/* ═══════════════════════════════════════════════════════════════════════════
   AMP Command Center v2 — one stylesheet for every page.
   Follows DESIGN.md (Retail Operations Hub): Horizon display + Poppins body,
   warm internal palette, 10px cards, 220px sidebar, status = dot + word.
   No gradients, no backdrop-filter, no hover transforms (shadow only).
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: "Horizon"; src: url("/fonts/horizon/Horizon.otf") format("opentype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/Poppins-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/Poppins-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/Poppins-SemiBold.otf") format("opentype"); font-weight: 600 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --font-display: "Horizon", "Poppins", system-ui, sans-serif;
  --font-body: "Poppins", system-ui, sans-serif;
  --bg: #FAFAF9; --surface: #FFFFFF; --surface-hover: #F5F5F4;
  /* --muted is 4.8:1 on white and 5.3:1 on a hovered row */
  --text: #1C1917; --text-2: #57534E; --muted: #6B645F; --disabled: #C9C4BE;
  --border: #E8E4DF; --border-subtle: #F1EEEA;
  /* Edge of inputs and text areas: 3.8:1 on white, so the field is findable */
  --field-border: #8A827B;
  --accent: #6B3FA0; --accent-bg: rgba(107,63,160,.08); --accent-hover: #5A3488; --on-accent: #FFFFFF;
  --avatar-bg: #EDE6F5; --notice-ink: #78350F; --red-ink: #7F1D1D; --green-ink: #14532D;
  --amber: #B45309; --amber-bg: #FEF3C7;
  --blue: #1D4ED8; --blue-bg: #DBEAFE;
  --green: #15803D; --green-bg: #DCFCE7;
  --red: #B91C1C; --red-bg: #FEE2E2;
  --gray: #78716C; --gray-bg: #F1EEEA;
  --toast-bg: #1C1917; --toast-ink: #FFFFFF;
  --hover-wash: rgba(28,25,23,.03);
  --logo-filter: none;
  --series-revenue: #6B3FA0; --series-expenses: #C47A5A;
  /* Small text in page scripts' inline styles: rem so it scales, bigger on phones */
  --fs-note: 0.75rem; --fs-small: 0.7812rem; --fs-tag: 0.7188rem;
  /* Badges are for things that need you: red, white count, 6.5:1 */
  --badge-bg: #B91C1C;
  --shadow: 0 4px 12px rgba(0,0,0,.04); --shadow-hover: 0 6px 16px rgba(0,0,0,.06);
  --r-card: 10px; --r-btn: 6px;
}

/* Dark appearance follows the system setting; there is no in-app switch.
   Contrast on the card surface #24201D: text 14.8:1, text-2 10.9:1,
   muted 6.4:1, accent 6.8:1, dark ink on accent buttons 7.4:1. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --surface: #24201D; --surface-hover: #2E2925;
    --text: #F5F5F4; --text-2: #D6D3D1; --muted: #A8A29E; --disabled: #57534E;
    --border: #3A3430; --border-subtle: #2F2A26;
    --field-border: #8A827B;
    --accent: #B99AE8; --accent-bg: rgba(185,154,232,.14); --accent-hover: #CDB6F0; --on-accent: #1C1917;
    --avatar-bg: rgba(185,154,232,.18); --notice-ink: #FDE68A; --red-ink: #FECACA; --green-ink: #BBF7D0;
    --amber: #FBBF24; --amber-bg: rgba(251,191,36,.14);
    --blue: #60A5FA; --blue-bg: rgba(96,165,250,.14);
    --green: #4ADE80; --green-bg: rgba(74,222,128,.12);
    --red: #F87171; --red-bg: rgba(248,113,113,.14);
    --gray: #A8A29E; --gray-bg: #2F2A26;
    --toast-bg: #F5F5F4; --toast-ink: #1C1917;
    --hover-wash: rgba(255,255,255,.04);
    /* The wordmark artwork is black: flip it to white, keep the purple bolt purple. */
    --logo-filter: invert(1) hue-rotate(180deg);
    /* 8.4:1 and 3.8:1 on the card, 2.2:1 apart (same gap as light) so bars differ by more than hue */
    --series-revenue: #C9B0F0; --series-expenses: #B0694C;
    --shadow: 0 4px 12px rgba(0,0,0,.3); --shadow-hover: 0 6px 16px rgba(0,0,0,.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* The drawer animates in, so it is hidden with inert/visibility rather than display. */
.drawer[hidden] { display: flex !important; visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: var(--r-btn); text-decoration: none; font-weight: 500; }
.skip:focus { top: 8px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.linkbtn:hover { text-decoration: underline; }
.page:focus { outline: none; }
/* Sizes are in rem so the browser's text-size setting scales the whole UI
   (1rem = the person's default, 16px unless they changed it). */
html { font-size: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body { font: 400 0.875rem/1.5 var(--font-body); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: inherit; }
.bolt { width: 26px; height: 26px; border-radius: 6px; background: var(--text); display: grid; place-items: center; flex-shrink: 0; }
.brand-name { font: 600 0.7812rem/1.1 var(--font-display); letter-spacing: .06em; }
.brand-bolt { width: 18px; height: auto; flex-shrink: 0; }
.brand-mark { display: block; width: 88px; height: auto; filter: var(--logo-filter); }
.brand-sub { margin-top: 3px; }
.gate-brand { flex-direction: column; gap: 6px; padding: 0 0 22px; }
.brand-logo { width: 112px; height: auto; filter: var(--logo-filter); }
.brand-sub { font-size: 0.6875rem; color: var(--muted); }
.group { font-size: 0.6562rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-btn); color: var(--text-2); font-size: 0.8438rem; text-decoration: none; transition: background .08s; }
.nav:hover { background: var(--surface-hover); }
.nav.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.nav svg { flex-shrink: 0; }
.nav .soon { margin-left: auto; font-size: 0.625rem; color: var(--muted); }
.badge { margin-left: auto; font-size: 0.6875rem; font-weight: 600; background: var(--badge-bg); color: #FFFFFF; border-radius: 9999px; padding: 0 7px; line-height: 18px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 9999px; background: var(--avatar-bg); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 0.75rem; flex-shrink: 0; }
.v1-link { font-size: 0.7188rem; color: var(--muted); text-decoration: none; }
.v1-link:hover { color: var(--accent); }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 14px 32px; min-height: 64px; }
.crumb { font-size: 0.75rem; color: var(--muted); }
.title { font: 600 1.125rem/1.2 var(--font-display); letter-spacing: .02em; margin: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync { font-size: 0.75rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.page { padding: 28px 32px 64px; max-width: 1280px; }

/* ── Type ──────────────────────────────────────────────────────────────── */
.greet { font: 600 1.75rem/1.15 var(--font-display); margin: 0 0 6px; letter-spacing: .01em; }
.lede { color: var(--text-2); margin: 0 0 28px; max-width: 760px; }
.section { margin-top: 32px; }
.section-t { font: 600 0.875rem/1.2 var(--font-display); letter-spacing: .02em; margin: 0 0 12px; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; }
.card-t { font: 600 0.875rem/1.2 var(--font-display); letter-spacing: .02em; margin: 0; }
.card-h .end { margin-left: auto; }
.card-link { font-size: 0.7812rem; color: var(--accent); text-decoration: none; font-weight: 500; background: none; border: none; cursor: pointer; padding: 0; }
.card-link:hover { text-decoration: underline; }
.count { font-size: 0.75rem; color: var(--muted); }
.card-b { padding: 0 20px 18px; }
.row { padding: 12px 20px; border-top: 1px solid var(--border-subtle); }
.row.click { cursor: pointer; transition: background .08s; }
.row.click:hover { background: var(--surface-hover); }
.empty { padding: 20px; color: var(--muted); font-size: 0.8125rem; }
.error { padding: 14px 20px; color: var(--red); font-size: 0.8125rem; }
.err-detail { margin-top: 4px; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }

/* ── Stat cards (label above value, DESIGN.md) ─────────────────────────── */
.stat { padding: 16px 20px; }
.stat-l { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.stat-v { font-size: 1.5rem; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: 0.875rem; color: var(--muted); font-weight: 500; }
.stat-d { font-size: 0.75rem; color: var(--text-2); margin-top: 2px; }
.up { color: var(--green); font-weight: 500; }
.down { color: var(--red); font-weight: 500; }
.bar { height: 6px; border-radius: 9999px; background: var(--border-subtle); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 9999px; }

/* ── Pills: always dot + word ──────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7188rem; font-weight: 500; border-radius: 9999px; padding: 2px 9px; white-space: nowrap; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); }
.dot { width: 7px; height: 7px; border-radius: 9999px; display: inline-block; flex-shrink: 0; }
.pill .dot { width: 6px; height: 6px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r-btn); padding: 7px 14px; font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: box-shadow .1s, background .1s; min-height: 34px; white-space: nowrap; }
.btn:hover { box-shadow: var(--shadow-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.sm { padding: 4px 10px; font-size: 0.7812rem; min-height: 30px; }
.btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); box-shadow: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Queue rows ────────────────────────────────────────────────────────── */
.q { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.q-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-meta { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.input, .textarea, .select { border: 1px solid var(--field-border); border-radius: var(--r-btn); padding: 7px 12px; font-size: 0.8125rem; background: var(--surface); min-height: 34px; width: 100%; }
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.label { font-size: 0.75rem; font-weight: 500; color: var(--muted); display: block; margin-bottom: 4px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { position: sticky; top: 0; text-align: left; font-size: 0.6875rem; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); font-size: 0.8438rem; }
.t.deals th, .t.deals td { padding-left: 10px; padding-right: 10px; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--surface-hover); }
.t .r { text-align: right; }

/* ── Drawer: from the right, 200ms ease-out, dims the background ───────── */
.scrim { position: fixed; inset: 0; background: rgba(28,25,23,.25); opacity: 0; pointer-events: none; transition: opacity .2s ease-out; z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .2s ease-out; z-index: 21; display: flex; flex-direction: column; }
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: none; visibility: visible; }
.drawer-h { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
/* Item titles are sentences, not headings: body face, not Horizon. */
.drawer-title { font: 600 1.0625rem/1.35 var(--font-body); margin: 2px 0 0; }
.drawer-b { padding: 20px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 0.8125rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Agent-written markdown, rendered safely */
.md { font-size: 0.8438rem; line-height: 1.6; color: var(--text); }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md h3, .md h4 { font: 600 0.8125rem/1.3 var(--font-body); margin: 14px 0 6px; }
.md code { font-size: 0.7812rem; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }
.md mark, mark.blank { background: var(--amber-bg); color: var(--amber); padding: 0 3px; border-radius: 3px; }
.md .table-wrap { margin: 0 0 12px; border: 1px solid var(--border); border-radius: 8px; }
.md .t th { position: static; padding: 8px 10px; white-space: normal; }
.md .t td { padding: 8px 10px; font-size: 0.7812rem; vertical-align: top; }
.quote { border-left: 3px solid var(--border); padding: 4px 12px; color: var(--text-2); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-ink); font-size: 0.8125rem; padding: 10px 16px; border-radius: var(--r-btn); box-shadow: var(--shadow-hover); z-index: 40; opacity: 0; transition: opacity .15s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ── Sign-in ───────────────────────────────────────────────────────────── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate .card { width: 100%; max-width: 380px; padding: 28px; }

/* ── Skeleton ──────────────────────────────────────────────────────────── */
.sk { background: var(--border-subtle); border-radius: 4px; height: 12px; margin: 8px 0; }

/* ── Phone: sidebar becomes a bottom tab bar ───────────────────────────── */
.tabbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 12px 16px; min-height: 56px; }
  .sync span { display: none; }
  .page { padding: 20px 16px 104px; }
  .g-main, .g-2, .g-3 { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .greet { font-size: 1.375rem; }
  .q { grid-template-columns: minmax(0, 1fr) auto; }
  .q > .q-type { grid-column: 1 / -1; }
  /* Real titles run long ("Reply: Amber Chaudhry (Noori …"): two lines on phones, then an ellipsis. */
  .q-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .hide-m { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.6875rem; color: var(--muted); text-decoration: none; padding: 4px 0; position: relative; min-height: 44px; justify-content: center; }
  .tab.active { color: var(--accent); font-weight: 500; }
  .tab .badge { position: absolute; top: 0; right: 22%; margin: 0; font-size: 0.6875rem; line-height: 16px; padding: 0 5px; }
  .more-sheet .nav { padding: 12px 10px; font-size: 0.9375rem; }
  /* Phone reading sizes and 44px tap targets (Apple: 17pt default, 11pt minimum, 44x44pt controls) */
  body { font-size: 1rem; }
  .q-meta, .crumb, .stat-l, .stat-d, .count, .sync, .empty, .error, .label { font-size: 0.8125rem; }
  .group, .nav .soon, .rank-note, .pill { font-size: 0.75rem; }
  .card-t, .section-t { font-size: 0.9375rem; }
  .btn, .btn.sm, .seg button { min-height: 44px; font-size: 0.875rem; }
  .input, .select { min-height: 44px; font-size: 1rem; }
  .textarea { font-size: 1rem; }
  .card-link { display: inline-block; padding: 12px 0; margin: -12px 0; font-size: 0.875rem; }
}

/* ── Charts (cc/charts.js) ─────────────────────────────────────────────── */
.chart { padding: 16px 20px 18px; }
.ch-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-title { font: 600 0.875rem/1.2 var(--font-display); letter-spacing: .02em; }
.ch-legend { display: flex; gap: 14px; font-size: 0.75rem; color: var(--text-2); }
.ch-key { display: inline-flex; align-items: center; gap: 6px; }
.ch-key i, .ch-tip-r i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ch-toggle { margin-left: auto; }
.ch-plot { position: relative; }
.ch-svg svg { display: block; overflow: visible; }
.ch-g.on rect { fill: var(--hover-wash); }
.ch-tip { position: absolute; top: 4px; width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-hover); padding: 10px 12px; font-size: 0.75rem; pointer-events: none; z-index: 2; }
.ch-tip-h { font-weight: 600; margin-bottom: 6px; }
.ch-tip-r { display: flex; align-items: center; gap: 6px; color: var(--text-2); margin-top: 2px; }
.ch-tip-r b { margin-left: auto; color: var(--text); font-weight: 600; }
.ch-tip-net { border-top: 1px solid var(--border-subtle); margin-top: 6px; padding-top: 6px; }
.rank { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 18px; }
.rank-top { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8125rem; }
.rank-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-v { font-weight: 500; }
.rank-track { height: 6px; background: var(--border-subtle); border-radius: 9999px; margin-top: 5px; overflow: hidden; }
.rank-track i { display: block; height: 100%; border-radius: 9999px; }
.rank-note { font-size: 0.7188rem; color: var(--muted); margin-top: 3px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-btn); overflow: hidden; background: var(--surface); }
.seg button { border: none; background: none; padding: 6px 12px; font-size: 0.7812rem; color: var(--text-2); cursor: pointer; min-height: 32px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-card); background: var(--amber-bg); color: var(--notice-ink); font-size: 0.8125rem; margin-bottom: 20px; }
@media (max-width: 860px) {
  .ch-legend { order: 3; width: 100%; }
  /* After .seg button above, so the phone size wins */
  .seg button { min-height: 44px; font-size: 0.875rem; }
}
.ch-sum { margin: 0 0 8px; font-size: 0.8125rem; color: var(--text-2); }

/* Money: second line under a deal name, phone-only bits, collapsible card */
.deal-sub { margin-top: 3px; font-size: var(--fs-note); color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.show-m { display: none; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .card-t::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); vertical-align: 2px; }
details.fold[open] > summary .card-t::after { transform: rotate(45deg); vertical-align: 4px; }
/* Collapsed: hug the header instead of stretching to the grid row height */
details.fold:not([open]) { align-self: start; }
details.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-card); }
@media (max-width: 860px) {
  :root { --fs-note: 0.8125rem; --fs-small: 0.875rem; --fs-tag: 0.75rem; }
  .show-m { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  /* Three numbers two-up instead of a full screen of one-per-row cards */
  .grid.stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.stats-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats-3 .stat-v { font-size: 1.25rem; }
}

/* Chief of Staff page: chat + files for agents */
.cos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.cos-chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 480px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { max-width: 82%; align-self: flex-start; font-size: 0.875rem; line-height: 1.55; }
.chat-msg.me { align-self: flex-end; background: var(--accent-bg); border-radius: 10px; padding: 10px 14px; }
.chat-who { font-size: 0.75rem; font-weight: 500; margin-bottom: 4px; }
.chat-att { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chat-att:empty { display: none; }
.chat-queued { margin-top: 8px; }
.chat-compose { border-top: 1px solid var(--border); padding: 12px 16px 14px; display: grid; gap: 8px; }
.chat-compose .textarea { resize: vertical; font-family: var(--font-body); }
.dropzone { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 96px; border: 1.5px dashed var(--border); border-radius: 10px; padding: 16px; font-size: 0.8125rem; color: var(--text-2); cursor: pointer; transition: background .1s, border-color .1s; }
.dropzone:hover, .dropzone.over { background: var(--accent-bg); border-color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1100px) { .cos-grid { grid-template-columns: 1fr; } .cos-chat { height: 70vh; } .chat-msg { max-width: 92%; } }
.chat-msg.me .muted { color: var(--text-2); }

/* Product page builder: review step. Edit on the left; facts, what's open and
   the actions stay in view on the right. */
.pdp-ws { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.pdp-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pdp-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.pdp-h { font: 600 0.875rem/1.2 var(--font-display); letter-spacing: .02em; margin: 0 0 4px; }
.pdp-hint { font-size: 0.7812rem; color: var(--muted); margin: 0 0 12px; }
.pdp-h + .pdp-field, .pdp-h + div { margin-top: 12px; }
.pdp-field + .pdp-field, .grid + .pdp-field { margin-top: 14px; }
.pdp-more > summary { cursor: pointer; font-size: 0.8125rem; font-weight: 500; color: var(--text); padding: 6px 0; }
.pdp-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pdp-side { position: sticky; top: 80px; }
.pdp-photo { aspect-ratio: 1; border-radius: 10px; background: var(--surface-hover); border: 1px solid var(--border-subtle); display: grid; place-items: center; overflow: hidden; margin-bottom: 12px; font-size: 0.7812rem; color: var(--muted); }
.pdp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-side-title { font-weight: 600; font-size: 0.875rem; line-height: 1.35; }
.pdp-kv { grid-template-columns: 70px 1fr; margin: 12px 0 4px; }
.pdp-status { list-style: none; margin: 16px 0; padding: 12px 0 0; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; font-size: 0.7812rem; }
.pdp-status li { display: flex; gap: 8px; align-items: flex-start; }
.pdp-status .pill { flex-shrink: 0; }
.pdp-wide { width: 100%; justify-content: center; }
@media (max-width: 1100px) {
  .pdp-ws { grid-template-columns: 1fr; }
  .pdp-side { position: static; order: 2; }
  .pdp-photo { max-width: 200px; }
}
@media (max-width: 860px) { .pdp-panel .grid.g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Payouts & invoices ── */
a.btn { display: inline-flex; align-items: center; justify-content: center; }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn.ghost.danger-text { color: var(--red); }
.page-note { margin: -8px 0 16px; font-size: 0.8125rem; color: var(--text-2); max-width: 70ch; }
.filters { margin: 20px 0 12px; }
.filters:empty { display: none; }
.filters + .card { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: none; border-radius: 999px; padding: 4px 12px; min-height: 30px; font-size: 0.7812rem; color: var(--text-2); cursor: pointer; }
.chip:hover { background: var(--surface-hover); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 500; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-n { font-variant-numeric: tabular-nums; }
.brand-pick { width: auto; min-width: 200px; }
.late-n { font-size: var(--fs-note); color: var(--red-ink); font-weight: 500; }
.void-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-btn); }
.field-err { font-size: var(--fs-note); color: var(--red-ink); }
.field-err:empty { display: none; }
@media (max-width: 860px) {
  .chip { min-height: 44px; padding: 6px 14px; font-size: 0.875rem; }
  .brand-pick { width: 100%; }
  .page-note { font-size: 0.875rem; }
}

/* ── Pipeline ── */
details.fine-print { padding: 8px 20px 14px; }
details.fine-print > summary { cursor: pointer; font-size: var(--fs-note); color: var(--text-2); width: max-content; }
details.fine-print > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
