:root {
  color-scheme: light;
  --font-sans: Inter, Geist, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --brand-900: #06344c;
  --brand-800: #064a69;
  --brand-700: #07587d;
  --brand-600: #146b91;
  --slate-950: #111923;
  --slate-800: #263241;
  --slate-700: #435064;
  --slate-600: #647186;
  --slate-500: #8591a2;
  --slate-300: #cdd4de;
  --slate-200: #dfe4eb;
  --slate-100: #edf0f4;
  --slate-50: #f6f8fa;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #e9edf2;
  --surface-soft: #f8f9fb;
  --text: #172231;
  --text-soft: #455266;
  --muted: #6d798b;
  --hairline: #dce2e9;
  --hairline-strong: #c8d0da;
  --accent: var(--brand-700);
  --accent-hover: var(--brand-800);
  --accent-soft: #e9f1f5;
  --button-text: #ffffff;
  --shadow-card: 0 1px 2px rgba(18, 28, 42, 0.05), 0 3px 8px rgba(18, 28, 42, 0.035);
  --shadow-float: 0 10px 30px rgba(18, 28, 42, 0.12);
  --radius-sm: 6px;
  --radius-md: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --stage-triage: #8491a2;
  --stage-negotiation: #8f7e5a;
  --stage-analysis: #77728f;
  --stage-committee: #5f7f8e;
  --stage-contracting: #627b66;
  --stage-monitoring: #497282;
  --stage-exit: #806f78;
  --status-good: #3d775c;
  --status-danger: #ad4c53;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e141c;
  --surface: #171e28;
  --surface-muted: #111923;
  --surface-soft: #1c2531;
  --text: #eef2f6;
  --text-soft: #c0c8d3;
  --muted: #8f9bab;
  --hairline: #293441;
  --hairline-strong: #354252;
  --accent: #6f9fb8;
  --accent-hover: #86afc4;
  --accent-soft: #172c38;
  --button-text: #081118;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-float: 0 16px 40px rgba(0, 0, 0, 0.34);
  --stage-triage: #758396;
  --stage-negotiation: #a89266;
  --stage-analysis: #918bad;
  --stage-committee: #7397a8;
  --stage-contracting: #729177;
  --stage-monitoring: #6290a1;
  --stage-exit: #947f89;
}

* { box-sizing: border-box; }
html { font-family: var(--font-sans); background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  gap: var(--space-6);
  padding: 0 var(--space-8);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; width: max-content; }
.brand__mark { width: 34px; height: 34px; overflow: visible; }
.brand__mark circle:first-child { fill: none; stroke: var(--accent); stroke-width: 2; }
.brand__node { fill: var(--accent); stroke: none; }
.brand__wordmark { color: var(--accent); font-size: 13px; font-weight: 760; letter-spacing: 0.18em; }
.brand__divider { height: 20px; width: 1px; background: var(--hairline-strong); margin-left: 2px; }
.brand__product { font-size: 14px; color: var(--muted); font-weight: 450; white-space: nowrap; }

.desktop-nav { height: 64px; display: flex; align-items: stretch; gap: var(--space-6); }
.desktop-nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 13px; font-weight: 560; white-space: nowrap; }
.desktop-nav a:hover { color: var(--text); }
.desktop-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.desktop-nav a.is-active { color: var(--text); }
.desktop-nav a.is-active::after { background: var(--accent); }

.topbar__actions { justify-self: end; display: flex; align-items: center; gap: var(--space-2); }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--surface-muted); color: var(--text); }
.icon--moon { display: none; }
html[data-theme="dark"] .icon--sun { display: none; }
html[data-theme="dark"] .icon--moon { display: block; }
.user-menu { display: flex; align-items: center; gap: var(--space-2); padding: 4px 6px 4px 4px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; text-align: left; }
.user-menu:hover { background: var(--surface-muted); }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 720; font-size: 11px; letter-spacing: .04em; }
.user-menu__copy { display: grid; gap: 1px; }
.user-menu__copy strong { font-size: 12px; font-weight: 620; }
.user-menu__copy small { color: var(--muted); font-size: 10px; }
.icon--chevron { width: 14px; height: 14px; }
.mobile-menu-button { display: none; }

.study-banner { min-height: 32px; padding: 0 var(--space-8); display: flex; align-items: center; justify-content: center; gap: var(--space-3); background: var(--accent-soft); color: var(--text-soft); border-bottom: 1px solid var(--hairline); font-size: 11px; }
.study-banner span { color: var(--accent); font-weight: 690; letter-spacing: .04em; text-transform: uppercase; }
.study-banner small { font-size: inherit; color: var(--muted); }

main { max-width: 1720px; margin: 0 auto; padding: var(--space-8); }
main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.page-head__title { display: grid; gap: var(--space-1); }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 680; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.025em; font-weight: 660; }
.page-head__meta { display: flex; align-items: center; gap: var(--space-4); }
.page-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.button { min-height: 36px; border: 0; border-radius: var(--radius-sm); padding: 0 var(--space-4); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font-weight: 620; cursor: pointer; }
.button--primary { background: var(--accent); color: var(--button-text); }
.button--primary:hover { background: var(--accent-hover); }
.button--secondary { background: var(--surface-muted); color: var(--text); }
.button--ghost { background: transparent; color: var(--accent); }
.button--small { min-height: 30px; padding-inline: var(--space-3); font-size: 12px; }
.button .icon { width: 16px; height: 16px; }

.filter-bar { display: grid; grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(145px, .75fr)) auto; align-items: end; gap: var(--space-5); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-muted); margin-bottom: var(--space-6); }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.field-control { min-height: 36px; display: flex; align-items: center; gap: var(--space-2); border-bottom: 1px solid var(--hairline-strong); }
.field-control:focus-within { border-color: var(--accent); }
.field-control .icon { width: 16px; color: var(--muted); flex: 0 0 auto; }
.field input, .field select { width: 100%; border: 0; outline: 0; background: transparent; min-width: 0; padding: 6px 0; }
.filter-clear { align-self: center; margin-top: 14px; border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: var(--space-2); font-size: 12px; }
.mobile-filter-trigger { display: none; }

.kanban-wrap { overflow-x: auto; padding-bottom: var(--space-5); scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }
.kanban { min-width: 1660px; display: grid; grid-template-columns: repeat(7, minmax(224px, 1fr)); gap: var(--space-3); }
.kanban-column { min-height: 570px; background: var(--surface-muted); border-radius: var(--radius-md); padding: var(--space-3); }
.column-head { position: relative; padding: var(--space-1) var(--space-1) var(--space-3); margin-bottom: var(--space-2); border-bottom: 1px solid var(--hairline); }
.column-head::before { content: ""; position: absolute; left: 4px; top: -12px; width: 28px; height: 2px; background: var(--stage-color, var(--stage-triage)); border-radius: 1px; }
.column-title-row { min-height: 24px; display: flex; align-items: center; gap: var(--space-2); }
.column-title-row h2 { margin: 0; font-size: 13px; line-height: 1.25; font-weight: 650; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 690; font-variant-numeric: tabular-nums; }
.column-totals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-2); }
.column-total { display: grid; gap: 2px; }
.column-total span { color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.column-total strong { font-size: 11px; font-weight: 580; font-variant-numeric: tabular-nums; }
.card-list { display: grid; gap: var(--space-2); }
.asset-card { min-width: 0; overflow: hidden; padding: var(--space-3); background: var(--surface); border: 1px solid color-mix(in srgb, var(--hairline) 72%, transparent); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.asset-card__code { margin-bottom: 5px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .025em; }
.asset-card h3 { margin-bottom: var(--space-3); overflow-wrap: anywhere; font-size: 13px; line-height: 1.3; font-weight: 650; }
.asset-values { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-3); }
.asset-value { display: grid; gap: 2px; }
.asset-value:nth-child(2) { justify-items: end; text-align: right; }
.asset-value span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .045em; }
.asset-value strong { font-size: 12px; font-weight: 660; font-variant-numeric: tabular-nums; }
.asset-meta { margin: 0 0 var(--space-3); overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.asset-actions { display: flex; align-items: center; justify-content: space-between; padding-top: var(--space-2); border-top: 1px solid var(--hairline); }
.icon-link { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); border-radius: var(--radius-sm); }
.icon-link:hover { color: var(--accent); background: var(--accent-soft); }
.empty-state { min-height: 144px; display: grid; place-items: center; color: color-mix(in srgb, var(--muted) 58%, transparent); font-size: 11px; }

.content-panel { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.content-toolbar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--hairline); }
.inline-search { min-width: 280px; display: flex; align-items: center; gap: var(--space-2); color: var(--muted); }
.inline-search input { width: 100%; background: transparent; border: 0; outline: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 12px 16px; text-align: left; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; font-weight: 560; background: var(--surface-soft); }
.data-table td { padding: 14px 16px; border-top: 1px solid var(--hairline); vertical-align: middle; }
.data-table code { font-family: var(--font-mono); color: var(--muted); font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status--good::before { background: var(--status-good); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.metric { min-height: 116px; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-card); }
.metric span { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.metric strong { display: block; margin-top: var(--space-3); font-size: 25px; letter-spacing: -.03em; font-weight: 610; font-variant-numeric: tabular-nums; }
.metric small { display: block; margin-top: var(--space-1); color: var(--muted); }
.fund-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.fund-card { padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-card); }
.fund-card header { display: flex; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-6); }
.fund-card h2 { margin: 0; font-size: 15px; font-weight: 650; }
.fund-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: 0; }
.fund-card dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.fund-card dd { margin: 4px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }

.feedback-dot { position: fixed; right: 22px; bottom: 22px; z-index: 28; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #626c7b; color: #fff; box-shadow: var(--shadow-float); cursor: pointer; font-size: 16px; }
.feedback-dot:hover { background: #4f5865; }
.mobile-tabbar, .mobile-drawer, .drawer-scrim { display: none; }

.filter-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius-md); background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); }
.filter-dialog::backdrop { background: rgba(8, 15, 24, .5); }
.filter-dialog form > header, .filter-dialog form > footer { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); border-bottom: 1px solid var(--hairline); }
.filter-dialog form > header h2 { margin: 2px 0 0; font-size: 18px; }
.filter-dialog__body { display: grid; gap: var(--space-4); padding: var(--space-4); }
.filter-dialog__body label { display: grid; gap: 6px; }
.filter-dialog__body label span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.filter-dialog__body input, .filter-dialog__body select { width: 100%; min-height: 40px; padding: 0 var(--space-3); border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--surface-soft); }
.filter-dialog form > footer { justify-content: flex-end; border: 0; border-top: 1px solid var(--hairline); }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr auto; }
  .desktop-nav { display: none; }
  .mobile-menu-button { display: inline-grid; }
  .filter-bar { grid-template-columns: minmax(200px, 1.2fr) repeat(2, minmax(140px, .8fr)) auto; }
  .filter-bar .field:nth-of-type(4), .filter-bar .field:nth-of-type(5) { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 13px; padding-bottom: 68px; }
  .topbar { min-height: 56px; grid-template-columns: 1fr auto; padding: 0 var(--space-4); gap: var(--space-2); }
  .brand { gap: var(--space-2); }
  .brand__mark { width: 30px; height: 30px; }
  .brand__wordmark, .brand__divider { display: none; }
  .brand__product { color: var(--text); font-size: 14px; font-weight: 600; }
  .topbar__actions > .icon-button:first-child, .user-menu { display: none; }
  .study-banner { min-height: 28px; padding: 0 var(--space-3); justify-content: flex-start; overflow: hidden; white-space: nowrap; }
  .study-banner small { overflow: hidden; text-overflow: ellipsis; }
  main { padding: var(--space-5) var(--space-4); }
  .page-head { align-items: flex-start; margin-bottom: var(--space-4); }
  h1 { font-size: 21px; }
  .page-head__meta { flex-direction: column-reverse; align-items: flex-end; gap: var(--space-2); }
  .page-count { font-size: 11px; }
  .page-head .button--primary { min-height: 34px; padding-inline: var(--space-3); font-size: 12px; }
  .filter-bar { display: none; }
  .mobile-filter-trigger { width: 100%; min-height: 44px; margin-bottom: var(--space-4); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: var(--surface-muted); cursor: pointer; }
  .mobile-filter-trigger > span { display: flex; align-items: center; gap: var(--space-2); }
  .mobile-filter-trigger small { color: var(--muted); }
  .kanban-wrap { margin-right: calc(var(--space-4) * -1); }
  .kanban { min-width: max-content; grid-template-columns: repeat(7, 276px); padding-right: var(--space-4); }
  .kanban-column { min-height: 494px; }
  .mobile-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 32; height: 62px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--hairline); backdrop-filter: blur(14px); }
  .mobile-tabbar a, .mobile-tabbar button { display: grid; place-items: center; align-content: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
  .mobile-tabbar .icon { width: 18px; height: 18px; }
  .mobile-tabbar .is-active { color: var(--accent); }
  .feedback-dot { right: 14px; bottom: 76px; width: 36px; height: 36px; }
  .mobile-drawer { position: fixed; inset: 0 0 0 auto; z-index: 51; width: min(320px, 86vw); padding: var(--space-5); display: block; background: var(--surface); transform: translateX(102%); transition: transform .2s ease; box-shadow: var(--shadow-float); }
  .mobile-drawer.is-open { transform: translateX(0); }
  .drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
  .mobile-drawer nav { display: grid; gap: var(--space-1); }
  .mobile-drawer nav a { padding: 12px; border-radius: var(--radius-sm); font-weight: 560; }
  .mobile-drawer nav a.is-active { background: var(--accent-soft); color: var(--accent); }
  .drawer__theme { width: 100%; margin-top: var(--space-8); padding: 12px; border: 0; border-radius: var(--radius-sm); background: var(--surface-muted); text-align: left; cursor: pointer; }
  .drawer-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(8, 15, 24, .48); }
  .drawer-scrim.is-open { display: block; }
  .content-panel { overflow-x: auto; }
  .content-toolbar { align-items: flex-start; }
  .inline-search { min-width: 0; }
  .data-table { min-width: 720px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .fund-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
