:root {
  --ink: #0d1b22;
  --ink-soft: #1c2e37;
  --text: #17303b;
  --muted: #5c7280;
  --bg: #eef5f2;
  --panel: #ffffff;
  --line: rgba(23, 48, 59, 0.1);
  --line-strong: rgba(23, 48, 59, 0.18);
  --green: #14b86e;
  --green-deep: #0b8b53;
  --blue: #3777c8;
  --teal: #28a7a4;
  --amber: #ffc857;
  --violet: #9a62d6;
  --red: #d85d5d;
  --shadow: 0 24px 80px rgba(13, 27, 34, 0.12);
  --radius: 16px;
  --radius-lg: 24px;
  --max-width: 1160px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(20, 184, 110, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 200, 87, 0.12), transparent 26%),
    linear-gradient(180deg, #f7fbf8 0%, #eef5f2 100%);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.screen-reader-text {
  position: absolute;
  left: -9999px;
}

.screen-reader-text:focus {
  left: 1rem;
  top: 1rem;
  z-index: 9999;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--green-deep);
  color: #fff;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 251, 248, 0.78);
  border-bottom: 1px solid rgba(23, 48, 59, 0.06);
  backdrop-filter: blur(16px);
}

.app-header__inner,
.app-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.app-header__inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  text-decoration: none;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  color: #082114;
  background: linear-gradient(135deg, var(--green), #5fe8aa);
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(20, 184, 110, 0.25);
}

.brand__text {
  display: grid;
  min-width: 0;
}

.brand__text strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.brand__text small {
  overflow: hidden;
  color: var(--muted);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--green-deep);
  border-color: rgba(20, 184, 110, 0.3);
}

.session-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.session-status strong {
  color: var(--ink);
}

.status-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(239, 170, 60, 0.14);
}

.status-dot.is-live {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(24, 168, 117, 0.14);
}

.app-shell {
  padding: 1.2rem 0 3rem;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.38fr) minmax(260px, 0.55fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.control-band__copy,
.control-band__media,
.action-dock,
.panel,
.student-card,
.empty-state,
.support-notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 35px rgba(17, 31, 39, 0.06);
}

.control-band__copy {
  display: grid;
  align-content: center;
  gap: 0.8rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.eyebrow,
.panel-label {
  color: var(--green-deep);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  width: fit-content;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(24, 168, 117, 0.1);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: 0;
  line-height: 1.06;
}

h1 {
  max-width: 13ch;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

.control-band__copy p {
  max-width: 56rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.control-band__media {
  display: grid;
  min-height: 190px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(160deg, #f9fbfb 0%, #e8f1ef 100%),
    #fff;
}

.control-band__media img {
  width: min(86%, 270px);
  height: min(86%, 270px);
  object-fit: contain;
  filter: drop-shadow(0 20px 32px rgba(17, 31, 39, 0.16));
}

.action-dock {
  display: grid;
  align-content: center;
  gap: 0.75rem;
  padding: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.8rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.segmented__button:hover,
.segmented__button:focus-visible {
  transform: translateY(-1px);
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  box-shadow: 0 18px 35px rgba(20, 184, 110, 0.24);
}

.button--secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.button--ghost {
  color: var(--ink-soft);
  background: #fff;
  border-color: var(--line-strong);
}

.support-notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  color: #5e4212;
  background: #fff8e9;
  border-color: #f1d9a5;
  font-weight: 700;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.72fr) minmax(280px, 0.72fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.panel--hero {
  min-height: 360px;
}

.panel__header,
.section-heading,
.student-card__top,
.student-card__footer,
.student-id,
.student-actions,
.band-row,
.watch-item,
.metric-line {
  display: flex;
  align-items: center;
}

.panel__header,
.section-heading,
.student-card__top,
.student-card__footer {
  justify-content: space-between;
  gap: 1rem;
}

.panel h2,
.section-heading h2 {
  margin-top: 0.2rem;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

.live-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.live-chip--soft {
  color: var(--ink);
  background: #edf2f1;
}

.calm-gauge,
.mini-gauge {
  --gauge-color: var(--green);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--gauge-color) calc(var(--score) * 1%), #e8efed 0);
}

.calm-gauge {
  width: min(220px, 48vw);
  aspect-ratio: 1;
  justify-self: center;
}

.calm-gauge div,
.mini-gauge {
  text-align: center;
}

.calm-gauge strong {
  display: block;
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1;
}

.calm-gauge span,
.mini-gauge span,
.signal-block span,
.student-source,
.student-status,
.student-updated,
.watch-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.trend-canvas,
.student-trend {
  width: 100%;
  height: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fbfb;
}

.band-stack,
.student-bands,
.watchlist {
  display: grid;
  gap: 0.75rem;
}

.band-row {
  gap: 0.7rem;
}

.band-name {
  width: 4.2rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: capitalize;
}

.band-track,
.meter {
  position: relative;
  height: 0.62rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e8efed;
}

.band-track {
  flex: 1;
}

.band-track span,
.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--green));
  transition: width 0.28s ease;
}

.band-value {
  width: 3rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.watchlist {
  min-height: 210px;
}

.watch-item {
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.watch-item strong {
  display: block;
  color: var(--ink);
}

.watch-score {
  color: var(--green-deep);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.watch-item.is-alert .watch-score {
  color: var(--red);
}

.student-section {
  display: grid;
  gap: 1rem;
}

.section-heading {
  padding: 0.6rem 0;
}

.segmented {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.segmented__button {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 800;
}

.segmented__button.is-active {
  color: #fff;
  background: var(--ink);
}

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

.student-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.student-avatar {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: var(--avatar-color, var(--green));
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
}

.student-id {
  min-width: 0;
  gap: 0.75rem;
}

.student-name {
  overflow: hidden;
  max-width: 14rem;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-actions {
  gap: 0.35rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.student-card__metrics {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
}

.mini-gauge {
  width: 4.8rem;
  aspect-ratio: 1;
}

.mini-gauge strong {
  display: block;
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.signal-block {
  display: grid;
  gap: 0.35rem;
}

.signal-block strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.meter {
  width: 100%;
}

.student-trend {
  height: 96px;
}

.student-card__footer {
  padding-top: 0.2rem;
  border-top: 1px solid var(--line);
}

.student-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.student-status::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--status-color, var(--green));
}

.empty-state {
  display: grid;
  gap: 0.4rem;
  padding: 2rem;
  text-align: center;
}

.empty-state h3 {
  font-size: 1.35rem;
}

.empty-state p {
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .control-band,
  .overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .control-band__copy,
  .panel--hero {
    grid-column: 1 / -1;
  }

  .student-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-header__inner,
  .app-shell {
    width: min(calc(100% - 1rem), var(--max-width));
  }

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

  .app-header__actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .back-link {
    justify-content: center;
  }

  .session-status,
  .segmented {
    width: 100%;
  }

  .session-status {
    justify-content: space-between;
  }

  .control-band,
  .overview-grid,
  .student-grid,
  .student-card__metrics {
    grid-template-columns: 1fr;
  }

  .control-band__media {
    min-height: 160px;
  }

  h1 {
    max-width: none;
  }

  .action-dock .button {
    width: 100%;
  }

  .segmented {
    overflow-x: auto;
  }

  .segmented__button {
    flex: 1;
    white-space: nowrap;
  }
}
