:root {
    --ink: #17212b;
    --muted: #77818d;
    --line: #e7ebef;
    --blue: #2878e8;
    --blue-dark: #155ac2;
    --bg: #f5f8fb;
    --card: #ffffff;
    --shadow: 0 18px 55px rgba(42, 67, 101, .09);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Pretendard, "Noto Sans KR", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.topbar { height: 72px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; width: min(1120px, calc(100% - 36px)); height: 100%; align-items: center; justify-content: space-between; margin: 0 auto; }
.brand { font-size: 18px; font-weight: 800; letter-spacing: -.04em; }
.brand span { margin-right: 7px; }
.logout { color: var(--muted); font-size: 13px; }
.container { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 52px 0 90px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 4vw, 48px); line-height: 1.16; letter-spacing: -.06em; }
h2 { margin: 8px 0 0; font-size: 22px; letter-spacing: -.05em; }
.muted { color: var(--muted); line-height: 1.7; }
.auth-shell { display: grid; grid-template-columns: 1fr 420px; gap: 90px; align-items: center; min-height: calc(100vh - 170px); }
.hero-copy em { color: var(--blue); font-style: normal; }
.hero-copy p { max-width: 420px; font-size: 16px; }
.auth-card, .panel, .error-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card { padding: 34px; }
.auth-card h2 { font-size: 28px; }
.auth-kicker { display: inline-block; margin-bottom: 2px; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.login-role-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 18px 0; }
.login-role-guide > div { display: grid; gap: 3px; min-width: 0; padding: 11px 8px; border: 1px solid #e1e8f0; border-radius: 11px; background: #f8fbff; text-align: center; }
.login-role-guide span { font-size: 19px; }
.login-role-guide strong { color: #28384b; font-size: 11px; }
.login-role-guide small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.login-action-button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; gap: 8px; padding: 13px 16px; border: 0; border-radius: 11px; cursor: pointer; font-size: 15px; font-weight: 800; line-height: 1.2; text-align: center; text-decoration: none; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.login-action-button:hover { transform: translateY(-1px); }
.login-action-primary { color: #fff; background: linear-gradient(135deg, var(--blue), #55a0ff); box-shadow: 0 8px 18px rgba(40,120,232,.18); }
.login-action-primary:hover { box-shadow: 0 10px 22px rgba(40,120,232,.24); }
.login-action-secondary { color: var(--blue-dark); background: #edf5ff; }
.login-action-secondary:hover { background: #e2efff; }
.teacher-signup-guide { width: 100%; margin: 12px 0 20px; border-radius: 11px; color: #4f4691; background: #f2f0ff; box-shadow: inset 0 0 0 1px #dedaff; overflow: hidden; }
.login-action-teacher { justify-content: space-between; color: #5146a6; background: transparent; font-size: 13px; text-align: left; }
.login-action-teacher:hover { background: #e9e6ff; }
.teacher-signup-toggle strong { font-size: inherit; }
.teacher-signup-chevron { display: grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; color: #6559bb; background: #fff; font-size: 17px; line-height: 1; transition: transform .18s ease; }
.teacher-signup-guide.is-open .teacher-signup-toggle { border-radius: 11px 11px 0 0; background: #ece9ff; transform: none; }
.teacher-signup-guide.is-open .teacher-signup-chevron { transform: rotate(180deg); }
.teacher-signup-content { padding: 0 10px 10px; background: #ece9ff; }
.teacher-signup-content a { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 12px; border-radius: 9px; color: #5146a6; background: #fff; font-size: 12px; font-weight: 800; text-align: center; text-decoration: none; }
.teacher-signup-content a:hover { background: #f9f8ff; }
.teacher-signup-content a span { margin-left: 3px; color: #8a82ba; font-size: 10px; font-weight: 600; }
.stack-form { display: grid; gap: 15px; }
.remember-login-option { display: grid; gap: 5px; color: #4b5663; font-size: 12px; font-weight: 700; }
.remember-login-option > span { display: flex; align-items: center; gap: 8px; }
.remember-login-option input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.remember-login-option small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
label { display: grid; gap: 7px; color: #4b5663; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #dce3ea; border-radius: 11px; padding: 12px 13px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,120,232,.11); }
textarea { resize: vertical; }
.primary-button, .secondary-button { border: 0; border-radius: 11px; padding: 13px 16px; cursor: pointer; font-weight: 800; text-align: center; }
.primary-button { color: #fff; background: linear-gradient(135deg, var(--blue), #55a0ff); }
.secondary-button { color: var(--blue-dark); background: #edf5ff; }
.inline-button { display: inline-block; }
.divider { display: flex; gap: 13px; align-items: center; margin: 23px 0; color: #a0a8b0; font-size: 12px; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.signup-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.signup-button { width: 100%; }
.signup-intro { margin: 12px 0 22px; font-size: 12px; line-height: 1.65; }
.optional-label { margin-left: 4px; color: #9aa5b2; font-size: 10px; font-weight: 500; }
.name-changeable { color: #1976d2; }
.id-fixed { color: #e53935; }
.notice { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.notice.success { color: #16734d; background: #eaf9f1; }
.notice.error { color: #a63434; background: #fff0f0; }
.notice.info { color: #2563a8; background: #edf5ff; }
.dashboard-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.dashboard-head h1 { margin-top: 10px; }
.dashboard-head-actions { display: flex; gap: 9px; align-items: center; }
.user-pill { padding: 10px 15px; color: #536171; background: #fff; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 18px; }
.stats-grid.four-stats { grid-template-columns: repeat(4, 1fr); }
.teacher-stats-grid { grid-template-columns: minmax(240px, 360px); }
.stat-card { padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.stat-card span, .stat-card small { color: var(--muted); font-size: 13px; }
.stat-card strong { display: inline-block; margin: 9px 4px 0 0; font-size: 30px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { padding: 26px; margin-bottom: 18px; }
.panel-title { display: flex; justify-content: space-between; margin-bottom: 22px; }
.panel-count { align-self: center; color: var(--muted); font-size: 13px; }
.class-head-actions { display: grid; gap: 8px; justify-items: end; }
.action-details { position: relative; z-index: 8; }
.action-details summary, .management-details summary { padding: 9px 12px; border-radius: 9px; color: var(--blue-dark); background: #edf5ff; cursor: pointer; font-size: 12px; font-weight: 800; list-style: none; }
.action-details summary::-webkit-details-marker, .management-details summary::-webkit-details-marker { display: none; }
.mini-action-form { position: absolute; top: calc(100% + 8px); right: 0; z-index: 12; display: grid; gap: 11px; width: 300px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 45px rgba(31,49,70,.16); }
.action-details:not(.align-right) .mini-action-form { right: 0; }
.management-strip { display: grid; grid-template-columns: minmax(260px, .8fr) 1.2fr; gap: 14px; margin-bottom: 18px; }
.management-details, .management-note { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.management-details[open] summary { margin-bottom: 14px; }
.management-form p, .management-note p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.management-note { display: flex; flex-direction: column; justify-content: center; background: #f8fbff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty { padding: 28px 0; margin: 0; color: var(--muted); text-align: center; }
.book-list, .log-list { display: grid; gap: 9px; }
.book-row { display: flex; align-items: center; gap: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.clickable-row { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.clickable-row:hover { border-color: #bcd6fa; box-shadow: 0 10px 28px rgba(40,120,232,.09); transform: translateY(-1px); }
.row-arrow { flex: 0 0 auto; color: #9badc0; font-size: 28px; line-height: 1; }
.book-cover { display: grid; place-items: center; width: 48px; height: 64px; flex: 0 0 48px; border-radius: 8px; background: #edf5ff; font-size: 20px; }
.book-info { flex: 1; min-width: 0; }
.book-info h3 { margin-bottom: 5px; font-size: 15px; }
.book-info p { overflow: hidden; margin-bottom: 10px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.book-info small { color: var(--muted); font-size: 11px; }
.progress-track { height: 6px; overflow: hidden; margin-bottom: 6px; border-radius: 99px; background: #edf0f3; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.icon-button { border: 0; color: #e36b78; background: transparent; cursor: pointer; font-size: 22px; }

/* Teacher dashboard class cards */
.teacher-classes-panel { overflow: visible; }
.teacher-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 250px)); justify-content: start; gap: 16px; }
.teacher-class-card { position: relative; min-width: 0; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 5px 18px rgba(31,49,70,.04); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease; }
.teacher-class-card:hover { border-color: #f4b53d; box-shadow: 0 14px 34px rgba(45,62,82,.1); transform: translateY(-3px); }
.teacher-class-card.is-dragging { z-index: 9; border: 2px dashed #f2a900; opacity: .58; transform: scale(.98); }
.teacher-class-card.class-status-ended { background: #f8fafc; opacity: .82; }
.teacher-class-card.class-status-archived { background: #f5f6f7; opacity: .66; filter: saturate(.72); }
.teacher-class-link { display: grid; height: 100%; box-sizing: border-box; min-height: 0; place-items: center; align-content: center; padding: 32px 20px 24px; text-align: center; }
.teacher-class-icon { display: grid; width: 108px; height: 108px; place-items: center; margin-bottom: 8px; border-radius: 28px; background: linear-gradient(145deg,#fff9e9,#edf5ff); font-size: 68px; line-height: 1; }
.teacher-class-link strong { overflow: hidden; max-width: 100%; margin-top: 4px; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.teacher-class-link small { margin-top: 8px; color: var(--muted); font-size: 11px; }
.class-status-badge { display: inline-flex; align-items: center; min-height: 24px; margin-top: 11px; padding: 5px 9px; border-radius: 99px; color: #16734d; background: #eaf9f1; font-size: 10px; font-weight: 900; }
.class-status-badge.status-ended { color: #5d6672; background: #e9edf2; }
.class-status-badge.status-archived { color: #7b6a52; background: #eee8df; }
.class-drag-handle { position: absolute; top: 10px; left: 11px; z-index: 5; display: grid; width: 34px; height: 30px; place-content: center; gap: 3px; border: 0; border-radius: 9px; color: #8b98a7; background: #f1f5f9; cursor: grab; touch-action: none; user-select: none; }
.class-drag-handle i { display: block; width: 15px; height: 2px; border-radius: 99px; background: currentColor; pointer-events: none; }
.class-drag-handle:hover { color: #b56d00; background: #fff3d4; }
.class-drag-handle:active { cursor: grabbing; }
.class-card-edit { position: absolute; top: 10px; right: 11px; z-index: 7; }
.class-card-edit > summary { display: grid; width: 34px; height: 30px; place-items: center; border-radius: 9px; color: #d37a26; background: #fff4e7; cursor: pointer; font-size: 17px; font-weight: 900; list-style: none; }
.class-card-edit > summary::-webkit-details-marker { display: none; }
.class-rename-form { position: absolute; top: calc(100% + 7px); right: 0; display: grid; gap: 11px; width: 270px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 45px rgba(31,49,70,.2); text-align: left; }
.class-rename-form .primary-button { padding: 10px 12px; }
.class-delete-form { margin-top: 1px; }
.class-delete-form button { width: 100%; }
.class-order-help { margin: 16px 0 0; color: var(--muted); font-size: 11px; text-align: right; }
.class-order-status { min-height: 20px; margin-top: 4px; font-size: 11px; font-weight: 800; text-align: right; }
.class-order-status.saving { color: #6c7888; }
.class-order-status.success { color: #178547; }
.class-order-status.error { color: #b83b46; }
.log-row { display: grid; grid-template-columns: 95px 1fr auto; gap: 15px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--muted); font-size: 12px; }
.log-row strong { font-size: 14px; }
.log-row p { overflow: hidden; margin: 4px 0 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.log-row b { color: var(--blue); font-size: 13px; white-space: nowrap; }
.error-card { max-width: 520px; margin: 60px auto; padding: 50px 35px; text-align: center; }
.error-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 18px; border-radius: 50%; color: #fff; background: #e36b78; font-size: 28px; font-weight: 800; }
.error-card h1 { font-size: 30px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin: -14px 0 30px; color: var(--muted); font-size: 13px; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb strong { color: var(--ink); }
.compact-head h1 { font-size: clamp(30px, 3.5vw, 42px); }
.student-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.student-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: -4px 0 14px; padding: 12px 14px; border-radius: 12px; background: #f7f9fc; }
.check-label { display: flex; grid-template-columns: none; gap: 7px; align-items: center; color: #536171; cursor: pointer; }
.check-label input, .student-select { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--blue); }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.small-button, .student-action { display: inline-block; border: 0; border-radius: 8px; cursor: pointer; font-weight: 800; text-align: center; text-decoration: none; }
.small-button { padding: 9px 12px; font-size: 12px; }
.warning-button { color: #8a5200; background: #fff0c9; }
.neutral-button { color: #405064; background: #e8eef5; }
.student-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.student-card:hover { border-color: #bcd6fa; box-shadow: 0 12px 30px rgba(40,120,232,.09); transform: translateY(-1px); }
.student-card-link { display: flex; gap: 14px; align-items: center; min-width: 0; }
.student-avatar { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; color: var(--blue-dark); background: #edf5ff; font-size: 18px; font-weight: 900; }
.student-main { flex: 1; min-width: 0; }
.student-name-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.student-name-line strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.student-name-line small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.student-metrics { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; color: #526170; font-size: 12px; }
.student-main p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.student-actions { display: flex; grid-column: 2; flex-wrap: wrap; gap: 6px; align-items: center; padding-left: 60px; }
.access-key-badge { padding: 5px 8px; border-radius: 7px; color: #4f46e5; background: #eef2ff; font-family: Consolas, monospace; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.student-action { padding: 6px 9px; color: #536171; background: #edf1f5; font-size: 11px; }
.student-action:hover { color: var(--blue-dark); background: #e1edff; }
.student-action.primary-action { color: #fff; background: #2eaf61; }
.student-action.primary-action:hover { color: #fff; background: #23894b; }
.student-action.danger-action { color: #b83b46; background: #fff0f1; }
.student-action.danger-action:hover { color: #922c35; background: #ffe1e4; }
.inline-form { display: inline; margin: 0; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; padding: 11px 16px; border-radius: 99px; color: #fff; background: #17212b; box-shadow: 0 12px 35px rgba(0,0,0,.18); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.teacher-detail-grid { align-items: start; }
.teacher-detail-grid .panel { min-width: 0; }
.compact-logs { max-height: 680px; overflow: auto; padding-right: 4px; }
.class-tabs { display: flex; gap: 4px; overflow-x: auto; margin: 2px 0 18px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: #fff; scrollbar-width: thin; }
.class-tabs a { flex: 0 0 auto; padding: 10px 13px; border-radius: 10px; color: #657181; font-size: 12px; font-weight: 800; white-space: nowrap; }
.class-tabs a:hover { color: var(--blue-dark); background: #f3f7fc; }
.class-tabs a.active { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(40,120,232,.22); }
.feature-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.feature-form-panel { position: sticky; top: 18px; }
.challenge-icon-field { display: grid; gap: 7px; color: #4b5663; font-size: 13px; font-weight: 700; }
.challenge-icon-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; max-height: 184px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc; }
.challenge-icon-option { position: relative; display: grid; min-height: 40px; place-items: center; border: 1px solid transparent; border-radius: 9px; background: #fff; cursor: pointer; }
.challenge-icon-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.challenge-icon-option span { font-size: 23px; line-height: 1; }
.challenge-icon-option:has(input:checked) { border-color: #f4ad2e; background: #fff5dc; box-shadow: 0 0 0 2px rgba(244,173,46,.16); }
.challenge-period-toggle { display: flex; grid-template-columns: none; align-items: center; gap: 7px; color: #5b6877; font-size: 12px; cursor: pointer; }
.challenge-period-toggle input { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--blue); }
.feature-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.feature-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: start; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.feature-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #fff7df; font-size: 25px; }
.feature-body { min-width: 0; }
.feature-body h3 { margin: 2px 0 7px; font-size: 15px; }
.feature-body strong { color: var(--blue-dark); font-size: 12px; }
.feature-body p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.feature-actions { position: relative; display: flex; gap: 4px; align-items: center; }
.recommendation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.recommendation-card { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 13px; align-items: start; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; }
.recommendation-card img, .recommendation-placeholder { width: 58px; height: 78px; border-radius: 8px; background: #edf5ff; object-fit: cover; }
.recommendation-placeholder { display: grid; place-items: center; font-size: 24px; }
.recommendation-card h3 { margin: 3px 0 5px; font-size: 14px; }
.recommendation-card p { margin: 0 0 7px; color: var(--muted); font-size: 12px; }
.recommendation-card small { display: -webkit-box; overflow: hidden; color: #627080; font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.ranking-list { display: grid; gap: 8px; }
.ranking-row { display: grid; grid-template-columns: 42px minmax(140px, 1fr) repeat(2, minmax(80px, auto)) minmax(90px, auto); gap: 13px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; transition: border-color .18s ease, transform .18s ease; }
.ranking-row:hover { border-color: #bcd6fa; transform: translateY(-1px); }
.ranking-row > span:not(.rank-number) { color: var(--muted); font-size: 12px; }
.ranking-row b { color: var(--blue-dark); text-align: right; }
.rank-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #617083; background: #edf1f5; font-size: 13px; font-weight: 900; }
.rank-number.top-rank { color: #8a5200; background: #fff0c9; }
.period-filter { display: grid; grid-template-columns: minmax(150px, 220px) minmax(150px, 220px) auto; gap: 10px; align-items: end; margin-bottom: 18px; }
.period-quick-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.period-quick-actions > span { color: var(--muted); font-size: 12px; font-weight: 800; }
.responsive-table { overflow-x: auto; }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; white-space: nowrap; }
.data-table th { color: var(--muted); background: #f8fafc; font-size: 11px; }
.settings-grid { display: grid; gap: 11px; }
.setting-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.class-delete-setting { border-color: #f2cdd2; background: #fffafa; }
.setting-card strong { display: block; margin-bottom: 6px; }
.setting-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.setting-card code { display: inline-block; margin-top: 9px; padding: 6px 9px; border-radius: 7px; color: #4f46e5; background: #eef2ff; font-size: 15px; font-weight: 900; letter-spacing: .08em; }
.setting-control { display: flex; gap: 7px; align-items: center; }
.setting-control select { min-width: 110px; padding: 8px 10px; }
.toggle-button { min-width: 62px; padding: 9px 12px; border: 0; border-radius: 99px; color: #657181; background: #e9eef3; cursor: pointer; font-size: 12px; font-weight: 900; }
.toggle-button.on { color: #fff; background: #16a66a; }
.request-panel, .student-request-panel { border-color: #d8e8fb; background: #fbfdff; }
.request-list { display: grid; gap: 8px; }
.request-row { display: flex; gap: 15px; align-items: center; justify-content: space-between; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.request-row strong { margin-right: 7px; }
.request-row small { color: var(--muted); }
.request-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.request-actions, .timer-buttons { display: flex; flex: 0 0 auto; gap: 7px; }
.pending-badge { flex: 0 0 auto; padding: 7px 10px; border-radius: 99px; color: #8a5200; background: #fff0c9; font-size: 11px; font-weight: 800; }
.danger-action { border: 0; color: #b83b46; background: #fff0f1; }
.student-class-strip { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 15px 18px; border: 1px solid #dce7f4; border-radius: 15px; background: #fff; }
.student-class-strip > div { display: flex; gap: 11px; align-items: center; }
.student-class-strip span { color: var(--muted); font-size: 12px; }
.reading-timer-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: #bdebd8; background: linear-gradient(135deg, #fbfffd, #f0fff8); }
.reading-timer-panel .muted { margin: 8px 0 0; font-size: 12px; }
.timer-controls { display: grid; gap: 10px; justify-items: end; }
.timer-controls > strong { font-family: Consolas, monospace; font-size: clamp(28px, 4vw, 42px); letter-spacing: .04em; }
.student-feature-columns { align-items: start; }
.student-feature-list { grid-template-columns: 1fr; }
.student-feature-list .feature-card, .student-feature-list .recommendation-card { grid-template-columns: auto minmax(0, 1fr); }
.teacher-log-card { position: relative; border-bottom: 1px solid var(--line); }
.teacher-log-card:last-child { border-bottom: 0; }
.teacher-log-card .log-row { border-bottom: 0; }
.comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 0 0 13px 110px; }
.comment-form textarea { min-height: 64px; }
.comment-delete-form { position: absolute; right: 0; bottom: 14px; }
.teacher-comment-view { display: grid; gap: 4px; margin-top: 9px; padding: 9px 11px; border-left: 3px solid #ff9d42; border-radius: 7px; background: #fff8ef; color: #8a521f; font-size: 11px; line-height: 1.55; white-space: normal; }
.teacher-comment-view strong { font-size: 11px; }
.book-row-actions, .log-row-actions { position: relative; display: flex; flex: 0 0 auto; gap: 6px; align-items: center; }
.log-row-actions { justify-content: flex-end; }
.inline-edit-details { position: relative; }
.inline-edit-details summary { padding: 6px 8px; border-radius: 7px; color: #536171; background: #edf1f5; cursor: pointer; font-size: 10px; font-weight: 800; list-style: none; }
.inline-edit-details summary::-webkit-details-marker { display: none; }
.inline-edit-popover { position: absolute; top: calc(100% + 7px); right: 0; z-index: 18; width: 290px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 45px rgba(31,49,70,.18); }
.log-row-actions .inline-edit-popover { top: auto; right: 0; bottom: calc(100% + 7px); }

@media (max-width: 760px) {
    .container { padding-top: 32px; }
    .auth-shell, .two-column { grid-template-columns: 1fr; gap: 26px; }
    .auth-shell { min-height: auto; }
    .hero-copy h1 { font-size: 34px; }
    .dashboard-head { display: block; }
    .user-pill { display: inline-block; margin-top: 12px; }
    .dashboard-head-actions { margin-top: 12px; align-items: center; }
    .dashboard-head-actions .user-pill { margin-top: 0; }
    .stats-grid, .stats-grid.four-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 15px; }
    .stat-card strong { font-size: 25px; }
    .panel { padding: 20px; border-radius: 18px; }
    .log-row { grid-template-columns: 75px 1fr auto; gap: 8px; }
    .student-grid { grid-template-columns: 1fr; }
    .student-toolbar { align-items: flex-start; flex-direction: column; }
    .student-actions { padding-left: 0; }
    .management-strip { grid-template-columns: 1fr; }
    .class-head-actions { justify-items: start; margin-top: 12px; }
    .mini-action-form { right: auto; left: 0; width: min(300px, calc(100vw - 54px)); }
    .breadcrumb { margin-top: -4px; }
    .feature-layout { grid-template-columns: 1fr; }
    .feature-form-panel { position: static; }
    .feature-card-grid, .recommendation-grid { grid-template-columns: 1fr; }
    .ranking-row { grid-template-columns: 36px minmax(110px, 1fr) auto; }
    .ranking-row > span:not(.rank-number) { display: none; }
    .period-filter { grid-template-columns: 1fr 1fr; }
    .period-filter button { grid-column: 1 / -1; }
    .setting-card, .request-row, .reading-timer-panel { align-items: flex-start; flex-direction: column; }
    .setting-control, .request-actions, .timer-buttons { width: 100%; }
    .setting-control select { flex: 1; }
    .student-class-strip { align-items: flex-start; flex-direction: column; }
    .timer-controls { width: 100%; justify-items: start; }
    .comment-form { grid-template-columns: 1fr; padding-left: 0; }
    .comment-delete-form { position: static; padding-bottom: 12px; }
    .inline-edit-popover { position: fixed; top: 50%; right: auto; bottom: auto; left: 50%; width: min(330px, calc(100vw - 36px)); max-height: calc(100vh - 40px); overflow: auto; transform: translate(-50%, -50%); }
    .teacher-class-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 210px)); justify-content: start; gap: 10px; }
    .teacher-class-card { aspect-ratio: 1; }
    .teacher-class-link { height: 100%; min-height: 0; padding: 30px 10px 18px; }
    .teacher-class-icon { width: 82px; height: 82px; border-radius: 22px; font-size: 52px; }
    .teacher-class-link strong { font-size: 14px; }
    .teacher-class-link small { font-size: 9px; }
    .class-rename-form { position: fixed; top: 50%; right: auto; left: 50%; width: min(320px, calc(100vw - 32px)); transform: translate(-50%, -50%); }
    .class-order-help, .class-order-status { text-align: left; }
}

@media (max-width: 430px) {
    .teacher-class-grid { grid-template-columns: minmax(0, 210px); justify-content: start; }
}

/* Teacher publishing, ISBN recommendation search and legacy-style ranking */
.success-button, .neutral-button, .quick-range { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 14px; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.success-button { color: #fff; background: #36ad54; box-shadow: 0 7px 18px rgba(54,173,84,.18); }
.success-button:hover { color: #fff; background: #278b40; }
.neutral-button { color: #405064; background: #e8eef5; }
.quick-range { min-height: 36px; padding: 8px 12px; border: 1px solid var(--line); color: #405064; background: #fff; }
.quick-range:hover { color: var(--blue-dark); border-color: #bcd6fa; background: #f5f9ff; }

.publish-modal[hidden] { display: none; }
.publish-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.publish-modal-backdrop { position: absolute; inset: 0; background: rgba(20,24,31,.62); backdrop-filter: blur(3px); }
.publish-modal-card { position: relative; z-index: 1; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px; border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.publish-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid #f0dca7; }
.publish-modal-head h2 { margin: 4px 0 0; font-size: 23px; }
.publish-modal-close { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; color: #667385; background: #eef2f6; cursor: pointer; font-size: 24px; }
.publish-form-section { display: grid; gap: 10px; margin-top: 18px; }
.publish-form-section > strong { font-size: 13px; }
.publish-form-section input[type="text"], .publish-form-section textarea, .publish-period-input input { width: 100%; border: 1px solid #dce3eb; border-radius: 10px; padding: 11px 12px; background: #fff; font: inherit; }
.publish-form-section textarea { resize: vertical; line-height: 1.5; }
.publish-period-types { display: flex; flex-wrap: wrap; gap: 12px; }
.publish-period-types label, .publish-check { display: flex; grid-template-columns: none; align-items: center; gap: 6px; color: #435164; cursor: pointer; font-size: 12px; }
.publish-period-types input, .publish-check input, .publish-theme input { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--blue); }
.publish-period-input { display: flex; align-items: center; gap: 8px; padding: 11px; border-radius: 10px; background: #f7f9fc; font-size: 13px; }
.publish-period-input[hidden] { display: none; }
.publish-custom-period input { min-width: 0; }
.publish-theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.publish-theme { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr); column-gap: 9px; padding: 10px; border: 1px solid #dfe6ee; border-radius: 12px; cursor: pointer; }
.publish-theme.active { border-color: #f59e0b; background: #fffaf0; box-shadow: 0 0 0 1px #f59e0b inset; }
.publish-theme input { grid-row: 1 / 4; align-self: center; }
.publish-theme b { font-size: 12px; }
.publish-theme small { color: var(--muted); font-size: 10px; }
.theme-preview { height: 28px; margin-bottom: 5px; border: 1px solid #dfe6ee; border-radius: 6px; }
.theme-preview.classic { background: linear-gradient(90deg,#fff 0 18%,#1f2937 18% 23%,#fff 23%); }
.theme-preview.modern { background: linear-gradient(90deg,#2563eb 0 24%,#eff6ff 24%); }
.theme-preview.cute { background: repeating-linear-gradient(90deg,#fffbeb 0 25%,#fbbf24 25% 29%); }
.theme-preview.colorful { background: linear-gradient(135deg,#cffafe,#dcfce7,#fef3c7); }
.publish-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.publish-modal-actions .neutral-button { min-height: 46px; }
.publish-modal-open { overflow: hidden; }

.book-api-search { display: grid; gap: 8px; margin-bottom: 17px; padding: 15px; border: 1px solid #cae6d5; border-radius: 14px; background: linear-gradient(135deg,#fbfffd,#f1fff6); }
.book-api-search > strong { font-size: 13px; }
.book-api-search > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.book-api-search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.book-api-search-row input { min-width: 0; width: 100%; border: 1px solid #bcd6ca; border-radius: 10px; padding: 11px 12px; font: inherit; }
.book-api-results { display: grid; gap: 5px; max-height: 360px; overflow-y: auto; padding: 6px; border: 1px solid #dce7e1; border-radius: 11px; background: #fff; }
.book-api-results[hidden] { display: none; }
.book-api-result { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: 9px; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.book-api-result:hover { background: #f0faf4; }
.book-api-result img, .book-result-placeholder { display: grid; width: 48px; height: 68px; place-items: center; border-radius: 6px; background: #edf5ff; object-fit: cover; font-size: 22px; }
.book-api-result > span:last-child { display: grid; min-width: 0; align-content: center; gap: 5px; }
.book-api-result strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.book-api-result small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.book-search-message { margin: 0; padding: 13px; color: var(--muted); text-align: center; font-size: 11px; }
.book-search-message.error { color: #b83b46; }
.selected-book-preview { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid #bdebd0; border-radius: 12px; background: #f1fff6; }
.selected-book-preview[hidden] { display: none; }
.selected-book-preview img { width: 48px; height: 68px; border-radius: 6px; object-fit: cover; }
.selected-book-preview > div { display: grid; min-width: 0; gap: 4px; }
.selected-book-preview b { color: #178547; font-size: 10px; }
.selected-book-preview strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.selected-book-preview small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.selected-book-preview button { border: 0; color: #718092; background: transparent; cursor: pointer; font-size: 22px; }

.ranking-print-header { display: none; }
.ranking-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ranking-filter label { color: #536171; font-size: 12px; font-weight: 800; }
.ranking-filter input { min-height: 38px; border: 1px solid #dce3eb; border-radius: 8px; padding: 8px 10px; font: inherit; }
.ranking-print-button { margin-left: auto; }
.ranking-summary-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.ranking-summary-grid article { display: grid; min-width: 0; min-height: 142px; place-items: center; align-content: center; padding: 15px 8px; border: 1px solid var(--line); border-radius: 15px; background: #fff; text-align: center; }
.ranking-summary-grid article > span { font-size: 26px; }
.ranking-summary-grid article > strong { overflow: hidden; width: 100%; margin: 8px 0 5px; font-size: clamp(18px,2.1vw,27px); text-overflow: ellipsis; white-space: nowrap; }
.ranking-summary-grid article > small { color: var(--muted); font-size: 10px; }
.ranking-chart-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; align-items: stretch; }
.ranking-trend-panel { grid-column: 1 / -1; }
.ranking-trend-panel .panel-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.daily-chart { display: grid; grid-template-columns: repeat(var(--daily-count),minmax(30px,1fr)); gap: 7px; align-items: end; min-height: 225px; overflow-x: auto; padding: 30px 8px 4px; border-bottom: 1px solid #dce3eb; }
.daily-column { display: grid; grid-template-rows: 20px 150px 20px; gap: 5px; min-width: 30px; align-items: end; justify-items: center; }
.daily-column span { color: #6c7888; font-size: 10px; }
.daily-column i { display: block; width: min(70%,34px); min-height: 3px; border-radius: 7px 7px 0 0; background: linear-gradient(180deg,#ffb000,#ff7800); }
.daily-column small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.ranking-bar-panel { min-height: 300px; }
.ranking-bars { display: grid; gap: 10px; }
.ranking-bars a { display: grid; grid-template-columns: 25px minmax(74px,120px) minmax(80px,1fr) auto; gap: 9px; align-items: center; color: inherit; }
.ranking-bars a > b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #8a5200; background: #fff0c9; font-size: 10px; }
.ranking-bars a > strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-bars a > span { height: 9px; overflow: hidden; border-radius: 99px; background: #edf1f5; }
.ranking-bars a > span i { display: block; height: 100%; border-radius: inherit; background: #ff8a00; }
.ranking-bars a > em { min-width: 50px; color: #d96900; font-size: 11px; font-style: normal; font-weight: 900; text-align: right; }
.tone-green .ranking-bars a > span i { background: #16b57a; }
.tone-green .ranking-bars a > em { color: #12855c; }
.tone-blue .ranking-bars a > span i { background: #2878e8; }
.tone-blue .ranking-bars a > em { color: #155ac2; }
.tone-purple .ranking-bars a > span i { background: #8b5cf6; }
.tone-purple .ranking-bars a > em { color: #7042d5; }
.tone-teal .ranking-bars a > span i { background: #0f9f9a; }
.tone-sky .ranking-bars a > span i { background: #38a8ec; }
.compact-empty { padding: 48px 0; }

@media (max-width: 1050px) {
    .ranking-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .publish-modal { padding: 10px; }
    .publish-modal-card { max-height: calc(100vh - 20px); padding: 20px; }
    .publish-theme-grid { grid-template-columns: 1fr; }
    .publish-modal-actions { position: sticky; bottom: -20px; margin-right: -20px; margin-left: -20px; padding: 12px 20px 20px; background: linear-gradient(transparent,#fff 22%); }
    .ranking-filter { align-items: stretch; }
    .ranking-filter label { width: 100%; }
    .ranking-filter input { min-width: 0; flex: 1 1 130px; }
    .ranking-print-button { width: 100%; margin-left: 0; }
    .ranking-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ranking-summary-grid article { min-height: 118px; }
    .ranking-chart-grid { grid-template-columns: 1fr; }
    .ranking-trend-panel { grid-column: auto; }
    .ranking-bars a { grid-template-columns: 25px minmax(70px,100px) minmax(55px,1fr) auto; }
}
