/* Skool look: Roboto, warm off-white page, white cards with hairline borders, yellow accents. */
:root {
  --bg: #f8f7f5;
  --card: #ffffff;
  --text: #202124;
  --muted: #909090;
  --muted-2: #65676b;
  --line: #e4e4e4;
  --hover: #f2f2f2;
  --yellow: #f8d481;
  --yellow-soft: #fdf0cf;
  --green: #21b66f;
  --blue: #2e6fdb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 64, 67, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.4 Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { display: block; }
.wrap { max-width: 1117px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-row { height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.brand-link { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; background: #ddd; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; overflow: hidden; }
.logo.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 14px; }
.switch-btn { width: 24px; height: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; flex: none; }
.switch-btn:hover { background: var(--hover); color: var(--text); }
.switch-btn svg { width: 10px; height: 16px; }

.search { position: relative; flex: 1; max-width: 580px; margin: 0 auto; }
.search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 44px; border: 0; border-radius: 10px; background: #f0f0f0; padding: 0 16px 0 46px; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.search input::placeholder { color: var(--muted); }
.search input:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--line), 0 2px 10px rgba(0,0,0,.08); }
.search-pop { position: absolute; top: 50px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.12); max-height: 420px; overflow: auto; padding: 6px; }
.search-pop a { display: block; padding: 10px 12px; border-radius: 8px; }
.search-pop a:hover, .search-pop a.on { background: var(--hover); }
.search-pop .t { font-size: 15px; font-weight: 500; }
.search-pop .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.search-pop .empty { padding: 14px; color: var(--muted); }

.top-right { display: flex; align-items: center; gap: 12px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted-2); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #f7a54a, #ef6a3a); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 15px; }

.tabs { display: flex; gap: 28px; height: 52px; align-items: stretch; }
.tab { display: flex; align-items: center; font-size: 16px; color: var(--muted); position: relative; }
.tab.on { color: var(--text); font-weight: 500; }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--text); }

/* group switcher */
.switcher { position: absolute; top: 52px; left: 0; width: 330px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14); z-index: 30; padding: 8px; }
.switcher input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 15px; outline: none; margin-bottom: 6px; }
.switcher input:focus { border-color: #c4c4c4; }
.sw-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; width: 100%; text-align: left; }
.sw-item:hover { background: var(--hover); }
.sw-item.on { background: var(--yellow-soft); }
.sw-item .nm { font-size: 15px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-item .meta { font-size: 12px; color: var(--muted); font-weight: 400; }
.sw-item .del { opacity: 0; color: var(--muted); width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.sw-item:hover .del { opacity: 1; }
.sw-item .del:hover { background: #e9e9e9; color: #c0392b; }
.sw-add { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; width: 100%; font-size: 15px; font-weight: 500; }
.sw-add:hover { background: var(--hover); }
.sw-add .plus { width: 32px; height: 32px; border-radius: 8px; background: #f0f0f0; display: grid; place-items: center; font-size: 20px; color: var(--muted-2); }
.sw-sep { height: 1px; background: var(--line); margin: 6px 0; }
.sw-list { max-height: 60vh; overflow: auto; }

/* ---------- classroom grid ---------- */
main.wrap { padding-top: 24px; padding-bottom: 64px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.course-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: box-shadow .15s; }
.course-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.10); }
.cover { position: relative; aspect-ratio: 1460 / 752; background: #ececec; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 22px; font-weight: 900; color: #fff; padding: 16px; text-align: center; line-height: 1.15; }
.lock { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; align-content: center; gap: 8px; font-size: 15px; font-weight: 500; }
.lock svg { width: 34px; height: 34px; }
.cbody { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ctitle { font-size: 16px; font-weight: 700; line-height: 1.3; }
.cdesc { font-size: 15px; color: var(--muted-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cfoot { margin-top: auto; padding-top: 8px; }
.bar { position: relative; height: 22px; border-radius: 11px; background: #ededed; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 11px; transition: width .3s; }
.bar > b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); }
.bar.thin { height: 8px; border-radius: 4px; }
.bar.thin > i { border-radius: 4px; }

.page-meta { margin-top: 28px; display: flex; gap: 16px; justify-content: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.page-meta a, .page-meta button { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.page-meta a:hover, .page-meta button:hover { color: var(--text); }

/* ---------- course view ---------- */
.course { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 140px; max-height: calc(100vh - 164px); display: flex; flex-direction: column; overflow: hidden; }
.side-head { padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.side-head h1 { margin: 0 0 12px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.side-head .pct { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted-2); }
.side-head .pct .bar { flex: 1; }
.side-list { overflow: auto; padding: 8px 0 12px; }
.set-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 12px 20px; font-size: 15px; font-weight: 700; }
.set-row:hover { background: var(--hover); }
.set-row .chev { margin-left: auto; color: var(--muted); transition: transform .15s; flex: none; }
.set-row.closed .chev { transform: rotate(-90deg); }
.set-row .cnt { font-size: 12px; color: var(--muted); font-weight: 400; flex: none; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 10px 20px; font-size: 15px; line-height: 1.35; border-radius: 0; }
.lrow.in { padding-left: 32px; }
.lrow:hover { background: var(--hover); }
.lrow.on { background: var(--yellow); }
.lrow .lt { flex: 1; min-width: 0; }
.lrow .chk { width: 20px; height: 20px; flex: none; color: var(--green); }
.lrow .lk { width: 16px; height: 16px; flex: none; color: var(--muted); }

.lesson { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 32px 32px; min-width: 0; }
.lhead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.lhead h2 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25; flex: 1; }
.done-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #cfcfcf; display: grid; place-items: center; color: transparent; flex: none; transition: all .15s; }
.done-btn:hover { border-color: var(--green); color: #a6dfc3; }
.done-btn.on { background: var(--green); border-color: var(--green); color: #fff; }
.done-btn svg { width: 20px; height: 20px; }
.more-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted-2); flex: none; }
.more-btn:hover { background: var(--hover); }

.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; margin-bottom: 24px; }
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .offline { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; color: #fff; text-align: center; padding: 24px; background: #111 center / cover no-repeat; }
.player .offline::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.player .offline > * { position: relative; }
.player .offline p { margin: 0; font-size: 15px; opacity: .9; max-width: 420px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 8px; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; background: var(--yellow); color: var(--text); }
.btn:hover { background: #f5c95f; }
.btn.ghost { background: #fff; border: 1px solid var(--line); text-transform: none; font-weight: 500; }
.btn.ghost:hover { background: var(--hover); }

.rich { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.rich p { margin: 0 0 12px; }
.rich h2, .rich h3, .rich h4, .rich h5 { margin: 20px 0 10px; line-height: 1.3; }
.rich h2 { font-size: 22px; } .rich h3 { font-size: 19px; } .rich h4, .rich h5 { font-size: 17px; }
.rich a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.rich ul, .rich ol { margin: 0 0 12px; padding-left: 24px; }
.rich li > p { margin: 0 0 4px; }
.rich img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.rich blockquote { margin: 0 0 12px; padding: 4px 16px; border-left: 4px solid var(--line); color: var(--muted-2); }
.rich pre { background: #f4f4f4; padding: 12px 16px; border-radius: 8px; overflow: auto; font-size: 14px; }
.rich code { background: #f4f4f4; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.rich pre code { background: none; padding: 0; }
.rich hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.rich .embed { position: relative; aspect-ratio: 16 / 9; margin: 12px 0; border-radius: 8px; overflow: hidden; }
.rich .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.res { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.res h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.res-list { display: flex; flex-wrap: wrap; gap: 8px; }
.res-item { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-weight: 500; max-width: 100%; }
.res-item:hover { background: var(--hover); }
.res-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-item svg { width: 16px; height: 16px; flex: none; color: var(--muted-2); }

details.transcript { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
details.transcript summary { cursor: pointer; font-weight: 700; font-size: 15px; }
details.transcript div { margin-top: 10px; white-space: pre-wrap; color: var(--muted-2); font-size: 15px; line-height: 1.6; max-height: 360px; overflow: auto; }

.lnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

.side-toggle { display: none; }

/* ---------- empty / import ---------- */
.empty-state { max-width: 640px; margin: 48px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }
.empty-state h1 { margin: 0 0 8px; font-size: 26px; }
.empty-state > p { color: var(--muted-2); font-size: 16px; margin: 0 0 24px; }
.how { text-align: left; display: grid; gap: 14px; }
.how .step { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.how .step h3 { margin: 0 0 6px; font-size: 16px; }
.how .step p, .how .step ol { margin: 0; color: var(--muted-2); font-size: 14.5px; line-height: 1.55; }
.how .step ol { padding-left: 20px; }
.how code { background: #f2f2f2; padding: 1px 6px; border-radius: 4px; font-size: 13px; color: var(--text); user-select: all; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-bg[hidden] { display: none; }
.modal { position: relative; background: #fff; border-radius: 12px; max-width: 620px; width: 100%; max-height: 90vh; overflow: auto; padding: 32px; }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal > div > p { color: var(--muted-2); margin: 0 0 20px; font-size: 15px; }
.modal-x { position: absolute; top: 12px; right: 14px; font-size: 28px; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; }
.modal-x:hover { background: var(--hover); color: var(--text); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .top-row { gap: 10px; }
  .search { display: none; }
  .brand-name { font-size: 16px; max-width: 52vw; }
  .avatar, .top-right .icon-btn { width: 36px; height: 36px; }
  .top-right { margin-left: auto; }
  .tabs { height: 46px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  main.wrap { padding-top: 16px; }
  .course { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .side { position: static; max-height: none; }
  .side.collapsed .side-list { display: none; }
  .side-toggle { display: inline-flex; margin-top: 12px; }
  .lesson { padding: 18px 16px 24px; }
  .lhead h2 { font-size: 20px; }
  .player { margin-left: -16px; margin-right: -16px; border-radius: 0; }
  .switcher { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
  .empty-state, .modal { padding: 24px 18px; }
}

/* ---------- login / users ---------- */
body.logged-out .search, body.logged-out .top-right, body.logged-out .tabs, body.logged-out .switch-btn { display: none; }
.avatar { cursor: pointer; border: 0; }
.top-right { position: relative; }
.user-menu { position: absolute; top: 50px; right: 0; width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14); z-index: 30; padding: 6px; }
.um-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.um-head span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.um-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 15px; color: var(--text); text-align: left; }
.um-item:hover { background: var(--hover); }
.um-item svg { color: var(--muted-2); }

.auth { min-height: calc(100vh - 180px); display: grid; place-items: center; padding: 32px 0; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; }
.skool-word { font-weight: 900; font-size: 34px; letter-spacing: -.5px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.auth-note { margin: 0; color: var(--muted-2); font-size: 14px; text-align: center; }
.auth-card label, .uform label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; color: var(--muted-2); }
.auth-card input, .uform input:not([type=checkbox]), .uform select { height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); background: #fff; outline: none; width: 100%; }
.auth-card input:focus, .uform input:focus, .uform select:focus { border-color: #b9b9b9; box-shadow: 0 0 0 3px var(--yellow-soft); }
.auth-btn { justify-content: center; height: 46px; margin-top: 4px; }
.btn:disabled { opacity: .6; cursor: default; }
.auth-err { background: #fdecea; color: #b3261e; border-radius: 8px; padding: 10px 12px; font-size: 14px; }

.users-page { padding: 32px 0 64px; }
.users-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.users-head h1 { margin: 0 0 6px; font-size: 26px; }
.users-head p { margin: 0; color: var(--muted-2); font-size: 15px; max-width: 620px; }
.users-head .btn { flex: none; }
.users-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.urow { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.urow + .urow { border-top: 1px solid var(--line); }
.uav { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #f7a54a, #ef6a3a); color: #fff; font-weight: 700; display: grid; place-items: center; flex: none; }
.uinfo { flex: 1; min-width: 0; }
.uname { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.umail { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--yellow-soft); color: #8a6512; padding: 2px 8px; border-radius: 999px; }
.badge.you { background: #eef2fb; color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f2f2f2; border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 13px; }
.chip.all, .chip.none { padding-left: 10px; }
.chip.none { color: var(--muted); }
.logo.xs { width: 20px; height: 20px; border-radius: 50%; font-size: 10px; }
.uact { display: flex; align-items: center; gap: 4px; flex: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }

.uform { display: flex; flex-direction: column; gap: 14px; }
.uform .opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.pw { display: flex; gap: 8px; }
.pw input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace !important; }
.pw .btn { height: 44px; flex: none; }
.school-picks { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.school-picks legend { font-weight: 500; font-size: 14px; color: var(--muted-2); padding: 0 6px; }
.uform .pick { flex-direction: row; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 15px; }
.uform .pick:hover { background: var(--hover); }
.pick input { width: 18px; height: 18px; accent-color: #202124; flex: none; }
.admin-note { display: none; margin: 4px 8px; }
.uform.is-admin .pick { display: none; }
.uform.is-admin .admin-note { display: block; }
.uform-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.creds { background: #f6f6f6; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; font: 14px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }

@media (max-width: 760px) {
  .users-head { flex-direction: column; }
  .urow { flex-wrap: wrap; }
  .uact { width: 100%; justify-content: flex-end; }
  .auth-card { padding: 28px 20px; }
}
[hidden] { display: none !important; }
