:root {
  --ink: #163332;
  --muted: #71817e;
  --paper: #f6f4ee;
  --card: #ffffff;
  --line: #e5e8e3;
  --green: #1b756b;
  --green-dark: #102c2a;
  --orange: #e98345;
  --blue: #4b78b5;
  --purple: #7e67a8;
  --shadow: 0 18px 45px rgba(28, 54, 51, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar { height: 86px; padding: 0 max(28px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; color: #fff; background: var(--green-dark); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 13px; color: #ffd2a8; font-family: SimSun, serif; font-size: 23px; }
.brand h1 { margin: 1px 0 0; font-size: 20px; letter-spacing: .08em; }
.eyebrow { margin: 0; font-size: 9px; font-weight: 800; letter-spacing: .2em; opacity: .58; }
.eyebrow.dark { color: var(--green); opacity: 1; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.save-state { margin-right: 8px; font-size: 12px; color: #b9ceca; }
.save-state i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #5ec6a3; }
.save-state.saving i { background: #ffc167; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.button { min-height: 38px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; font-size: 13px; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.ghost { color: #eaf3f0; background: transparent; border-color: rgba(255,255,255,.2); }
.button.ghost:hover { background: rgba(255,255,255,.08); }
.button.primary { color: #fff; background: var(--green); }
.button.secondary { color: var(--green); background: #e2f0ed; align-self: end; }
.dark-button { color: var(--ink) !important; border-color: var(--line) !important; background: white !important; }

main { max-width: 1440px; margin: 0 auto; padding: 0 28px 50px; }
.hero { min-height: 238px; margin: 0 -28px 0; padding: 58px 28px 46px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(115deg, #ecf2ed 0%, #f5eee5 100%); border-bottom: 1px solid #e9e5dc; }
.hero h2 { max-width: 760px; margin: 9px 0 8px; font-family: SimSun, "Songti SC", serif; font-size: clamp(30px, 4vw, 48px); font-weight: 700; letter-spacing: .04em; }
.date-line { margin: 0; color: var(--orange); font-weight: 800; font-size: 12px; letter-spacing: .08em; }
.hero-copy { margin: 0; color: var(--muted); font-size: 14px; }
.hero-progress { display: flex; align-items: center; gap: 18px; padding-right: 30px; }
.hero-progress strong, .hero-progress span { display: block; }
.hero-progress strong { font-size: 21px; }
.hero-progress > div:last-child span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.ring { --p: 0deg; width: 90px; height: 90px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) var(--p), #d6ded9 0); position: relative; }
.ring::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #f0f1ea; }
.ring span { position: relative; z-index: 1; font-size: 18px; font-weight: 800; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: -20px; position: relative; z-index: 2; }
.stat-card { min-height: 122px; padding: 23px; display: flex; align-items: center; gap: 17px; border-radius: 15px; background: var(--card); box-shadow: var(--shadow); border-top: 3px solid var(--green); }
.stat-card-button { width: 100%; color: var(--ink); border-right: 0; border-bottom: 0; border-left: 0; text-align: left; cursor: pointer; font: inherit; }
.stat-card-button:hover { transform: translateY(-2px); box-shadow: 0 22px 50px rgba(28,54,51,.14); }
.stat-card-button:focus-visible { outline: 3px solid rgba(126,103,168,.25); outline-offset: 3px; }
.stat-card.accent-orange { border-color: var(--orange); }
.stat-card.accent-blue { border-color: var(--blue); }
.stat-card.accent-purple { border-color: var(--purple); }
.stat-icon { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: var(--green); background: #e5f2ef; font-size: 22px; font-weight: 500; }
.accent-orange .stat-icon { color: var(--orange); background: #fff0e6; }
.accent-blue .stat-icon { color: var(--blue); background: #eaf0f8; }
.accent-purple .stat-icon { color: var(--purple); background: #f0ecf7; }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.stat-card strong { font-family: SimSun, "Songti SC", serif; font-size: 25px; }
.stat-card small { margin-top: 5px; color: #9aa6a3; font-size: 10px; }

.subject-section { padding: 48px 0 34px; }
.section-heading, .workspace-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2, .workspace-head h2 { margin: 4px 0 0; font-family: SimSun, "Songti SC", serif; font-size: 25px; }
.soft-note { margin: 0; color: var(--muted); font-size: 12px; }
.subject-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; }
.subject-card { min-height: 142px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); transition: .18s ease; cursor: pointer; }
.subject-card:hover { transform: translateY(-2px); background: #fff; box-shadow: 0 12px 28px rgba(31,58,55,.08); }
.subject-card.pending { border-style: dashed; opacity: .75; }
.subject-card-head { display: flex; justify-content: space-between; align-items: start; }
.subject-card h3 { margin: 0; font-family: SimSun, "Songti SC", serif; font-size: 20px; }
.subject-card .fraction { font-size: 11px; color: var(--muted); }
.subject-card strong { display: block; margin: 16px 0 9px; font-size: 18px; }
.mini-progress { height: 5px; overflow: hidden; border-radius: 5px; background: #e6ebe7; }
.mini-progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.subject-card p { margin: 9px 0 0; color: var(--muted); font-size: 10px; }

.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: 0 18px 50px rgba(31,58,55,.06); }
.workspace-head { padding: 25px 25px 18px; margin: 0; }
.workspace-tools { display: flex; gap: 9px; }
.search { min-width: 220px; height: 39px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fafbf9; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
select { height: 39px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fafbf9; outline: 0; }
.tabs { padding: 0 25px; display: flex; gap: 23px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { padding: 12px 2px 11px; flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.tab.active { color: var(--green); border-color: var(--green); }
.tab b { margin-left: 5px; padding: 1px 5px; border-radius: 9px; color: #879592; background: #eef1ef; font-size: 9px; }
.group-tabs { padding: 12px 25px; display: flex; align-items: center; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fbfcfa; }
.group-tabs[hidden] { display: none; }
.group-tabs-label { margin-right: 4px; color: #899692; font-size: 10px; font-weight: 800; white-space: nowrap; }
.group-tab { min-height: 32px; padding: 0 11px; flex: 0 0 auto; border: 1px solid #dce4e0; border-radius: 9px; color: #63736f; background: #fff; font-size: 11px; font-weight: 700; }
.group-tab:hover { border-color: #9ebdb7; color: var(--green); }
.group-tab.active { color: #fff; border-color: var(--green); background: var(--green); }
.group-tab b { margin-left: 6px; font-size: 9px; opacity: .72; }

.table-shell { overflow-x: auto; }
table { width: 100%; min-width: 990px; border-collapse: collapse; }
th { height: 48px; padding: 0 14px; color: #667773; background: #f8f9f7; font-size: 13px; font-weight: 800; letter-spacing: .03em; text-align: left; white-space: nowrap; }
th:first-child, td:first-child { padding-right: 18px; padding-left: 25px; text-align: left; }
td { height: 61px; padding: 8px 14px; border-top: 1px solid #edf0ed; font-size: 12px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fbfcfa; }
tbody tr.is-done .task-title-text { text-decoration: line-through; color: #81908d; }
tbody tr.is-running { background: #f1f8f5; }
.task-main { display: flex; align-items: center; justify-content: flex-start; gap: 11px; min-width: 240px; }
.task-main > div { text-align: left; }
.task-number { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: #eaf3f0; font-size: 11px; font-weight: 800; }
.task-name { display: block; font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.completed-label { margin-left: 3px; color: var(--green); font-weight: 800; }
.task-note { max-width: 260px; margin: 4px 0 0; overflow: hidden; color: #95a09e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.time-main { font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-main.clock { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; letter-spacing: .02em; }
.time-sub { display: block; margin-top: 2px; color: #9aa6a3; font-size: 9px; }
.time-sub.warning { color: var(--orange); }
.check { width: 21px; height: 21px; display: inline-grid; place-items: center; border: 1.5px solid #89aaa4; border-radius: 6px; background: #f4faf8; color: white; appearance: none; cursor: pointer; vertical-align: middle; transition: border-color .14s, background .14s, box-shadow .14s, transform .14s; }
.check:hover { border-color: var(--green); background: #e8f4f1; box-shadow: 0 0 0 3px rgba(27,117,107,.1); transform: scale(1.06); }
.check:checked { border-color: var(--green); background: var(--green); }
.check:checked::after { content: '✓'; font-size: 12px; font-weight: 900; }
.check:disabled { opacity: .18; cursor: not-allowed; }
.action-cell { display: flex; align-items: center; min-width: 54px; }
.record-button { height: 31px; padding: 0 12px; border: 1px solid #d9e2de; border-radius: 8px; color: var(--green); background: #f2f8f6; font-size: 10px; font-weight: 800; }
.record-button:hover { border-color: #9cbdb7; background: #e8f3f0; }
.empty-state { padding: 55px 20px 60px; text-align: center; color: var(--muted); }
.empty-state div { font-size: 34px; color: #aec0bb; }
.empty-state strong { display: block; margin-top: 7px; color: var(--ink); }
.empty-state p { margin: 6px 0 0; font-size: 12px; }
.table-footer { min-height: 58px; padding: 10px 25px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination { display: flex; gap: 5px; }
.page-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; font-size: 10px; }
.page-button.active { color: #fff; border-color: var(--green); background: var(--green); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 12px 17px; border-radius: 10px; color: #fff; background: var(--green-dark); box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }
.exit-screen { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.exit-screen strong { font-family: SimSun, "Songti SC", serif; font-size: 30px; }
.exit-screen p { color: var(--muted); }
.modal { width: min(520px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 90px rgba(16,44,42,.25); }
.modal::backdrop { background: rgba(13,37,35,.48); backdrop-filter: blur(3px); }
.modal form { padding: 25px; }
.dialog-content { padding: 25px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-head h3 { margin: 5px 0 0; font-family: SimSun, "Songti SC", serif; font-size: 24px; }
.modal-head p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; font-size: 20px; }
.field { display: block; margin-bottom: 15px; }
.field span { display: block; margin-bottom: 7px; color: #677572; font-size: 11px; font-weight: 700; }
.field input, .field textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #fafbf9; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: #79a49d; box-shadow: 0 0 0 3px #e8f2ef; }
.password-input { position: relative; }
.field .password-input input { padding-right: 46px; }
.password-toggle { width: 40px; height: 38px; display: grid; place-items: center; position: absolute; right: 2px; top: 50%; border: 0; border-radius: 8px; color: #7b8d89; background: transparent; transform: translateY(-50%); }
.password-toggle:hover { color: var(--green); background: #edf5f2; }
.password-toggle::before { content: ''; width: 18px; height: 11px; display: block; border: 1.7px solid currentColor; border-radius: 70% 30% 70% 30%; transform: rotate(45deg); }
.password-toggle::after { content: ''; width: 5px; height: 5px; position: absolute; border-radius: 50%; background: currentColor; }
.password-toggle.visible::after { width: 7px; height: 2px; border-radius: 2px; transform: rotate(-45deg); }
.password-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.settings-modal { width: min(850px, calc(100vw - 30px)); }
.settings-list { max-height: 49vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.setting-row { display: grid; grid-template-columns: 92px minmax(180px, 1fr) 90px 110px 112px; gap: 9px; align-items: end; padding: 12px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .field { margin: 0; }
.setting-row .field input { padding: 8px 9px; }
.setting-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.save-group, .delete-group { height: 36px; padding: 0 8px; border: 0; border-radius: 9px; font-size: 11px; font-weight: 800; }
.save-group { color: var(--green); background: #e4f1ee; }
.delete-group { color: #a34d3e; background: #f7e9e6; }
.add-group { margin-top: 14px; padding: 13px; border: 1px dashed #cbd8d4; border-radius: 11px; }
.add-group summary { cursor: pointer; color: var(--green); font-size: 12px; font-weight: 800; }
.add-grid { margin-top: 15px; display: grid; grid-template-columns: 1fr 2fr 100px 110px 70px; gap: 9px; }
.add-grid .field { margin: 0; }
.import-label { margin-right: auto; align-self: center; color: var(--green); font-size: 11px; font-weight: 800; cursor: pointer; }
.import-label input { display: none; }
.review-list { max-height: 48vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.review-item { padding: 13px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-subject { min-width: 42px; padding: 4px 7px; border-radius: 7px; color: var(--green); background: #e8f3f0; font-size: 10px; font-weight: 800; text-align: center; }
.review-item strong, .review-item small { display: block; }
.review-item strong { font-size: 13px; }
.review-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.review-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.review-empty span { display: grid; width: 38px; height: 38px; margin: 0 auto 9px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); }
.review-empty strong { display: block; color: var(--ink); }
.review-empty p { margin: 5px 0 0; font-size: 11px; }

[hidden] { display: none !important; }
.expiry-banner { min-height: 32px; padding: 7px 18px; color: #74431f; background: #fff0d8; border-bottom: 1px solid #eed7b4; font-size: 11px; text-align: center; letter-spacing: .03em; }
.user-chip { min-height: 40px; padding: 4px 10px 4px 5px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; color: #fff; background: rgba(255,255,255,.06); }
.user-chip span { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--green-dark); background: #ffd2a8; font-size: 12px; font-weight: 900; }
.user-chip b { max-width: 90px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.auth-screen { min-height: 100vh; padding: 38px; display: grid; grid-template-columns: minmax(280px, 480px) minmax(340px, 480px); place-content: center; gap: clamp(40px, 8vw, 120px); background: radial-gradient(circle at 20% 15%, #e3efea 0, transparent 35%), linear-gradient(135deg, #f6f4ee, #eee8dd); }
.auth-brand { align-self: center; }
.brand-mark.large { width: 62px; height: 62px; margin-bottom: 25px; border-color: #b7cbc5; color: var(--orange); background: var(--green-dark); font-size: 30px; }
.auth-brand h1 { margin: 8px 0 13px; font-family: SimSun, "Songti SC", serif; font-size: clamp(34px, 5vw, 56px); letter-spacing: .04em; }
.auth-brand > p:last-child { max-width: 390px; color: var(--muted); line-height: 1.9; }
.auth-card { min-height: 450px; padding: 28px; border: 1px solid rgba(255,255,255,.8); border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: 0 30px 90px rgba(16,44,42,.13); backdrop-filter: blur(14px); }
.expiry-callout { padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-radius: 10px; color: #74431f; background: #fff1db; font-size: 10px; }
.expiry-callout strong { font-size: 11px; }
.auth-tabs { margin: 22px 0; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 11px; background: #edf1ee; }
.auth-tabs button { height: 38px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.auth-tabs button.active { color: var(--green); background: #fff; box-shadow: 0 4px 12px rgba(16,44,42,.08); }
.auth-form h2 { margin: 5px 0 20px; font-family: SimSun, "Songti SC", serif; font-size: 27px; }
.auth-form .form-note { margin: -13px 0 18px; color: var(--muted); font-size: 10px; }
.auth-submit { width: 100%; min-height: 45px; margin-top: 3px; }
.auth-message { min-height: 18px; margin: 13px 0 0; color: #a34d3e; font-size: 11px; text-align: center; }
.expired-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.expired-screen h1 { margin: 22px 0 8px; font-family: SimSun, serif; font-size: 30px; }
.expired-screen p { color: var(--muted); }

.admin-modal { width: min(980px, calc(100vw - 30px)); }
.admin-modal .dialog-content { max-height: min(86vh, 850px); overflow-y: auto; }
.invite-panel { padding: 15px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border: 1px solid var(--line); border-radius: 13px; background: #f8faf8; }
.invite-panel strong { font-size: 13px; }
.invite-panel p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.invite-create { display: flex; gap: 7px; }
.invite-create input { width: 62px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; }
.generated-codes { margin-top: 12px; padding: 14px; display: grid; gap: 7px; border-radius: 12px; color: #fff; background: var(--green-dark); }
.generated-codes > strong { margin-bottom: 3px; font-size: 11px; }
.generated-codes button { min-height: 38px; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; color: #fff; background: rgba(255,255,255,.06); }
.generated-codes code { color: #ffd2a8; font-size: 13px; }
.generated-codes span { font-size: 10px; }
.admin-user-list { margin-top: 14px; display: grid; gap: 10px; }
.admin-loading { padding: 40px; text-align: center; color: var(--muted); }
.admin-loading.error { color: #a34d3e; }
.admin-user-card { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.admin-user-head { display: flex; align-items: center; gap: 10px; }
.admin-avatar { width: 39px; height: 39px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--green); background: #e6f1ee; font-weight: 900; }
.admin-user-head strong, .admin-user-head span { display: block; }
.admin-user-head strong { font-size: 13px; }
.admin-user-head span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.status-pill { margin-left: auto; padding: 4px 8px; border-radius: 9px; color: var(--green); background: #e5f1ee; font-size: 9px; font-style: normal; font-weight: 800; }
.status-pill.disabled { color: #8f5b52; background: #f4e8e5; }
.admin-progress-line { height: 5px; margin: 14px 0 11px; overflow: hidden; border-radius: 5px; background: #e7ece9; }
.admin-progress-line i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.admin-metrics { display: grid; grid-template-columns: 100px 100px 140px 1fr; gap: 14px; }
.admin-metrics span, .admin-metrics b { display: block; }
.admin-metrics span { color: var(--muted); font-size: 9px; }
.admin-metrics b { margin-bottom: 3px; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-actions { margin-top: 13px; display: flex; justify-content: flex-end; gap: 7px; }
.admin-actions button { min-height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--green); background: #f8faf8; font-size: 10px; font-weight: 800; }
.admin-actions button.danger { color: #9f4d40; }
.admin-progress-modal { width: min(760px, calc(100vw - 30px)); }
.admin-progress-modal .dialog-content { max-height: 86vh; overflow-y: auto; }
.readonly-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.readonly-summary span { padding: 14px; border-radius: 11px; color: var(--muted); background: #f3f6f4; font-size: 10px; }
.readonly-summary b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 18px; }
.readonly-subjects { margin-top: 13px; display: grid; gap: 8px; }
.readonly-subjects details { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.readonly-subjects summary { padding: 12px 14px; display: flex; justify-content: space-between; cursor: pointer; background: #fafbf9; font-size: 12px; }
.readonly-task-list { max-height: 300px; overflow-y: auto; }
.readonly-task-list > div { padding: 10px 14px; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); font-size: 11px; }
.readonly-task-list i { color: var(--muted); font-size: 9px; font-style: normal; white-space: nowrap; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .setting-row { grid-template-columns: 90px 1fr 80px 100px 112px; }
}
@media (max-width: 850px) {
  .auth-screen { grid-template-columns: minmax(0, 520px); gap: 24px; }
  .auth-brand { text-align: center; }
  .auth-brand .brand-mark { margin: 0 auto 18px; }
  .auth-brand > p:last-child { margin-right: auto; margin-left: auto; }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 82px; padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .brand h1 { font-size: 17px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand .eyebrow, .save-state, #backupButton { display: none; }
  .topbar { display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto auto; }
  .brand { grid-column: 1 / 3; grid-row: 1; }
  .header-actions { display: contents; }
  .header-actions .button, .user-chip { min-height: 42px; padding-right: 10px; padding-left: 10px; }
  #settingsButton { grid-column: 3; grid-row: 1; }
  #adminButton { grid-column: 1; grid-row: 2; justify-self: start; }
  .user-chip { grid-column: 2; grid-row: 2; margin: 0; }
  #logoutButton { grid-column: 3; grid-row: 2; }
  .expiry-banner { font-size: 10px; }
  main { padding: 0 14px 35px; }
  .hero { min-height: 300px; margin: 0 -14px; padding: 34px 18px 105px; align-items: flex-start; position: relative; }
  .hero-progress { padding: 0; position: absolute; right: 18px; bottom: 25px; top: auto; }
  .ring { width: 65px; height: 65px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; margin-top: -24px; }
  .stat-card { min-height: 105px; padding: 15px 12px; gap: 10px; }
  .stat-icon { display: none; }
  .stat-card strong { font-size: 20px; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-card { min-height: 128px; padding: 15px; }
  .section-heading { align-items: start; }
  .soft-note { max-width: 140px; text-align: right; }
  .workspace-head { align-items: start; gap: 15px; }
  .workspace-tools { width: 52%; flex-direction: column; }
  .search { min-width: 0; width: 100%; }
  .workspace-tools select { width: 100%; }
  .table-shell { padding: 10px; overflow: visible; background: #f4f6f3; }
  table { min-width: 0; display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { padding: 13px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 5px 16px rgba(31,58,55,.04); }
  tbody tr:hover { background: #fff; }
  td { height: auto; padding: 0; border: 0; text-align: left; }
  th:first-child, td:first-child { padding: 0 0 11px; grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  td:nth-child(2), td:nth-child(3) { grid-column: span 2; }
  td:nth-child(n+4):nth-child(-n+7) { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
  td:nth-child(8) { grid-column: 1 / -1; }
  td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; }
  td:first-child::before { display: none; }
  .task-main { min-width: 0; }
  .task-name { font-size: 14px; }
  .task-note { max-width: 230px; }
  .check { width: 25px; height: 25px; }
  .action-cell { width: 100%; }
  .record-button { width: 100%; min-height: 40px; font-size: 11px; }
  .table-footer { padding: 10px 13px; align-items: flex-start; gap: 8px; flex-direction: column; }
  .pagination { width: 100%; overflow-x: auto; }
  .page-button { width: 36px; height: 36px; flex: 0 0 auto; }
  .setting-row { grid-template-columns: 1fr 1fr; }
  .setting-row .field:nth-child(2), .setting-row .setting-actions { grid-column: span 2; }
  .add-grid { grid-template-columns: 1fr 1fr; }
  .add-grid .wide, .add-grid .button { grid-column: span 2; }
  .modal { max-height: 92vh; }
  .modal form, .dialog-content { padding: 19px; }
  .admin-modal .dialog-content, .admin-progress-modal .dialog-content { max-height: 88vh; }
  .invite-panel { align-items: stretch; flex-direction: column; }
  .invite-create input { min-height: 42px; }
  .invite-create .button { flex: 1; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .admin-actions { justify-content: stretch; flex-wrap: wrap; }
  .admin-actions button { min-height: 38px; flex: 1 1 42%; }
  .readonly-task-list > div { align-items: flex-start; flex-direction: column; }
  .readonly-task-list i { white-space: normal; }
  .auth-screen { padding: 20px 14px; place-content: start center; }
  .auth-brand { padding-top: 12px; }
  .auth-brand .brand-mark { width: 52px; height: 52px; margin-bottom: 12px; }
  .auth-brand h1 { margin: 5px 0; font-size: 30px; }
  .auth-brand > p:last-child { display: none; }
  .auth-card { min-height: 0; padding: 19px; border-radius: 17px; }
  .expiry-callout { align-items: flex-start; flex-direction: column; gap: 3px; }
  .auth-form .field input { min-height: 44px; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
}
