/* ============================================================
   Catalogue Control — interface
   Same language as parsingapi.io: a near-black canvas lit from
   above, white as the accent, translucent hairline cards, pill
   controls, system type and mono for data.
   ============================================================ */

:root {
  color-scheme: dark;

  /* canvas */
  --bg: #050505;
  --bg-elevated: #0c0c0c;
  --surface: #0a0a0a;
  --surface-2: #111111;
  --surface-3: #171717;

  /* ink */
  --fg: #f8f8f8;
  --muted: #a0a0a0;
  --muted-2: #7c7c7c;
  --muted-3: #4e4e4e;

  /* hairlines */
  --border-subtle: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .2);

  /* accent */
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, .06);
  --accent-2: #9ae6ff;

  /* signal */
  --ok: #3bffb5;
  --ok-dim: rgba(59, 255, 181, .1);
  --bad: #ff5f57;
  --bad-dim: rgba(255, 95, 87, .1);
  --warn: #febc2e;
  --warn-dim: rgba(254, 188, 46, .08);

  /* shape */
  --r-xl: 32px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-soft: 0 32px 120px rgba(0, 0, 0, .65);
  --shadow-card: 0 24px 70px rgba(0, 0, 0, .5);

  /* type */
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;

  /* rhythm */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

/* class-level display rules must never beat the hidden attribute */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% -10%, #191919, #050505 58%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--fg);
  font: 400 15px/1.5 var(--font-ui);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(255, 255, 255, .18); }

/* the app stays invisible until the session is confirmed */
body.is-checking .shell,
body.is-checking .foot { opacity: 0; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

/* ---------------- floating nav ---------------- */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: rgba(8, 8, 8, .9);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
}

.topbar__start {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar__back {
  flex: none;
  font: 500 12px/1 var(--font-ui);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--r-pill);
  transition: color .16s var(--ease), background .16s var(--ease);
  white-space: nowrap;
}
.topbar__back:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, .06);
}
.topbar__back:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .55);
  outline-offset: 2px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: var(--r-pill);
}
.brand:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 3px; }

.brand__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-subtle);
}
.brand__mark svg { width: 24px; height: 24px; }

.logo-mark {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  border: 0;
  padding: 0;
}
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.logo-mark--compact {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.brand__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.brand__name {
  font: 600 14px/1.2 var(--font-ui);
  letter-spacing: .04em;
  text-transform: lowercase;
  color: var(--fg);
  white-space: nowrap;
}

.brand__sub {
  font: 400 9.5px/1.3 var(--font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* ---------------- pills & status ---------------- */

.pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font: 500 11px/1 var(--font-ui);
  letter-spacing: .01em;
  white-space: nowrap;
}

.pill--demo {
  color: var(--warn);
  border-color: rgba(254, 188, 46, .26);
  background: var(--warn-dim);
}
.pill--demo::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 400 11px/1 var(--font-mono);
  color: var(--muted-2);
  white-space: nowrap;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(59, 255, 181, .14);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
.sync[data-state="error"] .pulse {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(255, 95, 87, .14);
  animation: none;
}
.sync[data-state="loading"] .pulse {
  background: var(--fg);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .12);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .82; transform: scale(1.06); }
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .02);
  color: var(--fg);
  font: 500 12.5px/1 var(--font-ui);
  letter-spacing: .005em;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
    transform .16s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover { background: rgba(255, 255, 255, .07); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }

.btn--ghost { background: transparent; }
.btn--ghost:hover { background: rgba(255, 255, 255, .06); }

.btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .9);
}
.btn--primary:hover {
  background: #f1f1f1;
  border-color: transparent;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .95);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: .7; transform: none; box-shadow: none; }

.btn--block { width: 100%; height: 46px; font-size: 14px; }

.btn--link {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: 500 12.5px/1.3 var(--font-ui);
}
.btn--link:hover { background: none; color: var(--fg); border-color: transparent; }
.btn--link svg { transition: transform .18s var(--ease); }
.btn--link:hover svg { transform: translateX(2px); }

.iconbtn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease),
    border-color .16s var(--ease);
}
.iconbtn:hover { background: rgba(255, 255, 255, .06); color: var(--fg); border-color: var(--border); }
.iconbtn:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }

/* ---------------- content ---------------- */

.content {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding-top: 56px;
}

.eyebrow {
  margin: 0 0 10px;
  font: 500 11px/1 var(--font-ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------------- overview ---------------- */

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  animation: rise .6s var(--ease) both;
}

.overview__head h1 {
  margin: 0;
  max-width: 16ch;
  font: 600 clamp(30px, 3.4vw, 42px)/1.05 var(--font-ui);
  letter-spacing: -.04em;
  color: var(--fg);
  text-wrap: balance;
}

.overview__head h1 .highlight {
  background: linear-gradient(120deg, #ffffff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.overview__note {
  margin: 14px 0 0;
  max-width: 54ch;
  font: 400 13px/1.65 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}
.overview__note strong { color: var(--fg); font-weight: 500; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* metrics card — same anatomy as the landing hero metrics */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: radial-gradient(circle at top left, #161616, #0a0a0a 62%);
  box-shadow: var(--shadow-card);
}

.kpi { min-width: 0; }

.kpi dt {
  margin: 0;
  font: 500 11px/1.2 var(--font-ui);
  letter-spacing: .01em;
  color: var(--muted);
  white-space: nowrap;
}

.kpi dd {
  margin: 6px 0 0;
  font: 500 21px/1 var(--font-mono);
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  white-space: nowrap;
}

.kpi dd.kpi__dd--accent {
  background: linear-gradient(120deg, #ffffff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kpi .kpi__sub {
  display: block;
  margin-top: 5px;
  font: 400 10.5px/1.25 var(--font-ui);
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi .kpi__sub--ok { color: var(--ok); }
.kpi .kpi__sub--warn { color: var(--warn); }
.kpi .kpi__sub--bad { color: var(--bad); }

/* ---------------- panel ---------------- */

.panel { animation: rise .6s var(--ease) both; }
.content > .panel:nth-of-type(1) { animation-delay: .05s; }
.content > .panel:nth-of-type(2) { animation-delay: .1s; }

.panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel__head .eyebrow { margin-bottom: 6px; }

.panel__head h2 {
  margin: 0;
  font: 600 17px/1.2 var(--font-ui);
  letter-spacing: -.03em;
  color: var(--fg);
}

.panel__meta {
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  font: 400 10.5px/1 var(--font-mono);
  color: var(--muted-2);
  white-space: nowrap;
}

.legend {
  display: flex;
  gap: 14px;
  font: 400 11px/1 var(--font-ui);
  color: var(--muted-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.lg--ok { background: var(--ok); opacity: .7; }
.lg--bad { background: var(--bad); opacity: .85; }
.lg--next { background: transparent; border: 1px dashed rgba(255, 255, 255, .35); }

/* ---------------- automation card ---------------- */

.autos { display: grid; gap: 16px; }

.auto {
  position: relative;
  padding: 20px;
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: radial-gradient(circle at top left, #131313, #090909 58%);
  box-shadow: var(--shadow-card);
  transition: border-color .2s var(--ease);
}
.auto:hover { border-color: rgba(255, 255, 255, .14); }

.auto__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.auto__id { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.auto__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font: 600 16px/1.2 var(--font-ui);
  letter-spacing: -.02em;
  color: var(--fg);
}

.host {
  padding: 4px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .04);
  font: 400 10.5px/1 var(--font-mono);
  color: var(--muted);
  letter-spacing: 0;
}

.auto__sched {
  font: 400 12px/1.4 var(--font-mono);
  color: var(--muted-2);
}
.auto__sched b { color: var(--muted); font-weight: 500; }
.auto__tz { color: var(--muted-3); }

.auto__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font: 500 11px/1 var(--font-ui);
  white-space: nowrap;
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--ok {
  color: var(--ok);
  background: var(--ok-dim);
  border: 1px solid rgba(59, 255, 181, .24);
}
.status--ok i { box-shadow: 0 0 8px rgba(59, 255, 181, .8); }
.status--bad {
  color: var(--bad);
  background: var(--bad-dim);
  border: 1px solid rgba(255, 95, 87, .26);
}
.status--run {
  color: var(--ok);
  background: var(--ok-dim);
  border: 1px solid rgba(59, 255, 181, .24);
}
.status--run i { animation: pulse-dot 1.5s ease-in-out infinite; }
.status--idle {
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border-subtle);
}

.nextrun {
  font: 400 11px/1 var(--font-mono);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.nextrun b { color: var(--fg); font-weight: 500; }

/* ---------------- run strip (signature) ---------------- */

.strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.strip__bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 52px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1px;
}

.tick {
  position: relative;
  flex: 1 1 0;
  min-width: 5px;
  max-width: 22px;
  height: var(--h, 40%);
  min-height: 6px;
  padding: 0;
  border: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(59, 255, 181, .95), rgba(59, 255, 181, .3));
  opacity: .5;
  cursor: pointer;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.tick:hover { opacity: 1; transform: scaleY(1.02); }
.tick:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; opacity: 1; }
.tick--bad {
  background: linear-gradient(180deg, rgba(255, 95, 87, .95), rgba(255, 95, 87, .3));
  opacity: .68;
}
.tick--bad:hover { opacity: 1; }
.tick--last { opacity: 1; }
.tick--next {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, .3);
  border-radius: 3px 3px 0 0;
  opacity: 1;
  cursor: default;
  min-height: 10px;
}
.tick--next:hover { transform: none; opacity: 1; }
.tick:disabled { cursor: default; }

.strip__axis {
  display: flex;
  justify-content: space-between;
  font: 400 9.5px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-3);
}

/* ---------------- outcomes ---------------- */

.outcomes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.outcome { min-width: 0; }

.outcome__v {
  font: 500 17px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--fg);
}
.outcome__v--muted { color: var(--muted-3); }

.outcome__l {
  margin-top: 6px;
  font: 400 11px/1.25 var(--font-ui);
  color: var(--muted-2);
  letter-spacing: .005em;
}

.outcome__d {
  display: inline-block;
  margin-left: 5px;
  font: 500 10.5px/1 var(--font-mono);
  color: var(--ok);
  vertical-align: 1px;
}
.outcome__d--down { color: var(--bad); }

/* ---------------- automation footer ---------------- */

.auto__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.auto__when {
  font: 400 11px/1.3 var(--font-mono);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.auto__when .sep { color: var(--muted-3); padding: 0 6px; }

.auto__actions { display: flex; align-items: center; gap: 16px; }

/* ---------------- feed ---------------- */

.feed {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: rgba(10, 10, 10, .92);
  box-shadow: var(--shadow-card);
}

.feed__row {
  display: grid;
  grid-template-columns: 8px 148px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .16s var(--ease);
}
.feed li:first-child .feed__row { border-top: 0; }
.feed__row:hover { background: rgba(255, 255, 255, .045); }
.feed__row:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: -2px; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  justify-self: center;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(59, 255, 181, .55);
}
.dot--bad { background: var(--bad); box-shadow: 0 0 8px rgba(255, 95, 87, .55); }

.feed__when {
  font: 400 11px/1 var(--font-mono);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feed__text {
  min-width: 0;
  font: 400 13px/1.45 var(--font-ui);
  color: var(--muted);
}
.feed__text b { color: var(--fg); font-weight: 500; }
.feed__text em { font-style: normal; color: var(--muted-2); }

.feed__dur {
  font: 400 11px/1 var(--font-mono);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feed__chev {
  color: var(--muted-3);
  justify-self: end;
  transition: transform .18s var(--ease), color .18s var(--ease);
}
.feed__row:hover .feed__chev { transform: translateX(2px); color: var(--muted); }

/* ---------------- footer ---------------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font: 400 11px/1.4 var(--font-ui);
  color: var(--muted-2);
}

/* ---------------- run sheet ---------------- */

/* a <dialog> must stay hidden until opened — display:flex would override it */
.sheet:not([open]) { display: none; }

.sheet {
  width: min(780px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  color: var(--fg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
}
.sheet::backdrop {
  background: rgba(5, 5, 5, .72);
  backdrop-filter: blur(6px);
}
.sheet[open] { animation: sheet-in .28s var(--ease); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.sheet:focus { outline: none; }

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 24px 18px;
}

.sheet__headText { min-width: 0; }

.sheet__title {
  margin: 0;
  font: 600 22px/1.15 var(--font-ui);
  letter-spacing: -.03em;
  color: var(--fg);
}

.sheet__meta {
  margin: 8px 0 0;
  font: 400 11px/1.5 var(--font-mono);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* segmented tabs, matching the pill controls */

.tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 3px;
  margin: 0 24px 18px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .03);
}

.tab {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--muted);
  font: 500 12.5px/1 var(--font-ui);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.tab:hover { color: var(--fg); background: rgba(255, 255, 255, .05); }
.tab[aria-selected="true"] {
  background: rgba(255, 255, 255, .1);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.tab:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }

.sheet__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 220px;
}

/* digest */

.digest { padding: 4px 24px 24px; }

.digest__lead {
  margin: 0 0 18px;
  max-width: 62ch;
  font: 400 14px/1.65 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}
.digest__lead b { color: var(--fg); font-weight: 600; }

.findings {
  margin: 0;
  border-top: 1px solid var(--border-subtle);
}

.finding {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.finding__k { font: 400 13px/1.4 var(--font-ui); color: var(--muted); }

.finding__v {
  font: 500 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  white-space: nowrap;
}
.finding__v--muted { color: var(--muted-3); font-weight: 400; }
.finding__v--text {
  max-width: 36ch;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.finding__link {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, .3);
}
.finding__link:hover { color: var(--accent-2); }

.notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(254, 188, 46, .24);
  background: var(--warn-dim);
  font: 400 12.5px/1.55 var(--font-ui);
  color: var(--muted);
}
.notice--bad { border-color: rgba(255, 95, 87, .26); background: var(--bad-dim); }
.notice b {
  display: block;
  margin-bottom: 6px;
  font: 500 10.5px/1 var(--font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--warn);
}
.notice--bad b { color: var(--bad); }
.notice ul { margin: 0; padding-left: 16px; }
.notice li {
  margin: 4px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-word;
}

/* log — same shell idea as the code block on the landing page */

pre.log {
  margin: 0;
  padding: 20px 24px;
  max-height: none;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, .35);
  font: 400 11.5px/1.7 var(--font-mono);
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}
pre.log:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: -2px; }

.sheet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 10, 10, .9);
}
.sheet__footNote { font: 400 10.5px/1 var(--font-mono); color: var(--muted-3); }
.sheet__footActions { display: flex; gap: 8px; }

/* ---------------- empty / error ---------------- */

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font: 400 13px/1.6 var(--font-ui);
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: var(--r-lg);
}
.empty b { display: block; color: var(--fg); font-weight: 500; margin-bottom: 4px; }

/* ---------------- account ---------------- */

.account { position: relative; }

.account__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .03);
  color: var(--fg);
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.account__btn:hover { background: rgba(255, 255, 255, .07); border-color: var(--border); }
.account__btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }
.account__btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, .08);
  border-color: var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .1);
  color: var(--fg);
  font: 600 10px/1 var(--font-ui);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.account__name {
  max-width: 15ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 12.5px/1 var(--font-ui);
  color: var(--fg);
}

.account__chev { color: var(--muted-2); transition: transform .18s var(--ease); }
.account__btn[aria-expanded="true"] .account__chev { transform: rotate(180deg); }

.menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  width: 252px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
  animation: menu-in .16s var(--ease);
}
.menu[hidden] { display: none; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.menu__head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.menu__name { font: 500 12.5px/1.3 var(--font-ui); color: var(--fg); }
.menu__email {
  font: 400 11px/1.35 var(--font-mono);
  color: var(--muted-2);
  overflow-wrap: anywhere;
}
.menu__meta {
  margin-top: 4px;
  font: 400 9.5px/1.35 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-3);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: 500 12.5px/1 var(--font-ui);
  text-align: left;
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.menu__item:hover { background: rgba(255, 255, 255, .06); color: var(--fg); }
.menu__item:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: -2px; }
.menu__item--danger { color: #ff8d86; }
.menu__item--danger:hover { background: var(--bad-dim); color: #ffb4ae; }

/* ============================================================
   Sign-in — same canvas, one card, no ceremony
   ============================================================ */

.auth-body { background-color: var(--bg); }

.auth {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 24px 40px;
}

.auth__rail {
  position: sticky;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  background: rgba(8, 8, 8, .9);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
}

.auth__railActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand--rail { align-self: center; }

.auth__pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 56px 0 24px;
}

.auth__card {
  position: relative;
  width: min(404px, 100%);
  padding: 30px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  background: radial-gradient(circle at top left, #161616, #0a0a0a 60%);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.auth__card::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 62%;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .1), transparent 62%);
  opacity: .55;
  pointer-events: none;
}
.auth__card > * { position: relative; z-index: 1; }
.auth__card.is-shaking { animation: shake .42s var(--ease); }

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

.auth__head { margin-bottom: 24px; }

.auth__title {
  margin: 0;
  font: 600 30px/1.08 var(--font-ui);
  letter-spacing: -.04em;
  color: var(--fg);
}

.auth__sub {
  margin: 10px 0 0;
  font: 400 13px/1.55 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}

.auth__form { display: grid; gap: 16px; }

/* fields */

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.field > label,
.field__row label {
  font: 500 10.5px/1 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.field__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-2);
  font: 400 11.5px/1 var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, .18);
  cursor: pointer;
  transition: color .16s var(--ease), text-decoration-color .16s var(--ease);
}
.field__link:hover { color: var(--fg); text-decoration-color: rgba(255, 255, 255, .45); }
.field__link:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 3px; border-radius: 2px; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .03);
  color: var(--fg);
  font: 400 14px/1 var(--font-ui);
  letter-spacing: .005em;
  transition: border-color .16s var(--ease), background .16s var(--ease),
    box-shadow .16s var(--ease);
}
.input::placeholder { color: var(--muted-3); }
.input:hover { border-color: rgba(255, 255, 255, .2); }
.input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .05);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .08);
}
.input:read-only { opacity: .6; }

/* Chrome paints its own yellow autofill background */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 60px #0f0f0f inset;
  caret-color: var(--fg);
}

.pw { position: relative; }
.pw .input { padding-right: 48px; }

.pw__toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.pw__toggle:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
.pw__toggle:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 1px; }

.field__hint {
  margin: 0;
  font: 400 10.5px/1.3 var(--font-mono);
  color: var(--warn);
  letter-spacing: .02em;
}

/* checkbox */

.check {
  position: relative;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 2px 0;
  cursor: pointer;
}

.check input {
  position: absolute;
  top: 2px;
  left: 0;
  width: 17px;
  height: 17px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check__box {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 6px;
  background: rgba(255, 255, 255, .03);
  transition: background .16s var(--ease), border-color .16s var(--ease),
    transform .1s var(--ease);
}
.check__box svg { opacity: 0; transform: scale(.55); transition: opacity .14s var(--ease), transform .18s var(--ease); }
.check__box svg path { stroke: #000; }

.check:hover .check__box { border-color: rgba(255, 255, 255, .35); }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box svg { opacity: 1; transform: none; }
.check input:active + .check__box { transform: scale(.94); }
.check input:focus-visible + .check__box { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }

.check__label { font: 400 12.5px/1.35 var(--font-ui); color: var(--muted); }
.check:hover .check__label { color: var(--fg); }

/* busy state */

.btn .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, .2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .68s linear infinite;
}
.btn[aria-busy="true"] .spinner { display: inline-block; }
.btn[aria-busy="true"] .btn__label { opacity: .8; }

@keyframes spin { to { transform: rotate(360deg); } }

/* messages */

.auth__flash,
.auth__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font: 400 12px/1.5 var(--font-ui);
  text-wrap: pretty;
}
.auth__flash svg,
.auth__error svg { flex: none; margin-top: 1px; }

.auth__flash {
  margin-bottom: 18px;
  border: 1px solid rgba(59, 255, 181, .24);
  background: var(--ok-dim);
  color: #9dffd3;
}

.auth__error {
  border: 1px solid rgba(255, 95, 87, .28);
  background: var(--bad-dim);
  color: #ffb0aa;
}

.auth__foot {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font: 400 11.5px/1.55 var(--font-ui);
  color: var(--muted-2);
  text-wrap: pretty;
}

.auth__legal {
  margin: 0;
  text-align: center;
  font: 400 9.5px/1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-3);
}

.sheet--narrow { width: min(440px, calc(100vw - 32px)); }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .shell { padding: 14px 20px 56px; }
  .content { gap: 44px; padding-top: 44px; }
  .overview { grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
  .overview__head h1 { max-width: 22ch; }
  .kpis { padding: 18px 20px; }
  .feed__row { grid-template-columns: 8px minmax(0, 1fr) auto; gap: 3px 16px; }
  .feed__when { grid-column: 2; grid-row: 1; }
  .feed__text { grid-column: 2; grid-row: 2; }
  .feed__dur { grid-column: 3; grid-row: 2; }
  .dot { grid-row: 1 / span 2; }
  .feed__chev { display: none; }
}

@media (max-width: 620px) {
  .shell { padding: 12px 16px 48px; }
  .content { gap: 36px; padding-top: 36px; }
  .topbar { gap: 10px; padding: 7px 8px 7px 10px; }
  .topbar__start { gap: 8px; min-width: 0; }
  .topbar__back { display: none; }
  .brand__sub { display: none; }
  .brand__name { font-size: 13px; }
  .logo-mark--compact { width: 36px; height: 36px; }
  .topbar__actions { gap: 8px; }
  .sync #syncText { display: none; }
  #demoBadge { display: none; }
  #refreshBtn { padding: 0 10px; }
  #refreshBtn .btn__text { display: none; }
  .account__name { display: none; }
  .account__btn { padding: 0 8px 0 5px; }
  .menu { width: min(252px, calc(100vw - 32px)); }
  .overview__head h1 { font-size: 28px; }
  .kpi dd { font-size: 19px; }
  .legend { display: none; }
  .panel__head { align-items: flex-start; }
  .panel__meta { margin-top: 2px; }
  .auto { padding: 16px; }
  .auto__top { flex-direction: column; gap: 12px; }
  .auto__side { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
  .outcomes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .auto__foot { flex-direction: column; align-items: flex-start; gap: 10px; }
  .strip__bars { height: 46px; }
  .sheet {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    margin: auto auto 0;
  }
  .sheet__head,
  .sheet__foot { padding-left: 18px; padding-right: 18px; }
  .tabs { margin: 0 18px 16px; }
  .digest { padding: 2px 18px 20px; }
  pre.log { padding: 16px 18px; }
  .foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .auth { padding: 12px 16px 32px; }
  .auth__rail { padding: 7px 8px 7px 10px; }
  .auth__pane { padding: 40px 0 16px; }
  .auth__card { padding: 24px 20px 22px; border-radius: 26px; }
  .auth__title { font-size: 26px; }
  .menu { right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .tick:hover { transform: none; }
  .btn--primary:hover { transform: none; }
  .overview, .panel { animation: none; }
}
