﻿@charset "UTF-8";
:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --card-hover: #fafaf8;
  --ink: #1b1b18;
  --muted: #6f6d66;
  --accent: #0f6e56;
  --accent-soft: rgba(15, 110, 86, .12);
  --border: #e7e4db;
  --error: #b03333;
  --danger: #b03333;
  --danger-soft: rgba(176, 51, 51, .12);
  --shadow: 0 2px 10px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .08);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

::selection {
  background: var(--accent-soft);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.topbar .controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.topbar .controls select {
  min-width: 150px;
}
.topbar .controls #site-search {
  min-width: 220px;
}
.topbar .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.topbar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.topbar a:hover {
  color: var(--accent);
}

/* ---------- Top bar left ---------- */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Admin link top ---------- */
.admin-link-top {
  padding: 8px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ---------- Compare toggle ---------- */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Form controls ---------- */
select,
input,
button {
  font: inherit;
  padding: 11px 14px;
  border-radius: 10px;
  transition: 0.18s ease;
}

select,
input {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
}
select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

button {
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
button:active {
  transform: translateY(0);
}
button.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
}
button.secondary:hover {
  background: var(--card-hover);
}
button.warning {
  background: #b7791f;
  color: #fff;
}
button.warning:hover {
  box-shadow: 0 0 0 4px rgba(183, 121, 31, 0.18);
}

/* ---------- Layout ---------- */
main {
  max-width: 1280px;
  margin: 32px auto;
  padding: 0 18px;
}

/* ---------- Dashboard cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
  overflow: visible;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
  overflow: visible;
  z-index: 1;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent);
  border-radius: 16px 16px 0 0;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.card .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.card .value {
  font-size: clamp(2rem, 4vw, 2.4rem);
  font-weight: 650;
  line-height: 1;
}
.card.kpi-open {
  z-index: 30;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 18px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 650;
}

.chart-wrap {
  height: 220px;
}

/* ---------- Dashboard topbar medium breakpoint ---------- */
@media (max-width: 1200px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }
  .topbar-left {
    flex: 1 1 auto;
    min-width: 220px;
  }
  .topbar .controls {
    flex: 1 1 100%;
    justify-content: flex-end;
    gap: 8px;
  }
  .topbar .controls > select {
    min-width: 170px;
  }
  .topbar .controls > #site-search {
    min-width: 180px;
  }
  .compare-wrap {
    max-width: 300px;
  }
  .compare-toggle {
    white-space: normal;
    line-height: 1.2;
  }
  .topbar .controls button {
    white-space: nowrap;
  }
}
@media (max-width: 1100px) {
  .topbar {
    align-items: stretch;
  }
  .topbar-left {
    width: 100%;
    justify-content: space-between;
  }
  .topbar .controls {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .topbar .controls > select,
  .topbar .controls > input,
  .topbar .controls > button,
  .compare-wrap {
    flex: 1 1 220px;
    min-width: 0;
  }
}
@media (max-width: 768px) {
  .topbar .controls > select,
  .topbar .controls > input,
  .topbar .controls > button,
  .compare-wrap {
    flex: 1 1 100%;
  }
  .compare-toggle {
    white-space: nowrap;
  }
}
/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table td,
table th {
  padding: 16px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table tr:hover {
  background: rgba(15, 110, 86, 0.025);
}
table tr:last-child td {
  border-bottom: none;
}
table td:last-child,
table th:last-child {
  text-align: right;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.off {
  background: #f1efe9;
  color: var(--muted);
}

/* ---------- Code snippets ---------- */
.snippet {
  margin-top: 10px;
  padding: 10px 12px;
  background: #1f2430; /* softer */
  color: #e8f3ef;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-x: auto;
}

.snippet-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.snippet-actions .button-xs {
  padding: 5px 10px;
  border-radius: 8px;
}

/* ---------- Event category summary ---------- */
.event-category-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--card-hover);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.category-name {
  color: var(--ink);
}

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

.button-xs[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
}
/* Panel header alignment */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2 {
  margin: 0;
}
.panel-head .button-xs {
  margin-left: auto;
  white-space: nowrap;
}

/* Tracked events scalability */
.events-panel .event-category-summary {
  margin-bottom: 12px;
}

.events-panel .events-toolbar {
  margin-bottom: 10px;
}

.events-mode-toggle {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 12px;
}
.events-mode-toggle .button-xs.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.events-table-wrap {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 12px 10px; /* added padding so rows aren’t flush to edge */
  background: var(--card);
}

.events-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.events-table td,
.events-table th {
  padding: 14px 10px; /* less cramped */
}

.events-table .event-category-row td {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.events-table .event-category-row td {
  text-align: left !important;
  background: var(--card-hover);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.events-table td {
  background: var(--card);
}

/* Mobile */
@media (max-width: 768px) {
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .panel-head .button-xs {
    margin-left: 0;
    width: 100%;
  }
  .events-table-wrap {
    max-height: 360px;
  }
}
/* Tracking health UX */
.tracking-health-panel .panel-head {
  margin-bottom: 10px;
}

.health-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--card-hover);
}
.health-empty p {
  margin: 0 0 6px;
}
.health-empty p:last-child {
  margin-bottom: 0;
}

.health-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.health-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--card);
}
.health-item .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.health-item .value {
  font-size: 1rem;
  font-weight: 650;
}

@media (max-width: 900px) {
  .health-details {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}
@media (max-width: 560px) {
  .health-details {
    grid-template-columns: 1fr;
  }
}
.compare-help {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .compare-help {
    white-space: normal;
    display: block;
    width: 100%;
  }
}
.compare-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.compare-info-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
  line-height: 1;
}

.compare-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(320px, 90vw);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}
.compare-popover strong {
  display: block;
  margin-bottom: 4px;
}
.compare-popover p {
  margin: 0 0 6px;
  font-size: 0.85rem;
}
.compare-popover p:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .compare-wrap {
    width: 100%;
  }
  .compare-popover {
    left: 0;
    right: 0;
    width: auto;
  }
}
.info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
}

.info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.kpi-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(240px, 80vw);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Sections Modal ---------- */
.sections-modal-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.sections-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.section-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--card);
}

@media (max-width: 768px) {
  .sections-list {
    grid-template-columns: 1fr;
  }
}
/* ---------- Admin: System trackers panel ---------- */
#system-trackers-table td:first-child {
  font-weight: 600;
}
#system-trackers-table td:nth-child(2) {
  color: var(--muted);
}
#system-trackers-table td:nth-child(3) .mono {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-hover);
  font-size: 0.8rem;
}
#system-trackers-table td:nth-child(4) {
  white-space: nowrap;
}
#system-trackers-table td:last-child {
  min-width: 140px;
}
#system-trackers-table .button-xs {
  min-width: 110px;
}

/* create form layout for system tracker controls */
.panel .inline:has(#system-tracker-site) {
  display: grid;
  grid-template-columns: 220px 1fr 180px auto;
  gap: 10px;
  align-items: center;
}
.panel .inline:has(#system-tracker-site) #system-tracker-site,
.panel .inline:has(#system-tracker-site) #system-tracker-name,
.panel .inline:has(#system-tracker-site) #system-tracker-type {
  width: 100%;
  min-width: 0;
}
.panel .inline:has(#system-tracker-site) button[type=submit] {
  white-space: nowrap;
}

#system-tracker-error {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .panel .inline:has(#system-tracker-site) {
    grid-template-columns: 1fr;
  }
  #system-trackers-table td:last-child {
    min-width: 0;
  }
  #system-trackers-table .button-xs {
    width: 100%;
  }
}
/* ---------- Tracked events UX refinements ---------- */
/* Override global table alignment for this table */
.events-table th,
.events-table td {
  text-align: left;
}

.events-table th:last-child,
.events-table td:last-child {
  text-align: right;
  width: 90px;
}

/* Category rows should always be left aligned */
.events-table .event-category-row td {
  text-align: left !important;
  background: var(--card-hover);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Event row content */
.event-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.goal-pin-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.goal-pin-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* Goals summary card */
.goals-summary {
  margin: 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-hover);
  padding: 10px 12px;
}

.goal-summary-head {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.goal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8rem;
}

.goal-pill-remove {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0;
  line-height: 1;
}

/* ---------- Dashboard footer ---------- */
.dashboard-footer {
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

@media (max-width: 768px) {
  .dashboard-footer {
    flex-direction: column;
    gap: 6px;
  }
}
/* ---------- Device Details Styles ---------- */
.device-detail-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.device-detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--card);
}
.device-detail-card h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compact-table th,
.compact-table td {
  padding: 8px 6px;
  font-size: 0.88rem;
}

.top-screens {
  margin-top: 12px;
}
.top-screens .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.screen-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.screen-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-hover);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .device-detail-grid {
    grid-template-columns: 1fr;
  }
}
/* ---------- Site selector ---------- */
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.18s ease;
}
.checks label:hover {
  background: var(--card-hover);
  border-color: var(--accent);
}

/* ---------- Forms ---------- */
.inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.inline input {
  flex: 1 1 220px;
}

/* ---------- Login ---------- */
.auth-card,
#login-screen,
#password-screen,
#reset-screen,
#gate {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.auth-card h2,
#login-screen h2,
#password-screen h2,
#reset-screen h2,
#gate h2 {
  margin: 0 0 22px;
  font-size: 1.35rem;
}
.auth-card input,
#login-screen input,
#password-screen input,
#reset-screen input,
#gate input {
  width: 100%;
  margin-bottom: 12px;
}
.auth-card button,
#login-screen button,
#password-screen button,
#reset-screen button,
#gate button {
  width: 100%;
  margin-top: 6px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.link-button {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  padding: 0;
}
.link-button:hover {
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar .actions {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    justify-content: flex-end;
  }
  .inline {
    flex-direction: column;
  }
  table {
    font-size: 0.9rem;
  }
}
/* ---------- Admin ---------- */
.admin-user-form {
  margin-top: 18px;
}

.admin-user-form > .inline:first-child {
  margin-top: 0;
}

.admin-user-form > .inline:last-of-type {
  margin-top: 16px;
}

.admin-user-form > .inline:last-of-type button {
  flex: 0 0 auto;
}

.admin-user-form > .checks {
  margin-top: 18px;
}

.admin-user-form > .error {
  margin-top: 4px;
}

.panel table + .inline {
  padding-top: 4px;
}

.site-check {
  margin: 0;
}

.site-check input {
  width: auto;
  flex: 0 0 auto;
}

@media (max-width: 768px) {
  .panel {
    padding: 18px;
  }
  .panel table {
    display: block;
    overflow-x: auto;
  }
  .panel table th,
  .panel table td {
    white-space: nowrap;
  }
  .panel table th:first-child,
  .panel table td:first-child {
    white-space: normal;
    min-width: 220px;
  }
  .checks {
    grid-template-columns: 1fr;
  }
}
/* ---------- Admin tabs restore ---------- */
.admin-tabs {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}

.admin-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.admin-tab:hover {
  background: var(--card-hover);
}
.admin-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.admin-tab-panel {
  display: none;
}
.admin-tab-panel.active {
  display: block;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---------- Sites row tidy ---------- */
.site-col-main {
  max-width: 760px;
}
.site-col-main .site-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.site-col-main .site-name-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.site-col-main .site-name-button:hover {
  color: var(--accent);
  text-decoration: underline;
}
.site-col-main .site-id-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-hover);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.8;
}
.site-col-main .site-id-icon {
  font-weight: 700;
  opacity: 0.75;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 650;
}

.site-name-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.site-name-button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-id-subtle {
  opacity: 0.45;
  font-size: 0.72rem;
  margin-top: 2px;
}

.site-domain {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.action-stack {
  display: flex;
  flex-direction: row; /* desktop horizontal */
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

#sites-table .site-col-actions {
  min-width: 260px;
}

#sites-table .site-col-actions button {
  min-width: 132px;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  /* ----- Global admin mobile tidy ----- */
  main {
    padding: 0 10px;
    margin-top: 10px;
  }
  .panel {
    padding: 14px;
    border-radius: 12px;
  }
  .topbar {
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar .controls {
    width: 100%;
  }
  .topbar .controls button {
    width: 100%;
  }
  .admin-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .admin-tab {
    width: 100%;
    text-align: center;
    padding: 10px 8px;
  }
  .sites-toolbar,
  .users-toolbar,
  .system-trackers-toolbar,
  .inline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sites-toolbar select,
  .users-toolbar select,
  .inline input,
  .inline select,
  .inline button,
  .system-trackers-toolbar button {
    width: 100%;
    min-width: 0;
  }
  /* prevent horizontal table scroll mess */
  .panel table {
    display: table;
    width: 100%;
    overflow: visible;
  }
  /* sites as cards on mobile */
  #sites-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    background: var(--card);
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  #sites-table td {
    display: block;
    border: 0;
    padding: 6px 0;
    text-align: left !important;
  }
  #sites-table .site-col-actions .action-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #sites-table .site-col-actions button {
    width: 100%;
    min-width: 0;
  }
  /* system tracker action buttons compact */
  .system-trackers-grid td:last-child .action-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;
  }
  .system-trackers-grid td:last-child .button-xs {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
  }
  /* bulk keys output readability */
  #bulk-trackers-keys {
    width: 100%;
    min-height: 170px;
    font-size: 0.82rem;
    line-height: 1.35;
  }
  .modal {
    padding: 10px;
  }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow: auto;
    padding: 14px;
  }
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .modal-actions button {
    width: 100%;
  }
}
/* ---------- Canonical mobile admin ---------- */
@media (max-width: 900px) {
  main {
    padding: 0 10px;
    margin-top: 10px;
  }
  .panel {
    padding: 14px;
    border-radius: 12px;
  }
  .topbar {
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar .controls, .topbar .controls button {
    width: 100%;
  }
  .admin-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .admin-tab {
    width: 100%;
    text-align: center;
    padding: 10px 8px;
  }
  .sites-toolbar,
  .users-toolbar,
  .system-trackers-toolbar,
  .inline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sites-toolbar select,
  .users-toolbar select,
  .inline input,
  .inline select,
  .inline button,
  .system-trackers-toolbar button {
    width: 100%;
    min-width: 0;
  }
  /* Sites table as cards */
  #tab-sites .sites-grid thead {
    display: none;
  }
  #tab-sites .sites-grid,
  #tab-sites .sites-grid tbody,
  #tab-sites .sites-grid tr,
  #tab-sites .sites-grid td {
    display: block;
    width: 100%;
  }
  #sites-table tr.site-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 12px;
  }
  #sites-table tr.site-row td {
    border: 0 !important;
    padding: 6px 0 !important;
    text-align: left !important;
    min-width: 0 !important;
  }
  #sites-table .site-domain {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
  }
  #sites-table .status-stack {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  #sites-table .snippet-actions,
  #sites-table .site-col-actions .action-stack {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  #sites-table .snippet-actions .button-xs,
  #sites-table .site-col-actions button {
    width: 100%;
    min-width: 0;
  }
  /* System trackers actions compact */
  .system-trackers-grid td:last-child .action-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;
  }
  .system-trackers-grid td:last-child .button-xs {
    width: 100%;
    min-width: 0;
  }
  /* Modal fit */
  .modal {
    padding: 10px;
  }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow: auto;
    padding: 14px;
  }
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .modal-actions button {
    width: 100%;
  }
  #bulk-trackers-keys {
    width: 100%;
    min-height: 170px;
    font-size: 0.82rem;
    line-height: 1.35;
  }
}
/* ---------- Admin users polish (alignment + mobile) ---------- */
/* Desktop/tablet: cleaner column balance */
#tab-users .panel table {
  table-layout: auto;
}

#users-table td {
  vertical-align: middle;
}

#users-table td:nth-child(1) {
  min-width: 260px;
} /* user */
#users-table td:nth-child(2) {
  min-width: 120px;
} /* sites */
#users-table td:nth-child(3) {
  min-width: 95px;
} /* status */
#users-table td:nth-child(4) {
  min-width: 190px;
} /* last login */
#users-table td:nth-child(5) {
  min-width: 360px;
} /* actions */
#users-table .table-actions {
  text-align: right;
}

#users-table .action-stack {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#users-table .action-stack .button-xs {
  min-width: 112px;
}

/* User create form: keep fields aligned and not oversized */
.admin-user-form > .inline:first-child {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.admin-user-form > .inline:first-child input {
  width: 100%;
  min-width: 0;
}

.admin-user-form > .inline:first-child label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  margin: 0;
}

/* Prevent giant inputs when .inline becomes column on mobile */
@media (max-width: 900px) {
  #tab-users .inline input,
  #tab-sites .inline input,
  #reset-password-modal .inline input {
    flex: 0 1 auto;
    min-height: 44px;
  }
  /* Override generic mobile table scroller for Users only */
  #tab-users .panel table {
    display: table;
    width: 100%;
    overflow: visible;
    table-layout: fixed;
  }
  #tab-users .panel table th,
  #tab-users .panel table td {
    white-space: normal;
    word-break: break-word;
  }
  #tab-users .panel table th:last-child,
  #tab-users .panel table td:last-child {
    text-align: left;
  }
  #users-table .action-stack {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  #users-table .action-stack button {
    min-width: 0;
    flex: 1 1 140px;
  }
  .users-toolbar {
    margin-bottom: 14px;
  }
}
/* ---------- Mobile users as cards (no horizontal table scroll) ---------- */
@media (max-width: 760px) {
  /* turn users table into stacked cards */
  #tab-users .panel table {
    display: block;
    width: 100%;
  }
  #tab-users .panel table thead {
    display: none;
  }
  #tab-users .panel table tbody,
  #tab-users .panel table tr,
  #tab-users .panel table td {
    display: block;
    width: 100%;
  }
  #users-table tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    background: var(--card);
    padding: 12px;
    margin-bottom: 12px;
  }
  #users-table td {
    border: 0;
    padding: 6px 0;
    min-width: 0 !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word;
  }
  /* compact field labels */
  #users-table td:nth-child(1)::before {
    content: "User";
  }
  #users-table td:nth-child(2)::before {
    content: "Sites";
  }
  #users-table td:nth-child(3)::before {
    content: "Status";
  }
  #users-table td:nth-child(4)::before {
    content: "Last login";
  }
  #users-table td:nth-child(-n+4)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 650;
  }
  /* actions row */
  #users-table td:nth-child(5) {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  #users-table .action-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }
  #users-table .action-stack button {
    width: 100%;
    min-width: 0;
  }
  /* user-create form tighter on mobile */
  .admin-user-form > .inline:first-child {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .admin-user-form > .inline:first-child label {
    justify-content: flex-start;
  }
}
/* ---------- Admin table consistency + sites clarity ---------- */
/* 1) Keep header and data alignment consistent */
#tab-users table th,
#tab-users table td,
#tab-sites .sites-grid th,
#tab-sites .sites-grid td {
  text-align: left;
}

/* actions column stays right-aligned on desktop (header + cells match) */
#tab-users table th:last-child,
#tab-users table td:last-child,
#tab-sites .sites-grid th:last-child,
#tab-sites .sites-grid td:last-child {
  text-align: right;
}

/* 2) Stable site table layout (prevents random wrapping/row height jumps) */
#tab-sites .sites-grid {
  table-layout: fixed;
}

#tab-sites .sites-grid th:nth-child(1),
#tab-sites .sites-grid td:nth-child(1) {
  width: 56%;
}

#tab-sites .sites-grid th:nth-child(2),
#tab-sites .sites-grid td:nth-child(2) {
  width: 18%;
}

#tab-sites .sites-grid th:nth-child(3),
#tab-sites .sites-grid td:nth-child(3) {
  width: 26%;
}

/* single-line, neat name/domain in large lists */
#sites-table .site-name,
#sites-table .site-domain {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sites-table .site-domain {
  max-width: 100%;
}

/* 3) Mobile: readable, no weird align shifts */
@media (max-width: 900px) {
  #tab-users table th,
  #tab-users table td,
  #tab-sites .sites-grid th,
  #tab-sites .sites-grid td {
    text-align: left !important;
  }
  /* drop fixed widths on mobile */
  #tab-sites .sites-grid {
    table-layout: auto;
  }
  #tab-sites .sites-grid th,
  #tab-sites .sites-grid td {
    width: auto;
  }
  /* allow wrapping on mobile so text is readable */
  #sites-table .site-name,
  #sites-table .site-domain {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }
}
/* ---------- System trackers table consistency ---------- */
.system-trackers-grid {
  table-layout: fixed;
}

.system-trackers-grid th,
.system-trackers-grid td {
  text-align: left;
  vertical-align: middle;
}

.system-trackers-grid th:last-child,
.system-trackers-grid td:last-child {
  text-align: right;
}

/* consistent column widths */
.system-trackers-grid th:nth-child(1),
.system-trackers-grid td:nth-child(1) {
  width: 34%;
} /* name */
.system-trackers-grid th:nth-child(2),
.system-trackers-grid td:nth-child(2) {
  width: 24%;
} /* site */
.system-trackers-grid th:nth-child(3),
.system-trackers-grid td:nth-child(3) {
  width: 16%;
} /* type */
.system-trackers-grid th:nth-child(4),
.system-trackers-grid td:nth-child(4) {
  width: 14%;
} /* status */
.system-trackers-grid th:nth-child(5),
.system-trackers-grid td:nth-child(5) {
  width: 20%;
} /* actions */
/* stop messy mixed wrapping on desktop */
.system-trackers-grid td:nth-child(1),
.system-trackers-grid td:nth-child(2),
.system-trackers-grid td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .system-trackers-grid {
    table-layout: auto;
  }
  .system-trackers-grid th,
  .system-trackers-grid td {
    width: auto;
    text-align: left !important;
    white-space: normal;
    word-break: break-word;
  }
}
/* ----- Tracker actions compact ----- */
.system-trackers-grid td:last-child .action-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.system-trackers-grid td:last-child .button-xs {
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.2;
}

/* mobile: stack less aggressively */
@media (max-width: 900px) {
  .system-trackers-grid td:last-child .action-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;
  }
  .system-trackers-grid td:last-child .button-xs {
    width: 100%;
  }
}
/* ---------- Final mobile override (Sites panel) ---------- */
@media (max-width: 900px) {
  /* Hide desktop table header for Sites on mobile */
  #tab-sites .sites-grid thead {
    display: none;
  }
  #tab-sites .sites-grid,
  #tab-sites .sites-grid tbody,
  #tab-sites .sites-grid tr,
  #tab-sites .sites-grid td {
    display: block;
    width: 100%;
  }
  /* Card row */
  #sites-table tr.site-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 12px;
  }
  #sites-table tr.site-row td {
    border: 0 !important;
    padding: 6px 0 !important;
    text-align: left !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  /* Content readability */
  #sites-table .site-name {
    font-size: 1.1rem;
    line-height: 1.25;
  }
  #sites-table .site-domain {
    white-space: normal !important;
    word-break: break-word;
    overflow: visible !important;
    text-overflow: unset !important;
  }
  #sites-table .status-stack {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  /* Actions in 2-col grid */
  #sites-table .site-col-actions .action-stack {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  #sites-table .site-col-actions .action-stack button {
    width: 100%;
    min-width: 0;
  }
  /* Snippet actions stay compact */
  #sites-table .snippet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #sites-table .snippet-actions .button-xs {
    width: 100%;
  }
  /* Keep forms neat */
  #tab-sites .inline,
  #tab-sites .sites-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #tab-sites .inline input,
  #tab-sites .inline select,
  #tab-sites .inline button,
  #tab-sites .sites-toolbar input,
  #tab-sites .sites-toolbar select {
    width: 100%;
    min-width: 0;
  }
}
/* ---------- Prospectus panel desktop layout ---------- */
@media (min-width: 901px) {
  #prospectus-panel .prospectus-header-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
  }
  #prospectus-panel .prospectus-tabs {
    justify-self: start;
    margin: 0;
  }
  #prospectus-panel .prospectus-refresh-btn {
    margin-left: 0;
    justify-self: end;
    white-space: nowrap;
  }
  #prospectus-panel #tracking-readiness-summary {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    font-weight: 600;
  }
  #prospectus-panel #prospectus-readiness-panel .system-trackers-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 220px) auto 1fr;
    align-items: center;
    gap: 10px;
  }
  #prospectus-panel #tracking-readiness-days {
    width: 100%;
    min-width: 0;
  }
  #prospectus-panel #prospectus-readiness-panel .system-trackers-toolbar .secondary {
    width: auto;
    min-width: 0;
  }
}
/* ---------- Sites toolbar desktop layout ---------- */
@media (min-width: 901px) {
  #tab-sites .sites-toolbar {
    display: grid;
    grid-template-columns: minmax(320px, 1.2fr) minmax(220px, 280px) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
  }
  #tab-sites #site-search,
  #tab-sites #site-filter {
    width: 100%;
    min-width: 0;
  }
  #tab-sites #sites-visible-count {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    font-weight: 600;
  }
  #tab-sites .sites-grid th:nth-child(1),
  #tab-sites .sites-grid td:nth-child(1) {
    width: 58%;
  }
  #tab-sites .sites-grid th:nth-child(2),
  #tab-sites .sites-grid td:nth-child(2) {
    width: 18%;
  }
  #tab-sites .sites-grid th:nth-child(3),
  #tab-sites .sites-grid td:nth-child(3) {
    width: 24%;
  }
}
/* ---------- Prospectus tabs visual states ---------- */
#prospectus-panel .prospectus-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-hover);
  margin: 0;
}
#prospectus-panel .prospectus-tabs .secondary {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 650;
  line-height: 1.2;
  box-shadow: none;
  transform: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
#prospectus-panel .prospectus-tabs .secondary:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
}
#prospectus-panel .prospectus-tabs .secondary.active {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
#prospectus-panel .prospectus-tabs .secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Prospectus tables: consistent left alignment ---------- */
#prospectus-panel {
  /* optional: make code column feel cleaner */
}
#prospectus-panel table th,
#prospectus-panel table td {
  text-align: left !important;
  vertical-align: top;
}
#prospectus-panel table th:last-child,
#prospectus-panel table td:last-child {
  text-align: left !important;
}
#prospectus-panel code.mono {
  white-space: pre-wrap;
  word-break: break-word;
  display: inline-block;
  max-width: 100%;
}

/* ---------- Prospectus readiness polish ---------- */
#prospectus-panel {
  /* mobile collapse for readiness table only */
}
#prospectus-panel #prospectus-readiness-panel {
  margin-top: 14px;
}
#prospectus-panel #prospectus-readiness-panel .system-trackers-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
#prospectus-panel #prospectus-readiness-panel .system-trackers-toolbar .secondary {
  width: auto;
  min-width: 132px;
}
#prospectus-panel #prospectus-readiness-panel #tracking-readiness-summary {
  font-weight: 700;
  line-height: 1.2;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-hover);
}
#prospectus-panel #prospectus-readiness-panel .readiness-site-name {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 2px;
}
#prospectus-panel #prospectus-readiness-panel .readiness-missing-inline {
  display: inline;
  line-height: 1.45;
  color: var(--ink);
}
#prospectus-panel #prospectus-readiness-panel .readiness-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}
#prospectus-panel #prospectus-readiness-panel .readiness-pill.is-ready {
  background: var(--accent-soft);
  color: var(--accent);
}
#prospectus-panel #prospectus-readiness-panel .readiness-pill.is-failing {
  background: #fff4f2;
  color: #a1382c;
  border-color: #f0d1cb;
}
@media (max-width: 900px) {
  #prospectus-panel #prospectus-readiness-panel .system-trackers-toolbar {
    margin-top: 4px;
    margin-bottom: 10px;
  }
  #prospectus-panel #prospectus-readiness-panel table thead {
    display: none;
  }
  #prospectus-panel #prospectus-readiness-panel table tbody,
  #prospectus-panel #prospectus-readiness-panel table tr,
  #prospectus-panel #prospectus-readiness-panel table td {
    display: block;
    width: 100%;
  }
  #prospectus-panel #prospectus-readiness-panel table tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--card);
  }
  #prospectus-panel #prospectus-readiness-panel table td {
    border: 0;
    padding: 4px 0;
    text-align: left !important;
  }
  #prospectus-panel #prospectus-readiness-panel table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 2px;
  }
}

.sites-grid-wrap {
  max-height: 34rem;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 6px;
}

.sites-grid-wrap .sites-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}

/* Keep headers visible while scrolling, without a boxed look */
.sites-grid-wrap .sites-grid thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

#prospectus-panel #prospectus-readiness-panel .readiness-table-wrap {
  max-height: 30rem;
  overflow-y: auto;
  overflow-x: hidden;
}
#prospectus-panel #prospectus-readiness-panel .readiness-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.4;
}
#prospectus-panel #prospectus-readiness-panel .readiness-check {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}
#prospectus-panel #prospectus-readiness-panel .readiness-check.is-used {
  background: var(--accent-soft);
  color: var(--accent);
}
#prospectus-panel #prospectus-readiness-panel .readiness-check.is-unused {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
}

#user-sites-modal .modal-card {
  width: min(760px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
#user-sites-modal #user-sites-checks {
  max-height: 52vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-top: 8px;
}
#user-sites-modal .modal-actions {
  margin-top: 12px;
  padding-top: 8px;
  background: var(--card);
}
