/* Customer portal. Palette from the approved mockup (docs/mockups/phase2-mockup-v2.html):
   dark by default, light via prefers-color-scheme or the toggle (data-theme on <html>).
   No web fonts or CDN: Inter when installed, else the system UI font. */
:root {
  color-scheme: dark;
  --bg: #080f19; --bg2: #0b1622; --card: #102333; --card2: #12293b; --sunk: #0c1a27;
  --line: #294050; --line2: #2e4a5c; --text: #eef7fb; --text2: #cedde6; --muted: #a3b7c7;
  --accent: #36dce9; --accent2: #87e5f0; --accent-ink: #062027; --soft: rgba(54, 220, 233, .10); --soft2: rgba(54, 220, 233, .18);
  --ok: #54d5a1; --ok-bg: rgba(84, 213, 161, .14); --warn: #f2c14e; --warn-bg: rgba(242, 193, 78, .14);
  --bad: #ed7383; --bad-bg: rgba(237, 115, 131, .14);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); --glow: 0 0 0 3px rgba(54, 220, 233, .25);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f6fa; --bg2: #edf1f7; --card: #ffffff; --card2: #e9eff8; --sunk: #f1f4f9;
    --line: #cad3df; --line2: #b9c7d6; --text: #172538; --text2: #2c3c52; --muted: #566578;
    --accent: #267985; --accent2: #1f6570; --accent-ink: #ffffff; --soft: rgba(38, 121, 133, .08); --soft2: rgba(38, 121, 133, .16);
    --ok: #0f7a45; --ok-bg: #dcf3e7; --warn: #9a6700; --warn-bg: #fbf0d4; --bad: #b42318; --bad-bg: #fde4e1;
    --shadow: 0 8px 24px rgba(23, 37, 56, .08); --glow: 0 0 0 3px rgba(38, 121, 133, .2);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa; --bg2: #edf1f7; --card: #ffffff; --card2: #e9eff8; --sunk: #f1f4f9;
  --line: #cad3df; --line2: #b9c7d6; --text: #172538; --text2: #2c3c52; --muted: #566578;
  --accent: #267985; --accent2: #1f6570; --accent-ink: #ffffff; --soft: rgba(38, 121, 133, .08); --soft2: rgba(38, 121, 133, .16);
  --ok: #0f7a45; --ok-bg: #dcf3e7; --warn: #9a6700; --warn-bg: #fbf0d4; --bad: #b42318; --bad-bg: #fde4e1;
  --shadow: 0 8px 24px rgba(23, 37, 56, .08); --glow: 0 0 0 3px rgba(38, 121, 133, .2);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }

/* shared bits */
.btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap; }
.btn:hover { box-shadow: var(--glow); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.full { width: 100%; justify-content: center; }
.gap { margin-top: 20px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ok { background: var(--ok-bg); color: var(--ok); }
.warn { background: var(--warn-bg); color: var(--warn); }
.bad { background: var(--bad-bg); color: var(--bad); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.mb { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin: 14px 0 5px; font-size: 13px; }
input, select, textarea { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--sunk); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
input[aria-invalid="true"] { border-color: var(--bad); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint.below { margin-top: 6px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 16px 0; }
label.check input { width: auto; margin-top: 3px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--sunk); }
tr:last-child td { border-bottom: 0; }
.tbl { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.bar { height: 7px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); overflow: hidden; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 999px; }
/* bar widths in 5% steps: the CSP forbids inline style attributes */
.bar i.w0 { width: 0%; }
.bar i.w5 { width: 5%; }
.bar i.w10 { width: 10%; }
.bar i.w15 { width: 15%; }
.bar i.w20 { width: 20%; }
.bar i.w25 { width: 25%; }
.bar i.w30 { width: 30%; }
.bar i.w35 { width: 35%; }
.bar i.w40 { width: 40%; }
.bar i.w45 { width: 45%; }
.bar i.w50 { width: 50%; }
.bar i.w55 { width: 55%; }
.bar i.w60 { width: 60%; }
.bar i.w65 { width: 65%; }
.bar i.w70 { width: 70%; }
.bar i.w75 { width: 75%; }
.bar i.w80 { width: 80%; }
.bar i.w85 { width: 85%; }
.bar i.w90 { width: 90%; }
.bar i.w95 { width: 95%; }
.bar i.w100 { width: 100%; }
.callout { border: 1px solid var(--line2); border-left: 3px solid var(--accent); background: var(--soft); padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); color: var(--text); }
.callout.bad { border-left-color: var(--bad); background: var(--bad-bg); color: var(--text); }
.callout.banner { border-radius: 0; margin: 0; border-width: 0 0 1px 3px; }

/* public pages (login, 2FA, sign-up) */
.pub-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.3px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.brand small { display: block; font-size: 10px; letter-spacing: .14em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.formcard { display: block; max-width: 440px; margin: 48px auto; padding: 28px; }
.formcard h1.title { margin: 6px 0 4px; }

/* customer panel (Jupiter-style "Tools" shell) */
.cp-top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--bg2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.cp-top .brand { min-width: 170px; }
.cp-top form { margin: 0; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { padding-left: 36px; background: var(--card); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: inherit; font-size: 11px; color: var(--muted); border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; }
.cp-top .user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--soft2); color: var(--accent); display: grid; place-items: center; font-weight: 700; border: 1px solid var(--accent); }
.iconbtn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line2); background: transparent; color: var(--text2); display: grid; place-items: center; cursor: pointer; }
.cp { display: flex; min-height: calc(100vh - 56px); }
.rail { width: 210px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--bg2); padding: 14px 10px; }
.rail a, .rail .dim { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--text2); font-weight: 500; margin-bottom: 2px; }
.rail a:hover { background: var(--soft); text-decoration: none; }
.rail a.on { background: var(--soft2); color: var(--accent); }
.rail .dim { opacity: .55; cursor: default; }
.rail .sec { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.cp-main { flex: 1; min-width: 0; padding: 22px 24px; }
.cp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side:empty { display: none; }
.cp-grid:has(> .side:empty) { grid-template-columns: minmax(0, 1fr); }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }
h1.title { margin: 0 0 16px; font-size: 24px; letter-spacing: -.4px; }
.group { margin-bottom: 16px; overflow: hidden; }
.group-h { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.group-h .gi { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--soft2); color: var(--accent); }
.group-h h2 { margin: 0; font-size: 15px; flex: 1; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 4px; padding: 10px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); border: 1px solid transparent; }
.tool:hover { background: var(--soft); border-color: var(--line2); text-decoration: none; }
.tool .ti { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--sunk); border: 1px solid var(--line); color: var(--accent); }
.tool.dim { opacity: .55; }
.side h2.side-h { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 13px; letter-spacing: .02em; }
.info { padding: 6px 18px 12px; }
.info div { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.info div:last-child { border-bottom: 0; }
.info small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat { padding: 10px 18px; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat .top { display: flex; justify-content: space-between; font-size: 13px; }

/* Password & 2FA */
.card-h { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
h2.card-h + .tbl, .tbl + h2.card-h { margin-top: 10px; }
.codes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.codes li { padding: 8px 10px; border: 1px dashed var(--line2); border-radius: 8px; background: var(--sunk); text-align: center; }
.secret-key { font-size: 16px; letter-spacing: .08em; padding: 10px 12px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--line); word-break: break-all; }

@media (max-width: 1100px) { .cp-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .cp { flex-direction: column; }
  .rail { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .rail .sec { display: none; }
  .rail a, .rail .dim { padding: 6px 10px; margin: 0; }
  .cp-top { flex-wrap: wrap; padding: 10px 16px; }
  .cp-top .brand { min-width: 0; }
  .hidesm { display: none; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .cp-main { padding: 16px; }
  .formcard { margin: 16px; padding: 22px 18px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .pub-head { padding: 14px 16px; }
}
