/* Kadi interface system. Presentation only; source and financial rules stay in their modules. */
html[data-theme="light"] {
  color-scheme:light;
  --bg:#f5f5f7;--surface:#fff;--surface2:#f5f5f7;--panel:#fff;--text:#1d1d1f;--muted:#6e6e73;--line:#e5e5e8;
  --primary:#0071e3;--primary2:#0071e3;--primary-soft:#eaf3ff;--accent:#0071e3;--accent-strong:#0066cc;--accent-soft:#eaf3ff;
  --km-text:#1d1d1f;--km-muted:#6e6e73;--km-line:#e5e5e8;--km-surface:#fff;--km-soft:#f5f5f7;--km-accent:#0071e3;
  --surface-soft:#f5f5f7;--surface-strong:#ededf0;--line-strong:#bfc0c6;--faint:#76767c;
  --success:#18794e;--success-soft:#ecf7f0;--warning:#956000;--warning-soft:#fff6e4;--danger:#c42b32;--danger-soft:#fff0f1;
  --ui-header:rgba(255,255,255,.88);--ui-hover:#f0f0f3;--ui-selected:#eaf3ff;--ui-shadow:0 8px 30px #0000000d;
}
html[data-theme="dark"] {
  color-scheme:dark;
  --bg:#161618;--surface:#212124;--surface2:#29292d;--panel:#212124;--text:#f5f5f7;--muted:#aaaab1;--line:#38383d;
  --primary:#409cff;--primary2:#409cff;--primary-soft:#193554;--accent:#409cff;--accent-strong:#73b6ff;--accent-soft:#193554;
  --km-text:#f5f5f7;--km-muted:#aaaab1;--km-line:#38383d;--km-surface:#212124;--km-soft:#29292d;--km-accent:#409cff;
  --surface-soft:#29292d;--surface-strong:#333338;--line-strong:#62626a;--faint:#aaaab1;
  --success:#6bd4a0;--success-soft:#183b2d;--warning:#f2bf66;--warning-soft:#3b301e;--danger:#ff858a;--danger-soft:#402326;
  --ui-header:rgba(29,29,31,.90);--ui-hover:#303035;--ui-selected:#193554;--ui-shadow:0 8px 30px #00000026;
}
html {scroll-padding-top:100px}
body {background:var(--bg)!important;color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;line-height:1.55}
body .container {padding-top:30px;min-width:0}
.ui-skip {position:fixed;top:-100px;left:16px;z-index:2000;background:var(--surface);color:var(--primary);padding:12px 18px;border-radius:10px}
.ui-skip:focus {top:10px}
:where(a,button,input,select,textarea,summary):focus-visible {outline:3px solid var(--primary)!important;outline-offset:3px}
body .topbar {min-height:62px;height:auto!important;padding:10px 28px;gap:24px;background:var(--ui-header)!important;border-bottom:1px solid var(--line);box-shadow:none!important;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);flex-wrap:nowrap}
body .topbar .brand {min-width:0!important;flex:0 0 auto;text-decoration:none;margin-right:12px}
html body .topbar .brandmark {font-size:26px!important;letter-spacing:-1.5px!important;font-weight:750!important;min-width:0!important;color:var(--text)!important;line-height:1.2!important;background:none!important}
body .topnav {gap:4px;flex:1;flex-wrap:nowrap!important;width:auto;order:initial;overflow:visible!important;min-width:0}
body .topnav>a {padding:8px 13px;border-radius:9px;font-size:13px;font-weight:550;color:var(--muted);white-space:nowrap;background:none}
body .topnav>a:hover {color:var(--text);background:var(--ui-hover)}
body .topnav>a.active {color:var(--text);background:var(--ui-hover);font-weight:650}
.ui-header-actions {display:flex;align-items:center;gap:8px;flex:0 0 auto}
.ui-menu {position:relative;margin:0}
body .ui-menu>summary {display:flex;align-items:center;justify-content:center;gap:8px;min-height:36px;padding:7px 11px;border:0;background:transparent;color:var(--muted);font-size:13px;font-weight:550;cursor:pointer;list-style:none;border-radius:9px;box-shadow:none}
.ui-menu>summary::-webkit-details-marker {display:none}
body .ui-menu>summary:hover,body .ui-menu[open]>summary,body .ui-menu>summary.active {background:var(--ui-hover);color:var(--text)}
body .ui-menu .account-icon {width:18px;height:18px;color:inherit}
body .ui-menu .ui-popover {position:absolute;right:0;top:calc(100% + 12px);width:252px;padding:7px;background:var(--surface);border:1px solid var(--line);border-radius:15px;box-shadow:0 12px 44px #0000001c;z-index:100;display:flex;flex-direction:column;gap:2px;color:var(--text)}
body .ui-menu .ui-popover a {display:block;border:0;border-radius:8px;padding:10px 12px;font-size:13px;font-weight:500;text-decoration:none;color:var(--text);white-space:normal;background:transparent}
body .ui-menu .ui-popover a:hover,body .ui-menu .ui-popover a.active {background:var(--ui-hover)}
.ui-menu-label {display:block;padding:10px 12px 4px;font-size:10px;font-weight:650;letter-spacing:.045em;text-transform:uppercase;color:var(--muted)}
.ui-account-heading {padding:10px 12px 12px;border-bottom:1px solid var(--line);margin-bottom:3px}
.ui-account-heading b,.ui-account-heading small {display:block;overflow-wrap:anywhere}
.ui-account-heading small {font-size:11px;color:var(--muted);margin-top:3px}
body .ui-popover .theme-switch {display:flex;gap:2px;margin:3px 8px 9px;padding:3px;background:var(--surface2);border:0;border-radius:8px;box-shadow:none}
body .ui-popover .theme-switch button {width:auto;flex:1;min-height:30px;height:auto;padding:5px;font-size:11px;border-radius:6px;color:var(--muted);border:0;background:transparent}
body .ui-popover .theme-switch button.active {background:var(--surface);color:var(--text);box-shadow:0 1px 4px #00000012}
body .ui-popover a.ui-signout {color:var(--muted);border-top:1px solid var(--line);border-radius:0 0 8px 8px}
body h1,body .page-head h1,body .gs-head h1 {font-size:29px;line-height:1.18;font-weight:650;letter-spacing:-.8px}
body h2,body .panel h2 {font-weight:650;line-height:1.35;letter-spacing:-.35px}
body .page-head,body .hero-row {gap:18px;margin:0 0 22px}
body .page-head>div:first-child,body .hero-row>div:first-child {min-width:0}
body .page-head p,body .hero-row p {font-size:13px;line-height:1.6;color:var(--muted);max-width:850px}
body .eyebrow {font-size:10px;font-weight:600;letter-spacing:.12em;color:var(--muted);margin-bottom:8px}
body .panel,body .kpi,body .gs-figure,body .an-entry,body .an-season,body .kadi-brand-compare,body .kadi-decisions {background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:none!important}
body .panel {padding:20px;margin-bottom:16px}
body .panel-head p {font-size:12px;line-height:1.55}
body .btn,body .km-quiet-button,body .km-primary-button,body .map-btn {font-size:12px;font-weight:550;min-height:36px;height:auto;padding:8px 13px;border-radius:9px;border:1px solid var(--line);background:var(--surface);color:var(--text);box-shadow:none!important;line-height:1.35;text-decoration:none;transition:background .15s,border-color .15s}
body .btn:hover,body .km-quiet-button:hover,body .map-btn:hover {background:var(--ui-hover);border-color:var(--line-strong);transform:none}
body .btn.primary,body .km-primary-button,body .map-btn.primary {background:#0071e3!important;border-color:#0071e3!important;color:#fff!important;box-shadow:none!important}
body .btn.primary:hover,body .map-btn.primary:hover {background:#0066cc!important}
body .btn.small {font-size:11px;min-height:30px;padding:6px 10px}
body button:disabled,body .btn:disabled {opacity:.45;cursor:not-allowed;filter:none}
body input:not([type=checkbox]):not([type=radio]):not([type=hidden]),body select,body textarea {border:1px solid var(--line-strong);border-radius:9px;background:var(--surface);color:var(--text);font:inherit;font-size:13px;min-height:37px;box-shadow:none;padding:8px 11px;max-width:100%}
body input[type=checkbox],body input[type=radio] {accent-color:var(--primary);min-height:0;height:auto;width:16px}
body input::placeholder,body textarea::placeholder {color:var(--muted);opacity:.85}
body label {font-size:11px;font-weight:550;color:var(--muted);line-height:1.4}
body .filterbar {padding:15px 18px;gap:12px;box-shadow:none}
body .chip,body .tag,body .status-chip {background:var(--surface2);border-color:var(--line);color:var(--muted);font-weight:550}
body table th,body .data-table th {background:var(--surface2);color:var(--muted);font-size:11px;font-weight:600;text-transform:none;letter-spacing:0}
body table td,body .data-table td {font-size:12px;border-color:var(--line);color:var(--text)}
body table th,body table td {padding:12px}
body .data-table tbody tr:hover {background:var(--surface2)}
body .table-wrap {border-radius:11px;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
body .kpi {padding:18px;box-shadow:none;border-top:1px solid var(--line)}
body .kpi>span {font-size:11px;font-weight:550;color:var(--muted)}
body .kpi strong {font-size:25px;letter-spacing:-.6px;font-weight:650}
body .kpi small {color:var(--muted);font-size:10px;line-height:1.5}
body .kpi-grid-3 {grid-template-columns:repeat(3,minmax(0,1fr))}
body .source-note,body .note,body .alert {font-size:12px;line-height:1.6;padding:13px 16px;box-shadow:none}
body .source-note {background:var(--primary-soft);border:1px solid color-mix(in srgb,var(--primary) 18%,var(--line));color:var(--text)}
body .note,body .alert.warn {color:var(--warning);background:var(--warning-soft);border-color:color-mix(in srgb,var(--warning) 25%,var(--line))}
body .alert.error {background:var(--danger-soft);color:var(--danger)}
body .alert.success {background:var(--success-soft);color:var(--success)}
body .footer {font-size:10px;color:var(--muted);gap:16px;padding-top:18px;border-top:1px solid var(--line);margin-top:20px}
/* A single, predictable disclosure pattern across reference pages. */
body .ui-disclosure {margin:14px 0;border:1px solid var(--line);border-radius:13px;background:var(--surface);min-width:0;color:var(--text)}
body .ui-disclosure>summary {list-style:none;display:flex;align-items:center;gap:12px;padding:15px 17px;cursor:pointer;font-size:13px;font-weight:550;line-height:1.4}
.ui-disclosure>summary::-webkit-details-marker {display:none}
.ui-disclosure>summary::before {content:'';width:6px;height:6px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:rotate(-45deg);flex:none;transition:transform .15s;margin:0 4px 0 1px}
.ui-disclosure[open]>summary::before {transform:rotate(45deg)}
.ui-disclosure>summary>span:first-of-type {flex:1;min-width:0}
.ui-disclosure>summary small {font-size:11px;color:var(--muted);font-weight:400}
.ui-disclosure[open]>summary {border-bottom:1px solid var(--line)}
.ui-disclosure-body {padding:18px;min-width:0}
.ui-disclosure-body>.panel {border:0!important;padding:0!important;margin:0;box-shadow:none!important}
.ui-disclosure-body>.filterbar {background:transparent}
body .ui-quiet-disclosure {background:transparent;border:0}
body .ui-quiet-disclosure>summary {padding:9px 0;color:var(--muted);font-size:12px}
.ui-disclosure-body .source-note {margin:0}
.ui-chart-note>summary {cursor:pointer;color:var(--muted);font-size:11px;list-style:revert}
.ui-chart-note p {margin:8px 0 0;line-height:1.6}
body .kadi-fold {border-color:var(--line)!important;border-radius:13px!important}
body .kadi-fold>summary {padding:15px 17px!important;gap:10px!important}
body .kadi-fold>summary b {font-size:13px!important;font-weight:550!important}
body .kadi-fold>summary small {font-size:11px!important}
/* The company overview starts with four outcomes; all remaining metrics remain available. */
body .gs-overview {margin:0 0 32px;--gs-bg:var(--surface);--gs-tile:var(--surface)}
body .gs-head {margin-bottom:10px}
body .gs-source {font-size:11px;margin:9px 0 16px}
body .gs-kpis {grid-template-columns:repeat(4,minmax(0,1fr));border:0;background:transparent;padding:0;gap:12px}
body .gs-kpi {padding:18px;min-height:130px;background:var(--surface);border:1px solid var(--line);border-radius:14px}
body .gs-kpi-label {font-size:11px;font-weight:550;color:var(--muted)}
body .gs-kpi-value {font-size:28px;font-weight:650;white-space:normal;overflow-wrap:anywhere;letter-spacing:-.7px;margin:9px 0 6px}
body .gs-kpi-sub {font-size:11px;color:var(--muted)}
body .gs-delta {background:var(--success-soft);color:var(--success);border-radius:6px;padding:3px 6px;font-size:10px;margin-top:10px}
body .gs-delta.bad {color:var(--danger);background:var(--danger-soft)}
.ui-secondary-metrics {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:16px}
.ui-secondary-metrics .gs-kpi {background:var(--surface2);border:0;min-height:120px}
.ui-secondary-metrics .gs-kpi-value {font-size:23px}
body .gs-note {font-size:11px;margin:13px 0 20px;padding-left:11px;border-left:2px solid var(--line-strong);line-height:1.6}
body .gs-figure {padding:20px}
body .gs-figure h2 {font-size:15px;margin-bottom:14px}
body .gs-chart {min-height:0}
body .gs-legend {font-size:10px;gap:8px 12px;margin:13px 0}
body .gs-legend i {width:8px;height:8px;border-radius:50%}
body .gs-periods,body .segmented {background:var(--surface2);border:1px solid var(--line);box-shadow:none;border-radius:9px;padding:3px}
body .gs-periods button,body .segmented button {font-size:12px;font-weight:550;padding:7px 12px;border:0;border-radius:6px;color:var(--muted);background:transparent;box-shadow:none}
body .gs-periods button[aria-pressed=true],body .segmented button.active {background:var(--surface);color:var(--text);box-shadow:0 1px 4px #0000000d}
body .gs-source-link {font-size:11px}
body .v3232-overview>.page-head {border-top:1px solid var(--line);padding-top:26px;margin-top:10px}
body .v3232-overview .page-head h2 {font-size:23px}
body .quickbar {gap:6px;flex-wrap:wrap}
/* Lists for tasks and catalogs share search, density and editable details. */
.ui-collection-toolbar {display:flex;align-items:end;gap:12px;margin:18px 0 12px}
.ui-collection-toolbar label {flex:1;max-width:520px}
.ui-collection-toolbar input {width:100%}
.ui-collection-status {font-size:11px;color:var(--muted);margin-left:auto;white-space:nowrap}
.ui-record {background:var(--surface);border:1px solid var(--line);border-radius:12px;margin:8px 0;min-width:0}
.ui-record>summary {display:grid;grid-template-columns:minmax(180px,2fr) minmax(100px,1fr) minmax(110px,1fr) 82px;gap:18px;align-items:center;padding:16px 18px;cursor:pointer;list-style:none;font-size:13px}
.ui-record>summary::-webkit-details-marker {display:none}
.ui-record-title b,.ui-record-title small {display:block}
.ui-record-title b {font-weight:600}
.ui-record-title small {color:var(--muted);font-size:11px;font-weight:400;margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:540px}
.ui-record-value {font-size:13px;font-variant-numeric:tabular-nums}
.ui-record-meta {font-size:11px;color:var(--muted)}
.ui-record-action {font-size:11px;text-align:right;color:var(--primary)}
.ui-record[open]>summary {border-bottom:1px solid var(--line)}
.ui-record-body {padding:20px;background:var(--surface2);border-radius:0 0 12px 12px}
.ui-inline-form {display:flex;gap:14px;align-items:end;flex-wrap:wrap}
.ui-inline-form label {flex:1;min-width:130px;max-width:280px}
.ui-inline-form label.ui-grow {flex:2;max-width:none}
.ui-inline-form input,.ui-inline-form select {width:100%}
.ui-collection-pager {display:flex;align-items:center;justify-content:flex-end;gap:12px;margin:16px 0;color:var(--muted);font-size:11px}
.ui-collection-empty {padding:30px;text-align:center;color:var(--muted)}
[hidden] {display:none!important}
/* Analytics and technical tools use the same low-noise surfaces. */
body .an-nav {gap:3px;padding:0 0 12px;margin:5px 0 22px}
body .an-nav a {border:0;background:transparent;padding:8px 13px;border-radius:8px;font-size:12px;font-weight:550;box-shadow:none;color:var(--muted)}
body .an-nav a[aria-current] {background:var(--surface);color:var(--text);box-shadow:0 1px 4px #00000006}
body .an-entry,body .an-season {padding:22px;transition:border-color .15s,background .15s}
body .an-entry:hover,body .an-season:hover {transform:none;background:var(--surface);border-color:var(--line-strong)}
body .an-entry h2 {font-size:20px;margin:15px 0 10px}
body .an-entry p {font-size:13px;min-height:65px;line-height:1.6}
body .an-entry-action,body .an-season>span:last-child {font-size:12px;color:var(--primary)}
body .an-season h2 {font-size:21px;margin-top:16px}
body .an-season p {margin-bottom:20px;font-size:12px}
body .an-change-periods a,body .an-season-tabs a {font-size:12px;padding:8px 13px;border-radius:8px}
body .an-change-counts>div {padding:17px}
body .an-change-counts b {font-size:26px;font-weight:650}
body .an-change-row {padding:12px 0;font-size:13px}
body .an-change-row small {font-size:11px}
body .calendar-day {min-height:108px;background:var(--surface)}
body .calendar-day.outside {background:var(--surface2)}
body .delivery-totals article {background:var(--surface);padding:18px;border-radius:13px}
body .delivery-totals strong {font-size:27px;font-weight:650;margin:7px 0}
body .calendar-help {font-size:11px;margin-bottom:14px}
body .map-card,body .map-stat,body .map-modal {background:var(--surface);border-color:var(--line);color:var(--text);box-shadow:none}
body .map-name,body .source-title,body .map-stat b {color:var(--text)}
body .map-links,body .map-hint,body .source-sub {color:var(--muted)}
body .source-row {border-color:var(--line);background:var(--surface)}
body .source-row:hover,body .source-row.locked {background:var(--surface2)}
body .source-row.selected {background:var(--primary-soft);border-color:var(--primary)}
body .map-close,body .map-count,body .source-badge {background:var(--surface2);color:var(--muted)}
body .map-stat {font-size:12px;border-radius:10px}
body .map-overlay {background:#00000045}
body .map-foot,body .map-modal-head {border-color:var(--line)}
body .source-flow {gap:12px;margin-bottom:18px}
body .source-flow .source-card {padding:16px;background:var(--surface);border-color:var(--line);box-shadow:none}
body .source-card b {font-size:13px;color:var(--text)}
body .source-card p {font-size:11px;color:var(--muted)}
/* The task app is embedded in the shared shell, including both theme modes. */
body[data-page="/tasks"] #aios-tasks-app {min-height:65vh}
body[data-page="/tasks"] .tasks-shell {width:100%;padding:0;margin:0}
body[data-page="/tasks"] .tasks-topbar {position:static;margin:0 0 22px;padding:0;background:none;backdrop-filter:none;gap:18px}
body[data-page="/tasks"] .brand-block h1 {font-size:29px;font-weight:650;letter-spacing:-.8px;line-height:1.18}
body[data-page="/tasks"] .brand-block p {font-size:13px;color:var(--muted)}
body[data-page="/tasks"] .summary-grid {gap:12px;margin-bottom:16px}
body[data-page="/tasks"] .summary-card {background:var(--surface);padding:16px 18px;box-shadow:none;min-height:100px;border-color:var(--line)}
body[data-page="/tasks"] .summary-card::after {display:none}
body[data-page="/tasks"] .summary-card strong {font-size:26px;font-weight:650}
body[data-page="/tasks"] .control-card,body[data-page="/tasks"] .team-card {background:var(--surface);border-color:var(--line);box-shadow:none}
body[data-page="/tasks"] .control-card {padding:16px}
body[data-page="/tasks"] .tasks-shell .filters-row {gap:10px}
body[data-page="/tasks"] .task-card,body[data-page="/tasks"] .board-column {box-shadow:none;border-color:var(--line);background:var(--surface)}
body[data-page="/tasks"] .task-card.overdue,body[data-page="/tasks"] .task-table .row-overdue {background:var(--surface)}
body[data-page="/tasks"] .tasks-shell .queue-row button {border-radius:8px;font-size:12px;padding:7px 12px}
body[data-page="/tasks"] .task-drawer,body[data-page="/tasks"] .task-modal {background:var(--surface);color:var(--text)}
body[data-page="/tasks"] .task-table th {background:var(--surface2);text-transform:none;font-size:11px}
body[data-page="/tasks"] .task-table td {font-size:12px}
body[data-page="/tasks"] .team-card {margin-top:18px}
/* Fluid layout without hiding the primary navigation. */
@media(max-width:1100px) {
 body .topbar {gap:14px;padding-left:20px;padding-right:20px;flex-wrap:wrap}
 body .topbar .brand {margin-right:0}
 body .topnav>a {padding:8px 9px;font-size:12px}
 .ui-profile-label {display:none}
 .ui-secondary-metrics {grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:760px) {
 body .topbar {padding:10px 16px;gap:8px 14px}
 body .topnav {order:3;width:100%;flex:1 0 100%;overflow-x:auto!important;flex-wrap:nowrap!important;padding:4px 0 2px;scrollbar-width:none}
 body .topnav::-webkit-scrollbar {display:none}
 body .topnav>a {min-height:38px;display:flex;align-items:center;padding:8px 12px}
 .ui-header-actions {margin-left:auto}
 body .ui-menu>summary {min-height:40px}
 body .container {padding:22px 16px 30px}
 body h1,body .page-head h1,body .gs-head h1 {font-size:25px}
 body .gs-kpis {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .ui-secondary-metrics {grid-template-columns:repeat(2,minmax(0,1fr));padding:12px}
 body .gs-kpi {padding:15px;min-height:124px}
 body .gs-kpi-value {font-size:25px}
 body .gs-chart-grid {gap:12px}
 .ui-disclosure>summary {flex-wrap:wrap;padding:14px}
 .ui-disclosure>summary small {white-space:normal}
 .ui-disclosure-body {padding:14px}
 .ui-record>summary {grid-template-columns:minmax(0,1fr) auto;gap:7px 14px;padding:14px}
 .ui-record-meta {grid-column:1}
 .ui-record-action {grid-column:2;grid-row:2}
 .ui-record-body {padding:14px}
 .ui-inline-form {gap:12px}
 .ui-inline-form label {max-width:none;min-width:140px}
 body .kpi-grid-3 {grid-template-columns:repeat(3,minmax(0,1fr))}
 body .kpi {padding:14px}
 body .kpi strong {font-size:22px}
 body .head-actions {gap:6px}
 body .gs-head-right {gap:10px}
 body .ui-menu .ui-popover {max-width:calc(100vw - 24px)}
 body[data-page="/tasks"] .tasks-topbar {flex-direction:column;align-items:stretch}
 body[data-page="/tasks"] .top-actions {justify-content:flex-start}
 .ui-collection-toolbar {flex-wrap:wrap}
 .ui-collection-toolbar label {max-width:none;flex-basis:100%}
}
@media(prefers-reduced-motion:reduce) {html {scroll-behavior:auto!important}*,*::before,*::after {transition:none!important;animation:none!important}}
@media print {
 body .topbar {position:static;background:white!important;backdrop-filter:none}
 body .topnav,body .ui-header-actions,.ui-skip,.ui-collection-toolbar,.ui-collection-pager {display:none!important}
 body .topbar .brandmark {color:#111!important}
 body {background:white!important;color:#111}
 body .container {padding:16px 0;max-width:none}
 body .panel,body .gs-kpi,body .ui-record {box-shadow:none;break-inside:avoid}
 .ui-disclosure {break-inside:auto}
 .ui-disclosure>summary {break-after:avoid}
 .ui-record[data-ui-match="true"] {display:block!important}
 .ui-record[data-ui-match="false"] {display:none!important}
}
body .ui-menu:not([open])>.ui-popover {display:none!important}

/* Override the legacy profile's fixed white text in the shared light header. */
body .topbar .account-menu>summary {color:var(--muted)!important;background:transparent!important;border-color:transparent!important}
body .topbar .account-menu>summary:hover,body .topbar .account-menu[open]>summary {color:var(--text)!important;background:var(--ui-hover)!important;border-color:transparent!important}
.ui-skip:focus:not(:focus-visible) {top:-100px}

html[data-theme] body[data-page] .topbar .brandmark {color:var(--text)!important}
body[data-page="/tasks"] .kanban-column {background:var(--surface2);border-color:var(--line);box-shadow:none}
body[data-page="/tasks"] .kanban-column>header b {background:var(--surface);color:var(--text);border-color:var(--line);box-shadow:none}
body[data-page="/tasks"] .column-empty {background:transparent;border-color:var(--line-strong);color:var(--muted)}
body[data-page="/tasks"] .search-wrap input {padding-left:38px}
body[data-page="/tasks"] .task-card:hover {transform:none;box-shadow:none;border-color:var(--line-strong)}
body[data-page="/tasks"] .task-table-wrap {border-color:var(--line);box-shadow:none;background:var(--surface)}

.ui-section-nav {display:flex;gap:4px;margin:0 0 24px;padding:0 0 12px;border-bottom:1px solid var(--line)}
.ui-section-nav a {padding:8px 13px;font-size:12px;font-weight:550;text-decoration:none;border-radius:8px;color:var(--muted)}
.ui-section-nav a[aria-current] {background:var(--surface);color:var(--text)}
.ui-more-rows>summary {padding:12px 0;color:var(--primary);font-size:12px;cursor:pointer}
body .map-btn.brand-filter.active {background:var(--primary-soft);color:var(--primary);border-color:transparent}
body .v325-page {padding:0;max-width:none}
body .v325-hero {margin:0 0 22px}
body .v325-card {box-shadow:none}

body .page-head,body .hero-row {text-align:left;align-items:flex-start}
body .an-up,body .good {color:var(--success)!important}
body .an-down,body .bad {color:var(--danger)!important}
html[data-theme] body .topnav>a.active {background:var(--ui-hover);color:var(--text)}
body .ui-menu>summary {border:0!important}

/* Keep WB signals and source captions readable in either theme. */
body .wb-action-item,body .collector-flow>div,body .wb-feature-grid>div {
 background:var(--surface2);border-color:var(--line);box-shadow:none;
}
body .wb-action-item:hover {transform:none;background:var(--ui-hover);border-color:var(--line-strong);box-shadow:none}
body .wb-live-main b,body .wb-live-source b,body .wb-action-copy b,
body .wb-product-cell b,body .collector-flow b,body .collector-note b,body .wb-feature-grid b {color:var(--text)}
body .wb-live-main small,body .wb-live-source small,body .wb-live-meta,body .wb-live-source span,
body .wb-action-copy small,body .wb-product-cell small,body .collector-flow small,body .wb-feature-grid span {color:var(--muted)}
body .collector-note {background:var(--surface2);border-color:var(--line);color:var(--muted)}

/* Stock provenance stays visible outside the WB configuration panel. */
body #v3221-wb-stock-root .v3221-card {background:var(--surface)!important;color:var(--text);box-shadow:none;border-color:var(--line)}
body #v3221-wb-stock-root .v3221-history-details {width:auto}
body #v3221-wb-stock-root .v3221-history-details summary {color:var(--text)!important;min-height:32px}
body #v3221-wb-stock-root .v3221-kicker,body #v3221-wb-stock-root .v3221-note {display:block!important}
.ui-stock-history .table-wrap {max-height:360px;overflow:auto;margin-top:16px}
.ui-stock-history td small {display:block;color:var(--muted);font-size:10px}
.ui-history-method {font-size:11px;margin:10px 0}
body .v3222-live-meta,body .v32292-wb-summary {background:var(--surface)!important;color:var(--text)!important;border-color:var(--line)!important;box-shadow:none!important}
body .v32292-wb-metric strong,body .v32292-wb-head h3 {color:var(--text)}

body .an-size-toggle {display:inline-flex;align-items:center;gap:7px;padding:6px 0;margin-top:6px;border:0;background:none;color:var(--primary);font:inherit;font-size:11px;font-weight:550;cursor:pointer}
.ui-marketplace-switch {display:flex;flex:none;gap:2px;align-items:center;padding:3px;border-radius:8px;background:var(--surface2);border:1px solid var(--line)}
.ui-marketplace-switch a {display:block;padding:5px 8px;border-radius:5px;text-decoration:none;color:var(--muted);font-size:12px;font-weight:600}
.ui-marketplace-switch a[aria-current] {background:var(--surface);color:var(--text)}
@media(max-width:760px){.ui-marketplace-switch {margin-left:auto}.ui-marketplace-switch a{font-size:11px;padding:5px 7px}}
.an-size-toggle>span:first-child {color:var(--muted)}
.an-size-toggle[aria-expanded=true]>span:last-child {transform:rotate(180deg)}
body .an-size-detail[hidden] {display:none!important}
body .an-size-detail>td {padding:0!important;background:var(--surface2)}
.an-size-panel {padding:18px 22px;border-bottom:1px solid var(--line)}
.an-size-head {display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:12px}
.an-size-head p,.an-size-note {font-size:11px;margin:4px 0;color:var(--muted)}
body .an-size-table {max-width:620px;background:var(--surface)}
body .an-size-table th,body .an-size-table td {padding:9px 14px;font-size:12px}
body .an-size-table tbody th {background:transparent;color:var(--text);font-weight:550}
body .an-size-table tfoot {font-weight:650;border-top:1px solid var(--line-strong)}
body .an-size-panel>.an-data-warning {font-size:11px;margin:10px 0}

@media(max-width:760px) {
 body #v3221-wb-stock-root .v3221-compact-main {grid-template-columns:1fr auto!important;gap:12px!important}
 body #v3221-wb-stock-root .v3221-updated {white-space:normal;text-align:left}
 .an-size-panel {padding:14px}
 .an-size-head {flex-wrap:wrap}
}

.ui-stock-history>summary::before {content:'›';font-size:18px;line-height:1;display:inline-block;transition:transform .15s}
.ui-stock-history[open]>summary::before {transform:rotate(90deg)}

/* Model cards: chart content and the economics sidebar keep their own height. */
body[data-page^="/model"] .model-dynamics-grid,
body[data-page^="/model"] .model-forecast-grid {align-items:start;min-width:0}
body[data-page^="/model"] .model-dynamics-grid>*,
body[data-page^="/model"] .model-forecast-grid>* {min-width:0;max-width:100%}
body[data-page^="/model"] .model-dynamics-grid>aside,
body[data-page^="/model"] .model-forecast-grid>aside {align-self:start;height:auto}
body[data-page^="/model"] .model-finance-kpis {grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch;gap:12px}
body[data-page^="/model"] .model-finance-kpis .kpi {min-width:0}
body[data-page^="/model"] .model-finance-kpis .kpi strong {font-size:clamp(20px,2vw,25px);overflow-wrap:anywhere}
/* The legacy accent used white text; the shared light surface needs an explicit ink color. */
body .kpi.accent-kpi {background:var(--primary-soft);color:var(--text);border-color:var(--line)}
body .kpi.accent-kpi strong {color:var(--text)}
body .kpi.accent-kpi>span,body .kpi.accent-kpi small {color:var(--muted)}
@media(max-width:760px){
 body[data-page^="/model"] .model-finance-kpis {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 body[data-page^="/model"] .model-dynamics-grid,
 body[data-page^="/model"] .model-forecast-grid {grid-template-columns:minmax(0,1fr)}
 body[data-page^="/model"] .model-finance-panel>.panel-head {flex-wrap:wrap}
}
@media(max-width:420px){body[data-page^="/model"] .model-finance-kpis {grid-template-columns:minmax(0,1fr)}}

/* Once the live chart is ready, the legacy chart slots become two small disclosures. */
body[data-page^="/model"] .model-context-grid.model-context-ready {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;margin-bottom:16px}
body[data-page^="/model"] .model-context-grid.model-context-ready>.dashboard-grid {display:contents!important}
body[data-page^="/model"] .model-context-grid.model-context-ready>.dashboard-grid>aside.model-context-panel {display:block!important;margin:0}
body[data-page^="/model"] .model-context-grid.model-context-single {grid-template-columns:minmax(0,1fr)}
body[data-page^="/model"] .model-context-panel {padding:0!important;min-width:0}
.model-context-detail>summary {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 18px;list-style:none;cursor:pointer}
.model-context-detail>summary::-webkit-details-marker {display:none}
.model-context-detail>summary b {font-size:13px;font-weight:600;color:var(--text)}
.model-context-detail>summary small {display:block;margin-top:3px;font-size:11px;font-weight:400;color:var(--muted)}
.model-context-chevron {color:var(--muted);transition:transform .15s}
.model-context-detail[open]>summary {border-bottom:1px solid var(--line)}
.model-context-detail[open] .model-context-chevron {transform:rotate(180deg)}
.model-context-detail>.metric-list {padding:0 18px 8px}
.model-context-detail>.metric-list>div {padding:9px 0;border-color:var(--line)}
.model-context-detail>.metric-list>div b {flex-shrink:0;font-variant-numeric:tabular-nums}
@media(max-width:760px){body[data-page^="/model"] .model-context-grid.model-context-ready {grid-template-columns:minmax(0,1fr);gap:10px}}

body[data-page^="/model"] .v316-kpis {grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))}

/* Seven model KPIs stay on one wide row, then form a balanced 4 + 3. */
body[data-page^="/model"] .model-kpis {grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;align-items:stretch}
body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"])) {grid-template-columns:repeat(7,minmax(0,1fr))}
body[data-page^="/model"] .model-kpis>.kpi {min-width:0;padding:16px}
body[data-page^="/model"] .model-kpis>.kpi strong {font-size:clamp(20px,1.8vw,25px);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
@media(max-width:1180px){
 body[data-page^="/model"] .model-kpis {grid-template-columns:repeat(6,minmax(0,1fr))}
 body[data-page^="/model"] .model-kpis>.kpi {grid-column:span 2}
 body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"])) {grid-template-columns:repeat(12,minmax(0,1fr))}
 body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"]))>.kpi {grid-column:span 3}
 body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"]))>.kpi:nth-child(n+5) {grid-column:span 4}
}
@media(max-width:760px){
 body[data-page^="/model"] .model-kpis,body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"])) {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 body[data-page^="/model"] .model-kpis>.kpi,body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"]))>.kpi:nth-child(n) {grid-column:auto;padding:14px}
 body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"]))>.kpi:last-child {grid-column:1/-1}
}
@media(max-width:420px){body[data-page^="/model"] .model-kpis,body[data-page^="/model"] .model-kpis:has(>.kpi:nth-child(7):not([hidden]):not([style*="display: none"])) {grid-template-columns:minmax(0,1fr)}}
