:root {
  --bg: #090b10;
  --surface: #11141b;
  --surface-raised: #171b24;
  --line: #262c38;
  --muted: #9299a8;
  --text: #f5f6f8;
  --green: #35dc9a;
  --green-dark: #0f6e53;
  --purple: #8b7cff;
  --blue: #49a8ff;
  --orange: #ffb35c;
  --red: #ff6b71;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% 5%, rgba(53, 220, 154, 0.1), transparent 26rem),
    radial-gradient(circle at 85% 20%, rgba(139, 124, 255, 0.08), transparent 28rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

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

.brand-mark {
  display: grid;
  width: 4.2rem;
  height: 4.2rem;
  margin-bottom: 2rem;
  place-items: center;
  border: 1px solid rgba(53, 220, 154, 0.5);
  border-radius: 1.25rem;
  color: var(--green);
  background: rgba(53, 220, 154, 0.08);
  box-shadow: inset 0 0 0 0.35rem rgba(53, 220, 154, 0.04);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.brand-mark-small {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
  border-radius: 0.8rem;
  font-size: 0.82rem;
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(23rem, 0.7fr);
  align-items: center;
  gap: clamp(3rem, 8vw, 9rem);
  max-width: 78rem;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.login-copy h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.1rem, 6.2vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.login-lead {
  max-width: 38rem;
  margin: 2rem 0;
  color: #b4bac6;
  font-size: 1.08rem;
  line-height: 1.7;
}

.trust-note,
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #bec4ce;
  font-size: 0.82rem;
}

.trust-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0.35rem rgba(53, 220, 154, 0.12);
}

.login-card {
  position: relative;
  padding: 2.2rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.65rem;
  background: rgba(17, 20, 27, 0.92);
  box-shadow: var(--shadow);
}

.login-card::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  content: "";
}

.lock-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 2rem;
  place-items: center;
  border-radius: 50%;
  color: #07110d;
  background: var(--green);
  font-size: 1.2rem;
  font-weight: 900;
}

.login-card h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.login-card > .muted {
  margin: 0.7rem 0 2rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.login-card label {
  display: block;
  margin: 1rem 0 0.5rem;
  color: #c9ced7;
  font-size: 0.78rem;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid #303644;
  border-radius: 0.8rem;
  outline: none;
  color: var(--text);
  background: #0c0f14;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 0.2rem rgba(53, 220, 154, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: 0.8rem;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  color: #07110d;
  background: var(--green);
  box-shadow: 0 0.5rem 1.8rem rgba(53, 220, 154, 0.15);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.75rem;
}

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

.google-button {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  color: var(--text);
  background: var(--surface-raised);
  font-weight: 800;
}

.google-button:hover {
  border-color: var(--green);
}

.secondary-button,
.ghost-button {
  padding: 0.72rem 1rem;
  color: var(--text);
  background: var(--surface-raised);
}

.secondary-button {
  border: 1px solid var(--line);
}

.ghost-button {
  color: var(--muted);
  background: transparent;
}

.form-error,
.dashboard-error {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 107, 113, 0.34);
  border-radius: 0.7rem;
  color: #ff9da1;
  background: rgba(255, 107, 113, 0.08);
  font-size: 0.82rem;
}

.form-error {
  margin: 1rem 0 -0.5rem;
}

.form-footnote {
  margin: 1.2rem 0 0;
  color: #717987;
  font-size: 0.7rem;
  text-align: center;
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 4.8rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid rgba(38, 44, 56, 0.8);
  background: rgba(9, 11, 16, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.topbar-brand .eyebrow {
  margin-bottom: 0.15rem;
  font-size: 0.58rem;
}

.topbar-brand strong {
  font-size: 0.92rem;
}

.dashboard-shell {
  width: min(92rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5.5rem) 0 5rem;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 4.5rem;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.page-heading .muted {
  margin: 1.2rem 0 0;
}

.updated-card {
  display: flex;
  min-width: 15rem;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.72rem;
}

.updated-card strong {
  color: var(--text);
  font-size: 1rem;
}

.updated-card small {
  color: #697180;
}

.dashboard-error {
  margin: -2rem 0 2rem;
}

.metric-section,
.split-section,
.panel {
  margin-bottom: 4rem;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.3rem;
}

.section-heading h2,
.panel-heading h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.035em;
}

.section-heading > p {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: right;
}

.section-index {
  margin: 0 0 0.35rem;
  color: var(--green);
  font: 700 0.65rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.metrics-grid-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
  display: flex;
  min-height: 10rem;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.metric-card > span {
  color: #a8afbb;
  font-size: 0.76rem;
  font-weight: 700;
}

.metric-card strong {
  margin-top: auto;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.07em;
}

.metric-card small {
  margin-top: 0.7rem;
  color: #737c8b;
  font-size: 0.7rem;
}

.metric-card-accent {
  border-color: rgba(53, 220, 154, 0.35);
  background:
    linear-gradient(145deg, rgba(53, 220, 154, 0.16), rgba(17, 20, 27, 0.9));
}

.metric-card-accent strong,
.metric-card-positive strong {
  color: var(--green);
}

.metric-card-warning strong {
  color: var(--orange);
}

.split-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 0.9rem;
}

.panel {
  padding: 1.45rem;
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: rgba(17, 20, 27, 0.82);
}

.split-section .panel {
  margin-bottom: 0;
}

.panel-chip {
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  color: var(--green);
  background: rgba(53, 220, 154, 0.09);
  font: 700 0.62rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.panel-chip-purple {
  color: #b9b0ff;
  background: rgba(139, 124, 255, 0.12);
}

.scan-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.scan-stats > div,
.retention-score {
  display: flex;
  min-height: 7.5rem;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  border-radius: 0.9rem;
  background: #0d1016;
}

.scan-stats span,
.retention-score span,
.panel-footer span {
  color: var(--muted);
  font-size: 0.72rem;
}

.scan-stats strong,
.retention-score strong {
  font-size: 2.2rem;
  letter-spacing: -0.06em;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  background: rgba(53, 220, 154, 0.06);
}

.panel-footer strong {
  color: var(--green);
}

.retention-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.retention-score strong {
  color: #b9b0ff;
}

.retention-score small {
  color: #687080;
}

.trend-panel {
  min-height: 24rem;
}

.chart-legend,
.token-note {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.chart-legend i {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.legend-active {
  background: var(--green);
}

.legend-scans {
  background: var(--purple);
}

.legend-new {
  background: var(--blue);
}

.trend-chart {
  display: grid;
  height: 17rem;
  grid-template-columns: repeat(14, minmax(1.5rem, 1fr));
  align-items: end;
  gap: 0.55rem;
  padding: 1.5rem 0.5rem 0.4rem;
  border-top: 1px solid var(--line);
}

.trend-column {
  display: flex;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  justify-content: end;
  gap: 0.6rem;
}

.trend-bars {
  display: flex;
  height: calc(100% - 1.5rem);
  align-items: end;
  justify-content: center;
  gap: 0.16rem;
}

.trend-bar {
  width: min(0.65rem, 30%);
  min-height: 3px;
  border-radius: 0.3rem 0.3rem 0.08rem 0.08rem;
  transition: filter 140ms ease;
}

.trend-column:hover .trend-bar {
  filter: brightness(1.3);
}

.trend-bar-active {
  background: var(--green);
}

.trend-bar-scans {
  background: var(--purple);
}

.trend-bar-new {
  background: var(--blue);
}

.trend-column small {
  overflow: hidden;
  color: #646c7a;
  font-size: 0.58rem;
  text-align: center;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

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

th {
  color: #747d8c;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #aeb5c1;
}

td:first-child {
  min-width: 13rem;
}

td strong,
td small {
  display: block;
}

td strong {
  color: var(--text);
}

td small {
  max-width: 18rem;
  margin-top: 0.25rem;
  overflow: hidden;
  color: #697280;
  text-overflow: ellipsis;
}

.number-cell {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.guest-cell {
  color: var(--orange);
}

.account-cell {
  color: var(--green);
}

.empty-table {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.methodology {
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--muted);
  background: rgba(17, 20, 27, 0.55);
  font-size: 0.78rem;
  line-height: 1.55;
}

.methodology summary {
  color: #c4cad3;
  cursor: pointer;
  font-weight: 700;
}

.methodology p,
.methodology ul {
  max-width: 70rem;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  margin: 4px;
  font-size: 0.85rem;
}
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
}
.search-bar button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent, #6366f1);
  color: white;
  cursor: pointer;
}
.metric-sub {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: 4px;
}

/* Revenue unavailable notice */
.revenue-unavailable { background: rgba(255,165,0,0.1); border: 1px solid rgba(255,165,0,0.3); border-radius: 8px; padding: 12px 16px; color: #ffa500; margin: 12px 0; }

/* Estimated revenue visual distinction */
.revenue-estimated { opacity: 0.6; font-style: italic; border-left: 3px solid #ffb35c; padding-left: 8px; }
.revenue-precise { border-left: 3px solid #35dc9a; padding-left: 8px; }

/* Users table */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { cursor: pointer; user-select: none; }
.users-table th:hover { background: rgba(255,255,255,0.1); }
.users-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.users-table tr:hover { background: rgba(255,255,255,0.03); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; }
.pagination button { padding: 6px 16px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); background: transparent; color: inherit; cursor: pointer; }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { font-size: 0.85rem; opacity: 0.7; }

/* User card */
.user-card { background: rgba(255,255,255,0.03); border-radius: 12px; padding: 20px; }
.user-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.user-card-section { margin-bottom: 16px; }
.user-card-section h4 { margin-bottom: 8px; opacity: 0.7; font-size: 0.85rem; text-transform: uppercase; }
.user-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }

/* Inactivity buckets */
.inactivity-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.inactivity-item { text-align: center; padding: 12px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.inactivity-count { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.inactivity-label { font-size: 0.75rem; opacity: 0.6; margin-top: 4px; }

/* Filters bar */
.filters-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; padding: 12px 16px; background: rgba(255,255,255,0.03); border-radius: 8px; border: 1px solid var(--line); }
.filters-bar select, .filters-bar input[type='date'] { padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); color: inherit; }
.filters-bar .filter-apply { padding: 6px 20px; border-radius: 6px; border: none; background: var(--green); color: #07110d; font-weight: bold; cursor: pointer; }

/* Retention cohort grid */
.retention-grid { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.retention-grid th, .retention-grid td { padding: 8px 10px; text-align: center; }
.retention-high { background: rgba(53, 220, 154, 0.2); }
.retention-medium { background: rgba(255, 179, 92, 0.15); }
.retention-low { background: rgba(255, 107, 113, 0.15); }

/* Chart container */
.chart-container { position: relative; height: 200px; margin: 16px 0; background: rgba(255,255,255,0.02); border-radius: 8px; padding: 12px; border: 1px solid var(--line); }

/* School and teacher provisioning */
.management-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 2rem;
}
.management-card,
.management-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}
.management-card h3,
.management-lists h3 {
  margin: 0 0 0.5rem;
}
.management-card label,
.management-selector label {
  color: #c9ced7;
  font-size: 0.75rem;
  font-weight: 700;
}
.management-card input:not([type="checkbox"]),
.management-card select,
.management-selector select,
.management-row select,
.management-row input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #303644;
  border-radius: 0.7rem;
  outline: none;
  color: var(--text);
  background: #0c0f14;
}
.management-card select[multiple] {
  min-height: 7rem;
}
.management-card .primary-button {
  margin-top: auto;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.management-selector {
  display: grid;
  max-width: 30rem;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.management-lists {
  margin-bottom: 0;
}
.management-list {
  display: grid;
  gap: 0.65rem;
}
.management-row small {
  color: var(--muted);
}
.management-row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.management-row-actions-stacked {
  align-items: stretch;
  flex-direction: column;
}
.management-action {
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(53, 220, 154, 0.35);
  border-radius: 0.65rem;
  color: var(--green);
  background: rgba(53, 220, 154, 0.08);
  font-weight: 700;
}
.management-action.danger {
  border-color: rgba(255, 107, 113, 0.35);
  color: #ff9da1;
  background: rgba(255, 107, 113, 0.08);
}
.management-status {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(53, 220, 154, 0.34);
  border-radius: 0.7rem;
  color: var(--green);
  background: rgba(53, 220, 154, 0.08);
  font-size: 0.82rem;
}

@media (max-width: 70rem) {
  .metrics-grid-five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .management-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 56rem) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .login-copy h1 {
    font-size: clamp(3rem, 13vw, 5.5rem);
  }

  .login-card {
    width: min(100%, 32rem);
  }

  .metrics-grid,
  .metrics-grid-five,
  .split-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-section .panel:last-child {
    grid-column: 1 / -1;
  }

  .page-heading,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .section-heading > p {
    text-align: left;
  }

  .trend-chart {
    overflow-x: auto;
    grid-template-columns: repeat(14, minmax(2rem, 1fr));
  }
}

@media (max-width: 38rem) {
  .login-layout {
    align-items: start;
    padding: 2rem 1rem;
  }

  .login-copy h1 {
    font-size: 3.3rem;
  }

  .topbar {
    align-items: flex-start;
  }

  .connection-state {
    display: none;
  }

  .topbar-actions {
    gap: 0.2rem;
  }

  .secondary-button,
  .ghost-button {
    padding-inline: 0.7rem;
    font-size: 0.72rem;
  }

  .dashboard-shell {
    width: min(100% - 1rem, 92rem);
    padding-top: 2.5rem;
  }

  .page-heading {
    margin-bottom: 3rem;
  }

  .updated-card {
    width: 100%;
  }

  .metrics-grid,
  .metrics-grid-five,
  .split-section,
  .retention-grid {
    grid-template-columns: 1fr;
  }

  .split-section .panel:last-child {
    grid-column: auto;
  }

  .metric-card {
    min-height: 8rem;
  }

  .metric-card strong {
    font-size: 3rem;
  }

  .panel-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .chart-legend {
    flex-wrap: wrap;
  }
}
