:root {
  --navy-900: #0d253f;
  --navy-800: #163a5f;
  --navy-700: #1e4d7b;
  --primary: #1a5fb4;
  --primary-hover: #154c91;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --border: #dce3ec;
  --border-strong: #c3cfde;
  --text: #1e293b;
  --text-muted: #64748b;
  --pos: #c92a2a;
  --pos-bg: #fff5f5;
  --neg: #0ca678;
  --neg-bg: #e6fcf5;
  --warn: #d97706;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(15, 37, 63, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 37, 63, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#appView:not(.hidden) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ---------- Login Screen ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  padding: 34px 32px 30px;
}

.login-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: #e8f1fc;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 21px;
  color: var(--navy-900);
}

.login-sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Forms & Buttons ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: #fff;
  border-color: var(--border-strong);
  color: #334155;
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: #fff5f5;
  border-color: #ffc9c9;
  color: #c92a2a;
}
.btn-danger:hover {
  background: #ffe3e3;
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(90deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: #fff;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
}

.brand-area {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-menu-btn {
  display: none;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12.5px;
}

.role-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 700;
}
.role-admin { background: #ffd43b; color: #1e293b; }
.role-editor { background: #63e6be; color: #0b4f3a; }
.role-viewer { background: #d0ebff; color: #1864ab; }

/* ---------- Main Container & Tabs ---------- */
.container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 10px 18px 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tab-group {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
  overflow-x: auto;
  max-width: 100%;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn.active {
  background: #fff;
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
}

/* ---------- KPI Strip ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.kpi-val {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy-900);
}

.kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.val-pos { color: var(--pos) !important; }
.val-neg { color: var(--neg) !important; }

/* ---------- Filter Bar ---------- */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.mobile-quick-bar {
  display: none;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-row + .filter-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-item label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.filter-item input,
.filter-item select {
  width: auto;
  padding: 6px 9px;
  font-size: 13px;
}

.search-box {
  flex: 1;
  min-width: 240px;
}
.search-box input {
  width: 100%;
}

/* ---------- Desktop Data Table ---------- */
.legend-bar {
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-city {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
}

.kpi-city-label {
  font-weight: 700;
  color: var(--navy-900);
}

.kpi-grid {
  flex-shrink: 0;
}

.filter-panel {
  flex-shrink: 0;
}

.sheet-tabs {
  flex-shrink: 0;
}

.data-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

table.budget-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.budget-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 8px 9px;
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.budget-table thead tr.sub-hdr th {
  top: 35px;
  z-index: 4;
  background: #f8fafc;
  font-size: 12px;
  padding: 6px 8px;
}

.budget-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.budget-table thead th.sortable:hover {
  background: #e2e8f0;
}

.budget-table tbody td {
  padding: 7px 9px;
  border-bottom: 1px solid #edf2f7;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
}

.budget-table tbody tr:hover td {
  background-color: #f0f7ff;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.code-col {
  text-align: center;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 12.5px;
  color: #475569;
  white-space: nowrap;
}

/* Frozen leading columns */
.budget-table thead th.sticky-col,
.budget-table tbody td.sticky-col {
  position: sticky;
  background: #fff;
}

.budget-table thead th.sticky-col {
  z-index: 8;
  background: #f1f5f9;
}

.budget-table thead tr.sub-hdr th {
  /* keep second header row sticky below first */
}

.budget-table tbody td.sticky-col {
  z-index: 3;
}

.budget-table tbody tr:hover td.sticky-col {
  background-color: #f0f7ff;
}

tr.lvl-none td.sticky-col { background: #e6eef8; }
tr.lvl-1 td.sticky-col { background: #eef4fb; }
tr.lvl-2 td.sticky-col { background: #f6f9fc; }
tr.lvl-3 td.sticky-col { background: #fbfcfe; }

.col-row {
  left: 0;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}
.has-action .col-act {
  left: 52px;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  text-align: center;
}
.has-action .col-keshi { left: 120px; }
.budget-table:not(.has-action) .col-keshi { left: 52px; }
.col-keshi {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}
.has-action .col-proj { left: 208px; }
.budget-table:not(.has-action) .col-proj { left: 140px; }
.col-proj {
  width: 240px;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 4px 0 8px rgba(15, 37, 63, 0.08);
  text-align: left !important;
}

/* Tree view frozen unit name sits where 科室 is */
.has-action .col-tree-unit { left: 120px; }
.budget-table:not(.has-action) .col-tree-unit { left: 52px; }
.col-tree-unit {
  width: 200px;
  min-width: 180px;
  max-width: 240px;
  text-align: left !important;
}
.has-action .col-tree-proj { left: 320px; }
.budget-table:not(.has-action) .col-tree-proj { left: 252px; }
.col-tree-proj {
  width: 200px;
  min-width: 180px;
  max-width: 240px;
  box-shadow: 4px 0 8px rgba(15, 37, 63, 0.08);
  text-align: left !important;
}

td.col-proj, td.col-unit, td.col-tree-unit, td.col-tree-proj, td.col-keshi {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.col-unit {
  width: 200px;
  max-width: 240px;
  min-width: 160px;
}

.y26-readonly,
input[readonly].y26-readonly {
  background: #eef1f5;
  color: #475569;
  cursor: default;
}

.y26-lock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: #334155;
}

.y26-lock-note {
  font-weight: 600;
}

.y26-unlock-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

/* Tree Hierarchy Row Styles */
tr.lvl-none td {
  background: #e6eef8;
  font-weight: 700;
  color: var(--navy-900);
}
tr.lvl-1 td {
  background: #eef4fb;
  font-weight: 700;
  color: #153e75;
}
tr.lvl-2 td {
  background: #f6f9fc;
  font-weight: 700;
}
tr.lvl-3 td {
  background: #fbfcfe;
  font-weight: 600;
  color: #334155;
}

.tree-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tree-arrow {
  display: inline-block;
  width: 14px;
  font-size: 11px;
  color: var(--primary);
  text-align: center;
}

.badge-new {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  background: #fff3bf;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 4px;
}

.remark-cell {
  max-width: 280px;
  cursor: pointer;
  color: #475569;
}
.remark-cell .clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.remark-cell.expanded .clamp {
  display: block;
  white-space: pre-wrap;
}

/* ---------- Mobile Card List View ---------- */
.mobile-cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  box-shadow: var(--shadow-sm);
}

.m-card-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.m-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.35;
}

.m-card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 9px;
  font-size: 12px;
  color: var(--text-muted);
}

.m-tag {
  display: inline-block;
  background: #eef2f6;
  color: #334155;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.m-tag-blue {
  background: #e8f1fc;
  color: var(--primary);
}

.m-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 8px 9px;
  font-variant-numeric: tabular-nums;
}

.m-metric-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.m-metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.m-metric-sub {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 1px;
}

.m-remark {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
}
.m-remark .clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-remark.expanded .clamp {
  display: block;
  white-space: pre-wrap;
}

/* Mobile Tree Card Item */
.m-tree-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.m-tree-item.lvl-none {
  background: #e6eef8;
  border-color: #b8d0ec;
}
.m-tree-item.lvl-1 {
  border-left: 4px solid var(--navy-800);
  background: #f2f7fd;
}
.m-tree-item.lvl-2 {
  border-left: 4px solid var(--primary);
  margin-left: 8px;
}
.m-tree-item.lvl-3 {
  border-left: 3px solid #64748b;
  margin-left: 16px;
}
.m-tree-item.lvl-4 {
  border-left: 2px solid #cbd5e1;
  margin-left: 22px;
}

/* Sort Chips on Mobile */
.sort-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-top: 8px;
}
.sort-chip {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  cursor: pointer;
}
.sort-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Pagination Bar */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.mobile-cards-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.pager-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg {
  max-width: 960px;
}

.modal-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--navy-900);
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.calc-preview {
  background: #f1f5f9;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.scope-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  max-height: 190px;
  overflow-y: auto;
}

.scope-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  left: 22px;
  max-width: 420px;
  margin-left: auto;
  z-index: 300;
  background: var(--navy-900);
  color: #fff;
  padding: 11px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
}
.toast.error {
  background: #c92a2a;
}

/* ======================================================
   移动端专属响应式布局 (手机微信 / Safari / 安卓浏览器)
   ====================================================== */
@media (max-width: 820px) {
  .topbar {
    padding: 10px 12px;
  }
  .brand-title {
    font-size: 15.5px;
  }
  .brand-meta {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .topbar-actions {
    display: none;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }
  .topbar-actions.mobile-open {
    display: flex;
  }

  .container {
    padding: 8px 10px 0;
  }

  /* 2x2 紧凑指标宫格 */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .kpi-card {
    padding: 9px 11px;
  }
  .kpi-label {
    font-size: 11px;
  }
  .kpi-val {
    font-size: 16.5px;
  }
  .kpi-sub {
    font-size: 10.5px;
  }

  /* 手机端折叠筛选栏 + 快捷搜索排序条 */
  .mobile-quick-bar {
    display: block;
  }
  .desktop-filters-body.mobile-collapsed {
    display: none;
  }
  .desktop-filters-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
  }
  .filter-item {
    width: 100%;
  }
  .filter-item label {
    width: 72px;
    flex-shrink: 0;
  }
  .filter-item input,
  .filter-item select {
    flex: 1;
    width: 100%;
  }
  #sortHint {
    display: none;
  }

  /* 防 iOS Safari 点击输入框自动放大页面 */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }

  /* 底部抽屉式弹窗 */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
  .modal-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .form-group[style*="span 2"] {
    grid-column: span 1 !important;
  }
}


/* ---------- Print ---------- */
@media print {
  html, body, #appView, #appView:not(.hidden), .container, .data-stage, .table-card, .table-scroll, .mobile-cards-wrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    box-shadow: none !important;
  }
  .topbar,
  .sheet-tabs,
  .filter-panel,
  .table-footer,
  .modal-backdrop,
  .toast,
  .mobile-menu-btn,
  #layoutModeGroup,
  .btn,
  .pager-btns {
    display: none !important;
  }
  .legend-bar,
  .kpi-city,
  .kpi-grid {
    break-inside: avoid;
    box-shadow: none;
  }
  .budget-table thead th,
  .budget-table thead th.sticky-col,
  .budget-table tbody td.sticky-col {
    position: static !important;
    box-shadow: none !important;
  }
  .table-card {
    border: none;
  }
  body {
    background: #fff;
  }
}
