/* LPNC-aligned chrome (from meeting.lpnc.org / www.lpnc.org) plus app layout. */
:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #f8f8f8;
  --text: #333333;
  --text-strong: #000000;
  --muted: #505054;
  --accent: #1a99d4;
  --accent-hover: #1478a7;
  --accent-soft: #e8f6fc;
  --danger: #c4002c;
  --danger-bg: #fdf2f3;
  --border: #dddddd;
  --border-strong: #cccccc;
  --radius: 2px;
  --radius-card: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --header-bar: #1a99d4;

  --lpnc-blue: #1a99d4;
  --lpnc-blue-dark: #1478a7;
  --lpnc-navy: #000000;
  --lpnc-slate: #333333;
  --lpnc-border: #dddddd;
  --lpnc-bg: #f3f3f3;
  --lpnc-card: #ffffff;
  --lpnc-success: #15803d;
  --lpnc-warning: #b45309;
  --lpnc-danger: #c4002c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  border-top: 3px solid var(--header-bar);
}

.page-main {
  flex: 1;
  padding: 1.5rem 0 2.5rem;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.topbar {
  background: #fff;
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.65rem 0;
  flex-wrap: wrap;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-link:hover {
  text-decoration: none;
  opacity: 0.92;
}

.brand-logo {
  height: 42px;
  width: auto;
  display: block;
}

.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1.1rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.topbar-nav > a {
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
}

.topbar-nav > a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-item {
  position: relative;
}

.nav-item summary {
  list-style: none;
  cursor: pointer;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.nav-item summary::-webkit-details-marker {
  display: none;
}

.nav-item summary::after {
  content: " ▾";
}

.nav-item summary:hover,
.nav-item[open] > summary {
  color: var(--accent);
}

.nav-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.35rem;
  min-width: 13.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  box-shadow: var(--shadow);
  border-radius: var(--radius-card);
  padding: 0.35rem 0;
  z-index: 20;
}

.nav-dropdown a,
.nav-dropdown .linkish {
  display: block;
  width: 100%;
  padding: 0.45rem 0.9rem;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.nav-dropdown a:hover,
.nav-dropdown .linkish:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
  text-decoration: none;
}

.footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 1.15rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer a {
  font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.75rem;
  line-height: 1.25;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-strong);
}

h1 {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.hero {
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: 1.85rem;
}

.lead {
  color: var(--muted);
  margin: 0;
  max-width: 48rem;
  font-size: 1.02rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card.narrow {
  max-width: 440px;
  margin: 1.5rem auto;
}

.card h2 {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.btn,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 39px;
  padding: 10px 15px;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid #1478a7;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
}

.btn:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background: var(--accent-hover);
  border-color: #0f5f86;
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary,
.btn.secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover,
.btn.secondary:hover {
  background: #ebebeb;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-sm,
.btn-small,
.btn.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  min-height: 0;
}

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

.btn-danger:hover,
.btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-success,
.btn-primary {
  background: var(--accent);
  border-color: #1478a7;
  color: #fff;
}

table {
  width: 100%;
  background: var(--surface);
  border-collapse: collapse;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}

th,
td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:hover {
  background: var(--surface-2);
}

.alert {
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.alert-info,
.alert.info {
  background: var(--accent-soft);
  border-color: #b6dff0;
  border-left: 3px solid var(--accent);
  color: var(--text);
}

.alert-success {
  background: #ecfdf3;
  border-color: #a7f3d0;
  color: #166534;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: var(--lpnc-warning);
}

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

form {
  background: var(--surface);
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  margin: 1rem 0;
}

.card form,
form.stack {
  background: none;
  padding: 0;
  border: none;
  box-shadow: none;
  margin: 0;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  min-height: 39px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 153, 212, 0.25);
}

.helptext,
.help {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
  margin: -0.5rem 0 1rem;
}

.role-choices {
  margin: 1rem 0;
  border: none;
  padding: 0;
}

.role-choices legend {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.role-choice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.role-choice input {
  margin-top: 0.2rem;
}

.role-choice .help {
  margin: 0.2rem 0 0;
}

.errorlist {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  padding-left: 1.1rem;
}

.messages {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
}

.messages li {
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
}

form.inline,
.inline-form,
.logout-form {
  display: inline;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

button.linkish {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  min-height: 0;
  margin: 0;
}

.snapshot-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  max-width: 1100px;
}

.snapshot-controls label {
  margin-bottom: 0;
  flex: 1 1 240px;
}

.snapshot-controls select {
  margin-bottom: 0;
}

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

.snapshot-section {
  margin-bottom: 2rem;
}

.snapshot-section h2 {
  margin-bottom: 0.75rem;
}

.snapshot-table-wrap {
  margin: 1rem -1rem;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 14rem);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.snapshot-table {
  margin: 0;
  min-width: 100%;
  font-size: 0.9rem;
}

.snapshot-table th,
.snapshot-table td {
  white-space: nowrap;
}

.snapshot-table thead th {
  position: sticky;
  background: #ecf0f1;
  z-index: 2;
}

.snapshot-table thead tr:first-child th {
  top: 0;
}

.snapshot-table thead tr:nth-child(2) th {
  top: 2.4rem;
}

.snapshot-table .county-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;
  min-width: 10rem;
}

.snapshot-table thead .county-col {
  background: #ecf0f1;
  z-index: 5;
}

.snapshot-table .num-col,
.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.snapshot-table .group-header {
  text-align: center;
  border-bottom: 2px solid #bdc3c7;
}

.snapshot-table .totals-row {
  font-weight: 600;
  background: #eaf2f8;
}

.snapshot-table .totals-row .county-col {
  background: #eaf2f8;
}

.snapshot-table tbody tr:hover .county-col {
  background: #f9fafb;
}

.snapshot-table .totals-row:hover,
.snapshot-table .totals-row:hover .county-col {
  background: #d6eaf8;
}

.snapshot-table .county-link {
  color: var(--text-strong);
  font-weight: 600;
  text-decoration: none;
}

.snapshot-table .county-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.series-link {
  color: var(--text-strong);
  font-weight: 600;
  text-decoration: none;
}

.shift-cell > .series-link {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.series-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.series-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.9rem;
}

.series-swatch {
  display: inline-block;
  width: 1.1rem;
  height: 0.35rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  border-radius: 999px;
}

.series-swatch-total { background: var(--accent); }
.series-swatch-active { background: #1478a7; }
.series-swatch-inactive { background: #94a3b8; }

.series-chart-wrap {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.25rem 0;
}

.series-chart {
  display: block;
  width: 100%;
  height: auto;
}

.series-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
}

.series-axis {
  stroke: #94a3b8;
  stroke-width: 1;
}

.series-axis-label {
  fill: var(--lpnc-slate);
  font-size: 11px;
}

.series-line {
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.series-line-total { stroke: var(--accent); }
.series-line-active { stroke: #1478a7; }
.series-line-inactive { stroke: #94a3b8; }

.series-table-scroll {
  max-height: min(70vh, 36rem);
}

.shift-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  line-height: 1.2;
}

.shift-delta {
  font-weight: 600;
}

.shift-delta.positive {
  color: #1e8449;
}

.shift-delta.negative {
  color: #c0392b;
}

.shift-delta.zero {
  color: #7f8c8d;
}

.shift-percent {
  font-size: 0.8rem;
  color: #566573;
}

.report-layout {
  display: grid;
  gap: 1.5rem;
  width: 100%;
}

.report-panel {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.report-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.report-form.report-form-stacked {
  grid-template-columns: 1fr;
  align-items: stretch;
  max-width: 42rem;
}

.report-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.report-form-field label {
  margin-bottom: 0;
}

.report-form label {
  display: block;
  margin-bottom: 0.25rem;
}

.report-form select,
.report-form input[type="text"],
.report-form input[type="number"] {
  width: 100%;
  margin-bottom: 0;
}

.report-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--lpnc-border);
  border-radius: var(--radius);
  background: #ffffff;
  font: inherit;
  color: var(--lpnc-slate);
}

.report-form input[type="file"]::file-selector-button,
.report-form input[type="file"]::-webkit-file-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 10px 15px;
  margin-right: 0.75rem;
  border: 1px solid #1478a7;
  border-radius: var(--radius);
  background: var(--lpnc-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.report-form input[type="file"]:hover::file-selector-button,
.report-form input[type="file"]:hover::-webkit-file-upload-button {
  background: var(--lpnc-blue-dark);
}

.report-form input[type="text"][size] {
  max-width: 100%;
}

.report-form:not(.report-form-stacked) input[type="text"][size] {
  grid-column: 1 / -1;
}

.report-form .field-help {
  display: block;
  color: var(--lpnc-slate);
  font-size: 0.85rem;
  margin: 0 0 0.35rem;
}

.report-form .checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-column: 1 / -1;
}

.report-form .actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.jobs-table th,
.jobs-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.jobs-table th {
  background: #ecf0f1;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

.report-preview-scroll {
  max-height: min(70vh, 44rem);
}

.report-preview-table {
  font-size: 0.85rem;
  width: max-content;
  min-width: 100%;
}

.report-preview-table th,
.report-preview-table td {
  white-space: nowrap;
}

.report-preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.movement-chart {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1.25rem 0 2rem;
}

.movement-row {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) 1fr 7rem;
  gap: 0.75rem;
  align-items: center;
}

.movement-label {
  font-weight: 600;
}

.movement-bar-track {
  height: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.movement-bar {
  height: 100%;
  background: var(--accent);
  min-width: 0.35rem;
}

.movement-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .movement-row {
    grid-template-columns: 1fr auto;
  }

  .movement-label,
  .movement-bar-track {
    grid-column: 1 / -1;
  }
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #eef2f7;
}

.status-completed { background: #d1fae5; }
.status-running { background: #dbeafe; }
.status-failed { background: #fee2e2; }
.status-pending { background: #fef3c7; }
.status-cancelled { background: #fde68a; }
.status-started { background: #dbeafe; }
.status-skipped_same_hash { background: #e0e7ff; }
.status-skipped_already_imported { background: #e0e7ff; }
.status-blocked_running { background: #ffedd5; }
.status-error { background: #fee2e2; }

.disk-usage {
  display: grid;
  gap: 0.75rem;
}

.disk-usage-meter {
  height: 0.75rem;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.disk-usage-meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  min-width: 0.25rem;
  transition: width 0.2s ease;
}

.disk-usage-meter-fill.is-warning {
  background: #f59e0b;
}

.disk-usage-meter-fill.is-critical {
  background: #ef4444;
}

.disk-usage-summary {
  margin: 0;
}

.disk-usage-details {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--lpnc-slate);
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.import-guard-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.help-text {
  color: var(--lpnc-slate);
  margin-top: 0;
}

.api-key-reveal {
  border: 2px solid #f59e0b;
  background: #fffbeb;
}

.api-key-secret-box {
  margin: 0.75rem 0;
  padding: 1rem;
  background: #111827;
  border-radius: 6px;
  overflow-x: auto;
}

.api-key-secret-box code {
  color: #fef3c7;
  font-size: 0.95rem;
  word-break: break-all;
  white-space: pre-wrap;
}

.api-key-instructions {
  line-height: 1.7;
  padding-left: 1.25rem;
}

@media (max-width: 768px) {
  .brand-logo {
    height: 34px;
  }

  .hero h1 {
    font-size: 1.45rem;
  }

  .topbar-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .footer .container {
    flex-direction: column;
    align-items: flex-start;
  }
}
