/* Store Assist dashboard — the design system (dashboard-spec §1).
 *
 * Same language as the handset: paper and ink, one rust accent, mono for
 * every number and identifier. The sidebar is ink and the workspace is paper,
 * which is the app's own duality at desk scale — and it keeps navigation
 * visually out of the way of the data, which is what an ops user came for.
 *
 * Numbers here obey the product rules the phone obeys: a count never appears
 * without its freshness, and a stale figure is coloured, never quietly shown.
 */

:root {
  /* surfaces */
  --paper: #F4F2EE;
  --card: #FFFFFF;
  --ink: #14120F;
  --ink-2: #241F1A;
  --ink-3: #35302A;

  /* text */
  --text: #14120F;
  --body: #5E5851;
  --muted: #8F8880;
  --on-ink: #F4F2EE;
  --on-ink-muted: rgba(244,242,238,.62);
  --on-ink-faint: rgba(244,242,238,.40);

  /* accent + signal */
  --accent: #B8451A;
  --danger: #B23124;
  --danger-soft: rgba(178,49,36,.09);
  --ok: #2F6B4F;
  --ok-soft: rgba(47,107,79,.10);
  --warn: #8A6410;
  --warn-soft: rgba(138,100,16,.11);

  /* lines + shadow */
  --line: rgba(20,18,15,.11);
  --line-strong: rgba(20,18,15,.20);
  --shadow-sm: 0 1px 2px rgba(20,18,15,.05);
  --shadow-md: 0 4px 16px rgba(20,18,15,.07);

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  --r-control: 9px;
  --r-card: 14px;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- app shell */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: var(--on-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--on-ink); font-weight: 700; font-size: 15px;
  padding: 4px 8px 20px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--card);
  display: grid; place-items: center; flex: none;
}
.brand-mark span { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-control);
  color: var(--on-ink-muted); font-size: 14px; font-weight: 500;
}
.side-nav a:hover { background: var(--ink-2); color: var(--on-ink); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--ink-3); color: var(--on-ink); font-weight: 600; }
.side-nav svg { width: 17px; height: 17px; flex: none; }

.side-label {
  font: 500 10px var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--on-ink-faint); padding: 20px 10px 7px;
}

.side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* Focusable but invisible: the label is the control, and a checkbox that
   cannot be tabbed to is a menu a keyboard cannot open. */
.nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; }
.nav-toggle-btn { display: none; }
.nav-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(244,242,238,.13); }
.side-account { padding: 4px 10px 12px; }
.side-tenant { font-size: 13px; font-weight: 600; color: var(--on-ink); }
.side-email {
  font: 400 11px var(--mono); color: var(--on-ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-foot button {
  width: 100%; height: 34px; border-radius: var(--r-control);
  background: transparent; border: 1px solid rgba(244,242,238,.22);
  color: var(--on-ink-muted); font: 500 13px var(--sans); cursor: pointer;
}
.side-foot button:hover { background: var(--ink-2); color: var(--on-ink); }

.workspace { min-width: 0; padding: 30px 34px 70px; }
.workspace-inner { max-width: 940px; }

/* --------------------------------------------------------------- page header */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
h1 { font-size: 27px; letter-spacing: -0.022em; line-height: 1.15; }
.page-sub { color: var(--body); font-size: 14px; margin-top: 6px; max-width: 68ch; }

h2 { font-size: 15px; letter-spacing: -0.01em; margin: 30px 0 12px; }
h3 { font-size: 14px; margin: 0 0 6px; }

.eyebrow {
  font: 500 10px var(--mono); letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted);
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.note { color: var(--body); font-size: 13px; line-height: 1.55; }

/* --------------------------------------------------------------------- cards */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card + .card { margin-top: 14px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 14px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* --------------------------------------------------------------------- stats */

.stat { padding: 16px 18px; }
.stat-value {
  font: 700 30px var(--mono); letter-spacing: -0.03em;
  margin-top: 8px; line-height: 1;
}
.stat-meta { font-size: 12px; color: var(--muted); margin-top: 7px; }
.stat.is-zero .stat-value { color: var(--muted); }

/* ------------------------------------------------------------------- buttons */

.btn, button {
  font: 600 14px var(--sans); cursor: pointer;
  height: 40px; padding: 0 16px; border-radius: var(--r-control);
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:hover, button:hover { background: var(--ink-2); text-decoration: none; }
.btn-secondary {
  background: var(--card); color: var(--text); border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--paper); }
.btn-ghost {
  background: transparent; color: var(--body); border-color: transparent;
}
.btn-ghost:hover { background: rgba(20,18,15,.05); color: var(--text); }
.btn-danger { background: var(--card); color: var(--danger); border-color: rgba(178,49,36,.35); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.store-badge svg { width: 18px; height: 18px; flex: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 11px var(--mono); letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(20,18,15,.06); color: var(--body);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* -------------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font: 500 10px var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding: 11px 20px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(20,18,15,.018); }
td.right, th.right { text-align: right; }
td form { display: inline; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------- banners */

.banner {
  display: flex; gap: 11px; align-items: flex-start;
  border-radius: var(--r-card); padding: 13px 16px;
  font-size: 14px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line);
}
.banner-ok { background: var(--ok-soft); border-color: rgba(47,107,79,.22); color: var(--ok); }
.banner-danger { background: var(--danger-soft); border-color: rgba(178,49,36,.24); color: var(--danger); }
.banner-warn { background: var(--warn-soft); border-color: rgba(138,100,16,.24); color: var(--warn); }
.banner svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.banner strong { font-weight: 650; }

/* -------------------------------------------------------------- empty states */

/* A fresh tenant sees these more than anything else, so they carry the
   onboarding load: say what is missing, why, and exactly what to do next. */
.empty { text-align: center; padding: 40px 24px; }
.empty-mark {
  width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--paper); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
}
.empty-mark svg { width: 20px; height: 20px; }
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { color: var(--body); font-size: 13.5px; max-width: 46ch; margin: 0 auto 16px; line-height: 1.55; }

/* --------------------------------------------------------------- onboarding */

.checklist { display: grid; gap: 0; }
.check-item {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.check-item:last-child { border-bottom: none; }
.check-box {
  width: 21px; height: 21px; border-radius: 999px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  font: 600 11px var(--mono); color: var(--muted);
}
.check-item.done .check-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item.done .check-title { color: var(--muted); }
.check-body { flex: 1; min-width: 0; }
.check-title { font-size: 14px; font-weight: 600; }
.check-text { font-size: 13px; color: var(--body); margin-top: 2px; }

/* --------------------------------------------------------------------- forms */

form.stack { display: grid; gap: 15px; max-width: 460px; }
form.stack.wide { max-width: 100%; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; }
.field-hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--text);
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--r-control); padding: 0 13px; height: 42px;
}
textarea { padding: 12px 13px; height: auto; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,18,15,.07);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }

.check-inline { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; }
.check-inline input { width: 17px; height: 17px; accent-color: var(--ink); }

/* ------------------------------------------------------------ code + secrets */

.code-block {
  font: 500 12.5px/1.6 var(--mono); background: var(--ink); color: var(--on-ink);
  border-radius: var(--r-card); padding: 15px 17px; overflow-x: auto;
  white-space: pre; -webkit-overflow-scrolling: touch;
}

.secret {
  background: var(--ink); color: var(--on-ink);
  border-radius: var(--r-card); padding: 20px;
}
.secret .code {
  font: 700 27px var(--mono); letter-spacing: .08em; margin: 9px 0 12px;
  word-break: break-all; line-height: 1.25;
}
.secret .note { color: var(--on-ink-muted); }
.secret .eyebrow { color: var(--on-ink-faint); }

.qr-box { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; padding: 20px; }
.qr-box img {
  width: 208px; height: 208px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); padding: 8px; flex: none;
}
.qr-side { flex: 1; min-width: 260px; }
.token-strip {
  font: 500 13px var(--mono); background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-control); padding: 10px 12px; word-break: break-all;
  margin: 8px 0 12px;
}

/* ---------------------------------------------------------------- auth pages */

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { color: var(--text); padding: 0 0 22px; justify-content: center; }
.auth-card .brand-mark { background: var(--ink); }
.auth-card .brand-mark span { background: var(--accent); }
.auth-box { background: var(--card); border: 1px solid var(--line);
            border-radius: var(--r-card); padding: 26px; box-shadow: var(--shadow-md); }
.auth-box h1 { font-size: 21px; margin-bottom: 5px; }
.auth-box .page-sub { margin-bottom: 20px; font-size: 13.5px; }
.auth-box form.stack { max-width: 100%; }
.auth-box button[type=submit] { width: 100%; }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--body); margin-top: 18px; }
.auth-links { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 62px; }
.pw-toggle {
  position: absolute; right: 5px; top: 5px; height: 32px; padding: 0 10px;
  background: transparent; border: none; color: var(--body);
  font: 500 12px var(--sans); cursor: pointer; border-radius: 7px;
}
.pw-toggle:hover { background: rgba(20,18,15,.06); color: var(--text); }

/* Strength is advice, not a gate — a meter that blocks submission teaches
   people to append "1!" and nothing more. */
.pw-meter { display: flex; gap: 4px; margin-top: 7px; }
.pw-seg { height: 3px; flex: 1; border-radius: 999px; background: var(--line); }
.pw-seg.on-weak { background: var(--danger); }
.pw-seg.on-fair { background: var(--warn); }
.pw-seg.on-good { background: var(--ok); }
.pw-label { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ----------------------------------------------------------------- docs page */

/* minmax(0, 1fr), not 1fr. A grid track's default min-width is auto, so a wide
   code block STRETCHES the column rather than scrolling inside it — which
   pushes the whole page wider than the viewport and makes the guide something
   you read sideways. The overflow-x on .code-block only works once the track
   it sits in is actually constrained. */
.docs { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 34px; align-items: start; }
.docs-toc { position: sticky; top: 30px; font-size: 13px; display: grid; gap: 7px; }
.docs-toc .eyebrow { margin-bottom: 3px; }
.docs-toc a { color: var(--body); }
.docs-toc a:hover { color: var(--accent); }
.docs-body h2 { margin: 34px 0 10px; font-size: 17px; }
.docs-body h2:first-child { margin-top: 0; }
.docs-body h3 { margin: 22px 0 7px; font-size: 14.5px; }
.docs-body p { font-size: 14px; color: var(--body); margin-bottom: 12px; line-height: 1.62; }
.docs-body ul, .docs-body ol { font-size: 14px; color: var(--body); margin: 0 0 12px 20px; line-height: 1.62; }
.docs-body li { margin-bottom: 5px; }
.docs-body table { margin-bottom: 16px; background: var(--card);
                   border: 1px solid var(--line); border-radius: var(--r-card); }
.docs-body th, .docs-body td { padding: 9px 13px; font-size: 13px; }
.docs-body code {
  font: 500 12.5px var(--mono); background: rgba(20,18,15,.055);
  padding: 2px 5px; border-radius: 5px;
}
.docs-body .code-block code { background: none; padding: 0; color: inherit; }

/* Fenced code in the guide arrives from the markdown renderer as a bare
   <pre><code> with no class to hang styling on, and a <pre> defaults to
   overflow: visible. So a long curl or a wide JSON line did not scroll — it
   spilled, and pushed the whole page wider than the window. The guide was
   something you read sideways, which is a poor answer to "here is a clear
   example". Only .code-block, written by hand in the templates, carried the
   overflow rule. */
.docs-body pre { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.docs-body strong { color: var(--text); font-weight: 650; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  /* Was a horizontally scrolling strip: ten links and a sign-out button in a
     row 390px wide, so a phone showed the brand and almost nothing else, with
     no hint that the rest was off to the right. A phone gets a menu instead. */
  .sidebar {
    position: sticky; top: 0; z-index: 30;
    height: auto; padding: 10px 14px; overflow: visible;
  }
  .brand { padding: 0; }
  .nav-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 14px; border-radius: var(--r-control);
    border: 1px solid rgba(244,242,238,.22); color: var(--on-ink);
    font: 500 14px var(--sans); cursor: pointer; user-select: none;
  }
  .nav-toggle-btn svg { width: 18px; height: 18px; }
  .nav-toggle:focus-visible ~ .side-top .nav-toggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-body { display: none; }
  .nav-toggle:checked ~ .nav-body { display: flex; margin-top: 12px; }
  /* Vertical again, so the section labels earn their space back and every
     target is a comfortable tap rather than a squeezed one. */
  .side-nav a { padding: 12px 10px; font-size: 15px; }
  .side-label { padding: 16px 10px 6px; }
  .side-foot { margin-top: 14px; }
  .workspace { padding: 22px 18px 60px; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; }
  .docs-toc { display: none; }
}

@media (max-width: 520px) {
  h1 { font-size: 23px; }
  .cols-4 { grid-template-columns: 1fr; }
  th, td { padding-left: 14px; padding-right: 14px; }
  .workspace { padding: 18px 14px 50px; }
}

/* Public documentation page — the docs grid without the app sidebar. */
.docs-public { max-width: 1040px; margin: 0 auto; padding: 0 20px 60px; }
.docs-public-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 0 26px;
}
.docs-public-head nav { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.docs-public-head .button-link {
  background: var(--accent, #D9531E); color: #fff; padding: 8px 14px;
  border-radius: 8px; font-weight: 600;
}
.docs-public-head .brand { color: var(--text); padding: 0; }
.docs-public-head .brand-mark { background: var(--ink, #14120F); }

/* Documentation tabs — user guide vs API reference. */
.docs-tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 22px; }
.docs-tabs a {
  padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--text-dim, #5E5851); border: 1px solid transparent;
}
.docs-tabs a[aria-current="page"] { background: var(--card, #fff); border-color: var(--hairline, rgba(20,18,15,.12)); color: var(--text, #14120F); }
.docs-tabs .docs-raw { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--accent, #D9531E); }
