@font-face {
  font-family: 'DM Sans';
  src: url('../assets/fonts/DM-Sans-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #243b3b;
  --muted: #657d7d;
  --line: #e1e9e7;
  --green: #18765b;
  --green-2: #e9f5ed;
  --green-3: #77b89a;
  --soft: #f4f7f6;
  --shadow: 0 5px 25px rgba(27, 59, 51, .035);
  --sidebar-width: 288px;
  --font-ui: 'DM Sans', 'Segoe UI', Arial, sans-serif;
}

body {
  font-family: var(--font-ui);
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.55;
  background: var(--soft);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: var(--font-ui); }
button { line-height: 1.4; }
input, select, textarea { font-size: 15px; }
button:focus-visible { outline: 3px solid #68b7a0; outline-offset: 3px; }
::selection { background: #d6edcf; color: #194b3b; }

/* The navigation stays visible while the workspace scrolls. */
.app-shell { background: var(--soft); align-items: flex-start; }
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px 17px 18px;
  background: linear-gradient(165deg, #123c3c 0%, #123e3a 52%, #194e42 100%);
  border-right: 1px solid #214a46;
  color: #e6efea;
  box-shadow: 5px 0 24px rgba(23, 53, 45, .04);
  z-index: 35;
}

.brand-lockup { gap: 13px; padding: 0 10px 26px; align-items: center; }
.brand-mark { width: 44px; height: 44px; font-size: 17px; border-radius: 13px; letter-spacing: -.06em; flex-shrink: 0; }
.sidebar .brand-mark {
  background: #d4f3bf;
  color: #234b3b;
  box-shadow: 0 4px 15px rgba(3, 25, 20, .12);
  font-weight: 800;
}
.brand-lockup strong { font-size: 21px; font-weight: 700; letter-spacing: -.035em; color: #f5faf6; line-height: 1.25; }
.brand-lockup .brand-copy > span { font-size: 14px; font-weight: 450; color: #bad1c7; margin-top: 3px; letter-spacing: .01em; }
.org-switcher {
  border: 1px solid rgba(214, 240, 223, .12);
  background: rgba(255, 255, 255, .05);
  border-radius: 12px;
  padding: 13px 11px;
  margin: 0 4px 25px;
  gap: 10px;
}
.org-avatar { width: 34px; height: 36px; border-radius: 9px; background: rgba(198, 232, 197, .1); color: #c6e3ba; flex-shrink: 0; }
.org-avatar .nav-icon { width: 22px; height: 22px; }
.org-switcher strong { font-size: 13px; font-weight: 600; color: #e6eee9; white-space: normal; }
.org-switcher .workspace-copy > span { color: #9fbeb0; font-size: 12px; display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.workspace-dot { width: 5px; height: 5px; background: #bce5a7; border-radius: 50%; }
.side-nav { min-height: 0; width: 100%; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #43675c transparent; }
.nav-section { margin-bottom: 23px; }
.nav-section > p { font-size: 11px; font-weight: 600; color: #90b3a4; letter-spacing: .13em; margin: 0 15px 10px; }
.nav-link {
  min-height: 44px;
  border: 1px solid transparent;
  gap: 12px;
  padding: 6px 12px;
  margin: 2px 0;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 500;
  color: #d0e0d7;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-link:hover { color: #fff; background: rgba(244, 255, 246, .07); }
.nav-link.active { background: #d6f3c2; color: #224936; font-weight: 650; box-shadow: 0 4px 12px rgba(7, 33, 25, .1); }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 22px; height: 22px; color: currentColor; }
.nav-link > .nav-icon { width: 28px; height: 28px; border-radius: 8px; color: var(--nav-color, #b6d5c4); background: color-mix(in srgb, var(--nav-color, #b6d5c4) 11%, transparent); }
.nav-link.active > .nav-icon { background: rgba(39, 89, 52, .09); color: #275f42; }
.nav-label { flex: 1; white-space: nowrap; }
.sidebar-bottom { padding: 4px 5px 0; width: 100%; }
.import-link { font-size: 13px; color: #b0cabe; padding: 10px 7px 16px; gap: 10px; }
.import-link .import-label { font-size: 13px; }
.import-link:hover { color: #d6f3c2; }
.profile { border-top: 1px solid rgba(214, 240, 223, .14); padding: 17px 5px 5px; gap: 11px; }
.profile-avatar { width: 37px; height: 37px; border-radius: 11px; background: #cbe3df; color: #204b47; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.profile-copy { flex: 1; }
.profile strong { color: #eef6f0; font-size: 15px; font-weight: 600; }
.profile span { color: #a9c3b5; font-size: 12px; margin-top: 1px; }
.profile .profile-online { width: 7px; height: 7px; border-radius: 50%; background: #b8dfa1; box-shadow: 0 0 0 4px rgba(184,223,161,.07); margin-right: 6px; }
.logout-button { color: #bbd2c5; background: transparent; border-color: rgba(214,240,223,.15); min-height: 39px; font-size: 13px; border-radius: 8px; margin-top: 13px; }
.logout-button .nav-icon { width: 18px; }
.logout-button:hover { background: rgba(240,255,245,.07); color: #e6f5e6; }
.sidebar-overlay, .menu-toggle { display: none; }

/* Workspace typography and controls. */
.main-shell { align-self: stretch; }
.topbar { min-height: 80px; padding: 0 30px; background: rgba(255,255,255,.95); gap: 18px; }
.topbar-location { display: flex; align-items: center; gap: 13px; min-width: 0; }
.breadcrumbs { font-size: 14px; gap: 11px; color: #738985; min-width: 0; }
.breadcrumbs > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs strong { font-weight: 600; color: #304a46; }
.topbar-actions { gap: 11px; }
.search-box { width: 249px; height: 42px; border-radius: 10px; padding: 0 11px; gap: 8px; background: #f9fbfa; }
.search-box > .nav-icon { width: 17px; height: 17px; }
.search-box input { font-size: 13px; }
.search-box kbd { font-size: 10px; }
.theme-button, .notification-button { height: 38px; width: 33px; display: inline-flex; align-items: center; justify-content: center; }
.content-scroll { max-width: 1680px; padding: 31px 30px 45px; }
.page-header { gap: 22px; margin-bottom: 25px; }
.eyebrow { font-size: 11px; color: #458071; letter-spacing: .11em; font-weight: 650; margin-bottom: 9px; }
.page-header h1 { font-size: 34px; font-weight: 650; line-height: 1.2; letter-spacing: -.045em; }
.page-header p { font-size: 14px; line-height: 1.6; margin-top: 9px; }
.page-header-action, .button-row { gap: 10px; flex-shrink: 0; }
.primary-button, .secondary-button { font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 17px; border-radius: 9px; white-space: nowrap; }
.primary-button { box-shadow: 0 4px 12px rgba(24,118,91,.12); }
.primary-button.compact { min-height: 42px; font-size: 13px; padding: 0 15px; }
.text-button { font-size: 13px; font-weight: 600; padding: 0; min-height: 24px; background: transparent; white-space: nowrap; }
.text-button span { font-size: 20px; }
.wide-action { min-height: 43px; font-size: 13px; font-weight: 600; margin-top: 16px; }
.loading-line { height: auto; font-size: 14px; padding: 12px 0; }
.connection-banner { flex-wrap: wrap; }
.connection-banner p, .connection-banner button { font-size: 14px; }

.metric-grid { gap: 16px; margin-bottom: 22px; }
.metric-card { border-radius: 14px; padding: 20px; min-height: 150px; box-shadow: var(--shadow); }
.metric-top { font-size: 11px; font-weight: 650; letter-spacing: .06em; gap: 5px; color: #758883; }
.metric-top b { width: 29px; height: 29px; border-radius: 9px; font-size: 16px; flex-shrink: 0; }
.metric-card.green .metric-top b { color: #237753; background: #eaf5ec; }
.metric-card.blue .metric-top b { color: #3a73b1; background: #edf4fc; }
.metric-card.amber .metric-top b { color: #b17a29; background: #fdf2df; }
.metric-card.purple .metric-top b { color: #8462af; background: #f3edfc; }
.metric-card > strong { font-size: clamp(23px, 1.9vw, 30px); font-weight: 650; letter-spacing: -.05em; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
.metric-card > small { font-size: 12px; line-height: 1.5; color: #7b8c83; }
.metric-card::after { opacity: .09; }
.metric-spark { opacity: .18; }
.dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(330px, 1fr); grid-template-areas: 'activity control' 'health quick'; gap: 20px; align-items: stretch; }
.activity-panel { grid-area: activity; grid-row: auto; }
.activity-panel table { min-width: 600px; }
.compliance-panel { grid-area: control; min-height: 0; }
.projects-panel { grid-area: health; }
.quick-panel { grid-area: quick; }
.panel { border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 21px 22px 18px; gap: 13px; }
.panel-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.panel-head p { font-size: 13px; line-height: 1.6; margin-top: 5px; }
table { min-width: 740px; }
th { font-size: 11px; color: #7b8b82; font-weight: 650; letter-spacing: .065em; padding: 13px 19px; background: #f9fbfa; }
td { font-size: 14px; line-height: 1.5; padding: 15px 19px; color: #5e746c; }
td strong { font-size: 14px; font-weight: 600; }
td small { font-size: 12px; color: #809189; max-width: 280px; margin-top: 4px; line-height: 1.5; }
.mono { font-family: var(--font-ui); font-size: 13px; letter-spacing: .015em; font-variant-numeric: tabular-nums; }
.money { font-weight: 600; }
.status-pill, .status-badge { font-size: 11px; font-weight: 600; padding: 5px 9px; }
.control-list { padding: 0 22px; }
.control-row { gap: 11px; padding: 15px 0; }
.control-icon { width: 33px; height: 33px; border-radius: 10px; font-size: 15px; flex-shrink: 0; }
.control-row strong { font-size: 14px; font-weight: 550; }
.control-row small { font-size: 12px; line-height: 1.5; color: #7b8c82; }
.control-row > b { font-size: 23px; font-weight: 600; }
.project-health-list { padding: 0 22px 22px; }
.project-health { padding-bottom: 21px; }
.project-health + .project-health { padding-top: 18px; }
.project-health-head strong, .report-project-head strong { font-size: 15px; font-weight: 600; line-height: 1.5; }
.project-health-head small, .report-project-head small { font-size: 12px; margin-top: 4px; }
.project-health-head > b { font-size: 14px; font-weight: 600; }
.project-health-foot { font-size: 12px; gap: 12px; margin-top: 9px; flex-wrap: wrap; }
.progress-track { height: 7px; margin-top: 13px; }
.quick-actions { grid-template-columns: 1fr; padding: 0 22px 22px; gap: 9px; }
.quick-actions button { padding: 12px; gap: 12px; background: #fcfdfc; border-radius: 10px; }
.quick-actions strong { font-size: 14px; font-weight: 550; }
.quick-actions small { font-size: 12px; margin-top: 4px; line-height: 1.5; }
.quick-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; flex-shrink: 0; }
.quick-actions button > b { font-size: 21px; font-weight: 400; }

/* Keep secondary screens as readable as the dashboard. */
.summary-strip, .account-summary, .ledger-summary { gap: 16px; margin-bottom: 22px; }
.summary-strip > div, .ledger-summary > div, .account-type-card { padding: 18px; border-radius: 12px; }
.summary-strip span, .ledger-summary span, .ledger-summary small, .account-type-card small { font-size: 13px; }
.summary-strip strong, .ledger-summary strong, .account-type-card strong { font-size: 23px; font-weight: 600; letter-spacing: -.04em; }
.ledger-summary > div:first-child strong { font-size: 19px; }
.account-type, .voucher-type, .method-chip, .count-label { font-size: 12px; }
.tabs { padding: 5px; gap: 4px; max-width: 100%; overflow: auto; }
.tabs button { font-size: 14px; padding: 10px 15px; white-space: nowrap; }
.two-column-panels, .report-grid, .settings-grid { gap: 20px; }
.mini-list { padding: 0 22px 17px; }
.mini-row { padding: 17px 0; gap: 12px; }
.mini-row strong { font-size: 15px; font-weight: 600; }
.mini-row small { font-size: 12px; line-height: 1.5; }
.fund-symbol, .party-symbol { width: 35px; height: 35px; font-size: 15px; border-radius: 10px; flex-shrink: 0; }
.report-project-list, .expense-bars { padding: 0 22px 22px; }
.bar-row { padding: 13px 0; }
.bar-row > div:first-child { font-size: 13px; }
.bar-row b { font-weight: 600; }
.audit-empty h2 { font-size: 24px; }
.audit-empty > p { font-size: 15px; }
.audit-note, .roadmap-item small { font-size: 13px; }
.roadmap-item strong { font-size: 15px; font-weight: 600; }
.roadmap-item b { font-size: 12px; }
.roadmap-item > span { width: 30px; height: 30px; font-size: 14px; flex-shrink: 0; }
.empty-state { padding: 38px 24px; }
.empty-symbol { width: 43px; height: 43px; margin-bottom: 13px; }
.empty-state h3 { font-size: 17px; font-weight: 600; }
.empty-state p { font-size: 14px; line-height: 1.6; }
.settings-fields { padding: 0 22px 22px; gap: 18px; }
.field > span { font-size: 13px; font-weight: 550; margin-bottom: 7px; }
.field small { font-size: 12px; color: #7d9085; line-height: 1.5; }
.field input, .field select, .header-select { font-size: 15px; height: 44px; padding: 0 12px; border-radius: 8px; }
.modal-card { width: min(700px, 100%); }
.modal-wide { width: min(850px, 100%); }
.modal-head { padding: 23px 25px 18px; }
.modal-head h2 { font-size: 22px; font-weight: 600; }
.modal-head p { font-size: 13px; line-height: 1.5; }
.modal-card form { padding: 21px 25px 24px; }
.form-grid { gap: 17px; }
.modal-section-head h3 { font-size: 15px; }
.modal-section-head p { font-size: 12px; }
.budget-line { grid-template-columns: 1fr 165px 36px; gap: 9px; }
.budget-line input { font-size: 14px; height: 42px; }
.modal-total { font-size: 14px; padding: 14px; align-items: center; gap: 12px; }
.modal-total strong { font-size: 18px; }
.voucher-type-picker button { font-size: 15px; padding: 11px; }
.voucher-type-picker small, .balance-preview, .balance-preview strong { font-size: 12px; }
.balance-preview { gap: 14px; padding: 13px; }
.toast { font-size: 14px; line-height: 1.6; max-width: 440px; padding: 13px 17px; }

/* Login uses the same locally installed font and scale. */
.login-brand strong { font-size: 19px; font-weight: 650; }
.login-brand span { font-size: 13px; }
.login-brand .brand-mark { width: 46px; height: 46px; }
.login-overline { font-size: 12px; }
.login-story h1 { font-size: clamp(38px, 3.5vw, 55px); line-height: 1.15; }
.login-story-content > p { font-size: 16px; line-height: 1.8; max-width: 410px; }
.login-features { font-size: 12px; gap: 9px 16px; }
.login-story-footer { font-size: 12px; }
.login-card { max-width: 390px; }
.login-card .eyebrow { font-size: 11px; }
.login-card h2 { font-size: 34px; font-weight: 650; }
.login-intro { font-size: 15px; margin: 11px 0 28px; }
.login-form .field > span { font-size: 14px; font-weight: 550; }
.login-form .field input { height: 49px; font-size: 16px; }
.password-input button { font-size: 13px; }
.login-submit { font-size: 15px; min-height: 48px; }
.login-help, .login-footer { font-size: 12px; }
.login-error { font-size: 14px; }

@media (max-width: 1450px) {
  .topbar .breadcrumbs > span { max-width: 225px; }
  .topbar { padding: 0 25px; }
  .content-scroll { padding-left: 25px; padding-right: 25px; }
  .search-box { width: 228px; }
  .theme-button { display: none; }
}

@media (min-width: 721px) and (max-height: 850px) {
  .sidebar { padding-top: 21px; padding-bottom: 14px; }
  .sidebar .org-switcher { display: none; }
  .brand-lockup { padding-bottom: 22px; }
  .nav-section { margin-bottom: 15px; }
  .nav-section > p { margin-bottom: 7px; }
  .sidebar-bottom .import-link { padding-top: 8px; padding-bottom: 12px; }
  .sidebar-bottom .profile { padding-top: 13px; }
}

@media (max-width: 1250px) {
  :root { --sidebar-width: 270px; }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .topbar .breadcrumbs > span, .topbar .breadcrumbs > b { display: none; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.2fr) minmax(310px, 1fr); }
  .metric-card { padding: 17px; }
  .metric-top { font-size: 10px; }
  .metric-card > strong { font-size: 25px; }
  .metric-card > small { font-size: 12px; }
  .page-header h1 { font-size: 31px; }
  .page-header p { font-size: 13px; }
}

@media (min-width: 721px) and (max-width: 1100px) {
  :root { --sidebar-width: 90px; }
  .sidebar { padding: 23px 11px 16px; }
  .brand-lockup { padding: 0 0 24px; justify-content: center; }
  .sidebar .brand-copy, .sidebar .workspace-copy, .sidebar .nav-label,
  .sidebar .nav-section > p, .sidebar .profile-copy, .sidebar .profile-online,
  .sidebar .logout-label, .sidebar .import-label { display: none; }
  .org-switcher { padding: 8px; margin: 0 0 25px; justify-content: center; }
  .nav-link { padding: 8px; justify-content: center; min-height: 49px; }
  .nav-link > .nav-icon { background: transparent; }
  .nav-section { margin-bottom: 18px; }
  .sidebar-bottom { padding: 0; }
  .import-link, .profile { justify-content: center; padding-left: 0; padding-right: 0; }
  .logout-button { min-height: 38px; }
}

@media (max-width: 950px) {
  .dashboard-grid { grid-template-columns: 1fr; grid-template-areas: 'activity' 'control' 'health' 'quick'; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip, .account-summary, .ledger-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column-panels, .settings-grid, .report-grid { grid-template-columns: 1fr; }
  .report-funds { grid-column: auto; }
  .topbar-actions .notification-button, .topbar-actions .theme-button { display: none; }
  .page-header { flex-wrap: wrap; align-items: flex-start; }
  .page-header-action { width: auto; }
  .search-box { width: 205px; }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 288px;
    padding: 26px 17px 18px;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .2s, visibility .2s;
    z-index: 45;
  }
  .sidebar.is-open { transform: translateX(0); visibility: visible; }
  .sidebar .brand-copy, .sidebar .workspace-copy, .sidebar .profile > .profile-copy { display: block; }
  .brand-lockup { justify-content: flex-start; padding: 0 10px 26px; }
  .sidebar .brand-copy > span { font-size: 14px; }
  .org-switcher { justify-content: flex-start; padding: 13px 11px; margin: 0 4px 25px; }
  .nav-section > p { font-size: 11px; height: auto; }
  .nav-link { justify-content: flex-start; padding: 9px 12px; font-size: 16px; }
  .sidebar .nav-link > .nav-label { font-size: 16px; }
  .sidebar .import-label { font-size: 13px; }
  .sidebar .profile { justify-content: flex-start; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(10, 35, 30, .38); backdrop-filter: blur(2px); border: 0; z-index: 40; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; height: 39px; width: 39px; border-radius: 9px; background: #eef4f0; border: 1px solid var(--line); color: #245b49; flex-shrink: 0; }
  .main-shell { width: 100%; }
  .topbar { min-height: 70px; padding: 0 17px; gap: 10px; }
  .topbar-location { gap: 10px; }
  .breadcrumbs { font-size: 14px; }
  .topbar-actions { gap: 0; }
  .topbar-actions .primary-button { display: none; }
  .search-box { width: min(175px, 38vw); height: 38px; }
  .search-box kbd { display: none; }
  .search-box input { font-size: 12px; }
  .content-scroll { padding: 25px 17px 35px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 17px; margin-bottom: 23px; }
  .page-header h1 { font-size: 29px; }
  .page-header p { font-size: 14px; }
  .page-header-action, .dashboard-header .page-header-action { width: 100%; }
  .page-header-action > button { flex: 1; }
  .metric-grid { gap: 10px; }
  .metric-card { padding: 15px 13px; min-height: 139px; }
  .metric-card > strong { font-size: 24px; }
  .metric-top { font-size: 10px; letter-spacing: .02em; }
  .metric-top b { width: 24px; height: 24px; }
  .metric-card > small { font-size: 12px; }
  .dashboard-grid { gap: 16px; }
  .panel-head { padding: 19px 17px 15px; }
  .panel-head h2 { font-size: 17px; }
  .panel-head p { font-size: 13px; }
  .quick-actions { grid-template-columns: 1fr; padding-left: 17px; padding-right: 17px; }
  .summary-strip, .account-summary, .ledger-summary { gap: 10px; }
  .summary-strip > div, .ledger-summary > div, .account-type-card { padding: 14px; }
  .summary-strip strong, .ledger-summary strong { font-size: 19px; overflow-wrap: anywhere; }
  .ledger-summary > div:first-child strong { font-size: 17px; }
  .form-grid.two, .settings-fields { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .budget-line { grid-template-columns: minmax(0, 1fr) 105px 30px; }
  .modal-backdrop { padding: 10px; }
  .modal-card form { padding: 18px; }
  .modal-head { padding: 19px 18px 15px; }
  .modal-head h2 { font-size: 21px; }
  .modal-total { flex-wrap: wrap; }
  .balance-preview { flex-wrap: wrap; }
  .header-select { min-width: 0; max-width: 100%; }
  .page-header-action > .field { width: 100%; }
  .login-brand strong { font-size: 17px; line-height: 1.4; }
  .login-brand span { font-size: 12px; }
  .login-card { padding: 26px 23px; }
  .login-card h2 { font-size: 30px; }
  .login-intro { font-size: 14px; }
  .login-footer { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
