/*
 * The console front-end, styled from `Consola.dc.html`.
 *
 * The design ships as inline styles on every element because that is what a design tool emits.
 * They are lifted into classes here for one reason that matters and one that is merely tidy:
 * the design's hover states live in a `style-hover` attribute its own runtime interprets, which
 * no browser does, so they would silently not exist; and a stylesheet is cacheable where a
 * hundred kilobytes of repeated inline declarations are not.
 *
 * The palette is the design's, transcribed literally. Every hex below appears in
 * `Consola.dc.html`; none was invented, adjusted or "improved".
 */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f5f5f1;
  --surface-3: #fafaf8;
  --ink: #17161b;
  --ink-2: #4a5666;
  --muted: #7b8492;
  --muted-2: #a6adb8;
  --line: #edede8;
  --line-2: #e4e2da;
  --divider: #f1f0eb;

  --brand: #4a3e86;
  --brand-hover: #3a3070;
  --brand-soft: #edeaf7;
  --brand-line: #dcd5f0;

  --ok-bg: #e9f0e8;
  --ok-fg: #4a6b45;
  --bad-bg: #f7e8ec;
  --bad-fg: #8a4257;
  --warn-bg: #fdebdd;
  --warn-fg: #8a5423;
  --warn-line: #f0d9be;
  --warn-surface: #fff8f0;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;

  --radius-card: 18px;
  --radius-ctl: 11px;
  --shadow-card: 0 1px 3px rgba(23, 22, 27, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-hover);
}
button {
  font-family: inherit;
}
::selection {
  background: var(--brand-soft);
  color: var(--ink);
}

.mono {
  font-family: var(--mono);
}
.hidden {
  display: none !important;
}
.spacer {
  flex: 1;
}

/* Screen-reader-only: the design has icon-only controls whose meaning is carried by the icon
   alone. An icon is not an accessible name, so each carries one of these. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm {
  width: 15px;
  height: 15px;
}
.icon-xs {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------------------------------------- */
/* Shell                                                                                      */
/* ---------------------------------------------------------------------------------------- */

.shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.aside {
  width: 262px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.22s ease;
}
.shell.mini .aside {
  width: 78px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
}
.shell.mini .logo-row {
  flex-direction: column;
  gap: 10px;
  padding: 20px 0 14px;
}
.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.logo-word {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.shell.mini .lbl {
  display: none;
}
.shell.mini .logo-row .spacer {
  display: none;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.toggle-icon {
  display: flex;
  transition: transform 0.22s ease;
}
.shell.mini .toggle-icon {
  transform: rotate(180deg);
}

.search-pad {
  padding: 0 16px 16px;
}
.shell.mini .search-pad {
  padding: 0 14px 16px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-ctl);
  background: var(--surface-2);
  border: none;
  width: 100%;
  overflow: hidden;
  cursor: pointer;
  color: var(--muted-2);
  font-size: 14px;
  text-align: left;
}
.shell.mini .search-box {
  justify-content: center;
  gap: 0;
  padding: 0;
}

.nav-group {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sec-lbl {
  padding: 22px 24px 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  color: var(--muted-2);
}
.shell.mini .sec-lbl {
  height: 1px;
  min-height: 1px;
  flex-shrink: 0;
  align-self: stretch;
  margin: 16px 18px 12px;
  padding: 0;
  background: var(--line);
  font-size: 0;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-ctl);
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.nav-item:hover {
  background: var(--surface-3);
}
.nav-item[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.shell.mini .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
}

.badge-count {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn-bg);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--warn-fg);
}
.badge-soon {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.shell.mini .badge-count,
.shell.mini .badge-soon {
  display: none;
}

.aside-foot {
  padding: 16px 12px 0;
  border-top: 1px solid var(--line);
  margin: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-pad {
  padding: 12px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  width: 100%;
  cursor: pointer;
  text-align: left;
}
.user-row:hover {
  background: #f9f9f6;
}
.shell.mini .user-row {
  justify-content: center;
  gap: 0;
  padding: 9px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar.grey {
  background: var(--surface-2);
  color: var(--muted);
}
.user-name {
  font-size: 13.5px;
  font-weight: 600;
}
.user-sub {
  font-size: 11.5px;
  color: var(--muted-2);
}
.user-chev {
  margin-left: auto;
  color: var(--muted-2);
  display: flex;
}
.shell.mini .user-chev {
  display: none;
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.company-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-ctl);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
}
.company-pick:hover {
  border-color: #d8d6ce;
}
.company-ruc {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}
.env-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.env-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7822f;
  display: block;
}
.env-pill.prod {
  background: var(--ok-bg);
  color: var(--ok-fg);
}
.env-pill.prod .env-dot {
  background: var(--ok-fg);
}
.topbar-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.view {
  padding: 28px 32px 48px;
}
.view.narrow {
  max-width: 1080px;
}
.view.narrower {
  max-width: 860px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.view-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-sub {
  font-size: 14.5px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------------------- */
/* Cards, tables, chips                                                                       */
/* ---------------------------------------------------------------------------------------- */

.card {
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.card-pad {
  padding: 22px 24px 24px;
}
.card-scroll {
  overflow: hidden;
  overflow-x: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}
.kpi {
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.kpi.attention {
  border: 1px solid var(--warn-line);
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-label {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.kpi-value {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.thead,
.trow {
  display: grid;
  gap: 16px;
  align-items: center;
}
.thead {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.trow {
  padding: 16px 22px;
  border-bottom: 1px solid var(--divider);
  font-size: 13.5px;
}
.trow:last-child {
  border-bottom: none;
}
.trow.revoked {
  opacity: 0.6;
}

.pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 4px 9px;
  border-radius: 999px;
  justify-self: start;
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}
.pill.bad {
  background: var(--bad-bg);
  color: var(--bad-fg);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.pill.neutral {
  background: var(--surface-2);
  color: var(--ink-2);
}
.pill.brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.scope-tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
}
.scope-tag.sharp {
  background: var(--brand-soft);
  color: var(--brand);
}
.scope-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.scope-chip {
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.scope-chip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------------------------------------------------------------------------------------- */
/* Buttons                                                                                    */
/* ---------------------------------------------------------------------------------------- */

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-ctl);
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}
.btn.primary {
  border: none;
  background: var(--brand);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--brand-hover);
  color: #fff;
}
.btn.danger {
  border: none;
  background: var(--bad-fg);
  color: #fff;
}
.btn.danger:hover:not(:disabled) {
  background: #733746;
  color: #fff;
}
.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}
.btn.md {
  height: 36px;
  padding: 0 15px;
  font-size: 13.5px;
  border-radius: 10px;
}
.btn.revoke {
  justify-self: end;
  color: var(--bad-fg);
}
.btn.revoke:hover:not(:disabled) {
  border-color: #c98fa0;
  background: #fdf6f7;
  color: var(--bad-fg);
}
.btn:disabled {
  cursor: not-allowed;
  background: #edece6;
  color: var(--muted-2);
  border-color: transparent;
}
.btn.primary:disabled {
  background: #edece6;
  color: var(--muted-2);
}

label.field {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 7px;
}
.input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-ctl);
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}
.input.mono {
  font-family: var(--mono);
  font-size: 13.5px;
}
.input:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------------------- */
/* Notices                                                                                    */
/* ---------------------------------------------------------------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}
.notice.brand {
  background: var(--brand-soft);
  color: var(--brand);
}
.notice.warn {
  background: var(--warn-surface);
  border: 1px solid var(--warn-line);
  color: var(--ink-2);
}
.notice.bad {
  background: #fdf6f7;
  border: 1px solid #f0d9de;
  color: var(--bad-fg);
}
.notice strong {
  font-weight: 600;
}

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

pre.raw {
  margin: 0;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: #e6e3ee;
  overflow-x: auto;
}
.raw-wrap {
  border-radius: 12px;
  background: #1b1a20;
  overflow: hidden;
}
.raw-key {
  color: #c4b5fd;
}
.raw-str {
  color: #9fd8b4;
}

/* ---------------------------------------------------------------------------------------- */
/* Activity                                                                                   */
/* ---------------------------------------------------------------------------------------- */

.act-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  align-items: start;
}
.act-row {
  display: grid;
  grid-template-columns: 86px 132px 52px minmax(0, 1fr);
  gap: 14px;
  min-width: 600px;
  align-items: center;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-bottom: 1px solid var(--divider);
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  color: inherit;
}
.act-row:hover {
  background: var(--surface-3);
}
.act-row[aria-selected="true"] {
  border-left-color: var(--brand);
  background: #f5f3fb;
}
.act-head {
  display: grid;
  grid-template-columns: 86px 132px 52px minmax(0, 1fr);
  gap: 14px;
  min-width: 600px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kv {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
}
.kv > span:first-child {
  color: var(--muted);
}
.kv > span:last-child {
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}

.artifact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-3);
  font-family: var(--mono);
  font-size: 12.5px;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.artifact-row:hover {
  background: var(--brand-soft);
}
.artifact-row:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
}

/* ---------------------------------------------------------------------------------------- */
/* Modal                                                                                      */
/* ---------------------------------------------------------------------------------------- */

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(23, 22, 27, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.modal {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 60px -20px rgba(23, 22, 27, 0.4);
  overflow: hidden;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-head {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 5px;
}
.modal-body {
  padding: 24px 26px;
}
.modal-foot {
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface-3);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.token-strip {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-3);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  overflow-x: auto;
  white-space: nowrap;
}
.checkline {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: inherit;
}
.checkline:hover {
  border-color: var(--brand);
}
.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d6d3c9;
  background: #fff;
  color: #fff;
}
.checkline[aria-checked="true"] .checkbox {
  border-color: var(--brand);
  background: var(--brand);
}

/* ---------------------------------------------------------------------------------------- */
/* Sign-in                                                                                    */
/* ---------------------------------------------------------------------------------------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg);
}
.gate-card {
  width: 100%;
  max-width: 430px;
}
.gate-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}
.gate-panel {
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 28px;
}
.gate-panel h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.gate-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}
.stack {
  display: grid;
  gap: 16px;
}

@media (max-width: 720px) {
  .aside {
    display: none;
  }
  .view,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
}
