:root {
  --ink: #17211e;
  --muted: #65716c;
  --line: #dce5e0;
  --wash: #f3f7f4;
  --surface: #ffffff;
  --green: #0b8b63;
  --green-dark: #076347;
  --green-glow: rgba(11, 139, 99, 0.25);
  --amber: #bd7617;
  --amber-rgb: 189, 118, 23;
  --red: #bb3944;
  --red-rgb: 187, 57, 68;
  --shadow: 0 4px 20px rgba(20, 35, 27, 0.05), 0 1px 3px rgba(20, 35, 27, 0.04);
  --shadow-hover: 0 14px 40px rgba(20, 35, 27, 0.1), 0 2px 6px rgba(20, 35, 27, 0.05);
  font-family: Plus Jakarta Sans, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  height: 70px;
  padding: 0 max(22px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(20, 35, 27, 0.03);
  transition: background-color 0.3s ease;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand span {
  color: var(--green);
}

.brand-icon {
  width: 30px;
  height: 30px;
  margin-right: 7px;
  flex: 0 0 auto;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

nav a, .link-button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: none;
  transition: all 0.2s ease;
}

nav a:hover, .link-button:hover {
  color: var(--green-dark);
  background: rgba(11, 139, 99, 0.08);
}

.settings-jump-nav {
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.settings-jump-nav a {
  background: var(--surface);
  border: 1px solid var(--line);
}

.settings-links {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.settings-card .secondary-button {
  flex: 1 1 210px;
  text-align: center;
}

fieldset[id] {
  scroll-margin-top: 96px;
}

#history {
  scroll-margin-top: 96px;
}

.link-button {
  cursor: pointer;
}

.page {
  max-width: 1180px;
  margin: auto;
  padding: 48px 28px 80px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.page-heading h1, .narrow h1 {
  font-size: clamp(36px, 4.8vw, 54px);
  letter-spacing: -2px;
  line-height: 1.05;
  margin: 0;
  font-weight: 800;
}

.lead {
  max-width: 670px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  margin: 15px 0 0;
}

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  background: var(--green);
  color: #ffffff;
  text-decoration: none;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--green-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.button:hover, button:hover {
  background: var(--green-dark);
  transform: translateY(-1.5px);
  box-shadow: 0 8px 24px var(--green-glow);
}

.button:active, button:active {
  transform: scale(0.97);
}

.secondary-button {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 16px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 720;
  text-decoration: none;
  transition: all 0.2s ease;
}

.secondary-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--wash);
  transform: translateY(-1px);
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.site-card, .empty-card, .panel, .summary-card, .privacy-card, .card-form, .danger-zone, .admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.site-card:hover, .panel:hover, .summary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(11, 139, 99, 0.25);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Pulsing animated status dot */
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(11, 139, 99, 0.15);
  flex: 0 0 auto;
  animation: pulseDotGreen 2.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.status-degraded .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(189, 118, 23, 0.15);
  animation: pulseDotAmber 2.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.status-offline .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(187, 57, 68, 0.15);
  animation: pulseDotRed 2.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulseDotGreen {
  0%, 100% { box-shadow: 0 0 0 4px rgba(11, 139, 99, 0.2); }
  50% { box-shadow: 0 0 0 10px rgba(11, 139, 99, 0); }
}
@keyframes pulseDotAmber {
  0%, 100% { box-shadow: 0 0 0 4px rgba(189, 118, 23, 0.2); }
  50% { box-shadow: 0 0 0 10px rgba(189, 118, 23, 0); }
}
@keyframes pulseDotRed {
  0%, 100% { box-shadow: 0 0 0 4px rgba(187, 57, 68, 0.2); }
  50% { box-shadow: 0 0 0 10px rgba(187, 57, 68, 0); }
}

.pill {
  display: inline-block;
  border-radius: 999px;
  background: var(--wash);
  border: 1px solid var(--line);
  padding: 5px 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.site-card h2 {
  font-size: 24px;
  letter-spacing: -0.8px;
  margin: 24px 0 6px;
  font-weight: 750;
}

.big-status {
  font-weight: 680;
  margin: 0 0 20px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.mini-metrics div, .metric-row article {
  background: var(--wash);
  border-radius: 12px;
  padding: 14px;
  transition: transform 0.2s ease;
}

.mini-metrics div:hover, .metric-row article:hover {
  transform: translateY(-1px);
}

.mini-metrics dt, .metric-row p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 5px;
  font-weight: 600;
}

.mini-metrics dd {
  font-weight: 760;
  margin: 0;
}

.incident-line {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.card-actions {
  display: flex;
  gap: 16px;
  margin-top: 18px;
}

.card-actions a {
  color: var(--green-dark);
  font-size: 13.5px;
  font-weight: 750;
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-actions a:hover {
  color: var(--green);
  text-decoration: underline;
}

.privacy-card {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #e8f4ee;
  border-color: #c4e4d5;
}

.privacy-card h2 {
  margin: 0 0 5px;
}

.privacy-card p {
  color: #455a52;
  max-width: 720px;
  line-height: 1.5;
  margin: 0;
}

.danger-zone, .admin-panel {
  margin-top: 20px;
  box-shadow: none;
}

.danger-zone summary, .admin-panel summary {
  cursor: pointer;
  font-weight: 750;
  transition: color 0.2s ease;
}

.danger-zone summary:hover, .admin-panel summary:hover {
  color: var(--green);
}

.inline-form {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.danger {
  background: var(--red);
  box-shadow: 0 4px 14px rgba(187, 57, 68, 0.25);
}

.danger:hover {
  background: #a32d37;
}

.summary-card {
  display: flex;
  gap: 18px;
  align-items: center;
}

.summary-card h2 {
  margin: 3px 0 0;
  font-size: 27px;
}

.label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  margin: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.metric-row article {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
  border-radius: 14px;
}

.metric-row strong {
  font-size: 22px;
  font-weight: 750;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel h2 {
  margin-top: 0;
}

.incident {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.incident:first-of-type {
  border-top: 0;
}

.incident h3 {
  margin: 7px 0;
}

.incident p {
  line-height: 1.5;
  color: var(--muted);
}

.severity-critical .pill {
  color: var(--red);
  background: #fde8ea;
  border-color: #f7c3c7;
}

.severity-warning .pill {
  color: var(--amber);
  background: #fdf3e7;
  border-color: #f8dfbf;
}

.empty-check {
  padding: 18px;
  border-radius: 14px;
  background: #edf8f2;
  color: var(--green-dark);
  font-weight: 650;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background: var(--wash);
}

th {
  color: var(--muted);
  position: sticky;
  top: 0;
  background: #ffffff;
  font-weight: 750;
}

.heading-actions {
  display: flex;
  gap: 10px;
}

.narrow {
  max-width: 690px;
  margin: auto;
}

.card-form {
  margin-top: 25px;
}

.stack {
  display: grid;
  gap: 16px;
}

.stack label, .alert label {
  display: grid;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
}

.compact {
  margin-top: 17px;
}

input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cdd8d2;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 14px;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(11, 139, 99, 0.3);
  outline-offset: 1px;
}

.code-input {
  text-transform: uppercase;
  font-size: 24px;
  letter-spacing: 4px;
  font-weight: 800;
}

.check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 10px !important;
  line-height: 1.45;
  cursor: pointer;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
  cursor: pointer;
}

.check a, .legal-inline a, footer a {
  color: var(--green-dark);
  font-weight: 700;
}

.billing-terms {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--wash);
  font-size: 12.5px;
}

.permissions-panel {
  margin-top: 22px;
}

.permission-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.permission-grid article {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}

.permission-grid p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

legend {
  font-weight: 800;
  padding: 0 6px;
}

.fine {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.alert {
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 18px;
  animation: fadeInUp 0.3s ease;
}

.alert.error {
  background: #fff0f1;
  color: #7e2028;
  border: 1px solid #efc7cb;
}

.alert.success {
  background: #eaf7f0;
  color: #075c42;
  border: 1px solid #c7e5d6;
}

.alert.info {
  border-color: #b8d8f0;
  background: #eef7fd;
  color: #174b6b;
}

.email-setup-status > p:first-child {
  margin-top: 0;
}

.email-setup-status > p:last-child {
  margin-bottom: 0;
}

.smtp-admin-setup {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #b8d8f0;
}

.smtp-admin-setup h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.smtp-admin-setup p {
  line-height: 1.55;
}

.smtp-admin-setup code {
  border-radius: 6px;
  background: rgba(23, 75, 107, 0.09);
  padding: 2px 5px;
  overflow-wrap: anywhere;
}

.smtp-admin-setup .smtp-command {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  white-space: normal;
}

.draft-list {
  display: grid;
  gap: 16px;
}

.draft-list pre {
  white-space: pre-wrap;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  background: var(--wash);
  padding: 16px;
  border-radius: 10px;
}

.draft-actions, .auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.auth-links { justify-content: space-between; font-size: 14px; }
.auth-links a { color: var(--green-dark); font-weight: 700; }

.provider-report-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.provider-report-form small { color: var(--muted); }

.report-copy {
  max-width: 900px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 25px;
  background: radial-gradient(circle at 15% 15%, #dcefe6, transparent 37%), var(--wash);
}

.auth-card {
  width: min(530px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 22px 70px rgba(20, 35, 27, 0.08);
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.auth-card .brand {
  margin-bottom: 28px;
}

.auth-card-header .brand {
  margin-bottom: 0;
}

.auth-card h1 {
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -1.8px;
  margin: 0;
  font-weight: 800;
}

.auth-card form {
  margin-top: 25px;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.google-login-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #747775;
  border-radius: 12px;
  background: #ffffff;
  color: #1f1f1f;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.google-login-button:hover {
  background: #f8faff;
  border-color: #1f1f1f;
  box-shadow: 0 2px 8px rgba(31, 31, 31, 0.12);
}

footer {
  max-width: 1180px;
  margin: auto;
  padding: 0 28px 35px;
  color: var(--muted);
  font-size: 12px;
}

button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(11, 139, 99, 0.4);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .site-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
  .topbar nav .nav-secondary {
    display: none;
  }
}

@media (max-width: 650px) {
  .permission-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar nav {
    gap: 4px;
  }
  .topbar nav a {
    font-size: 11.5px;
    padding: 7px 9px;
  }
  .page {
    padding: 35px 17px 60px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-heading h1, .narrow h1 {
    font-size: 38px;
  }
  .site-grid {
    grid-template-columns: 1fr;
  }
  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .privacy-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .heading-actions {
    width: 100%;
    flex-direction: column;
  }
  .heading-actions a {
    justify-content: center;
  }
  .inline-form {
    display: grid;
  }
  .auth-card {
    padding: 28px 22px;
  }
  .auth-card h1 {
    font-size: 34px;
  }
  .topbar .link-button {
    font-size: 11.5px;
    padding: 7px 9px;
  }
}

@media print {
  .topbar, footer, .report-heading button {
    display: none;
  }
  .page {
    padding: 0;
  }
  .panel, .metric-row article {
    box-shadow: none;
    break-inside: avoid;
  }
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.55fr);
  align-items: start;
  gap: 18px;
}

.history-layout > .panel {
  min-width: 0;
  padding: clamp(22px, 3vw, 34px);
}

.section-intro {
  margin: -4px 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.incidents-panel .incident {
  margin-top: 16px;
  padding: 22px 0 4px;
}

.incident-topline,
.incident-period,
.incident-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.repeat-badge {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.incident .diagnostic-code {
  display: inline-block;
  margin: 0 0 5px;
  color: var(--muted);
  background: var(--wash);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.recommended-action {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--green);
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(11, 139, 99, 0.09), rgba(11, 139, 99, 0.025));
}

.recommended-action strong {
  color: var(--green-dark);
  font-size: 12px;
}

.recommended-action p {
  margin: 5px 0 0;
  color: var(--ink);
}

.incident-period {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.evidence-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: var(--wash);
}

.evidence-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.evidence-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 750;
}

.incident-feedback {
  margin-top: 14px;
}

.incident-feedback > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.history-panel {
  background:
    radial-gradient(circle at 88% 6%, rgba(11, 139, 99, 0.09), transparent 24%),
    var(--surface);
}

.history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.period-switcher,
.metric-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
}

.period-switcher a,
.metric-switcher button {
  min-height: 36px;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.period-switcher a:hover,
.metric-switcher button:hover {
  color: var(--green-dark);
  background: var(--wash);
  box-shadow: none;
  transform: none;
}

.period-switcher .active,
.metric-switcher .active {
  color: #fff;
  background: var(--green);
  box-shadow: 0 5px 14px rgba(11, 139, 99, 0.2);
}

.history-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 12px;
}

.history-kpis article {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(220, 229, 224, 0.85);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.76);
}

.history-kpis span {
  display: block;
  min-height: 28px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.3;
}

.history-kpis strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(17px, 2vw, 23px);
  letter-spacing: -0.03em;
}

.history-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
}

.trend-card,
.state-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.trend-card {
  padding: 14px;
}

.interactive-chart {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  height: 238px;
  margin-top: 13px;
}

.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 7px 4px 0;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.interactive-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-grid line:nth-child(2) {
  stroke-dasharray: 4 5;
}

.metric-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 5px 6px rgba(11, 139, 99, 0.16));
}

.metric-line[hidden],
.chart-marker[hidden],
.chart-marker-line[hidden],
.chart-tooltip[hidden] {
  display: none;
}

.loss-line {
  stroke: var(--red);
}

.chart-hit-layer rect {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.chart-marker-line {
  stroke: rgba(23, 33, 30, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.chart-marker {
  fill: var(--surface);
  stroke: var(--green);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 3;
  width: 178px;
  padding: 11px 12px;
  border: 1px solid rgba(23, 33, 30, 0.1);
  border-radius: 11px;
  background: rgba(23, 33, 30, 0.94);
  box-shadow: 0 12px 32px rgba(23, 33, 30, 0.2);
  color: #fff;
  pointer-events: none;
  transform: translateX(-50%);
}

.chart-tooltip > * {
  display: block;
}

.chart-tooltip strong {
  margin-bottom: 6px;
  font-size: 12px;
}

.chart-tooltip span,
.chart-tooltip small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}

.chart-tooltip .tooltip-value {
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 13px;
}

.state-card h3 {
  align-self: stretch;
  margin: 0;
  font-size: 14px;
}

.state-donut {
  width: 142px;
  height: 142px;
  margin: 7px auto 3px;
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 13;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}

.donut-track { stroke: var(--line); }
.donut-segment.healthy { stroke: var(--green); }
.donut-segment.degraded { stroke: var(--amber); }
.donut-segment.offline { stroke: var(--red); }

.state-donut text {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.state-donut .donut-caption {
  fill: var(--muted);
  font-size: 8px;
  font-weight: 650;
}

.state-legend {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.state-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 11px;
}

.state-legend strong { color: var(--ink); }

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.healthy { background: var(--green); }
.legend-dot.degraded { background: var(--amber); }
.legend-dot.offline { background: var(--red); }

.history-highlights {
  margin-top: 22px;
}

.history-highlights > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.history-highlights h3 {
  margin: 0 0 10px;
}

.history-highlights p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.history-highlights .table-wrap {
  max-height: 360px;
  border: 1px solid var(--line);
}

.history-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.history-status.status-healthy { color: var(--green-dark); background: #e8f5ef; }
.history-status.status-degraded { color: #8b5310; background: #fdf3e7; }
.history-status.status-offline { color: var(--red); background: #fde8ea; }

.empty-history {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
}

.empty-history > span {
  color: var(--green);
  font-size: 45px;
}

.empty-history h3 { margin: 8px 0; }
.empty-history p { max-width: 360px; margin: 0; color: var(--muted); }

@media (max-width: 1080px) {
  .history-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .history-heading,
  .history-highlights > div:first-child {
    align-items: stretch;
    flex-direction: column;
  }
  .period-switcher {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .period-switcher a {
    text-align: center;
  }
  .history-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .history-visual-grid {
    grid-template-columns: 1fr;
  }
  .state-card {
    display: grid;
    grid-template-columns: 1fr 142px 1fr;
  }
  .state-card h3 { align-self: start; }
}

@media (max-width: 520px) {
  .history-layout > .panel {
    padding: 20px 16px;
  }
  .period-switcher a,
  .metric-switcher button {
    padding: 7px 6px;
    font-size: 10.5px;
  }
  .history-kpis article {
    padding: 12px;
  }
  .history-visual-grid {
    margin-inline: -5px;
  }
  .interactive-chart {
    height: 210px;
  }
  .state-card {
    display: flex;
  }
  .evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .metric-line,
  .chart-marker,
  .chart-marker-line {
    transition: none;
  }
}

.speed-comparison {
  margin: 0 0 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

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

.speed-gauge-card {
  --gauge-color: var(--muted);
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--wash);
}

.speed-gauge-card.state-ok { --gauge-color: var(--green); }
.speed-gauge-card.state-low { --gauge-color: var(--red); }

.speed-gauge {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--surface);
}

.speed-gauge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.speed-gauge circle {
  fill: none;
  stroke-width: 10;
}

.speed-gauge .gauge-track {
  stroke: var(--line);
}

.speed-gauge .gauge-progress {
  stroke: var(--gauge-color);
  stroke-linecap: round;
}

.speed-gauge > span {
  position: relative;
  z-index: 1;
  color: var(--gauge-color);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.speed-gauge > span small {
  font-size: 14px;
  letter-spacing: 0;
}

.speed-gauge-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.speed-gauge-card strong {
  font-size: 22px;
}

.speed-gauge-card .speed-state {
  color: var(--gauge-color);
  font-weight: 750;
}

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

.remote-tests {
  margin: 0 0 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.section-title h2 {
  margin: 0 0 15px;
}

.remote-test-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.remote-test-grid article {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 105px;
  padding: 16px;
  background: var(--wash);
  border-radius: 14px;
  transition: transform 0.2s ease;
}

.remote-test-grid article:hover {
  transform: translateY(-2px);
}

.remote-test-grid p, .remote-test-grid small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.remote-test-grid strong {
  font-size: 19px;
  font-weight: 750;
}

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

.report-appendix {
  margin: 0;
}

.report-appendix div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.report-appendix dt {
  color: var(--muted);
}

.report-appendix dd {
  margin: 0;
  font-weight: 750;
}

@media (max-width: 650px) {
  .remote-test-grid,
  .speed-gauge-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .speed-gauge-card {
    gap: 16px;
    padding: 16px;
  }
  .speed-gauge {
    width: 92px;
    height: 92px;
  }
}

.locale-form {
  margin: 0;
}

.locale-form label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

.locale-form select {
  max-width: 155px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px;
  color: var(--ink);
  cursor: pointer;
}

.locale-form noscript button {
  padding: 7px 10px;
}

@media (max-width: 500px) {
  .auth-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card-header .locale-form,
  .auth-card-header .locale-form label {
    width: 100%;
  }

  .auth-card-header .locale-form select {
    max-width: none;
    flex: 1;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 70px;
    padding: 12px 16px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    position: static;
  }
  .topbar nav {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .topbar nav .nav-secondary {
    display: inline-flex;
  }
  .topbar nav a,
  .topbar nav form {
    min-width: 0;
  }
  .topbar .locale-form {
    max-width: 100%;
  }
  .topbar .locale-form label span {
    display: none;
  }
  .locale-form select {
    max-width: 135px;
  }
  .page,
  footer,
  .narrow,
  .card-form,
  fieldset,
  label,
  input,
  select,
  textarea {
    min-width: 0;
  }
  input,
  select,
  textarea {
    max-width: 100%;
  }
}

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