:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d0d5dd;
  --accent: #1f4e79;
  --good: #027a48;
  --good-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --neutral-bg: #f2f4f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--accent);
  text-transform: uppercase;
  font-size: .85rem;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  margin-top: 4px;
}

h2 {
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
}

.userbox {
  text-align: right;
  line-height: 1.5;
}

.userbox a,
.school-switcher a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.school-switcher {
  padding: 14px 32px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #eef3f8;
  border-bottom: 1px solid var(--border);
}

.school-switcher a {
  padding: 6px 10px;
  border-radius: 999px;
}

.school-switcher a.active {
  background: var(--accent);
  color: white;
}

.dashboard {
  padding: 28px 32px;
  display: grid;
  gap: 24px;
}

.card,
.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border-left: 8px solid var(--accent);
}

.hero h2 {
  font-size: 1.45rem;
  margin: 4px 0 8px;
}

.hero p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-red {
  border-left-color: var(--danger);
}

.hero-yellow {
  border-left-color: var(--warning);
}

.hero-green {
  border-left-color: var(--good);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .75rem;
  font-weight: 800;
  color: var(--muted);
}

.health-badge {
  min-width: 150px;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: center;
}

.health-badge span {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
}

.health-badge strong {
  display: block;
  font-size: 1.45rem;
  margin-top: 2px;
}

.health-red,
.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fda29b;
}

.health-yellow,
.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fedf89;
}

.health-green,
.good {
  background: var(--good-bg);
  color: var(--good);
  border-color: #abefc6;
}

.neutral {
  background: var(--neutral-bg);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
}

.health-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.health-title {
  font-weight: 800;
}

.health-value {
  font-size: 2rem;
  font-weight: 900;
  margin-top: 6px;
}

.health-note {
  font-size: .9rem;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 16px;
}

.card {
  padding: 18px;
}

.card-warning {
  border-color: #fedf89;
  background: var(--warning-bg);
}

.card-danger {
  border-color: #fda29b;
  background: var(--danger-bg);
}

.metric {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.card-warning .metric {
  color: var(--warning);
}

.card-danger .metric {
  color: var(--danger);
}

.label {
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.submetric {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 8px;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-grid {
  display: grid;
  gap: 24px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 800;
  text-transform: capitalize;
}

.pill-danger,
.priority-urgent .status-pill {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill-warning,
.priority-high .status-pill,
.priority-watch .status-pill,
.priority-normal .status-pill {
  background: var(--warning-bg);
  color: var(--warning);
}

.pill-good {
  background: var(--good-bg);
  color: var(--good);
}

.pill-neutral,
.priority-on_freeze .status-pill,
.priority-needs_review .status-pill {
  background: var(--neutral-bg);
  color: var(--muted);
}

.item-list,
.retention-list,
.compact-list {
  display: grid;
  gap: 12px;
}

.action-item,
.retention-item,
.compact-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: white;
}

.action-item {
  border-left: 5px solid var(--border);
}

.priority-urgent {
  border-left-color: var(--danger);
}

.priority-high,
.priority-watch,
.priority-normal {
  border-left-color: var(--warning);
}

.priority-on_freeze,
.priority-needs_review {
  border-left-color: var(--muted);
}

.item-topline,
.compact-item,
.retention-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.item-meta,
.item-contact,
.item-note,
.reason {
  color: var(--muted);
  font-size: .9rem;
  margin-top: 6px;
}

.item-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reason {
  text-transform: capitalize;
}

.days-box,
.right-note {
  min-width: 84px;
  text-align: right;
}

.days-box strong,
.right-note strong {
  display: block;
  font-size: 1.3rem;
}

.days-box span,
.right-note span {
  color: var(--muted);
  font-size: .82rem;
}

.empty-state {
  padding: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.login-card h1 {
  margin: 8px 0;
}

.login-card form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.login-card label {
  font-weight: 700;
}

.login-card input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}

.login-card button {
  margin-top: 8px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 12px;
}

.flash-error {
  background: #fee4e2;
  border: 1px solid #fda29b;
}

.demo-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 1100px) {
  .cards,
  .health-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero,
  .item-topline,
  .retention-item,
  .compact-item {
    flex-direction: column;
  }

  .userbox,
  .days-box,
  .right-note {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .cards,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .dashboard,
  .school-switcher {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Retention outreach and owner-dashboard action surfaces. */
.student-name-link {
  color: var(--accent);
  text-decoration: none;
}

.student-name-link:hover {
  text-decoration: underline;
}

.retention-action-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.retention-action-metrics a {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 55%, white 45%);
  color: var(--text);
  text-decoration: none;
}

.retention-action-metrics strong {
  color: var(--accent);
  font-size: 1.2rem;
}

.retention-action-metrics span,
.latest-outreach-line {
  color: var(--muted);
  font-size: .78rem;
}

.latest-outreach-line {
  margin-top: 8px;
}

.recent-attendance-list,
.outreach-history-list {
  display: grid;
  gap: 10px;
}

.recent-attendance-item,
.outreach-history-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 38%, white 62%);
}

.recent-attendance-item time {
  color: var(--muted);
  font-size: .82rem;
  text-align: right;
}

.outreach-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--theme-surface-border, var(--border));
}

.outreach-log-panel summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.outreach-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.outreach-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.outreach-form input,
.outreach-form select,
.outreach-form textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font: inherit;
}

.outreach-note-field {
  grid-column: 1 / -1;
}

.outreach-submit {
  justify-self: start;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.student-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.student-summary-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 42%, white 58%);
}

.student-summary-grid span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.outreach-history-item {
  display: block;
}

.outreach-history-item p {
  margin-top: 8px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .retention-action-metrics,
  .student-summary-grid,
  .outreach-form {
    grid-template-columns: 1fr 1fr;
  }

  .outreach-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .retention-action-metrics,
  .student-summary-grid,
  .outreach-form {
    grid-template-columns: 1fr;
  }

  .recent-attendance-item {
    display: grid;
  }

  .recent-attendance-item time {
    text-align: left;
  }
}


/* Branding Pass 1 theme overrides */
:root {
  --brand-accent: #c89b3c;
}

.school-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.school-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .08);
}

.brand-mark::after {
  content: "";
  display: inline-block;
  width: 34px;
  height: 4px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--brand-accent);
  vertical-align: middle;
}

.hero {
  border-left-color: var(--brand-accent);
}

.school-switcher a.active {
  border-color: var(--accent);
}

.login-card button {
  border-color: var(--accent);
}

@media (max-width: 720px) {
  .school-brand {
    align-items: flex-start;
  }

  .school-logo {
    width: 48px;
    height: 48px;
  }
}


/* Alias for human-readable freeze priority class naming. */
.priority-on-freeze .status-pill {
  font-weight: 700;
}

.priority-on-freeze {
  font-weight: 700;
}

/* Branding Upload Pass 1B */
.flash-panel {
  border-left: 6px solid var(--brand-accent);
}

.branding-panel {
  max-width: 980px;
}

.branding-preview {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}

.branding-logo-preview {
  display: block;
  max-width: 260px;
  max-height: 160px;
  object-fit: contain;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
}

.branding-form {
  display: grid;
  gap: 12px;
}

.branding-form label {
  font-weight: 800;
}

.branding-form input[type="file"] {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.branding-form button {
  width: fit-content;
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 720px) {
  .branding-preview {
    grid-template-columns: 1fr;
  }
}

/* Branding Upload Pass 1E — color customization */
.color-grid {
  display: grid;
  gap: 14px;
}

.color-grid label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.color-grid input[type="color"] {
  width: 96px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

/* Branding Theme Surface Pass 1 — neutral tiles follow school theme
   Rule:
   - Neutral/non-alert tiles should feel like the school theme.
   - Red/amber/green warning states remain semantic and protected.
*/

body {
  --theme-surface: color-mix(in srgb, var(--bg) 82%, white 18%);
  --theme-surface-strong: color-mix(in srgb, var(--bg) 68%, white 32%);
  --theme-surface-border: color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  --theme-surface-shadow: rgba(15, 23, 42, .10);
}

/* Main neutral panels/cards */
.panel,
.card,
.health-card.neutral {
  background: var(--theme-surface);
  border-color: var(--theme-surface-border);
  box-shadow: 0 8px 22px var(--theme-surface-shadow);
}

/* Neutral metric tiles should look branded, not generic white */
.card:not(.card-warning):not(.card-danger) {
  background:
    linear-gradient(180deg, var(--theme-surface-strong), var(--theme-surface));
  border-color: var(--theme-surface-border);
}

.card:not(.card-warning):not(.card-danger) .metric {
  color: var(--accent);
}

.card:not(.card-warning):not(.card-danger) h3 {
  color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
}

/* Good/neutral health tiles should be theme-adjacent, not bright semantic green */
.health-card.good,
.health-card.neutral {
  background:
    linear-gradient(180deg, var(--theme-surface-strong), var(--theme-surface));
  border-color: var(--theme-surface-border);
}

.health-card.good .health-title,
.health-card.neutral .health-title {
  color: color-mix(in srgb, var(--accent) 76%, var(--text) 24%);
}

.health-card.good .health-value,
.health-card.neutral .health-value {
  color: var(--accent);
}

/* Keep warning/danger cards semantic and visually separate */
.card-warning,
.health-card.warning {
  background: #fff8e6;
  border-color: #f8c84e;
}

.card-danger,
.health-card.danger {
  background: #fff1f1;
  border-color: #ff9b8f;
}

.card-warning .metric,
.health-card.warning .health-value {
  color: #b45309;
}

.card-danger .metric,
.health-card.danger .health-value {
  color: #b42318;
}

/* Panels get a subtle brand edge like live JISIK/PTX */
.panel {
  border-left: 4px solid color-mix(in srgb, var(--brand-accent) 70%, var(--accent) 30%);
}

/* Do not put brand edge on already-semantic action items */
.action-item,
.retention-item {
  border-left-color: var(--brand-accent);
}

/* Owner Dashboard Compact Cards Pass — reduce report-like vertical height */
.panel-heading {
  gap: 12px;
  align-items: flex-start;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 55%, var(--border) 45%);
  color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
  font-weight: 800;
  font-size: .78rem;
  text-decoration: none;
  white-space: nowrap;
}

.placeholder-link {
  opacity: .72;
  cursor: default;
}

.action-panel .item-list,
.retention-list,
.compact-list {
  gap: 10px;
}

.action-item,
.retention-item,
.compact-item {
  padding: 14px 16px;
}

.action-panel .action-item {
  display: grid;
  gap: 5px;
}

.action-panel .item-topline,
.retention-item .item-topline {
  margin-bottom: 2px;
}

.action-panel .item-meta,
.action-panel .item-contact,
.retention-item .item-meta,
.retention-item .item-contact {
  line-height: 1.25;
}

.action-panel .item-contact,
.retention-item .item-contact {
  gap: 10px;
  flex-wrap: wrap;
}

.compact-reason {
  margin: 4px 0 0;
  line-height: 1.25;
}

.muted-inline {
  color: var(--muted);
  font-weight: 500;
}

.retention-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.days-box {
  min-width: 74px;
  padding: 8px 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 70%, white 30%);
  text-align: center;
}

.days-box strong {
  font-size: 1.25rem;
  line-height: 1;
}

.days-box span {
  font-size: .72rem;
}

@media (max-width: 760px) {
  .panel-heading {
    gap: 8px;
  }

  .panel-link {
    width: fit-content;
  }

  .retention-item {
    grid-template-columns: 1fr;
  }

  .days-box {
    width: fit-content;
    text-align: left;
  }
}

/* Owner Dashboard Real Compact Row Pass — make priority lists scannable */
.action-panel .item-list,
.retention-list {
  gap: 8px;
}

.action-panel .action-item,
.retention-item {
  padding: 10px 12px;
  border-radius: 16px;
  min-height: unset;
}

.action-panel .action-item {
  display: grid;
  grid-template-columns: minmax(180px, .9fr) minmax(260px, 1.4fr);
  grid-template-areas:
    "top meta"
    "top contact"
    "reason reason";
  column-gap: 14px;
  row-gap: 3px;
  align-items: center;
}

.action-panel .item-topline {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.action-panel .item-topline strong {
  font-size: 1rem;
  line-height: 1.1;
}

.action-panel .item-meta {
  grid-area: meta;
  margin: 0;
  line-height: 1.2;
}

.action-panel .item-contact {
  grid-area: contact;
  margin: 0;
  line-height: 1.2;
  gap: 8px;
}

.action-panel .compact-reason,
.action-panel .reason {
  grid-area: reason;
  margin: 2px 0 0;
  line-height: 1.2;
  font-size: .9rem;
}

.status-pill {
  display: inline-flex !important;
  width: auto !important;
  max-width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 3px 9px !important;
  border-radius: 999px;
  line-height: 1.05;
  font-size: .72rem;
  white-space: nowrap;
}

.retention-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: center;
  text-align: left !important;
}

.retention-item > div:first-child {
  text-align: left !important;
}

.retention-item .item-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 3px;
}

.retention-item .item-topline strong {
  font-size: 1rem;
  line-height: 1.1;
}

.retention-item .item-meta,
.retention-item .item-contact {
  margin: 0;
  line-height: 1.2;
}

.retention-item .item-contact {
  gap: 8px;
  flex-wrap: wrap;
}

.days-box {
  justify-self: end;
  min-width: 70px;
  padding: 7px 9px;
  border-radius: 12px;
  text-align: center !important;
}

.days-box strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
}

.days-box span {
  display: block;
  font-size: .68rem;
  line-height: 1.1;
}

.panel-heading {
  align-items: center;
}

.panel-heading .pill {
  white-space: nowrap;
}

.panel-link {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .action-panel .action-item {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "meta"
      "contact"
      "reason";
  }

  .retention-item {
    grid-template-columns: 1fr;
  }

  .days-box {
    justify-self: start;
  }
}

/* Owner Dashboard RYG Health Check Pass — live-style operational checklist */
.ryg-panel {
  margin-top: 18px;
}

.ryg-list {
  display: grid;
  gap: 10px;
}

.ryg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--theme-surface-border);
  background: color-mix(in srgb, var(--theme-surface) 84%, white 16%);
}

.ryg-row.good {
  border-color: rgba(22, 163, 74, .35);
  background: rgba(22, 163, 74, .055);
}

.ryg-row.warning {
  border-color: rgba(217, 119, 6, .42);
  background: rgba(217, 119, 6, .075);
}

.ryg-row.danger {
  border-color: rgba(185, 28, 28, .42);
  background: rgba(185, 28, 28, .075);
}

.ryg-row.neutral {
  border-color: var(--theme-surface-border);
  background: color-mix(in srgb, var(--theme-surface) 88%, white 12%);
}

.ryg-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 3px;
}

.ryg-title strong {
  font-size: .98rem;
  line-height: 1.15;
}

.ryg-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  flex: 0 0 auto;
}

.ryg-row.good .ryg-dot,
.ryg-row.good .ryg-status {
  background: #16a34a;
  color: white;
}

.ryg-row.warning .ryg-dot,
.ryg-row.warning .ryg-status {
  background: #d97706;
  color: white;
}

.ryg-row.danger .ryg-dot,
.ryg-row.danger .ryg-status {
  background: #b91c1c;
  color: white;
}

.ryg-row.neutral .ryg-dot,
.ryg-row.neutral .ryg-status {
  background: color-mix(in srgb, var(--accent) 72%, var(--muted) 28%);
  color: white;
}

.ryg-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.25;
  font-size: .9rem;
}

.ryg-status {
  min-width: 72px;
  text-align: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
}

@media (max-width: 760px) {
  .ryg-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .ryg-status {
    width: fit-content;
  }
}

/* Owner Dashboard RYG + Retention Pair Pass */
.priority-health-grid {
  align-items: stretch;
}

.priority-health-grid .ryg-panel,
.priority-health-grid .retention-panel {
  margin-top: 0;
}

.priority-health-grid .ryg-panel .ryg-list {
  gap: 8px;
}

.priority-health-grid .ryg-row {
  padding: 10px 12px;
}

.priority-health-grid .ryg-main p {
  font-size: .86rem;
}

.priority-health-grid .ryg-status {
  min-width: 64px;
  padding: 4px 8px;
}

.priority-health-grid .retention-list {
  gap: 8px;
}

.priority-health-grid .retention-item {
  padding: 10px 12px;
}

@media (max-width: 980px) {
  .priority-health-grid {
    grid-template-columns: 1fr;
  }
}

/* Owner Dashboard Quick Stats Top Pass */
main > .cards:first-of-type {
  margin-top: 0;
  margin-bottom: 18px;
}

main > .cards:first-of-type + .hero {
  margin-top: 0;
}

/* Owner Dashboard Build Part 2 - Lead Pipeline View All */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 18px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--theme-surface-border, rgba(31, 58, 95, .18));
  border-radius: 999px;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: 700;
  background: rgba(255, 255, 255, .52);
}

.filter-tab.active {
  background: var(--accent, #1f4e79);
  color: #fff;
}

.lead-table-wrap {
  overflow-x: auto;
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.lead-table th,
.lead-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--theme-surface-border, rgba(31, 58, 95, .15));
  vertical-align: top;
  text-align: left;
}

.lead-table th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(17, 31, 34, .72);
}

.lead-table tr.priority-urgent td {
  background: rgba(185, 28, 28, .08);
}

.panel-count {
  font-weight: 800;
  color: var(--accent, #1f4e79);
}

/* Owner Dashboard Build Part 3 - Lead View All Visual Cleanup */
.leads-page .topnav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.leads-page .topnav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
}

.leads-main {
  gap: 18px;
}

.leads-hero-panel {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--theme-surface, #fff) 82%, white 18%),
      color-mix(in srgb, var(--theme-surface-strong, #fff) 72%, white 28%));
}

.leads-page-heading {
  margin-bottom: 12px;
}

.leads-help-text {
  margin-top: 8px;
  max-width: 820px;
  line-height: 1.35;
}

.leads-filter-tabs {
  margin-bottom: 0;
}

.leads-list-panel {
  padding: 16px;
}

.lead-card-list {
  display: grid;
  gap: 12px;
}

.lead-card {
  border: 1px solid var(--theme-surface-border, var(--border));
  border-left: 5px solid var(--brand-accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--theme-surface, #fff) 86%, white 14%);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  overflow: hidden;
}

.lead-card.priority-urgent {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(180, 35, 24, .075), rgba(255, 255, 255, .7));
}

.lead-card.priority-normal {
  border-left-color: var(--warning);
}

.lead-card-main {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.lead-card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.lead-card h3 {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.15;
}

.lead-priority-pill {
  flex: 0 0 auto;
}

.lead-card-detail-grid {
  display: grid;
  grid-template-columns: minmax(140px, .7fr) minmax(190px, 1fr) minmax(210px, 1fr) minmax(190px, 1fr);
  gap: 12px;
  align-items: start;
}

.lead-field-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.lead-field-value {
  font-size: .92rem;
  line-height: 1.25;
}

.lead-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .58);
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.3;
}

.leads-empty-state {
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 1px dashed var(--theme-surface-border, var(--border));
  border-radius: 16px;
  background: color-mix(in srgb, var(--theme-surface, #fff) 80%, white 20%);
}

.leads-empty-state h3 {
  margin: 0;
}

@media (max-width: 980px) {
  .lead-card-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .leads-topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .leads-page .topnav {
    flex-wrap: wrap;
  }

  .lead-card-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .lead-card-detail-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lead-card-main {
    padding: 13px;
  }

  .leads-list-panel {
    padding: 12px;
  }

  .filter-tab {
    padding: 9px 11px;
  }
}

/* Branding & Color System Pass 2 — contrast/readability + preview
   Rule:
   - Brand colors provide identity.
   - Red/yellow/green remain semantic operational colors.
   - Logo color extraction is future work and requires an approved image dependency.
*/

/* Safer theme surfaces: keep panels readable even when owner chooses a very dark or very bright background. */
body {
  --theme-surface: color-mix(in srgb, var(--bg) 24%, white 76%);
  --theme-surface-strong: color-mix(in srgb, var(--bg) 16%, white 84%);
  --theme-surface-border: color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  --theme-surface-shadow: rgba(15, 23, 42, .12);
}

.panel,
.card,
.health-card.neutral,
.action-item,
.retention-item,
.compact-item,
.lead-card {
  color: var(--text);
}

.branding-main {
  gap: 18px;
}

.branding-intro {
  margin-top: 8px;
  max-width: 760px;
  line-height: 1.35;
}

.branding-current-card {
  display: grid;
  gap: 10px;
}

.logo-empty-box {
  display: grid;
  place-items: center;
  min-height: 140px;
  margin-top: 12px;
  border: 1px dashed var(--theme-surface-border, var(--border));
  border-radius: 18px;
  background: rgba(255, 255, 255, .66);
  color: var(--muted);
  font-weight: 800;
}

.branding-note-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--theme-surface-border, var(--border));
  background: rgba(255, 255, 255, .62);
}

.branding-note-box p {
  line-height: 1.35;
}

.branding-preview-panel {
  max-width: 980px;
}

.theme-preview-shell {
  --preview-primary: var(--accent);
  --preview-secondary: var(--bg);
  --preview-accent: var(--brand-accent);
  --preview-primary-text: #fff;
  --preview-accent-text: #17202a;
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--preview-primary) 28%, var(--border) 72%);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--preview-secondary) 18%, white 82%),
      color-mix(in srgb, var(--preview-secondary) 28%, white 72%));
}

.theme-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: var(--preview-primary);
  color: var(--preview-primary-text);
}

.theme-preview-top h3,
.theme-preview-top p {
  margin: 0;
  color: inherit;
}

.preview-brand {
  color: var(--preview-accent);
}

.preview-brand::after {
  background: var(--preview-accent);
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--preview-accent);
  color: var(--preview-accent-text);
  font-size: .75rem;
  font-weight: 900;
  white-space: nowrap;
}

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.theme-preview-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--preview-primary) 20%, var(--border) 80%);
  background: rgba(255, 255, 255, .72);
}

.theme-preview-card .metric {
  color: var(--preview-primary);
}

.preview-warning-card {
  border-color: #fedf89;
  background: var(--warning-bg);
}

.preview-warning-card .metric {
  color: var(--warning);
}

.preview-danger-card {
  border-color: #fda29b;
  background: var(--danger-bg);
}

.preview-danger-card .metric {
  color: var(--danger);
}

.contrast-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.contrast-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--theme-surface-border, var(--border));
  background: rgba(255, 255, 255, .62);
}

.contrast-row span {
  font-weight: 900;
  color: color-mix(in srgb, var(--accent) 70%, var(--text) 30%);
}

@media (max-width: 760px) {
  .theme-preview-top,
  .contrast-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-preview-grid {
    grid-template-columns: 1fr;
  }
}

/* Branding & Color System Pass 2B — browser-side logo palette suggestions */
.logo-suggestions-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--theme-surface-border, var(--border));
  background: rgba(255, 255, 255, .64);
}

.logo-suggestions-panel h3 {
  margin: 2px 0 4px;
}

.suggestion-swatches {
  display: grid;
  gap: 12px;
}

.suggestion-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.discovered-colors {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.suggestion-swatch {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}

.suggestion-swatch code,
.suggestion-swatch span:not(.swatch-chip) {
  color: var(--muted);
  font-size: .8rem;
}

.selected-suggestion {
  border-color: color-mix(in srgb, var(--brand-accent) 55%, var(--border) 45%);
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, .88),
      color-mix(in srgb, var(--theme-surface, #fff) 78%, white 22%));
}

.swatch-chip {
  display: block;
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.suggestion-empty {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--theme-surface-border, var(--border));
  color: var(--muted);
  background: rgba(255, 255, 255, .58);
  font-weight: 800;
}

.secondary-button {
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 55%, var(--accent) 45%);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .74);
  color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
  font-weight: 900;
  cursor: pointer;
}

.secondary-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .suggestion-group {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }
}

/* Branding & Color System Pass 2C — palette workbench drag/drop */
.suggestion-help {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
  color: var(--muted);
  font-weight: 800;
}

.selected-palette-group {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.palette-drop-zone {
  position: relative;
  min-height: 96px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.palette-drop-zone small {
  grid-column: 2;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.palette-drop-zone.drag-over {
  transform: translateY(-2px);
  border-color: var(--brand-accent);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}

.discovered-swatch {
  cursor: grab;
}

.discovered-swatch:active {
  cursor: grabbing;
}

.swatch-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.swatch-actions button {
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, .78);
  color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
  font-size: .72rem;
  font-weight: 900;
  cursor: pointer;
}

.swatch-actions button:hover,
.swatch-actions button:focus {
  border-color: var(--brand-accent);
}

@media (max-width: 760px) {
  .selected-palette-group {
    grid-template-columns: 1fr;
  }

  .palette-drop-zone {
    min-height: unset;
  }
}

/* Branding & Color System Pass 2D — topbar text readability safety
   Problem:
   - Owner-selected brand colors can be too light on the white topbar.
   - The brand mark and Branding/Logout links may become nearly unreadable.
   Rule:
   - Keep the logo and accent identity.
   - Force topbar text/links toward readable dark text when needed.
   - Do not change semantic R/Y/G colors.
*/

.topbar {
  color: var(--text);
}

.topbar h1,
.topbar .userbox,
.topbar .userbox div,
.topbar .muted {
  color: var(--text);
}

.topbar .muted {
  opacity: .72;
}

.topbar .brand-mark {
  color: color-mix(in srgb, var(--accent) 38%, var(--text) 62%);
}

.topbar .brand-mark::after {
  background: var(--brand-accent);
}

.topbar .userbox a,
.topbar .topnav a {
  color: color-mix(in srgb, var(--accent) 32%, var(--text) 68%);
  text-decoration: none;
  font-weight: 900;
}

.topbar .userbox a:hover,
.topbar .topnav a:hover {
  color: color-mix(in srgb, var(--brand-accent) 50%, var(--text) 50%);
}


/* Branding & Color System Pass 2F — reset to safe demo defaults */
.branding-reset-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(180, 35, 24, .35);
  background: rgba(254, 243, 242, .42);
}

.danger-secondary-button {
  width: fit-content;
  border: 1px solid rgba(180, 35, 24, .45);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .76);
  color: #b42318;
  font-weight: 900;
  cursor: pointer;
}

.danger-secondary-button:hover,
.danger-secondary-button:focus {
  background: #fef3f2;
  border-color: #b42318;
}

@media (max-width: 760px) {
  .danger-secondary-button {
    width: 100%;
  }
}

/* Owner Dashboard Build Part 4 — Retention View All */
.retention-page .leads-hero-panel {
  border-left: 5px solid var(--brand-accent);
}

.retention-card-list {
  display: grid;
  gap: 14px;
}

.retention-card {
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 20px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.retention-card.priority-urgent {
  border-left: 6px solid #b42318;
}

.retention-card.priority-high {
  border-left: 6px solid #b7791f;
}

.retention-card.priority-medium {
  border-left: 6px solid #1f4e79;
}

.retention-card-main {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.retention-card-main h3 {
  margin: 0 0 4px;
  color: var(--text);
}

.retention-card-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.retention-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
}

.retention-empty-state {
  text-align: left;
}

@media (max-width: 900px) {
  .retention-card-detail-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .retention-card-detail-grid {
    grid-template-columns: 1fr;
  }

  .retention-filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Owner Dashboard View All polish — hide demo noise, make freeze visibly blue */
.freeze-pill,
.retention-card.priority-on_freeze .lead-priority-pill,
.retention-item.priority-on_freeze .status-pill {
  background: #dbeafe;
  color: #0b4ea2;
  border: 1px solid rgba(37, 99, 235, .35);
}

.retention-card.priority-on_freeze,
.retention-item.priority-on_freeze {
  border-left-color: #2563eb;
}

.retention-card.priority-on_freeze {
  box-shadow: 0 10px 30px rgba(37, 99, 235, .10);
}


/* Owner Dashboard View All polish follow-up — consistent On Freeze label */
.status-pill.freeze-pill,
.days-box.freeze-pill {
  background: #dbeafe;
  color: #0b4ea2;
  border: 1px solid rgba(37, 99, 235, .35);
}

.retention-item.priority-on_freeze {
  border-left-color: #2563eb;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .10);
}

/* Owner Dashboard Build Part 5 — Testing View All */
.testing-page .testing-hero-panel {
  border-left: 5px solid var(--brand-accent);
}

.testing-card-list {
  display: grid;
  gap: 14px;
}

.testing-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

.testing-card.testing-upcoming {
  border-left: 6px solid #16a34a;
}

.testing-card.testing-completed {
  border-left: 6px solid var(--brand-accent);
}

.testing-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.testing-card-header h3 {
  margin: 0 0 4px;
  color: var(--text);
}

.testing-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 10px;
}

.testing-metric {
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, .62);
}

.testing-metric strong {
  display: block;
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
}

.testing-metric span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

@media (max-width: 900px) {
  .testing-metric-grid {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }
}

@media (max-width: 640px) {
  .testing-card-header {
    display: grid;
  }

  .testing-metric-grid {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

/* Owner Dashboard View All polish — make Retention/Testing cards carry theme depth */
.retention-page .leads-list-panel,
.testing-page .leads-list-panel {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--bg) 72%, white 28%),
      color-mix(in srgb, var(--bg) 50%, white 50%)
    );
  border-color: color-mix(in srgb, var(--brand-accent) 42%, var(--theme-surface-border, var(--border)) 58%);
}

.retention-card,
.testing-card {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--bg) 48%, white 52%),
      color-mix(in srgb, var(--bg) 28%, white 72%)
    );
  border-color: color-mix(in srgb, var(--brand-accent) 34%, var(--theme-surface-border, var(--border)) 66%);
}

.retention-card:nth-child(even),
.testing-card:nth-child(even) {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--bg) 36%, white 64%),
      color-mix(in srgb, var(--bg) 20%, white 80%)
    );
}

.testing-metric {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--bg) 22%, white 78%),
      color-mix(in srgb, var(--bg) 10%, white 90%)
    );
  border-color: color-mix(in srgb, var(--brand-accent) 34%, var(--theme-surface-border, var(--border)) 66%);
}

.retention-card .lead-field-value,
.testing-card .item-meta,
.retention-card .item-meta {
  color: color-mix(in srgb, var(--text) 82%, var(--accent) 18%);
}


/* Owner Dashboard Build Part 6 — Birthday View All */
.birthdays-page .birthdays-hero-panel {
  border-left: 5px solid var(--brand-accent);
}

.birthdays-page .leads-list-panel {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--bg) 72%, white 28%),
      color-mix(in srgb, var(--bg) 50%, white 50%)
    );
  border-color: color-mix(in srgb, var(--brand-accent) 42%, var(--theme-surface-border, var(--border)) 58%);
}

.birthday-card-list {
  display: grid;
  gap: 14px;
}

.birthday-card {
  display: grid;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 34%, var(--theme-surface-border, var(--border)) 66%);
  border-radius: 20px;
  padding: 16px;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--bg) 44%, white 56%),
      color-mix(in srgb, var(--bg) 24%, white 76%)
    );
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

.birthday-card.birthday-today {
  border-left: 6px solid #f97316;
}

.birthday-card.birthday-soon {
  border-left: 6px solid var(--brand-accent);
}

.birthday-card.birthday-past {
  border-left: 6px solid #64748b;
}

.birthday-card.birthday-upcoming {
  border-left: 6px solid var(--accent);
}

.birthday-card-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.birthday-card-main h3 {
  margin: 0 0 4px;
  color: var(--text);
}

.birthday-date-box {
  min-width: 88px;
  border-radius: 18px;
  padding: 10px 12px;
  text-align: center;
  background: rgba(255, 255, 255, .68);
  border: 1px solid color-mix(in srgb, var(--brand-accent) 30%, var(--theme-surface-border, var(--border)) 70%);
}

.birthday-date-box strong {
  display: block;
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.birthday-date-box span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.birthday-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

@media (max-width: 760px) {
  .birthday-card-main {
    display: grid;
  }

  .birthday-date-box {
    width: fit-content;
  }

  .birthday-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Owner Dashboard Navigation Pass 1 — shared sticky top toolbar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  align-items: center;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--bg) 58%, white 42%),
      color-mix(in srgb, var(--bg) 34%, white 66%)
    );
  border-bottom: 1px solid color-mix(in srgb, var(--brand-accent) 42%, var(--theme-surface-border, var(--border)) 58%);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .10);
  backdrop-filter: blur(12px) saturate(1.05);
}

.app-topbar .school-brand {
  min-width: 0;
}

.app-topbar h1 {
  line-height: 1.08;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  max-width: 760px;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
  font-size: .86rem;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent 82%);
  background: rgba(255, 255, 255, .58);
}

.app-nav-link:hover,
.app-nav-link.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.app-nav-link.logout-link {
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, .18);
}

.app-nav-link.logout-link:hover {
  color: #fff;
  background: #991b1b;
  border-color: #991b1b;
}

.app-nav-toggle {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.app-nav-button {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--theme-surface-border, var(--border)) 78%);
  background: rgba(255, 255, 255, .68);
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  cursor: pointer;
}

.app-nav-button span {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

@media (max-width: 1120px) {
  .app-topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
  }

  .app-nav-button {
    display: inline-flex;
  }

  .app-nav {
    grid-column: 1 / -1;
    display: none;
    justify-content: flex-start;
    max-width: none;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--brand-accent) 28%, transparent 72%);
  }

  .app-nav-toggle:checked ~ .app-nav {
    display: flex;
  }

  .app-nav-link {
    flex: 1 1 140px;
  }
}

@media (max-width: 640px) {
  .app-topbar {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .app-topbar .school-brand {
    align-items: center;
  }

  .app-topbar h1 {
    font-size: 1.05rem;
  }

  .app-topbar .muted {
    font-size: .82rem;
  }

  .app-nav-link {
    flex-basis: 100%;
  }
}

/* Navigation Pass 1B — force readable nav button text */
.app-topbar .app-nav a.app-nav-link {
  color: var(--accent);
  text-shadow: none;
}

.app-topbar .app-nav a.app-nav-link.active,
.app-topbar .app-nav a.app-nav-link:hover,
.app-topbar .app-nav a.app-nav-link:focus {
  color: #ffffff !important;
  background: var(--accent);
  border-color: var(--accent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.app-topbar .app-nav a.app-nav-link.logout-link {
  color: #7f1d1d;
}

.app-topbar .app-nav a.app-nav-link.logout-link:hover,
.app-topbar .app-nav a.app-nav-link.logout-link:focus {
  color: #ffffff !important;
  background: #991b1b;
  border-color: #991b1b;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.app-topbar .app-nav a.app-nav-link.active.logout-link {
  color: #ffffff !important;
}

/* Phase 3T-1 — Testing Event Detail Foundation */

.testing-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.testing-detail-main {
  display: grid;
  gap: 18px;
}

.testing-detail-hero {
  border-left: 5px solid var(--brand-accent);
}

.testing-detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.testing-detail-heading h2 {
  margin: 2px 0 5px;
}

.testing-detail-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.testing-detail-notes {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 14px;
  background:
    color-mix(
      in srgb,
      var(--bg) 18%,
      white 82%
    );
}

.testing-detail-notes p {
  margin: 7px 0 0;
  line-height: 1.45;
}

.testing-detail-roster-panel {
  overflow: hidden;
}

.testing-detail-table-wrap {
  overflow-x: auto;
}

.testing-detail-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.testing-detail-table th,
.testing-detail-table td {
  padding: 11px 10px;
  border-bottom:
    1px solid
    var(--theme-surface-border, var(--border));
  text-align: left;
  vertical-align: top;
}

.testing-detail-table th {
  color:
    color-mix(
      in srgb,
      var(--text) 72%,
      var(--accent) 28%
    );
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.testing-detail-table tbody tr:nth-child(even) {
  background:
    color-mix(
      in srgb,
      var(--bg) 14%,
      white 86%
    );
}

.testing-result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}

.testing-result-pill.result-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.testing-result-pill.result-pass {
  background: var(--good-bg);
  color: var(--good);
}

.testing-result-pill.result-fail {
  background: var(--danger-bg);
  color: var(--danger);
}

.testing-result-pill.result-did_not_attend {
  background: var(--neutral-bg);
  color: var(--muted);
}

@media (max-width: 900px) {
  .testing-detail-summary {
    grid-template-columns:
      repeat(3, minmax(100px, 1fr));
  }
}

@media (max-width: 640px) {
  .testing-detail-heading {
    display: grid;
  }

  .testing-detail-summary {
    grid-template-columns:
      repeat(2, minmax(100px, 1fr));
  }
}



/* Phase 3T-3D3 — Testing readiness UI */

.testing-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.testing-readiness-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.testing-readiness-item {
  padding: 13px;
  border:
    1px solid
    var(--theme-surface-border, var(--border));
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
}

.testing-readiness-item strong {
  display: block;
  color: var(--accent);
  font-size: 1rem;
}

.testing-readiness-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

@media (max-width: 760px) {
  .testing-detail-actions {
    justify-content: flex-start;
  }

  .testing-readiness-grid {
    grid-template-columns:
      repeat(2, minmax(120px, 1fr));
  }
}

/* Phase 3T-4C — Testing result-entry form */

.testing-roster-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.testing-result-form {
  display: block;
}

.testing-result-select {
  width: 100%;
  min-width: 170px;
  min-height: 36px;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid rgba(31, 78, 121, 0.2);
  border-radius: 8px;
  background: #fff;
  color: #17212b;
  font: inherit;
}

.testing-result-select:focus {
  outline: 2px solid rgba(31, 78, 121, 0.28);
  border-color: var(--accent);
}

.testing-pass-all-button {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.testing-pass-all-button:hover {
  background: rgba(31, 78, 121, 0.06);
}

.testing-pass-all-button:focus-visible {
  outline: 3px solid rgba(200, 155, 60, 0.55);
  outline-offset: 2px;
}

.testing-result-savebar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 78, 121, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(20, 35, 50, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.testing-result-savebar p {
  margin: 3px 0 0;
}

.testing-result-save-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 17px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.testing-result-save-button:hover {
  filter: brightness(0.94);
}

.testing-result-save-button:focus-visible {
  outline: 3px solid rgba(200, 155, 60, 0.55);
  outline-offset: 2px;
}

.testing-finalization-blocked {
  padding: 12px 14px;
  border: 1px solid rgba(180, 83, 9, 0.3);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
}

.testing-finalization-blocked ul {
  margin: 8px 0 0;
  padding-left: 20px;
  columns: 3;
  column-gap: 28px;
}

.testing-finalization-blocked li {
  break-inside: avoid;
}

.testing-finalization-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 14px;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.testing-finalization-confirm {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 700;
  line-height: 1.4;
}

.testing-finalization-confirm input {
  margin-top: 3px;
}

.belt-order-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.belt-order-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.belt-order-print-button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.belt-size-form {
  display: flex;
  gap: 7px;
}

.belt-size-form input {
  width: 105px;
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--theme-surface-border, var(--border));
  border-radius: 7px;
  padding: 6px 8px;
}

.belt-size-form button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.belt-size-warning {
  display: block;
  margin-top: 5px;
  color: #b42318;
  font-size: 0.76rem;
  font-weight: 800;
}

.print-only {
  display: none;
}

/* Phase 3 visual completion — compact owner command-center density.
   Mobile rules below remain touch-friendly; these reductions target desktop. */
@media (min-width: 761px) {
  body {
    font-size: 14px;
  }

  .topbar,
  .app-topbar {
    gap: 18px;
    padding: 13px 24px;
  }

  .school-logo {
    width: 44px;
    height: 44px;
  }

  .app-topbar h1 {
    font-size: 1.15rem;
  }

  .app-topbar .muted {
    font-size: 0.78rem;
  }

  .app-nav {
    gap: 5px;
  }

  .app-nav-link {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 0.78rem;
  }

  .school-switcher {
    padding: 8px 24px;
  }

  .dashboard {
    gap: 14px;
    padding: 16px 24px 24px;
  }

  .leads-main,
  .testing-detail-main {
    gap: 12px;
  }

  .card,
  .panel,
  .login-card,
  .lead-card,
  .birthday-card {
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  }

  .cards,
  .health-grid {
    gap: 9px;
  }

  .card {
    padding: 11px 12px;
  }

  .metric,
  .health-value {
    font-size: 1.55rem;
    line-height: 1;
  }

  .submetric {
    margin-top: 5px;
    font-size: 0.78rem;
  }

  .panel,
  .leads-list-panel {
    padding: 14px;
  }

  .panel-heading {
    gap: 10px;
    margin-bottom: 10px;
  }

  .section-grid,
  .two-col {
    gap: 14px;
  }

  .hero {
    gap: 16px;
    padding: 14px 16px;
    border-left-width: 5px;
  }

  .hero h2 {
    margin: 2px 0 5px;
    font-size: 1.18rem;
  }

  .health-badge {
    min-width: 125px;
    padding: 9px 12px;
    border-radius: 9px;
  }

  .item-list,
  .retention-list,
  .compact-list,
  .lead-card-list,
  .birthday-card-list {
    gap: 7px;
  }

  .action-item,
  .retention-item,
  .compact-item,
  .lead-card-main,
  .birthday-card {
    padding: 9px 11px;
  }

  .ryg-row {
    padding: 9px 11px;
  }

  .retention-action-metrics {
    gap: 7px;
  }

  .retention-action-metrics a {
    padding: 9px;
  }

  .filter-tabs {
    gap: 7px;
    margin: 8px 0 11px;
  }

  .filter-tab {
    padding: 6px 10px;
  }

  th,
  td,
  .lead-table th,
  .lead-table td,
  .testing-detail-table th,
  .testing-detail-table td {
    padding: 7px 8px;
  }

  .testing-detail-summary,
  .testing-readiness-grid {
    gap: 7px;
  }

  .testing-metric,
  .testing-readiness-item {
    padding: 9px;
    border-radius: 8px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .testing-result-savebar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .testing-result-save-button {
    width: 100%;
  }

  .testing-finalization-form {
    align-items: stretch;
    flex-direction: column;
  }

  .testing-finalization-blocked ul {
    columns: 1;
  }

  .belt-order-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .belt-order-summary {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .dashboard {
    gap: 12px;
    padding: 12px;
  }

  .cards,
  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card,
  .health-card {
    min-width: 0;
    padding: 12px;
    border-radius: 10px;
  }

  .metric,
  .health-value {
    font-size: 1.5rem;
  }

  .label {
    font-size: 0.86rem;
  }

  .submetric {
    margin-top: 5px;
    font-size: 0.75rem;
  }
}

@media (max-width: 520px) {
  .retention-action-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  .no-print {
    display: none !important;
  }

  .print-only {
    display: inline;
  }

  .belt-order-page,
  .belt-order-main {
    background: #fff !important;
  }

  .belt-order-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .belt-order-main .panel {
    border: 0;
    box-shadow: none;
  }
}
