:root {
  --navy: #051325;
  --ink: #0b1b31;
  --muted: #5e6a7a;
  --line: rgba(5, 19, 37, .12);
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --brand: #316ec6;
  --brand-dark: #255baa;
  --brand-light: #75a7ee;
  --brand-soft: rgba(49, 110, 198, .10);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.site-header {
  min-height: 78px;
  padding: 13px max(24px, calc((100vw - 1320px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; gap: 12px; color: var(--navy); }
.brand-word { font-size: 21px; font-weight: 650; letter-spacing: -.045em; }
.brand small { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
nav { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 650; }
nav form { margin: 0; }
.link-button { border: 0; padding: 0; color: var(--brand); background: transparent; font: inherit; cursor: pointer; }

.page-shell { width: min(1320px, calc(100% - 40px)); margin: 54px auto 90px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.page-heading.compact { align-items: start; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 13px; color: var(--navy); font-size: clamp(36px, 4.4vw, 58px); font-weight: 600; line-height: 1.02; letter-spacing: -.055em; }
h2 { margin-bottom: 18px; color: var(--navy); font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { width: 28px; height: 2px; background: currentColor; content: ""; }
.muted { max-width: 720px; color: var(--muted); line-height: 1.65; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border: 1px solid var(--brand); border-radius: 999px; background: var(--brand); color: white; font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease; }
.button:hover { background: var(--brand-dark); color: white; }
.button:hover { transform: translateY(-1px); }
.button-small { min-height: 42px; padding: 0 17px; }
.button-secondary { border-color: var(--navy); background: var(--paper); color: var(--navy); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi-card, .panel, .form-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.kpi-card { padding: 22px; }
.kpi-card span, .kpi-card small { display: block; color: var(--muted); }
.kpi-card strong { display: block; margin: 11px 0 9px; font-size: 27px; letter-spacing: -.035em; }
.kpi-card small { font-size: 12px; line-height: 1.4; }
.kpi-card.accent { border-top: 4px solid var(--brand); padding-top: 19px; }
.period-filter { display: flex; align-items: end; gap: 10px; margin: 0 0 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.period-filter label { align-self: center; margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.period-filter select { min-height: 42px; padding: 6px 34px 6px 11px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit; }
.period-filter .button { margin-left: auto; width: auto; }
.reporting-cutoff { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 18px 0 10px; padding: 0 4px; color: var(--muted); font-size: 12px; }
.reporting-cutoff strong { color: var(--navy); font-weight: 650; }
.comparison-legend { display: flex; justify-content: flex-end; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.comparison-legend span { display: inline-flex; align-items: center; gap: 6px; }
.comparison-legend i { width: 9px; height: 9px; border-radius: 50%; }
.target-dot { background: #c8d1cc; }
.actual-dot { background: var(--brand); }
.comparison-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.comparison-card { padding: 24px; border: 1px solid var(--line); border-top: 4px solid rgba(5, 19, 37, .24); border-radius: 20px; background: var(--paper); }
.comparison-card.favorable { border-top-color: var(--brand); }
.comparison-card.unfavorable { border-top-color: #c75c51; }
.comparison-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.comparison-card h2 { margin-bottom: 20px; font-size: 18px; }
.derived { padding: 4px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.comparison-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comparison-values span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.comparison-values strong { font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.comparison-bars { margin: 19px 0 16px; }
.bar-row { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.bar-row > div { height: 7px; overflow: hidden; border-radius: 999px; background: var(--canvas); }
.bar-row i { display: block; height: 100%; min-width: 2px; border-radius: inherit; }
.target-bar { background: #c8d1cc; }
.actual-bar { background: var(--brand); }
.unfavorable .actual-bar { background: #c75c51; }
.variance-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 12px; }
.variance-line span { color: var(--muted); }
.variance-line strong { font-variant-numeric: tabular-nums; }
.favorable .variance-line strong { color: var(--brand); }
.unfavorable .variance-line strong { color: #a33f36; }
.monthly-target { margin-top: 11px; padding: 9px 11px; border-radius: 10px; background: var(--canvas); color: var(--muted); font-size: 11px; }
.monthly-target strong { color: var(--navy); font-weight: 650; }
.card-note { display: block; min-height: 34px; margin-top: 11px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.panel { padding: 26px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 12px; border-top: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
td small { color: var(--muted); }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.status-open { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #fff4dc; color: #8a5b08; font-size: 12px; font-weight: 700; }
.empty-state { padding: 44px 20px 22px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); }

.entry-form { max-width: 920px; }
.form-card { margin-bottom: 18px; padding: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid.dates { grid-template-columns: repeat(4, 1fr); }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(49, 110, 198, .16); border-color: var(--brand); }
.field small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.category-intro { margin: -8px 0 20px; font-size: 13px; }
.category-levels { align-items: start; }
.category-levels .field > label { display: flex; align-items: center; gap: 8px; }
.field-step { display: inline-grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--navy); color: white; font-size: 11px; }
.form-divider { height: 1px; margin: 24px 0; background: var(--line); }
.errorlist { margin: 7px 0 0; padding-left: 18px; color: #a32a25; font-size: 12px; }
.form-errors, .message { margin-bottom: 18px; padding: 13px 16px; border-radius: 9px; background: #fbe9e8; color: #8d2420; }
.message.success { background: var(--brand-soft); color: var(--brand-dark); }
.category-info { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding: 11px 13px; border-radius: 10px; background: var(--brand-soft); color: var(--navy); }
.category-info span { display: grid; flex: 0 0 20px; place-items: center; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-family: Georgia, serif; font-size: 13px; font-weight: bold; }
.category-info p { margin: 1px 0 0; font-size: 13px; line-height: 1.45; }
.amount-preview { margin-top: 9px; color: var(--muted); font-size: 12px; }
.amount-preview strong { color: var(--ink); }
.amount-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amount-mode label { position: relative; margin: 0; cursor: pointer; }
.amount-mode input { position: absolute; opacity: 0; pointer-events: none; }
.amount-mode span { display: grid; min-height: 48px; padding: 8px 12px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.amount-mode input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.amount-mode input:focus-visible + span { outline: 3px solid rgba(49, 110, 198, .16); }
.advanced summary { cursor: pointer; font-size: 16px; font-weight: 750; }
.advanced[open] summary { margin-bottom: 22px; }
.checkbox-field { display: flex; align-items: center; }
.checkbox-field label { margin: 0; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.form-actions > a { margin-right: auto; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy); }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: 0 20px 50px rgba(5, 19, 37, .22); }
.login-brand { margin-bottom: 42px; }
.login-card h1 { font-size: 38px; }
.login-card .field { margin-bottom: 18px; }
.full-button { width: 100%; margin-top: 8px; }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .comparison-grid { grid-template-columns: 1fr 1fr; }
  .form-grid.dates { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 650px) {
  .site-header { align-items: flex-start; }
  nav { flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
  nav > a:first-child { display: none; }
  .page-shell { width: min(100% - 24px, 1320px); margin-top: 32px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .kpi-grid, .comparison-grid, .form-grid, .form-grid.dates { grid-template-columns: 1fr; }
  .period-filter { align-items: stretch; flex-wrap: wrap; }
  .period-filter label { margin-left: 0; }
  .period-filter .button { flex-basis: 100%; margin-top: 4px; }
  .reporting-cutoff { align-items: flex-start; flex-direction: column; gap: 4px; }
  .panel, .form-card { padding: 20px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions > a { margin: 8px auto; }
  .button { width: 100%; }
}
