:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --brand: #163b65;
  --brand-soft: rgba(29, 78, 216, 0.08);
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f8fafc;
  --border-soft: #cbd5e1;
  --border-strong: #64748b;
  --focus-ring: #1d4ed8;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(248,250,252,.98), rgba(248,250,252,.98)),
    var(--bg);
}

.app-bg { min-height: 100vh; }
.app-card {
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(249,250,251,.9));
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.shadow-soft { box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255,255,255,.7);
  padding: .4rem .75rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-chip, .btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  border-radius: 999px;
  padding: .88rem 1.1rem;
  font-size: .95rem;
  font-weight: 700;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
  text-decoration: none;
  cursor: pointer;
}

.nav-chip:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.nav-surface {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  width: 100%;
  padding: .7rem;
  border-radius: 1.35rem;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.68);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 10px 24px rgba(15, 23, 42, 0.04);
}

.nav-chip {
  border: 1px solid rgba(148, 163, 184, .24);
  background: rgba(255,255,255,.8);
  color: #334155;
  min-height: 2.85rem;
  justify-content: center;
  width: 100%;
  padding-inline: 1rem;
  text-align: center;
  line-height: 1.15;
}

.nav-chip span {
  line-height: 1;
}

.nav-chip i {
  width: 1rem;
  text-align: center;
}
.nav-chip:hover,
.btn-secondary:hover,
.btn-primary:hover,
.btn-danger:hover { transform: translateY(-1px); }
.nav-chip-active {
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(29, 78, 216, 0.22), inset 0 0 0 1px rgba(255,255,255,.14);
}

.nav-chip[aria-current="page"] { position: relative; }

.nav-chip[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset: auto 1rem .28rem 1rem;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
}

.btn-primary {
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  color: white;
  border: 1px solid transparent;
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.22);
}
.btn-primary:hover { filter: brightness(1.02); }
.btn-primary:disabled {
  opacity: .72;
  cursor: progress;
  transform: none;
}
.btn-secondary {
  background: white;
  color: #334155;
  border: 1px solid rgba(148, 163, 184, .3);
}
.btn-secondary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (min-width: 640px) {
  .nav-surface { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .nav-surface {
    display: flex;
    width: auto;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: .65rem;
  }

  .nav-chip {
    width: auto;
    white-space: nowrap;
  }
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  outline: none;
  border-radius: 0 0 1.25rem 1.25rem;
}

.table-scroll > table {
  width: 100%;
}

.table-scroll:focus-visible,
.table-scroll:focus-within {
  box-shadow: inset 0 0 0 2px rgba(37,99,235,.18);
}

.table-scroll table {
  min-width: 0;
}

.data-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.batch-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.snapshot-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.summary-band-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.data-table thead th,
.data-table tbody td {
  font-size: .93rem;
}

.data-table thead th.col-id,
.data-table tbody td.col-id {
  white-space: nowrap;
}

.data-table thead th.col-name,
.data-table tbody td.col-name,
.data-table thead th.col-div,
.data-table tbody td.col-div {
  min-width: 170px;
}

.batch-table thead th,
.batch-table tbody td,
.snapshot-table thead th,
.snapshot-table tbody td,
.summary-band-table thead th,
.summary-band-table tbody td {
  padding: .8rem .85rem;
  vertical-align: top;
}

.batch-table thead th,
.snapshot-table thead th,
.summary-band-table thead th,
.agency-table thead th {
  font-size: .7rem;
  letter-spacing: .12em;
}

.app-table thead th:first-child {
  border-top-left-radius: 1rem;
}

.app-table thead th:last-child {
  border-top-right-radius: 1rem;
}

.app-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 1rem;
}

.app-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 1rem;
}

.batch-table tbody tr,
.snapshot-table tbody tr,
.summary-band-table tbody tr,
.agency-table tbody tr {
  transition: background-color .16s ease;
}

.batch-table tbody tr:hover,
.snapshot-table tbody tr:hover,
.summary-band-table tbody tr:hover,
.agency-table tbody tr:hover {
  background: rgba(248,250,252,.85);
}

.batch-table .col-date { width: 160px; }
.batch-table .col-agency { width: 120px; }
.batch-table .col-status { width: 102px; }
.batch-table .col-day { width: 84px; }
.batch-table .col-files { width: 22%; }
.batch-table .col-totals { width: 16%; }
.batch-table .col-notes { width: auto; }
.batch-table .col-action { width: 200px; }

.batch-table .col-action,
.batch-table .col-files,
.batch-table .col-notes {
  min-width: 0;
}

.batch-table .col-files .table-clip > span {
  max-width: 100%;
}

.batch-table .col-notes .stack-tight p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-table .col-notes {
  font-size: .82rem;
}

.batch-table .col-totals {
  white-space: nowrap;
}

.batch-table .stat-label {
  font-size: .62rem;
}

.batch-delete-card {
  display: grid;
  gap: .65rem;
  padding: .75rem;
  border: 1px solid rgba(251, 113, 133, .22);
  border-radius: 1rem;
  background: rgba(255, 241, 242, .6);
}

.batch-password-field::placeholder {
  color: #9f1239;
  opacity: .7;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border-radius: 999px;
  padding: .78rem 1rem;
  font-size: .9rem;
  font-weight: 700;
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid rgba(244,63,94,.25);
  box-shadow: 0 10px 18px rgba(244,63,94,.08);
  transition: transform .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
  text-decoration: none;
  cursor: pointer;
}

.btn-danger:hover {
  transform: translateY(-1px);
  background: #ffe4e6;
  border-color: rgba(244,63,94,.35);
}

.btn-danger:focus-visible {
  outline: 3px solid rgba(244,63,94,.22);
  outline-offset: 2px;
}

.snapshot-table .col-id { width: 9%; }
.snapshot-table .col-name { width: 14%; }
.snapshot-table .col-div { width: 18%; }
.snapshot-table .col-div .flex {
  min-width: 0;
}
.snapshot-table tbody td.col-name .cell-clip { max-width: 100%; }
.snapshot-table tbody td.col-id,
.snapshot-table tbody td.col-money { white-space: nowrap; }
.snapshot-table tbody td.col-div { min-width: 0; }

.summary-band-table .col-name { width: auto; }
.summary-band-table .col-id { width: 11%; }
.summary-band-table .col-money { width: 18%; }
.summary-band-table .col-name .summary-link {
  max-width: 100%;
  min-width: 0;
}

.agency-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.agency-table .col-code { width: 100px; }
.agency-table .col-name { width: auto; }
.agency-table .col-status { width: 120px; }

.agency-table .col-name strong,
.agency-table .col-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-tight {
  display: grid;
  gap: .35rem;
}

.stack-tight p {
  margin: 0;
}

.table-clip {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}

.table-clip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-clip > i {
  flex: 0 0 auto;
}

.batch-table .stat-label,
.snapshot-table .stat-label,
.summary-band-table .stat-label {
  font-size: .66rem;
}

.batch-list {
  display: grid;
}

.batch-card {
  position: relative;
  transition: background-color .16s ease, box-shadow .16s ease;
}

.batch-card:hover {
  background: rgba(248,250,252,.78);
}

.batch-card-error {
  background: linear-gradient(90deg, rgba(254,242,242,.55), rgba(255,255,255,0) 45%);
}

.batch-card-warning {
  background: linear-gradient(90deg, rgba(255,251,235,.65), rgba(255,255,255,0) 45%);
}

.batch-pill {
  max-width: 100%;
}

.batch-file {
  min-width: 0;
}

.batch-file span {
  min-width: 0;
}

.batch-stat {
  padding: .55rem .65rem;
  border-radius: .85rem;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(255,255,255,.72);
}

.batch-stat strong {
  display: block;
  margin-top: .15rem;
  font-size: .95rem;
  line-height: 1.05;
}

.batch-actions {
  min-width: 10rem;
}

.batch-delete-trigger {
  min-height: 2.55rem;
}

.batch-delete-panel {
  max-width: 46rem;
}

.batch-notes p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.contacts-table thead th,
.contacts-table tbody td {
  font-size: .8rem;
  padding: .55rem .6rem;
}

.contacts-table-compact {
  min-width: 0;
}

.contacts-table-compact thead th,
.contacts-table-compact tbody td {
  padding: .5rem .55rem;
  font-size: .76rem;
}

.contacts-table .col-name {
  min-width: 0;
}

.contacts-table .col-id {
  min-width: 0;
}

.contract-copy {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: 100%;
  border-radius: 999px;
  padding: .22rem .45rem;
  color: #0f172a;
  font-weight: 800;
  font-size: .82rem;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.contract-copy:hover {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #bfdbfe;
  transform: translateY(-1px);
}

.contract-copy:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.contract-copy i {
  color: #64748b;
  font-size: .78rem;
}

.contract-copy small {
  color: #166534;
  font-size: .68rem;
  font-weight: 800;
}

.contacts-table .col-div {
  min-width: 0;
}

.contacts-table .col-id,
.contacts-table .col-money,
.contacts-table .col-div {
  vertical-align: middle;
}

.contacts-table .col-id,
.contacts-table .col-money,
.contacts-table .col-div {
  vertical-align: middle;
}

.data-table tbody td.col-name .cell-clip {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

.contacts-table tbody td.col-name .cell-clip {
  max-width: 100%;
  display: block;
}

.data-table thead th.col-money,
.data-table tbody td.col-money {
  min-width: 145px;
  background: rgba(248, 250, 252, 0.45);
}

.contacts-table thead th.col-money,
.contacts-table tbody td.col-money {
  min-width: 0;
  width: 102px;
}

.contacts-table thead th.col-id,
.contacts-table tbody td.col-id {
  width: 84px;
}

.contacts-table thead th.col-name,
.contacts-table tbody td.col-name {
  width: 120px;
}

.contacts-table thead th.col-div,
.contacts-table tbody td.col-div {
  width: 132px;
}

.contacts-table .pill {
  padding: .18rem .45rem;
  font-size: .66rem;
}

.contacts-table thead th {
  font-size: .64rem;
}

.contacts-table tbody td {
  line-height: 1.2;
}

.contacts-table tbody td.col-name .cell-clip,
.contacts-table tbody td.col-name .cell-clip,
.contacts-table tbody td.col-id,
.contacts-table tbody td.col-money,
.contacts-table tbody td.col-div {
  overflow: hidden;
  text-overflow: ellipsis;
}

.contacts-table .contract-copy {
  max-width: 100%;
}

.contacts-table .contract-copy span {
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-table .col-name .cell-clip {
  max-width: 100%;
  display: block;
}

.contacts-table .col-name {
  width: 120px;
}

.contacts-table .col-id {
  width: 84px;
}

.contacts-table .col-money {
  width: 102px;
}

.contacts-table .col-div {
  width: 132px;
}

.contacts-table tbody tr td:first-child {
  position: relative;
}

.contacts-table tbody td,
.agency-table tbody td,
.batch-table tbody td,
.snapshot-table tbody td,
.summary-band-table tbody td {
  border-bottom-color: rgba(226,232,240,.75);
}

.data-table thead th.col-money {
  background: rgba(241, 245, 249, 0.96);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(248,250,252,.55);
}

.row-alt { background: rgba(248,250,252,.48); }

.data-table tbody tr:hover .col-money {
  background: rgba(239, 246, 255, .7);
}

.arrears-table tfoot th,
.arrears-table tfoot td {
  padding: 1rem 1.15rem;
  border-top: 1px solid rgba(226,232,240,.9);
  font-size: .95rem;
}

.arrears-table tfoot th {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  color: #475569;
}

.app-table tfoot th,
.app-table tfoot td {
  padding: 1rem 1.15rem;
  border-top: 1px solid rgba(226,232,240,.9);
  vertical-align: top;
}

.app-table tfoot th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #475569;
}

.summary-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.summary-link:hover { text-decoration: underline; }

.flash {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.flash i { margin-top: .1rem; }
.flash-success { border-color: rgba(34,197,94,.25); color: #166534; }
.flash-error { border-color: rgba(244,63,94,.25); color: #9f1239; }
.flash-warning { border-color: rgba(245,158,11,.25); color: #92400e; }

.status-tile, .metric-card, .note-box {
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.8);
  border-radius: 1.25rem;
}
.status-tile {
  min-width: 10rem;
  padding: 1rem 1.1rem;
  display: grid;
  gap: .2rem;
  justify-items: start;
}
.status-label, .stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
}
.status-tile strong { font-size: 2rem; line-height: 1; }

.metric-card {
  padding: .9rem 1rem;
  display: grid;
  gap: .2rem;
}
.metric-card span { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.metric-card strong { font-size: 1.35rem; line-height: 1.1; color: var(--text); }

.upload-field { display: grid; gap: .5rem; }
.field-label { font-weight: 700; color: #0f172a; display: inline-flex; align-items: center; gap: .5rem; }
.field-meta { font-size: .78rem; color: var(--muted); }
.field-help, .field-error { font-size: .85rem; line-height: 1.5; }
.field-help { color: var(--muted); }
.field-error { color: var(--danger); }

.file-dropzone {
  display: grid;
  gap: .9rem;
  padding: 1rem;
  border-radius: 1.25rem;
  border: 1px dashed rgba(100,116,139,.35);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.94));
  cursor: pointer;
}
.file-dropzone:hover { border-color: rgba(37,99,235,.45); background: linear-gradient(180deg, rgba(239,246,255,.94), rgba(255,255,255,.98)); }
.file-dropzone:focus-within {
  box-shadow: 0 0 0 4px var(--focus-ring);
  border-color: rgba(37,99,235,.45);
}
.dropzone-copy { display: flex; gap: .9rem; align-items: flex-start; }
.dropzone-copy > i { font-size: 1.15rem; color: var(--brand); margin-top: .15rem; }
.dropzone-title { font-weight: 700; color: #0f172a; }
.dropzone-help { margin-top: .15rem; font-size: .88rem; color: var(--muted); }
.dropzone-file { font-size: .85rem; font-weight: 600; color: #334155; padding-top: .2rem; border-top: 1px solid rgba(148,163,184,.15); }

.check-item { display: flex; gap: .6rem; align-items: flex-start; }
.check-item i { color: var(--success); margin-top: .22rem; }
.note-box {
  padding: 1rem;
  display: grid;
  gap: .25rem;
  color: #334155;
}
.note-box strong { color: #0f172a; }

.empty-state {
  display: grid;
  place-items: center;
  gap: .9rem;
  text-align: center;
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
}

.agency-hero {
  position: relative;
}

.agency-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 -1.2rem 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,.35), transparent);
}

.agency-grid {
  display: grid;
  gap: 1rem;
}

.agency-card {
  padding: 1.15rem;
  display: grid;
  gap: 1rem;
}

.agency-card-top {
  display: grid;
  gap: 1rem;
}

.agency-card-id {
  display: grid;
  gap: .65rem;
}

.agency-card-status {
  display: grid;
  gap: .45rem;
  padding: .95rem 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.82));
}

.agency-card-actions {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.agency-delete-shell {
  display: grid;
  gap: .75rem;
}

.agency-delete-panel {
  display: grid;
  gap: .9rem;
  padding: 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(244,63,94,.18);
  background: linear-gradient(180deg, rgba(255,241,242,.72), rgba(255,255,255,.92));
}

.agency-delete-form {
  display: grid;
  gap: .9rem;
}

.agency-delete-copy {
  display: grid;
  gap: .25rem;
}

.agency-delete-lock {
  border-color: rgba(251,191,36,.22);
  background: linear-gradient(180deg, rgba(255,251,235,.85), rgba(255,255,255,.88));
}

.agency-password-card {
  display: grid;
  gap: .85rem;
  padding: 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(248,250,252,.92), rgba(255,255,255,.84));
}

.agency-password-copy {
  display: grid;
  gap: .25rem;
}

.agency-form-hero {
  position: relative;
}

.agency-form-grid {
  display: grid;
  gap: 1rem;
}

.empty-state-card {
  overflow: hidden;
}

.agency-table thead th,
.agency-table tbody td {
  padding: .95rem 1.1rem;
}

.agency-table tbody tr:hover {
  background: rgba(248,250,252,.85);
}

.agency-table .pill {
  padding-inline: .55rem;
}

@media (min-width: 640px) {
  .agency-card {
    padding: 1.35rem;
  }

  .agency-card-actions {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .agency-delete-shell {
    width: 100%;
    max-width: 28rem;
    margin-left: auto;
  }

  .agency-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .agency-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agency-card-top {
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, .9fr);
    align-items: start;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.pill-success { background: #ecfdf5; color: #166534; }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: #fff1f2; color: var(--danger); }
.pill-neutral { background: #f1f5f9; color: #334155; }

.money-positive {
  color: #15803d !important;
  font-weight: 800;
}

.money-negative {
  color: #dc2626 !important;
  font-weight: 800;
}

.money-neutral {
  color: #334155;
}

.app-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.app-table thead th {
  position: sticky; top: 0;
  z-index: 1;
  background: rgba(248, 250, 252, .96);
  border-bottom: 1px solid var(--line);
  color: #475569;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  text-align: left;
  padding: 1rem 1.15rem;
  white-space: nowrap;
}
.app-table tbody td {
  border-bottom: 1px solid rgba(226,232,240,.8);
  padding: 1rem 1.15rem;
  vertical-align: top;
}
.app-table tbody tr:hover { background: rgba(248,250,252,.8); }
.app-table-tight tbody td { padding-top: .9rem; padding-bottom: .9rem; }
.row-warning { background: linear-gradient(90deg, rgba(255,247,237,.7), rgba(255,255,255,0)); }

.tabular-nums { font-variant-numeric: tabular-nums; }

[x-cloak] { display: none !important; }

@media (max-width: 1024px) {
  .app-table thead th { top: 74px; }
}

/* UX pass: denser financial dashboard, clearer tables and compact mobile nav */
.hero-card,
.filter-shell,
.table-shell {
  overflow: hidden;
}

.hero-card {
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto 1.25rem 0 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,.28), transparent);
}

.metric-band {
  display: grid;
  gap: .75rem;
}

.metric-band--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
}

.metric-card strong {
  letter-spacing: -0.02em;
}

.metric-card--compact {
  padding: .8rem .85rem;
}

.metric-card--compact strong {
  font-size: 1.1rem;
}

.meta-strip,
.table-toolbar,
.filter-shell {
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(255,255,255,.8);
  border-radius: 1.25rem;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .85rem 1rem;
  align-items: center;
}

.table-toolbar,
.filter-shell {
  padding: 1rem;
}

.filter-grid {
  display: grid;
  gap: .9rem;
}

.filter-block {
  display: grid;
  gap: .2rem;
  padding: 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.86));
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: .55rem;
}

.check-grid--months {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .check-grid--months {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.check-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .8rem .85rem;
  border-radius: 1rem;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(255,255,255,.86);
  color: #0f172a;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.check-option:hover {
  transform: translateY(-1px);
  border-color: rgba(37,99,235,.28);
  box-shadow: 0 10px 22px rgba(15,23,42,.05);
}

.check-option:focus-within {
  border-color: rgba(37,99,235,.38);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.check-option input {
  margin-top: .2rem;
  width: 1rem;
  height: 1rem;
  border-radius: .35rem;
  border-color: rgba(148,163,184,.55);
  color: var(--brand);
  flex: 0 0 auto;
}

.check-option span {
  min-width: 0;
  display: grid;
  gap: .12rem;
}

.check-option strong,
.check-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-option strong {
  font-size: .92rem;
  font-weight: 700;
}

.check-option small {
  color: var(--muted);
  font-size: .74rem;
}

.check-option--compact strong {
  font-size: .88rem;
}

.empty-mini {
  padding: .8rem .9rem;
  border-radius: .95rem;
  background: rgba(241,245,249,.85);
  color: var(--muted);
  font-size: .85rem;
}

.chart-shell {
  border: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(249,250,251,.88));
}

.chart-frame {
  overflow-x: auto;
  padding-bottom: .25rem;
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.chart-gridline {
  stroke: rgba(148,163,184,.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-axis {
  stroke: rgba(100,116,139,.45);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.chart-y-label,
.chart-x-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.chart-y-label {
  text-anchor: end;
  dominant-baseline: middle;
}

.chart-x-label {
  text-anchor: middle;
}

.chart-line {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-line-current {
  stroke: #1d4ed8;
  filter: drop-shadow(0 10px 22px rgba(29,78,216,.18));
}

.chart-line-previous {
  stroke: rgba(100,116,139,.8);
  stroke-dasharray: 7 7;
}

.chart-dot {
  stroke: white;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.chart-dot-current {
  fill: #1d4ed8;
}

.chart-dot-previous {
  fill: rgba(100,116,139,.92);
}

.chart-legend {
  display: grid;
  gap: .45rem;
  padding: .9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(255,255,255,.82);
  color: #334155;
  font-size: .82rem;
  font-weight: 700;
}

.chart-legend div {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.chart-legend-swatch {
  width: .9rem;
  height: .9rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chart-legend-swatch-current {
  background: #1d4ed8;
}

.chart-legend-swatch-previous {
  background: rgba(100,116,139,.92);
}

.chart-legend-swatch-axis {
  background: rgba(148,163,184,.55);
}

.filter-grid--dense {
  gap: .75rem;
}

.field-help--tight {
  font-size: .78rem;
  line-height: 1.35;
}

.field-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(241,245,249,.95);
  color: #334155;
  font-size: .72rem;
  font-weight: 700;
}

.table-shell {
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.table-scroll {
  position: relative;
  scrollbar-gutter: stable;
  outline: none;
  border-radius: 0 0 1.25rem 1.25rem;
}

.table-scroll::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1.1rem;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(244,247,251,.88));
  transition: opacity .18s ease;
}

.table-scroll:focus-visible,
.table-scroll:focus-within {
  box-shadow: inset 0 0 0 2px rgba(37,99,235,.18);
}

.table-scroll:focus-within::after {
  opacity: 0;
}

.app-table thead th {
  background: rgba(246,248,252,.98);
  box-shadow: inset 0 -1px 0 rgba(226,232,240,.95), 0 1px 0 rgba(255,255,255,.65);
}

.app-table thead th:first-child {
  border-top-left-radius: 1rem;
}

.app-table thead th:last-child {
  border-top-right-radius: 1rem;
}

.app-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 1rem;
}

.app-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 1rem;
}

.app-table tbody tr:hover,
.app-table tbody tr:focus-within {
  background: rgba(239,246,255,.55);
}

.app-table tbody tr:hover td,
.app-table tbody tr:focus-within td {
  border-bottom-color: rgba(191,219,254,.55);
}

.app-table tbody td.col-money,
.app-table tfoot td.col-money,
.app-table tfoot th.col-money {
  background: rgba(248,250,252,.68);
}

.app-table tbody td.text-right,
.app-table thead th.text-right,
.app-table tfoot th.text-right,
.app-table tfoot td.text-right {
  text-align: right;
}

.app-table thead th.sticky-divider,
.app-table tbody td.sticky-divider {
  box-shadow: inset -1px 0 0 rgba(226,232,240,.9);
}

.nav-surface {
  display: flex;
  gap: .55rem;
  width: 100%;
  padding: .6rem;
  border-radius: 1.35rem;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.72);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 10px 24px rgba(15, 23, 42, 0.04);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.nav-surface::-webkit-scrollbar {
  height: .45rem;
}

.nav-surface::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.45);
  border-radius: 999px;
}

.nav-chip {
  flex: 0 0 auto;
  width: auto;
  min-height: 2.55rem;
  padding: .7rem .95rem;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(148, 163, 184, .24);
  scroll-snap-align: start;
}

.nav-chip span {
  white-space: nowrap;
}

.nav-chip.nav-chip-active,
.nav-chip[aria-current="page"] {
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(29, 78, 216, 0.22), inset 0 0 0 1px rgba(255,255,255,.14);
}

@media (min-width: 640px) {
  .nav-surface {
    flex-wrap: wrap;
    justify-content: flex-end;
    overflow: visible;
  }

  .metric-band--compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .nav-surface {
    width: auto;
    min-width: min-content;
  }

  .nav-chip {
    white-space: nowrap;
  }
}

@media (max-width: 639px) {
  .hero-card,
  .table-toolbar,
  .filter-shell,
  .meta-strip {
    border-radius: 1rem;
  }

  .app-header-brand {
    align-items: center;
  }

  .app-header-brand-title {
    letter-spacing: -0.03em;
  }

  .app-header-brand-eyebrow {
    display: none;
  }

  .app-header-brand-subtitle {
    display: none;
  }

  .nav-surface {
    display: flex;
    grid-template-columns: none;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: .45rem;
    width: 100%;
    padding: .45rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .nav-chip {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 2.75rem;
    padding: .6rem .85rem;
    font-size: .82rem;
    scroll-snap-align: start;
  }

  .nav-chip i {
    font-size: .92rem;
  }

  .metric-band--compact {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card {
    padding: .75rem .8rem;
  }

  .metric-card span,
  .status-label,
  .stat-label {
    letter-spacing: .12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .nav-chip:hover,
  .btn-secondary:hover,
  .btn-primary:hover,
  .btn-danger:hover,
  .check-option:hover,
  .contract-copy:hover,
  .batch-card:hover {
    transform: none !important;
  }
}

/* Enterprise shell overrides */
.app-shell {
  display: grid;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.shell-sidebar {
  display: none;
}

.shell-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.shell-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .32);
  border: 0;
}

.shell-drawer__panel {
  position: relative;
  z-index: 1;
  width: min(88vw, 20rem);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 1rem;
  box-shadow: 0 24px 48px rgba(15, 23, 42, .14);
  overflow: auto;
}

.shell-main {
  min-width: 0;
}

.top-commandbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: .75rem 1rem;
  background: rgba(248,250,252,.94);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}

.top-commandbar__left,
.top-commandbar__right {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.breadcrumbs strong {
  color: var(--text);
  font-weight: 700;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.25rem;
  padding: 0 .75rem;
  border: 1px solid var(--border-soft);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
}

.page-shell {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.page-messages {
  display: grid;
  gap: .5rem;
}

.shell-icon-button,
.btn-primary,
.btn-secondary,
.btn-danger,
.nav-chip,
.shell-nav-item {
  min-height: 2.5rem;
  border-radius: .5rem;
}

.shell-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.shell-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.shell-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.shell-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  background: var(--brand);
  color: #fff;
  flex: 0 0 auto;
}

.shell-brand__copy {
  display: grid;
  min-width: 0;
}

.shell-brand__copy strong {
  font-size: .95rem;
  font-weight: 800;
}

.shell-brand__copy small,
.shell-nav-group__label,
.field-meta,
.field-help,
.empty-mini,
.chart-legend,
.status-label,
.stat-label,
.note-box,
.flash,
.context-chip {
  font-size: .8rem;
}

.shell-nav {
  display: grid;
  gap: 1rem;
}

.shell-nav-group {
  display: grid;
  gap: .5rem;
}

.shell-nav-group__label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
}

.shell-nav-item {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.5rem;
  padding: 0 .75rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  color: var(--text);
  text-decoration: none;
  background: transparent;
}

.shell-nav-item i {
  width: 1rem;
  text-align: center;
  color: var(--muted);
}

.shell-nav-item.is-active,
.shell-nav-item[aria-current="page"] {
  background: rgba(29, 78, 216, .08);
  border-color: rgba(29, 78, 216, .22);
  color: var(--brand);
}

.shell-nav-item.is-active i,
.shell-nav-item[aria-current="page"] i {
  color: var(--brand);
}

.shell-sidebar--collapsed {
  width: 4.5rem;
}

.shell-sidebar--collapsed .shell-sidebar__brand {
  justify-content: center;
}

.shell-sidebar--collapsed .shell-brand {
  display: none;
}

.shell-sidebar--collapsed .shell-nav-group__label,
.shell-sidebar--collapsed .shell-nav-item span {
  display: none;
}

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

.app-card,
.filter-shell,
.table-shell,
.table-toolbar,
.chart-shell,
.agency-card,
.agency-delete-panel,
.agency-delete-lock,
.agency-password-card,
.batch-delete-panel,
.batch-delete-card,
.metric-card,
.note-box,
.flash,
.filter-block,
.file-dropzone,
.empty-state-card,
.empty-mini,
.check-option,
.check-grid,
.meta-strip {
  border-radius: .75rem;
}

.app-card,
.filter-shell,
.table-shell,
.chart-shell,
.agency-card,
.agency-delete-panel,
.agency-delete-lock,
.agency-password-card,
.batch-delete-panel,
.metric-card,
.note-box,
.flash,
.filter-block,
.file-dropzone,
.check-option,
.empty-mini,
.context-chip,
.shell-nav-item,
.shell-icon-button,
.btn-primary,
.btn-secondary,
.btn-danger,
.pill {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: none;
}

.app-card {
  position: relative;
  overflow: hidden;
  padding: 1rem;
}

.hero-card,
.filter-shell,
.table-shell,
.chart-shell {
  background: var(--surface);
}

.table-toolbar,
.filter-shell {
  padding: 1rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 0 .875rem;
  font-weight: 700;
  text-decoration: none;
}

.btn-primary,
.shell-nav-item.is-active,
.shell-nav-item[aria-current="page"] {
  background: rgba(29, 78, 216, .08);
  color: var(--brand);
}

.btn-primary {
  border-color: rgba(29, 78, 216, .24);
  color: #fff;
  background: var(--focus-ring);
}

.btn-secondary,
.btn-danger {
  color: var(--text);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(185, 28, 28, .25);
  background: #fff;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.shell-icon-button:focus-visible,
.shell-nav-item:focus-visible,
.contract-copy:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.metric-card {
  padding: .75rem .875rem;
  border-radius: .75rem;
}

.metric-card span,
.field-label,
.shell-nav-group__label,
.breadcrumbs strong,
.check-option strong,
.dropzone-title,
.dropzone-help,
.note-box strong,
.flash p,
.pill {
  line-height: 1.2;
}

.metric-card span,
.status-label,
.stat-label,
.field-meta,
.field-help,
.empty-mini,
.flash,
.context-chip,
.breadcrumbs,
.shell-brand__copy small {
  color: var(--muted);
}

.metric-card strong,
.status-tile strong,
.shell-brand__copy strong,
.field-label,
.dropzone-title,
.check-option strong,
.chart-legend,
.summary-link,
.contract-copy {
  color: var(--text);
}

.metric-card strong,
.status-tile strong {
  font-size: 1rem;
  line-height: 1.15;
}

.metric-card--compact strong {
  font-size: .95rem;
}

.field-label,
.summary-link,
.contract-copy,
.shell-nav-item,
.btn-primary,
.btn-secondary,
.btn-danger {
  font-size: .875rem;
}

.upload-field {
  display: grid;
  gap: .375rem;
}

.upload-field input:not([type="file"]),
.upload-field select,
.upload-field textarea,
.filter-shell input:not([type="checkbox"]):not([type="radio"]),
.filter-shell select,
.filter-shell textarea,
.agency-delete-panel input,
.agency-password-card input,
.batch-delete-panel input {
  min-height: 2.5rem;
  padding: .625rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--text);
}

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

.field-help {
  line-height: 1.45;
}

.file-dropzone {
  padding: .75rem;
  border-style: solid;
  border-color: var(--border-strong);
}

.dropzone-copy {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.dropzone-copy > i,
.field-label i,
.shell-nav-item i,
.breadcrumbs i,
.context-chip i {
  color: var(--brand);
}

.dropzone-title,
.check-option strong,
.note-box strong {
  font-weight: 700;
}

.check-option {
  display: flex;
  gap: .625rem;
  align-items: flex-start;
  padding: .75rem;
  border-color: var(--border-soft);
}

.check-option:hover,
.file-dropzone:hover,
.shell-nav-item:hover,
.btn-secondary:hover,
.btn-primary:hover,
.btn-danger:hover,
.contract-copy:hover {
  transform: translateY(-1px);
}

.check-option:focus-within,
.file-dropzone:focus-within {
  box-shadow: 0 0 0 4px rgba(255,255,255,.8), 0 0 0 6px var(--focus-ring);
}

.check-option input {
  width: 1rem;
  height: 1rem;
  margin-top: .125rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 1.75rem;
  padding: 0 .5rem;
  border-radius: .5rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-success { color: var(--success); background: rgba(21,128,61,.08); border-color: rgba(21,128,61,.18); }
.pill-warning { color: var(--warning); background: rgba(180,83,9,.08); border-color: rgba(180,83,9,.18); }
.pill-danger { color: var(--danger); background: rgba(185,28,28,.08); border-color: rgba(185,28,28,.18); }
.pill-neutral { color: var(--muted); background: var(--surface-soft); }

.flash {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .75rem .875rem;
}

.flash-success { color: var(--success); }
.flash-warning { color: var(--warning); }
.flash-error { color: var(--danger); }

.summary-link,
.contract-copy {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
}

.summary-link {
  font-weight: 700;
}

.contract-copy {
  padding: .25rem .5rem;
  border-radius: .5rem;
  background: var(--surface);
}

.contract-copy small {
  color: var(--success);
  font-size: .7rem;
  font-weight: 700;
}

.table-shell {
  overflow: hidden;
}

.table-scroll {
  position: relative;
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.table-scroll::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1rem;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(248,250,252,0), rgba(248,250,252,.96));
}

.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.app-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 2.5rem;
  padding: .75rem .875rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-table tbody td,
.app-table tfoot th,
.app-table tfoot td {
  padding: .75rem .875rem;
  border-bottom: 1px solid rgba(203,213,225,.7);
  vertical-align: top;
}

.app-table tbody tr:hover,
.app-table tbody tr:focus-within {
  background: rgba(29,78,216,.04);
}

.app-table thead th:first-child,
.app-table tbody tr:last-child td:first-child {
  border-top-left-radius: .5rem;
  border-bottom-left-radius: .5rem;
}

.app-table thead th:last-child,
.app-table tbody tr:last-child td:last-child {
  border-top-right-radius: .5rem;
  border-bottom-right-radius: .5rem;
}

.data-table,
.batch-table,
.snapshot-table,
.summary-band-table,
.agency-table,
.contacts-table {
  table-layout: fixed;
}

.data-table thead th,
.data-table tbody td,
.contacts-table thead th,
.contacts-table tbody td {
  font-size: .8rem;
}

.col-id,
.col-money,
.batch-table .col-date,
.batch-table .col-day,
.agency-table .col-code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.tabular-nums,
.metric-card strong,
.status-tile strong,
.col-money,
.col-id {
  font-variant-numeric: tabular-nums;
}

.snapshot-table .col-id { width: auto; }
.snapshot-table .col-name { width: auto; }
.snapshot-table .col-div { width: 16rem; }
.summary-band-table .col-name { width: auto; }
.summary-band-table .col-money { width: 10rem; }
.contacts-table .col-name { width: auto; }
.contacts-table .col-id { width: 8rem; }
.contacts-table .col-money { width: 8.5rem; }
.agency-table .col-code { width: 6rem; }
.agency-table .col-status { width: 8rem; }

.batch-list,
.agency-grid,
.metric-band,
.filter-grid,
.check-grid,
.shell-nav,
.page-shell,
.stack-tight,
.note-box,
.agency-card,
.agency-delete-form,
.batch-delete-panel,
.chart-legend {
  display: grid;
  gap: .75rem;
}

.batch-card,
.agency-card,
.agency-delete-panel,
.batch-delete-panel,
.agency-password-card,
.filter-block,
.table-toolbar,
.chart-shell {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: .75rem;
}

.batch-card,
.agency-card {
  padding: 1rem;
}

.batch-card-error { border-color: rgba(185,28,28,.22); }
.batch-card-warning { border-color: rgba(180,83,9,.22); }

.batch-stat,
.meta-strip,
.context-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: .5rem;
  padding: 0 .625rem;
  min-height: 2rem;
}

.batch-stat {
  display: grid;
  gap: .125rem;
  align-content: start;
  padding: .5rem .625rem;
  min-height: 3rem;
}

.batch-stat strong { font-size: .95rem; }

.empty-state {
  display: grid;
  place-items: center;
  gap: .75rem;
  text-align: center;
}

.empty-state-icon,
.shell-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  background: rgba(29,78,216,.08);
  color: var(--brand);
}

.chart-shell {
  overflow: hidden;
}

.chart-frame {
  overflow-x: auto;
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.chart-gridline { stroke: rgba(203,213,225,.8); }
.chart-axis { stroke: rgba(100,116,139,.7); }
.chart-line-current { stroke: var(--focus-ring); filter: none; }
.chart-line-previous { stroke: rgba(100,116,139,.8); }
.chart-dot-current { fill: var(--focus-ring); }
.chart-dot-previous { fill: rgba(100,116,139,.95); }
.chart-y-label,
.chart-x-label { fill: var(--muted); }

.chart-legend {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  align-items: center;
  border: 1px solid var(--border-soft);
  padding: .75rem .875rem;
  background: var(--surface);
}

.chart-legend div { display: flex; align-items: center; gap: .5rem; }
.chart-legend-swatch { width: .75rem; height: .75rem; border-radius: .25rem; }

.filter-block { padding: .875rem; }

.meta-strip { flex-wrap: wrap; gap: .4rem; padding: .4rem 0; }

@media (min-width: 1024px) {
  .app-shell { grid-template-columns: 18rem minmax(0, 1fr); }
  .app-shell.app-shell--collapsed { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .shell-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1rem;
    border-right: 1px solid var(--border-soft);
    background: var(--surface);
  }
  .shell-sidebar--collapsed { width: 4.5rem; }
  .shell-main { min-width: 0; }
  .page-shell { padding: 1rem 1.25rem 1.25rem; }
}

@media (min-width: 768px) {
  .batch-list { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .agency-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .shell-sidebar { display: none; }
}

@media (max-width: 767px) {
  .top-commandbar { padding-inline: .75rem; }
  .context-chip { display: none; }
  .page-shell { padding: .75rem; gap: .75rem; }
  .app-card,
  .table-toolbar,
  .filter-shell,
  .chart-shell,
  .hero-card { padding: .875rem; }
  .app-table thead th,
  .app-table tbody td { padding: .625rem .625rem; }
  .batch-card,
  .agency-card { padding: .875rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
