/* Brand on Cue components — built only from tokens.css. Class names are documented in docs/DESIGN-SYSTEM.md. */
@import url("/shared/brand/brand.css");   /* Brand on Cue logo (official, Oct 22): the one place that picks the logo files */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: var(--fw-regular) var(--fs-md)/var(--lh) var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss03"; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); font-weight: var(--fw-semibold); }
h1 { font-size: var(--fs-3xl); letter-spacing: var(--tracking-display); font-weight: 680; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 2px; border-radius: var(--r-xs); }
/* never hide focus behind the sticky top bar or the phone tab bar (WCAG 2.4.11 Focus Not Obscured) */
html { scroll-padding-top: calc(var(--topbar-h) + 12px); scroll-padding-bottom: calc(var(--tabbar-h) + 12px); }
::selection { background: var(--brand-soft); }
.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-link { position: absolute; left: var(--s-3); top: -48px; z-index: 100; background: var(--bg-elev); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: var(--s-3); }

/* ---------- Text helpers ---------- */
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.block { display: block; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: var(--s-3); }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.stack-1 > * + * { margin-top: var(--s-1); } .stack-2 > * + * { margin-top: var(--s-2); } .stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); } .stack-6 > * + * { margin-top: var(--s-6); } .stack-8 > * + * { margin-top: var(--s-8); }
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); }
.hide { display: none !important; }
@media (max-width: 720px) { .hide-sm { display: none !important; } }
@media (min-width: 721px) { .show-sm { display: none !important; } }

/* ---------- Buttons ---------- */
.btn { --btn-bg: var(--bg-elev); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: 38px; padding: 0 var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: 1; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-xs); transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1); }
.btn:hover { background: color-mix(in srgb, var(--btn-bg) 92%, var(--text)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 2px; box-shadow: var(--shadow-focus); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: transparent;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(0, 28, 60, .18), 0 2px 6px -2px color-mix(in srgb, var(--brand) 45%, transparent); }
.btn-primary:hover { background-color: var(--brand-strong); }
.btn-secondary { --btn-bg: var(--bg-elev); --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 1px 2px rgba(0, 28, 60, .18); }
.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: var(--danger-border); box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand); --btn-bd: transparent; box-shadow: none; }
.btn-sm { height: 32px; padding: 0 var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { height: 46px; padding: 0 var(--s-6); font-size: var(--fs-lg); border-radius: var(--r-md); }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; color: transparent; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-weight: var(--fw-medium); font-size: var(--fs-sm); color: var(--text); }
.label .opt { color: var(--text-3); font-weight: var(--fw-regular); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.error-text { font-size: var(--fs-xs); color: var(--danger); display: flex; gap: 4px; align-items: center; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--border-input);
  background: var(--bg-elev); color: var(--text); box-shadow: inset 0 1px 1px rgba(0, 28, 60, .04); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.textarea { height: auto; min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: var(--lh); }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus, var(--brand)); outline-offset: 1px; border-color: var(--brand); box-shadow: var(--shadow-focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 var(--s-3); border: 1px solid var(--border-strong); background: var(--bg-sunken); color: var(--text-2); font-size: var(--fs-sm); }
.input-group .addon:first-child { border-radius: var(--r-md) 0 0 var(--r-md); border-right: 0; }
.input-group .addon:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.check { display: inline-flex; gap: var(--s-2); align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: var(--r-full); background: var(--n-300); position: relative; transition: background var(--dur-2) var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease-out); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: var(--shadow-focus); }
.switch input:disabled + .track { opacity: .5; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--bg-sunken); border: 1px solid var(--border); }
.segmented button { border: 0; background: transparent; height: 30px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text-2); font-weight: var(--fw-medium); font-size: var(--fs-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background var(--dur-1), color var(--dur-1); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); font-weight: var(--fw-semibold); }
.segmented button:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 1px; }
.choice-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--bg-elev); cursor: pointer; transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1); text-align: left; }
.choice:hover { border-color: var(--n-300); }
.choice[aria-checked="true"], .choice.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-softer); }
.choice .choice-icon { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: var(--s-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--s-1) 0 var(--s-3); border-radius: var(--r-full); background: var(--bg-sunken); border: 1px solid var(--border); font-size: var(--fs-sm); }
.chip button { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-3); }
.chip button:hover { background: var(--bg-hover); color: var(--text); }
.chip svg { width: 12px; height: 12px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg-elev); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
input[type="color"] { width: 38px; height: 38px; padding: 2px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--bg-elev); cursor: pointer; }

/* ---------- Cards & surfaces ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--s-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--divider); }
.card-head h3 { font-size: var(--fs-lg); }
.card-head h2, .card-head h3 { font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
.card-body { padding: var(--s-5); }
.card-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--divider); display: flex; justify-content: flex-end; gap: var(--s-2); }
.card.is-interactive { transition: border-color var(--dur-1), box-shadow var(--dur-2), transform var(--dur-2) var(--ease-out); cursor: pointer; }
.card.is-interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.surface { background: var(--bg-sunken); border-radius: var(--r-md); padding: var(--s-4); }
.divider { height: 1px; background: var(--divider); border: 0; margin: var(--s-4) 0; }

/* ---------- Stats ---------- */
.stat { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.stat .stat-label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.stat .stat-label svg { width: 15px; height: 15px; color: var(--text-3); }
.stat .stat-value { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 680; letter-spacing: var(--tracking-display); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .stat-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--fw-semibold); font-size: var(--fs-xs); padding: 2px 6px; border-radius: var(--r-full); }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--success); background: var(--success-bg); }
.delta.down { color: var(--danger); background: var(--danger-bg); }
.delta.flat { color: var(--text-2); background: var(--bg-sunken); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  background: var(--bg-sunken); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge-brand { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.badge-hot { color: var(--hot); background: var(--hot-bg); border-color: transparent; }
.badge-warm { color: var(--warm); background: var(--warm-bg); border-color: transparent; }
.badge-cold { color: var(--cold); background: var(--cold-bg); border-color: transparent; }
/* Test / demo / simulated data: a hatched neutral pill with a dashed edge — never green, never mistaken for a real result */
.badge-demo, .badge-test { color: var(--test); border: 1px dashed var(--test-border);
  background: repeating-linear-gradient(135deg, var(--test-bg) 0 5px, var(--test-stripe) 5px 7px); }
/* Status pills: live / real (emerald + dot), draft (neutral), blocked / disconnected (amber + icon), error (red) */
.badge-live { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 25%, transparent); }
.badge-draft { color: var(--draft); background: var(--draft-bg); border-color: var(--border-strong); }
.badge-blocked { color: var(--blocked); background: var(--blocked-bg); border-color: var(--warning-border); }
.badge-error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.badge-lg { height: 26px; padding: 0 10px; font-size: var(--fs-sm); }

/* ---------- Alerts / callouts ---------- */
.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--info-border); background: var(--info-bg); color: var(--text); font-size: var(--fs-sm); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--info); }
.alert-success { border-color: var(--success-border); background: var(--success-bg); } .alert-success svg { color: var(--success); }
.alert-warning { border-color: var(--warning-border); background: var(--warning-bg); } .alert-warning svg { color: var(--warning); }
.alert-danger { border-color: var(--danger-border); background: var(--danger-bg); } .alert-danger svg { color: var(--danger); }
.alert-quiet { border-color: var(--border); background: var(--bg-sunken); } .alert-quiet svg { color: var(--text-3); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; position: relative; }   /* positioned, so visually hidden text inside is clipped too */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th { text-align: left; font-size: 11.5px; font-weight: var(--fw-semibold); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-caps);
  padding: 10px var(--s-4); border-bottom: 1px solid var(--border); background: var(--bg-raised, var(--bg-elev)); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table td { font-variant-numeric: tabular-nums; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 720px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--divider); }
  .table.stack td { border: 0; padding: 2px 0; }
  .table.stack td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 96px; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
  .table.stack .num { text-align: left; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs button, .tabs a { all: unset; cursor: pointer; padding: var(--s-3) var(--s-3); color: var(--text-2); font-weight: var(--fw-medium); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs [aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.tabs button:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--r-xs); }
.tabs .count { font-size: var(--fs-xs); background: var(--bg-sunken); color: var(--text-2); padding: 0 6px; border-radius: var(--r-full); }

/* ---------- Avatar ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); background: var(--brand-soft); color: var(--brand); flex: none; }
.avatar-lg { width: 44px; height: 44px; font-size: var(--fs-md); }
.logo-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--biz-brand); color: var(--biz-ink); font-weight: var(--fw-bold); font-size: var(--fs-sm); letter-spacing: .02em; border-radius: var(--r-md); flex: none; overflow: hidden; }
.logo-mark.circle { border-radius: 50%; }
.logo-mark.square { border-radius: var(--r-xs); }
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Empty / loading ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-12) var(--s-6); color: var(--text-2); }
.empty .empty-icon { width: 52px; height: 52px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent); }
.empty .empty-icon svg { width: 22px; height: 22px; }
.empty h3 { color: var(--text); font-size: var(--fs-lg); }
.empty p { max-width: 380px; }
.skeleton { background: linear-gradient(90deg, var(--bg-sunken) 25%, color-mix(in srgb, var(--bg-sunken) 60%, var(--bg-elev)) 37%, var(--bg-sunken) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-sm); }
.skeleton.line { height: 12px; } .skeleton.block { height: 96px; border-radius: var(--r-lg); }
.skeleton.title { height: 22px; width: 40%; border-radius: var(--r-sm); } .skeleton.circle { width: 32px; height: 32px; border-radius: 50%; }
.skeleton.tall { height: 220px; border-radius: var(--r-lg); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- Progress & stepper ---------- */
.progress { height: 6px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width var(--dur-3) var(--ease-out); }
.progress.warn > span { background: var(--warning); } .progress.danger > span { background: var(--danger); } .progress.ok > span { background: var(--success); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.steps li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); color: var(--text-2); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.steps li .step-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); border: 1.5px solid var(--border-strong); background: var(--bg-elev); flex: none; }
.steps li.is-done .step-n { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.steps li.is-done .step-n svg { width: 13px; height: 13px; }
.steps li.is-current { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.steps li.is-current .step-n { border-color: var(--brand); color: var(--brand); }
.steps li button { all: unset; cursor: pointer; display: flex; gap: var(--s-3); align-items: center; width: 100%; }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0, 18, 42, .48); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop var(--dur-3) var(--ease-out); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6) var(--s-3); }
.modal-body { padding: var(--s-2) var(--s-6) var(--s-5); overflow-y: auto; max-height: calc(100vh - 220px); }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--divider); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100vw); background: var(--bg-elev); box-shadow: var(--shadow-lg); z-index: 60; display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden; transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3); }
.drawer.is-open { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease-out), visibility 0s; }   /* closed: out of the tab order and the accessibility tree */
.drawer-scrim { position: fixed; inset: 0; background: rgba(12, 16, 24, .35); z-index: 55; opacity: 0; pointer-events: none; transition: opacity var(--dur-2); }
.drawer-scrim.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Menus & tooltips ---------- */
.menu { position: absolute; z-index: 50; min-width: 220px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: var(--s-1); animation: pop var(--dur-2) var(--ease-out); }
.menu button, .menu a { all: unset; display: flex; align-items: center; gap: var(--s-3); width: calc(100% - 2 * var(--s-3)); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-md); color: var(--text); }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--bg-hover); }
.menu svg { width: 16px; height: 16px; color: var(--text-3); }
.menu .menu-label { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-xs); color: var(--text-3); }
.menu hr { border: 0; height: 1px; background: var(--divider); margin: var(--s-1) 0; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--n-900); color: #fff; font-size: var(--fs-xs); padding: 4px 8px; border-radius: var(--r-sm); white-space: nowrap; z-index: 70; pointer-events: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: var(--s-5); bottom: var(--s-5); z-index: 90; display: flex; flex-direction: column; gap: var(--s-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); background: var(--navy-900, #001c3c); color: #fff; border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); animation: pop var(--dur-3) var(--ease-out); }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success svg { color: #5ee3a5; } .toast.error svg { color: #ff8a96; } .toast.info svg { color: #9cc0ff; }
:root[data-theme="dark"] .toast { background: #222833; border: 1px solid var(--border-strong); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .toast { background: #222833; border: 1px solid var(--border-strong); } }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--divider); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .area { opacity: .14; }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar { transition: opacity var(--dur-1); }
.chart .bar:hover { opacity: .8; }
.chart .hover-line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); font-size: var(--fs-xs); z-index: 20; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar-list { display: flex; flex-direction: column; gap: var(--s-3); }
.bar-list .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--s-3); align-items: center; font-size: var(--fs-sm); }
.bar-list .bl-track { grid-column: 1 / -1; height: 6px; background: var(--bg-sunken); border-radius: var(--r-full); overflow: hidden; }
.bar-list .bl-track span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

/* ---------- Key-value list ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: var(--s-2) var(--s-4); font-size: var(--fs-md); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s-4) var(--s-6); font-size: var(--fs-sm); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline li::after { content: ""; position: absolute; left: 9.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.kbd { font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--r-xs); border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--bg-elev); color: var(--text-2); }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 14px; height: 14px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }
.fade-in { animation: fadein var(--dur-3) var(--ease-out); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Icons (SVG sprite: <svg class="ic"><use href="/shared/icons.svg#i-name"/></svg>) ---------- */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; } .ic.lg { width: 22px; height: 22px; } .ic.xl { width: 28px; height: 28px; }
.btn .ic { width: 16px; height: 16px; }

/* Read-only forms (fieldset disabled for roles that can't save): look disabled, so nothing seems editable. */
fieldset:disabled .input, fieldset:disabled .select, fieldset:disabled .textarea { background: var(--bg-sunken); color: var(--text-2); cursor: not-allowed; }
fieldset:disabled .btn { opacity: .5; cursor: not-allowed; }
/* Phone: 44px touch targets and 16px fields (iOS Safari zooms into smaller text on focus). */
@media (max-width: 720px) {
  .btn { min-height: 44px; } .btn-sm { min-height: 40px; } .btn-icon.btn-sm { min-width: 40px; }
  .input, .select { height: 44px; } .input, .select, .textarea { font-size: 16px; }
  .segmented button, .chip { min-height: 40px; }
  details > summary { padding-block: 12px; }
}

/* ---------- Oct 23 premium pass: touch targets, motion, helpers (docs/DESIGN-SYSTEM.md) ---------- */
/* Touch screens of any width (tablets, phones in landscape): 44px targets for controls (WCAG 2.5.8 needs 24px; 44px is comfortable) */
@media (pointer: coarse) {
  .btn, .segmented button, .tabs button, .tabs a, .chip, .menu button, .menu a { min-height: var(--target); }
  .btn-icon { min-width: var(--target); }
  .input, .select { min-height: var(--target); }
  .check input { width: 22px; height: 22px; }
}
/* Reduced motion: no slides, pops, shimmer, lifts or smooth scrolling anywhere (tokens already zero the durations) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .card.is-interactive:hover { transform: none; }
}
/* Forced colours (Windows high contrast): keep badges, cards and buttons outlined */
@media (forced-colors: active) { .badge, .card, .btn { border: 1px solid CanvasText; } }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.status-dot.is-live { background: var(--live); } .status-dot.is-warn { background: var(--warning); } .status-dot.is-error { background: var(--danger); }
.text-success { color: var(--success); } .text-warning { color: var(--warning); } .text-danger { color: var(--danger); }
.card-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }

/* Stacked tables on phones (Oct 27 2026 platform review): label and value in two even columns, so a long label ("Cost / booked job")
   never runs into its value. */
@media (max-width: 720px) {
  .table.stack:not(.ld-table) td[data-label] { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--s-2); row-gap: 2px; padding: 3px 0; }
  .table.stack:not(.ld-table) td[data-label]::before { flex: 0 0 calc(44% - var(--s-2)); min-width: 0; overflow-wrap: anywhere; }
}
.modal-body > p.muted { white-space: pre-line; }

/* ---- Shared status language (Command Intelligence Center, Nov 21 2026) — one chip for every screen ----
   Working (green) · Needs you (amber) · Blocked (red) · System fixing (grey) · Draft · Approved (blue) · Scheduled · Sent.
   The dot/edge carries the colour (>= 3:1); the text stays dark for AA contrast. */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-label, .75rem);
  font-weight: var(--fw-label, 600); line-height: 1.2; border: 1px solid var(--card-border, #e3e7ed); background: var(--bg-elev, #fff); color: var(--text); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--status-fixing, #9ca3af); flex: none; }
.chip[data-state="working"]::before, .chip[data-state="sent"]::before, .chip[data-state="published"]::before { background: var(--status-working, #16a34a); }
.chip[data-state="needs"]::before, .chip[data-state="draft"]::before { background: var(--status-needs, #f59e0b); }
.chip[data-state="blocked"]::before, .chip[data-state="failed"]::before { background: var(--status-blocked, #dc2626); }
.chip[data-state="approved"]::before { background: var(--cic-blue, #1e40af); }
.chip[data-state="scheduled"]::before { background: var(--cic-primary, #0f766e); }
.chip[data-state="publishing"]::before { background: var(--cic-primary, #0f766e); animation: chip-pulse 1.4s ease-in-out infinite; }
.chip[data-state="fixing"]::before { background: var(--status-fixing, #9ca3af); }
/* P2 (Dec 2 2026, DESIGN-AUDIT A7/A8): the shared STATUS chip — ui.js statusChip(state, label) — one look on Home, Approvals, Ads, Hiring and
   Command Center. Four states: Working · Needs you · Blocked · Fixing (anything else is neutral). The words sit in the AA status colour on its
   soft fill (tokens.css, light and dark), the dot carries the colour as a UI part, so it never relies on colour alone. */
.status-chip { border-color: var(--border); background: var(--bg-elev); color: var(--text-2); white-space: normal; max-width: 100%; }
.status-chip[data-state="working"] { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.status-chip[data-state="needs"] { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.status-chip[data-state="blocked"] { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.status-chip[data-state="fixing"] { color: var(--text-2); background: var(--bg-sunken); border-color: var(--border-strong); }
.status-chip[data-state="working"]::before { background: var(--success); }
.status-chip[data-state="needs"]::before { background: var(--warning); }
.status-chip[data-state="blocked"]::before { background: var(--danger); }
.status-chip[data-state="fixing"]::before, .status-chip[data-state="neutral"]::before { background: var(--text-3); }
@keyframes chip-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .chip[data-state="publishing"]::before { animation: none; } }
.card-cic { border-radius: var(--rad-md, 12px); border: 1px solid var(--card-border, #e3e7ed); background: var(--bg-elev, #fff); box-shadow: 0 1px 2px rgba(11, 27, 54, .06); }

/* Dec 1 2026 audit F13: sideways chip / tab rows fade on the side that has more (app.js marks data-more) */
[data-more="r"] { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
[data-more="l"] { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
[data-more="lr"] { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
@media (max-width: 760px) { .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .segmented::-webkit-scrollbar { display: none; } .segmented button { flex: none; white-space: nowrap; } }
