:root {
  color-scheme: light;
  --ink: #172941;
  --muted: #4e6072;
  --blue: #244bc0;
  --blue-dark: #193997;
  --sky: #e3eeff;
  --line: #dce2e7;
  --surface: #f5f8fc;
  --red: #ad3824;
  --display: Bricolage, Atkinson, sans-serif;
  font: 100%/1.45 Atkinson, "Segoe UI", sans-serif;
  color: var(--ink);
  background: white;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); line-height: 1.12; letter-spacing: -.035em; }
h1 { font-size: clamp(2.35rem, 4vw, 3.65rem); font-weight: 740; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); font-weight: 720; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .53; }
button, input, textarea, select, a { -webkit-tap-highlight-color: transparent; }
:where(button, input, textarea, select, a):focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
main:focus { outline: none; }
a { color: var(--blue-dark); }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 4; padding: 10px 15px; background: white; border-radius: 9px; }
.app-frame { width: min(1192px, calc(100% - 104px)); margin-inline: auto; }
.app-header { background: white; }
.mast-row, .nav-row, .profile, .app-brand, .signout, .nav-row nav, .class-context, .nav-link {
  display: flex; align-items: center;
}
.mast-row { min-height: 84px; justify-content: space-between; gap: 20px; }
.app-brand { gap: 11px; flex: none; }
.app-brand b { font: 760 28px/1 var(--display); letter-spacing: -.035em; }
.app-brand > span { border-left: 1px solid #cbd4dd; padding-left: 18px; margin-left: 9px; font-size: 15px; color: var(--muted); }
.profile { min-width: 0; gap: 9px; }
.avatar, .row-avatar { background: var(--sky); color: var(--blue-dark); border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 600; }
.avatar { width: 37px; height: 37px; font-size: .87rem; }
.profile-name { min-width: 0; line-height: 1.25; }
.profile-name strong, .profile-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24ch; }
.profile-name strong { font-weight: 600; }
.profile-name small { color: var(--muted); font-size: .82rem; }
.signout { justify-content: center; gap: 6px; min-height: 44px; padding: 4px 8px; margin-left: 7px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; }
.signout:hover, .nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-band { border-block: 1px solid var(--line); }
.nav-row { justify-content: space-between; gap: 18px; }
.nav-row nav { align-self: stretch; gap: 5px; }
.nav-link { justify-content: center; gap: 8px; background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 12px 15px 9px; min-height: 49px; font-weight: 600; line-height: 1.2; }
.nav-link[aria-current] { border-bottom-color: var(--blue); color: var(--blue); }
.nav-link svg, .btn svg, .icon-btn svg { flex: none; }
.class-context { color: var(--muted); gap: 9px; font-size: .84rem; flex-wrap: wrap; }
.class-context .text-btn { font-size: inherit; }
.workspace { padding-bottom: 56px; }
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, 30%); align-items: center; gap: 36px; margin: 32px 0; }
.page-copy { min-width: 0; }
.page-copy p { margin-top: 10px; font-size: 1.08rem; color: var(--muted); overflow-wrap: anywhere; max-width: 65ch; }
.page-copy p strong { color: var(--ink); }
.page-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 11px; font-size: .94rem; color: var(--muted); }
.page-meta strong { color: var(--blue-dark); overflow-wrap: anywhere; }
.page-meta time { padding-left: 12px; border-left: 1px solid #becad6; }
.page-copy > .btn { margin-top: 18px; }
.fox-nook { background: var(--sky); border-radius: 38% 25px 24% 25px / 45% 25px 36% 25px; height: clamp(138px, 13vw, 178px); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
.fox-nook img { display: block; max-width: 90%; width: auto; height: 90%; object-fit: contain; }
.card { border: 1px solid var(--line); background: white; border-radius: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px; }
.section-head p { color: var(--muted); margin-top: 4px; font-size: .96rem; }
.btn, .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; min-height: 48px; border-radius: 12px; padding: 10px 16px; line-height: 1.25; text-decoration: none; text-align: center; font-weight: 600; }
.primary { background: var(--blue); color: white; }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.secondary, .icon-btn { background: white; border-color: #bac9dc; color: var(--blue-dark); }
.secondary:hover:not(:disabled), .icon-btn:hover { background: #edf4ff; border-color: #9fb6da; }
.icon-btn { width: 44px; min-height: 44px; flex: none; padding: 0; }
.text-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; border: 0; border-radius: 3px; color: var(--blue-dark); background: transparent; text-align: left; font-weight: 600; text-decoration: underline; text-decoration-color: #b7c8e7; text-underline-offset: 4px; }
.text-btn:hover, .rank-link:hover { color: var(--blue); text-decoration-color: currentColor; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 26px; border-radius: 16px; background: var(--surface); }
.stat { display: flex; min-width: 0; align-items: center; gap: 13px; padding: 18px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.feature-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; flex: none; }
.blue, .badge.ready { color: var(--blue-dark); background: var(--sky); }
.mint, .badge.read { color: #236043; background: #e1f3e8; }
.rose, .badge.unread { color: #913c36; background: #fbe6e1; }
.peach, .badge.pending { color: #80501e; background: #fff0d6; }
.stat strong { display: block; font: 730 1.8rem/1.05 var(--display); }
.stat div span { color: var(--muted); font-size: .91rem; }
.toolbar, .stamp-summary, .bulk, .row-person, .roster-actions { display: flex; align-items: center; gap: 8px; }
.toolbar { flex-wrap: wrap; }
.toolbar select, .toolbar input, .form input, .form textarea, .form select {
  min-height: 48px; min-width: 0; max-width: 100%; padding: 9px 12px; border: 1px solid #8595a3;
  color: var(--ink); background: #fbfcfe; border-radius: 11px; font-size: 1rem;
}
.form input[readonly] { background: var(--surface); color: var(--muted); }
.form textarea { resize: vertical; }
.bulk { justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.stamp-summary { flex-wrap: wrap; }
.mark-done { display: inline-flex; align-items: center; gap: 6px; color: #236043; font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: 0 0 18px 18px; }
.roster-card .table-wrap { border-radius: 18px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 13px 15px; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th { font-size: .86rem; font-weight: 600; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
.roster-card th { border-top: 0; }
td { font-size: 1rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
tbody tr:hover { background: #fafcff; }
.table-day { color: var(--muted); white-space: nowrap; }
.table-actions { text-align: right; }
.table-actions .icon-btn { margin-left: 8px; vertical-align: middle; }
.roster-actions { justify-content: flex-end; gap: 4px 15px; flex-wrap: wrap; }
.subtext, .rank-title small { display: block; color: var(--muted); font-size: .875rem; margin-top: 2px; }
.badge { display: inline-flex; gap: 5px; align-items: center; border-radius: 16px; padding: 5px 10px; line-height: 1.3; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.badge.missing { color: var(--muted); background: #ecf0f3; }
.stamp-edit { margin-inline-start: 10px; font-size: .9rem; }
.stamp-note { max-width: 24ch; }
.row-avatar { width: 32px; height: 32px; font-size: .78rem; }
.mobile-label { display: none; }
.empty { padding: 22px 24px; color: var(--muted); }
.ranking-list { list-style: none; padding: 0; margin: 0; }
.ranking-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 24px; }
.ranking-list li + li { border-top: 1px solid var(--line); }
.rank-number { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--blue-dark); background: var(--sky); font: 700 1.08rem var(--display); }
.ranking-list li:first-child .rank-number { color: #7a461d; background: #ffe8c9; }
.rank-title { overflow-wrap: anywhere; }
.rank-link { color: var(--ink); font-weight: 600; text-underline-offset: 4px; text-decoration-color: #acbcce; }
.rank-link svg { vertical-align: -.16em; margin-left: 2px; }
.rank-count { font-size: .95rem; white-space: nowrap; color: var(--muted); }
.rank-count strong { color: var(--ink); }
dialog { width: min(480px, calc(100% - 28px)); max-height: 90dvh; padding: 26px; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 20px; box-shadow: 0 22px 64px #16263830; }
dialog::backdrop { background: #1729416b; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-head .icon-btn { border-color: transparent; background: var(--surface); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 7px; }
.dialog-intro { color: var(--muted); margin-bottom: 13px; }
.form, .form label, .isbn-lookup { display: grid; gap: 6px; }
.form { gap: 14px; }
.form label { font-size: 1rem; font-weight: 600; }
.form input, .form textarea, .form select { width: 100%; font-weight: 400; }
.form label small, .isbn-message { font-size: .875rem; font-weight: 400; color: var(--muted); }
.isbn-lookup label, .isbn-lookup > div { display: flex; align-items: baseline; gap: 8px; }
.isbn-lookup > div { align-items: stretch; }
.isbn-lookup .btn { flex: none; }
.form-error, .isbn-message.form-error { color: var(--red); }
.question, .demo-pin { padding: 12px 14px; border-radius: 11px; margin-bottom: 13px; overflow-wrap: anywhere; }
.question { display: grid; gap: 4px; background: var(--sky); }
.question span { font-size: .875rem; color: var(--blue-dark); }
.demo-pin { background: var(--surface); }
.credentials { margin: 0 0 15px; padding: 4px 13px; border-radius: 12px; background: var(--surface); }
.credentials > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 0; }
.credentials > div + div { border-top: 1px solid var(--line); }
.credentials dt { color: var(--muted); font-size: .9rem; }
.credentials dd { margin: 0; overflow-wrap: anywhere; font: 600 .95rem ui-monospace, monospace; }
.toast { display: none; position: fixed; bottom: 18px; right: 18px; max-width: min(380px, calc(100% - 36px)); padding: 12px 17px; border-radius: 12px; background: var(--ink); color: white; z-index: 3; }
.toast.visible { display: block; }
.loading { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; }
@media (max-width: 950px) {
  .app-frame { width: calc(100% - 48px); }
  .nav-row { flex-wrap: wrap; gap: 0 15px; }
  .class-context { min-height: 37px; }
  .stat { padding: 14px 12px; gap: 8px; }
  .feature-icon { width: 34px; height: 34px; }
}
@media (max-width: 720px) {
  .app-frame { width: calc(100% - 36px); }
  .mast-row { min-height: 68px; gap: 8px; }
  .app-brand { gap: 8px; }
  .app-brand img { width: 31px; height: 31px; }
  .app-brand b { font-size: 24px; }
  .app-brand > span, .signout span { display: none; }
  .profile-name strong, .profile-name small { max-width: 18ch; }
  .signout { width: 44px; margin-left: 0; }
  .nav-row { flex-direction: column; align-items: stretch; }
  .nav-row nav { justify-content: flex-start; }
  .class-context { padding-inline: 3px; gap: 8px; }
  .page-head { gap: 15px; grid-template-columns: minmax(0,1fr) 120px; margin: 22px 0; }
  .fox-nook { height: 95px; }
  .page-meta { font-size: .86rem; gap: 3px 7px; margin-bottom: 7px; }
  .page-meta time { border: 0; padding: 0; }
  h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
  .page-copy p { font-size: 1rem; margin-top: 7px; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); margin-bottom: 19px; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .section-head { padding: 16px; }
  .class-head { align-items: flex-start; flex-direction: column; }
  .bulk { padding: 12px 16px; }
  .toolbar { width: 100%; }
  .workspace { padding-bottom: 32px; }
}
@media (max-width: 575px) {
  .profile { gap: 5px; }
  .profile .avatar { display: none; }
  .profile-name strong, .profile-name small { max-width: min(25vw, 12ch); }
  .nav-row nav { gap: 2px; }
  .nav-link { flex: 1 1 0; flex-direction: column; gap: 3px; padding: 8px 2px 6px; font-size: .88rem; }
  .page-head { grid-template-columns: minmax(0,1fr) 84px; gap: 6px 12px; }
  .page-meta { flex-direction: column; }
  .fox-nook { height: 72px; border-radius: 36% 12px 24% 12px; align-self: start; margin-top: 3px; }
  .page-copy { display: contents; }
  .page-meta, .page-head h1 { grid-column: 1; }
  .page-head .fox-nook { grid-column: 2; grid-row: 1 / span 2; }
  .page-head p, .page-copy > .btn { grid-column: 1 / -1; }
  .page-copy p { margin-top: 2px; }
  .page-copy > .btn { justify-self: start; margin-top: 8px; }
  .section-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .toolbar select, .toolbar input { flex: 1 1 125px; width: 100%; }
  .bulk { align-items: flex-start; }
  .bulk > .btn { width: 100%; }
  .table-wrap { overflow: visible; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 9px; padding: 14px 16px; border-top: 1px solid var(--line); }
  .table-wrap tbody tr:first-child { border-top-color: var(--line); }
  .roster-card tbody tr:first-child { border-top: 0; }
  .table-wrap td { padding: 0; border: 0; }
  .table-day { font-size: .87rem; }
  .student-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .student-table td:nth-child(3), .teacher-table td:nth-child(3) { grid-row: 1; grid-column: 2; }
  .teacher-table td:nth-child(2), .table-wrap .table-actions, .roster-card td { grid-column: 1 / -1; }
  .teacher-table .row-avatar, .table-actions:empty { display: none; }
  .teacher-table .stamp-edit { display: flex; margin-inline-start: 0; }
  .stamp-note { max-width: 15ch; }
  .mobile-label { display: inline; margin-right: 5px; font-size: .87rem; color: var(--muted); }
  .table-actions { text-align: left; }
  .roster-actions { justify-content: flex-start; }
  .ranking-list li { padding: 14px; gap: 9px; }
  .rank-number { width: 29px; height: 31px; }
  .rank-count { font-size: .87rem; }
  dialog { padding: 18px; }
}
@media (max-width: 365px) {
  .app-frame { width: calc(100% - 24px); }
  .table-wrap tr { padding-inline: 11px; }
  .isbn-lookup > div { flex-wrap: wrap; }
  .isbn-lookup .btn { width: 100%; }
}
