/* =========================================================================
   Supace — auth pages (login / signup / reset / callback / account)
   Reuses the design tokens from styles.css. Same hell/edel/premium look.
   ========================================================================= */

/* The [hidden] attribute must win even when an element also has a
   display:flex class (auth-status / auth-form) — otherwise view-toggling
   between the loading / form / error states leaves stale views visible. */
[hidden] { display: none !important; }

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
  position: relative;
  overflow: clip;
}
.auth-wrap::before {
  content: "";
  position: absolute;
  top: -240px;
  left: 50%;
  width: 900px;
  height: 560px;
  max-width: 140vw;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(20, 150, 172, 0.13), rgba(20, 150, 172, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 424px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.75rem, 4vw, 2.5rem);
}

/* =========================================================================
   Split-screen auth (login / signup / reset / verify): form + brand showcase
   Left = form on the light surface. Right = dark navy showcase with the app's
   real selling points. Showcase is desktop-only; mobile shows just the form.
   ========================================================================= */
.auth-split {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 940px) {
  .auth-split { grid-template-columns: 1fr 1fr; }
}

/* Left column: the form side */
.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 3rem;
  background: var(--surface);
}
/* Inside the split the card goes flat — the column already frames it. */
.auth-panel .auth-card {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  max-width: 392px;
}
.auth-panel .auth-foot,
.auth-panel .auth-legal { max-width: 392px; }

/* Left column: the light brand showcase (à la Final Round — light, serif
   italic claim, product value props). order:-1 puts it in the FIRST column. */
.auth-showcase {
  display: none;
  order: -1;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  gap: 2.25rem;
  padding: clamp(2.5rem, 4vw, 4.5rem);
  color: var(--ink-soft);
  border-right: 1px solid var(--border);
  background:
    radial-gradient(70% 45% at 15% 5%, rgba(24, 159, 187, 0.07), transparent 60%),
    var(--surface-alt);
}
@media (min-width: 940px) {
  .auth-showcase { display: flex; }
}

/* On short viewports there isn't room for the product visual next to the
   claim and the list — drop the visual rather than let it push the column
   past the fold. */
@media (max-height: 760px) {
  .showcase-visual { display: none; }
}

.showcase-logo {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.showcase-logo img { width: 30px; height: 30px; object-fit: contain; }

/* Logo pinned to the top of the column, the body optically centred in the
   space left under it. */
.showcase-body { position: relative; z-index: 1; margin-block: auto; }
.showcase-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 1rem;
}
/* Plain ink, no gradient fill — at this size a gradient reads as a trick;
   the serif carries the elegance on its own. */
.showcase-claim {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.05rem, 3.1vw, 2.9rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
  max-width: 15ch;
  color: var(--ink);
}
.showcase-lead {
  font-size: 1.02rem;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 36ch;
  margin-bottom: 1.75rem;
}
.showcase-list {
  display: flex; flex-direction: column; gap: 0;
  border-top: 1px solid var(--border);
}
.showcase-list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.96rem;
  color: var(--ink);
}
.showcase-list li svg {
  width: 20px; height: 20px;
  color: var(--teal-deep);
  flex-shrink: 0;
  margin-top: 0.08em;
}

/* ---------- Product visual on the auth showcase side ----------
   The sign-in page used to be a text list next to a form, which told a new
   visitor nothing about what they were signing up for. Same glass overlay
   language as the homepage so the two read as one product. */
.showcase-visual {
  position: relative;
  margin-top: 1.75rem;
  border-radius: var(--radius-md);
  padding: 0.85rem 0.85rem 5.25rem;
  background: linear-gradient(165deg, #16213a 0%, #0b1322 100%);
  border: 1px solid rgba(11, 18, 32, 0.1);
  box-shadow: 0 26px 60px -24px rgba(11, 18, 32, 0.42);
}
.sv-bar { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.7rem; }
.sv-dots { display: flex; gap: 4px; }
.sv-dots span { width: 7px; height: 7px; border-radius: 50%; }
.sv-dots span:nth-child(1) { background: #ff5f57; }
.sv-dots span:nth-child(2) { background: #febc2e; }
.sv-dots span:nth-child(3) { background: #28c840; }
.sv-title { font-size: 0.68rem; color: #7c8699; }

.sv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sv-tile {
  position: relative;
  aspect-ratio: 16 / 11;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
  background:
    radial-gradient(70% 60% at 50% 22%, rgba(255,255,255,0.09), transparent 62%),
    linear-gradient(165deg, #24314f 0%, #131c30 100%);
}
.sv-tile:last-child {
  background:
    radial-gradient(70% 60% at 50% 22%, rgba(79, 214, 230, 0.14), transparent 62%),
    linear-gradient(165deg, #1c2c48 0%, #101827 100%);
}
.sv-tile::before {
  content: ""; position: absolute; left: 50%; top: 25%;
  width: 25%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%;
  background: linear-gradient(160deg, rgba(255,255,255,0.28), rgba(255,255,255,0.1));
}
.sv-tile::after {
  content: ""; position: absolute; left: 50%; bottom: -15%;
  width: 60%; aspect-ratio: 1.5; transform: translateX(-50%); border-radius: 50% 50% 0 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.2), rgba(255,255,255,0.06));
}

.sv-overlay {
  position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0.85rem;
  border-radius: 10px;
  padding: 0.7rem 0.8rem 0.75rem;
  background: linear-gradient(165deg, rgba(17, 27, 48, 0.64), rgba(9, 14, 26, 0.78));
  border: 1px solid rgba(140, 220, 235, 0.28);
  box-shadow: 0 16px 34px -12px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
}
.sv-head {
  display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.5rem;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.04em; color: #7de6da;
}
.sv-head i {
  width: 5px; height: 5px; border-radius: 50%; background: #4fe6c8;
  box-shadow: 0 0 0 3px rgba(79,230,200,0.2);
}
.sv-q {
  font-size: 0.76rem; font-style: italic; line-height: 1.4; color: #eef1f7;
  padding-bottom: 0.5rem; margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sv-points { display: flex; flex-direction: column; gap: 0.28rem; }
.sv-points li {
  display: flex; gap: 0.45rem; align-items: flex-start;
  font-size: 0.72rem; line-height: 1.35; color: #d6dbe8;
  padding: 0; border: none;
}
.sv-points li::before {
  content: ""; width: 3px; height: 3px; margin-top: 0.5em; border-radius: 50%;
  background: #4fd6e6; flex-shrink: 0;
}
.showcase-foot {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* SSL / trust badge under the form (Final Round shows this) */
.auth-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.auth-trust svg { width: 14px; height: 14px; color: var(--teal-deep); flex-shrink: 0; }

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 1.6rem;
}
.auth-logo img { width: 32px; height: 32px; object-fit: contain; }

.auth-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.65rem;
  font-weight: 570;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.auth-sub {
  color: var(--muted);
  font-size: 0.94rem;
  margin-bottom: 1.6rem;
}
.auth-sub a { color: var(--teal-deep); font-weight: 600; }
.auth-sub a:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.auth-alert {
  display: none;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.2rem;
  border: 1px solid transparent;
}
.auth-alert.is-shown { display: flex; }
.auth-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 0.12em; }
.auth-alert.error {
  background: #fdf2f1;
  border-color: #f3d4d0;
  color: #8f2c22;
}
.auth-alert.success {
  background: #eefaf2;
  border-color: #c9ecd6;
  color: #1c6b3f;
}
.auth-alert.info {
  background: #eef7fa;
  border-color: #cfe8ef;
  color: #0e5c6b;
}

/* ---------- Form ---------- */
.auth-form { display: flex; flex-direction: column; gap: 1.05rem; }

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.field-row a { font-size: 0.8rem; color: var(--teal-deep); font-weight: 600; }
.field-row a:hover { text-decoration: underline; }

.input-shell { position: relative; display: flex; }
.field input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.96rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field input::placeholder { color: #a6abb5; }
.field input:focus {
  outline: none;
  border-color: var(--teal-deep);
  box-shadow: 0 0 0 3px rgba(20, 150, 172, 0.16);
}
.field input[aria-invalid="true"] {
  border-color: #cf4a3c;
}
.field input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(207, 74, 60, 0.16);
}
.field.has-toggle input { padding-right: 2.9rem; }

.pw-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border-radius: 7px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle:hover { color: var(--ink-soft); background: var(--surface-alt); }

.field-hint { font-size: 0.78rem; color: var(--muted); }
.field-error {
  font-size: 0.8rem;
  color: #b23124;
  font-weight: 500;
  display: none;
}
.field-error.is-shown { display: block; }

/* ---------- Terms checkbox ---------- */
.field-check { display: flex; flex-direction: column; gap: 0.4rem; }
.field-check .check-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.field-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  flex-shrink: 0;
  accent-color: var(--navy);
  cursor: pointer;
}
.field-check label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
  cursor: pointer;
}
.field-check a { color: var(--teal-deep); font-weight: 600; }
.field-check a:hover { text-decoration: underline; }

.auth-form .btn { margin-top: 0.35rem; }

/* ---------- Google / OAuth button ---------- */
.btn-google {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  font-weight: 600;
}
.btn-google:hover { border-color: var(--navy); background: var(--surface); transform: translateY(-1px); }
.btn-google svg { width: 18px; height: 18px; }

/* ---------- Divider ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.2rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Footer links under the card ---------- */
.auth-foot {
  position: relative;
  z-index: 1;
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-foot a { color: var(--ink-soft); font-weight: 600; }
.auth-foot a:hover { color: var(--ink); text-decoration: underline; }

.auth-legal {
  position: relative;
  z-index: 1;
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 420px;
}
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-legal a:hover { color: var(--ink-soft); }

/* ---------- Loading / status (callback, account) ---------- */
.auth-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}
.spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--teal-deep);
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
}

/* Big centered glyph used on verify-email / success screens */
.auth-badge {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 50%;
  margin-bottom: 1.2rem;
  background: linear-gradient(150deg, rgba(18, 40, 92, 0.09), rgba(20, 150, 172, 0.14));
  color: var(--navy);
}
.auth-badge svg { width: 26px; height: 26px; }

/* ---------- Account (placeholder logged-in) ---------- */
.account-meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.4rem 0 1.6rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}
.account-row .k { color: var(--muted); }
.account-row .v { color: var(--ink); font-weight: 600; word-break: break-word; text-align: right; }
.account-note {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* =========================================================================
   Dashboard (/account)
   ========================================================================= */
.dash {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1.5rem 4rem;
}
.dash-inner { width: 100%; max-width: 560px; margin-inline: auto; }

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.7rem;
  font-weight: 580;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.dash-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.75rem; }

.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.5rem 1.6rem;
  margin-bottom: 1.25rem;
}
.dash-section-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.15rem;
}
.dash-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.12rem;
  font-weight: 570;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.dash-hint { font-size: 0.82rem; color: var(--muted); margin-top: 0.8rem; line-height: 1.5; }

/* Left-align the save button inside the (flex-column) profile form */
.dash-section form > .btn { align-self: flex-start; }

.badge-soon {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal-deep);
  background: rgba(20, 150, 172, 0.1);
  border: 1px solid rgba(20, 150, 172, 0.22);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

/* Role pill (read-only, informational) */
.role-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.role-pill.role-user { background: var(--surface-alt); border: 1px solid var(--border-strong); color: var(--ink-soft); }
.role-pill.role-unlimited { background: linear-gradient(135deg, var(--navy), var(--teal-deep)); color: #fff; }

/* Credits placeholder */
.credits-value { font-size: 1.5rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.credits-note { font-size: 0.84rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.5; }

/* =========================================================================
   Dashboard polish (account.html)
   ========================================================================= */
/* =========================================================================
/* =========================================================================
   Dashboard shell (account.html) — labeled sidebar + content column.
   Restrained/premium: no decorative filler, generous space, real data only.
   ========================================================================= */
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; background: var(--bg); }

/* ---------------- Sidebar ---------------- */
.sb {
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh; height: 100dvh; width: 252px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 1.35rem 0.85rem 1rem;
  background: var(--surface); border-right: 1px solid var(--border);
}
.sb-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 0.55rem 0.35rem; margin-bottom: 1.4rem;
}
.sb-brand span { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }

.sb-nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sb-item {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--ink-soft);
  padding: 0.62rem 0.6rem; border-radius: 10px;
  border: none; background: transparent; cursor: pointer; text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sb-item svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--muted); transition: color .15s var(--ease); }
.sb-item:hover { background: var(--surface-alt); color: var(--ink); }
.sb-item:hover svg { color: var(--ink-soft); }
.sb-item.is-active { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: 0 4px 14px -6px rgba(18, 40, 92, 0.45); }
.sb-item.is-active svg { color: #fff; }

.sb-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: 0.15rem; }
.sb-link { font-weight: 500; }

.sb-user {
  display: flex; align-items: center; gap: 0.6rem;
  margin-top: 0.7rem; padding: 0.6rem 0.55rem 0.2rem;
  border-top: 1px solid var(--border);
}
.sb-user-av {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; font-size: 0.85rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--teal-deep));
}
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sb-user-name {
  font-size: 0.86rem; font-weight: 650; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-tier {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.sb-user-tier.is-hi { color: var(--teal-deep); }
.sb-logout {
  flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; border: none; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sb-logout svg { width: 17px; height: 17px; }
.sb-logout:hover { background: #fdf2f1; color: #b23124; }

/* ---------------- Main column ---------------- */
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar-banner {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.7rem 1.9rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 0.87rem; color: var(--ink-soft);
}
.topbar-banner-text b { color: var(--ink); font-weight: 650; }
.topbar-banner-link { font-weight: 650; color: var(--teal-deep); white-space: nowrap; }
.topbar-banner-link:hover { text-decoration: underline; }
.topbar-banner-x {
  margin-left: auto; flex-shrink: 0; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 7px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
}
.topbar-banner-x svg { width: 15px; height: 15px; }
.topbar-banner-x:hover { background: var(--surface-alt); color: var(--ink); }

.app-content { flex: 1 1 auto; width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.9rem 1.9rem 4rem; }

/* ---------------- Welcome hero ---------------- */
.hero-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(52rem 26rem at 6% -25%, rgba(20, 150, 172, 0.06), transparent 62%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.9rem 2rem;
  margin-bottom: 1.15rem; scroll-margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.hero-title {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-size: 1.85rem; font-weight: 580; letter-spacing: -0.01em; color: var(--ink);
}
.hero-sub { font-size: 0.95rem; color: var(--muted); margin-top: 0.4rem; }
.hero-cta { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.3rem; }

/* ---------------- Stat tiles ---------------- */
.stats { display: grid; gap: 1.15rem; margin-bottom: 1.15rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.stat-link:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.stat-ic { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #fff; }
.stat-ic svg { width: 19px; height: 19px; }
.stat-ic-sessions { background: linear-gradient(135deg, #12285c, #2d5fa8); }
.stat-ic-credits  { background: linear-gradient(135deg, #0e7c8f, #189fbb); }
.stat-ic-access   { background: linear-gradient(135deg, #1b3a7a, #189fbb); }
.stat-label {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.stat-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-top: 0.85rem; line-height: 1.1; }
.stat-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

/* ---------------- Low-balance banner ---------------- */
.fuel {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.35rem; margin-bottom: 1.15rem;
  border-radius: var(--radius-md);
  background: #fdf7e8; border: 1px solid #f0e2bd;
}
.fuel-ic {
  width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 10px; background: rgba(180, 140, 30, 0.14); color: #8a6d1f;
}
.fuel-ic svg { width: 18px; height: 18px; }
.fuel-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.15rem; }
.fuel-text b { font-size: 0.94rem; font-weight: 650; color: #6b5415; }
.fuel-text span { font-size: 0.84rem; color: #8a6d1f; }
.fuel .btn { flex-shrink: 0; }

/* ---------------- Panels ---------------- */
.app-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.5rem 1.6rem;
  margin-bottom: 1.15rem; scroll-margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.app-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin-bottom: 1.15rem; }
.app-panel-title {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-size: 1.15rem; font-weight: 570; color: var(--ink); letter-spacing: -0.005em;
}
.app-two { display: grid; gap: 1.15rem; }
@media (min-width: 900px) { .app-two { grid-template-columns: 1fr 1fr; } .app-two .app-panel { margin-bottom: 0; } }
.app-divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0 1.1rem; }

/* ---------------- Weekly activity chart ----------------
   One series → one hue (#189fbb, validated on the light surface). Text wears text
   tokens, never the data color. Grid is a recessive solid hairline, never dashed. */
.chart-sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.chart-head-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.chart-total { font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.chart-total small { font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.chart-toggle {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
  padding: 0.32rem 0.6rem; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.chart-toggle:hover { border-color: var(--navy); color: var(--ink); background: var(--surface-alt); }

.chart-wrap { position: relative; }
.chart-svg svg { display: block; width: 100%; height: auto; overflow: visible; }

.cx-grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.cx-bar { fill: #189fbb; }
.cx-bar-empty { fill: var(--border-strong); }
.cx-tick, .cx-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; fill: var(--muted);
}
.cx-hit { fill: transparent; cursor: default; outline: none; }
.cx-hit:hover ~ .cx-bar { opacity: 1; }
.cx-hit:focus-visible { fill: rgba(24, 159, 187, 0.08); }

.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0.7rem; border-radius: 9px;
  background: #0b1220; color: #e8edf6;
  box-shadow: 0 10px 26px -10px rgba(11, 18, 32, 0.5);
  white-space: nowrap;
}
.chart-tip strong { font-size: 0.92rem; font-weight: 700; color: #fff; }   /* value leads */
.chart-tip span { font-size: 0.74rem; color: #9fb0cc; }                     /* label follows */

.chart-table table { width: 100%; border-collapse: collapse; }
.chart-table th, .chart-table td {
  text-align: left; font-size: 0.86rem; padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border); color: var(--ink-soft);
}
.chart-table th {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.chart-table td.num, .chart-table th:last-child { text-align: right; }
.chart-table td.num { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.chart-table tr:last-child td { border-bottom: none; }
.chart-note { font-size: 0.82rem; color: var(--muted); margin-top: 0.85rem; }

/* "In the app" pill in a panel head */
.badge-app {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-alt); border: 1px solid var(--border);
  padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap;
}

/* Empty-state row inside a panel (icon + explanation) */
.dash-empty { display: flex; gap: 0.9rem; align-items: flex-start; }
.dash-empty .ic {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 11px;
  background: var(--surface-alt); color: var(--teal-deep);
}
.dash-empty .ic svg { width: 20px; height: 20px; }
.dash-empty p { font-size: 0.89rem; color: var(--ink-soft); line-height: 1.55; margin: 0.2rem 0 0; }
.dash-empty p b { color: var(--ink); font-weight: 650; }

/* ---------------- Small screens ---------------- */
@media (max-width: 780px) {
  .sb { display: none; }
  .app-content { padding: 1.4rem 1.1rem 3rem; }
  .topbar-banner { padding: 0.7rem 1.1rem; }
  .hero-card { padding: 1.4rem 1.25rem; }
  .hero-title { font-size: 1.45rem; }
}

/* --- Interview sessions — rows with a Review action --- */
.sess-note { font-size: 0.88rem; color: var(--muted); padding: 0.4rem 0; }
.sess-list { display: flex; flex-direction: column; gap: 0.55rem; }

.sess-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.sess-row:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.sess-open {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.18rem;
  font: inherit; text-align: left; border: none; background: transparent; cursor: pointer; padding: 0;
}
.sess-open:focus-visible { outline: 2.5px solid var(--teal-deep); outline-offset: 3px; border-radius: 6px; }
.sess-title {
  font-weight: 650; color: var(--ink); font-size: 0.95rem; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sess-meta { font-size: 0.79rem; color: var(--muted); }
.sess-right { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.sess-review { white-space: nowrap; }
@media (max-width: 560px) {
  .sess-row { flex-wrap: wrap; }
  .sess-right { width: 100%; justify-content: flex-end; }
}

/* =========================================================================
   Reader / preview sheet — used by BOTH the session transcript and the
   document preview.

   It used to be a drawer sliding in from the right, 760px wide against the
   full page. That is the wrong shape for the thing being shown: an A4 document
   in a narrow column is small and needs constant scrolling, and a transcript
   sat in a strip while most of the screen stayed dimmed and empty. A centred
   sheet gives the content the middle of the screen and roughly twice the area.
   ========================================================================= */
.reader-overlay {
  position: fixed; inset: 0; z-index: 220;
  display: grid; place-items: center;
  padding: clamp(0.75rem, 3vw, 2.5rem);
  background: rgba(11, 18, 32, 0.42);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: reader-fade .18s var(--ease);
}
.reader-panel {
  position: relative;
  /* 1180px, centred — the full-screen experiment felt too big. The close
     button no longer depends on the sheet's size: it is pinned to the sheet's
     own top-right corner, so this can be any width without it drifting. */
  width: min(1180px, 100%);
  height: min(94vh, 100%);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 40px 90px -30px rgba(11, 18, 32, 0.45);
  animation: reader-rise .24s var(--ease);
}
/* On a phone the sheet simply IS the screen — a rounded card with margins
   would waste the little space there is. */
@media (max-width: 640px) {
  .reader-overlay { padding: 0; }
  .reader-panel { width: 100%; height: 100%; border-radius: 0; border: none; }
}

/* The head is a bar, not a stacked block: with the full width available the
   title and the actions belong on one line, which buys the content more room. */
.reader-head {
  flex-shrink: 0;
  padding: 1rem 3.4rem 1rem 1.25rem; /* right side clears the pinned close */
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.reader-head-top { display: flex; align-items: center; gap: 0.9rem; min-width: 0; flex: 1 1 260px; }
.reader-title { font-size: 1.08rem; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); min-width: 0; }
.reader-sub {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.03em;
  color: var(--muted); margin-top: 0.2rem; text-transform: uppercase;
}
.reader-close {
  flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.reader-close:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--navy); }
.reader-close svg { width: 18px; height: 18px; }

.reader-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
/* Close is ANCHORED to the sheet's top-right corner, the way a Windows title
   bar does it — not laid out as the last flex item in the actions row. As a
   flex sibling it was vertically centred in a ~70px header and could wrap to
   a second line on narrow windows, which is exactly the "it sits somewhere in
   the middle" complaint. Absolute positioning pins it to the corner no matter
   what the header does. */
.reader-close {
  position: absolute; top: 0.55rem; right: 0.55rem; z-index: 3;
}
.reader-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.55rem 0.9rem; border-radius: 9px; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: transparent; color: var(--ink);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.reader-btn:hover { background: var(--surface-alt); border-color: var(--navy); transform: translateY(-1px); }
.reader-btn svg { width: 15px; height: 15px; }
.reader-btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  border-color: transparent; color: #fff;
}
.reader-btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); }
.reader-btn[disabled] { opacity: 0.45; cursor: default; transform: none; }

/* Text is centred in a reading column: a line running the full 1180px is
   physically harder to read than the narrow drawer was. The SHEET is wide for
   the document; the TEXT stays at a comfortable measure. */
.reader-body {
  flex: 1 1 auto; overflow-y: auto;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
  /* White, like every other surface in the dashboard. The cards inside carry
     the warm tone; making the whole sheet warm changed a palette that worked. */
  background: var(--surface);
}
.reader-body > * { max-width: 78ch; margin-inline: auto; }
.reader-note { color: var(--muted); font-size: 0.9rem; padding: 1rem 0; }
.reader-note { color: var(--muted); font-size: 0.9rem; padding: 1rem 0; }

/* exchange cards */
.rx {
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface-alt);
  padding: 1.1rem 1.15rem; margin-bottom: 0.9rem;
}
.rx-block + .rx-block { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--border); }
.rx-label {
  display: block; font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 0.4rem;
}
/* Matches the app's archive exactly: 10px mono, tabular figures, faint, sitting
   just under the text it belongs to. Scoped with .rx so it outranks `.rx p`,
   which would otherwise style this as a normal body paragraph. */
.rx .rx-time {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rx-q .rx-label { color: var(--navy); }
.rx-you .rx-label { color: var(--muted); }
.rx-ai .rx-label { color: var(--teal-deep); }
.rx p { font-size: 0.94rem; line-height: 1.62; color: var(--ink-soft); margin: 0; white-space: pre-wrap; }
.rx-q p { color: var(--ink); font-weight: 550; }
.rx-ai .intro { font-size: 0.94rem; line-height: 1.62; color: var(--ink-soft); margin: 0 0 0.5rem; }
.rx-ai ul { margin: 0; padding-left: 1.15rem; }
.rx-ai li { font-size: 0.94rem; line-height: 1.6; color: var(--ink-soft); margin-bottom: 0.4rem; }
.rx-ai li::marker { color: var(--navy); }
.rx-ai .kw { color: var(--navy); font-weight: 650; }

@keyframes reader-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes reader-rise { from { transform: translateY(12px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .reader-overlay, .reader-panel { animation: none; }
}

/* =========================================================================
   Operations page (operator only) — reuses the chart marks above; only the
   pieces that don't exist elsewhere are defined here.
   ========================================================================= */
@media (min-width: 1000px) { .stats-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 800px) { .stats-3 { grid-template-columns: repeat(3, 1fr); } }
/* An e-mail address is not a number — it needs to fit, not to shout. */
.stat-value-sm { font-size: 1.05rem; font-weight: 650; overflow-wrap: anywhere; line-height: 1.35; }

/* Legend: required whenever a chart carries two series, so identity is never
   colour alone. */
.cx-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.9rem; }
.cx-legend-item {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.82rem; color: var(--ink-soft);
}
.cx-legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }


/* Filters in ONE row above the charts. */
.admin-filters { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.15rem; flex-wrap: wrap; }
.range-btn {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.5rem 0.85rem; border-radius: 9px; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink-soft);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.range-btn:hover { border-color: var(--navy); color: var(--ink); }
.range-btn.is-active {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  border-color: transparent; color: #fff;
}

/* Month picker sits in the same filter row as the ranges. */
.range-select {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.03em; padding: 0.5rem 0.7rem; border-radius: 9px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink-soft);
  cursor: pointer;
}
.range-select:hover { border-color: var(--navy); color: var(--ink); }

/* Which window the numbers belong to, said in words. */
.scope-line { font-size: 0.92rem; color: var(--muted); margin: -0.4rem 0 1.15rem; }
.scope-line b { color: var(--ink); font-weight: 650; }
.scope-reset {
  font: inherit; background: none; border: none; padding: 0 0 0 0.6rem;
  color: var(--teal-deep); cursor: pointer; text-decoration: underline;
}
.app-panel-hint { font-size: 0.78rem; color: var(--muted); }

/* The selected month keeps the series hue but gains the ink outline — colour
   alone would not survive a greyscale print or a colour-blind reader. */
.cx-bar.is-selected { stroke: var(--ink); stroke-width: 2px; }
.cx-hit-clickable { cursor: pointer; }
.cx-hit-clickable:hover ~ .cx-bar { opacity: 0.85; }


/* Row label + direct value on the horizontal bars. Text wears text tokens —
   never the series colour. */
.cx-rowlabel {
  font-family: var(--font-sans); font-size: 12px; font-weight: 550;
  fill: var(--ink-soft);
}
.cx-value {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  fill: var(--ink); font-variant-numeric: tabular-nums;
}

/* Flags. The colour is the LAST channel: every row carries an icon and the
   word Watch/Serious, because amber and red are close under deuteranopia
   (measured ΔE 7.3) and must never be the only difference. */
.flag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.flag {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 0.95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-alt);
}
.flag-ic { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.flag-ic svg { width: 20px; height: 20px; }
.flag div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.5rem; min-width: 0; }
.flag b { font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.flag span:not(.flag-level):not(.flag-ic) { color: var(--ink-soft); font-size: 0.9rem; }
.flag-level {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.15rem 0.4rem; border-radius: 5px; color: #fff;
}
.flag-warning .flag-ic { color: #a08200; }
.flag-warning .flag-level { background: #a08200; }
.flag-serious .flag-ic { color: #c0392b; }
.flag-serious .flag-level { background: #c0392b; }
.flag-serious { border-color: rgba(192, 57, 43, 0.35); background: #fdf5f4; }

/* The account table is wider than the page on a laptop — it scrolls itself
   rather than pushing the layout sideways. */
.admin-table { overflow-x: auto; }
.admin-table table { min-width: 620px; }

.user-search {
  font: inherit; font-size: 0.85rem;
  padding: 0.45rem 0.75rem; border-radius: 9px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--ink); min-width: 200px;
}
.user-search:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 1px; }

/* Technical detail under a human error headline — visible, but clearly the
   footnote rather than the message. */
.auth-alert .alert-detail {
  display: block; margin-top: 0.45rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400;
  color: inherit; opacity: 0.75; overflow-wrap: anywhere;
}

/* =========================================================================
   Document preview — same drawer as the session reader, wider, because a
   page of A4 at a readable size needs more room than a transcript.
   ========================================================================= */
/* A document gets the whole sheet: no reading column, no padding — the PDF
   viewer brings its own chrome and every pixel of it is useful. */
.reader-body.is-frame > * { max-width: none; }

/* The PDF is shown by the browser's own viewer, which brings its own chrome —
   so this pane gives it the full area with no padding of ours. */
.reader-body.is-frame { padding: 0; overflow: hidden; }
.docprev-frame {
  display: block; width: 100%; height: 100%;
  border: 0; background: var(--surface-alt);
}

.docprev-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* Danger buttons */
.btn-danger {
  background: #c0392b;
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(192, 57, 43, 0.5);
}
.btn-danger:hover { background: #a93226; transform: translateY(-1px); }
.btn-danger-ghost {
  background: transparent;
  color: #b23124;
  border: 1.5px solid #e6c3bd;
}
.btn-danger-ghost:hover { border-color: #c0392b; background: #fdf2f1; }

/* Confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(11, 18, 32, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: modal-fade 0.16s var(--ease);
}
/* Every dismissible surface closes from the SAME place — the top right corner,
   the way a window does. Having to hunt for the way out is the kind of small
   friction people blame on the whole product. */
.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.6rem;
  animation: modal-pop 0.18s var(--ease);
}
.modal-x {
  position: absolute; top: 0.85rem; right: 0.85rem;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; border: none; background: transparent;
  color: var(--muted); cursor: pointer;
}
.modal-x:hover { background: var(--surface-alt); color: var(--ink); }
.modal-x svg { width: 16px; height: 16px; }
.modal-card h3 { padding-right: 2.2rem; }
.modal-card h3 {
  font-size: 1.2rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.modal-card > p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.4rem; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-card { animation: none; }
}

/* ---------------- Multi-page dashboard additions ---------------- */
.app-content-narrow { max-width: 760px; }

.page-head { margin-bottom: 1.4rem; }
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); }
.page-sub { font-size: 0.95rem; color: var(--muted); margin-top: 0.4rem; max-width: 62ch; line-height: 1.55; }

/* Stat tiles that navigate */
.stat-link { display: block; text-decoration: none; transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease); }
.stat-link:hover { border-color: var(--navy); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-link:focus-visible { outline: 2.5px solid var(--teal-deep); outline-offset: 2px; }

.panel-link { font-size: 0.85rem; font-weight: 650; color: var(--teal-deep); white-space: nowrap; }
.panel-link:hover { text-decoration: underline; }
.sess-more { font-size: 0.82rem; color: var(--muted); margin-top: 0.9rem; }

/* Documents — "what already syncs" list */
.doc-list { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }
.doc-list li { display: flex; gap: 0.85rem; align-items: flex-start; }
.doc-list li > div { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.doc-list b { font-size: 0.94rem; font-weight: 650; color: var(--ink); }
.doc-list span { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.55; }
.doc-ic {
  width: 26px; height: 26px; flex-shrink: 0; margin-top: 0.1rem;
  display: grid; place-items: center; border-radius: 50%;
}
.doc-ic svg { width: 14px; height: 14px; }
.doc-ic.ok { background: rgba(20, 150, 172, 0.12); color: var(--teal-deep); }
.doc-ic.pending { background: var(--surface-alt); color: var(--muted); }

/* Danger zone panel */
.panel-danger { border-color: #e6c3bd; }
.panel-danger .app-panel-title { color: #b23124; }

/* ---------------- Documents: upload zone + file rows ---------------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 2.1rem 1.25rem; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-alt);
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--teal-deep); background: rgba(20, 150, 172, 0.05); }

/* List full: the zone stays visible and explains itself instead of silently
   refusing files. */
.drop.is-full {
  cursor: default;
  border-style: solid;
  border-color: var(--border);
  background: var(--surface-alt);
  opacity: 0.85;
}
.drop.is-full .drop-ic { opacity: 0.45; }
.drop-ic {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--teal-deep); margin-bottom: 0.35rem;
}
.drop-ic svg { width: 20px; height: 20px; }
.drop-title { font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.drop-title u { text-decoration-color: var(--teal-deep); }
.drop-sub { font-size: 0.8rem; color: var(--muted); }

.upload-progress {
  display: flex; align-items: center; gap: 0.6rem;
  margin-top: 1rem; font-size: 0.88rem; color: var(--ink-soft);
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

.doc-rows { display: flex; flex-direction: column; gap: 0.55rem; }
.doc-row {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s var(--ease);
}
.doc-row:hover { border-color: var(--border-strong); }
.doc-file-ic {
  flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface-alt); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.04em; color: var(--teal-deep);
}
.doc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.doc-name {
  font-size: 0.94rem; font-weight: 650; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-meta { font-size: 0.79rem; color: var(--muted); }
.doc-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
@media (max-width: 560px) {
  .doc-row { flex-wrap: wrap; }
  .doc-actions { width: 100%; justify-content: flex-end; }
}

/* ---------------- Dashboard: get-started checklist ---------------- */
.onboard-count {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.onboard-list { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; }
.onboard-item { display: flex; align-items: center; gap: 0.85rem; }
.onboard-mark {
  flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--border-strong); color: #fff; background: transparent;
}
.onboard-mark svg { width: 13px; height: 13px; }
.onboard-item.is-done .onboard-mark { background: var(--teal-deep); border-color: var(--teal-deep); }
.onboard-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.onboard-text b { font-size: 0.94rem; font-weight: 650; color: var(--ink); }
.onboard-text span { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.onboard-item.is-done .onboard-text b { color: var(--ink-soft); }
.onboard-cta { flex-shrink: 0; }

/* Live indicator — the page is watching for new sessions */
.live-dot {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  transition: color .2s var(--ease);
}
.live-dot i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong);
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.live-dot.is-hit { color: var(--teal-deep); }
.live-dot.is-hit i { background: var(--teal); box-shadow: 0 0 0 4px rgba(24, 159, 187, 0.18); }
@media (prefers-reduced-motion: reduce) { .live-dot, .live-dot i { transition: none; } }
.doc-name-row { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.doc-src {
  flex-shrink: 0; font-family: var(--font-mono);
  font-size: 0.56rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--teal-deep); background: rgba(20, 150, 172, 0.1);
  border: 1px solid rgba(20, 150, 172, 0.22); padding: 0.14rem 0.4rem; border-radius: 999px;
}

/* =========================================================================
   Collapsed sidebar — icons only. Driven by data-sidebar on <html> so the
   <head> script can apply it before paint.
   ========================================================================= */
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding-right: 0.1rem; }
.sb-collapse {
  flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sb-collapse svg { width: 16px; height: 16px; }
.sb-collapse:hover { background: var(--surface-alt); color: var(--ink); }

:root[data-sidebar="collapsed"] .sb { width: 72px; padding-left: 0.7rem; padding-right: 0.7rem; }
:root[data-sidebar="collapsed"] .sb-brand span,
:root[data-sidebar="collapsed"] .sb-item span,
:root[data-sidebar="collapsed"] .sb-user-meta { display: none; }
:root[data-sidebar="collapsed"] .sb-top { flex-direction: column; gap: 0.35rem; }
:root[data-sidebar="collapsed"] .sb-brand { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .sb-item { justify-content: center; padding-inline: 0; }
:root[data-sidebar="collapsed"] .sb-user { justify-content: center; }
:root[data-sidebar="collapsed"] .sb-logout { display: none; }

/* Delete action on a session row — recessive until hovered, since it's destructive */
.sess-del {
  flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.sess-del svg { width: 16px; height: 16px; }
.sess-del:hover { background: #fdf2f1; color: #b23124; border-color: #e6c3bd; }
.sess-del:focus-visible { outline: 2.5px solid #c0392b; outline-offset: 2px; }
.sess-del[disabled] { opacity: 0.45; cursor: default; }

/* ---------------- Select mode (mirrors the desktop app's Dashboard) ----------------
   No checkboxes until "Select" is pressed; then the whole row is the hit target and
   the box is a filled brand square with a check — the same mark the app draws. */
.select-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }

.sess-row.is-selectable { cursor: pointer; }
.sess-row.is-selected { border-color: var(--navy); background: rgba(18, 40, 92, 0.05); }
.sess-row.is-selectable:focus-visible { outline: 2.5px solid var(--teal-deep); outline-offset: 2px; }

.sess-box {
  flex-shrink: 0; width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 5px; border: 1.5px solid var(--border-strong);
  color: transparent; background: transparent;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.sess-box svg { width: 11px; height: 11px; }
.sess-row.is-selected .sess-box { background: var(--navy); border-color: var(--navy); color: #fff; }

/* In select mode the row body is a div, not a button — keep the same type rhythm. */
.sess-row.is-selectable .sess-open { cursor: pointer; }
