:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #64716b;
  --surface: #fffdf8;
  --surface-soft: #f6f1ff;
  --surface-glass: rgba(255, 253, 248, .78);
  --line: rgba(23, 32, 28, .11);
  --mist: #eee9ff;
  --sage: #c4b5fd;
  --fern: #7c3aed;
  --violet: #8b5cf6;
  --plum: #4c1d95;
  --iris: #a78bfa;
  --coral: #e77d67;
  --marigold: #eab85f;
  --lavender: #b8a6df;
  --sky: #9fc8dc;
  --shadow: 0 22px 60px rgba(76, 29, 149, .14);
  --soft-shadow: 0 12px 30px rgba(76, 29, 149, .09);
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(139, 92, 246, .20), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(159, 200, 220, .22), transparent 30%),
    linear-gradient(135deg, #fffaf8 0%, #f4f0ff 46%, #eef8fb 100%);
}

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

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, .66);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  color: white;
  font-weight: 800;
  background: linear-gradient(145deg, var(--plum), var(--violet));
  box-shadow: var(--soft-shadow);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-card small,
.sidebar-card span {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.tab,
.btn,
.care-item,
.roster-row {
  min-height: 46px;
  border: 0;
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  transition: background 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  transform: translateY(-1px);
}

.nav-item.active {
  color: var(--plum);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .14);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .62);
}

.sidebar-card + .sidebar-card {
  margin-top: 0;
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.beta-login {
  margin-top: auto;
}

.role-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.demo-switch-label {
  display: block;
  margin-top: 16px;
}

.mini-action {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .7);
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease);
}

.mini-action:hover,
.mini-action.active {
  color: white;
  background: var(--violet);
  transform: translateY(-1px);
}

.main-panel {
  position: relative;
  padding: 34px clamp(22px, 4vw, 56px) 56px;
}

.account-bar {
  display: none;
}

.auth-screen {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 620px) minmax(280px, 420px);
  gap: clamp(18px, 4vw, 44px);
  align-items: center;
  min-height: 100vh;
  padding: clamp(20px, 5vw, 64px);
}

.auth-card,
.auth-aside .panel {
  animation: pageIn 220ms var(--ease);
}

.auth-card {
  display: grid;
  gap: 24px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(139, 92, 246, .16);
  border-radius: 30px;
  background: rgba(255, 253, 248, .76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-brand {
  margin-bottom: 6px;
}

.auth-card h1 {
  margin-bottom: 12px;
}

.auth-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .62);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-aside {
  display: grid;
  gap: 16px;
}

.auth-toolbar .btn {
  width: 100%;
  margin-top: 12px;
}

.page-hero,
.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 26px;
  animation: pageIn 220ms var(--ease);
}

.detail-hero {
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--fern);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

.page-hero p,
.detail-hero p,
.soft-copy,
.note-line,
.announcement,
.skill-card p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions,
.toolbar,
.pill-row,
.import-controls,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 8px 20px rgba(23, 32, 28, .06);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--soft-shadow);
}

.btn:active {
  transform: scale(.98);
}

.btn.primary {
  color: white;
  background: linear-gradient(145deg, var(--plum), var(--violet));
}

.ghost-link {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--fern);
  background: rgba(255, 255, 255, .62);
  cursor: pointer;
}

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

.metric,
.panel,
.class-card,
.student-card,
.message-card {
  border: 1px solid var(--line);
  background: var(--surface-glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.metric {
  min-height: 132px;
  padding: 18px;
  border-radius: 22px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 34px;
}

.metric.sage {
  background: linear-gradient(145deg, rgba(238, 233, 255, .95), rgba(255, 255, 255, .7));
}

.metric.sky {
  background: linear-gradient(145deg, rgba(159, 200, 220, .32), rgba(255, 255, 255, .78));
}

.metric.lavender {
  background: linear-gradient(145deg, rgba(184, 166, 223, .32), rgba(255, 255, 255, .78));
}

.metric.coral,
.metric.marigold {
  background: linear-gradient(145deg, rgba(231, 125, 103, .22), rgba(255, 255, 255, .78));
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: start;
}

.stack,
.side-stack {
  display: grid;
  gap: 16px;
}

.wide {
  max-width: 960px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading span {
  color: var(--muted);
}

.panel {
  padding: 20px;
  border-radius: 24px;
}

.gradient-panel {
  color: #13241d;
  background:
    linear-gradient(145deg, rgba(127, 168, 143, .28), rgba(234, 184, 95, .2)),
    rgba(255, 255, 255, .72);
}

.class-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-radius: 26px;
  cursor: pointer;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.lift:hover,
.lift:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, .28);
  box-shadow: var(--shadow);
}

.class-time {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 92px;
  border-radius: 20px;
  background: var(--mist);
}

.class-time strong {
  font-size: 22px;
}

.class-time span {
  color: var(--muted);
  font-size: 13px;
}

.class-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.class-title-row p {
  margin-bottom: 10px;
}

.mini-roster {
  display: flex;
  margin-top: 12px;
}

.mini-roster .avatar + .avatar {
  margin-left: -8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.good {
  background: rgba(139, 92, 246, .16);
}

.pill.watch {
  background: rgba(234, 184, 95, .22);
}

.pill.risk {
  background: rgba(231, 125, 103, .2);
}

.pill.first,
.pill.lavender {
  background: rgba(184, 166, 223, .2);
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  font-weight: 800;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, .78);
  border-radius: 16px;
  color: white;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(145deg, var(--plum), var(--violet));
}

.care-list,
.roster-list,
.timeline,
.skill-list {
  display: grid;
  gap: 10px;
}

.care-item,
.roster-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
  background: rgba(255, 255, 255, .58);
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}

.care-item:hover,
.roster-row:hover {
  background: rgba(255, 255, 255, .9);
  transform: translateY(-1px);
}

.care-item strong,
.care-item small,
.roster-name strong,
.roster-name small {
  display: block;
}

.care-item small,
.roster-name small,
.timeline small,
.skill-row small,
.message-card small,
.skill-card small {
  color: var(--muted);
}

.care-flags {
  display: inline-flex;
  gap: 4px;
}

.empty-state {
  display: grid;
  place-items: start;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .42);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--mist);
}

.note-editor,
.csv-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  resize: vertical;
}

.note-editor {
  min-height: 150px;
}

.csv-input {
  min-height: 220px;
  margin: 14px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.student-grid,
.message-grid,
.cohort-grid,
.skill-board,
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.student-card,
.message-card {
  display: grid;
  gap: 16px;
  min-height: 190px;
  padding: 20px;
  border-radius: 24px;
  cursor: pointer;
}

.message-card {
  cursor: default;
}

.student-card h3 {
  margin-top: 14px;
}

.skill-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .56);
}

.skill-row span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.timeline div,
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline div:last-child,
.history-row:last-child {
  border-bottom: 0;
}

.alert-soft,
.guardian-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(231, 125, 103, .16);
}

.guardian-box {
  background: rgba(184, 166, 223, .16);
}

.tabs {
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .5);
}

.tab {
  padding: 10px 13px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
}

.tab.active,
.tab:hover {
  color: var(--ink);
  background: white;
}

.import-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
input {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(139, 92, 246, .18);
  border-color: rgba(139, 92, 246, .34);
}

.compact-csv {
  min-height: 120px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--violet);
}

.preview-grid pre {
  overflow: auto;
  min-height: 180px;
  max-height: 320px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #17201c;
  color: #f6f1e8;
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 20;
  top: 18px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  animation: toastIn 220ms var(--ease);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    padding: 12px;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand div:last-child,
  .sidebar-card {
    display: none;
  }

  .sidebar .beta-login {
    display: none;
    min-width: 220px;
    margin-top: 0;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .sidebar .beta-login .demo-switch-label,
  .sidebar .beta-login .role-switcher {
    display: none;
  }

  .sidebar .beta-login strong,
  .sidebar .beta-login small {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-toolbar .btn {
    min-height: 38px;
    padding: 8px 10px;
  }

  nav {
    display: flex;
    min-width: max-content;
  }

  .nav-item {
    width: auto;
  }

  .main-panel {
    padding: 22px 16px 40px;
  }

  .account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, .7);
    box-shadow: var(--soft-shadow);
  }

  .account-bar span {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 10px;
    align-items: center;
    min-width: 0;
  }

  .account-bar .avatar {
    grid-row: span 2;
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 14px;
  }

  .account-bar strong,
  .account-bar small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-bar small {
    color: var(--muted);
    font-size: 12px;
  }

  .page-hero,
  .detail-hero,
  .content-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

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

@media (max-width: 640px) {
  h1 {
    font-size: 34px;
  }

  .metrics-grid,
  .student-grid,
  .message-grid,
  .cohort-grid,
  .skill-board,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    padding: 14px;
  }

  .auth-card {
    border-radius: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .class-card,
  .roster-row,
  .care-item {
    grid-template-columns: 1fr;
  }

  .class-time {
    min-height: 64px;
  }

  .section-heading,
  .class-title-row,
  .skill-row,
  .timeline div,
  .history-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
