:root {
  --navy: #0b2545;
  --navy-light: #13396b;
  --gold: #c9972a;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #dfe4ea;
  --text: #1f2937;
  --muted: #64748b;
  --green: #1c8a4b;
  --red: #c0392b;
  --amber: #b7791f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--navy-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.topbar .brand .logo-mark { height: 34px; width: auto; background: #fff; padding: 3px 6px; border-radius: 4px; }
.topbar nav a { color: #dce6f5; margin-left: 20px; font-size: 14px; }
.topbar nav a.active { color: #fff; font-weight: 600; border-bottom: 2px solid var(--gold); padding-bottom: 4px; }
.topbar .user-chip { font-size: 13px; color: #b9c6da; }

.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

.hero {
  text-align: center;
  padding: 48px 20px 32px;
}
.hero img.qci-logo { height: 78px; width: auto; margin-bottom: 18px; }
.hero h1 { font-size: 28px; margin: 6px 0 4px; color: var(--navy); }
.hero p { color: var(--muted); font-size: 15px; margin: 0; }

.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 36px 0 14px;
  font-weight: 600;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tile:hover { box-shadow: 0 6px 18px rgba(11,37,69,0.12); transform: translateY(-2px); text-decoration: none; }
.tile .logo-img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border);
}
.tile .code { font-weight: 600; color: var(--navy); }
.tile .type { font-size: 12px; color: var(--muted); }

.footer-links { text-align: center; margin-top: 40px; font-size: 13px; color: var(--muted); }
.footer-links a { margin: 0 10px; }

/* Buttons (used across app: budget entry, review, etc.) */
.btn {
  background: var(--navy); color: #fff; border: none; padding: 10px 18px; border-radius: 6px;
  font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--navy-light); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn.secondary:hover { background: #eef2f7; }
.btn.gold { background: var(--gold); }
.btn.danger { background: var(--red); }

/* Icon-toggle segmented control (e.g. Pivot page's Service Line / Ledger Head switch) */
.icon-toggle-group { display: inline-flex; border: 1px solid #dfe4ea; border-radius: 8px; overflow: hidden; background: #fff; }
.icon-toggle-btn {
  display: flex; align-items: center; gap: 7px; padding: 8px 16px; background: #fff; border: none;
  border-right: 1px solid #dfe4ea; color: var(--navy); font-size: 13px; font-weight: 600; cursor: pointer;
}
.icon-toggle-btn:last-child { border-right: none; }
.icon-toggle-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.icon-toggle-btn.active { background: var(--navy); color: #fff; }
.icon-toggle-btn:hover:not(.active) { background: #eef2f7; }

/* Lightweight CSS-only bar visuals for the Pivot Analysis cards (no chart library) */
.mini-bar-track { background: #eef1f4; border-radius: 4px; height: 10px; width: 100%; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 4px 0 0 4px; }
.mini-bar-fill.income { background: var(--green); }
.mini-bar-fill.expense { background: var(--red); }
.ratio-pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.ratio-pill.healthy { background: #e9f7ef; color: var(--green); }
.ratio-pill.tight { background: #fff4de; color: var(--amber); }
.ratio-pill.deficit { background: #fdecea; color: var(--red); }

/* Login page - split panel layout */
html, body.login-body { height: 100%; margin: 0; }
body.login-body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
}
.login-page {
  min-height: 100vh;
  display: flex;
}
.login-brand-panel {
  flex: 1.1;
  background: linear-gradient(155deg, var(--navy) 0%, #08192f 60%, #051220 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 50px;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  top: -160px; right: -180px;
}
.login-brand-panel::after {
  content: "";
  position: absolute;
  width: 340px; height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(201,151,42,0.25);
  bottom: -120px; left: -100px;
}
.login-brand-inner { max-width: 420px; position: relative; z-index: 1; }
.login-brand-inner .brand-logo {
  height: 52px; width: auto; background: #fff; padding: 8px 12px; border-radius: 6px;
  margin-bottom: 34px;
}
.login-brand-inner h1 { font-size: 30px; line-height: 1.28; margin: 0 0 14px; font-weight: 700; }
.login-brand-inner p { color: #b9c6da; font-size: 15px; line-height: 1.5; margin: 0; }
.login-brand-footer {
  margin-top: 60px; font-size: 13px; color: #7c8ba3; text-transform: uppercase; letter-spacing: 0.08em;
  border-top: 1px solid rgba(255,255,255,0.12); padding-top: 18px;
}

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 14px;
  padding: 40px 36px;
  box-shadow: 0 10px 40px rgba(11,37,69,0.10);
  border: 1px solid var(--border);
}
.login-card .back-link { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 22px; }
.login-card .entity-logo {
  height: 44px; width: auto; max-width: 100%; object-fit: contain; margin-bottom: 14px; display: block;
}
.entity-type-pill {
  display: inline-block; background: #eef2f7; color: var(--navy); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 10px; border-radius: 20px; margin-bottom: 10px;
}
.login-card h2 { margin: 4px 0 6px; color: var(--navy); font-size: 22px; }
.login-card .login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; line-height: 1.4; }

.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.form-group input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus {
  outline: none; border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(19,57,107,0.12);
}

.login-submit {
  width: 100%; background: var(--navy); color: #fff; border: none; padding: 12px 18px;
  border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 6px;
  transition: background .15s;
}
.login-submit:hover { background: var(--navy-light); }

.login-footnote { text-align: center; font-size: 12px; color: var(--muted); margin: 22px 0 0; line-height: 1.5; }

@media (max-width: 860px) {
  .login-page { flex-direction: column; }
  .login-brand-panel { padding: 40px 30px; }
  .login-brand-inner h1 { font-size: 24px; }
}

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; text-align: left; }
.flash.error { background: #fdecea; color: var(--red); border: 1px solid #f5c6c2; }
.flash.success { background: #e9f7ef; color: var(--green); border: 1px solid #b7e4c7; }

/* Cards / KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.kpi .value.green { color: var(--green); }
.kpi .value.red { color: var(--red); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px; margin-bottom: 24px; }
.card h3 { margin-top: 0; color: var(--navy); font-size: 16px; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 7px 9px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 180px; }
thead th { background: #eef2f7; color: var(--navy); font-weight: 600; }
tbody tr:nth-child(even) { background: #fafbfc; }
.row-income td:first-child { border-left: 3px solid var(--green); }
.row-expense td:first-child { border-left: 3px solid var(--red); }
tfoot td { font-weight: 700; background: #eef2f7; }

.table-scroll { overflow-x: auto; }

input.cell-input {
  width: 68px; text-align: right; border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px; font-size: 12.5px;
}
input.cell-input:disabled { background: #f1f3f5; color: var(--muted); }

input.remark-input {
  width: 140px; border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px; font-size: 12px; color: #475569;
}
input.remark-input:disabled { background: #f1f3f5; color: var(--muted); }
input.remark-input:focus { outline: none; border-color: var(--forest); background: #fff; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-Draft { background: #eef1f4; color: var(--muted); }
.status-Submitted { background: #fff4de; color: var(--amber); }
.status-Approved { background: #e9f7ef; color: var(--green); }
.status-SentBack { background: #fdecea; color: var(--red); }

.entity-list { list-style: none; padding: 0; margin: 0; }
.entity-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--card);
}
.entity-list .name { font-weight: 600; color: var(--navy); }
.entity-list .meta { font-size: 12px; color: var(--muted); }

.form-row { margin-bottom: 14px; text-align: left; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--navy); }
.form-row textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-family: inherit; }

.actions-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.remarks-box { background: #fff8ee; border: 1px solid #f0dcb0; border-radius: 8px; padding: 12px 16px; font-size: 13px; margin-bottom: 16px; }

/* Entity home landing page */
.entity-hero-logo { height: 64px; width: auto; max-width: 220px; object-fit: contain; margin-bottom: 12px; }

.big-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: box-shadow .15s, transform .15s;
}
.big-tile:hover { box-shadow: 0 8px 22px rgba(11,37,69,0.14); transform: translateY(-3px); text-decoration: none; }
.big-tile-icon { font-size: 34px; }
.big-tile-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.big-tile-sub { font-size: 13px; color: var(--muted); }

/* Budget type / Original vs Revised */
.type-toggle { display: inline-flex; gap: 6px; margin-bottom: 4px; }
.type-toggle a {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); color: var(--navy);
}
.type-toggle a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.type-toggle a.disabled { color: var(--muted); pointer-events: none; opacity: .5; }

tr.row-original td { color: var(--muted); font-style: italic; background: #f8fafc; }

/* Debtors */
.ageing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 20px; }
.ageing-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; text-align: center; }
.ageing-card .bucket { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ageing-card .amt { font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 6px; }

.upload-box {
  border: 2px dashed var(--border); border-radius: 10px; padding: 30px; text-align: center; background: #fafbfc;
}

@media print {
  .topbar, .actions-row, .footer-links, form button, .type-toggle { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
}

/* ---------- App shell: left sidebar layout (logged-in pages) ---------- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, #08192f 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.sidebar-brand .logo-mark { height: 30px; width: auto; background: #fff; padding: 3px 6px; border-radius: 4px; flex-shrink: 0; }
.sidebar-brand-text { font-size: 15px; font-weight: 700; line-height: 1.25; }
.sidebar-brand-text small { display: block; font-size: 10.5px; font-weight: 500; color: #97a9c4; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

.sidebar-entity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.sidebar-entity img { height: 34px; width: 34px; border-radius: 50%; object-fit: cover; background: #fff; border: 1px solid rgba(255,255,255,0.25); }
.sidebar-entity .code { font-weight: 700; font-size: 14px; }
.sidebar-entity .type { font-size: 11px; color: #97a9c4; }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 8px; color: #dce6f5; font-size: 14px; font-weight: 500;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); text-decoration: none; }
.sidebar-link.active { background: var(--gold); color: #1f1503; font-weight: 700; }
.sidebar-link.active .sidebar-icon { color: #1f1503; }
.sidebar-icon { width: 18px; height: 18px; flex-shrink: 0; color: #9db2d4; }
.sidebar-link.active .sidebar-icon, .sidebar-link:hover .sidebar-icon { color: inherit; }

.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.10);
}
.sidebar-user { font-size: 12.5px; color: #b9c6da; margin-bottom: 8px; }
.sidebar-logout { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #dce6f5; font-weight: 600; }
.sidebar-logout:hover { color: #fff; text-decoration: none; }
.sidebar-logout .sidebar-icon { width: 15px; height: 15px; color: inherit; }

.main-wrap { flex: 1; min-width: 0; }
.main-wrap .container { max-width: 1180px; }

/* Slim top strip used only on the logged-out public home / login flow */
.topbar-lite {
  background: var(--navy); color: #fff; padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-lite .brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; color: #fff; }
.topbar-lite .brand .logo-mark { height: 34px; width: auto; background: #fff; padding: 3px 6px; border-radius: 4px; }
.topbar-lite a.login-link { color: #dce6f5; font-size: 14px; }

/* Home page hero banner (gradient, matches login brand panel) */
.home-hero-banner {
  background: linear-gradient(155deg, var(--navy) 0%, #08192f 60%, #051220 100%);
  color: #fff;
  text-align: center;
  padding: 56px 20px 46px;
  position: relative;
  overflow: hidden;
}
.home-hero-banner::before {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08); top: -180px; right: -140px;
}
.home-hero-banner::after {
  content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  border: 1px solid rgba(201,151,42,0.25); bottom: -120px; left: -80px;
}
.home-hero-banner .hero-inner { position: relative; z-index: 1; }
.home-hero-banner img.qci-logo { height: 60px; width: auto; background: #fff; padding: 8px 14px; border-radius: 8px; margin-bottom: 20px; }
.home-hero-banner .eyebrow { font-size: 12.5px; text-transform: uppercase; letter-spacing: .12em; color: #b9c6da; font-weight: 600; margin-bottom: 8px; }
.home-hero-banner h1 { font-size: 34px; margin: 0 0 10px; font-weight: 700; }
.home-hero-banner p { color: #b9c6da; font-size: 15px; max-width: 620px; margin: 0 auto; line-height: 1.55; }

/* Icon-based tiles (replacing emoji glyphs for a more professional look) */
.tile-icon-svg, .big-tile-icon-svg { width: 30px; height: 30px; color: var(--navy-light); }
.big-tile-icon-svg { width: 34px; height: 34px; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: relative; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
}

@media print {
  .sidebar, .topbar-lite { display: none !important; }
}

/* Sign-in page: QCI logo pinned to the top-left of the brand panel */
.login-brand-logo-topleft {
  position: absolute;
  top: 28px;
  left: 32px;
  height: 44px;
  width: auto;
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 2;
}

/* ---------- Budget Summary ("Budget at a Glance" board-review style) ---------- */
:root {
  --forest: #1a4331;
  --forest-light: #31654f;
  --steel-blue: #134a71;
}

.glance-wrap { background: var(--forest); border-radius: 10px; overflow: hidden; margin-bottom: 24px; }

.glance-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 18px 24px; background: var(--forest);
}
.glance-header-left { display: flex; align-items: center; gap: 16px; }
.glance-badge {
  background: #fff; color: var(--forest); font-weight: 800; font-size: 15px;
  padding: 8px 18px; border-radius: 8px;
}
.glance-title { color: #fff; font-size: 22px; font-weight: 700; margin: 0; }
.glance-header-right { color: #cfe3d8; font-size: 13px; text-align: right; }
.glance-header-right .fy { font-weight: 600; }

.glance-section-title {
  background: var(--forest-light); color: #fff; font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 24px;
}

.glance-kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px; padding: 22px 24px; background: var(--forest);
}
.glance-kpi .label { color: #9fc2ae; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.glance-kpi .value { color: var(--gold); font-size: 26px; font-weight: 800; margin-top: 4px; }
.glance-kpi .sub { color: #cfe3d8; font-size: 12px; margin-top: 4px; }

.glance-body { display: flex; gap: 0; background: #fff; align-items: stretch; }
.glance-table-col { flex: 1; min-width: 0; padding: 18px 20px; }
.glance-comments-col {
  width: 260px; flex-shrink: 0; background: var(--forest); color: #fff; padding: 18px 20px;
}
.glance-comments-col h4 { color: var(--gold); margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.glance-comments-col p { color: #cfe3d8; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }

.glance-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.glance-table th, .glance-table td { padding: 8px 10px; text-align: right; border: 1px solid #e2e8e4; white-space: nowrap; }
.glance-table th:first-child, .glance-table td:first-child { text-align: left; white-space: normal; min-width: 170px; }
.glance-table thead th { color: #fff; background: var(--forest-light); font-weight: 600; }
.glance-table thead th.col-blue { background: var(--steel-blue); }
.glance-table thead th.col-gold { background: var(--gold); color: #2a1e02; }
.glance-table tbody tr:nth-child(even) { background: #f4f8f6; }
.glance-table tfoot td { background: var(--forest); color: #fff; font-weight: 700; }
.glance-table .growth-pos { color: var(--green); font-weight: 600; }
.glance-table .growth-neg { color: var(--red); font-weight: 600; }

table.performance-table td.variance-pos { color: var(--green); font-weight: 600; }
table.performance-table td.variance-neg { color: var(--red); font-weight: 600; }
table.performance-table tfoot td {
  font-weight: 700;
  background: #eef2f7;
  border-top: 2px solid #d7dfe9;
}
table.performance-table tfoot td.variance-pos { color: var(--green); }
table.performance-table tfoot td.variance-neg { color: var(--red); }

table.pivot-table th, table.pivot-table td { padding: 5px 7px; font-size: 12px; }
table.pivot-table th:first-child, table.pivot-table td:first-child { min-width: 190px; }
table.pivot-table td a { color: var(--navy); font-weight: 600; text-decoration: none; border-bottom: 1px dotted var(--navy); }
table.pivot-table td a:hover { color: var(--gold); border-bottom-color: var(--gold); }
table.pivot-table thead th { position: sticky; top: 0; background: #eef2f7; z-index: 1; }

.glance-footer {
  background: var(--forest); color: #cfe3d8; text-align: center; font-size: 11.5px;
  padding: 10px; letter-spacing: .02em;
}

@media (max-width: 900px) {
  .glance-body { flex-direction: column; }
  .glance-comments-col { width: auto; }
}

@media print {
  .glance-comments-col { display: none; }
}

/* Monthly phase-out: auto-fill dropdown + over-budget feedback */
.autofill-select {
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid #dfe4ea;
  border-radius: 4px;
  color: #0b2545;
  background: #f8fafc;
  vertical-align: middle;
}
.row-warn {
  font-size: 11px;
  color: #c0392b;
  font-weight: 600;
  margin-top: 2px;
}
td.row-total-cell.over-budget {
  background: #fdecea;
  color: #c0392b;
  font-weight: 700;
}

/* ---- Annual Budget (frozen reference) card ---- */
.annual-budget-card {
  border-top: 3px solid var(--forest, #1a4331);
}
.annual-budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.frozen-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2f7;
  color: #0b2545;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d7dfe9;
}
.annual-budget-note {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 12px;
}
table.annual-budget-table {
  background: #fbfcfd;
}
table.annual-budget-table thead th {
  background: #eef2f7;
}
table.annual-budget-table td.cell-blank,
table.performance-table td.cell-blank {
  color: #cbd5e1;
  text-align: center;
}
a.head-amount-toggle {
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  cursor: pointer;
}
a.head-amount-toggle::after {
  content: " \25BE";
  font-size: 10px;
  opacity: 0.7;
}
a.head-amount-toggle.expanded::after {
  content: " \25B4";
}
table.annual-budget-table tr.subtotal-row td,
table.performance-table tr.subtotal-row td {
  font-weight: 700;
  border-top: 1px solid #d7dfe9;
  border-bottom: 1px solid #d7dfe9;
}
table.performance-table tr.spacer-row td {
  border: none;
  height: 10px;
  padding: 0;
  background: transparent;
}
table.annual-budget-table tfoot td {
  font-weight: 700;
  background: #1a4331;
  color: #fff;
}
input.annual-target-input {
  width: 84px; text-align: right; border: 1px solid var(--gold); border-radius: 4px;
  padding: 4px 6px; font-size: 12.5px; background: #fffdf6;
}
input.annual-target-input:disabled { background: #f1f3f5; color: var(--muted); border-color: var(--border); }
input.annual-target-input:focus { outline: none; border-color: var(--forest); background: #fff; }

/* ---- Monthly Phaseout section head + view toggle ---- */
.phaseout-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 10px;
}
.phaseout-section-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.link-muted {
  font-size: 12px;
  color: #134a71;
  text-decoration: none;
  font-weight: 600;
}
.link-muted:hover {
  text-decoration: underline;
}

/* Quarter/Half rollup columns are read-only recaps, hidden unless selected */
table.phaseout-table .cell-quarter,
table.phaseout-table .cell-half {
  display: none;
  text-align: right;
  padding-right: 10px;
  background: #f8fafc;
  font-variant-numeric: tabular-nums;
}
table.phaseout-table[data-view="monthly"] .cell-month { display: table-cell; }
table.phaseout-table[data-view="quarterly"] .cell-month { display: none; }
table.phaseout-table[data-view="quarterly"] .cell-quarter { display: table-cell; }
table.phaseout-table[data-view="halfyear"] .cell-month { display: none; }
table.phaseout-table[data-view="halfyear"] .cell-half { display: table-cell; }
table.phaseout-table[data-view="annual"] .cell-month,
table.phaseout-table[data-view="annual"] .cell-quarter,
table.phaseout-table[data-view="annual"] .cell-half { display: none; }

/* ---- Revised view: side-by-side Original (read-only) vs Revised (editable) ---- */
table.revised-table thead th.group-original {
  background: #eef1f4;
  color: #64748b;
  text-align: center;
}
table.revised-table thead th.group-revised {
  background: #fff8e6;
  color: #8a6d1a;
  text-align: center;
}
table.revised-table td.orig-col,
table.revised-table th.orig-col {
  background: #f4f6f8;
  color: #64748b;
  text-align: right;
  padding-right: 10px;
  font-variant-numeric: tabular-nums;
  border-right: 2px solid #d7dfe9;
}
table.revised-table tfoot td.orig-col {
  background: #e2e7ec;
  font-weight: 700;
}

/* ---- Sidebar section labels (Reports / Settings groupings) ---- */
.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7d8fac;
  font-weight: 700;
  margin: 16px 20px 4px;
}
.sidebar-nav .sidebar-section-label:first-child { margin-top: 4px; }

/* ---- Simple modal overlay (Board Master add/edit forms) ---- */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11,37,69,0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px 26px; width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin-top: 0; color: var(--navy); }
.modal-close-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.master-row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.master-row-actions .btn { padding: 4px 10px; font-size: 12px; }
.master-service-line-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px;
}
.master-service-line-head {
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px;
}
.master-project-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 10px; border-top: 1px solid var(--border);
}
.master-project-row:first-of-type { border-top: none; }
.master-meta { font-size: 12px; color: var(--muted); }
