:root {
  --bg: var(--brand-canvas);
  --paper: var(--brand-canvas);
  --paper-strong: #ffffff;
  --ink: var(--brand-ink);
  --muted: var(--brand-ink-soft);
  --line: #ddd8cc;
  --line-soft: #ece7dc;
  --teal: var(--brand-emerald);
  --teal-dark: var(--brand-emerald);
  --teal-soft: var(--brand-panel-mint);
  --gold: var(--brand-gold);
  --gold-soft: var(--brand-gold-soft);
  --coral: #cc614f;
  --coral-soft: #f8e7e2;
  --blue: var(--brand-teal);
  --blue-soft: var(--brand-panel-mint);
  --green: var(--brand-emerald);
  --green-soft: var(--brand-panel-mint);
  --shadow: 0 18px 50px rgba(29, 51, 55, 0.10);
  --shadow-soft: 0 8px 24px rgba(29, 51, 55, 0.07);
  --radius: 10px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: linear-gradient(135deg, rgba(36,126,120,.045), transparent 32%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(36,126,120,.25); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(1.8rem, 3vw, 2.55rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: 6px; font-size: 1.25rem; line-height: 1.2; }
h3 { margin-bottom: 5px; }
p { line-height: 1.5; }
a { color: inherit; text-decoration: none; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; min-width: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: 24px 18px 18px; background: var(--brand-ink); color: var(--brand-canvas); border-right: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--brand-gold-soft); color: var(--brand-ink); font-size: .82rem; font-weight: 900; letter-spacing: -.03em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .91rem; }
.brand small { margin-top: 2px; color: #adc5c3; font-size: .72rem; }
.admin-nav { min-height: 0; flex: 1 1 auto; display: grid; align-content: start; gap: 4px; overflow-y: auto; overscroll-behavior: contain; padding: 17px 4px 12px 0; scrollbar-width: thin; scrollbar-color: rgba(152,225,220,.38) transparent; }
.admin-nav::-webkit-scrollbar { width: 6px; }
.admin-nav::-webkit-scrollbar-track { background: transparent; }
.admin-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(152,225,220,.38); }
.nav-label { margin: 15px 10px 5px; color: #87a9a6; font-size: .68rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 0; border-radius: 8px; color: #d7e6e4; background: transparent; cursor: pointer; text-align: left; font-weight: 750; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { color: var(--brand-ink); background: var(--brand-gold-soft); }
.nav-item small { min-width: 27px; padding: 3px 6px; border-radius: 999px; background: rgba(255,255,255,.09); color: inherit; font-size: .63rem; text-align: center; }
.nav-item.active small { background: rgba(23,56,59,.09); }
.sidebar-foot { flex: 0 0 auto; margin-top: 12px; display: grid; gap: 12px; }
.connection-card { display: flex; gap: 9px; align-items: flex-start; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.045); }
.connection-card strong, .connection-card small { display: block; }
.connection-card strong { font-size: .78rem; }
.connection-card small { margin-top: 3px; color: #a9c0be; font-size: .66rem; line-height: 1.3; }
.connection-dot { width: 9px; height: 9px; margin-top: 4px; flex: 0 0 auto; border-radius: 999px; background: var(--gold); box-shadow: 0 0 0 4px rgba(184,138,51,.14); }
.connection-dot.connected { background: #7bc19f; box-shadow: 0 0 0 4px rgba(123,193,159,.15); }
.back-link { padding: 0 12px; color: #bad0ce; font-size: .75rem; font-weight: 750; }

.admin-main { min-width: 0; padding: 28px clamp(22px, 3vw, 44px) 60px; }
.admin-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.view-description { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.eyebrow, .panel-kicker { margin-bottom: 5px; color: var(--teal-dark); font-size: .69rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.topbar-actions, .button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.environment-pill { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,248,.84); color: var(--muted); font-size: .74rem; font-weight: 800; }
.environment-pill > span:first-child { width: 8px; height: 8px; border-radius: 999px; background: var(--gold); }
.environment-pill > span:first-child.connected { background: var(--green); }
.button { min-height: 42px; padding: 10px 15px; border: 1px solid transparent; border-radius: 8px; font-weight: 850; cursor: pointer; }
.button.primary { color: white; background: var(--teal); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { border-color: var(--line); background: var(--paper); }
.button.secondary:hover { border-color: #bfc9c3; background: #fff; }
.button.small { min-height: 36px; padding: 7px 11px; font-size: .76rem; }
.text-button { padding: 0; border: 0; color: var(--teal-dark); background: transparent; font-weight: 850; cursor: pointer; }

.notice { margin: -5px 0 20px; padding: 12px 14px; border: 1px solid #e4d4a6; border-radius: 8px; background: var(--gold-soft); color: #6f5728; font-size: .84rem; }
.notice.error { border-color: #e7bcb3; background: var(--coral-soft); color: #7b382d; }
.hidden { display: none !important; }
.admin-view { display: none; }
.admin-view.active { display: block; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-grid.compact-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { min-height: 126px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-soft); }
.metric-card .metric-label { color: var(--muted); font-size: .72rem; font-weight: 850; }
.metric-card strong { display: block; margin: 15px 0 6px; font-size: 1.75rem; line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); font-size: .7rem; }
.metric-card.positive { border-top: 3px solid var(--green); }
.metric-card.attention { border-top: 3px solid var(--gold); }
.metric-card.critical { border-top: 3px solid var(--coral); }

.dashboard-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.dashboard-grid.two-thirds { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); }
.dashboard-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid.lab-grid { grid-template-columns: minmax(360px, .78fr) minmax(430px, 1.22fr); align-items: start; }
.dashboard-grid.cost-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-soft); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2, .panel-head p { margin-bottom: 0; }
.freshness { color: var(--muted); font-size: .72rem; }
.health-score-wrap { display: grid; grid-template-columns: 126px minmax(0, 1fr); gap: 22px; align-items: center; padding: 9px 0 18px; }
.health-score { width: 126px; height: 126px; display: grid; place-content: center; text-align: center; border: 10px solid #dcece5; border-top-color: var(--teal); border-radius: 999px; background: #fff; }
.health-score strong { font-size: 2.35rem; line-height: 1; }
.health-score span { margin-top: 4px; color: var(--muted); font-size: .66rem; }
.health-summary p { margin: 6px 0 13px; color: var(--muted); font-size: .84rem; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e9e7df; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.health-factors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.health-factor { padding: 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.health-factor strong, .health-factor span { display: block; }
.health-factor strong { font-size: 1.05rem; }
.health-factor span { margin-top: 3px; color: var(--muted); font-size: .66rem; }

.stack-list, .safeguard-list, .check-list { display: grid; gap: 9px; }
.alert-row, .safeguard-row, .check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.severity-mark, .check-mark { width: 9px; height: 9px; margin-top: 5px; border-radius: 999px; background: var(--gold); }
.severity-mark.critical, .severity-mark.high { background: var(--coral); }
.severity-mark.low { background: var(--blue); }
.severity-mark.healthy, .check-mark { background: var(--green); }
.alert-row strong, .alert-row small, .safeguard-row strong, .safeguard-row small, .check-row strong, .check-row small { display: block; }
.alert-row strong, .safeguard-row strong, .check-row strong { font-size: .78rem; }
.alert-row small, .safeguard-row small, .check-row small { margin-top: 4px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 999px; color: #6b5528; background: var(--gold-soft); font-size: .63rem; font-weight: 900; white-space: nowrap; }
.status-badge.healthy { color: #286048; background: var(--green-soft); }
.status-badge.critical { color: #8c3e32; background: var(--coral-soft); }
.status-badge.info { color: #2f537b; background: var(--blue-soft); }
.status-badge.neutral { color: var(--muted); background: #eeece6; }

.module-table { display: grid; }
.module-row { display: grid; grid-template-columns: minmax(180px, 1.35fr) repeat(3, minmax(100px, .75fr)); gap: 14px; align-items: center; padding: 13px 8px; border-top: 1px solid var(--line-soft); }
.module-row.header { padding-top: 0; border: 0; color: var(--muted); font-size: .68rem; font-weight: 850; }
.module-row strong { font-size: .82rem; }
.module-row span { color: var(--muted); font-size: .75rem; }

.filter-bar { display: flex; align-items: end; gap: 12px; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,248,.78); }
label { display: grid; gap: 6px; color: var(--ink); font-size: .72rem; font-weight: 850; }
label > span, legend { color: var(--muted); font-size: .68rem; font-weight: 850; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input, select { min-height: 42px; padding: 9px 11px; }
textarea { min-height: 82px; padding: 11px; resize: vertical; line-height: 1.45; }
.search-field { min-width: 260px; flex: 1; }
.table-panel { padding: 0; overflow: hidden; }
.data-table { width: 100%; }
.table-row { display: grid; grid-template-columns: 1.25fr repeat(6, minmax(90px, .75fr)); gap: 12px; align-items: center; min-height: 56px; padding: 10px 16px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.table-row:first-child { border-top: 0; }
.table-row.header { min-height: 44px; color: var(--muted); background: #f9f7f1; cursor: default; font-size: .66rem; font-weight: 900; }
.table-row:not(.header):hover { background: #fbfaf6; }
.table-row strong { font-size: .76rem; }
.table-row span { color: var(--muted); font-size: .72rem; }
.cost-table-head { padding: 18px 20px 0; }
.cost-filter-bar .button { align-self: end; }
.cost-notice { margin-top: -4px; }
.cost-breakdown-list, .cost-event-list { display: grid; gap: 9px; }
.cost-breakdown-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.cost-breakdown-row-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.cost-breakdown-row-head strong { font-size: .84rem; }
.cost-breakdown-row-head span { color: var(--teal-dark); font-size: .78rem; font-weight: 900; }
.cost-breakdown-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .64rem; font-weight: 800; }
.cost-breakdown-meta span { padding: 3px 6px; border-radius: 999px; background: #f0eee8; }
.cost-bar { height: 7px; overflow: hidden; border-radius: 999px; background: #ece8dc; }
.cost-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #5ca89e); }
.cost-table .table-row { grid-template-columns: minmax(170px, 1.2fr) repeat(5, minmax(92px, .75fr)); cursor: default; }
.cost-table .table-row strong { overflow-wrap: anywhere; }
.cost-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.cost-pills span { display: inline-flex; padding: 3px 6px; border-radius: 999px; background: #f0eee8; color: var(--muted); font-size: .6rem; font-weight: 800; }
.cost-event { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.cost-event strong, .cost-event small { display: block; }
.cost-event strong { font-size: .78rem; }
.cost-event small { margin-top: 4px; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.cost-event-cost { color: var(--teal-dark); font-size: .78rem; font-weight: 900; }
.crash-banner { background: linear-gradient(135deg, #152126, #08766d); }
.error-filter-bar .button { align-self: end; }
.error-notice { margin-top: -4px; }
.dashboard-grid.error-grid { grid-template-columns: minmax(0, 1.25fr) minmax(340px, .85fr); align-items: start; }
.error-table-head { padding: 18px 20px 0; }
.error-table .table-row { grid-template-columns: minmax(220px, 1.3fr) minmax(82px, .48fr) minmax(100px, .62fr) minmax(82px, .52fr) minmax(150px, .9fr) minmax(82px, .48fr); width: 100%; border-right: 0; border-bottom: 0; border-left: 0; background: transparent; text-align: left; }
.error-table .table-row.header { display: grid; }
.error-table .table-row strong small { display: block; margin-top: 4px; color: var(--muted); font-size: .61rem; font-weight: 750; overflow-wrap: anywhere; }
.error-issue-row { cursor: pointer; }
.error-issue-row.selected { background: #e8f4ef; box-shadow: inset 4px 0 0 #08766d; }
.error-event-list, .error-breakdown-list { display: grid; gap: 9px; }
.error-event { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.error-event strong, .error-event small { display: block; }
.error-event strong { font-size: .78rem; }
.error-event small { margin-top: 4px; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.error-breakdown-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.error-handoff-panel textarea { min-height: 172px; margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .72rem; }
.error-handoff-summary h3 { margin: 10px 0 6px; }
.error-handoff-summary p { color: var(--muted); font-size: .78rem; }
.handoff-copy-label { margin: 13px 0 10px; }
.drawer { position: fixed; z-index: 30; top: 0; right: 0; width: min(720px, 100vw); height: 100vh; overflow: auto; padding: 28px; border-left: 1px solid var(--line); background: var(--paper); box-shadow: -20px 0 55px rgba(29,51,55,.16); }
.drawer-backdrop { position: fixed; z-index: 29; inset: 0; border: 0; background: rgba(20,39,43,.46); backdrop-filter: blur(2px); cursor: pointer; }
body.drawer-open { overflow: hidden; }
.drawer-close, .dialog-close { margin-left: auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; font-weight: 800; }
.drawer h2 { margin-top: 28px; }
.user-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.user-detail-card { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.user-detail-card strong, .user-detail-card span { display: block; }
.user-detail-card strong { font-size: 1.2rem; }
.user-detail-card span { margin-top: 4px; color: var(--muted); font-size: .67rem; }

.version-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.version-card { padding: 14px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.version-card strong, .version-card span { display: block; }
.version-card strong { overflow-wrap: anywhere; font-size: .8rem; }
.version-card span { margin-top: 6px; color: var(--muted); font-size: .66rem; }
.alert-list { display: grid; gap: 10px; }
.alert-card { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-soft); }
.alert-card h3 { font-size: .91rem; }
.alert-card p { margin-bottom: 8px; color: var(--muted); font-size: .78rem; }
.alert-meta { display: flex; gap: 10px; color: var(--muted); font-size: .67rem; }

.lab-banner { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 16px; padding: 24px; border-radius: var(--radius); color: #f8fbfa; background: #17383b; box-shadow: var(--shadow); }
.lab-banner h2 { font-size: 1.6rem; }
.lab-banner p { max-width: 740px; margin-bottom: 0; color: #bed0ce; }
.lab-banner .panel-kicker { color: #e3c887; }
.inline-lab-link { display: inline-flex; margin-top: 13px; color: #f1d998; font-size: .72rem; font-weight: 850; text-decoration: none; }
.inline-lab-link:hover { color: #fff4ce; text-decoration: underline; }
.lab-banner-stat { min-width: 140px; display: grid; place-content: center; text-align: center; border-left: 1px solid rgba(255,255,255,.15); }
.lab-banner-stat strong { font-size: 2.2rem; }
.lab-banner-stat span { color: #bcd0ce; font-size: .68rem; }
.lab-module-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.lab-module-tab { min-height: 70px; display: grid; gap: 4px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); cursor: pointer; text-align: left; box-shadow: var(--shadow-soft); }
.lab-module-tab:hover { border-color: #aec4bd; background: #fff; }
.lab-module-tab.active { border-color: var(--teal); color: #fff; background: var(--teal); }
.lab-module-tab strong, .lab-module-tab span { display: block; }
.lab-module-tab strong { font-size: .82rem; }
.lab-module-tab span { color: var(--muted); font-size: .68rem; line-height: 1.3; }
.lab-module-tab.active span { color: #d7eeea; }
.test-builder { display: grid; gap: 13px; }
.test-builder .panel-head { margin-bottom: 0; }
.target-tools { display: grid; gap: 9px; padding: 12px; border: 1px solid #d9e4df; border-radius: 8px; background: #f6fbf8; }
.target-tools-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.target-tools-head span { color: var(--muted); font-size: .66rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.target-tools-head strong { color: var(--ink); font-size: .88rem; text-align: right; overflow-wrap: anywhere; }
.target-control-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.target-control-row select { min-width: 0; }
.target-tools p { margin: 0; color: var(--muted); font-size: .7rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
fieldset { margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 5px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.alignment-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 7px; background: #fff; color: var(--ink); font-size: .68rem; font-weight: 750; }
.choice input { width: 14px; min-height: 14px; margin: 0; }
.test-preview-panel { position: sticky; top: 18px; }
.coverage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.coverage-card { padding: 9px; border-radius: 8px; background: var(--teal-soft); }
.coverage-card strong, .coverage-card span { display: block; }
.coverage-card strong { font-size: 1.05rem; }
.coverage-card span { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.case-preview-list, .result-list { max-height: 590px; overflow: auto; display: grid; gap: 8px; padding-right: 3px; }
.case-card, .result-card { padding: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.case-card-head, .result-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.case-card p, .result-card p { margin-bottom: 7px; color: var(--muted); font-size: .76rem; }
.case-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.case-meta span { padding: 3px 6px; border-radius: 999px; background: #f0eee8; color: var(--muted); font-size: .61rem; font-weight: 750; }
.empty-state { min-height: 220px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state p { margin-bottom: 0; font-size: .78rem; }
.result-filter-row { display: flex; gap: 7px; margin: 0 0 13px; }
.filter-chip { min-height: 32px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-size: .69rem; font-weight: 850; }
.filter-chip.active { border-color: var(--teal); color: #fff; background: var(--teal); }
.result-card.fail { border-left: 4px solid var(--coral); }
.result-card.watch { border-left: 4px solid var(--gold); }
.result-card.pass { border-left: 4px solid var(--green); }
.result-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

.dashboard-grid.model-compare-grid { grid-template-columns: minmax(340px, .8fr) minmax(360px, 1fr); align-items: start; }
.model-compare-builder { display: grid; gap: 13px; }
.model-compare-builder .panel-head { margin-bottom: 0; }
.model-profile-summary { display: grid; gap: 9px; }
.model-profile-summary article { padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.model-profile-summary article div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.model-profile-summary article span { color: var(--muted); font-size: .63rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.model-profile-summary article strong { font-size: .82rem; }
.model-profile-summary article p { margin-bottom: 6px; color: var(--muted); font-size: .72rem; }
.model-profile-summary article small { color: #506367; font-size: .66rem; line-height: 1.35; }
.model-comparison-history { max-height: 458px; overflow: auto; display: grid; gap: 8px; padding-right: 3px; }
.comparison-history-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; }
.comparison-history-row:hover { border-color: #b9c9c4; background: #fbfaf6; }
.comparison-history-row strong { overflow-wrap: anywhere; font-size: .78rem; }
.comparison-history-row small { grid-column: 2; color: var(--muted); font-size: .65rem; }
.comparison-result-list { display: grid; gap: 10px; }
.comparison-card { padding: 14px; border: 1px solid var(--line-soft); border-left: 4px solid var(--green); border-radius: 8px; background: #fff; }
.comparison-card.review { border-left-color: var(--gold); }
.comparison-card.block { border-left-color: var(--coral); }
.comparison-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.comparison-card-head strong, .comparison-card-head span { display: block; }
.comparison-card-head strong { font-size: .82rem; }
.comparison-card-head div span { margin-top: 4px; color: var(--muted); font-size: .65rem; }
.comparison-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.comparison-meta span { padding: 4px 7px; border-radius: 999px; background: #f0eee8; color: var(--muted); font-size: .61rem; font-weight: 800; }
.comparison-transcript { margin-bottom: 10px; padding: 10px; border: 1px solid #d9e4df; border-radius: 8px; background: #f7fbf8; color: #40575b; font-size: .75rem; line-height: 1.45; }
.comparison-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.comparison-columns section { min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fffdf8; }
.comparison-column-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.comparison-column-head strong { font-size: .74rem; }
.comparison-column-head span { color: var(--teal-dark); font-size: .68rem; font-weight: 900; }
.comparison-columns p { margin-bottom: 10px; color: #455b60; font-size: .74rem; line-height: 1.45; }
.comparison-cost-row { display: flex; flex-wrap: wrap; gap: 6px; }
.comparison-cost-row span { padding: 3px 6px; border-radius: 999px; background: #eeece6; color: var(--muted); font-size: .6rem; font-weight: 800; }
.comparison-safeguards { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.comparison-safeguards span { padding: 4px 7px; border-radius: 999px; font-size: .59rem; font-weight: 850; }
.comparison-safeguards span.pass { color: #286048; background: var(--green-soft); }
.comparison-safeguards span.fail { color: #8c3e32; background: var(--coral-soft); }
.comparison-notes { margin-top: 10px; padding: 10px; border: 1px solid #eadab0; border-radius: 8px; background: #fbf5e5; }
.comparison-notes p { margin-bottom: 6px; color: #675433; font-size: .72rem; }
.comparison-notes p:last-child { margin-bottom: 0; }

.handoff-intro { margin-bottom: 15px; padding: 20px; border: 1px solid #d9caa1; border-radius: var(--radius); background: var(--gold-soft); }
.handoff-intro p { max-width: 760px; margin-bottom: 0; color: #6e6249; }
.handoff-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; align-items: start; }
.handoff-column { min-height: 340px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,248,.6); }
.handoff-column-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 3px 2px 10px; border-bottom: 1px solid var(--line); }
.handoff-column-head strong { font-size: .77rem; }
.handoff-column-head span { color: var(--muted); font-size: .69rem; }
.handoff-card { margin-bottom: 8px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; box-shadow: var(--shadow-soft); }
.handoff-card strong, .handoff-card small { display: block; }
.handoff-card strong { font-size: .77rem; }
.handoff-card small { margin-top: 6px; color: var(--muted); font-size: .65rem; }
.handoff-card button { margin-top: 10px; padding: 0; border: 0; color: var(--teal-dark); background: transparent; cursor: pointer; font-size: .68rem; font-weight: 850; }
.handoff-dialog { width: min(720px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.handoff-dialog::backdrop { background: rgba(18,40,43,.48); backdrop-filter: blur(3px); }
.handoff-dialog form { padding: 22px; }
.handoff-dialog textarea { min-height: 250px; }

.release-timeline { display: grid; gap: 10px; }
.release-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 120px 90px; gap: 13px; align-items: center; padding: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.release-row strong, .release-row span { font-size: .73rem; }
.release-row span { color: var(--muted); }
.release-policy { margin-top: 16px; }
.promotion-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 15px 0; }
.promotion-flow span { padding: 11px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: center; font-size: .7rem; font-weight: 850; }
.release-policy p { margin-bottom: 0; color: var(--muted); font-size: .8rem; }
.module-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.module-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-soft); }
.module-card p { color: var(--muted); font-size: .78rem; }
.module-card-footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .68rem; }

/* Business operations dashboard */
.business-range-bar { position: sticky; z-index: 5; top: 0; flex-wrap: wrap; background: rgba(251,248,240,.95); backdrop-filter: blur(14px); }
.business-range-bar label { min-width: 150px; }
.business-range-bar .button { align-self: end; }
.business-freshness { margin-left: auto; align-self: center; }
.business-metric-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.business-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); }
.business-table-head { margin: 0; padding: 18px 20px 14px; }
.trend-legend { display: flex; gap: 16px; margin-bottom: 14px; color: var(--muted); font-size: .68rem; font-weight: 800; }
.trend-legend span { display: flex; align-items: center; gap: 6px; }
.trend-legend i { width: 9px; height: 9px; border-radius: 999px; background: var(--teal); }
.trend-legend i.conversion { background: var(--gold); }
.business-trend { min-height: 220px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(22px, 1fr); gap: 7px; align-items: end; overflow-x: auto; padding: 10px 2px 2px; }
.trend-day { min-width: 22px; display: grid; grid-template-rows: 170px auto; gap: 8px; align-items: end; text-align: center; }
.trend-bars { height: 170px; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.trend-bars i { width: min(9px, 38%); min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--teal), var(--teal-dark)); }
.trend-bars i.conversion { background: linear-gradient(180deg, var(--gold), #d69c2b); }
.trend-day small { color: var(--muted); font-size: .55rem; white-space: nowrap; }
.live-status { display: inline-flex; align-items: center; gap: 6px; color: var(--teal-dark); font-size: .68rem; font-weight: 900; }
.live-status i { width: 8px; height: 8px; border-radius: 999px; background: var(--teal); box-shadow: 0 0 0 5px rgba(15,143,139,.12); }
.live-number-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.live-number { padding: 14px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--paper-strong); }
.live-number strong, .live-number span { display: block; }
.live-number strong { font-size: 1.5rem; letter-spacing: -.04em; }
.live-number span { margin-top: 4px; color: var(--muted); font-size: .65rem; font-weight: 800; }
.attention-list { display: grid; gap: 8px; }
.attention-button, .attention-static { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; color: var(--muted); font-size: .7rem; text-align: left; }
.attention-button { cursor: pointer; }
.attention-button:hover { border-color: var(--teal); background: var(--teal-soft); }
.attention-button strong, .attention-static strong { color: var(--ink); font-size: .86rem; }
.status-distribution, .module-usage-list { display: grid; gap: 12px; }
.distribution-row, .module-usage-row { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(120px, 1fr) auto; gap: 12px; align-items: center; }
.distribution-row span, .module-usage-row span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.distribution-row strong, .module-usage-row strong { font-size: .72rem; }
.distribution-track, .module-usage-track, .tour-step-track { height: 8px; overflow: hidden; border-radius: 999px; background: #ece9df; }
.distribution-track i, .module-usage-track i, .tour-step-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--brand-cyan, #58ced0)); }
.customer-table, .canceled-table, .users-table, .engagement-table, .tour-users-table, .compact-customer-table { min-width: 980px; }
.customer-table .table-row { grid-template-columns: minmax(190px, 1.3fr) minmax(95px,.72fr) minmax(120px,.82fr) minmax(92px,.68fr) minmax(110px,.78fr) minmax(66px,.45fr) minmax(110px,.78fr) minmax(100px,.7fr); }
.canceled-table .table-row { grid-template-columns: minmax(190px, 1.25fr) minmax(92px,.62fr) minmax(100px,.68fr) minmax(100px,.68fr) minmax(105px,.72fr) minmax(95px,.65fr) minmax(115px,.78fr) minmax(100px,.68fr); }
.users-table .table-row { grid-template-columns: minmax(190px, 1.25fr) minmax(90px,.65fr) minmax(110px,.72fr) minmax(115px,.78fr) minmax(90px,.62fr) minmax(120px,.78fr) minmax(105px,.72fr) minmax(100px,.7fr); }
.engagement-table .table-row { grid-template-columns: minmax(190px, 1.25fr) repeat(6, minmax(92px,.68fr)); }
.tour-users-table .table-row { grid-template-columns: minmax(190px, 1.25fr) minmax(90px,.62fr) minmax(85px,.58fr) minmax(145px,.95fr) minmax(95px,.65fr) minmax(95px,.65fr) minmax(110px,.75fr); }
.compact-customer-table .table-row { grid-template-columns: minmax(180px, 1.25fr) repeat(4, minmax(92px,.7fr)); }
.customer-table .table-row strong small, .canceled-table .table-row strong small, .users-table .table-row strong small { display: block; margin-top: 3px; color: var(--muted); font-size: .6rem; font-weight: 700; }
.customer-filter-bar { flex-wrap: wrap; }
.customer-filter-bar label:not(.search-field) { min-width: 145px; }
.online-user-list { display: grid; gap: 8px; }
.online-user { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.online-user > i { width: 9px; height: 9px; border-radius: 999px; background: var(--teal); box-shadow: 0 0 0 4px rgba(15,143,139,.11); }
.online-user strong, .online-user span { display: block; }
.online-user strong { font-size: .75rem; }
.online-user span { margin-top: 3px; color: var(--muted); font-size: .63rem; }
.tour-funnel { display: grid; gap: 12px; }
.tour-step { display: grid; grid-template-columns: minmax(180px,.95fr) minmax(140px,1.2fr) 58px; gap: 14px; align-items: center; }
.tour-step > div:first-child span, .tour-step > div:first-child strong { display: block; }
.tour-step > div:first-child span { color: var(--teal-dark); font-size: .58rem; font-weight: 900; text-transform: uppercase; }
.tour-step > div:first-child strong { margin-top: 2px; font-size: .74rem; }
.tour-step > b { text-align: right; font-size: .8rem; }
.tour-step > b small { display: block; color: var(--muted); font-size: .58rem; font-weight: 750; }
.customer-drawer-header { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; margin-top: 24px; }
.customer-drawer-header h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.customer-drawer-header p { margin-bottom: 0; color: var(--muted); }
.drawer-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.account-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 10px 0 0; }
.account-facts > div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.account-facts dt { color: var(--muted); font-size: .6rem; font-weight: 850; text-transform: uppercase; }
.account-facts dd { margin: 5px 0 0; color: var(--ink); font-size: .73rem; font-weight: 750; overflow-wrap: anywhere; }
.drawer-module-list { display: grid; gap: 7px; }
.drawer-module-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .72rem; }
.timeline-list { display: grid; gap: 5px; }
.timeline-item { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.timeline-item > i { width: 9px; height: 9px; margin-top: 5px; border-radius: 999px; background: var(--teal); }
.timeline-item strong, .timeline-item span, .timeline-item small { display: block; }
.timeline-item strong { font-size: .75rem; }
.timeline-item span { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.timeline-item small { margin-top: 5px; color: var(--muted); font-size: .58rem; }
.drawer-loading { display: grid; place-items: center; gap: 10px; min-height: 180px; color: var(--muted); font-size: .74rem; }
.drawer-loading span { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 999px; animation: admin-spin .8s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.empty-state p { margin: 5px 0 0; color: var(--muted); font-size: .7rem; }

/* Customer operations */
.operations-shell { margin-top: 22px; padding: 18px; border: 1px solid rgba(8,118,109,.22); border-radius: 10px; background: var(--brand-panel-mint); }
.operations-shell-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.operations-shell-head h3 { margin: 3px 0 5px; font-size: 1.08rem; }
.operations-shell-head p { margin: 0; color: var(--muted); font-size: .72rem; }
.operations-source { flex: 0 0 auto; padding: 5px 8px; border: 1px solid rgba(8,118,109,.2); border-radius: 999px; background: rgba(255,255,255,.72); color: var(--teal-dark); font-size: .61rem; font-weight: 850; }
.operation-group { margin-top: 16px; }
.operation-group h4 { margin: 0 0 8px; color: var(--muted); font-size: .63rem; letter-spacing: .08em; text-transform: uppercase; }
.operation-button-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.operation-button { min-height: 42px; padding: 9px 10px; border: 1px solid rgba(8,118,109,.22); border-radius: 8px; background: rgba(255,255,255,.88); color: var(--ink); cursor: pointer; font-size: .68rem; font-weight: 800; text-align: left; }
.operation-button:hover { border-color: var(--brand-emerald); box-shadow: 0 5px 14px rgba(8,118,109,.1); transform: translateY(-1px); }
.operation-button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.operation-button.danger { border-color: rgba(204,97,79,.4); }
.operation-button small { display: block; margin-top: 3px; color: var(--muted); font-size: .57rem; font-weight: 700; }
.operation-summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.operation-summary-grid div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.operation-summary-grid strong, .operation-summary-grid span { display: block; }
.operation-summary-grid strong { font-size: 1rem; }
.operation-summary-grid span { margin-top: 3px; color: var(--muted); font-size: .59rem; }
.operation-history { display: grid; gap: 7px; margin-top: 10px; }
.operation-history-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.operation-history-item strong, .operation-history-item span, .operation-history-item small { display: block; }
.operation-history-item strong { font-size: .7rem; }
.operation-history-item span { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.operation-history-item small { color: var(--muted); font-size: .57rem; text-align: right; }
.customer-record-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.customer-record-facts > div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255,255,255,.88); }
.customer-record-facts span, .customer-record-facts strong { display: block; }
.customer-record-facts span { color: var(--muted); font-size: .57rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.customer-record-facts strong { margin-top: 4px; overflow-wrap: anywhere; font-size: .7rem; }
.communication-history-item strong { text-transform: none; }
.empty-state.compact { padding: 12px; }
.customer-record-link { display: inline; padding: 0; border: 0; color: var(--teal-dark); background: transparent; cursor: pointer; font: inherit; font-weight: 850; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.customer-record-link:hover { color: var(--brand-emerald); }
.customer-action-dialog { width: min(650px,calc(100vw - 24px)); max-height: calc(100vh - 30px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.customer-action-dialog::backdrop { background: rgba(21,33,38,.6); backdrop-filter: blur(3px); }
.customer-action-dialog form { padding: 24px; }
.customer-action-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 18px 0 12px; }
.customer-action-fields label.wide { grid-column: 1 / -1; }
.customer-action-fields textarea { min-height: 115px; }
.confirmation-row { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; padding: 12px; border: 1px solid rgba(239,185,78,.55); border-radius: 8px; background: var(--gold-soft); color: var(--ink); font-size: .72rem; font-weight: 750; }
.confirmation-row input { width: 18px; height: 18px; margin-top: 1px; }
.customer-action-dialog .panel-support { color: var(--muted); }
.customer-action-dialog label > span b { color: var(--coral); font-size: .58rem; text-transform: uppercase; }

@media (max-width: 1180px) {
  .metric-grid, .business-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid.two-thirds, .dashboard-grid.lab-grid, .dashboard-grid.model-compare-grid, .dashboard-grid.cost-grid, .dashboard-grid.error-grid, .dashboard-grid.business-grid { grid-template-columns: 1fr; }
  .test-preview-panel { position: static; }
  .handoff-board { grid-template-columns: 1fr; }
  .table-row, .cost-table .table-row, .error-table .table-row { grid-template-columns: 1.2fr repeat(3, minmax(80px, .7fr)); }
  .table-row > *:nth-child(n+5) { display: none; }
}

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; width: 100%; max-width: 100%; height: auto; overflow: hidden; padding: 16px; }
  .brand { padding-bottom: 14px; }
  .admin-nav { min-width: 0; max-width: 100%; flex: none; display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior: auto; padding: 12px 0 2px; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { min-width: max-content; }
  .admin-main { padding: 20px 14px 50px; }
  .admin-topbar { display: block; }
  .topbar-actions { margin-top: 14px; }
  .metric-grid, .metric-grid.compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid.equal, .module-card-grid { grid-template-columns: 1fr; }
  .health-factors, .version-grid, .coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-row { grid-template-columns: 1.2fr .8fr; }
  .module-row > *:nth-child(n+3) { display: none; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .business-range-bar { position: static; }
  .business-freshness { margin-left: 0; }
  .table-panel { overflow-x: auto; }
  .search-field { min-width: 0; }
  .lab-banner { display: block; }
  .lab-banner-stat { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.15); border-left: 0; }
  .lab-module-tabs { grid-template-columns: 1fr; }
  .comparison-columns { grid-template-columns: 1fr; }
  .comparison-card-head { display: block; }
  .comparison-card-head .status-badge { margin-top: 8px; }
}

@media (max-width: 520px) {
  .metric-grid, .metric-grid.compact-grid, .health-factors, .version-grid, .form-row, .choice-grid, .alignment-choices, .coverage-grid, .user-detail-grid, .target-control-row { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .health-score-wrap { grid-template-columns: 1fr; }
  .health-score { margin: 0 auto; }
  .release-row { grid-template-columns: 1fr; }
  .promotion-flow { grid-template-columns: 1fr; }
  .live-number-grid, .account-facts, .operation-button-grid, .operation-summary-grid, .customer-action-fields, .customer-record-facts { grid-template-columns: 1fr; }
  .customer-action-fields label.wide { grid-column: auto; }
  .tour-step { grid-template-columns: 1fr 52px; }
  .tour-step-track { grid-column: 1 / -1; grid-row: 2; }
}

.detector-banner { background: linear-gradient(135deg, rgba(8, 118, 109, .16), rgba(88, 206, 208, .08)); }
.detector-coverage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.detector-card { min-height: 150px; padding: 16px; border: 1px solid rgba(21, 33, 38, .1); border-radius: 16px; background: var(--hope-warm-ivory, #fbf8f0); display: grid; align-content: start; gap: 8px; }
.detector-card.finding { border-color: rgba(239, 185, 78, .8); box-shadow: inset 4px 0 0 var(--hope-gold, #efb94e); }
.detector-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.detector-card h3, .detector-card p { margin: 0; }
.detector-card p { color: var(--hope-deep-ink-muted, #506066); font-size: .88rem; line-height: 1.45; }
.detector-card small { color: var(--hope-emerald, #08766d); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
@media (max-width: 720px) { .detector-coverage-grid { grid-template-columns: 1fr; } }

/* Quality workspace */
.quality-workspace { --quality-line: rgba(8, 118, 109, .18); }
.evaluation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--quality-line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 12%, rgba(88, 206, 208, .14), transparent 32%),
    linear-gradient(135deg, #ffffff 0%, var(--brand-canvas) 58%, var(--brand-panel-mint) 140%);
  box-shadow: 0 16px 38px rgba(21, 33, 38, .07);
}
.evaluation-hero-copy { min-width: 0; }
.evaluation-hero .panel-kicker { margin-bottom: 7px; color: var(--brand-emerald); }
.evaluation-hero h2 { max-width: 820px; margin-bottom: 9px; color: var(--brand-ink); font-size: clamp(1.45rem, 2.2vw, 2rem); letter-spacing: -.035em; }
.evaluation-hero p { max-width: 790px; margin: 0; color: var(--brand-ink-soft); font-size: .82rem; line-height: 1.6; }
.evaluation-status-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.evaluation-status-row span { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border: 1px solid rgba(8, 118, 109, .12); border-radius: 999px; color: var(--brand-emerald); background: rgba(232, 244, 239, .72); font-size: .62rem; font-weight: 850; }
.evaluation-status-row span::before { width: 6px; height: 6px; margin-right: 6px; border-radius: 999px; background: var(--brand-cyan); content: ""; }
.evaluation-score { display: grid; place-content: center; min-width: 0; padding: 18px; border-left: 1px solid var(--quality-line); text-align: center; }
.evaluation-score span, .evaluation-score small { color: var(--brand-ink-soft); font-size: .62rem; font-weight: 800; }
.evaluation-score span { letter-spacing: .06em; text-transform: uppercase; }
.evaluation-score strong { margin: 5px 0 3px; color: var(--brand-emerald); font-size: 2.25rem; letter-spacing: -.055em; }
.evaluation-panel { border-color: rgba(21, 33, 38, .11); border-radius: 14px; background: rgba(255, 255, 255, .88); box-shadow: 0 10px 30px rgba(21, 33, 38, .055); }
.evaluation-panel .panel-head { align-items: flex-start; }
.panel-support { max-width: 570px; margin: 5px 0 0; color: var(--brand-ink-soft); font-size: .68rem; font-weight: 600; line-height: 1.45; }
.quality-workspace .lab-module-tabs { gap: 9px; }
.quality-workspace .lab-module-tab { min-height: 74px; border-color: rgba(21, 33, 38, .12); border-radius: 12px; background: rgba(255,255,255,.82); box-shadow: 0 7px 22px rgba(21,33,38,.045); }
.quality-workspace .lab-module-tab:hover { border-color: var(--brand-emerald); background: #fff; }
.quality-workspace .lab-module-tab.active { border-color: var(--brand-emerald); color: #fff; background: var(--brand-emerald); box-shadow: 0 10px 24px rgba(8,118,109,.18); }
.quality-workspace .lab-grid { grid-template-columns: minmax(390px, .86fr) minmax(420px, 1.14fr); gap: 14px; }
.quality-workspace .test-builder { gap: 15px; }
.quality-workspace fieldset { border-color: rgba(21, 33, 38, .11); background: rgba(251,248,240,.48); }
.quality-workspace .choice { border-color: rgba(21,33,38,.1); }
.evaluation-empty { min-height: 280px; padding: 30px; border: 1px dashed rgba(8,118,109,.24); border-radius: 11px; background: linear-gradient(145deg, rgba(232,244,239,.46), rgba(255,255,255,.2)); }
.evaluation-empty strong { color: var(--brand-ink); font-size: .86rem; }
.preview-disclosure { margin: 12px 0 0; color: var(--brand-ink-soft); font-size: .63rem; font-weight: 750; text-align: right; }
.quality-workspace .coverage-card { border: 1px solid rgba(8,118,109,.1); background: rgba(232,244,239,.7); }
.quality-workspace .case-card,
.quality-workspace .result-card,
.quality-workspace .comparison-history-row,
.quality-workspace .model-profile-summary article { border-color: rgba(21,33,38,.1); }
.handoff-hero { grid-template-columns: minmax(0,1fr) 190px; }
.quality-workspace .handoff-board { gap: 12px; }
.quality-workspace .handoff-column { min-height: 230px; padding: 13px; border-color: rgba(21,33,38,.11); border-radius: 13px; background: rgba(255,255,255,.58); }
.quality-workspace .handoff-column .empty-state { min-height: 150px; }

@media (max-width: 1180px) {
  .quality-workspace .lab-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .evaluation-hero { grid-template-columns: 1fr; padding: 21px; }
  .evaluation-score { padding: 15px 0 0; border-top: 1px solid var(--quality-line); border-left: 0; }
  .evaluation-status-row { align-items: stretch; }
  .evaluation-status-row span { flex: 1 1 150px; }
}

/* Customer-visible in-app Contact inbox. */
.contact-inbox-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(440px, 1.45fr);
  gap: 18px;
  align-items: start;
}

.contact-inbox-list-panel,
.contact-inbox-detail-panel {
  min-height: 620px;
}

.contact-admin-thread-list {
  display: grid;
  gap: 10px;
  max-height: 720px;
  overflow-y: auto;
}

.contact-admin-thread {
  position: relative;
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--brand-emerald) 16%, transparent);
  border-radius: 15px;
  color: var(--brand-ink);
  text-align: left;
  background: color-mix(in srgb, var(--brand-canvas) 94%, var(--brand-panel-mint));
  cursor: pointer;
}

.contact-admin-thread:hover,
.contact-admin-thread.selected {
  border-color: var(--brand-teal);
  box-shadow: inset 4px 0 0 var(--brand-teal);
}

.contact-admin-thread.needs-review::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-gold) 20%, transparent);
}

.contact-admin-thread > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-admin-thread > span b {
  color: var(--brand-emerald);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.contact-admin-thread time,
.contact-admin-thread small,
.contact-admin-thread em,
.contact-admin-thread p {
  color: var(--brand-ink-soft);
  font-size: 0.78rem;
  font-style: normal;
}

.contact-admin-thread p {
  overflow: hidden;
  margin: 3px 0 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-admin-status {
  width: fit-content;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--brand-emerald);
  background: var(--brand-panel-mint);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 850;
}

.contact-admin-status.status-waiting_on_user {
  color: var(--brand-ink);
  background: color-mix(in srgb, var(--brand-gold-soft) 52%, var(--brand-canvas));
}

.contact-admin-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.contact-admin-detail-head h2 {
  margin: 0;
}

.contact-admin-detail-head p {
  margin: 6px 0 0;
  color: var(--brand-ink-soft);
}

.contact-admin-detail-head label {
  min-width: 180px;
}

.contact-admin-detail-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-admin-detail-actions label {
  min-width: 150px;
}

.contact-admin-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.contact-admin-context span {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--brand-ink-soft);
  background: var(--brand-panel-mint);
  font-size: 0.72rem;
  font-weight: 750;
}

.contact-admin-message-stream {
  display: grid;
  gap: 12px;
  max-height: 430px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--brand-emerald) 14%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--brand-panel-mint) 48%, var(--brand-canvas));
}

.contact-admin-message {
  width: min(84%, 620px);
  padding: 13px 15px;
  border-radius: 15px;
}

.contact-admin-message.customer {
  justify-self: start;
  border: 1px solid color-mix(in srgb, var(--brand-emerald) 20%, transparent);
  border-bottom-left-radius: 5px;
  background: var(--brand-canvas);
}

.contact-admin-message.support {
  justify-self: end;
  border-bottom-right-radius: 5px;
  color: var(--brand-canvas);
  background: var(--brand-emerald);
}

.contact-admin-message > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
}

.contact-admin-message time {
  opacity: 0.74;
  white-space: nowrap;
}

.contact-admin-message p {
  margin: 7px 0 0;
  line-height: 1.5;
}

.contact-admin-reply-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.contact-admin-reply-form label,
.contact-admin-reply-form label span {
  display: grid;
  gap: 7px;
  font-weight: 850;
}

.contact-admin-reply-form textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--brand-emerald) 24%, transparent);
  border-radius: 13px;
  color: var(--brand-ink);
  background: var(--brand-canvas);
  font: inherit;
  line-height: 1.5;
}

.contact-admin-reply-form > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.contact-admin-reply-form small {
  color: var(--brand-ink-soft);
}

.admin-empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  align-content: center;
  gap: 6px;
  color: var(--brand-ink-soft);
  text-align: center;
}

.admin-empty-state p {
  max-width: 42ch;
  margin: 0;
}

@media (max-width: 1100px) {
  .contact-inbox-layout {
    grid-template-columns: 1fr;
  }

  .contact-inbox-list-panel,
  .contact-inbox-detail-panel {
    min-height: auto;
  }
}
