:root {
  color-scheme: light;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e6ee;
  --border-strong: #c7cedb;

  --text: #1a2233;
  --muted: #6b7280;
  --muted-2: #94a0b4;

  --primary: #4f6df5;
  --primary-hover: #3d59e0;
  --primary-soft: #eef1ff;

  --danger: #e5484d;
  --danger-soft: #fdecec;
  --success: #16a34a;
  --success-soft: #ecfdf3;

  --water: #2f9bda;
  --electric: #e0a72b;
  --gas: #e0672b;

  --chart-series-1: #2a78d6;
  --chart-series-2: #eb6834;
  --chart-series-3: #1baf7a;
  --chart-series-4: #eda100;
  --chart-series-5: #e87ba4;
  --chart-series-6: #008300;
  --chart-series-7: #4a3aa7;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 2px 8px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  font-family: "Segoe UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #12141c;
    --surface: #1a1d29;
    --surface-alt: #20232f;
    --border: #2c3040;
    --border-strong: #3a3f52;

    --text: #e7e9f0;
    --muted: #9aa2b6;
    --muted-2: #6d7590;

    --primary: #7c8dff;
    --primary-hover: #94a2ff;
    --primary-soft: #232748;

    --danger: #f27272;
    --danger-soft: #3a2027;
    --success: #4ade80;
    --success-soft: #16281f;

    --chart-series-1: #3987e5;
    --chart-series-2: #d95926;
    --chart-series-3: #199e70;
    --chart-series-4: #c98500;
    --chart-series-5: #d55181;
    --chart-series-6: #008300;
    --chart-series-7: #9085e9;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--primary-soft), transparent),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- shell */

.app-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  flex: none;
  width: 232px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width 0.15s ease, padding 0.15s ease;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-alt);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* ---------------------------------------------------------------- sidebar collapse */

.sidebar-toggle {
  appearance: none;
  position: fixed;
  top: 24px;
  left: 232px;
  transform: translateX(-50%);
  z-index: 30;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: left 0.15s ease, background 0.12s ease, color 0.12s ease;
}

.sidebar-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  left: 64px;
}

.app-shell.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .sidebar {
  width: 64px;
  padding-left: 12px;
  padding-right: 12px;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

h1 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-spacer {
  height: 14px;
}

.nav-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-item.highlight {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

.nav-item.highlight:hover {
  background: var(--primary-hover);
  color: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logout-item {
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding-top: 14px;
}

.logout-item:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  padding: 24px 28px 56px;
}

.panel[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  background: rgba(15, 18, 28, 0.55);
  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  position: relative;
  width: min(1200px, 94vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  animation: modal-in 0.16s ease;
}

.modal-close {
  appearance: none;
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------------------------------------------------------- cards */

.table-section {
  margin-bottom: 20px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

/* ---------------------------------------------------------------- welcome panel */

.welcome-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 28px;
}

.welcome-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: var(--surface-alt);
  box-shadow: var(--shadow-sm);
}

.welcome-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.welcome-text {
  text-align: left;
}

.welcome-card h2 {
  font-size: 1.1rem;
  margin: 0;
}

.welcome-card .hint {
  margin: 2px 0 0;
}

.welcome-actions {
  display: flex;
  gap: 12px;
  flex: none;
  margin-left: 12px;
}

.missing-card {
  width: 100%;
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px;
  text-align: left;
}

.missing-buildings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.missing-building-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 10px;
}

.missing-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 2px 9px;
  border-radius: 999px;
}

.missing-count.all-done {
  color: var(--success);
  background: var(--success-soft);
}

.missing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.missing-floor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.missing-chip {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.missing-chip.chip-missing {
  background: var(--danger-soft);
  color: var(--danger);
}

.missing-chip.chip-done {
  background: var(--success-soft);
  color: var(--success);
}

.section-heading .hint {
  font-size: 0.76rem;
  color: var(--muted-2);
}

/* ---------------------------------------------------------------- forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px 16px;
}

.form-grid label, .filters label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  gap: 6px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover, select:hover, textarea:hover {
  border-color: var(--muted-2);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

input[readonly] {
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 600;
}

/* charge groups (water / electric / gas) */

.charge-groups {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.charge-group {
  /* <fieldset> defaults to a content-based min-inline-size in every
     browser, which ignores the grid track width and forces this column
     (and everything to its right) to blow out past the page edge. */
  min-width: 0;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  background: var(--surface-alt);
  border-left: 3px solid var(--border-strong);
}

.charge-group[data-prefix^="water"] { border-left-color: var(--water); }
.charge-group[data-prefix^="electric"] { border-left-color: var(--electric); }
.charge-group[data-prefix^="gas"] { border-left-color: var(--gas); }

.charge-group legend {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 4px;
  color: var(--text);
}

.charge-fields {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.charge-fields label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted-2);
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.charge-fields input {
  padding: 7px 8px;
  font-size: 0.82rem;
}

.other-charges {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.total-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius);
}

.total-row label { color: var(--text); }

#total {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary);
  background: var(--surface);
}

#total_chinese {
  font-weight: 600;
  background: var(--surface);
}

/* ---------------------------------------------------------------- buttons */

.actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn svg { width: 15px; height: 15px; flex: none; }

.btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

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

.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong));
}

.btn.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

/* ---------------------------------------------------------------- filters */

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.filters select {
  min-width: 140px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.82rem;
}

th, td {
  padding: 7px 8px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

th:first-child, td:first-child { padding-left: 10px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt);
  font-weight: 700;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
}

thead th[data-sort] {
  cursor: pointer;
  user-select: none;
}

thead th[data-sort]:hover {
  color: var(--primary);
}

/* Always show a sort indicator so it's clear a column is sortable, not
   just after the user has already clicked one. */
thead th[data-sort]::after {
  content: " \21C5";
  display: inline-block;
  margin-left: 2px;
  font-size: 0.68rem;
  opacity: 0.35;
}

thead th[data-sort]:hover::after {
  opacity: 0.7;
}

thead th[data-sort].sort-asc::after {
  content: " \25B2";
  font-size: 0.62rem;
  opacity: 1;
  color: var(--primary);
}

thead th[data-sort].sort-desc::after {
  content: " \25BC";
  font-size: 0.62rem;
  opacity: 1;
  color: var(--primary);
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-alt) 60%, transparent);
}

tbody tr:hover {
  background: var(--primary-soft);
}

tbody tr:last-child td {
  border-bottom: none;
}

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------------- pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination-info {
  font-size: 0.78rem;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-controls .btn svg {
  width: 14px;
  height: 14px;
}

.pagination-controls .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-controls .btn:disabled:hover {
  border-color: transparent;
  background: transparent;
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

#pagination_page_select {
  width: auto;
  min-width: 46px;
  padding: 3px 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------------------------------------------------------------- status toast */

.status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  padding: 14px 22px;
  border-radius: var(--radius);
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease;
  pointer-events: none;
}

.status:empty {
  display: none;
}

.status.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------------------------------------------------------------- confirm dialog */

#confirm-dialog .modal-box,
#dashboard-unlock-modal .modal-box {
  width: min(420px, 92vw);
  text-align: center;
}

#dashboard-unlock-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

#dashboard-unlock-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

#confirm-message {
  margin: 4px 0 20px;
  font-size: 0.92rem;
  color: var(--text);
}

#confirm-dialog .actions {
  justify-content: center;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

#print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0;
}

/* ---------------------------------------------------------------- settings */

.settings-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}

.settings-card textarea {
  resize: vertical;
}

/* ---------------------------------------------------------------- login */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  text-align: center;
}

.login-brand .brand-mark {
  width: 48px;
  height: 48px;
}

.login-brand .brand-mark img {
  width: 30px;
  height: 30px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

#login-form input {
  font-size: 1rem;
  padding: 12px 14px;
}

#login_submit_btn {
  justify-content: center;
  margin-top: 8px;
  padding: 11px 16px;
  font-size: 0.98rem;
}

.login-status {
  min-height: 1.2em;
  margin-top: 14px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-status.error {
  color: var(--danger);
}

/* ---------------------------------------------------------------- dashboard */

.nav-lock {
  width: 13px;
  height: 13px;
  margin-left: auto;
  flex: none;
  color: var(--muted-2);
}

.nav-item.unlocked .nav-lock {
  display: none;
}

.dash-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
}

.dash-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.dash-filters select,
.dash-filters input {
  width: auto;
}

.dash-presets {
  display: flex;
  gap: 8px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.chart-card h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
}

.chart-svg-wrap {
  width: 100%;
}

.chart-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.chart-bar {
  transition: opacity 0.1s ease;
  cursor: pointer;
}

.chart-bar:hover,
.chart-bar:focus-visible {
  opacity: 0.82;
  outline: none;
}

.chart-axis-text {
  font-size: 10px;
  fill: var(--muted);
}

.chart-value-text {
  font-size: 10px;
  fill: var(--text);
  font-weight: 600;
}

.chart-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 10px;
  font-size: 0.78rem;
  max-width: 220px;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip .tt-label {
  color: var(--muted);
  margin-bottom: 2px;
}

.chart-tooltip .tt-value {
  color: var(--text);
  font-weight: 700;
}

.chart-table-toggle {
  margin-top: 12px;
}

.chart-table-toggle summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

.chart-table {
  width: 100%;
  margin-top: 10px;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.chart-table th, .chart-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.chart-table td:last-child, .chart-table th:last-child {
  text-align: right;
}

/* ---------------------------------------------------------------- misc */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-width: 860px) {
  .form-grid, .charge-groups, .charge-fields, .other-charges {
    grid-template-columns: 1fr 1fr;
  }
}
