/* CloudHero design system — web stylesheet.
   Relies on tokens inlined in base.html via partials/_design_tokens_inline.html.
   NO @import of _design_tokens.css (would re-fetch and undermine the inline). */

/* ────────────────────────────────────────────────────────────
   Reset + base
   ──────────────────────────────────────────────────────────── */
.ch * { box-sizing: border-box; }
.ch {
  font-family: var(--ch-font);
  color: var(--ch-black);
  background: var(--ch-cream);
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  margin: 0;
  min-height: 100vh;
}
.ch button, .ch input, .ch select, .ch textarea { font-family: inherit; }
.ch a { color: var(--ch-blue); text-decoration: none; }
.ch a:hover { text-decoration: underline; }

/* Skip-link for keyboard nav */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  background: var(--ch-black); color: #fff;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; z-index: 9999;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ────────────────────────────────────────────────────────────
   Helpers
   ──────────────────────────────────────────────────────────── */
.ch-mono { font-family: var(--ch-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.ch-tnum { font-variant-numeric: tabular-nums; }
.ch-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ch-mute);
}
.ch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.ch-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
  flex: 0 0 auto;
}
.ch-mark { display: inline-block; line-height: 0; color: currentColor; }
.ch-mark svg { display: block; width: 100%; height: 100%; }

.sev-critical { color: var(--sev-critical); }
.sev-medium   { color: var(--sev-medium); }
.sev-info     { color: var(--sev-info); }
.sev-pass     { color: var(--sev-pass); }
.bg-critical  { background: var(--sev-critical); }
.bg-medium    { background: var(--sev-medium); }
.bg-info      { background: var(--sev-info); }
.bg-pass      { background: var(--sev-pass); }

.ch-dotgrid {
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.12) 1px, transparent 0);
  background-size: 16px 16px;
}
.ch-dotgrid-light {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.16) 1px, transparent 0);
  background-size: 16px 16px;
}

.ch-map {
  background:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px) 0 0/40px 40px,
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px) 0 0/40px 40px,
    linear-gradient(135deg, transparent 49.5%, rgba(0,0,0,0.06) 49.5%, rgba(0,0,0,0.06) 50.5%, transparent 50.5%) 0 0/120px 120px,
    radial-gradient(circle at 30% 40%, rgba(71,222,255,0.10), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(121,217,0,0.08), transparent 50%),
    var(--ch-cream-2);
}
.ch-map-dark {
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px) 0 0/40px 40px,
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px) 0 0/40px 40px,
    var(--ch-ink);
}

.ch-photo {
  background: linear-gradient(135deg, #C5C0AF 0%, #A9A693 100%);
  position: relative; overflow: hidden;
}
.ch-photo::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 60%, rgba(0,0,0,0.15), transparent 50%),
    radial-gradient(circle at 70% 30%, rgba(255,255,255,0.2), transparent 50%);
}

/* Animations */
@keyframes ch-wave {
  0%, 100% { transform: scaleY(0.2); }
  50%      { transform: scaleY(1); }
}
@keyframes ch-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}
@keyframes ch-listen {
  0%   { transform: scale(1);    opacity: 0.6; }
  100% { transform: scale(2.4);  opacity: 0;   }
}
@keyframes ch-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes ch-spin { to { transform: rotate(360deg); } }
@keyframes ch-fade-out {
  to { opacity: 0; transform: translateY(-6px); }
}

/* ────────────────────────────────────────────────────────────
   Dashboard shell
   ──────────────────────────────────────────────────────────── */

.dash-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  background: var(--ch-cream);
  color: #000;
}
.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Sidebar — 240px black */
.dash-sidebar {
  width: 240px;
  flex: 0 0 auto;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.dash-sidebar-brand { padding: 0 8px 18px; }
.dash-sidebar-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  margin-top: 14px;
}
.dash-org {
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.dash-org-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ch-cyan); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: -0.02em;
}
.dash-org-name { flex: 1; min-width: 0; }
.dash-org-name strong { display: block; font-size: 13px; font-weight: 600; }
.dash-org-name small { font-size: 11px; color: rgba(255,255,255,0.5); }

.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav-item {
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; font-weight: 500;
  position: relative;
  text-decoration: none;
}
.dash-nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); text-decoration: none; }
.dash-nav-item--active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.dash-nav-item--active::before {
  content: "";
  position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--ch-lime);
}
.dash-nav-item span.label { flex: 1; }
.dash-nav-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-variant-numeric: tabular-nums;
}

.dash-user {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 10px;
}
.dash-user-avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--ch-orange); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.dash-user-name { flex: 1; min-width: 0; }
.dash-user-name strong { display: block; font-size: 12.5px; font-weight: 600; }
.dash-user-name small { font-size: 11px; color: rgba(255,255,255,0.5); }
.dash-user a {
  color: rgba(255,255,255,0.5);
  display: inline-flex;
}

/* Topbar */
.dash-topbar {
  padding: 22px 32px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--ch-line);
  background: var(--ch-cream);
}
.dash-topbar-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-topbar h1 {
  font-size: 28px; font-weight: 600; letter-spacing: -0.03em;
  margin: 0; line-height: 1.1;
}
.dash-topbar-right { display: flex; align-items: center; gap: 8px; }

/* Page content padding */
.dash-page { padding: 20px 32px 32px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }

/* ────────────────────────────────────────────────────────────
   Buttons + Inputs
   ──────────────────────────────────────────────────────────── */

.btn-ch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 36px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: #000;
  text-decoration: none;
  transition: background 80ms, border-color 80ms, color 80ms;
}
.btn-ch:hover { text-decoration: none; }
.btn-ch--solid { background: #000; color: #fff; border-color: #000; }
.btn-ch--solid:hover { background: #1a1a1a; }
.btn-ch--outline { background: transparent; color: #000; border-color: var(--ch-line); }
.btn-ch--outline:hover { background: rgba(0,0,0,0.04); }
.btn-ch--ghost { background: transparent; color: #000; border-color: transparent; }
.btn-ch--ghost:hover { background: rgba(0,0,0,0.04); }
.btn-ch--danger { background: var(--ch-red); color: #fff; border-color: var(--ch-red); }
.btn-ch--danger:hover { filter: brightness(0.95); }
.btn-ch--lg { height: 44px; padding: 0 18px; font-size: 14px; }

.search-ch {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 36px;
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 10px;
  width: 320px;
}
.search-ch input {
  border: 0; outline: 0; background: transparent;
  flex: 1; font-size: 13px; min-width: 0;
}
.search-ch kbd {
  font-family: var(--ch-mono);
  font-size: 10px;
  padding: 2px 5px; border-radius: 4px;
  background: var(--ch-cream-2);
  color: var(--ch-mute);
}

.input-ch, .select-ch, .textarea-ch {
  width: 100%;
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #000;
  font-family: inherit;
  box-sizing: border-box;
}
.input-ch, .select-ch { min-height: 40px; }

/* Compact variant for table cells / inline forms — keeps height down but
   reserves enough line-height for the Onest font's descenders. */
.input-ch--sm, .select-ch--sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
}
.select-ch--sm { padding-right: 28px; background-position: right 8px center; }
.input-ch:focus, .select-ch:focus, .textarea-ch:focus {
  outline: 2px solid var(--ch-blue);
  outline-offset: -1px;
}
.select-ch {
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%236B675E" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.textarea-ch { min-height: 88px; resize: vertical; }

.field-ch { display: flex; flex-direction: column; gap: 6px; }
.field-ch label {
  font-size: 12px; font-weight: 600; color: #000;
}
.field-ch small { font-size: 11px; color: var(--ch-mute); }
.field-ch--error { color: var(--ch-red); font-size: 11px; }

.check-ch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check-ch input { width: 16px; height: 16px; }

/* Filter chips */
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: transparent;
  color: #000;
  border: 1px solid var(--ch-line);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.filter-chip:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
.filter-chip--active {
  background: #000; color: #fff; border-color: #000;
}
.filter-chip--active:hover { background: #1a1a1a; }

/* ────────────────────────────────────────────────────────────
   Cards
   ──────────────────────────────────────────────────────────── */

.stat-card {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  min-height: 92px;
}
.stat-card__label {
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 500;
  color: var(--ch-mute);
  margin-bottom: 8px;
}
.stat-card__row { display: flex; align-items: baseline; gap: 8px; }
.stat-card__value {
  font-size: 36px; font-weight: 600;
  letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card__delta { font-size: 12px; font-weight: 500; }
.stat-card__delta--ok { color: var(--ch-green); }
.stat-card__delta--warn { color: var(--ch-orange); }
.stat-card__delta--bad { color: var(--ch-red); }
.stat-card__delta--mute { color: var(--ch-mute); }
.stat-card__spark {
  position: absolute; bottom: 12px; right: 14px;
  width: 76px; height: 28px; opacity: 0.9;
}

/* Section card (white panel with rounded corners) */
.section-card {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.section-card__header {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--ch-line);
}
.section-card__title {
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 500;
  color: var(--ch-mute);
}
.section-card__body { padding: 18px; }
.section-card__body--flush { padding: 0; }

/* KPI tile */
.kpi {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 14px;
  padding: 16px 18px;
}
.kpi__label {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 500; color: var(--ch-mute); margin-bottom: 8px;
}
.kpi__value {
  font-size: 32px; font-weight: 600; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.kpi__delta { font-size: 12px; margin-top: 4px; }
.kpi__sub { font-size: 11px; color: var(--ch-mute); margin-top: 4px; }

/* Signal card (alerts, errors, info) */
.signal-card {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-left: 4px solid var(--ch-mute);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.signal-card--critic { border-left-color: var(--ch-red); }
.signal-card--avertisment { border-left-color: var(--ch-orange); }
.signal-card--info { border-left-color: var(--ch-cyan); }
.signal-card--pass { border-left-color: var(--ch-lime); }
.signal-card--ai { border-left-color: var(--ch-purple); }
.signal-card__head {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
}
.signal-card__time {
  margin-left: auto; color: var(--ch-mute);
  font-family: var(--ch-mono);
}
.signal-card__title { font-weight: 600; font-size: 14px; }
.signal-card__detail { font-size: 13px; color: var(--ch-mute); line-height: 1.45; }
.signal-card__actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Alert pill (used inside signal card head + tables) */
.alert-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
}
.alert-pill-critic { background: #FFE4E2; color: #8A0500; }
.alert-pill-avertisment { background: #FFEED0; color: #8A4D00; }
.alert-pill-info { background: #D6F4FF; color: #00547A; }
.alert-pill-pass { background: #E2F8C9; color: #2D5500; }
.alert-pill-ai { background: #F1DEFF; color: #50157C; }

/* Param card (parameter with min/max gauge) */
.param-card {
  background: var(--ch-cream-2);
  border-radius: 12px;
  padding: 12px 14px;
}
.param-card__label {
  font-size: 11px; color: var(--ch-mute); margin-bottom: 4px;
}
.param-card__value {
  font-size: 20px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.param-card__bar {
  position: relative;
  height: 6px; background: rgba(0,0,0,0.08);
  border-radius: 99px; margin-top: 8px; overflow: hidden;
}
.param-card__bar-fill {
  height: 100%;
  background: var(--ch-lime);
}
.param-card__bar-fill--warn { background: var(--ch-orange); }
.param-card__bar-fill--fail { background: var(--ch-red); }
.param-card__range { font-size: 10px; color: var(--ch-mute); margin-top: 4px; }

/* ────────────────────────────────────────────────────────────
   Table
   ──────────────────────────────────────────────────────────── */

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.report-table thead tr { background: var(--ch-cream-2); text-align: left; }
.report-table th {
  padding: 10px 14px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 500; color: var(--ch-mute);
  border-bottom: 1px solid var(--ch-line);
  white-space: nowrap;
}
.report-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ch-line-2);
  vertical-align: middle;
}
.report-table tr.is-selected { background: var(--ch-cream-2); }
.report-table tr:hover td { background: rgba(0,0,0,0.02); }

.avatar-ch {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--ch-cream-2);
  border: 1px solid var(--ch-line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.score-bar {
  width: 60px; height: 6px; border-radius: 99px;
  background: var(--ch-line-2); overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.score-bar > span {
  display: block; height: 100%;
  background: var(--ch-lime);
}
.score-bar--warn > span { background: var(--ch-orange); }
.score-bar--bad > span { background: var(--ch-red); }

/* ────────────────────────────────────────────────────────────
   Map pins + tooltip
   ──────────────────────────────────────────────────────────── */

.map-panel { position: relative; min-height: 0; }
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.map-pin--active {
  width: 28px; height: 28px;
  border: 3px solid #000;
}
.map-pin--active::after {
  content: ""; position: absolute; inset: -8px;
  border: 2px solid currentColor; border-radius: 999px;
  animation: ch-listen 2s ease-out infinite;
}
.map-tooltip {
  position: absolute;
  transform: translate(-50%, -200%);
  background: #000; color: #fff;
  padding: 8px 12px; border-radius: 10px;
  font-size: 11.5px; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.map-tooltip::after {
  content: "";
  position: absolute; bottom: -5px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px; background: #000;
}
.map-legend {
  position: absolute; bottom: 14px; left: 14px; right: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ch-line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; gap: 14px; font-size: 11px; font-weight: 500;
  flex-wrap: wrap;
}

/* ────────────────────────────────────────────────────────────
   Quality gauge wrapper + category bars
   ──────────────────────────────────────────────────────────── */

.quality-overall { display: flex; align-items: center; gap: 18px; }
.quality-overall .gauge { flex: 0 0 auto; }
.quality-bars { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.quality-bar-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.quality-bar-label { flex: 0 0 110px; color: var(--ch-mute); }
.quality-bar { flex: 1; height: 6px; background: var(--ch-line-2); border-radius: 99px; overflow: hidden; }
.quality-bar-fill { height: 100%; background: var(--ch-lime); }
.quality-bar-fill--warn { background: var(--ch-orange); }
.quality-bar-fill--bad { background: var(--ch-red); }
.quality-bar-pct {
  flex: 0 0 36px; text-align: right;
  font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ────────────────────────────────────────────────────────────
   SOP checklist
   ──────────────────────────────────────────────────────────── */

.sop-list { display: flex; flex-direction: column; gap: 2px; }
.sop-row { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--ch-line-2); }
.sop-row:last-child { border-bottom: 0; }
.sop-circle {
  width: 28px; height: 28px; border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--ch-mute);
  flex: 0 0 auto;
}
.sop-circle--done {
  background: var(--ch-lime);
  border-color: var(--ch-lime);
  color: #000;
}
.sop-circle--partial { border-color: var(--ch-orange); color: var(--ch-orange); }
.sop-circle--skip { border-color: var(--ch-red); color: var(--ch-red); }
.sop-body { flex: 1; min-width: 0; }
.sop-label { font-size: 14px; font-weight: 500; }
.sop-note { font-size: 12px; color: var(--ch-mute); margin-top: 2px; line-height: 1.4; }

/* ────────────────────────────────────────────────────────────
   Waveform
   ──────────────────────────────────────────────────────────── */

.wave-bars { display: flex; align-items: center; justify-content: center; gap: 4px; }
.wave-bars > span {
  width: 3px; background: currentColor; border-radius: 2px;
  transform-origin: center;
  animation: ch-wave 0.8s ease-in-out infinite;
}

/* ────────────────────────────────────────────────────────────
   Photo grid + lightbox
   ──────────────────────────────────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.photo-card {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ch-cream-2);
  border: 1px solid var(--ch-line);
  cursor: pointer;
}
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card__overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.photo-label {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 4px;
  color: #fff;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
}

.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  z-index: 5000;
  align-items: center; justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox__inner {
  max-width: 92vw; max-height: 92vh;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.lightbox__img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.lightbox__bar {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}
.lightbox__btn {
  background: rgba(255,255,255,0.1); color: #fff;
  border: 0; border-radius: 999px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox__btn:hover { background: rgba(255,255,255,0.18); }
.lightbox__close {
  position: absolute; top: 18px; right: 18px;
}

/* ────────────────────────────────────────────────────────────
   Flash messages (signal-card-style toast at top)
   ──────────────────────────────────────────────────────────── */

.flash-stack {
  position: fixed; top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 4000;
  max-width: 380px;
}
.flash {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-left: 4px solid var(--ch-mute);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
  animation: ch-fade-out 0.2s ease-out 4.8s forwards;
}
.flash--success { border-left-color: var(--ch-lime); }
.flash--info { border-left-color: var(--ch-cyan); }
.flash--warning { border-left-color: var(--ch-orange); }
.flash--danger { border-left-color: var(--ch-red); }
.flash button.close {
  background: transparent; border: 0; cursor: pointer; padding: 0 4px;
  color: var(--ch-mute); font-size: 18px; line-height: 1;
}

/* ────────────────────────────────────────────────────────────
   Coming-soon placeholder
   ──────────────────────────────────────────────────────────── */

.coming-soon {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  padding: 80px 32px; text-align: center;
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 16px;
  margin: 32px;
}
.coming-soon h2 { font-size: 24px; font-weight: 600; margin: 0; }
.coming-soon p { color: var(--ch-mute); font-size: 14px; max-width: 480px; margin: 0; }

/* ────────────────────────────────────────────────────────────
   Empty / loading states
   ──────────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ch-mute);
}
.empty h3 {
  font-size: 16px; font-weight: 600; color: #000;
  margin: 12px 0 6px;
}
.empty p { font-size: 13px; margin: 0; max-width: 360px; margin-left: auto; margin-right: auto; }
.empty .btn-ch { margin-top: 16px; }

.skel { background: var(--ch-line-2); border-radius: 8px; }
.skel-row { height: 12px; margin-bottom: 8px; }
.skel-w-80 { width: 80%; }
.skel-w-60 { width: 60%; }
.skel-w-40 { width: 40%; }

.processing-hero {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 16px;
  padding: 28px;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.processing-hero__title { font-size: 18px; font-weight: 600; }
.processing-hero__sub { color: var(--ch-mute); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.processing-hero__sub .dot { animation: ch-pulse 1.2s ease-in-out infinite; }
.ch-pulse-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--ch-cyan); display: inline-block;
  animation: ch-pulse 1.2s ease-in-out infinite;
}
.skeleton-stack {
  width: 100%; max-width: 560px;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 4px;
}
.skeleton-bar {
  height: 12px; border-radius: 8px;
  background: linear-gradient(90deg, var(--ch-line-2) 0%, rgba(0,0,0,0.03) 50%, var(--ch-line-2) 100%);
  background-size: 200% 100%;
  animation: ch-skeleton 1.4s ease-in-out infinite;
}
@keyframes ch-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ────────────────────────────────────────────────────────────
   Drawer toggle (CSS-only) for mobile
   ──────────────────────────────────────────────────────────── */

#dash-drawer-toggle { display: none; }
.dash-hamburger {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--ch-line);
  border-radius: 10px; cursor: pointer;
}

/* ────────────────────────────────────────────────────────────
   Upload zone + photo preview cards (widget-local)
   ──────────────────────────────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--ch-line);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 100ms, background 100ms;
  background: var(--ch-cream-2);
}
.upload-zone:hover, .upload-zone:focus { border-color: var(--ch-black); }
.upload-zone--dragover { border-color: var(--ch-blue); background: rgba(0,138,255,0.04); }
.upload-zone__icon {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  color: var(--ch-mute);
}
.upload-zone__text { font-size: 14px; font-weight: 500; }
.upload-zone__hint { font-size: 12px; color: var(--ch-mute); margin-top: 4px; }

.photo-preview-card {
  display: flex; gap: 12px; align-items: center;
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
}
.photo-preview-card__thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--ch-cream-2);
}
.photo-preview-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview-card__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.photo-preview-card__name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-preview-card__meta { font-size: 11px; color: var(--ch-mute); }
.photo-preview-card__label {
  height: 28px; padding: 0 8px; font-size: 12px;
}
.photo-preview-card__remove {
  background: transparent; border: 1px solid var(--ch-line);
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ch-mute); cursor: pointer; flex: 0 0 auto;
}
.photo-preview-card__remove:hover { color: var(--ch-red); border-color: var(--ch-red); }

/* ────────────────────────────────────────────────────────────
   Voice recorder UI
   ──────────────────────────────────────────────────────────── */

.recorder-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 16px 0; }
.recorder-btn-row { display: flex; align-items: center; gap: 14px; }
.recorder-level-col { display: flex; flex-direction: column; justify-content: flex-end; height: 60px; width: 8px; }
.recorder-level-bar {
  width: 100%; background: var(--ch-cyan); border-radius: 2px; min-height: 2px;
  transition: height 80ms;
}
.recorder-button {
  width: 88px; height: 88px; border-radius: 999px;
  background: var(--ch-black); color: #fff;
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 100ms, background 100ms;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.recorder-button:hover { transform: scale(1.03); }
.recorder-button:disabled { opacity: 0.6; cursor: default; transform: none; }
.recorder-button--recording { background: var(--ch-red); animation: ch-pulse 1.4s ease-in-out infinite; }
.recorder-timer {
  font-family: var(--ch-mono);
  font-size: 28px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.recorder-status { color: var(--ch-mute); font-size: 13px; min-height: 1.4em; }
.recorder-hint { font-size: 12px; color: var(--ch-mute-2); min-height: 1.2em; }
.recorder-warn { color: var(--ch-orange); font-size: 12px; }
.is-hidden { display: none !important; }

/* ────────────────────────────────────────────────────────────
   Responsive — 3 tiers
   ──────────────────────────────────────────────────────────── */

/* Tablet: 600px – 1024px */
@media (max-width: 1024px) {
  .dash-sidebar {
    width: 64px;
    padding: 14px 8px;
  }
  .dash-sidebar-brand small.dash-sidebar-eyebrow,
  .dash-org-name,
  .dash-user-name,
  .dash-org > svg,
  .dash-nav-item span.label,
  .dash-nav-badge {
    display: none;
  }
  .dash-org { padding: 8px; justify-content: center; }
  .dash-nav-item {
    justify-content: center;
    padding: 12px 8px;
  }
  .dash-nav-item--active::before { left: -8px; }

  .dash-topbar { padding: 16px 20px 12px; }
  .dash-page { padding: 14px 20px 24px; }
  .search-ch { width: 220px; }
}

/* Phone: < 600px — drawer mode */
@media (max-width: 600px) {
  .dash-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 200ms;
    z-index: 1000;
    padding: 22px 14px;
  }
  /* Restore labels in drawer */
  .dash-sidebar-brand small.dash-sidebar-eyebrow,
  .dash-org-name,
  .dash-user-name,
  .dash-nav-item span.label,
  .dash-nav-badge {
    display: revert;
  }
  .dash-nav-item { justify-content: flex-start; padding: 10px 12px; }
  .dash-nav-item--active::before { left: -14px; }
  .dash-org { padding: 12px; justify-content: flex-start; }

  /* The drawer-toggle checkbox sits at the top of the body; we use a sibling
     selector to flip the sidebar. */
  body.has-drawer:has(#dash-drawer-toggle:checked) .dash-sidebar {
    transform: translateX(0);
  }
  body.has-drawer:has(#dash-drawer-toggle:checked)::after {
    content: ""; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
  }

  .dash-hamburger { display: inline-flex; }
  .dash-topbar { padding: 14px 16px 10px; }
  .dash-topbar h1 { font-size: 22px; }
  .dash-page { padding: 14px 16px 22px; gap: 12px; }
  .search-ch { width: 100%; }

  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px; }
  .stat-card__value { font-size: 30px; }
}
