:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #fff;
  --line: #e3e9e0;
  --ink: #1f3128;
  --muted: #64736b;
  --forest: #235941;
  --mint: #b5ddb9;
  --bottom: #f8faf7;
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .63; }
:focus-visible { outline: 2px solid #4b895f; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
[data-icon] { display: inline-flex; flex: 0 0 auto; }
svg { width: 18px; height: 18px; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #fbfcfa; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 29px 17px 22px; }
.brand { display: block; padding: 5px 7px; }
.brand img { display: block; width: 100%; height: auto; }
nav { margin-top: 23px; display: grid; gap: 5px; }
.nav-link { display: flex; width: 100%; align-items: center; gap: 11px; text-align: left; padding: 12px; border: 0; border-radius: 9px; background: transparent; color: #506057; font-weight: 600; }
.nav-link:hover { background: #edf3ec; }
.nav-link.selected { background: #e6efe4; color: var(--forest); font-weight: 750; }
.local { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 100%; background: #72a77c; flex: 0 0 auto; }
.workspace { width: 100%; max-width: 1710px; margin-inline: auto; padding: 29px 32px 35px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.source { font-size: 12px; letter-spacing: .04em; color: #536b5e; font-weight: 600; }
h1 { font-size: clamp(25px, 3vw, 35px); letter-spacing: -.045em; margin-top: 4px; line-height: 1.25; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 9px 13px; white-space: nowrap; font-size: 13px; line-height: 20px; font-weight: 650; }
.button svg { width: 16px; height: 16px; }
.secondary { background: var(--surface); border-color: #dce5db; }
.secondary:hover { background: #eff5ee; }
.primary { color: white; background: var(--forest); }
.primary:hover { background: #174630; }
.coverage { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 187px; overflow: hidden; isolation: isolate; border-radius: 17px; padding: 24px 30px; background: linear-gradient(115deg, #16382b, #20543e 70%, #286048); color: #eff8ee; }
.coverage-info { z-index: 1; }
.coverage-label { display: flex; align-items: center; gap: 8px; }
.coverage-label .live-dot { background: var(--mint); box-shadow: 0 0 0 4px #b5ddb923; }
.coverage-label h2 { font-size: 13px; font-weight: 650; letter-spacing: .075em; }
.percent { font-size: clamp(44px, 6vw, 63px); font-weight: 740; letter-spacing: -.06em; line-height: 1.1; margin: 7px 0; font-variant-numeric: tabular-nums; }
.unit { font-size: .46em; color: var(--mint); margin-left: 5px; letter-spacing: -.02em; }
.coverage-info p { font-size: 13px; color: #d6e8d9; }
.coverage-art { position: absolute; right: 19%; top: 50%; transform: translate(30%, -50%); display: grid; place-items: center; }
.coverage-art::before, .coverage-art::after { content: ""; position: absolute; width: 215px; aspect-ratio: 1; border-radius: 50%; border: 1px solid #b6d6bc22; }
.coverage-art::after { width: 287px; border-color: #b6d6bc14; }
.ring { width: 153px; aspect-ratio: 1; display: grid; place-items: center; position: relative; }
.ring-progress { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#b5ddb9 var(--progress,0%), #b6d6bc32 0); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); }
.ring svg { width: 37px; height: 37px; color: #bedcc4; stroke-width: 1.3; }
.coverage-class { z-index: 1; align-self: flex-end; color: #d6e8d9; padding: 6px 11px; background: #14352668; border: 1px solid #d6e8d92c; border-radius: 7px; white-space: nowrap; font-size: 12px; }
.coverage-class strong { color: white; font-variant-numeric: tabular-nums; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin: 14px 0 22px; }
.metric { display: flex; align-items: center; gap: 13px; padding: 14px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #587064; background: #e9eeeb; }
.metric-icon.done { color: #276448; background: #e6f1e7; }
.metric-icon.scheduled { color: #815e1c; background: #fbefda; }
.metric p { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.metric strong { font-size: 25px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric span { color: var(--muted); font-size: 11px; }
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.ledger-header { padding: 18px 20px 11px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.ledger h2 { font-size: 19px; }
.ledger-header p, .ledger footer { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ledger-header p { margin-top: 5px; }
.legend { display: flex; gap: 6px; white-space: nowrap; }
.status { --status-color: #566561; --status-bg: #eff2f0; color: var(--status-color); background: var(--status-bg); border-radius: 20px; padding: 4px 8px; font-size: 11px; display: inline-flex; gap: 5px; align-items: center; }
.status::before, .card-dot { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status.completed { --status-color: #286444; --status-bg: #e6f2e8; }
.status.scheduled { --status-color: #805b16; --status-bg: #fbf0db; }
.toolbar { padding: 4px 20px 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search, .select { display: flex; align-items: center; background: var(--bottom); color: #586b60; border: 1px solid var(--line); border-radius: 8px; min-height: 38px; }
.search { gap: 8px; padding: 0 10px; }
.search input, .select select { outline: none; background: transparent; border: none; min-height: 36px; font-size: 13px; }
.search:focus-within, .select:focus-within { outline: 2px solid #6a9d76; outline-offset: 1px; }
.search input { width: 166px; padding: 0; }
.search svg, .select svg { width: 15px; height: 15px; }
.select { position: relative; }
.select select { cursor: pointer; appearance: none; padding: 0 27px 0 10px; }
.select [data-icon] { position: absolute; right: 7px; pointer-events: none; }
.match-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.table-scroll { overflow: auto; width: 100%; max-height: 59vh; border-block: 1px solid var(--line); scrollbar-color: #abbcac #f2f5f0; }
table { width: 100%; border-spacing: 0; text-align: left; }
thead th { position: sticky; top: 0; background: #f0f4ef; color: #52645a; z-index: 2; font-size: 12px; font-weight: 650; padding: 10px 9px; white-space: nowrap; border-bottom: 1px solid var(--line); }
thead th:first-child { z-index: 3; }
tr > :first-child { position: sticky; left: 0; padding-inline: 17px; }
tbody th { z-index: 1; background: white; min-width: 158px; box-shadow: 1px 0 0 var(--line); font-weight: 730; }
tbody td, tbody th { padding: 8px 5px; border-bottom: 1px solid #e9eee7; }
tbody tr:last-child :is(td,th) { border-bottom: 0; }
tbody:nth-child(2) tr:nth-child(even) { background: #fbfcfa; }
tbody:nth-child(2) tr:nth-child(even) th { background: #fbfcfa; }
.class-meta { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); font-weight: 550; margin-top: 6px; }
.class-meta progress { appearance: none; width: 50px; height: 5px; border: 0; border-radius: 6px; color: #4c906b; background: #e6ece5; }
progress::-webkit-progress-bar { border-radius: 6px; background: #e6ece5; }
progress::-webkit-progress-value { border-radius: 6px; background: #53956c; }
progress::-moz-progress-bar { background: #53956c; }
.student { border: 1px solid #e4eae3; border-radius: 8px; background: white; padding: 7px 9px; width: 106px; text-align: left; min-height: 53px; display: flex; flex-direction: column; align-items: flex-start; }
.student:hover { border-color: #a1c0a5; background: #f2f8f0; }
.student-name { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.student-meta { display: flex; justify-content: space-between; width: 100%; align-items: center; gap: 3px; margin-top: 5px; }
.student .status { background: transparent; padding: 0; font-size: 10px; white-space: nowrap; }
.score { color: #665028; background: #f7eddb; border-radius: 4px; font-size: 10px; line-height: 1.4; font-weight: 650; padding: 0 3px; white-space: nowrap; }
.ledger footer { padding: 10px 20px; display: flex; align-items: center; gap: 7px; }
.ledger footer svg { width: 14px; height: 14px; }
.empty { padding: 23px 18px; text-align: center; color: var(--muted); }
dialog { color: var(--ink); border: 1px solid var(--line); padding: 0; box-shadow: 0 18px 60px #12271b42; }
dialog::backdrop { background: #13271c72; }
.student-dialog { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(595px, 100%); height: 100%; max-height: none; max-width: none; border-width: 0 0 0 1px; background: #f8faf7; }
.settings-dialog { width: min(540px, calc(100% - 26px)); border-radius: 14px; }
.save-dialog .dialog-header { align-items: center; background: #f1f6ef; padding-block: 18px; }
.save-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.save-heading img { flex: 0 0 auto; object-fit: contain; border-radius: 50%; }
.save-heading h2 { font-size: clamp(17px, 4.5vw, 22px); margin: 0; }
.save-dialog .dialog-body { padding-top: 19px; }
.save-dialog .settings-note { font-size: 14px; margin-bottom: 15px; }
.save-file { display: flex; align-items: center; gap: 11px; border: 1px solid #dfe8dd; background: #f7faf6; padding: 12px; border-radius: 10px; margin: 14px 0; }
.save-file > div { flex: 1; min-width: 0; }
.save-file strong { display: block; font-weight: 650; overflow-wrap: anywhere; }
.save-file small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.save-file-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px; background: #e3efe4; color: #235940; }
.save-extension { color: #375844; font-size: 11px; font-weight: 750; letter-spacing: .04em; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 22px 23px; background: white; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 26px; margin-block: 4px; }
#student-meta { font-size: 12px; color: var(--muted); }
.icon-button { background: #f0f4ef; width: 36px; height: 36px; padding: 0; }
.icon-button:hover { background: #e5eee3; }
.dialog-body { padding: 18px 23px 25px; }
.factors { border: 1px solid var(--line); background: #edf4ec; border-radius: 9px; padding: 12px; }
.factors summary { cursor: pointer; }
.factors summary span:first-child { font-weight: 750; margin-right: 7px; }
.factors summary span:last-child { color: #506858; font-size: 12px; }
dl { margin: 11px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 15px; align-items: start; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; }
.factor-hit { margin-left: 6px; }
.records-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 19px 0 10px; }
.records-heading h3 { font-size: 17px; }
#record-count { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 3px; }
.record-form, .record, #record-list .empty { border: 1px solid var(--line); border-radius: 10px; background: white; padding: 14px; margin-top: 10px; }
.record-form h3 { margin-bottom: 12px; }
.record-form label, #settings-form label { display: grid; gap: 6px; font-weight: 640; font-size: 13px; margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.record-form :is(input:not([type=file]),textarea,select), #regions { border: 1px solid #d8e3d8; border-radius: 7px; padding: 8px 9px; width: 100%; min-width: 0; background: white; font-weight: 450; }
textarea { resize: vertical; }
.file-picker, .record-form .file-picker { position: relative; display: flex; align-items: center; gap: 9px; cursor: pointer; border: 1px dashed #a7bfaa; padding: 11px; border-radius: 8px; background: #f7faf6; }
.file-picker:focus-within { outline: 2px solid #6a9d76; outline-offset: 1px; }
.file-picker small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.file-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
#attachment-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#attachment-fields legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 640; }
.attachment-pickers { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 8px; }
.record-form .attachment-pickers .file-picker { margin: 0; }
.attachment-help { margin: 6px 0 10px; color: var(--muted); font-size: 12px; }
.attachment-editor { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.attachment-editor li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #f7faf6; border: 1px solid var(--line); border-radius: 8px; }
.record-form .attachment-name { display: flex; flex: 1; align-items: center; min-width: 0; margin: 0; color: var(--muted); font-weight: 400; }
.attachment-name span { white-space: nowrap; }
.record-form .attachment-remove { display: flex; align-items: center; margin: 0; font-weight: 400; white-space: nowrap; }
.record-form .attachment-remove input[type=checkbox] { width: auto; }
.attachment-remove-button { flex-shrink: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.record-header, .attachment-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.record-time { font-weight: 750; }
.record-actions { display: flex; gap: 5px; }
.record-actions button, .attachment-top a { font-size: 12px; padding: 3px 6px; border: 0; background: transparent; color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.record-actions button.danger { color: #94392c; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 3px; line-height: 1.55; }
.attachment { background: #f3f6f1; border: 1px solid var(--line); padding: 7px 9px; border-radius: 9px; margin-top: 9px; }
.attachment-top { font-size: 12px; overflow-wrap: anywhere; }
.photo-link { display: block; width: fit-content; margin-top: 5px; }
.photo-link img { display: block; max-width: 100%; max-height: 230px; object-fit: contain; border-radius: 6px; }
.record-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.export-field { display: grid; gap: 6px; font-weight: 640; }
.export-field select { border: 1px solid #d8e3d8; border-radius: 7px; padding: 8px 9px; background: white; }
#import-error { margin-top: 10px; }
audio { width: 100%; margin-top: 3px; height: 36px; }
.error { color: #933324; background: #fbede8; border: 1px solid #f3d9d1; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.settings-note { margin-bottom: 13px; line-height: 1.6; color: var(--muted); }
.toast { position: fixed; z-index: 10; bottom: 24px; right: 24px; border-radius: 9px; padding: 11px 14px; background: #163c2a; color: #fff; box-shadow: 0 4px 16px #213d2945; }
.toast-recovery-success { top: clamp(16px, 5vh, 36px); right: auto; bottom: auto; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 9px; transition: opacity 500ms ease; }
.toast-recovery-success::before { content: "✓"; display: grid; place-items: center; width: 21px; height: 21px; flex: 0 0 auto; border-radius: 50%; background: #d5eadd; color: #163c2a; font-weight: 700; }
.toast-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .toast-recovery-success { transition: none; } }
.student-dialog[open] { display: flex; flex-direction: column; }
.student-dialog .dialog-body { overflow-y: auto; }
.student-dialog.record-creating { inset: 0; width: 100%; height: 100dvh; border: 0; }
.record-creating .dialog-body { align-self: center; width: min(100%, 1160px); padding: clamp(12px, 2.5vw, 32px); }
.record-creating :is(.factors, .records-heading, #record-list) { display: none; }
.record-creating .record-form { margin: 0; padding: clamp(14px, 2vw, 26px); }
.record-creating textarea { min-height: clamp(150px, 27vh, 260px); }
@media (max-width: 1040px) {
  body { grid-template-columns: 181px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .workspace { padding-inline: 20px; }
}
@media (max-width: 770px) {
  body { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; width: clamp(146px, 29vw, 186px); }
  .sidebar { flex-wrap: wrap; }
  .local, #ledger-nav { display: none; }
  nav { display: flex; flex-wrap: wrap; margin: 0; gap: 3px; }
  .nav-link { padding: 7px; gap: 5px; width: auto; font-size: 12px; white-space: nowrap; }
  .nav-link svg { width: 14px; height: 14px; }
  .workspace { padding: 16px 12px 20px; }
  .page-header { margin-bottom: 13px; }
  .coverage { min-height: 160px; padding: 17px; }
  .coverage-art { right: 25%; opacity: .8; }
  .ring { width: 118px; }
  .coverage-art::before { width: 160px; }
  .coverage-art::after { width: 213px; }
  .metrics { gap: 6px; margin: 9px 0 14px; }
  .metric { padding: 9px 6px; gap: 5px; }
  .metric-icon { width: 25px; height: 25px; border-radius: 7px; }
  .metric-icon svg { width: 14px; height: 14px; }
  .metric strong { font-size: 20px; }
  .ledger-header { align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px; }
  .toolbar { padding-inline: 12px; }
  .search input { width: 134px; }
  tbody th { min-width: 121px; }
  tr > :first-child { padding-inline: 10px; }
  .ledger footer { padding-inline: 12px; }
}
@media (max-width: 440px) {
  .records-heading { flex-wrap: wrap; }
  .coverage-art { right: 27%; opacity: .48; }
  .coverage-class { padding: 5px 6px; }
  .source { font-size: 11px; }
  .match-count { margin-left: 0; }
}


.auth-screen { grid-column: 1 / -1; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 10% 0%, #dcece2, transparent 60%), var(--bg); }
.auth-card { width: min(100%, 410px); padding: clamp(24px, 6vw, 38px); background: white; border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 16px 56px #1b4b2d16; }
.auth-brand { display: block; width: 190px; max-width: 100%; height: auto; margin-bottom: 22px; }
.auth-card h1 { font-size: clamp(25px, 4.6vw, 30px); margin-bottom: 10px; }
.auth-note { color: var(--muted); line-height: 1.6; margin-bottom: 18px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; font-weight: 650; }
.auth-form input { width: 100%; border: 1px solid #d4e1d6; border-radius: 8px; min-height: 42px; padding: 8px 11px; background: #fbfdfb; }
.auth-form .form-actions { margin-top: 0; }
.auth-link, .account-actions button { border: 0; background: transparent; color: var(--forest); padding: 7px 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
#auth-error { margin: 12px 0 0; }
.sidebar-account { margin-top: auto; border-top: 1px solid var(--line); padding: 13px 8px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.account-actions { display: flex; gap: 13px; flex-wrap: wrap; }
.accounts-list { display: grid; gap: 7px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border-radius: 8px; background: var(--bottom); border: 1px solid var(--line); }
.account-row small { color: var(--muted); display: block; margin-top: 4px; }
.reset-result { background: #edf6ee; border: 1px solid #d4e8d7; padding: 10px; margin-bottom: 10px; border-radius: 8px; overflow-wrap: anywhere; white-space: pre-line; }
#sharing-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
#sharing-form p { margin: 0; }
#sharing-form button { justify-self: start; }
.record-author { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
@media (max-width: 770px) {
  .sidebar-account { flex-basis: 100%; display: flex; align-items: center; gap: 14px; padding: 4px 0 0; margin: 0; }
}

.recovery-address { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.recovery-address .button { min-height: 42px; }
#recovery-message, #recovery-code-error { margin: 0; }
#mail-settings { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
#mail-settings summary { cursor: pointer; font-weight: 700; color: var(--forest); }
#mail-status { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 6px; }
#mail-form { margin-top: 12px; }
#mail-form .settings-note, #profile-note, #profile-error { margin: 0; }
#mail-form .button { justify-self: start; }
.smtp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.smtp-fields select { border: 1px solid #d4e1d6; border-radius: 8px; min-height: 42px; padding: 8px 9px; background: #fbfdfb; }
.account-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.account-row .record-tools { justify-content: flex-end; flex: none; }
@media (max-width: 520px) {
  .account-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .account-row .record-tools { justify-content: flex-start; }
}
