:root {
  color-scheme: light;
  --bg: #eef4ff;
  --bg-accent: #dbe8ff;
  --panel: #ffffff;
  --panel-border: rgba(35, 56, 118, 0.12);
  --text: #182033;
  --muted: #58627a;
  --primary: #1453d1;
  --primary-hover: #0e43aa;
  --secondary: #157f54;
  --secondary-hover: #0f6944;
  --danger-bg: #fff1f1;
  --danger-border: #f1b6b6;
  --danger-text: #912b2b;
  --info-bg: #eef6ff;
  --info-border: #c1d9ff;
  --info-text: #184f97;
  --planned-bg: #e5f0ff;
  --planned-text: #0d58b5;
  --failure-bg: #ffe7e7;
  --failure-text: #b12727;
  --mass-bg: #fff2de;
  --mass-text: #a15c08;
  --revoked-bg: #eceef3;
  --revoked-text: #3f4657;
  --shadow: 0 18px 45px rgba(31, 46, 92, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 28%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
}

body.report-body {
  background: #f4f4f6;
}

body.report-body .report-sheet {
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0 auto;
  padding: 0;
}

.page-shell,
.report-sheet {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.page-shell {
  padding: 2rem 0 3rem;
}

.hero-card,
.panel,
.placeholder-card,
.report-sheet {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card,
.panel,
.placeholder-card,
.outage-card {
  padding: 1.5rem;
}

.hero-card {
  margin-bottom: 1.25rem;
}

.hero-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logout-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

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

.login-panel {
  width: min(540px, 100%);
  margin: 2rem auto;
}

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

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.intro,
.panel-header p,
.placeholder-card p,
.field-label,
.description-text,
.report-meta p {
  color: var(--muted);
}

.panel {
  margin-bottom: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

label,
.county-form label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(41, 66, 140, 0.18);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(20, 83, 209, 0.2);
  border-color: rgba(20, 83, 209, 0.65);
}

.filters-actions {
  display: flex;
  align-items: flex-end;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 46px;
}

.primary-button {
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-hover);
}

.secondary-button {
  background: var(--secondary);
}

.secondary-button:hover {
  background: var(--secondary-hover);
}

.secondary-button-alt {
  background: #a46311;
}

.secondary-button-alt:hover {
  background: #864f0d;
}

.secondary-button-csv {
  background: #0c6e67;
}

.secondary-button-csv:hover {
  background: #095750;
}

.loading-indicator {
  display: none;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 0.88rem;
}

.htmx-request.htmx-indicator,
.htmx-indicator.htmx-request {
  display: inline-flex;
}

.results-stack {
  display: grid;
  gap: 1rem;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.county-form {
  min-width: 240px;
}

.results-table-panel {
  padding: 0;
  overflow: hidden;
}

.results-table-panel .report-table {
  margin: 0;
}

.alert {
  padding: 1rem 1.15rem;
  border-radius: 18px;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.alert-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

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

.outage-header,
.badge-row,
.datetime-grid {
  display: flex;
  gap: 0.75rem;
}

.outage-header {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.datetime-grid {
  flex-wrap: wrap;
}

.datetime-grid > div {
  min-width: 180px;
}

.badge,
.region-chip,
.county-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.badge-planned {
  background: var(--planned-bg);
  color: var(--planned-text);
}

.badge-failure {
  background: var(--failure-bg);
  color: var(--failure-text);
}

.badge-mass {
  background: var(--mass-bg);
  color: var(--mass-text);
}

.badge-revoked,
.region-chip,
.county-chip {
  background: var(--revoked-bg);
  color: var(--revoked-text);
}

.address-block,
.address-list {
  display: grid;
  gap: 0.5rem;
}

.address-item {
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: #f6f8fc;
}

.county-chip {
  margin-left: 0.5rem;
  font-size: 0.75rem;
}

.report-sheet {
  margin: 1.5rem auto;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: none;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.print-actions {
  margin-bottom: 1rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  border: 1px solid #d8dbe5;
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #eef3ff;
}

.report-table th:nth-child(1),
.report-table td:nth-child(1) {
  width: 20%;
}

.report-table th:nth-child(2),
.report-table td:nth-child(2) {
  width: 58%;
}

.report-table th:nth-child(3),
.report-table td:nth-child(3) {
  width: 22%;
}

.news-addresses {
  display: grid;
  gap: 0.45rem;
}

.city-block {
  display: grid;
  gap: 0.25rem;
}

.city-name {
  color: #13733f;
  font-weight: 700;
}

.street-line {
  line-height: 1.35;
}

.empty-state {
  text-align: center;
  padding: 2rem;
}

.report-sheet-newspaper {
  width: 57.8mm;
  padding: 0;
}

.report-sheet-newspaper .report-header {
  display: block;
  margin-bottom: 0.65rem;
}

.report-sheet-newspaper h1 {
  font-size: 12px;
  margin-bottom: 0.35rem;
}

.report-sheet-newspaper p,
.report-sheet-newspaper .report-table,
.report-sheet-newspaper .report-table th,
.report-sheet-newspaper .report-table td,
.report-sheet-newspaper .street-line,
.report-sheet-newspaper .city-name {
  font-size: 9px;
}

.report-sheet-newspaper .report-table th,
.report-sheet-newspaper .report-table td {
  padding: 1.2mm;
}

@media (max-width: 800px) {
  .page-shell,
  .report-sheet {
    width: min(100% - 1rem, 1120px);
  }

  .panel-header,
  .results-toolbar,
  .report-header {
    flex-direction: column;
  }

  .hero-top-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions,
  .filters-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

@media print {
  body.report-body {
    background: #fff;
  }

  body.report-body.format-a4 {
    page: a4;
  }

  body.report-body.format-newspaper {
    page: newspaper;
  }

  @page a4 {
    size: A4 portrait;
    margin: 8mm;
  }

  @page newspaper {
    size: 57.8mm 297mm;
    margin: 2.5mm;
  }

  body.report-body.format-newspaper .report-sheet {
    width: 100%;
    max-width: 100%;
  }

  .report-sheet {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .no-print {
    display: none !important;
  }
}
