/* Personal colour palettes: all themes retain light surfaces and semantic status colours. */
:root, [data-palette="forest"] {
  color-scheme: light;
  --bg:#f4f6f3; --paper:#ffffff; --ink:#1c352a; --muted:#5f6f65;
  --line:#dee6df; --green:#245b43; --lime:#cbed8a; --soft:#edf3e9;
  --sidebar:#162f25; --sidebar-muted:#baccc0; --featured:#244b36;
  --featured-text:#f7fbf6; --primary-text:#233d25; --focus:#4d8c60;
  --chart-plan:#c1d6a1; --chart-fact:#2e6245;
}
:root[data-theme="blue"], [data-palette="blue"] {
  --bg:#f2f5fa; --paper:#ffffff; --ink:#20324c; --muted:#5d6e87;
  --line:#dbe3ef; --green:#315d97; --lime:#d2e2ff; --soft:#edf3fc;
  --sidebar:#172d4a; --sidebar-muted:#bdcce0; --featured:#254e7d;
  --featured-text:#f7faff; --primary-text:#233f66; --focus:#4575b5;
  --chart-plan:#aec8ea; --chart-fact:#315d97;
}
:root[data-theme="violet"], [data-palette="violet"] {
  --bg:#f6f3f9; --paper:#ffffff; --ink:#39294b; --muted:#72637c;
  --line:#e6dced; --green:#73508f; --lime:#e8d8fa; --soft:#f3ecf9;
  --sidebar:#30223f; --sidebar-muted:#d1bfdc; --featured:#62417f;
  --featured-text:#fcf8ff; --primary-text:#503366; --focus:#8b62ad;
  --chart-plan:#d4bae9; --chart-fact:#73508f;
}
:root[data-theme="sand"], [data-palette="sand"] {
  --bg:#f8f5ef; --paper:#ffffff; --ink:#46372a; --muted:#75695a;
  --line:#e8dfd2; --green:#80602e; --lime:#efdfbe; --soft:#f6f0e6;
  --sidebar:#382c20; --sidebar-muted:#dacbb8; --featured:#715332;
  --featured-text:#fffbf4; --primary-text:#513b21; --focus:#9c773c;
  --chart-plan:#dfcba7; --chart-fact:#80602e;
}
:root[data-theme="graphite"], [data-palette="graphite"] {
  --bg:#f3f5f8; --paper:#ffffff; --ink:#2d3543; --muted:#616c7c;
  --line:#dfe4ec; --green:#47536a; --lime:#d9e0ec; --soft:#edf0f5;
  --sidebar:#202832; --sidebar-muted:#c3cbd7; --featured:#3b475b;
  --featured-text:#fafcff; --primary-text:#303c51; --focus:#677995;
  --chart-plan:#c0cadb; --chart-fact:#47536a;
}
html { scrollbar-gutter:stable; }
@supports not(scrollbar-gutter:stable) { html { overflow-y:scroll; } }
body { background:var(--bg); color:var(--ink); }
#toast { background:var(--featured); color:var(--featured-text); box-shadow:0 4px 25px color-mix(in srgb,var(--sidebar) 18%,transparent); }
:focus-visible { outline-color:var(--focus); }
input:focus, select:focus, textarea:focus { outline-color:var(--focus); }
.sidebar { background:var(--sidebar); }
.sidebar .nav-label, .sidebar .workspace small, .sidebar .sidebar-local { color:var(--sidebar-muted); }
.sidebar .sidebar-logout { color:var(--sidebar-muted) !important; }
.workspace-avatar { background:color-mix(in srgb,var(--lime) 15%,transparent); color:var(--lime); }
.nav button .attention-count { background:var(--lime); color:var(--primary-text); }
.topbar, .modal, .modal-footer, .panel, .kpi, .discipline-card, .source-card, .program-login-card { background:var(--paper); }
.topbar { position:sticky;top:0;border-bottom-color:var(--line);display:grid;grid-template-columns:240px minmax(38px,1fr) auto;align-items:center;gap:16px; }
.topbar .breadcrumb { min-width:0;width:100%; }
.breadcrumb-home, .crumb-divider { flex-shrink:0; }
.breadcrumb strong { color:var(--ink);min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;max-width:100%; }
.topbar .global-search-trigger { width:100%;min-width:0;max-width:365px;justify-self:start; }
.global-search-trigger span { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.topbar .local-chip { flex:0 0 140px;width:140px;white-space:nowrap;overflow:hidden; }
.breadcrumb-home, .eyebrow, .cash-data-scope { color:var(--muted); }
.global-search-trigger, kbd { background:var(--soft); color:var(--muted); border-color:var(--line); }
.global-search-trigger:hover { border-color:var(--green); }
.btn.primary { color:var(--primary-text); background:var(--lime); border-color:var(--lime); }
.btn.primary:hover:not(:disabled) { background:color-mix(in srgb,var(--lime) 88%,var(--green)); border-color:var(--lime); }
.btn.dark { color:var(--featured-text); background:var(--featured); border-color:var(--featured); }
.btn.dark:hover:not(:disabled) { background:var(--green); }
.btn.soft, .icon-btn:hover { background:var(--soft); color:var(--green); border-color:var(--line); }
.btn:hover:not(.primary):not(.dark):not(.danger):not(:disabled) { background:var(--soft); border-color:var(--line); }
.link-button { color:var(--green); }
.link-button:hover { color:var(--green); }
input[type=checkbox], input[type=radio] { accent-color:var(--green); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), .select, select, textarea { background:var(--paper); color:var(--ink); border-color:var(--line); }
.field label, label.field, .field > span, .control-field > span, input::placeholder, textarea::placeholder { color:var(--muted); }
.password-control button { color:var(--green); }
.password-control button:hover { background:var(--soft); }
.kpi.featured, .fee-card.general { background:var(--featured); color:var(--featured-text); border-color:var(--featured); }
.kpi.featured .kpi-label, .kpi.featured .kpi-foot, .kpi.featured .currency, .general .fee-top, .general .fee-footer, .general .fee-value > span { color:var(--featured-text); }
.kpi.featured .kpi-label svg, .kpi.featured .kpi-foot .green { color:inherit; }
.general .fee-top b { color:var(--lime); }
.contract-budget, .fee-card.agency, .contract-share-line, .discipline-icon, .budget-source-details summary, .expense-navigation, .inline-help, .source-quote { background:var(--soft); border-color:var(--line); }
.fee-card.agency .fee-top, .fee-card.agency .fee-footer, .contract-share-line strong, .discipline-icon { color:var(--green); }
.contract-share-line, .budget-note, .budget-source-note, .discipline-code, .discipline-footer { color:var(--muted); }
.expense-navigation button { color:var(--muted); }
.expense-navigation button.active { color:var(--green); background:var(--paper); }
.discipline-card.not-priced, .discipline-card.bundled { background:color-mix(in srgb,var(--soft) 55%,var(--paper)); }
.legend i, .swatch { background:var(--chart-fact); }
.legend i.pale, .swatch.light { background:var(--chart-plan); }
.ring-inner { background:var(--paper); }
.tabs button.active, .period-presets .btn.active, .bank-tabs button.active { color:var(--green); background:var(--soft); border-color:var(--line); }
.table thead th { color:var(--muted); background:color-mix(in srgb,var(--soft) 65%,var(--paper)); }
.table tbody tr:hover, .similar-source, .command-result-icon, .guide-grid > button { background:var(--soft); }
.program-login { background:radial-gradient(ellipse at top left,var(--soft),transparent 60%),var(--bg); }
.program-login-brand { color:var(--green); }
.program-login p { color:var(--muted); }
.program-login-card { border-color:var(--line); box-shadow:0 24px 70px color-mix(in srgb,var(--sidebar) 5%,transparent); }
.program-login :focus-visible { outline-color:var(--focus); }
.program-login input { color:var(--ink); caret-color:var(--ink); }
:root[data-theme] .program-login input:focus { border-color:var(--focus); outline:2px solid var(--focus); outline-offset:2px; }
.program-login input:is(:autofill, :-webkit-autofill) { -webkit-text-fill-color:var(--ink); caret-color:var(--ink); -webkit-box-shadow:0 0 0 1000px var(--soft) inset; box-shadow:0 0 0 1000px var(--soft) inset; }
.mobile-bottom-nav { background:var(--paper); border-color:var(--line); }
.mobile-bottom-nav button { color:var(--muted); }
.mobile-bottom-nav button[aria-current=page], .mobile-bottom-nav button:hover { background:var(--soft); color:var(--green); }

/* The current verified identity remains visible beside the personal theme control. */
.topbar-actions { flex-shrink:0; gap:10px; }
.header-user { display:flex;align-items:center;gap:9px;width:200px;min-width:200px;max-width:200px;padding:2px 0; }
.header-user-avatar { display:grid;place-items:center;flex-shrink:0;width:35px;height:35px;border:1px solid var(--line);border-radius:50%;background:var(--soft);color:var(--green);font-size:13px;font-weight:700; }
.header-user-copy { display:block;min-width:0; }
.header-user-copy strong { display:block;font-size:12px;font-weight:650;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.header-user-copy > span { display:block;font-size:10px;line-height:1.5;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.appearance-trigger { white-space:nowrap; }
.appearance-user { color:var(--muted);font-size:13px;margin-bottom:18px; }
.appearance-options { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:20px; }
.appearance-option { position:relative;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--paper);color:var(--ink);text-align:left;min-width:0; }
.appearance-option:hover { border-color:var(--green); }
.appearance-option[aria-pressed=true] { border-color:var(--green);box-shadow:0 0 0 1px var(--green); }
.appearance-preview { position:relative;display:block;height:75px;margin-bottom:13px;border:1px solid var(--line);border-radius:7px;background:var(--bg);overflow:hidden; }
.appearance-preview i { position:absolute;display:block;border-radius:4px; }
.appearance-preview-nav { left:0;top:0;bottom:0;width:22%;background:var(--sidebar);border-radius:0 !important; }
.appearance-preview-card { top:15px;left:30%;right:10%;height:22px;background:var(--featured); }
.appearance-preview-action { top:47px;left:30%;width:31%;height:12px;background:var(--lime); }
.appearance-option-copy strong { display:block;font-size:13px;font-weight:600;padding-right:20px; }
.appearance-option-copy small { display:block;font-size:11px;color:var(--muted);margin-top:5px;line-height:1.5; }
.appearance-selected { position:absolute;right:10px;bottom:36px;display:none;color:var(--green); }
.appearance-option[aria-pressed=true] .appearance-selected { display:block; }
@media(max-width:1700px) { .topbar .local-chip { display:none; } .global-search-trigger kbd { display:none; } }
@media(max-width:1390px) {
 .topbar { grid-template-columns:180px minmax(38px,1fr) auto;gap:12px; }
 .header-user { width:170px;max-width:170px;min-width:170px; }
 .appearance-trigger { width:42px;min-width:42px;padding:10px;font-size:0;gap:0;justify-content:center; }
 .appearance-trigger svg { width:18px;height:18px; }
 .global-search-trigger { max-width:240px;min-width:38px; }
}
@media(max-width:1100px) { .topbar { grid-template-columns:minmax(0,1fr) 38px auto; } .topbar .global-search-trigger { width:38px; } .global-search-trigger { flex:0 0 38px;padding:9px;justify-content:center; } .global-search-trigger span { display:none; } .header-user { width:160px;min-width:160px;max-width:160px; } }
@media(max-width:800px) {
 html { scroll-padding-top:130px; }
 .topbar { grid-template-columns:minmax(0,1fr) 38px;grid-template-rows:34px 39px;height:98px;min-height:98px;padding:9px 14px;gap:7px; }
 .topbar .breadcrumb { grid-column:1;grid-row:1;min-width:0; }
 .topbar .breadcrumb strong { max-width:calc(100vw - 120px);font-size:12px; }
 .topbar .global-search-trigger { grid-column:2;grid-row:1;margin:0;width:38px;height:34px;min-height:34px; }
 .topbar-actions { grid-column:1/-1;grid-row:2;width:100%;gap:8px; }
 .header-user { flex:1;width:auto;min-width:0;max-width:none;margin-right:auto; }
 .header-user-avatar { width:31px;height:31px;font-size:12px; }
 .header-user-copy strong { font-size:12px; }
 .header-user-copy > span { font-size:10px; }
 .topbar-actions > [data-action=upload], .topbar-actions > .program-logout, .topbar-actions > .appearance-trigger { display:inline-flex !important;justify-content:center;gap:0;width:38px;min-width:38px;height:38px;min-height:38px;padding:9px;font-size:0; }
 .topbar-actions > .btn svg { width:18px;height:18px; }
 .appearance-options { gap:10px; }
}
@media(max-width:400px) { .appearance-options { grid-template-columns:1fr; } .appearance-preview { height:57px; } .appearance-preview-card { top:10px;height:18px; } .appearance-preview-action { top:36px;height:11px; } }
