/* DVendo HQ: the "Command Center" look with one red hero tile per page (docs/dashboard-look.md, Task 78). */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url("/fonts/Inter-400.ttf"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url("/fonts/Inter-500.ttf"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url("/fonts/Inter-600.ttf"); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url("/fonts/Inter-700.ttf"); }

:root, [data-theme="light"] {
  --bg:#f2f1f3; --chrome:#ffffff; --surface:#ffffff; --raised:#eeedf0; --border:#e2e0e5; --borderStrong:#cfccd4; --divider:#ecebee;
  --text:#18161a; --muted:#625d66; --track:#e6e4e9;
  --side:#18141a; --sideText:#f1eef2; --sideMuted:#a59fa9; --sideBorder:#2a252d; --sideHover:#252028;
  --brand:#d6352a; --brandText:#c62f24; --success:#14804a; --successBg:#e3f5eb; --danger:#b42318; --dangerBg:#fdecea;
  --warning:#8a5a06; --warningBg:#fff4d6; --creamSurface:#f7efcb; --creamText:#6b4e16; --focus:#d6352a; color-scheme: light;
}
[data-theme="dark"] {
  --bg:#0c0b0d; --chrome:#131115; --surface:#17151a; --raised:#201d23; --border:#2a262e; --borderStrong:#3a3540; --divider:#221f25;
  --text:#f1eef2; --muted:#a8a1ad; --track:#2a262e;
  --side:#08070a; --sideText:#f1eef2; --sideMuted:#958f99; --sideBorder:#1f1c22; --sideHover:#18161b;
  --brand:#ff5a47; --brandText:#ff7a6a; --success:#3ddc97; --successBg:rgba(61,220,151,.12); --danger:#ff8a8a; --dangerBg:rgba(255,120,120,.12);
  --warning:#fbbf24; --warningBg:rgba(251,191,36,.12); --creamSurface:#2a2420; --creamText:#f4ecc2; --focus:#ff7a6a; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0c0b0d; --chrome:#131115; --surface:#17151a; --raised:#201d23; --border:#2a262e; --borderStrong:#3a3540; --divider:#221f25;
    --text:#f1eef2; --muted:#a8a1ad; --track:#2a262e;
    --side:#08070a; --sideText:#f1eef2; --sideMuted:#958f99; --sideBorder:#1f1c22; --sideHover:#18161b;
    --brand:#ff5a47; --brandText:#ff7a6a; --success:#3ddc97; --successBg:rgba(61,220,151,.12); --danger:#ff8a8a; --dangerBg:rgba(255,120,120,.12);
    --warning:#fbbf24; --warningBg:rgba(251,191,36,.12); --creamSurface:#2a2420; --creamText:#f4ecc2; --focus:#ff7a6a; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
#root { height: 100%; }
.boot { padding: 40px; color: var(--muted); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.app { height: 100%; display: flex; overflow: hidden; --gap: 12px; }
.side { width: 236px; flex-shrink: 0; background: var(--side); color: var(--sideText); border-right: 1px solid var(--sideBorder);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand img { width: 36px; height: 37px; }
.brand .name { font-weight: 700; font-size: 16px; }
.brand .sub { font-size: 11px; color: var(--sideMuted); }
.navlabel { font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; font-weight: 700; color: var(--sideMuted); padding: 12px 8px 4px; }
.nav { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: inherit; text-decoration: none;
  padding: 9px 10px; border-radius: 10px; font-weight: 500; width: 100%; text-align: left; min-height: 40px; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav:hover { background: var(--sideHover); }
.nav[aria-current="page"] { background: #d6352a; color: #fff; font-weight: 600; }
.nav .soon { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; color: var(--sideText); background: var(--sideHover);
  border: 1px solid var(--sideBorder); padding: 2px 6px; border-radius: 6px; }
.nav[aria-current="page"] .soon { background: rgba(255,255,255,.18); border-color: transparent; }
.side .foot { margin-top: auto; padding: 12px 8px 4px; font-size: 12px; color: var(--sideMuted); border-top: 1px solid var(--sideBorder); display: grid; gap: 8px; }
.side .foot .who { overflow-wrap: anywhere; }
.themeSwitch { display: flex; background: var(--sideHover); border-radius: 8px; padding: 2px; }
.themeSwitch button { flex: 1; border: 0; background: transparent; color: var(--sideMuted); padding: 5px 0; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.themeSwitch button[aria-pressed="true"] { background: var(--side); color: var(--sideText); }
.linkBtn { border: 0; background: transparent; color: var(--sideText); padding: 4px 0; text-align: left; text-decoration: underline; font-size: 12.5px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--chrome); border-bottom: 1px solid var(--border); }
.top h1 { margin: 0; font-size: 20px; font-weight: 700; }
.top .meta { font-size: 12px; color: var(--muted); }
.top .spacer { flex: 1; }
.envTag { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; background: var(--warningBg); color: var(--warning);
  border: 1px solid var(--warning); padding: 2px 8px; border-radius: 6px; }
.menuBtn { display: none; border: 0; background: var(--raised); color: var(--text); width: 44px; height: 44px; align-items: center;
  justify-content: center; border-radius: 12px; flex-shrink: 0; }
.menuBtn svg { width: 24px; height: 24px; }
.content { flex: 1; overflow-y: auto; padding: 18px 24px 32px; }
.scrim { display: none; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--gap); }
.mt { margin-top: var(--gap); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; min-width: 0; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { border-top: 3px solid var(--borderStrong); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 6px; white-space: nowrap; }
.kpi .delta { font-size: 12px; font-weight: 600; margin-top: 4px; color: var(--muted); }
.hero { grid-column: span 2; grid-row: span 2; position: relative; overflow: hidden; color: #fff; border: 0; border-radius: 14px; min-height: 196px;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255,150,110,.35), transparent 55%), linear-gradient(135deg, #d6352a, #c21f3a);
  display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; }
.hero .label { color: #f4ecc2; font-size: 13px; font-weight: 600; }
.hero .value { font-size: 44px; font-weight: 700; margin-top: 10px; letter-spacing: -.5px; }
.hero .delta { color: #f4ecc2; font-size: 13px; }
.hero > div:first-child, .hero .delta { max-width: calc(100% - 150px); }
.hero .art { position: absolute; right: 18px; bottom: 14px; height: 132px; width: auto; filter: drop-shadow(0 6px 10px rgba(60,0,0,.25)); }
.card h2 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); }
.later { text-align: center; padding: 40px 20px; }
.later img { height: 120px; margin-bottom: 12px; }
.later h2 { font-size: 18px; margin-bottom: 6px; }
.later p { margin: 0 auto; max-width: 420px; color: var(--muted); }

/* ---------- Tables, pills, buttons, forms ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.search, .field input { border: 1px solid var(--borderStrong); background: var(--surface); color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 14px; min-height: 40px; }
.search { flex: 1; min-width: 160px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--raised); }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.rowName { overflow-wrap: anywhere; }
/* Emails have no spaces; Safari only breaks them inside a table cell with word-break. */
/* Emails break only after "@" or "." (emailText() in pages/accounts.js puts a <wbr> there), never mid-word. */
td small.email { overflow-wrap: normal; word-break: normal; }
.rowName { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 600; color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; }
.pill.ok { background: var(--successBg); color: var(--success); } .pill.ok i { background: var(--success); }
.pill.wait { background: var(--warningBg); color: var(--warning); } .pill.wait i { background: var(--warning); }
.pill.off { background: var(--raised); color: var(--muted); } .pill.off i { background: var(--muted); }
.btn { border: 0; background: linear-gradient(135deg, #d6352a, #c21f3a); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 10px; font-size: 14px; min-height: 40px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--borderStrong); }
.btn.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
.btn.wide { width: 100%; }
.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; background: var(--raised); }
.notice[data-type="error"] { background: var(--dangerBg); color: var(--danger); }
.notice[data-type="success"] { background: var(--successBg); color: var(--success); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; }
.field .err { color: var(--danger); font-size: 12.5px; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.suffixWrap { position: relative; display: flex; }
.suffixWrap input { flex: 1; min-width: 0; }
.suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 14px; }
.code { font-size: 30px; font-weight: 700; letter-spacing: 3px; text-align: center; padding: 14px; border-radius: 12px; background: var(--creamSurface); color: var(--creamText); font-variant-numeric: tabular-nums; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20,12,14,.5); }
.dlg { padding: 20px; }
.dlg h2 { margin: 0 0 4px; font-size: 18px; }
.dlg .hint { margin-bottom: 14px; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dlg dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 14px; font-size: 13px; }
.dlg dt { color: var(--muted); font-weight: 600; }
.dlg dd { margin: 0; }

/* ---------- Sign-in ---------- */
.signin { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background:
  radial-gradient(70% 50% at 50% 0%, rgba(214,53,42,.12), transparent 70%), var(--bg); }
.signinCard { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 24px; }
.signinCard .mascot { display: block; width: 88px; height: 90px; margin: 0 auto 8px; }
.signinCard h1 { text-align: center; margin: 0; font-size: 22px; }
.signinCard .sub { text-align: center; color: var(--muted); margin: 4px 0 20px; }
.signinCard .switch { margin-top: 14px; text-align: center; }
.signinCard .switch button { border: 0; background: transparent; color: var(--brandText); font-weight: 600; text-decoration: underline; padding: 6px; }
.codeInput { letter-spacing: 6px; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; visibility: hidden; }
  .app.open .side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .app.open .scrim { display: block; position: fixed; inset: 0; background: rgba(20,12,14,.42); z-index: 10; }
  .menuBtn { display: inline-flex; }
  .top { padding: 12px 14px; gap: 10px; }
  .top h1 { font-size: 18px; }
  .content { padding: 14px 14px 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-row: auto; min-height: 168px; }
  .hero .value { font-size: 34px; }
  .hero .art { height: 92px; }
  .hero > div:first-child, .hero .delta { max-width: calc(100% - 104px); }
  .kpi .value { font-size: 19px; }
  .hideSm { display: none; }
  /* iPhone Safari zooms the page into any field under 16px. */
  .search, .field input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
