:root {
  --ink: #1b2430;
  --muted: #657083;
  --line: #d9e1ea;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --blue: #2457d6;
  --teal: #007f86;
  --green: #18864b;
  --amber: #a46700;
  --red: #b42318;
  --red-soft: #fff1f0;
  --amber-soft: #fff7df;
  --blue-soft: #eef4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #10263f;
}

.login-screen.is-exiting {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#dashboardApp {
  min-height: 100vh;
}

#dashboardApp[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

.login-card h1 {
  color: var(--ink);
  font-size: 24px;
  margin-bottom: 22px;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.login-card input {
  width: 100%;
  min-height: 40px;
  margin-bottom: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.login-card button {
  width: 100%;
  justify-content: center;
  background: var(--blue);
  color: white;
}

.login-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 34px;
  background: #10263f;
  color: white;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  font-weight: 760;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.72;
}

.date-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #f2cd7b;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #583600;
  font-size: 14px;
}

.snapshot-section {
  margin-bottom: 18px;
}

.section-title {
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.kpi .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi .channel {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 820;
}

.kpi .metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid #edf2f7;
}

.kpi .metric-row:first-of-type {
  border-top: 0;
}

.kpi .metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.kpi .metric-value {
  font-size: 14px;
  font-weight: 820;
}

.kpi .value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 780;
}

.kpi .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.badge.good {
  background: #eaf8ef;
  color: var(--green);
}

.badge.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.bad {
  background: var(--red-soft);
  color: var(--red);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f7f9fc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable::after {
  content: " ↕";
  color: #94a3b8;
  font-weight: 700;
}

th:first-child,
td:first-child,
td.text,
th.text {
  text-align: left;
}

tbody tr:hover {
  background: #f9fbff;
}

.coverage-warning {
  color: var(--amber);
  font-weight: 800;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 16px;
}

button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  background: #f8fafc;
}

@media (max-width: 900px) {
  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .split {
    grid-template-columns: 1fr;
  }

  main {
    padding: 14px;
  }
}
