* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f5f7fb;
  color: #1e293b;
  font:
    15px/1.6 system-ui,
    sans-serif;
}
.admin-page header {
  background: linear-gradient(115deg, #eff6ff, white 65%);
}
.admin-page .compact-stats .stat {
  border-top: 3px solid #3b82f6;
  background: linear-gradient(145deg, white, #eff6ff);
}
.admin-page .compact-stats .stat:nth-child(2) {
  border-top-color: #10b981;
  background: linear-gradient(145deg, white, #ecfdf5);
}
.admin-page .compact-stats .stat:nth-child(3) {
  border-top-color: #8b5cf6;
  background: linear-gradient(145deg, white, #f5f3ff);
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.reference-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 13px;
}
#panel-reference select,
#panel-reference input {
  margin: 8px 0;
}
#panel-reference [data-city],
#panel-reference [data-amount] {
  margin: 4px;
}
#panel-reference [aria-pressed="true"] {
  background: #2563eb;
  color: white;
}
#panel-reference table {
  min-width: 760px;
}
#panel-reference [id$="taxMemo"] {
  display: grid;
  gap: 16px;
}
#panel-reference [id$="officialSources"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}
@media (max-width: 760px) {
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
header {
  background: #fff;
  border-bottom: 1px solid #dce3ee;
}
header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  padding-bottom: 22px;
}
.wrap {
  max-width: 1180px;
  margin: auto;
  padding: 24px;
}
h1 {
  font-size: 24px;
  line-height: 1.25;
  margin: 0 0 5px;
}
h2 {
  font-size: 20px;
  margin: 0 0 16px;
}
h3 {
  font-size: 16px;
  margin: 0 0 8px;
}
p {
  margin: 8px 0;
}
a {
  color: #1d4ed8;
  text-underline-offset: 3px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.muted,
small {
  color: #64748b;
}
.eyebrow {
  font-size: 12px;
  color: #2563eb;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card {
  background: white;
  border: 1px solid #dce3ee;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 3px 12px #162b4b04;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stat strong {
  display: block;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: #64748b;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}
.row > * {
  flex: 1;
  min-width: 140px;
}
.row button {
  flex: 0 0 auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.grid .card {
  margin: 0;
}
section {
  scroll-margin-top: 20px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  font: inherit;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: inherit;
  padding: 9px 11px;
  border-radius: 8px;
  margin-top: 5px;
}
textarea {
  min-height: 85px;
  resize: vertical;
}
button,
.button {
  cursor: pointer;
  font: 600 13px/1.5 system-ui;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  padding: 9px 14px;
  text-decoration: none;
  display: inline-block;
}
button:hover,
.button:hover {
  background: #1d4ed8;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.secondary {
  background: white;
  color: #1d4ed8;
  border-color: #cbd5e1;
}
.secondary:hover {
  background: #eff6ff;
}
.danger {
  background: #b91c1c;
  border-color: #b91c1c;
}
.danger:hover {
  background: #991b1b;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
th {
  color: #64748b;
  font-weight: 600;
  background: #f8fafc;
}
td,
th {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
td.actions {
  min-width: 160px;
}
td.actions button {
  margin: 3px;
}
.notice {
  border-left: 4px solid #2563eb;
  background: #eff6ff;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 12px 0;
}
.error {
  border-color: #b91c1c;
  background: #fef2f2;
  color: #991b1b;
}
.status {
  white-space: pre-wrap;
  font-size: 13px;
}
.empty {
  color: #64748b;
  padding: 18px;
  text-align: center;
}
.message {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.message p {
  white-space: pre-wrap;
}
.message small {
  display: block;
}
dialog {
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  max-width: 760px;
  width: calc(100% - 32px);
  max-height: 85vh;
  overflow: auto;
}
dialog::backdrop {
  background: #0f172a88;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 7px;
  border-radius: 12px;
}
footer {
  text-align: center;
  padding: 26px;
  color: #64748b;
}
meter {
  width: 100%;
  height: 16px;
}
#searchResults:empty {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  .wrap {
    padding: 16px;
  }
  header .wrap {
    align-items: start;
    flex-direction: column;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 16px;
  }
  .row {
    display: block;
  }
  .row button {
    margin-bottom: 10px;
  }
  h1 {
    font-size: 21px;
  }
}

.admin-page .wrap {
  max-width: 1320px;
}
.admin-page header .wrap {
  padding-top: 18px;
  padding-bottom: 18px;
}
.compact-stats .stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
}
.compact-stats .stat strong {
  font-size: 25px;
}
.compact-stats {
  gap: 12px;
  margin-bottom: 4px;
}
.compact-stats .card {
  margin-bottom: 14px;
}
.admin-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.admin-tabs {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-tabs a {
  padding: 11px 14px;
  border-radius: 9px;
  text-decoration: none;
  color: #475569;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
}
.admin-tabs a:hover {
  background: #eaf0fb;
}
.admin-tabs a[aria-selected="true"] {
  background: #fff;
  border-color: #dce3ee;
  color: #1d4ed8;
  box-shadow: 0 3px 12px #162b4b04;
}
.admin-content {
  min-width: 0;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-heading h2 {
  margin-bottom: 0;
}
.overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}
.overview-metrics strong {
  display: block;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}
.overview-metrics span {
  font-size: 12px;
  color: #64748b;
}
.operation-card {
  border-color: #93b4f0;
}
.operation-card progress {
  width: 100%;
  height: 12px;
  accent-color: #2563eb;
}
.operation-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
#recentMessages .message {
  padding: 12px 14px;
}
#recentMessages .message p {
  font-size: 13px;
}
#recentMessages .message button {
  padding: 5px 10px;
}
.state-completed {
  color: #166534;
  background: #dcfce7;
}
.state-failed,
.state-interrupted {
  color: #991b1b;
  background: #fee2e2;
}
@media (max-width: 800px) {
  .admin-layout {
    display: block;
  }
  .admin-tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    margin: 0 0 16px;
    gap: 4px;
    padding-bottom: 4px;
  }
  .admin-tabs a {
    white-space: nowrap;
    padding: 9px 12px;
  }
  .overview-metrics {
    gap: 10px;
  }
  .overview-metrics strong {
    font-size: 22px;
  }
}
@media (max-width: 500px) {
  .compact-stats {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .compact-stats .card {
    margin-bottom: 7px;
  }
  .compact-stats .stat {
    padding: 8px 14px;
  }
  .overview-metrics {
    grid-template-columns: 1fr;
  }
  .overview-metrics > div {
    display: flex;
    align-items: center;
    gap: 12px;
  }
}
