:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #0b0c0a;
  --panel-2: #11120f;
  --line: #2b2e27;
  --line-strong: #474c40;
  --text: #f4f6ef;
  --muted: #8e9684;
  --faint: #62695c;
  --signal: #ffb800;
  --signal-ink: #110d00;
  --positive: #00e676;
  --danger: #ff5d52;
  --font: "Cascadia Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); font-family: var(--font); font-size: 14px; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: square; stroke-linejoin: miter; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 248px; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; min-height: 96px; align-items: center; gap: 13px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; width: 43px; height: 43px; place-items: center; border: 1px solid var(--signal); color: var(--signal); }
.brand-mark span { font-size: 14px; font-weight: 800; letter-spacing: -.08em; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.035em; }
.brand > div > span { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }

.main-nav { display: grid; gap: 2px; padding: 24px 14px; }
.nav-link { position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border: 1px solid transparent; color: var(--muted); text-decoration: none; transition: color .16s ease, border-color .16s ease, background .16s ease; }
.nav-link::before { content: ""; position: absolute; left: -15px; width: 2px; height: 0; background: var(--signal); transition: height .18s ease; }
.nav-link svg { width: 17px; height: 17px; }
.nav-link b { color: var(--faint); font-size: 10px; font-weight: 500; }
.nav-link:hover { color: var(--text); border-color: var(--line); }
.nav-link.active { color: var(--text); border-color: var(--line); background: #10110e; }
.nav-link.active::before { height: 54px; }
.nav-link.active svg, .nav-link.active b { color: var(--signal); }

.sidebar-note { display: flex; align-items: flex-start; gap: 11px; margin: auto 20px 18px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.signal { display: inline-block; width: 7px; height: 7px; margin-top: 3px; background: var(--signal); }
.sidebar-note strong, .sidebar-note p { margin: 0; }
.sidebar-note strong { display: block; font-size: 11px; font-weight: 650; text-transform: uppercase; }
.sidebar-note p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.account-card { display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 11px; min-height: 74px; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); }
.avatar { display: grid; width: 35px; height: 35px; place-items: center; color: var(--signal-ink); background: var(--signal); font-size: 12px; font-weight: 800; }
.account-card strong, .account-card span { display: block; }
.account-card strong { font-size: 12px; }
.account-card span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; gap: 2px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button span { width: 3px; height: 3px; margin: 0; background: currentColor; }
.logout-button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--line-strong); color: var(--muted); background: transparent; font-size: 10px; text-transform: uppercase; cursor: pointer; }
.logout-button:hover { border-color: var(--signal); color: var(--signal); }

.workspace { min-width: 0; margin-left: 248px; }
.topbar { display: flex; min-height: 132px; align-items: center; justify-content: space-between; gap: 30px; padding: 26px clamp(24px, 4vw, 58px); border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 11px; color: var(--muted); font-size: 10px; letter-spacing: .14em; }
.eyebrow span:first-child { color: var(--signal); }
.eyebrow i { width: 30px; height: 1px; background: var(--line-strong); }
h1, h2 { margin: 0; letter-spacing: -.055em; }
h1 { font-size: clamp(28px, 3vw, 45px); font-weight: 650; }
h2 { font-size: 23px; font-weight: 620; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.demo-chip { display: flex; min-height: 40px; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; text-transform: uppercase; }
.demo-chip .signal { width: 6px; height: 6px; margin: 0; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border: 1px solid var(--line-strong); color: var(--text); background: var(--panel); font-size: 11px; font-weight: 700; text-transform: uppercase; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease; }
.button svg { width: 15px; height: 15px; }
.button:hover { border-color: var(--text); }
.button:active { transform: translateY(1px); }
.button-primary { border-color: var(--signal); color: var(--signal-ink); background: var(--signal); }
.button-primary:hover { border-color: #ffd667; background: #ffd667; }
.button-secondary { background: transparent; }
.button:focus-visible, input:focus-visible, select:focus-visible, .close-button:focus-visible, .delete-button:focus-visible, .text-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.metric-card { position: relative; min-width: 0; min-height: 226px; padding: 28px clamp(18px, 2.5vw, 34px) 24px; background: var(--panel); }
.metric-card + .metric-card { border-left: 1px solid var(--line); }
.metric-card-primary { background: var(--signal); color: var(--signal-ink); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.metric-head b { color: var(--faint); font-weight: 500; }
.metric-card-primary .metric-head b { color: rgba(17,13,0,.45); }
.metric-value { display: block; margin-top: 32px; overflow: hidden; font-size: clamp(26px, 2.5vw, 39px); font-weight: 650; letter-spacing: -.075em; text-overflow: ellipsis; white-space: nowrap; }
.metric-card:nth-child(4) .metric-value { font-size: clamp(26px, 2.1vw, 35px); }
.metric-card p { min-height: 30px; margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.metric-card-primary p, .metric-card-primary small { color: rgba(17,13,0,.65); }
.metric-rule { height: 3px; margin-top: 22px; background: var(--line); }
.metric-rule span { display: block; width: 0; height: 100%; background: var(--signal); transition: width .5s ease; }
.metric-card-primary .metric-rule { background: rgba(17,13,0,.2); }
.metric-card-primary .metric-rule span { background: var(--signal-ink); }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.forecast-tag { width: fit-content; margin-top: 22px; padding: 6px 8px; border: 1px solid var(--line); color: var(--signal); font-size: 9px; letter-spacing: .09em; }
.micro-bars { display: flex; height: 28px; align-items: end; gap: 3px; margin-top: 12px; }
.micro-bars span { flex: 1; min-width: 3px; background: var(--line-strong); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr); border-bottom: 1px solid var(--line); }
.panel { background: var(--panel); }
.trend-panel { min-width: 0; border-right: 1px solid var(--line); }
.panel-head { display: flex; min-height: 93px; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 28px; border-bottom: 1px solid var(--line); }
.panel-index { margin: 0 0 8px; color: var(--signal); font-size: 9px; letter-spacing: .12em; }
.panel-note { margin: 0; color: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 8px; height: 8px; background: var(--line-strong); }
.legend .legend-current { background: var(--signal); }

.chart-wrap { display: grid; grid-template-columns: 56px 1fr; min-height: 310px; padding: 34px 28px 22px 16px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 34px; color: var(--faint); font-size: 9px; text-align: right; }
.bar-chart { position: relative; display: grid; grid-template-columns: repeat(6, minmax(32px, 1fr)); align-items: end; gap: clamp(9px, 2vw, 26px); min-width: 0; padding: 0 7px 34px 20px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% 25%; }
.bar-column { display: flex; height: 100%; flex-direction: column; justify-content: end; align-items: center; }
.bar-value { margin-bottom: 7px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.bar { width: min(100%, 52px); min-height: 2px; background: var(--line-strong); transition: height .5s cubic-bezier(.2,.8,.2,1); }
.bar-column.current .bar { background: var(--signal); }
.bar-label { position: absolute; bottom: 11px; color: var(--muted); font-size: 9px; text-transform: uppercase; }

.vendor-panel { min-width: 0; }
.vendor-summary { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 18px; min-height: 310px; padding: 28px; }
.donut { display: grid; width: 138px; height: 138px; place-content: center; border: 17px solid var(--line); text-align: center; }
.donut span { font-size: 25px; font-weight: 650; }
.donut small { margin-top: 4px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.vendor-list { display: grid; gap: 17px; }
.vendor-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.vendor-row strong { overflow: hidden; font-size: 11px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.vendor-row b { font-size: 10px; font-weight: 550; }
.vendor-track { grid-column: 1 / -1; height: 2px; background: var(--line); }
.vendor-track span { display: block; height: 100%; background: var(--signal); }

.project-panel { border-bottom: 1px solid var(--line); }
.project-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-card { min-width: 0; min-height: 184px; padding: 25px 28px; }
.project-card + .project-card { border-left: 1px solid var(--line); }
.project-number { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 9px; }
.project-number b { color: var(--signal); font-weight: 500; }
.project-card h3 { min-height: 38px; margin: 22px 0 12px; overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.45; }
.project-card strong { display: block; font-size: 21px; letter-spacing: -.055em; }
.project-track { height: 3px; margin-top: 19px; background: var(--line); }
.project-track span { display: block; height: 100%; background: var(--signal); }

.category-panel { border-bottom: 1px solid var(--line); }
.category-content { display: grid; grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr); min-height: 150px; }
.category-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 26px 28px; border-right: 1px solid var(--line); }
.category-form .form-field input { height: 48px; }
.category-list { display: flex; align-content: flex-start; align-items: flex-start; flex-wrap: wrap; gap: 10px; padding: 28px; }
.category-item { display: inline-flex; min-height: 44px; align-items: center; gap: 13px; padding: 0 13px; border: 1px solid var(--line); color: var(--text); font-size: 12px; }
.category-item b { color: var(--signal); font-size: 10px; font-weight: 500; }
.category-permission { align-self: center; margin: 0; padding: 28px; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.history-panel { min-width: 0; }
.history-head { min-height: 108px; }
.table-tools { display: flex; gap: 8px; }
.search-field { display: flex; min-width: min(30vw, 330px); height: 40px; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); color: var(--muted); background: var(--bg); }
.search-field svg { width: 15px; height: 15px; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.search-field input::placeholder { color: var(--faint); }
select { height: 40px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 0; color: var(--text); background: var(--bg); font-size: 10px; outline: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 9px; font-weight: 500; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { height: 72px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; white-space: nowrap; }
tbody tr:hover { background: #0f100d; }
td strong, td span { display: block; }
td strong { max-width: 210px; overflow: hidden; color: var(--text); font-size: 11px; font-weight: 550; text-overflow: ellipsis; }
td span { max-width: 210px; margin-top: 5px; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; }
.category-badge { display: inline-block; width: fit-content; margin: 0; padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; }
.align-right { text-align: right; }
td.align-right { color: var(--text); font-size: 11px; font-weight: 650; }
.delete-button, .close-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; color: var(--faint); background: transparent; cursor: pointer; }
.delete-button:hover { border-color: var(--danger); color: var(--danger); }
.delete-button svg { width: 15px; height: 15px; }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-state strong { font-size: 12px; }
.empty-state p { color: var(--muted); font-size: 10px; }
.empty-add-button { margin: 22px auto 0; }
.table-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; padding: 0 28px; color: var(--muted); font-size: 10px; }
.text-button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--line-strong); color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.text-button:hover { border-color: var(--signal); color: var(--signal); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.78); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(780px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; border: 1px solid var(--line-strong); background: var(--panel); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.close-button { border-color: var(--line); }
.close-button:hover { color: var(--text); border-color: var(--text); }
.close-button svg { width: 17px; height: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 26px 28px; }
.form-field { display: grid; gap: 8px; min-width: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.form-field-wide { grid-column: 1 / -1; }
.form-field input, .form-field select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0; color: var(--text); background: var(--bg); outline: 0; text-transform: none; }
.form-field input::placeholder { color: var(--faint); }
.form-field input:focus, .form-field select:focus { border-color: var(--signal); }
.cost-preview { margin: 0 28px; border: 1px solid var(--signal); }
.cost-preview > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; color: var(--signal-ink); background: var(--signal); }
.cost-preview > div span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.cost-preview strong { font-size: 27px; letter-spacing: -.06em; }
.cost-preview p { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 12px 20px; color: var(--muted); font-size: 10px; }
.cost-preview p b { color: var(--signal); font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 24px 28px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 150; max-width: 360px; padding: 14px 18px; border-left: 3px solid var(--positive); color: var(--text); background: var(--panel-2); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-card:nth-child(4) { border-top: 1px solid var(--line); }
  .metric-card:nth-child(4) .metric-value { font-size: clamp(26px, 3vw, 39px); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .trend-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-card:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .project-card:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { min-height: 72px; }
  .main-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 8px; }
  .nav-link { grid-template-columns: 18px 1fr; min-height: 44px; padding: 0 8px; }
  .nav-link::before, .nav-link b { display: none; }
  .sidebar-note, .account-card { display: none; }
  .workspace { margin-left: 0; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .history-head { align-items: flex-start; flex-direction: column; }
  .table-tools { width: 100%; }
  .search-field { min-width: 0; flex: 1; }
}

@media (max-width: 580px) {
  .main-nav { overflow-x: auto; grid-template-columns: repeat(5, minmax(110px, 1fr)); }
  .topbar { padding: 22px 18px; }
  .demo-chip { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card + .metric-card { border-left: 0; border-top: 1px solid var(--line); }
  .panel-head { align-items: flex-start; flex-direction: column; padding: 20px 18px; }
  .chart-wrap { grid-template-columns: 44px 1fr; padding-right: 14px; }
  .bar-chart { gap: 7px; padding-left: 10px; }
  .bar-value { display: none; }
  .vendor-summary { grid-template-columns: 1fr; justify-items: center; }
  .vendor-list { width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card + .project-card { border-left: 0; border-top: 1px solid var(--line); }
  .category-content { grid-template-columns: 1fr; }
  .category-form, .category-permission { border-right: 0; border-bottom: 1px solid var(--line); }
  .category-form { grid-template-columns: 1fr; }
  .table-tools { flex-direction: column; }
  .search-field, .table-tools select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; padding: 22px 18px; }
  .form-field-wide { grid-column: auto; }
  .cost-preview { margin: 0 18px; }
  .modal-actions { padding: 20px 18px; }
}

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

/* Comfortable reading scale for desktop and high-resolution displays. */
body { font-size: 17px; }
.brand strong { font-size: 17px; }
.brand > div > span { font-size: 11px; }
.nav-link { font-size: 16px; }
.nav-link b { font-size: 11px; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note p { font-size: 11px; }
.account-card strong { font-size: 13px; }
.account-card span { font-size: 11px; }
.logout-button { font-size: 11px; }
.eyebrow { font-size: 11px; }
h2 { font-size: 30px; }
.demo-chip { font-size: 11px; }
.button { min-height: 48px; padding-inline: 19px; font-size: 13px; }
.metric-head { font-size: 11px; }
.metric-card p { font-size: 13px; }
.metric-card small, .forecast-tag { font-size: 10px; }
.panel-index { font-size: 11px; }
.panel-note, .legend { font-size: 12px; }
.chart-y, .bar-value, .bar-label { font-size: 11px; }
.donut small { font-size: 10px; }
.vendor-row strong { font-size: 14px; }
.vendor-row b { font-size: 12px; }
.project-number { font-size: 11px; }
.project-card h3 { font-size: 17px; }
.project-card strong { font-size: 25px; }

.history-head { min-height: 132px; }
.search-field { height: 50px; }
.search-field input { font-size: 14px; }
.table-tools select { height: 50px; font-size: 14px; }
th { height: 60px; font-size: 13px; }
td { height: 94px; font-size: 16px; line-height: 1.45; }
td strong { max-width: 300px; font-size: 17px; }
td span { max-width: 300px; margin-top: 8px; font-size: 14px; }
.category-badge { padding: 8px 10px; font-size: 12px; }
td.align-right { font-size: 17px; }
.delete-button { width: 40px; height: 40px; }
.delete-button svg { width: 18px; height: 18px; }
.table-footer, .text-button { font-size: 13px; }
.form-field { font-size: 12px; }
.form-field input, .form-field select { height: 50px; font-size: 14px; }
.cost-preview > div span, .cost-preview p { font-size: 12px; }
.cost-preview strong { font-size: 30px; }
.toast { font-size: 13px; }
