/* LABS PTG admin: tokens (copied from src/css/tokens.css), base, app shell and sign-in screens. */
:root {
  --paper: #fbfcfe;
  --paper-2: #f3f6fb;
  --ink: #0b1230;
  --ink-2: #3a4258;
  --muted: #5e6679;
  --line: #dde4ee;
  --line-2: #c9d2e0;
  --blue: #3761d9;
  --blue-ink: #2a4fc0;
  --blue-soft: #e6edfb;
  --blue-label: #050d1f;

  --tile-ice: #e7eefa;
  --tile-mint: #e4f3ec;
  --tile-sand: #f5efe4;
  --tile-lilac: #ece9f7;
  --tile-slate: #e8edf3;
  --tile-rose: #f6e9e8;
  --tile-sage: #e9f0e6;

  --ok: #1d7f4f;
  --warn: #b26a00;
  --bad: #b3261e;

  --font: "General Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgb(11 18 48 / 0.06), 0 1px 1px rgb(11 18 48 / 0.04);
  --shadow-2: 0 10px 30px -12px rgb(11 18 48 / 0.18);

  --wrap: 1240px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --section: clamp(3.5rem, 8vw, 7rem);

  --fs-1: clamp(2.5rem, 1.6rem + 3.6vw, 4.75rem);
  --fs-2: clamp(1.9rem, 1.3rem + 2.2vw, 3.25rem);
  --fs-3: clamp(1.35rem, 1.1rem + 1vw, 1.9rem);
  --fs-4: 1.125rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-micro: 0.8125rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Admin-only values, all derived from the tokens above. */
  --admin-bg: color-mix(in srgb, var(--paper-2) 55%, #fff);
  --card: #fff;
  --side-w: 240px;
  --top-h: 56px;
  --ctl-h: 36px;
  --page-w: 1120px;
  --pad: clamp(16px, 3vw, 32px);
  --amber-bg: #fcefd2;
  --amber-fg: #7a4a00;
  --green-bg: #dff2e7;
  --green-fg: #14603b;
  --red-bg: #fbe3e1;
  --grey-bg: #e9edf3;
}

@font-face { font-family: "General Sans"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/general-sans-var.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-500.woff2) format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--admin-bg); color: var(--ink);
  font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--blue-ink); }
/* Short helper copy: balanced lines, never a stranded word (the defence only asks for "pretty"). */
main p, dialog p, .auth-box p, .field-hint, .panel-sub, .switch-label { text-wrap: balance; }
/* The layout defence caps li at 68ch; list rows inside panels run full width. */
.list .list-item, .timeline .timeline-item, .guide .guide-item, .plain li { max-inline-size: none; }
img, svg { display: block; }
.icon { display: inline-grid; place-items: center; flex: none; width: var(--icon, 20px); height: var(--icon, 20px); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.main:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -64px; z-index: 200; background: var(--ink); color: #fff; padding: 12px 16px; min-height: 44px; border-radius: var(--r-pill); text-decoration: none; }
.skip-link:focus { top: 8px; }
.noscript { padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.link, .link-btn { color: var(--blue-ink); text-decoration: none; font-weight: 500; background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit; cursor: pointer; }
.link:hover, .link-btn:hover { text-decoration: underline; }

/* ---- app shell ---- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--top-h) auto 1fr; min-height: 100vh; min-height: 100dvh; }
.topbar {
  grid-column: 1 / -1; grid-row: 1; position: sticky; top: 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 44px; text-decoration: none; color: var(--ink); width: calc(var(--side-w) - 32px); flex: none; }
.brand img { width: 28px; height: 28px; }
.brand-word { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.brand-word b { color: var(--blue); font-weight: 700; }
.brand-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 8px; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn.menu-toggle { display: none; }

/* Live site pill (live-status.js): state colour, dot and short label; the popover hangs under it. */
.live-pill-host { position: relative; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 44px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  font: 600 12.5px/1 var(--font); cursor: pointer; white-space: nowrap; background: var(--grey-bg); color: var(--ink-2);
}
.live-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.live-pill[data-tone="ok"] { background: var(--green-bg); color: var(--green-fg); }
.live-pill[data-tone="busy"] { background: var(--blue-soft); color: var(--blue-ink); }
.live-pill[data-tone="wait"] { background: var(--amber-bg); color: var(--amber-fg); }
.live-pill[data-tone="bad"] { background: var(--red-bg); color: var(--bad); }
.live-pill[data-tone="busy"] .live-pill-dot { animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: 0.35; } }

.topsearch { position: relative; flex: 1 1 auto; max-width: 560px; margin-inline: auto; }
.topsearch > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topsearch .topsearch-input { padding-left: 38px; border-radius: var(--r-pill); background: var(--paper-2); border-color: var(--line); }
.topsearch-input:focus { background: #fff; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); max-height: min(70vh, 460px); overflow: auto; padding: 8px; z-index: 60; }
.search-group { padding: 8px 12px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.search-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search-item[aria-selected="true"], .search-item:hover { background: var(--paper-2); }
.search-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.search-meta { color: var(--muted); font-size: 12.5px; text-align: right; overflow-wrap: anywhere; }
.search-empty { padding: 16px 12px; color: var(--muted); }

.side {
  grid-row: 3; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h));
  overflow-y: auto; background: var(--paper-2); border-right: 1px solid var(--line); padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.side-list { display: grid; gap: 4px; }
.side-item { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.side-item:hover { background: rgb(11 18 48 / 0.05); color: var(--ink); }
.side-item[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.side-sub { margin-left: 16px; height: 32px; font-size: 13px; }
.side-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 8px; border-radius: var(--r-pill); background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 12px; }

.main { grid-column: 2; grid-row: 3; width: 100%; max-width: calc(var(--page-w) + 2 * var(--pad)); justify-self: center; min-width: 0; padding: 24px var(--pad) 96px; }
.main > * + * { margin-top: 16px; }
.main > .page-head + * { margin-top: 20px; }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgb(11 18 48 / 0.35); z-index: 35; }

/* ---- signed-out screens ---- */
.auth-view { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-boot { width: min(320px, 100%); }
.auth-box { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; display: grid; gap: 12px; box-shadow: var(--shadow-1); }
.auth-mark { width: 44px; height: 44px; }
.auth-brand { font-weight: 700; font-size: 14px; letter-spacing: 0.04em; margin-top: 4px; }
.auth-brand b { color: var(--blue); }
.auth-title { font-size: 24px; letter-spacing: -0.02em; }
.auth-text { color: var(--muted); }
.auth-form { display: grid; gap: 16px; margin-top: 12px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 13px; }
.auth-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.form-error { color: var(--bad); background: var(--red-bg); border-radius: 10px; padding: 12px 12px; }
.btn-block { width: 100%; }

/* ---- below 1024px: sidebar becomes a top drawer ---- */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { grid-column: 1; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .brand { width: auto; }
  .side {
    position: fixed; left: 0; right: 0; top: var(--top-h); height: auto; max-height: calc(100dvh - var(--top-h)); z-index: 38;
    border-right: 0; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2);
    visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
  }
  body.drawer-open .side { visibility: visible; opacity: 1; transform: none; }
  .side-item { height: 44px; }
  .side-sub { height: 40px; }
}
@media (max-width: 767px) {
  a.btn.view-store { display: none; }
  .brand-tag { display: none; }
}
@media (max-width: 639px) {
  .live-pill { gap: 5px; padding: 0 9px; font-size: 12px; }
  .live-pill-time { display: none; }
}
@media (max-width: 559px) {
  .brand { justify-content: center; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand-word { display: none; }
  .main { padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
