/* LessonBox: shared visual tokens and responsive workspace. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px; line-height: 1.6; font-synthesis: none; color: var(--text); background: var(--background); color-scheme: light;
  --green: #246b50; --green-hover: #19543e; --green-soft: #eaf3ed;
  --text: #203d35; --muted: #52675f; --background: #edf4f4; --surface: #ffffffb8;
  --line: #e1e7df; --input-border: #849386; --danger: #ae3939; --danger-soft: #fcf0ef;
  --radius: 16px; --shadow-sm: 0 2px 6px #223c2c04; --shadow-card: 0 8px 24px #223c2c0b;
  --shadow-modal: 0 24px 80px #152f352b; --ease: cubic-bezier(.2,.7,.2,1);
  --glass: #ffffffa8; --glass-strong: #ffffffd9; --glass-line: #ffffffd9;
  --glass-shadow: 0 12px 40px #3c68740d, inset 0 1px 0 #ffffffe6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button,input,select,textarea { font: inherit; }
button,a,input,select,textarea { -webkit-tap-highlight-color: transparent; }
button,a { touch-action: manipulation; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); line-height: 1.5; font-weight: 500; cursor: pointer; transition: background-color 150ms, border-color 150ms, box-shadow 180ms, color 150ms; }
button:hover { border-color: #a6bead; background: #f1f6f0; }
button:active { background: #e6eee5; }
button:disabled { cursor: wait; opacity: .6; }
button.primary { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 2px 3px #1b493b12; }
button.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
button.primary:active { background: #123f2f; }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: #dca3a0; }
button.destructive { background: var(--danger); border-color: var(--danger); }
button.destructive:hover { background: #8b2929; border-color: #8b2929; }
button[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-hover); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
input,select,textarea { min-height: 44px; min-width: 0; max-width: 100%; padding: 10px 12px; color: var(--text); border: 1px solid var(--input-border); border-radius: 9px; background: var(--surface); line-height: 1.5; transition: border-color 150ms,box-shadow 150ms; }
input::placeholder,textarea::placeholder { color: #63746a; opacity: 1; }
input:focus,select:focus,textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
textarea { resize: vertical; min-height: 100px; }
input[type="checkbox"] { min-height: 20px; width: 20px; height: 20px; accent-color: var(--green); }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: 30px; line-height: 1.4; letter-spacing: -.6px; font-weight: 650; }
h2 { font-size: 20px; line-height: 1.5; }
h3 { font-size: 16px; line-height: 1.5; }
small,.muted { color: var(--muted); }
small { font-size: 12px; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon-btn { width: 44px; height: 44px; padding: 10px; flex-shrink: 0; background: transparent; border-color: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--green); }
.skip-link { position: fixed; top: 12px; left: 12px; padding: 12px 20px; background: var(--green); color: #fff; border-radius: 8px; transform: translateY(-150%); z-index: 30; }
.skip-link:focus { transform: translateY(0); color: #fff; }

/* Navigation and workspace */
.layout { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 32px 18px 20px; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 10px 46px; }
.brand-icon { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; background: transparent; color: #fff; box-shadow: 0 4px 10px #246b501a; }
.brand-icon img { display: block; width: 100%; height: 100%; border-radius: inherit; }
.brand strong { display: block; font-size: 20px; letter-spacing: .5px; line-height: 1.5; }
.brand small { display: block; font-size: 10px; letter-spacing: 2.5px; color: #667a69; }
.nav-label { padding: 0 16px; margin-bottom: 12px; font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.nav { display: grid; gap: 8px; }
.nav button { position: relative; justify-content: flex-start; gap: 13px; min-height: 49px; padding: 12px 16px; border-color: transparent; background: transparent; color: #5d6f63; white-space: nowrap; }
.nav button:hover { background: #f5f7f3; color: var(--green); }
.nav button.active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav button.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav .nav-count { margin-left: auto; padding: 0 6px; min-width: 23px; text-align: center; font-size: 11px; background: #fff9; border-radius: 5px; font-variant-numeric: tabular-nums; }
.sidebar-bottom { margin-top: auto; padding-top: 40px; }
.sidebar-note { padding: 20px 18px; margin: 0 6px 24px; background: #f3f6ee; border: 1px solid #e9eedf; border-radius: 12px; }
.sidebar-note > .icon { margin-bottom: 10px; color: var(--green); }
.sidebar-note strong { display: block; font-size: 13px; font-weight: 600; color: #435b3c; }
.sidebar-note p { font-size: 12px; line-height: 1.9; color: #65725a; margin: 6px 0 0; }
.account { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 20px 3px 0; }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: #eaf1e6; color: #476c47; font-weight: 600; }
.account .info { flex: 1; min-width: 0; font-size: 13px; }
.account .info strong { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-weight: 600; }
.account .info small { font-size: 11px; }
.workspace { min-width: 0; }
.mobile-logout { display: none; }
.content { max-width: 1540px; margin: auto; padding: 30px 40px 28px; }
.content:focus:not(:focus-visible) { outline: none; }
.content:focus-visible { outline-offset: -5px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.heading h1 { margin: 0 0 8px; }
.heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.heading > button,.heading .toolbar { flex-shrink: 0; }
.heading .primary { padding: 11px 20px; }
.toolbar { display: flex; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.stat small { font-size: 12px; }
.stat-value { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; }
.stat-value strong { font-size: 30px; font-weight: 600; letter-spacing: -.8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value > span { font-size: 11px; color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px; background: #edf5ed; color: #4a7956; }
.stat-icon.blue { background: #edf2f9; color: #5779a5; }
.stat-icon.amber { background: #fcf4e6; color: #a88032; }
.stat-icon.violet { background: #f1eef7; color: #82709f; }

/* Search, filters and resources */
.filters { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.filter-top { display: flex; align-items: center; gap: 10px; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #718376; pointer-events: none; width: 18px; height: 18px; }
.search { width: 100%; padding-left: 41px; font-size: 13px; background: #fafbf9; }
.filter-top select { width: 122px; flex-shrink: 0; font-size: 13px; padding-left: 11px; }
.filter-top [data-filter="unit"] { width: 155px; }
.reset-btn { color: var(--muted); padding: 10px 12px; font-size: 13px; flex-shrink: 0; }
.reset-btn .icon { width: 16px; height: 16px; }
.filter-bottom { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf0e9; }
.filter-label { font-size: 12px; color: var(--muted); margin-right: 8px; }
.chip { padding: 7px 15px; min-height: 38px; border-color: transparent; border-radius: 8px; background: transparent; color: #5d7061; font-size: 13px; white-space: nowrap; }
.chip:hover { background: #f3f6ee; border-color: transparent; }
.chip.selected { color: var(--green); background: var(--green-soft); font-weight: 600; }
.results-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.results-line > div,.section-label { display: flex; align-items: center; gap: 12px; }
.results-line h2,.section-label h2 { margin: 0; font-size: 16px; font-weight: 600; }
#count,.section-label > span { font-size: 12px; color: var(--muted); }
.sort-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.sort-control select { font-size: 12px; min-height: 40px; padding: 8px; border-color: transparent; background: transparent; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.course-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow 220ms var(--ease), border-color 220ms; }
.course-card:focus-within { border-color: #9db9a6; }
@media (hover: hover) { .course-card:hover { border-color: #bdcfbe; box-shadow: var(--shadow-card); } }
.favorite { position: static; flex-shrink: 0; width: 40px; height: 40px; min-height: 40px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: #657966; }
.favorite:hover { background: #fff; border-color: #a1b6a1; color: var(--green); }
.favorite.on { color: #936811; background: #fffbec; border-color: #e6ce8f; }
.favorite.on .icon { fill: #f4d78e; }
.favorite[aria-busy="true"] .icon { display: none; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 18px 12px; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; padding-top: 7px; }
.subject-tag { padding: 2px 7px; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 11px; }
.course-status { color: #4b6a4e; font-size: 11px; }
.course-status.draft { color: #7a5a29; }
.card-body h3 a { color: var(--text); border-radius: 4px; }
.card-body h3 a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }
.card-admin.personal-actions { grid-template-columns: 1fr 2fr 1fr; }
.grade-tag { padding: 2px 7px; border-radius: 5px; background: #eef4eb; color: #4e6a45; font-size: 11px; }
.card-body h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.card-unit { font-size: 12px; color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.card-description { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid #edf0e9; }
.card-footer small { font-size: 11px; }
.card-footer small span { margin: 0 3px; }
.card-footer a { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; min-height: 40px; font-weight: 600; font-size: 12px; white-space: nowrap; border-radius: 5px; }
.card-footer a .icon { width: 16px; height: 16px; }
.card-admin { display: grid; grid-template-columns: 1fr 1fr 1.6fr 1fr; gap: 4px; border-top: 1px solid #edf0e9; padding-top: 9px; margin-top: 7px; }
.card-admin button { min-height: 36px; padding: 7px 4px; border-color: transparent; font-size: 12px; color: var(--muted); background: transparent; white-space: nowrap; }
.card-admin button:hover { color: var(--green); background: var(--green-soft); }
.card-admin button.danger { color: var(--danger); }
.card-admin button.danger:hover { background: var(--danger-soft); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; grid-column: 1/-1; min-height: 350px; padding: 48px 24px; background: #fff; border: 1px dashed #c7d6c5; border-radius: var(--radius); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 20px; background: #f0f5e9; border: 8px solid #f8faf3; border-radius: 24px; color: #678452; transform: rotate(-5deg); }
.empty-icon .icon { width: 29px; height: 29px; transform: rotate(5deg); }
.empty h3 { font-size: 18px; color: #3d5941; margin-bottom: 10px; }
.empty p { max-width: 380px; color: var(--muted); line-height: 1.9; font-size: 13px; margin-bottom: 22px; }

/* Members and account settings */
.section-label { margin: 24px 0 16px; }
.table-wrap { max-width: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th,td { padding: 20px; text-align: left; border-bottom: 1px solid #edf0e9; font-size: 13px; }
th { padding-top: 15px; padding-bottom: 15px; color: var(--muted); background: #f9faf7; font-size: 12px; font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcf9; }
.member-identity { display: flex; align-items: center; gap: 11px; }
.member-identity strong,.member-identity small { display: block; }
.member-identity strong { font-weight: 600; }
.member-identity small { font-size: 12px; }
.member-access { white-space: normal; min-width: 160px; max-width: 300px; line-height: 1.8; }
.table-actions { display: flex; gap: 6px; }
.table-actions button { padding: 8px 10px; min-height: 36px; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 3px; border-radius: 6px; padding: 3px 8px; background: #edf5e8; color: #4f743e; font-size: 12px; }
.status .icon { width: 13px; height: 13px; }
.status.off { background: #fbefec; color: #a34238; }
.current-account { color: var(--muted); font-size: 12px; }
.table-hint { display: none; margin-top: 12px; color: var(--muted); font-size: 12px; }
.settings-card { max-width: 850px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.profile-summary { display: flex; align-items: center; gap: 16px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.profile-summary .avatar { width: 60px; height: 60px; font-size: 22px; }
.profile-summary h2 { margin: 0 0 5px; font-size: 20px; }
.profile-summary p { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.profile-summary p span { margin: 0 6px; }
.security-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 28px; }
.security-info { display: flex; align-items: center; gap: 14px; }
.security-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: #f1f5ec; color: var(--green); }
.security-info h3 { font-size: 15px; margin: 0 0 5px; }
.security-info p { font-size: 12px; color: var(--muted); margin: 0; }
.security-row > button { flex-shrink: 0; }

/* Categorized system settings and course history */
.system-settings { display: grid; grid-template-columns: 190px minmax(0,1fr); align-items: start; gap: 24px; max-width: 1180px; }
.settings-role { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 12px; white-space: nowrap; }
.settings-role .icon { width: 16px; height: 16px; }
.settings-categories { display: grid; gap: 8px; }
.settings-categories button { justify-content: flex-start; padding: 13px 14px; background: transparent; border-color: transparent; color: var(--muted); }
.settings-categories button.selected { background: #e7f0e5; color: var(--green); font-weight: 600; }
.settings-categories button .icon:last-child { width: 14px; height: 14px; margin-left: auto; }
.settings-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-panel-head { display: flex; align-items: center; gap: 14px; padding: 24px; border-bottom: 1px solid var(--line); }
.settings-panel-head h2 { font-size: 19px; margin: 0 0 5px; }
.settings-panel-head p { color: var(--muted); font-size: 12px; margin: 0; }
#system-settings-form { padding: 24px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.setting-row h3,.setting-section h3 { font-size: 15px; margin: 0 0 7px; }
.setting-row p,.setting-section > p { font-size: 12px; line-height: 1.9; color: var(--muted); margin: 0; }
.setting-switch { position: relative; display: flex; align-items: center; flex-shrink: 0; width: 48px; height: 44px; cursor: pointer; }
.setting-switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.setting-switch > span { position: relative; display: block; width: 44px; height: 25px; background: #7b8c7e; border-radius: 20px; transition: background-color 150ms; }
.setting-switch > span::before { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; background: white; border-radius: 50%; transition: transform 150ms; }
.setting-switch:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.setting-switch input:disabled { cursor: not-allowed; }
.setting-switch input:checked + span { background: var(--green); }
.setting-switch input:checked + span::before { transform: translateX(19px); }
.setting-switch input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 3px; }
.setting-section { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
.setting-section .form-grid { margin-top: 18px; }
.setting-section > p + p { margin-top: 12px; }
.setting-shortcut { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf8; }
.setting-shortcut > span { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.settings-save { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.settings-save > span,.setting-help { color: var(--muted); font-size: 12px; }
.settings-save button { flex-shrink: 0; }
.subject-settings { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.subject-setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.subject-setting:has(input:checked) { border-color: #a7bf9e; background: #f5f9f0; }
.subject-setting > span:first-child { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; }
.subject-setting .icon { width: 17px; height: 17px; color: var(--green); }
.subject-choice { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.subject-choice input { margin: 0; }
.setting-help { margin: 16px 0 0; }
.setting-notes { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 2; }
.setting-notes li + li { margin-top: 8px; }
.version-dialog { padding: 24px 28px; }
.version-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.version-toolbar p { font-size: 12px; color: var(--muted); margin: 0; }
.version-toolbar button { flex-shrink: 0; }
.version-list { display: grid; gap: 14px; }
.version-item { padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.version-item.current { border-color: #99b891; background: #f8fbf4; }
.version-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.version-title > strong { font-size: 18px; }
.version-security { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); font-size: 11px; }
.version-security .icon { width: 14px; height: 14px; }
.version-security.protected { color: var(--green); }
.version-note { font-size: 13px; margin-bottom: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.version-meta,.version-entry { font-size: 11px; color: var(--muted); margin: 4px 0; overflow-wrap: anywhere; }
.version-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.version-actions button { font-size: 12px; padding: 8px 12px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 8px 12px; background: white; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; }
.button-link:hover { background: var(--green-soft); border-color: #9ab498; }
.button-link .icon { width: 15px; height: 15px; }
.version-protect { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; background: #edf4e8; }
.version-protect > span { font-size: 12px; color: #4f6746; }
.version-protect .icon { width: 17px; height: 17px; margin-right: 5px; }
.version-protect button { font-size: 12px; padding: 8px 10px; flex-shrink: 0; }

/* Authentication */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 40px 20px; background: radial-gradient(ellipse at 15% 12%,#e6eddf 0,transparent 52%),radial-gradient(ellipse at 90% 95%,#e8eee0 0,transparent 50%),#f7f8f3; }
.auth-panel { width: 100%; max-width: 444px; padding: 36px 38px 28px; background: var(--surface); border: 1px solid #dde5d7; border-radius: 22px; box-shadow: 0 20px 60px #304a2110; }
.auth-panel .brand { margin: 0 0 36px; }
.auth-panel .brand-icon { width: 42px; height: 42px; }
.auth-panel .brand strong { font-size: 19px; }
.auth-intro { margin-bottom: 28px; }
.auth-kicker { display: block; margin-bottom: 8px; font-size: 11px; color: #627c57; letter-spacing: .6px; }
.auth-intro h1 { font-size: 26px; margin: 0 0 10px; letter-spacing: -.5px; }
.auth-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.auth-panel .form-field { font-size: 13px; margin-bottom: 20px; }
.auth-panel input { width: 100%; min-height: 48px; background: #fcfdfb; }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 13px; top: 15px; width: 18px; height: 18px; color: #6b7f6c; pointer-events: none; }
.input-wrap input { padding-left: 40px; }
.input-wrap input[name="password"] { padding-right: 52px; }
.password-toggle { position: absolute; top: 2px; right: 2px; border: 0; background: transparent; }
.password-toggle .icon { width: 18px; height: 18px; }
.auth-submit { width: 100%; min-height: 48px; justify-content: space-between; margin-top: 6px; font-size: 14px; padding: 12px 18px; }

/* Forms and dialogs */
.form-field { display: flex; flex-direction: column; min-width: 0; gap: 8px; margin-bottom: 20px; font-size: 13px; color: #405442; }
.form-field small { font-size: 12px; line-height: 1.7; }
.form-field > input,.form-field > select,.form-field > textarea { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.full { grid-column: 1/-1; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; min-height: 44px; margin-bottom: 16px; }
.error { font-size: 13px; line-height: 1.8; color: #a52f2f; white-space: pre-wrap; overflow-wrap: anywhere; }
.error:empty { display: none; }
.error:not(:empty) { padding: 12px 14px; border: 1px solid #e9bdb6; border-radius: 8px; background: var(--danger-soft); margin-bottom: 18px; }
dialog { width: min(680px,calc(100% - 40px)); max-height: calc(100dvh - 64px); padding: 0; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-modal); color: var(--text); background: var(--surface); overscroll-behavior: contain; scroll-padding-top: 112px; }
dialog::backdrop { background: #172d256b; backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 2; padding: 24px 28px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-kicker { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.dialog-head h2 { font-size: 21px; font-weight: 600; margin: 0; }
.dialog-body { padding: 24px 28px; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.dialog-actions button { min-width: 88px; }
.upload-zone { border: 1px dashed #a4b99b; background: #f8faf4; border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.upload-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dae5d1; background: #eef4e5; color: var(--green); border-radius: 12px; }
.upload-heading strong { font-size: 15px; font-weight: 600; }
.upload-zone p { font-size: 12px; line-height: 1.9; color: var(--muted); margin: 2px 0 0; }
.upload-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.upload-zone label { display: block; text-align: left; font-size: 12px; color: #476343; padding: 12px; border: 1px solid #dbe5d6; border-radius: 9px; background: #fff; }
.upload-zone label > .icon { width: 16px; height: 16px; margin-right: 6px; }
.upload-zone input { width: 100%; display: block; margin-top: 7px; padding: 5px 0; min-height: 40px; border: 0; border-radius: 0; background: transparent; font-size: 12px; }
input::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 1px solid #b1c2ad; border-radius: 6px; color: var(--green); background: #f1f6ec; cursor: pointer; font: inherit; }
.upload-zone > small { display: block; margin-top: 14px; font-size: 11px; }
.hint { padding: 15px 18px; background: #edf4e8; border: 1px solid #dce7d1; border-radius: 10px; color: #4f6746; font-size: 13px; line-height: 1.9; margin-bottom: 20px; }
.hint:has(> .icon) { display: flex; align-items: flex-start; gap: 10px; }
.hint > .icon { margin-top: 3px; width: 18px; height: 18px; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--green); padding: 32px; }
#toast { position: fixed; bottom: max(28px,env(safe-area-inset-bottom)); left: 50%; max-width: calc(100% - 40px); padding: 13px 22px; border-radius: 10px; background: #294d3a; color: white; box-shadow: 0 6px 24px #172c2b1a; text-align: center; font-size: 13px; opacity: 0; transform: translate(-50%,12px); pointer-events: none; transition: opacity 180ms,transform 220ms var(--ease); z-index: 20; }
#toast.show { opacity: 1; transform: translate(-50%,0); }

/* Course player: keep the lesson edge-to-edge. */
.player { width: 100%; height: 100dvh; overflow: hidden; background: #fff; }
.player #stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.player-tools { position: fixed; top: max(10px,env(safe-area-inset-top)); right: max(10px,env(safe-area-inset-right)); z-index: 5; display: grid; grid-template-columns: auto 32px; align-items: center; gap: 0; opacity: .8; transition: opacity 150ms; }
.player-tools:hover,.player-tools:focus-within,.player-tools.dragging { opacity: 1; }
.player .tools-toggle { display: flex; align-items: center; gap: 8px; height: 44px; padding: 5px 10px 5px 6px; border: 1px solid #aac3b1; border-right: 0; border-radius: 10px 0 0 10px; background: #f8fbf7; color: #235c49; font-size: 13px; font-weight: 500; line-height: 1; box-shadow: none; }
.player-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: #527f62; color: #fff; cursor: grab; touch-action: none; }
.player-mark img { display: block; width: 28px; height: 28px; border-radius: 7px; }
.dragging .player-mark { cursor: grabbing; }
.tools-chevron { width: 6px; height: 6px; margin: 0 3px 3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 150ms; }
.tools-toggle[aria-expanded="true"] .tools-chevron { transform: rotate(225deg); margin-top: 5px; }
.player .tools-toggle:hover,.player .tools-toggle[aria-expanded="true"] { background: #edf5eb; border-color: #559b7e; }
.player .tools-dismiss { width: 32px; height: 44px; min-height: 44px; padding: 0; border: 1px solid #aac3b1; border-left: 0; border-radius: 0 10px 10px 0; background: #f8fbf7; color: #4e6f59; font-size: 19px; box-shadow: none; }
.player .tools-dismiss:hover { background: #e6eee3; }
.tools-panel { grid-column: 1/-1; justify-self: end; display: flex; align-items: center; gap: 5px; margin-top: 6px; padding: 5px; border: 1px solid #c6d7c6; border-radius: 10px; background: #fff; box-shadow: var(--shadow-card); }
.tools-panel a,.tools-panel button { display: flex; align-items: center; min-height: 44px; font-size: 12px; white-space: nowrap; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; }
.tools-panel a:hover,.tools-panel button:hover { background: #eef4e9; }
#player-message { padding: 30px; text-align: center; color: var(--muted); }

/* Frosted surfaces: static light, readable content, no animated blur. */
body { min-height: 100vh; background-color: var(--background); background-image: radial-gradient(ellipse at 4% 0%,#bce5d8 0,transparent 42%),radial-gradient(ellipse at 88% 8%,#cbdff8 0,transparent 42%),radial-gradient(ellipse at 95% 90%,#e5dff4 0,transparent 40%); background-attachment: fixed; }
.layout { padding: 18px; grid-template-columns: 224px minmax(0,1fr); gap: 18px; }
.sidebar { top: 18px; height: calc(100dvh - 36px); border: 1px solid var(--glass-line); border-radius: 24px; background: #ffffff73; box-shadow: var(--glass-shadow); backdrop-filter: blur(18px) saturate(125%); -webkit-backdrop-filter: blur(18px) saturate(125%); padding-left: 14px; padding-right: 14px; }
.brand { margin-left: 8px; gap: 10px; }
.brand strong { font-size: 19px; }
.brand-icon { background: transparent; box-shadow: 0 6px 16px #27776029,inset 0 1px 0 #ffffff52; }
.nav button.active { background: #ffffffa6; border-color: #ffffffcf; box-shadow: 0 4px 16px #4b827b0b; }
.sidebar-note { background: #ffffff47; border-color: #ffffffa6; }
.account { border-color: #ffffffb3; }
.content { padding: 16px 18px 28px; }
.heading h1 { font-size: 31px; letter-spacing: -.8px; }
.filters,.course-card,.settings-panel,.settings-card,.table-wrap,.empty,.auth-panel { border-color: var(--glass-line); background: var(--glass); box-shadow: var(--glass-shadow); backdrop-filter: blur(12px) saturate(120%); -webkit-backdrop-filter: blur(12px) saturate(120%); }
.filters,.course-card,.settings-panel,.settings-card,.table-wrap { border-radius: 20px; }
.course-card { transition: box-shadow 220ms var(--ease),border-color 180ms,background-color 180ms; }
@media (hover: hover) { .course-card:hover { border-color: #a1c9be; background: #ffffffc4; box-shadow: 0 14px 36px #3b75681a,inset 0 1px 0 #fff; } }
.course-card:focus-within { border-color: #83b4a5; }
.card-body { padding: 22px 19px 14px; }
.card-admin { grid-template-columns: 1fr 1fr 1.6fr 1fr 1fr; }
.card-admin button { border-radius: 8px; background: #ffffff40; }
.card-admin button:hover { background: #e5f3eecf; }
.card-footer,.card-admin,.filter-bottom { border-color: #b3cec447; }
.subject-tag { background: #dcefe6c4; }
.grade-tag { background: #ffffffa6; color: #526b5b; }
.favorite { background: #ffffff80; border-color: #bbcec4a6; }
.favorite.on { background: #fff6ddc4; }
input,select,textarea { background-color: #ffffffc4; }
.search { background-color: #ffffff8c; }
.chip.selected { background: #ffffffc4; box-shadow: 0 3px 10px #39736408; }
.settings-categories button.selected { background: #ffffffa6; box-shadow: var(--glass-shadow); }
.settings-panel-head { border-color: #b3cec44d; }
.hint { background: #e2f0e6a6; border-color: #b8d7c699; }
.settings-save,.setting-section,.profile-summary,.dialog-actions { border-color: #b3cec466; }
.subject-setting { background: #ffffff47; border-color: #c1d6cc99; }
.subject-setting:has(input:checked) { background: #edf8e98c; border-color: #aac3a6b3; }
.setting-shortcut { background: #ffffff66; }
.auth { background: transparent; }
.auth-panel { background: #ffffffb8; border-radius: 26px; box-shadow: 0 24px 80px #3a72691a,inset 0 1px 0 #fff; }
dialog { background: #f9fdfbf0; border-color: #fffffff2; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 24px; box-shadow: 0 30px 100px #234b4933,inset 0 1px 0 #fff; }
dialog::backdrop { background: #284c5052; backdrop-filter: blur(7px); }
.dialog-head { background: #f9fdfbf2; }
.version-item { background: #ffffff66; }
.version-item.current { background: #eaf5e7b3; }
.stats.overview-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 0 0 22px; background: transparent; border: 0; }
.overview-stats .stat { background: #ffffff94; border: 1px solid #ffffffd9; border-radius: 17px; padding: 20px; box-shadow: inset 0 1px 0 #fff; }
.overview-details { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.overview-details > div { display: flex; flex-direction: column; gap: 7px; padding: 17px; border: 1px solid #ffffffb3; border-radius: 14px; background: #ffffff52; }
.overview-details .icon { color: var(--green); }
.overview-details span { color: var(--muted); font-size: 12px; }
.overview-details strong { font-size: 18px; font-weight: 600; }
.overview-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.trash-card .card-meta { margin-bottom: 18px; }
.trash-card h2 { font-size: 18px; overflow-wrap: anywhere; margin-bottom: 10px; }
.trash-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; }
.share-dialog { padding: 24px 28px; }
.share-access { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 0; margin: 0 0 18px; border: 0; }
.share-access legend { margin-bottom: 10px; padding: 0; font-size: 13px; }
.share-access label { display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 12px 14px; border: 1px solid #b9ccc2; background: #ffffff73; border-radius: 12px; cursor: pointer; }
.share-access label:has(input:checked) { background: #e3f2e9b3; border-color: #699e86; }
.share-access input { width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--green); }
.share-access .icon { width: 17px; height: 17px; }
.share-list { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.share-list > h3 { font-size: 15px; margin-bottom: 16px; }
.share-list > h3 span { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.share-item { padding: 16px; background: #ffffff8c; border: 1px solid #d6e3d9; border-radius: 14px; margin-bottom: 12px; }
.share-item-top,.share-item-top strong { display: flex; align-items: center; gap: 7px; }
.share-item-top { justify-content: space-between; }
.share-item-top strong { font-size: 13px; }
.share-item-top .icon { width: 16px; height: 16px; color: var(--green); }
.share-expiry { font-size: 11px; color: var(--muted); margin: 8px 0 12px; }
.share-link-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.share-link-row input { width: 100%; font-size: 12px; }
.share-item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-item-actions button { font-size: 12px; padding: 8px 10px; }
.share-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 22px; border: 1px solid #ffffffd9; border-radius: 16px; background: #d7ece5a6; color: var(--green); }
.share-detail { color: var(--muted); font-size: 13px; line-height: 1.9; margin-bottom: 26px; }
.share-auth h1 { font-size: 25px; margin-bottom: 12px; overflow-wrap: anywhere; }
.share-player { background: white; overflow: hidden; }
.share-stage { position: fixed; inset: 0; }
.share-stage iframe { display: block; width: 100%; height: 100%; border: 0; background: white; }
.share-tools { position: fixed; top: max(10px,env(safe-area-inset-top)); right: max(10px,env(safe-area-inset-right)); display: flex; align-items: center; gap: 8px; padding: 5px 7px 5px 12px; max-width: calc(100vw - 20px); background: #fffffff0; border: 1px solid #b5ccbe; border-radius: 12px; box-shadow: var(--shadow-card); backdrop-filter: blur(14px); }
.share-tools > span:first-child { color: var(--green); font-size: 12px; white-space: nowrap; }
.share-tools button { font-size: 12px; padding: 8px 10px; border: 0; background: transparent; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar,.filters,.course-card,.settings-panel,.settings-card,.table-wrap,.empty,.auth-panel { background: #f9fcfa; }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar,.filters,.course-card,.settings-panel,.settings-card,.table-wrap,.empty,.auth-panel,dialog { background: #f9fcfa; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Responsive layouts */
@media (min-width: 1640px) { .grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 1279px) {
  .layout { grid-template-columns: 216px minmax(0,1fr); }
  .sidebar { padding: 28px 14px 18px; }
  .brand { margin-left: 8px; gap: 10px; }
  .brand strong { font-size: 18px; }
  .content { padding: 30px 28px 24px; }
  .stat { padding: 19px 16px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
  .filter-top { flex-wrap: wrap; }
  .search-wrap { flex-basis: 100%; }
  .filter-top select,.filter-top [data-filter="unit"] { width: auto; flex: 1; min-width: 0; }
  .table-hint { display: block; }
}
@media (max-width: 1023px) and (min-width: 768px) {
  .system-settings { grid-template-columns: 1fr; gap: 16px; }
  .settings-categories { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-categories button .icon:last-child { display: none; }
  .layout { grid-template-columns: 196px minmax(0,1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .brand { gap: 8px; margin-left: 8px; }
  .brand-icon { width: 38px; height: 38px; }
  .brand strong { font-size: 17px; }
  .brand small { font-size: 9px; }
  .nav button { gap: 10px; padding-left: 14px; font-size: 13px; }
  .nav .nav-count { display: none; }
  .content { padding: 26px 22px; }
  .stats { gap: 10px; }
  .stat { padding: 18px 12px; }
  .stat-icon { display: none; }
  .stat-value strong { font-size: 27px; }
  .heading h1 { font-size: 27px; }
  .heading p { font-size: 12px; }
  .card-body { padding-left: 14px; padding-right: 14px; }
  .card-footer { flex-wrap: wrap; }
  .card-footer a { margin-left: auto; }
  .heading .toolbar { flex-direction: column; gap: 8px; }
}
@media (max-width: 767px) {
  .layout { padding: 10px; gap: 0; }
  .sidebar { border: 1px solid var(--glass-line); border-radius: 20px; background: #ffffff80; box-shadow: var(--glass-shadow); }
  .nav:has(button:nth-child(6)) { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .stats.overview-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; border: 0; background: transparent; }
  .overview-stats .stat { padding: 15px 12px; text-align: left; }
  .overview-stats .stat-value { justify-content: flex-start; }
  .overview-details { gap: 8px; }
  .overview-details > div { padding: 13px 10px; }
  .share-dialog { padding: 20px; }
  .share-access label { padding: 10px; gap: 6px; font-size: 12px; }
  .share-link-row input { font-size: 16px; }
  .system-settings { grid-template-columns: 1fr; gap: 18px; }
  .settings-role { display: none; }
  .settings-categories { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .settings-categories button { font-size: 12px; padding: 11px; background: white; border-color: var(--line); }
  .settings-categories button .icon:last-child { display: none; }
  .settings-panel-head { padding: 20px; align-items: flex-start; }
  #system-settings-form { padding: 20px; }
  .subject-settings { grid-template-columns: 1fr; }
  .setting-row { gap: 16px; align-items: flex-start; }
  .settings-save { gap: 10px; }
  .settings-save > span { font-size: 11px; }
  .version-dialog { padding: 20px; }
  .version-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .version-protect { align-items: flex-start; flex-direction: column; }
  .version-item { padding: 15px; }
  .version-actions { gap: 8px; }
  .layout { display: block; position: relative; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px 18px 0; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { margin: 0 0 18px; gap: 10px; }
  .brand-icon { width: 38px; height: 38px; border-radius: 11px; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 9px; letter-spacing: 2px; }
  .nav-label,.sidebar-bottom,.nav .nav-count { display: none; }
  .nav { display: flex; gap: 4px; justify-content: space-between; padding-bottom: 12px; }
  .nav button { flex: 1; flex-direction: column; justify-content: center; gap: 5px; padding: 8px 3px; min-height: 62px; font-size: 11px; border-radius: 9px; }
  .nav button .icon { width: 19px; height: 19px; }
  .nav button.active::before { display: none; }
  .nav button[aria-busy="true"]::after { display: none; }
  .mobile-logout { display: flex; position: absolute; top: 15px; right: 18px; height: 44px; width: 44px; }
  .content { padding: 25px 18px 24px; }
  .heading { align-items: flex-start; gap: 16px; margin-bottom: 24px; }
  .heading h1 { font-size: 25px; margin-bottom: 6px; }
  .heading p { display: none; }
  .heading .primary { font-size: 13px; padding: 10px 13px; margin-top: 3px; }
  .heading .primary .icon { width: 17px; height: 17px; }
  .heading .toolbar { flex-direction: column; gap: 8px; }
  .toolbar button { padding: 9px 12px; font-size: 12px; }
  .toolbar .primary { margin-top: 0; }
  .stats { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .stat { display: block; text-align: center; padding: 14px 5px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .stat + .stat { border-left: 1px solid var(--line); }
  .stat small { font-size: 12px; }
  .stat-value { margin-top: 7px; justify-content: center; gap: 5px; }
  .stat-value strong { font-size: 25px; }
  .stat-value > span { font-size: 10px; }
  .stat-icon { display: none; }
  .filters { padding: 14px; margin-bottom: 23px; border-radius: 13px; }
  .filter-top { gap: 10px; }
  .filter-top select { font-size: 16px; }
  .filter-top [data-filter="grade"],.filter-top [data-filter="semester"] { flex: 1 1 calc(50% - 5px); }
  .filter-top [data-filter="unit"] { flex: 1 1 50%; }
  .reset-btn { min-width: 76px; }
  .search { font-size: 16px; padding-right: 10px; }
  .filter-bottom { gap: 6px; padding-top: 12px; margin-top: 14px; }
  .filter-label { display: none; }
  .chip { min-height: 44px; padding: 9px 12px; font-size: 12px; }
  .results-line { margin-bottom: 14px; }
  .results-line > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .results-line h2 { font-size: 15px; }
  #count { font-size: 11px; }
  .sort-control > span { display: none; }
  .sort-control select { min-height: 44px; font-size: 16px; max-width: 155px; }
  .grid { gap: 16px; }
  .card-body { padding: 18px 16px 12px; }
  .card-footer { flex-wrap: wrap; }
  .card-footer a { margin-left: auto; min-height: 44px; }
  .card-admin button { min-height: 44px; }
  .favorite { width: 44px; height: 44px; }
  .empty { min-height: 310px; padding: 36px 20px; }
  .empty h3 { font-size: 17px; }
  .empty p { font-size: 12px; }
  .hint { font-size: 12px; padding: 13px 14px; }
  .table-actions button { min-height: 44px; }
  .settings-card { padding: 22px 20px; }
  .security-row { align-items: flex-start; flex-direction: column; gap: 20px; }
  .security-row > button { align-self: flex-end; }
  .security-info { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field input,.form-field textarea,.form-field select { font-size: 16px; }
  .form-field { font-size: 13px; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 32px); border-radius: 16px; }
  .dialog-head { padding: 20px; }
  .dialog-head h2 { font-size: 20px; }
  .dialog-body { padding: 20px; }
  .dialog-actions { padding-top: 18px; }
  .upload-zone { padding: 20px 14px; }
  #toast { bottom: max(20px,env(safe-area-inset-bottom)); }
}
@media (max-width: 539px) {
  .upload-options { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .card-body { padding: 19px 20px 12px; }
  .auth { padding: 28px 18px; gap: 22px; }
  .auth-panel { padding: 30px 25px 24px; border-radius: 18px; }
  .auth-panel .brand { margin-bottom: 30px; }
  .auth-intro h1 { font-size: 24px; }
  .auth-intro { margin-bottom: 24px; }
  .auth-panel input { font-size: 16px; }
}
@media (max-width: 359px) {
  .content { padding-left: 14px; padding-right: 14px; }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .stat { padding: 13px 4px; }
  .stat small { font-size: 11px; }
  .heading { flex-wrap: wrap; gap: 12px; }
  .auth-panel { padding: 26px 20px; }
}
@media (max-height: 750px) and (min-width: 768px) {
  .sidebar-note { display: none; }
  .sidebar-bottom { padding-top: 24px; }
}
@media (pointer: coarse) {
  .chip,.card-admin button,.table-actions button,.sort-control select { min-height: 44px; }
  .favorite { min-height: 44px; width: 44px; height: 44px; }
  .player .tools-dismiss { width: 44px; }
  .player-tools { grid-template-columns: auto 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button[aria-busy="true"]::after { border-style: dotted; border-right-color: currentColor; }
}
