/* ---------------------------------------------------------------
   portal.css: the look of every Mejora Voice portal page.
   Follows docs/design.md: pastel colours, Space Grotesk headings,
   Inter body text, NO boxed cards (hairline rows, one number strip,
   tinted bands instead), light and dark mode, works at phone width.
   --------------------------------------------------------------- */

/* Colour "tokens": every colour on the page comes from this list. */
:root {
  --ground: #F6F4FB;
  --ink: #1F1A3D;
  --text-2: #5E5A78;
  --hairline: #E6E1F2;
  --ink-panel: #2A2459;
  --field: #FFFFFF;
  --lavender-bg: #E6E0FF; --lavender-fg: #4B3BB5;
  --mint-bg: #D3F2E4;     --mint-fg: #17784D;
  --peach-bg: #FFE2D4;    --peach-fg: #B4471A;
  --sky-bg: #DAEBFF;      --sky-fg: #1F5FA6;
  --butter-bg: #FFF2C2;   --butter-fg: #7A5A00;
  --rose-bg: #FFDDE6;     --rose-fg: #A3264B;
  --live: #2FA36B;
  --danger: #D6456F;
  --head: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

/* Dark mode: deep tinted ground, pastels become text/accents. */
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #15122B;
    --ink: #F1EEFF;
    --text-2: #B3ADD6;
    --hairline: #2C2750;
    --field: #1C1838;
    --lavender-bg: #29235A; --lavender-fg: #C9BEFA;
    --mint-bg: #18352A;     --mint-fg: #9FE0C0;
    --peach-bg: #3A2418;    --peach-fg: #FFC6AE;
    --sky-bg: #172C47;      --sky-fg: #A9D0FF;
    --butter-bg: #352C10;   --butter-fg: #FFE38A;
    --rose-bg: #3A1824;     --rose-fg: #FFB3C7;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.5 var(--body);
}
a { color: var(--lavender-fg); }
h1, h2, h3, .num { font-family: var(--head); letter-spacing: -0.01em; }
h1 { font-size: 40px; font-weight: 700; margin: 0 0 4px; line-height: 1.1; }
h2 { font-size: 21px; font-weight: 600; margin: 32px 0 8px; }
.muted { color: var(--text-2); font-size: 13px; }

/* ----- Top bar: logo, menu, user ----- */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 32px; border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 36px; height: 36px; }
.brand span { font: 700 20px var(--head); }
.brand b { color: var(--lavender-fg); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--text-2); font-weight: 500; min-height: 36px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { background: var(--lavender-bg); color: var(--lavender-fg); }
.who { display: flex; align-items: center; gap: 12px; color: var(--text-2); }

/* ----- Page body ----- */
main { max-width: 1100px; margin: 0 auto; padding: 32px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* One horizontal strip of big numbers, split by hairlines (not cards). */
.strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 28px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}
.strip div { padding: 16px 20px; border-left: 1px solid var(--hairline); }
.strip div:first-child { border-left: 0; padding-left: 0; }
.strip .num { font-size: 34px; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }

/* Lists are rows split by hairlines. */
table.rows { width: 100%; border-collapse: collapse; }
.rows th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.rows th, .rows td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.rows td.changes { font-size: 13px; }
.scroll { overflow-x: auto; }

/* Status pills: colour AND a word, never colour alone. */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.mint { background: var(--mint-bg); color: var(--mint-fg); }
.pill.rose { background: var(--rose-bg); color: var(--rose-fg); }
.pill.sky { background: var(--sky-bg); color: var(--sky-fg); }
.pill.lavender { background: var(--lavender-bg); color: var(--lavender-fg); }
.pill.peach { background: var(--peach-bg); color: var(--peach-fg); }
.pill.butter { background: var(--butter-bg); color: var(--butter-fg); }

/* Tinted rounded band for the main focus of a page (login, 2FA). */
.band { border-radius: 28px; padding: 32px; background: var(--lavender-bg); }
.band.narrow { max-width: 440px; margin: 64px auto; }
.band .qr { background: #fff; border-radius: 16px; padding: 12px; width: 220px; }
.band .qr svg { width: 100%; height: auto; display: block; }
code.secret { font-size: 13px; word-break: break-all; }

/* ----- Forms ----- */
label { display: block; font-weight: 500; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 12px; font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--hairline); min-height: 44px;
}
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--lavender-fg); outline-offset: 2px;
}
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.helptext, .field-help { display: block; color: var(--text-2); font-size: 12px; margin-top: 4px; }
.errorlist { color: var(--danger); margin: 6px 0; padding: 0; list-style: none; font-size: 13px; }
fieldset { border: 0; border-top: 1px solid var(--hairline); padding: 8px 0 0; margin: 24px 0 0; }
legend { font: 600 17px var(--head); padding: 0 8px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 28px; }

/* Buttons: pill shape, 44px tall for fingers. */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 14px var(--body); background: var(--ink-panel); color: #fff; text-decoration: none;
}
.btn.ghost, button.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--hairline); }
@media (prefers-color-scheme: dark) { .btn, button { background: var(--lavender-fg); color: #15122B; } }

/* One-line notices after saving. */
.notice { padding: 10px 16px; border-radius: 14px; margin: 0 0 16px; background: var(--mint-bg); color: var(--mint-fg); }
.notice.info { background: var(--sky-bg); color: var(--sky-fg); }
.notice.error { background: var(--rose-bg); color: var(--rose-fg); }

footer { max-width: 1100px; margin: 0 auto; padding: 24px 32px 40px; color: var(--text-2); font-size: 12px; }

/* Phone width: smaller gutters and title. */
@media (max-width: 640px) {
  .topbar, main, footer { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 30px; }
  .strip div { border-left: 0; padding-left: 0; }
  .band { padding: 22px; }
  .band.narrow { margin: 24px auto; }
}
