:root {
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: #272b23;
  background: #f2f1eb;
  color-scheme: light;
  --panel: #fbfaf5;
  --line: #deddd3;
  --muted: #62675b;
  --green: #285e43;
  --sage: #d5e4cf;
  --clay: 0 3px 0 #dbd9cd, 0 5px 10px #37352810, inset 0 1px 1px #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); }
button, input, textarea, select { font: inherit; }
button, a.btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f9f8f1;
  box-shadow: var(--clay);
  color: inherit;
  padding: .6rem .85rem;
  border-radius: .7rem;
  text-decoration: none;
  display: inline-block;
  font-weight: 650;
}
button:hover, a.btn:hover { border-color: #7b9272; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
button.primary, a.primary, button[aria-pressed="true"] {
  background: var(--sage);
  color: #214633;
  border-color: #b7c9af;
  box-shadow: 0 3px 0 #a9bda0, 0 5px 9px #31472a1a, inset 0 1px 1px #eef8e8;
}
button:disabled { opacity: .5; cursor: default; }
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem max(1rem,calc((100vw - 1230px)/2));
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
  gap: 1rem;
}
.brand { display: flex; gap: .75rem; align-items: center; text-decoration: none; color: inherit; font-weight: 800; }
.brand small { display: block; letter-spacing: .13em; color: var(--muted); margin-top: .08rem; font-size: .75rem; }
.mark {
  display: block;
  flex: 0 0 auto;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: .8rem;
}
nav, .actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
main { max-width: 1262px; margin: auto; padding: 1.75rem 1rem 4rem; }
.welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.3rem,4vw,2.75rem);
  background: radial-gradient(ellipse at right top,#f2f6e8 0%,transparent 65%), #e7eddf;
  border: 1px solid #d8dfd0;
  border-radius: 1.45rem;
}
.welcome p:not(.eyebrow) { max-width: 38rem; }
.clay-tile {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(4.25rem,12vw,9rem);
  aspect-ratio: 1.15;
  margin-right: clamp(0rem,3vw,2rem);
  transform: rotate(-9deg);
  background: linear-gradient(145deg,#fffefa,#eae5d9);
  border: 1px solid #f9f6ee;
  border-radius: 24%;
  box-shadow: 0 6px 0 #d9d3c4, 0 16px 24px #635c4240, inset 1px 2px 4px #fff;
  color: #39624b;
  font-size: clamp(1.2rem,4vw,2.8rem);
  text-shadow: 0 2px 0 #fff;
}
.eyebrow { color: var(--green); font-size: .875rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin-bottom: .65rem; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(2.1rem,5vw,4rem); letter-spacing: -.066em; margin-bottom: .6rem; line-height: 1.02; }
h2 { letter-spacing: -.04em; line-height: 1.15; margin-bottom: .75rem; }
p { line-height: 1.55; color: var(--muted); }
p strong { color: #272b23; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(1rem,2.2vw,1.4rem);
  border-radius: 1.18rem;
  box-shadow: 0 4px 12px #3d35230b, inset 0 1px 0 #fff;
  min-width: 0;
}
.layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(325px,1fr); gap: 1rem; align-items: start; }
.stack { display: grid; gap: 1rem; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .75rem; margin: 1rem 0; }
.stat strong { font-size: clamp(1.2rem,3vw,1.9rem); color: var(--green); display: block; }
.muted,.stat span,small { color: var(--muted); }
.day-head, .month { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.day-head h2, .day-head .pill { margin-bottom: 0; }
.day-head button { font-size: .875rem; }
.month { flex-wrap: nowrap; }
.month button { font-size: 1.4rem; line-height: 1; padding: .35rem .65rem; }
.calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .36rem; }
.calendar button,.cal-out,.cal-blank { min-width: 0; min-height: 3rem; display: grid; place-content: center; justify-items: center; gap: .16rem; }
.calendar button { padding: .2rem 0; font-size: .875rem; }
.calendar .today { outline: 1px solid #6d8763; outline-offset: 2px; }
.cal-out,.weekday { color: var(--muted); text-align: center; font-size: .8rem; }
.cal-out { opacity: .65; }
.check { width: 1.15rem; height: 1.15rem; display: inline-grid; place-items: center; border-radius: 50%; color: #505751; background: #e4e5df; font-size: .78rem; font-weight: 800; font-style: normal; line-height: 1; }
.check.partial { color: #256244; border: 2px dotted #2e7453; background: #edf4e9; }
.check.full { background: #377254; color: #fff; }
.check.none { background: transparent; }
.legend { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1rem; color: var(--muted); font-size: .875rem; }
.legend span { display: flex; align-items: center; gap: .25rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.tabs button { font-size: .875rem; }
.tabs .selected { background: var(--sage); border-color: #8ca782; }
.video { display: block; width: 100%; max-height: 390px; background: #222720; border-radius: .8rem; margin: .65rem 0 1rem; aspect-ratio: 16/9; }
.task { padding-top: .8rem; border-top: 1px solid var(--line); }
.task li { line-height: 1.5; margin-block: .35rem; }
.review { display: grid; gap: .65rem; margin: .9rem 0; }
.review-links { margin: .7rem 0; }
.rubric { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: .65rem; border-bottom: 1px solid var(--line); padding: .55rem 0; }
.rubric label { font-size: .875rem; white-space: nowrap; }
input[type=radio] { accent-color: var(--green); }
textarea,input:not([type=radio]),select { background: #fffefa; border: 1px solid #bfc3b6; color: inherit; border-radius: .55rem; padding: .55rem; max-width: 100%; }
textarea { width: 100%; min-height: 5rem; resize: vertical; }
#draft { min-height: 13rem; }
details { margin: .65rem 0; }
summary { cursor: pointer; font-weight: 750; }
details[open] summary { margin-bottom: .65rem; }
.roster button { width: 100%; text-align: left; }
.pill { display: inline-block; color: var(--green); background: #e8efe0; border-radius: 2rem; padding: .34rem .65rem; font-weight: 700; font-size: .875rem; margin-bottom: .65rem; }
#toast { position: fixed; bottom: 1rem; right: 1rem; background: #e8efe0; border-radius: .7rem; color: #244533; }
#toast:not(:empty) { padding: .8rem 1rem; box-shadow: var(--clay); }
code { color: var(--green); }
@media(max-width: 850px) {
  .layout { grid-template-columns: 1fr; }
  .calendar { max-width: 32rem; }
}
@media(max-width: 520px) {
  .bar { flex-wrap: wrap; }
  .welcome { gap: .8rem; }
  .stat { padding: .65rem; }
  .stat span { font-size: .84rem; }
  .rubric { gap: .25rem; }
  .rubric label { font-size: .78rem; }
}
dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; margin-bottom: .65rem; }
dt { font-weight: 750; }
dd { margin: 0; overflow-wrap: anywhere; }
.review label:has(> input:not([type=radio])) { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.student-layout { grid-template-columns: minmax(315px, .95fr) minmax(0, 1.65fr); }
.phase-path { display: grid; gap: .65rem; }
.phase-group { padding: .6rem .7rem .75rem; border: 1px solid transparent; border-radius: .8rem; }
.phase-group h3 { font-size: .9rem; margin-bottom: .45rem; line-height: 1.2; }
.phase-0 { background: #edf1e7; }
.phase-1 { background: #f5eee2; }
.phase-2 { background: #eeedf6; }
.phase-3 { background: #eaf0f1; }
.phase-4 { background: #f1eee6; }
.active-phase { border-color: #a8b9a0; }
.day-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.day-tile {
  min-width: 0;
  display: grid;
  grid-template-rows: 1rem 1.1rem .75rem;
  justify-items: center;
  align-items: center;
  gap: .14rem;
  padding: .3rem 0;
  line-height: 1;
  border-radius: .52rem;
}
.day-number { font-size: .885rem; }
.day-tile small { font-size: .62rem; }
.day-tile small:empty { visibility: hidden; }
#plan-ahead { margin-bottom: .85rem; padding: .75rem; border: 1px solid var(--line); border-radius: .8rem; }
#plan-ahead h3 { margin-bottom: 0; }
.progress-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .875rem; }
.progress-label strong { font-variant-numeric: tabular-nums; }
.segments { display: grid; gap: .19rem; margin: .3rem 0 .8rem; }
.days-meter { grid-template-columns: repeat(30, minmax(0, 1fr)); }
.passes-meter { grid-template-columns: repeat(7, .7rem); gap: .34rem; }
.segments i { height: .48rem; border-radius: .4rem; background: #e4e6de; border: 1px solid #d8dbd1; }
.passes-meter i { height: .7rem; border-radius: 50%; }
.segments .filled { background: #508568; border-color: #508568; }
.extension { font-size: .875rem; margin-bottom: 0; }
.extension { margin-top: .75rem; }
.daily-title { font-size: clamp(1.65rem, 3vw, 2.35rem); margin-bottom: .45rem; }
.lesson-player { margin: 1rem 0; }
.lesson-player figcaption { font-weight: 750; font-size: .92rem; }
.lesson-player .video { margin-bottom: 0; }
.submission { margin-top: 1rem; }
.submission h3 { margin-bottom: .4rem; }
.nav-menu { position: relative; margin: 0; }
.nav-menu summary { padding: .5rem .35rem; }
.nav-menu[open] summary { margin-bottom: 0; }
.nav-popover {
  position: absolute;
  z-index: 2;
  top: 100%;
  right: 0;
  display: grid;
  gap: .5rem;
  min-width: min(13rem, 75vw);
  max-width: 75vw;
  padding: .65rem;
  background: var(--panel);
  border-radius: .8rem;
  border: 1px solid var(--line);
  box-shadow: var(--clay);
}
.nav-popover dl { min-width: 14rem; }
@media(max-width: 850px) {
  .student-layout { grid-template-columns: 1fr; }
  .day-tiles { grid-template-columns: repeat(7,minmax(0,2.65rem)); }
}


.roadmap, .manager-card { min-width: 0; }
.roadmap-stages {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, .82fr) repeat(2, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.roadmap-stage {
  min-width: 0;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: #f3f1e9;
}
.roadmap-stage:nth-child(2) { background: #eeedf6; }
.roadmap-stage:nth-child(3) { background: #eaf0f1; }
.roadmap-stage:nth-child(4) { background: #f5eee2; }
.roadmap-stage.stage-current { background: #edf1e7; border-color: #91aa87; }
.stage-time { font-size: .875rem; color: var(--muted); font-weight: 700; }
.roadmap-stage h3 { margin: .25rem 0 .55rem; font-size: 1rem; }
.roadmap-stage p { margin: 0; font-size: .875rem; }
.roadmap-stage .stage-goal { color: var(--green); font-size: 1.05rem; font-weight: 800; margin-bottom: .25rem; }
.roadmap-stage .stage-update { margin-top: .6rem; font-weight: 750; color: var(--green); }
.roadmap-stage .meter-target { margin: -.48rem 0 .55rem; }
.roadmap-stage .target { outline: 1px solid var(--green); outline-offset: 1px; }
@media(max-width: 900px) { .roadmap-stages { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width: 540px) { .roadmap-stages { grid-template-columns: 1fr; } }

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 16rem);
  gap: 1rem;
  margin-bottom: 1rem;
}
.manager-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .65rem;
}
.manager-card h2 { font-size: 1.2rem; margin: 0; }
.manager-card h3 { margin: 0; font-size: 1.1rem; }
.manager-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 1rem;
  object-fit: cover;
  box-shadow: var(--clay);
}
.manager-initial { display: grid; place-items: center; background: var(--sage); font-weight: 800; }
.manager-card .manager-stats { margin: -.35rem 0 0; font-size: .875rem; }
.manager-card .discord-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .48rem .55rem;
  font-size: .875rem;
  background: #4652ce;
  border-color: #414bbc;
  box-shadow: 0 3px 0 #30399f, inset 0 1px 1px #7482f3;
  color: #fff;
}
.manager-card a.discord-button:hover { background: #3946bd; }
.message-icon { display: block; flex: 0 0 auto; border-radius: .4rem; }
@media(max-width: 850px) { .dashboard-top { grid-template-columns: 1fr; } }

.csm-login { font-size: .875rem; font-weight: 650; }
