:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #18212f;
  --muted: #667085;
  --line: #dfe4ea;
  --brand: #176b61;
  --brand-dark: #0f5048;
  --danger: #b42318;
  --warning: #b54708;
  --shadow: 0 12px 35px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: var(--brand); }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 36px auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { line-height: 1.15; }
label { display: grid; gap: 7px; font-weight: 650; color: #344054; }
input, select { width: 100%; border: 1px solid #cbd3dc; border-radius: 10px; padding: 11px 12px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 3px solid rgba(23,107,97,.15); border-color: var(--brand); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 15px; background: var(--brand); color: white; text-decoration: none; font: inherit; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--brand-dark); }
.button.secondary { background: #e7f2f0; color: var(--brand-dark); }
.button.danger { background: #fee4e2; color: var(--danger); }
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; background: #eef4ff; }
.alert.error { background: #fee4e2; color: var(--danger); }
.alert.success { background: #dcfae6; color: #067647; }
.alert.warning { background: #fffaeb; color: var(--warning); }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 14px; font-weight: 750; margin-right: 8px; }
.status.ok { color: #067647; background: #dcfae6; }
.status.bad { color: var(--danger); background: #fee4e2; }
.status.neutral { background: #eaecf0; color: #475467; }
.login { width: min(440px, 100%); margin: 12vh auto 0; }
.login form { display: grid; gap: 18px; }
.admin-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.admin-header p { color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-form .wide { grid-column: 1 / -1; }
.checkbox { display: flex; flex-direction: row; align-items: start; gap: 10px; font-weight: 500; }
.checkbox input { width: auto; margin-top: 5px; }
.budget-admin-list { display: grid; gap: 20px; }
.budget-admin-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; }
.admin-actions { display: flex; gap: 10px; align-items: start; }
.adjustment-form { grid-column: 1 / -1; display: grid; grid-template-columns: 170px 170px 1fr auto; gap: 12px; align-items: end; border-top: 1px solid var(--line); padding-top: 18px; }
.adjustment-form small { grid-column: 1 / -1; color: var(--muted); }
.dashboard-page { background: linear-gradient(180deg, #eaf2f1 0, var(--bg) 360px); }
.dashboard { display: grid; gap: 22px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 12px 4px; }
.dashboard-header h1 { font-size: clamp(30px, 4vw, 48px); margin: 5px 0 8px; }
.dashboard-header p { color: var(--muted); font-size: 18px; margin: 0; }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: .11em; font-weight: 800; font-size: 13px; }
.month-picker { width: 180px; }
.live-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: #067647; font-size: 14px; font-weight: 700; }
.live-status.error { color: var(--danger); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(6,118,71,.12); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.metrics article { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 23px; box-shadow: var(--shadow); }
.metrics span { display: block; color: var(--muted); font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.metrics strong { display: block; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; }
.metrics small { display: block; margin-top: 9px; color: var(--muted); }
.negative { color: var(--danger); }
.progress-panel { margin: 0; }
.progress-label { display: flex; justify-content: space-between; gap: 16px; }
.progress { height: 18px; background: #eaecf0; border-radius: 999px; overflow: hidden; margin: 13px 0; }
.progress > div { height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width .35s ease; }
.progress > div.warning { background: #f79009; }
.progress > div.over { background: var(--danger); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 15px; }
.section-heading p, .section-heading span { color: var(--muted); margin: 0; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
th:last-child, td:last-child { text-align: right; white-space: nowrap; }
td:nth-child(1), td:nth-child(3) { white-space: nowrap; }
.empty { color: var(--muted); text-align: center !important; padding: 30px; }
.adjustment-row { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; border-bottom: 1px solid var(--line); }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 30px; }
@media (max-width: 760px) {
  .page-shell { width: min(100% - 20px, 1180px); margin-top: 18px; }
  .dashboard-header, .admin-header { align-items: stretch; flex-direction: column; }
  .month-picker { width: 100%; }
  .metrics { grid-template-columns: 1fr; }
  .grid-form, .budget-admin-card, .adjustment-form { grid-template-columns: 1fr; }
  .grid-form .wide, .adjustment-form, .adjustment-form small { grid-column: auto; }
  .admin-actions { flex-wrap: wrap; }
  .section-heading { align-items: start; flex-direction: column; }
}

.budget-edit { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 16px; }
.budget-edit summary { cursor: pointer; font-weight: 700; color: var(--text); }
.budget-edit[open] summary { margin-bottom: 16px; }
.compact-form { margin-top: 8px; }
.form-hint { margin: -6px 0 0; color: var(--muted); font-size: 0.92rem; }
