:root {
  color-scheme: light;
  --ink: #1a2b25;
  --muted: #5e7067;
  --line: #dfe7df;
  --paper: #f5f7f2;
  --white: #fff;
  --pine: #173c33;
  --mint: #def2bf;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
input, select, textarea, button { outline-offset: 3px; }
:focus-visible { outline: 2px solid #397d64; }
p, h1, h2, h3 { margin: 0; }
svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbols { position: absolute; width: 0; height: 0; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: #fbfcf9; border-right: 1px solid var(--line); padding: 28px 16px 16px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; font-weight: 750; font-size: 19px; letter-spacing: -.035em; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 550; letter-spacing: 0; margin-top: 2px; }
.brand-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--mint); background: var(--pine); }
.brand-icon svg { width: 23px; height: 23px; }
.navigation { margin-top: 38px; display: grid; gap: 4px; }
.nav-button { width: 100%; border: 0; border-radius: 9px; background: transparent; color: #43564d; text-align: left; display: flex; align-items: center; gap: 10px; padding: 11px 10px; font-weight: 650; font-size: 13px; }
.nav-button:hover, .nav-button.current { background: #e6eee3; color: #204939; }
.class-navigation { margin-top: 29px; }
.class-navigation h2 { padding: 0 10px 10px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; font-weight: 750; }
.class-nav-row { justify-content: space-between; gap: 5px; }
.class-nav-row span:first-child { display: flex; align-items: center; gap: 10px; }
.class-dot { display: inline-block; width: 9px; height: 9px; margin-left: 5px; border-radius: 50%; background: #4d8268; }
.class-nav-row:nth-child(3n+2) .class-dot { background: #768bbb; }
.class-nav-row:nth-child(3n+3) .class-dot { background: #b28652; }
.class-size { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 11px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 13px 2px 0; display: flex; gap: 9px; align-items: center; font-size: 13px; font-weight: 650; }
.sidebar-footer button { margin-left: auto; }
.teacher-avatar { border-radius: 50%; background: #e6eddf; color: var(--pine); display: grid; place-items: center; width: 33px; height: 33px; }
.main { width: 100%; max-width: 1700px; margin-inline: auto; padding: 0 30px 30px; min-width: 0; }
.page-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions select { font-size: 13px; font-weight: 650; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; }
#crumb-class:not(:empty)::before { content: "/"; margin-right: 8px; color: #849289; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; min-height: 39px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 700; white-space: nowrap; }
.button svg { width: 16px; height: 16px; }
.primary { color: var(--white); background: var(--pine); }
.primary:hover { background: #245444; }
.secondary { color: var(--ink); background: var(--white); border-color: var(--line); }
.secondary:hover { background: #edf3e9; }
.mint { color: var(--pine); background: var(--mint); }
.mint:hover { background: #edf9d7; }
.icon-button { display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; flex: none; padding: 0; }
.icon-button:hover { background: #edf2eb; color: var(--ink); }
.overview { display: grid; gap: 13px; }
.hero { isolation: isolate; min-height: 169px; border-radius: 17px; overflow: hidden; background: #193f35; color: #fff; padding: 25px 29px; display: flex; gap: 22px; justify-content: space-between; align-items: center; position: relative; }
.hero-label { color: #c4dcac; letter-spacing: .14em; font-weight: 750; font-size: 10px; margin-bottom: 6px; }
.hero h1 { font-size: clamp(32px, 4vw, 49px); font-weight: 730; line-height: 1.06; letter-spacing: -.065em; }
.hero-text > p:last-child { color: #d6e5d9; font-size: 13px; margin-top: 11px; }
.hero .button { padding: 0 14px; min-height: 43px; }
.hero-lines { position: absolute; z-index: -1; width: 350px; height: 350px; right: -70px; bottom: -232px; border-radius: 27%; transform: rotate(-30deg); border: 1px solid #94c49a45; box-shadow: 0 0 0 18px #94c49a20, 0 0 0 36px #94c49a19, 0 0 0 54px #94c49a14, 0 0 0 72px #94c49a10, 0 0 0 90px #94c49a0c, 0 0 0 108px #94c49a08; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.metric { background: var(--white); border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 75px; }
.metric-icon { width: 37px; height: 37px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; }
.green { color: #306046; background: #e8f1e1; }
.blue { color: #3b5685; background: #ebf0f9; }
.gold { color: #81572d; background: #f9efdd; }
.metric p { color: var(--muted); font-size: 11px; font-weight: 650; margin-bottom: 2px; }
.metric strong { font-size: 22px; letter-spacing: -.04em; font-weight: 730; font-variant-numeric: tabular-nums; }
.metric-total { margin-left: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.gradebook { margin-top: 21px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: clip; }
.table-tools { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 17px; }
.table-tools h2 { font-size: 19px; letter-spacing: -.036em; }
.table-tools p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.table-filters { display: flex; gap: 8px; align-items: center; }
input, select, textarea { border: 1px solid #d6e1d8; background: var(--white); border-radius: 8px; min-height: 39px; color: var(--ink); padding: 8px 10px; }
input::placeholder, textarea::placeholder { color: #6a7a70; }
.search { display: flex; align-items: center; position: relative; }
.search svg { position: absolute; pointer-events: none; left: 10px; color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 33px; width: 224px; font-size: 12px; }
.table-filters select { font-size: 12px; }
.grade-scroll { overflow: auto; max-height: 57vh; scrollbar-color: #bbcbbd #f1f5ef; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
thead { position: sticky; top: 0; z-index: 3; }
thead th { background: #f0f4ef; color: #42564b; font-weight: 720; }
thead tr:first-child th { border-top: 1px solid var(--line); }
th, td { text-align: center; padding: 0; }
thead .group-head { height: 27px; border-bottom: 1px solid #e1e8df; }
thead .slot-head { height: 23px; min-width: 45px; color: #52655a; font-size: 10px; }
.start { border-left: 1px solid #e3eae1; }
.band-yaz { background: #e8f0e6; }
.band-tar { background: #e9eff6; }
.band-den { background: #eeeaf5; }
.band-odev { background: #f5efdf; }
.sticky-student { text-align: left; position: sticky; left: 0; z-index: 2; min-width: 204px; padding-left: 13px; }
thead .sticky-student { z-index: 4; }
tbody .sticky-student { background: var(--white); }
.id-col { min-width: 62px; font-variant-numeric: tabular-nums; color: var(--muted); }
.class-col { min-width: 53px; }
.note-col { min-width: 52px; }
tbody td { height: 48px; border-top: 1px solid #edf0eb; }
tbody tr:hover td { background-color: #f7faf5; }
.student-link { border: 0; background: none; text-align: left; display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 675; padding: 4px 8px 4px 0; border-radius: 7px; }
.student-link:hover { color: #31674d; text-decoration: underline; }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #e8efe3; color: #375d45; flex: none; font-weight: 750; font-size: 10px; }
tbody tr:nth-child(3n+2) .avatar { background: #e9eef6; color: #405b86; }
tbody tr:nth-child(3n+3) .avatar { background: #f6eddf; color: #795832; }
.pill { display: inline-flex; align-items: center; gap: 3px; border-radius: 5px; background: #edf2ec; color: #40584b; font-size: 10px; font-weight: 750; padding: 4px 6px; white-space: nowrap; }
.grade-cell { width: 35px; min-height: 29px; background: #f2f5f0; border: 1px solid #ebf0e9; border-radius: 6px; color: #687d6e; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.grade-cell:hover { background: #e7f2e1; border-color: #bdd6b3; }
.grade-cell.scored { background: #e8f2e2; border-color: #dae9d3; color: #25563c; }
.grade-cell.low { background: #f7ede2; border-color: #efddc8; color: #80542e; }
.note-button { border: 0; background: transparent; color: #526e5d; display: inline-flex; gap: 2px; align-items: center; justify-content: center; border-radius: 7px; min-width: 31px; height: 29px; font-size: 10px; padding: 2px; }
.note-button svg { width: 15px; height: 15px; }
.note-button:hover, .note-button.has-notes { background: #eaf1e6; }
.table-footer { min-height: 40px; padding: 7px 15px; display: flex; align-items: center; justify-content: space-between; gap: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.table-footer span:last-child { display: inline-flex; align-items: center; gap: 5px; }
.table-footer svg { width: 14px; height: 14px; }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); font-size: 13px; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at 22% 8%, #dcead7, transparent 47%), var(--paper); }
.auth-card { width: min(390px, 100%); background: var(--white); border: 1px solid var(--line); box-shadow: 0 16px 60px #173c3311; border-radius: 17px; padding: 28px; }
.auth-card h1 { margin: 15px 0 3px; font-size: 33px; letter-spacing: -.055em; }
.auth-card > p { color: var(--muted); font-size: 13px; }
.auth-card form { margin-top: 21px; }
.auth-card button { width: 100%; }
form label, .form-grid label { display: block; font-size: 12px; font-weight: 720; margin-bottom: 10px; }
form label input, .form-grid label select { display: block; width: 100%; margin-top: 5px; }
.error { color: #9d3c32; font-size: 12px; margin: 8px 0; }
.error:empty { display: none; }
.dialog { border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 16px; padding: 0; width: min(495px, calc(100% - 26px)); max-height: calc(100dvh - 26px); box-shadow: 0 20px 75px #17362c42; }
.dialog::backdrop { background: #10261d78; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 13px 16px; }
.dialog-head h2 { font-size: 19px; letter-spacing: -.035em; }
.dialog-title { display: flex; align-items: center; gap: 9px; }
.dialog-body { padding: 16px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-actions, .quick-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 15px; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 5px; }
.progress-meta strong { color: #365e48; }
progress { width: 100%; height: 7px; border: 0; background: #e7eee4; border-radius: 9px; accent-color: #478268; }
progress::-webkit-progress-bar { background: #e7eee4; border-radius: 9px; }
progress::-webkit-progress-value { background: #478268; border-radius: 9px; }
.quick-student, .detail-person { display: flex; align-items: center; gap: 10px; margin: 14px 0; background: #f3f7f0; border: 1px solid #e6ede3; border-radius: 11px; padding: 11px; }
.quick-student .avatar, .detail-person .avatar { width: 42px; height: 42px; font-size: 13px; }
.quick-student strong, .detail-person h3 { display: block; font-size: 17px; letter-spacing: -.02em; }
.quick-student small, .detail-person p { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.quick-student .pill, .detail-person button { margin-left: auto; }
.score-line { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.score-line input { width: 120px; font-size: 34px; line-height: 1.05; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 9px 0; }
kbd { font-family: inherit; font-size: .9em; font-weight: 700; border: 1px solid currentColor; padding: 0 4px; border-radius: 4px; }
.quick-actions button:first-child { margin-right: auto; }
.quick-empty h3 { margin: 10px 0 4px; color: var(--ink); }
.quick-empty .button { margin-top: 13px; }
.drawer { width: min(470px, 100%); height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-radius: 15px 0 0 15px; }
.detail-person { margin-top: 0; }
.section-title { font-size: 14px; margin: 16px 0 8px; }
.detail-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.detail-grade { min-height: 43px; width: 100%; display: grid; place-content: center; gap: 1px; }
.detail-grade span { font-size: 10px; font-weight: 550; }
textarea { resize: vertical; width: 100%; }
.notes-list { display: grid; gap: 7px; margin-top: 12px; }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.note header { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.note .icon-button { width: 28px; height: 25px; }
.note .icon-button svg { width: 14px; height: 14px; }
.mini-dialog { width: min(365px, calc(100% - 26px)); }
.toast { position: fixed; bottom: 16px; right: 16px; z-index: 5; border-radius: 9px; padding: 11px 14px; background: var(--pine); color: var(--white); font-size: 13px; box-shadow: 0 8px 25px #173c3330; }
.mobile-only { display: none; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 174px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .main { padding-inline: 16px; }
}
@media (max-width: 767px), (max-width: 950px) and (pointer: coarse) {
  body:has(.dialog[open]) { overflow: hidden; }
  .workspace { display: block; }
  .sidebar {
    position: static; height: auto; flex-direction: row; justify-content: space-between; align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; font-size: 17px; }
  .brand-icon { width: 34px; height: 34px; border-radius: 9px; }
  .brand-icon svg { width: 19px; height: 19px; }
  .navigation, .class-navigation, .sidebar-footer > span, .breadcrumb { display: none; }
  .sidebar-footer { border: 0; padding: 0; margin: 0; }
  .main {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .page-header { min-height: 0; padding-block: 12px; }
  .page-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .page-actions select { grid-column: 1 / -1; }
  .page-actions .button { white-space: normal; padding-inline: 6px; }
  .button, .icon-button, input, select { min-height: 44px; }
  .button { font-size: 14px; }
  .icon-button { width: 44px; }
  input, select, textarea, .page-actions select, .table-filters select, .search input { font-size: 16px; }
  .hero { min-height: 0; padding: 16px; gap: 13px; flex-wrap: wrap; align-items: flex-start; }
  .hero h1 { font-size: clamp(28px, 8vw, 36px); }
  .hero-text > p:last-child { font-size: 13px; margin-top: 6px; }
  .hero .button { min-height: 46px; width: 100%; }
  .hero .button svg:last-child { margin-left: 4px; }
  .metrics { gap: 7px; }
  .metric { padding: 8px; min-height: 58px; }
  .metric .metric-icon { display: none; }
  .metric strong { font-size: 20px; }
  .metric-total { display: inline-block; }
  .gradebook { margin-top: 14px; }
  .table-tools { display: grid; padding: 12px; }
  .table-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .mobile-only { display: inline-flex; }
  #mobile-view { font-size: 13px; padding-inline: 8px; }
  #mobile-view[aria-pressed="true"] { background: #e6eee3; color: var(--pine); }
  .table-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .table-filters select { max-width: 36vw; }
  .search input { width: 100%; min-width: 0; }
  .gradebook:not(.show-table) :is(thead, .id-col, .class-col, .note-col, .score-col, .table-footer),
  .show-table :is(.student-meta, .student-arrow) { display: none; }
  .gradebook:not(.show-table) .grade-scroll { max-height: none; overflow: visible; }
  .gradebook:not(.show-table) .sticky-student { position: static; width: 100%; min-width: 0; padding: 0; }
  .student-link { width: 100%; min-height: 56px; gap: 10px; padding: 8px 12px; font-size: 15px; }
  .student-identity { flex: 1; min-width: 0; }
  .student-name { display: block; overflow-wrap: anywhere; }
  .student-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 500; }
  .student-arrow { color: var(--muted); }
  .show-table .sticky-student { min-width: 130px; width: 130px; padding-left: 0; }
  .show-table .student-link { font-size: 13px; min-height: 48px; gap: 6px; padding: 5px 7px; }
  .show-table .student-link .avatar { display: none; }
  .show-table .score-col, .show-table .slot-head { min-width: 52px; }
  .show-table .grade-cell, .note-button { min-width: 44px; min-height: 44px; font-size: 14px; }
  .show-table .table-footer { font-size: 11px; flex-wrap: wrap; }
  .auth { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .auth-card { padding: 22px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .form-grid :is(input, select), #roster-file { min-width: 0; max-width: 100%; }
  .quick-dialog, .drawer {
    width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
    margin: 0; border: 0; border-radius: 0; overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-top: calc(67px + env(safe-area-inset-top));
  }
  .quick-dialog .dialog-head, .drawer .dialog-head {
    position: sticky; z-index: 2; top: 0; background: var(--white);
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .dialog-body { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  :is(.quick-dialog, .drawer) :is(.dialog-head, .dialog-body) {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .quick-dialog .form-grid label { margin-bottom: 3px; }
  .quick-student, .detail-person { flex-wrap: wrap; overflow-wrap: anywhere; }
  .quick-student { margin-block: 10px; }
  .quick-student > div, .detail-person > div { flex: 1; min-width: 0; }
  .score-line input { width: 108px; }
  .quick-actions { display: grid; grid-template-columns: 44px auto minmax(0, 1fr); margin-top: 9px; }
  .quick-actions button:first-child { margin-right: 0; }
  .quick-actions .button { padding-inline: 5px; }
  #quick-save { white-space: normal; }
  #quick-save kbd { display: none; }
  .quick-hint { margin-top: 7px; }
  .detail-grades { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-grade { min-height: 51px; }
  .detail-grade span { font-size: 11px; }
  .note .icon-button { width: 44px; }
  #note-save { width: 100%; }
  .toast { bottom: calc(12px + env(safe-area-inset-bottom)); right: 12px; max-width: calc(100vw - 24px); }
}
@media (max-width: 355px) {
  .table-filters { grid-template-columns: minmax(0, 1fr); }
  .table-filters select { max-width: none; }
}
