.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--bar-h);
  padding: 10px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { min-width: 0; }
.brand-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.bar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.bar-menu {
  position: relative;
}
.bar-menu > summary {
  list-style: none;
}
.bar-menu > summary::-webkit-details-marker { display: none; }
.bar-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 220px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.bar-menu-list .btn {
  justify-content: flex-start;
  width: 100%;
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.footer-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 28px;
  font-size: 13px;
  color: var(--faint);
}
.footer-strip .version { font-family: var(--mono); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}
.landing-hero { margin-bottom: 32px; }
.landing-hero p { max-width: 54ch; color: var(--muted); }
.draft-pill {
  display: inline-block;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 4px 10px;
}

.landing h1 {
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.04em;
  font-weight: 650;
  line-height: 1.1;
  margin: 0 0 12px;
}
.landing .lede {
  max-width: 52ch;
  color: var(--muted);
  margin: 0 0 32px;
}

.gate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.gate-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gate-card h2 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.gate-card p { margin: 0; color: var(--muted); flex: 1; }
.tutor-desk {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip-accent { background: var(--accent-soft); border-color: #99f6e4; color: var(--accent); }
.chip-hidden {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.week-link.is-queued { font-style: italic; }
.week-link .chip { margin-left: auto; font-style: normal; }
.section-block.is-tutor-hidden {
  outline: 1px dashed #fcd34d;
  background: #fffbeb;
}
.tutor-reveal-banner { border-color: #fcd34d; color: #92400e; background: #fffbeb; }
.publish-list { display: grid; gap: 8px; margin: 8px 0 0; }
.publish-step { align-items: flex-start; }
.publish-hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.roster-inactive { opacity: 0.72; }
tr.roster-row { cursor: pointer; }
tr.roster-row:hover { background: var(--accent-soft); }
.people-add {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 20px;
}
.people-add input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
}
.modal-root[hidden] { display: none; }
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 25, 23, 0.45);
}
.modal-card {
  background: var(--paper);
  border-radius: 12px;
  max-width: 760px;
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(28, 25, 23, 0.22);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.github-org-panel {
  margin: 8px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.github-org-panel h2 { margin: 0 0 6px; font-size: 15px; }
.github-org-panel p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.file-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0 6px;
}
.roster-name .file-flags { margin: 6px 0 0; }
.consent-flag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  background: #f5f5f4;
  color: var(--muted);
}
.consent-flag.is-needed { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.consent-flag.is-sent { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.consent-flag.is-received { background: #d1fae5; border-color: #6ee7b7; color: #047857; }
.consent-flag.is-ok { background: var(--accent-soft); border-color: #99f6e4; color: var(--accent); }
.consent-flag.is-unknown { background: #f5f5f4; color: var(--muted); }
.consent-hint { color: var(--muted); margin: 0 0 8px; font-size: 14px; }
.consent-panel {
  margin: 8px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafaf9;
}
.consent-panel h2 { margin: 0 0 8px; font-size: 15px; }
.consent-panel p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.os-note {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #99f6e4;
  background: var(--accent-soft);
}
.os-note p { margin: 0 0 8px; color: var(--ink); }
.os-note p:last-child { margin-bottom: 0; }

.hub-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: calc(100vh - var(--bar-h));
}
.year-nav {
  border-right: 1px solid var(--line);
  padding: 20px 14px 40px;
  background: var(--paper);
}
.student-main { padding: 28px 32px 80px; max-width: 820px; }

.week-hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.week-hero h1 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
  margin: 8px 0 6px;
}
.cal-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.section-block { margin: 0 0 24px; }
.section-block h2 { font-size: 15px; margin: 0 0 10px; letter-spacing: -0.02em; }
.section-block ul, .task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-block li, .task-row {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.task-row { display: flex; gap: 10px; align-items: flex-start; }
.task-row input { margin-top: 3px; accent-color: var(--accent); }
.task-row.is-done span { color: var(--muted); }
.homework-turnin { margin: 0 0 14px; }
.form-grid { display: grid; gap: 4px; }
.form-row { display: grid; gap: 5px; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.form-row label,
.account-row label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.form-row input,
.form-row select,
.form-row textarea,
.account-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper);
}
.account-list {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}
.account-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, 11.5rem) minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
}
.account-row label { margin: 0; }
.group-post {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.notes-area, .mono-area {
  width: 100%;
  min-height: 110px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 12px;
  resize: vertical;
}
.mono-area { font-family: var(--mono); font-size: 13px; min-height: 220px; }

.week-link, .tree-btn {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 8px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}
.week-link:hover, .tree-btn:hover,
.week-link.is-active, .tree-btn.is-active {
  background: var(--bg);
  color: var(--ink);
}
.week-link .wk, .tree-btn .num {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  min-width: 2.4em;
}

.unit-group { margin-bottom: 16px; }
.unit-group h3 {
  margin: 0 8px 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.progress-meter {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin: 8px 0 14px;
}
.progress-meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.lock-note, .banner {
  font-size: 13.5px;
  color: var(--muted);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.banner.is-dirty { border-color: #fcd34d; color: var(--warn); }
.banner.is-ok { border-color: #6ee7b7; color: var(--ok); }

.hub-banner {
  margin: 0;
  padding: 8px 24px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid #fcd34d;
}

.name-gate {
  max-width: 400px;
  margin: 48px auto;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.name-gate h1 { margin: 0 0 8px; font-size: 24px; }
.name-gate form { display: flex; gap: 8px; margin-top: 14px; }
.name-gate input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.portal-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 16px;
}
.portal-tools .btn { justify-content: flex-start; }

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.msg-card .who { font-weight: 650; font-size: 13px; }
.msg-card .when { color: var(--faint); font-size: 12px; margin-left: 8px; }
.msg-card.is-hidden { opacity: 0.45; }

.lab-result { margin-top: 12px; list-style: none; padding: 0; }
.lab-result li { margin-bottom: 10px; }
.lab-result .pass { color: var(--ok); }
.lab-result .fail { color: var(--danger); }
.lab-result .fail-hint { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.lab-result .fail-err { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.quiz-item.is-ok { border-color: var(--ok); }
.quiz-item.is-miss { border-color: var(--danger); }
.quiz-explain { margin: 8px 0 0; font-size: 13.5px; }
.quiz-explain.is-ok { color: var(--ok); }
.quiz-explain.is-miss { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--paper);
}
table.data th, table.data td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}
table.data th { background: var(--bg); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
table.data th:first-child,
table.data td:first-child {
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}
table.data th:first-child { background: var(--bg); }

.privacy-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0;
  padding: 8px 24px;
  background: #1c1917;
  color: #fafaf9;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
body.is-private .pii-live { display: none !important; }
body.is-private .pii-mask { display: inline !important; letter-spacing: 0.12em; color: var(--faint); }
.pii-mask { display: none; }
body.is-private [data-pii-field] {
  filter: blur(9px);
  user-select: none !important;
}
.pii-photo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}
body.is-private .pii-photo { opacity: 0; }
body.is-private .pii-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, #d6d3d1, #d6d3d1 6px, #e7e5e4 6px, #e7e5e4 12px);
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--line);
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.file-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.file-hero h1 { margin: 0 0 4px; }
.student-photo,
.student-photo-sm,
.student-photo.is-empty {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  background: var(--bg);
}
.student-photo.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  font-size: 32px;
  color: var(--faint);
}
.student-photo-sm,
.roster-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--faint);
}
.roster-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg);
}

.inbox-wrap { position: relative; }
.inbox-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(360px, 90vw);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  z-index: 40;
}
.inbox-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inbox-item {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  margin-top: 6px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.inbox-item span { color: var(--muted); }
.inbox-item:hover { text-decoration: none; background: var(--bg); }
.inbox-item.is-unread { border-color: #99f6e4; background: var(--accent-soft); }

.parent-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  margin-bottom: 12px;
}

.import-box {
  margin: 8px 0 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.import-box > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}
.import-box > summary::-webkit-details-marker,
.import-box > summary::marker { display: none; content: ""; }
.import-box > summary h2 { margin: 0; font-size: 15px; letter-spacing: -0.02em; }
.import-hint { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.import-toggle {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-right: 6px;
  transition: transform 0.15s ease;
}
.import-box[open] > summary .import-toggle { transform: rotate(-135deg); margin-top: 6px; }
.import-body { padding: 0 16px 16px; }
.col-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
}
.col-pick-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  font-size: 13.5px;
}
.col-pick-item input { margin-top: 3px; accent-color: var(--accent); }
.col-pick-item strong { display: block; font-weight: 650; }
.col-pick-item code { color: var(--muted); font-size: 12px; }
.col-pick-item .chip { margin-left: 4px; vertical-align: middle; }

@media (max-width: 860px) {
  .gate-grid, .tutor-desk, .grid-2, .col-pick, .people-add { grid-template-columns: 1fr; }
  .hub-shell { grid-template-columns: 1fr; }
  .year-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .student-main, .wrap { padding: 20px 16px 72px; }
  .file-hero { flex-direction: column; }
  .form-row.two,
  .account-row { grid-template-columns: 1fr; }
}
