/* Pro Shop. Phone: title, content, bottom tab bar with centre + button.
   PC (900px and wider): dark side menu on the left, content on the right. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #f4f6f8; --line: #dde2e9;
  --ink: #16202b; --muted: #5b6877;
  --accent: #1f5fbf; --accent-ink: #ffffff; --accent-soft: #e2ebf9;
  --ok: #1b7446; --ok-soft: #def2e6; --warn: #9a5800; --warn-soft: #fbeed6;
  --bad: #b42318; --bad-soft: #fde3df;
  --rail: #18222e; --rail-ink: #c9d3de; --rail-active: #26364a; --scrim: rgba(8, 12, 18, .45);
  --f-display: "Archivo", "Arial Narrow", "Segoe UI", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Consolas", monospace;
  --tabbar-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319; --surface: #161d26; --surface-2: #1c2531; --line: #29343f;
    --ink: #e5eaf0; --muted: #97a3b1;
    --accent: #6d9fff; --accent-ink: #0a1220; --accent-soft: #1a2a44;
    --ok: #5ac78b; --ok-soft: #13301f; --warn: #f0ae55; --warn-soft: #382811;
    --bad: #ff8b7b; --bad-soft: #3c1a16;
    --rail: #0a0f14; --rail-ink: #a9b6c4; --rail-active: #1c2a3b; --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- frame */
.app { min-height: 100vh; }
.rail { display: none; }
.main { padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
        display: grid; gap: 18px; align-content: start; max-width: 1100px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line);
          display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
          padding: 6px max(6px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
.tab { display: grid; justify-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 4px 0; position: relative; }
.tab .ic { width: 24px; height: 24px; stroke-width: 1.8; }
.tab[aria-current="page"] { color: var(--accent); }
.tab .dot { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff;
            font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.plus { justify-self: center; width: 56px; height: 56px; border-radius: 28px; border: 0; cursor: pointer; background: var(--accent); color: var(--accent-ink);
        display: grid; place-items: center; margin-top: -26px; box-shadow: 0 6px 16px rgba(31, 95, 191, .35); }
.plus .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.addmenu { border: 0; padding: 8px 16px calc(22px + env(safe-area-inset-bottom)); margin: auto 0 0; width: 100%; max-width: 100%; background: var(--bg); color: var(--ink);
           border-radius: 22px 22px 0 0; gap: 12px; }
.addmenu:popover-open { display: grid; }
.addmenu::backdrop { background: var(--scrim); }
.addmenu h3 { font-family: var(--f-display); font-size: 20px; margin: 10px 0 2px; }
.acct { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 4px 0; border-top: 1px solid var(--line); margin-top: 4px; }
.acctlinks { display: flex; gap: 14px; align-items: center; }
.acctlinks a, .acctlinks button { font: inherit; font-size: 14px; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; }
.acctlinks button { color: var(--bad); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 232px 1fr; }
  .rail { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; background: var(--rail); color: var(--rail-ink); padding: 20px 14px; }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; color: var(--rail-ink); }
  .brand b { font-family: var(--f-display); font-size: 17px; color: #fff; display: block; line-height: 1.1; }
  .brand small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
  .railnav { display: grid; gap: 2px; }
  .railnav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; font-weight: 500; color: var(--rail-ink); }
  .railnav a:hover { background: var(--rail-active); color: #fff; }
  .railnav a[aria-current="page"] { background: var(--rail-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
  .railnav .ic { width: 19px; height: 19px; stroke-width: 1.8; }
  .railnav .count { margin-left: auto; font-family: var(--f-mono); font-size: 11px; background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; }
  .railfoot { margin-top: auto; display: grid; gap: 2px; padding: 12px 6px 0; border-top: 1px solid var(--rail-active); font-size: 13px; }
  .railfoot .who { color: #fff; font-weight: 600; display: grid; margin-bottom: 6px; }
  .railfoot .who small { color: var(--rail-ink); font-weight: 400; opacity: .75; }
  .railfoot a, .railfoot button { color: var(--rail-ink); background: none; border: 0; font: inherit; padding: 5px 0; text-align: left; cursor: pointer; }
  .railfoot a:hover, .railfoot button:hover, .railfoot a[aria-current="page"] { color: #fff; }
  .tabbar, .addmenu { display: none !important; }
  .main { padding: 28px 32px 48px; width: 100%; }
}

/* ---------------------------------------------------------------- type */
.pagehead { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.pagehead h1 { font-family: var(--f-display); font-weight: 700; font-size: 28px; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.pagehead .back { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; margin-bottom: 4px; }
.pagehead .back .ic { width: 18px; height: 18px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 15px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
h2 a, h2 .act { font-family: var(--f-body); font-size: 13px; font-weight: 500; }
.num, .q { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bad-t { color: var(--bad); }
.good-t { color: var(--ok); }

/* ---------------------------------------------------------------- blocks */
.cols { display: grid; gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
@media (min-width: 900px) { .cols { grid-template-columns: 1.3fr 1fr; align-items: start; } }
section { min-width: 0; }
.card { background: var(--surface); border-radius: 16px; overflow: hidden; }
.pad { padding: 16px; }
.alertcard { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--bad-soft); color: var(--bad); padding: 14px 16px; border-radius: 16px; }
.alertcard b { display: block; }
.alertcard.warn { background: var(--warn-soft); color: var(--warn); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border-radius: 16px; padding: 14px; display: grid; gap: 2px; }
.kpi .v { font-family: var(--f-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qbtn { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 14px; display: grid; gap: 8px; font-weight: 600; }
.qbtn.alt { background: var(--surface); color: var(--ink); }
@media (min-width: 900px) { .quick { display: none; } }

.list { display: grid; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:last-child { border-bottom: 0; }
a.row:hover, summary.row:hover { background: var(--surface-2); }
.row.two { grid-template-columns: minmax(0, 1fr) auto; }
.row.three { grid-template-columns: minmax(0, 1fr) auto auto; }
.row .t { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { text-align: right; }
.row .r .q { font-weight: 500; }
.row .full { grid-column: 2 / -1; }
.badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-family: var(--f-display); font-weight: 700; font-size: 13px; }
.badge .ic { width: 18px; height: 18px; }
.badge.low { background: var(--bad-soft); color: var(--bad); }
.badge.in { background: var(--accent-soft); color: var(--accent); }
.badge.sale { background: var(--ok-soft); color: var(--ok); }
.empty { color: var(--muted); text-align: center; padding: 22px 14px; margin: 0; }
.day { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 4px -10px; }

.bar { position: relative; height: 6px; background: var(--surface-2); border-radius: 4px; margin-top: 6px; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); }
.bar.low i { background: var(--bad); }
.bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); }

.hero { background: var(--surface); border-radius: 16px; padding: 18px; display: grid; gap: 4px; }
.hero .big { font-family: var(--f-display); font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.hero .big small { font-family: var(--f-body); font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.low { background: var(--bad-soft); color: var(--bad); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg a { text-align: center; padding: 7px 4px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 0 12px; border: 1px solid var(--line); }
.search .ic { width: 18px; height: 18px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 11px 0; }
.search input:focus { outline: none; }

/* ---------------------------------------------------------------- forms */
form.stackform { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--bad); font-size: 12.5px; }
.validation-summary-errors ul { margin: 0; padding: 12px 14px 12px 30px; background: var(--bad-soft); color: var(--bad); border-radius: 12px; }
.validation-summary-valid { display: none; }
.btn { display: block; border: 0; cursor: pointer; text-align: center; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 14px; width: 100%; }
.btn.ghost { background: var(--surface); color: var(--accent); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.textdanger { background: transparent; color: var(--bad); padding: 10px; }
.linkbtn { border: 0; background: none; cursor: pointer; padding: 6px; color: var(--muted); display: grid; place-items: center; border-radius: 8px; }
.linkbtn:hover { color: var(--bad); background: var(--bad-soft); }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.stepper button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; font-size: 22px; font-weight: 500; color: var(--accent); cursor: pointer; }
.stepper input { text-align: center; font-family: var(--f-mono); font-size: 20px; }
.option { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; background: var(--surface); border-radius: 16px; padding: 16px; color: var(--ink); }
.option .badge { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; }
.option b { font-size: 16px; }
details.addbox > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent); padding: 14px 16px; }
details.addbox > summary::-webkit-details-marker { display: none; }
details.addbox[open] > summary { border-bottom: 1px solid var(--line); }
details.txn > summary { list-style: none; cursor: pointer; }
details.txn > summary::-webkit-details-marker { display: none; }
details.txn[open] > summary { background: var(--surface-2); }
details.txn .more { padding: 4px 14px 14px 62px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
details.txn:last-child .more { border-bottom: 0; }
.mvline { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.check .row.short { background: var(--bad-soft); }
.check .head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); z-index: 20; background: var(--ink); color: var(--surface);
         border-radius: 12px; padding: 12px 14px; font-weight: 500; text-align: center; max-width: 480px; margin: 0 auto; transition: opacity .3s; }
.toast.hide { opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .toast { left: auto; right: 24px; bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------------------------------------------------------------- sign-in pages */
.authpage { min-height: 100vh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.authbox { width: 100%; max-width: 400px; display: grid; gap: 20px; }
.authbrand { display: flex; align-items: center; gap: 12px; justify-content: center; }
.authbrand b { font-family: var(--f-display); font-size: 20px; display: block; line-height: 1.1; }
.authbrand small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.authtitle { font-family: var(--f-display); font-size: 22px; margin: 0; }
