:root {
    color-scheme: light;
    --navy: #101b35;
    --blue: #3157d5;
    --cyan: #36c6d9;
    --ink: #17213a;
    --muted: #68748d;
    --line: #e4e8f1;
    --surface: #ffffff;
    --background: #f4f6fb;
    --danger: #a62b3d;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.15; letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 1.35rem; }
h3 { margin-bottom: 4px; font-size: 1rem; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background: radial-gradient(circle at 12% 15%, #243c78 0, transparent 35%), radial-gradient(circle at 90% 85%, #174b67 0, transparent 32%), var(--navy);
}
.auth-card { width: min(100%, 980px); display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; border-radius: 28px; background: var(--surface); box-shadow: 0 30px 90px #050a1870; }
.auth-intro { padding: 56px; color: #fff; background: linear-gradient(150deg, #1e3363, #172442); }
.auth-intro h1 { margin-top: 42px; }
.auth-intro p:last-child { color: #b9c7e5; }
.auth-form-wrap { padding: 56px 48px; align-self: center; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, var(--blue), var(--cyan)); font-weight: 800; }
.brand-mark.large { width: 52px; height: 52px; border-radius: 16px; font-size: 1.4rem; }
.eyebrow { margin-bottom: 12px; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.auth-intro .eyebrow { margin-top: 28px; color: #77dce8; }
.muted, .page-heading p, .empty-state { color: var(--muted); }
.form-stack { display: grid; gap: 20px; margin-top: 28px; }
.form-stack label { display: grid; gap: 7px; font-size: .9rem; font-weight: 650; }
.form-stack small { color: var(--muted); font-weight: 400; }
input { width: 100%; padding: 13px 14px; border: 1px solid #d7ddea; border-radius: 11px; color: var(--ink); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px #3157d51a; }
.primary-button { display: block; width: 100%; padding: 13px 20px; border: 0; border-radius: 11px; color: #fff; background: var(--blue); font-weight: 750; cursor: pointer; transition: transform .15s, background .15s; }
.primary-button:hover { background: #2648bd; transform: translateY(-1px); }
.inline-button { display: inline-block; width: auto; margin-top: 12px; }
.alert { margin: 18px 0; padding: 12px 14px; border-radius: 10px; font-size: .9rem; }
.alert.error { color: var(--danger); background: #fff0f2; border: 1px solid #f5cbd2; }
.alert.info { color: #245079; background: #edf6ff; border: 1px solid #cbe3f8; }

.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px max(24px, calc((100vw - 1240px) / 2)); color: #fff; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.user-nav { display: flex; align-items: center; gap: 20px; }
.user-summary { display: grid; text-align: right; line-height: 1.3; }
.user-summary small { color: #aebbd5; }
.nav-link { color: #c8d3e9; font-size: .9rem; }
.nav-link:hover { color: #fff; }
.button-link { padding: 0; border: 0; background: none; cursor: pointer; }
.page-shell { width: min(100% - 40px, 1240px); margin: 0 auto; padding: 48px 0 64px; }
.page-heading { margin-bottom: 30px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { display: grid; gap: 8px; padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 6px 20px #1c2a4606; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.stat-card strong { font-size: 2rem; line-height: 1; }
.content-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 24px; }
.panel { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 10px 35px #1c2a4607; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.narrow-panel { width: min(100%, 560px); margin: 0 auto; }
.center-text { text-align: center; }
.empty-state { padding: 28px 8px; text-align: center; }
.lesson-list { display: grid; }
.lesson-item { display: flex; align-items: center; gap: 16px; padding: 17px 0; border-top: 1px solid var(--line); }
.lesson-item p { margin: 0; color: var(--muted); font-size: .88rem; }
.lesson-date { min-width: 62px; padding: 9px; border-radius: 11px; text-align: center; color: var(--blue); background: #edf1ff; line-height: 1.25; }
.lesson-date span { display: block; margin-top: 4px; font-size: .75rem; }
.course-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.course-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.course-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #176274; background: #e6f8fa; }

@media (max-width: 850px) {
    .auth-card { grid-template-columns: 1fr; }
    .auth-intro { padding: 36px; }
    .auth-intro h1 { margin-top: 20px; }
    .auth-form-wrap { padding: 36px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .auth-shell { padding: 14px; }
    .auth-intro, .auth-form-wrap { padding: 28px 24px; }
    .topbar { align-items: flex-start; padding: 14px 20px; }
    .brand > span:last-child, .user-summary, .user-nav > .nav-link { display: none; }
    .page-shell { width: min(100% - 28px, 1240px); padding-top: 30px; }
    .panel { padding: 22px; }
}

select, textarea { width: 100%; padding: 12px 14px; border: 1px solid #d7ddea; border-radius: 11px; color: var(--ink); background: #fff; outline: none; }
textarea { resize: vertical; }
select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px #3157d51a; }
.action-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.action-button { width: auto; white-space: nowrap; }
.form-panel { width: min(100%, 680px); margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--blue); font-size: .9rem; font-weight: 700; }
.alert.success { color: #176744; background: #ecf9f2; border: 1px solid #c5ecd8; }
.filter-bar { display: grid; grid-template-columns: 1fr 190px auto; gap: 12px; margin-bottom: 24px; }
.secondary-button { padding: 11px 18px; border: 1px solid #d7ddea; border-radius: 11px; color: var(--ink); background: #f8f9fc; font-weight: 700; cursor: pointer; }
.secondary-button:hover { background: #eef1f7; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 14px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.table-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; }
.table-action { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: .75rem; font-weight: 750; }
.success-badge { color: #176744; background: #e8f7ef; }
.muted-badge { color: #5d6679; background: #edf0f4; }
.text-button { padding: 0; border: 0; color: var(--blue); background: none; font-size: .85rem; font-weight: 750; cursor: pointer; }
.danger-text { color: var(--danger); }
.course-management-grid { align-items: start; grid-template-columns: 1.3fr 1fr; }
.member-list { display: grid; }
.member-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
    .action-heading { align-items: flex-start; flex-direction: column; }
    .filter-bar { grid-template-columns: 1fr; }
    .user-nav { gap: 12px; }
    .user-nav .nav-link { font-size: .8rem; }
}

[hidden] { display: none !important; }
.lesson-link:hover { color: var(--blue); }
.status-scheduled { color: #245079; background: #eaf4ff; }
.status-live { color: #176744; background: #e5f8ee; }
.status-ended { color: #5d6679; background: #edf0f4; }
.status-cancelled { color: var(--danger); background: #fff0f2; }
.large-badge { padding: 8px 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-list { display: grid; gap: 0; margin: 20px 0 28px; }
.detail-list div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.room-entry-button { width: auto; }
.danger-button { padding: 12px 18px; border: 1px solid #e7b6bf; border-radius: 11px; color: #fff; background: var(--danger); font-weight: 750; cursor: pointer; }
.danger-button:hover { background: #892233; }
.full-width { width: 100%; margin-top: 12px; }
.room-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.live-indicator { display: flex; align-items: center; gap: 8px; color: #c1364b; font-size: .75rem; font-weight: 850; letter-spacing: .1em; }
.live-indicator > span { width: 9px; height: 9px; border-radius: 50%; background: #d73b52; box-shadow: 0 0 0 5px #d73b5218; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.stage-panel { position: relative; display: grid; place-items: center; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 22px; color: #fff; background: radial-gradient(circle at 50% 20%, #263b69, #0c1428 75%); box-shadow: 0 18px 45px #0b13252b; }
.stage-panel video { width: 100%; height: 100%; object-fit: cover; }
.stage-placeholder { padding: 32px; text-align: center; }
.stage-placeholder .brand-mark { margin-bottom: 20px; }
.stage-placeholder p { margin: 0; color: #aebbd5; }
.room-sidebar .form-stack { margin-top: 18px; }
.device-status { margin: 18px 0; padding: 12px; border-radius: 10px; color: var(--muted); background: #f3f5f9; font-size: .82rem; }

@media (max-width: 900px) {
    .room-grid { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; }
}

@media (max-width: 560px) {
    .form-row { grid-template-columns: 1fr; }
    .room-heading { align-items: flex-start; }
    .stage-panel { border-radius: 16px; }
}
