:root {
  --bg: #f6f0e4;
  --card: rgba(255, 255, 255, 0.9);
  --card-strong: #fffaf1;
  --text: #141414;
  --muted: #6a655d;
  --line: rgba(20, 20, 20, 0.1);
  --primary: #111111;
  --primary-soft: #ebe3d3;
  --accent: #2c73ff;
  --green: #18794e;
  --red: #c03d3d;
  --shadow: 0 16px 42px rgba(20, 20, 20, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.7), transparent 28%),
    linear-gradient(180deg, #f7f2e8 0%, #f1eadc 100%);
  color: var(--text);
  font-family: "SF Pro Display", "Segoe UI", Inter, sans-serif;
}

button,
input,
select,
table {
  font: inherit;
}

code {
  background: rgba(20, 20, 20, 0.06);
  padding: 2px 6px;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}

.topbar h1,
.hero-card h2,
.panel h2,
.auth-card h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede,
.hero-body,
.muted,
.caption {
  color: var(--muted);
  line-height: 1.65;
}

.lede {
  max-width: 760px;
  margin: 12px 0 0;
}

.banner {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.banner-soft {
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
}

.auth-gate {
  min-height: 58vh;
  display: grid;
  place-items: center;
}

.auth-card,
.hero-card,
.panel {
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-card {
  max-width: 620px;
  padding: 28px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.grid.four-col,
.sales-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.hero-card,
.panel {
  padding: 22px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-card-compact {
  justify-content: center;
}

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

.callout {
  border-radius: 18px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  background: var(--card-strong);
  padding: 16px;
}

.callout h3,
.panel h2 {
  margin: 0;
}

.callout p {
  margin: 8px 0 0;
}

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

.retention-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.retention-metric-card .value {
  font-size: clamp(1.45rem, 3vw, 2.15rem);
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric-card h3,
.metric-card p {
  margin: 0;
}

.metric-card .value {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin: 10px 0 8px;
}

.metric-card .helper {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.filter-panel {
  display: grid;
  gap: 18px;
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.membership-admin-panel {
  border-color: rgba(24, 121, 78, 0.22);
}

.institute-admin-panel {
  border-color: rgba(44, 115, 255, 0.28);
}

.institute-admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.institute-wide-field {
  grid-column: span 2;
}

.membership-admin-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr 1fr 1fr;
  gap: 12px;
}

.membership-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.membership-admin-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px 14px;
}

.membership-admin-result.error {
  border-color: rgba(192, 61, 61, 0.28);
  background: rgba(192, 61, 61, 0.08);
  color: var(--red);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #eee8dc;
  color: #5f554a;
}
.status-chip.verified,
.status-chip.synced { background: #d9f3e7; color: #146044; }
.status-chip.pending,
.status-chip.syncing { background: #fff0c9; color: #805c16; }
.status-chip.error { background: #fbe0dc; color: #96372c; }

.danger-button {
  border-color: rgba(192, 61, 61, 0.32);
  color: var(--red);
}

.filter-field {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.filter-field span {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-field input,
.filter-field select {
  width: 100%;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
}

.range-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.range-card {
  border-radius: 18px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  background: rgba(255, 255, 255, 0.74);
  padding: 16px;
}

.range-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.range-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.daypart-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 100%;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 241, 0.72)),
    var(--card-strong);
  overflow: hidden;
}

.daypart-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.daypart-card.strong::before {
  background: var(--green);
}

.daypart-card.needs-focus::before {
  background: #d99124;
}

.daypart-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.daypart-card h3,
.daypart-summary {
  margin: 0;
}

.daypart-card h3 {
  font-size: 1.12rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.daypart-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.daypart-summary {
  color: var(--muted);
  line-height: 1.55;
}

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

.daypart-metrics span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(17, 17, 17, 0.05);
}

.daypart-metrics strong {
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.daypart-metrics small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.daypart-action {
  border-radius: 16px;
  border: 1px solid rgba(44, 115, 255, 0.14);
  background: rgba(44, 115, 255, 0.06);
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.chart-shell {
  position: relative;
  width: 100%;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.56));
  border: 1px solid rgba(20, 20, 20, 0.06);
  padding: 12px 12px 6px;
  overflow: hidden;
}

.chart-shell-tall {
  height: 320px;
}

.chart-shell-medium {
  height: 340px;
}

.chart-shell canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.stack-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.stack-item strong {
  display: block;
  margin-bottom: 6px;
}

.stack-item.good {
  border-color: rgba(24, 121, 78, 0.18);
}

.stack-item.warn {
  border-color: rgba(192, 61, 61, 0.18);
}

.stack-item.info {
  border-color: rgba(44, 115, 255, 0.16);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: rgba(255, 255, 255, 0.72);
}

thead {
  background: rgba(17, 17, 17, 0.06);
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

.primary-button,
.ghost-button {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.small-button {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.ghost-button {
  background: rgba(17, 17, 17, 0.08);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.up {
  color: var(--green);
}

.down {
  color: var(--red);
}

@media (max-width: 1180px) {
  .metric-grid,
  .retention-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .shell {
    padding: 16px;
  }

  .topbar,
  .hero-grid,
  .grid.two-col,
  .grid.four-col,
  .sales-summary-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .hero-callouts,
  .metric-grid,
  .retention-card-grid,
  .daypart-card-grid {
    grid-template-columns: 1fr;
  }

  .range-summary {
    grid-template-columns: 1fr;
  }

  .chart-shell-tall,
  .chart-shell-medium {
    height: 280px;
  }
}

@media (max-width: 560px) {
  .chart-shell-tall,
  .chart-shell-medium {
    height: 240px;
    padding: 10px 10px 4px;
  }
}

@media (max-width: 560px) {
  .topbar h1,
  .hero-card h2,
  .panel h2,
  .auth-card h2 {
    font-size: 1.7rem;
  }

  .auth-card,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .metric-grid,
  .retention-card-grid {
    grid-template-columns: 1fr;
  }

  .daypart-card-top,
  .daypart-metrics {
    grid-template-columns: 1fr;
  }

  .daypart-card-top {
    display: grid;
  }

  th,
  td {
    padding: 12px;
  }
}

/* TechPSC Home-aligned admin theme */
:root {
  --bg: #f7f2ea;
  --card: rgba(255, 254, 250, 0.94);
  --card-strong: #fffaf3;
  --text: #18120d;
  --muted: #6b5f53;
  --line: rgba(24, 18, 13, 0.13);
  --primary: #18120d;
  --primary-soft: #efe3d5;
  --accent: #c9642f;
  --green: #14795d;
  --red: #b83935;
  --gold: #b77a19;
  --shadow: 0 16px 38px rgba(47, 31, 18, 0.08);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(201, 100, 47, 0.15), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(246, 201, 130, 0.18), transparent 24%),
    linear-gradient(180deg, #f7f2ea 0%, #fbf7f0 48%, #fffefa 100%);
}

.shell { max-width: 1420px; padding: 20px 24px 72px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  margin: -20px -24px 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 242, 234, 0.92);
  backdrop-filter: blur(18px);
}
.admin-brand-block { display: flex; align-items: center; gap: 14px; }
.admin-brand {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: #fff5eb;
  background: #18120d;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(24, 18, 13, 0.2);
}
.topbar h1, .hero-card h2, .panel h2, .auth-card h2, .section-label h2 {
  color: var(--text);
  font-family: "Geist", sans-serif;
  letter-spacing: -0.045em;
}
.topbar h1 { font-size: clamp(1.65rem, 2.6vw, 2.45rem); }
.eyebrow { color: var(--accent); }
.lede { margin-top: 7px; max-width: 820px; }
.section-nav {
  position: sticky;
  top: 83px;
  z-index: 19;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: 0 10px 26px rgba(47, 31, 18, 0.06);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 750;
}
.section-nav a:hover, .section-nav a:focus-visible { color: #fff7ed; background: var(--primary); }
.dashboard-anchor { scroll-margin-top: 145px; }
.section-label { padding: 12px 3px 0; }
.section-label h2 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2.1rem); }
.section-label .muted { margin: 7px 0 0; }

.auth-card, .hero-card, .panel, .metric-card {
  border-color: var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero-card:first-child {
  color: #fff7ed;
  border-color: rgba(255,255,255,.08);
  background:
    radial-gradient(circle at 86% 16%, rgba(246, 201, 130, .18), transparent 28%),
    linear-gradient(145deg, #18120d, #2b1c12 68%, #151c20);
}
.hero-card:first-child h2, .hero-card:first-child .hero-body { color: #fff7ed; }
.hero-card:first-child .eyebrow { color: #f0a978; }
.callout, .range-card, .stack-item, .daypart-card, .membership-admin-result {
  border-color: var(--line);
  background: rgba(255, 250, 243, 0.9);
}
.hero-card:first-child .callout { color: var(--text); background: rgba(255, 250, 243, .96); }
.metric-card { position: relative; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.membership-admin-panel { border-color: rgba(20, 121, 93, .25); }
.institute-admin-panel { border-color: rgba(201, 100, 47, .28); }
.filter-field input, .filter-field select {
  min-height: 46px;
  border-color: var(--line);
  background: #fffefa;
}
.primary-button, .ghost-button { min-height: 44px; border-radius: 12px; }
.primary-button { background: var(--primary); color: #fff7ed; }
.ghost-button { border: 1px solid var(--line); background: rgba(255,255,255,.68); }
.primary-button:focus-visible, .ghost-button:focus-visible, .section-nav a:focus-visible {
  outline: 3px solid rgba(201,100,47,.25);
  outline-offset: 2px;
}
.chart-shell, table { background: rgba(255, 254, 250, .75); }
thead { background: #efe5d8; }
tbody tr:hover td { background: rgba(201, 100, 47, .045); }

.data-guide, .creator-grid, .ops-grid, .quality-metrics, .category-metrics {
  display: grid;
  gap: 10px;
}
.data-guide { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.creator-grid, .ops-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quality-card-grid, .script-list { display: grid; gap: 12px; }
.quality-card, .creator-card, .ops-card, .script-card, .category-card, .data-guide span {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 250, 243, .92);
}
.quality-card::before, .script-card::before, .category-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.quality-card.weak::before, .script-card.warn::before, .category-card.needs-focus::before { background: var(--gold); }
.quality-card.strong::before, .script-card.good::before, .category-card.strong::before { background: var(--green); }
.quality-card-top, .category-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.quality-card h3, .script-card h3, .category-card h3 { margin: 0; color: var(--text); }
.quality-chip, .category-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: #fffefa;
  font-size: .72rem;
  font-weight: 800;
}
.quality-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.quality-metrics span, .category-metrics span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(24,18,13,.045);
}
.quality-metrics.cohort-table { grid-template-columns: 1fr; }
.quality-metrics.cohort-table span { grid-template-columns: 86px 1fr auto; align-items: center; }
.quality-diagnosis, .category-card p, .script-card p { color: var(--muted); line-height: 1.5; }
.quality-action {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(201,100,47,.07);
  line-height: 1.45;
}
.creator-card strong, .ops-card strong { display: block; margin: 4px 0 7px; font-size: 1.25rem; }
.creator-card span, .ops-card span { color: var(--muted); line-height: 1.5; }
.category-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.category-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.daypart-metrics-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 920px) {
  .topbar { position: relative; margin-bottom: 12px; }
  .section-nav { top: 0; }
  .admin-brand-block { align-items: flex-start; }
  .data-guide, .creator-grid, .ops-grid, .daypart-metrics-wide,
  .membership-admin-grid, .institute-admin-grid { grid-template-columns: 1fr; }
  .institute-wide-field { grid-column: span 1; }
}
@media (max-width: 560px) {
  .shell { padding-inline: 14px; }
  .topbar { margin-inline: -14px; padding-inline: 14px; }
  .admin-brand { width: 40px; height: 40px; border-radius: 12px; }
  .topbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .topbar-actions button { width: 100%; }
  .section-nav { margin-inline: -4px; border-radius: 13px; }
  .quality-metrics { grid-template-columns: 1fr; }
  .quality-metrics.cohort-table span { grid-template-columns: 64px 1fr auto; }
}
