:root {
  --red: #ed1c24; --red-d: #c4141b; --red-l: #fdeaeb;
  --ink: #1c1d22; --ink-2: #5a5e6a; --ink-3: #8a8e9a;
  --line: #e2e4ea; --bg: #f1f2f5; --card: #ffffff;
  --ok: #12805c; --ok-l: #dcf4ea; --warn: #a65f00; --warn-l: #fff0d1; --bad: #c4141b; --bad-l: #fdeaeb;
  --board: #14161b; --board-2: #1d2027; --amber: #ffb81c;
  --r: 14px; --r-s: 8px;
  --head: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--body); color: var(--ink); background: var(--bg); }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 800; } h2 { font-size: 1.35rem; font-weight: 800; } h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 1em; } a { color: var(--red-d); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #1c6dff66; outline-offset: 2px; border-radius: 6px; }
.boot { display: grid; place-items: center; height: 100vh; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .6; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-2); } .small { font-size: .875rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; }
.stack > * + * { margin-top: 1rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 1.1rem .85rem; z-index: 30; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1.2rem; color: #fff; text-decoration: none; font-family: var(--head); font-weight: 800; line-height: 1.1; font-size: 1.05rem; }
.brand img { width: 40px; height: 40px; background: #fff; border-radius: 12px; padding: 4px; }
.brand small { display: block; font-weight: 600; font-size: .78rem; color: #ffffff99; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-title { font-size: .75rem; color: #ffffff77; padding: 1rem .7rem .35rem; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: #ffffffcc; text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: #ffffff14; color: #fff; }
.nav a.active { background: var(--red); color: #fff; }
.ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-user { display: flex; align-items: center; gap: .65rem; padding: .8rem .5rem 0; border-top: 1px solid #ffffff22; margin-top: .6rem; }
.side-user .name { font-weight: 700; font-size: .92rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .role { font-size: .78rem; color: #ffffff88; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #ddd; object-fit: cover; flex: none; }
.avatar.sm { width: 28px; height: 28px; } .avatar.lg { width: 84px; height: 84px; border: 4px solid #fff; }
.icon-btn { background: none; border: 0; padding: .45rem; border-radius: 8px; cursor: pointer; color: inherit; display: inline-grid; place-items: center; }
.icon-btn:hover { background: #ffffff1f; }
.main { min-width: 0; }
.topbar { display: none; align-items: center; gap: .6rem; padding: .6rem .9rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar b { font-family: var(--head); }
.content { padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 4rem; max-width: 1180px; margin: 0 auto; }
.scrim { display: none; }

/* ---------- ui ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin-bottom: .7rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head h1 { margin: 0; } .page-head p { margin: .25rem 0 0; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: .6rem 1rem; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s; }
.btn:hover { background: #f6f7f9; border-color: #c9ccd4; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; } .btn.primary:hover { background: var(--red-d); border-color: var(--red-d); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; } .btn.dark:hover { background: #33353d; }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: var(--bad-l); border-color: #f2b5b8; }
.btn.sm { padding: .38rem .7rem; font-size: .88rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 700; background: #eceef2; color: var(--ink-2); white-space: nowrap; }
.badge.red { background: var(--red-l); color: var(--red-d); } .badge.ok { background: var(--ok-l); color: var(--ok); } .badge.warn { background: var(--warn-l); color: var(--warn); } .badge.dark { background: var(--ink); color: #fff; }
.grid { display: grid; gap: 1rem; } .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.stat { padding: 1rem 1.15rem; } .stat .n { font-family: var(--head); font-size: 2rem; font-weight: 800; line-height: 1; } .stat .l { color: var(--ink-2); font-size: .88rem; margin-top: .4rem; font-weight: 600; }
.stat.hot .n { color: var(--red); }
.bar { height: 8px; background: #e8eaee; border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--red); border-radius: 99px; transition: width .3s; } .bar.ok > i { background: var(--ok); }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--ink-2); } .empty b { display: block; color: var(--ink); font-family: var(--head); font-size: 1.1rem; margin-bottom: .3rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1.1rem; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: .65rem 1rem; font-weight: 700; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--red-d); border-color: var(--red); }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .85rem; font-weight: 700; font-size: .88rem; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* forms */
label.f { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .9rem; }
label.f > span { display: block; margin-bottom: .3rem; } label.f small { font-weight: 500; color: var(--ink-2); }
input[type=text], input[type=search], input[type=number], input[type=datetime-local], select, textarea { width: 100%; padding: .6rem .75rem; border: 1px solid #cfd2da; border-radius: 10px; background: #fff; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid #ed1c2433; border-color: var(--red); }
.check { display: flex; gap: .55rem; align-items: center; font-weight: 600; cursor: pointer; } .check input { width: 18px; height: 18px; accent-color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }

/* tables */
.table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; color: var(--ink-2); padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; } tr:last-child td { border-bottom: 0; }
.cell-user { display: flex; align-items: center; gap: .65rem; } .cell-user b { display: block; line-height: 1.2; }
.actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- hero / login ---------- */
.hero { border-radius: var(--r); overflow: hidden; background: var(--red); color: #fff; margin-bottom: 1.2rem; }
.hero-strip { display: block; width: 100%; height: auto; }
.hero-body { padding: 1.4rem 1.8rem 1.7rem; }
.hero h1 { color: #fff; margin: 0 0 .3rem; font-size: 2rem; } .hero p { margin: 0; color: #ffffffee; max-width: 56ch; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--red); position: relative; color: #fff; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.login-art .strip { display: block; width: calc(100% + 6rem); max-width: none; margin: 0 -3rem 1.6rem; height: auto; }
.login-art .art-body { padding: 3rem; }
.login-art img.star { width: 84px; background: #fff; border-radius: 22px; padding: 12px; margin-bottom: 1.6rem; }
.login-art h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); font-weight: 900; margin: 0 0 .6rem; color: #fff; }
.login-art p { max-width: 36ch; color: #ffffffee; font-size: 1.1rem; margin: 0; }
.login-form { display: grid; place-items: center; padding: 2rem; }
.login-box { width: min(400px, 100%); }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; width: 100%; padding: .85rem 1rem; font-size: 1.02rem; } .btn.discord:hover { background: #4752c4; border-color: #4752c4; }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; } .alert.bad { background: var(--bad-l); color: var(--bad); } .alert.warn { background: var(--warn-l); color: var(--warn); } .alert.ok { background: var(--ok-l); color: var(--ok); }

/* ---------- boarding pass cards ---------- */
.passes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.pass { display: grid; grid-template-columns: 1fr 104px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); position: relative; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.pass:hover { border-color: var(--red); transform: translateY(-2px); }
.pass-main { padding: 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.pass-main h3 { margin: 0; font-size: 1.12rem; } .pass-main p { margin: 0; color: var(--ink-2); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pass-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; padding-top: .3rem; }
.pass-stub { border-left: 2px dashed #cfd2da; padding: 1rem .6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .2rem; position: relative; background: #fafafb; border-radius: 0 var(--r) var(--r) 0; }
.pass-stub::before, .pass-stub::after { content: ""; position: absolute; left: -9px; width: 16px; height: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 50%; }
.pass-stub::before { top: -9px; } .pass-stub::after { bottom: -9px; }
.pass-stub .big { font-family: var(--head); font-weight: 800; font-size: 1.5rem; line-height: 1; } .pass-stub .cap { font-size: .72rem; color: var(--ink-2); font-weight: 700; }
.pass.done .pass-stub { background: var(--ok-l); } .pass.done .big { color: var(--ok); }
.pass.late .pass-stub { background: var(--bad-l); } .pass.late .big { color: var(--bad); }

/* ---------- departures board ---------- */
.board { background: var(--board); color: #f4f4f4; border-radius: var(--r); overflow: hidden; }
.board-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; background: var(--red); font-family: var(--head); font-weight: 800; font-size: 1.15rem; }
.board-head span { font-weight: 600; font-size: .9rem; opacity: .9; }
.board-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 160px 150px; gap: 1rem; align-items: center; padding: .85rem 1.25rem; border-bottom: 1px solid #ffffff14; text-decoration: none; color: inherit; }
a.board-row:hover { background: var(--board-2); }
.board-row.cols { color: #ffffff77; font-size: .78rem; font-weight: 700; padding-top: .7rem; padding-bottom: .7rem; background: #0e1014; }
.board-time { font-family: var(--mono); color: var(--amber); font-weight: 700; font-size: .98rem; }
.board-time small { display: block; color: #ffffff88; font-weight: 500; font-size: .76rem; }
.board-name b { display: block; font-size: 1.02rem; } .board-name span { color: #ffffff88; font-size: .84rem; }
.board-count { font-family: var(--mono); font-weight: 700; }
.board-status { font-weight: 800; font-size: .88rem; font-family: var(--mono); } .s-ok { color: #4ade80; } .s-soon { color: var(--amber); } .s-late { color: #ff6b6b; } .s-none { color: #ffffff88; } .s-prog { color: #7cc4ff; }
.board-group { padding: .5rem 1.25rem; font-weight: 800; font-size: .85rem; color: #fff; background: #ffffff0f; }
.board-empty { padding: 2rem; text-align: center; color: #ffffff88; }

/* ---------- course page ---------- */
.course-head { display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1.2rem; }
.course-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
.lesson-list { list-style: none; margin: 0; padding: 0; } .lesson-list li a { display: flex; gap: .7rem; padding: .75rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .95rem; align-items: flex-start; }
.lesson-list li:last-child a { border-bottom: 0; } .lesson-list li a:hover { background: #f7f8fa; } .lesson-list li a.active { background: var(--red-l); }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c3c6ce; flex: none; display: grid; place-items: center; color: #fff; margin-top: 1px; } .dot.on { background: var(--ok); border-color: var(--ok); } .dot .ico { width: 13px; height: 13px; stroke-width: 3; }
.prose { max-width: 70ch; font-size: 1.04rem; line-height: 1.7; } .prose h2 { font-size: 1.6rem; margin-top: 0; } .prose h3 { font-size: 1.25rem; margin-top: 1.6em; } .prose h4 { font-size: 1.05rem; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; } .prose li { margin-bottom: .3em; }
.prose blockquote { margin: 1.2em 0; padding: .8rem 1.1rem; background: var(--red-l); border-left: 4px solid var(--red); border-radius: 0 10px 10px 0; font-weight: 600; }
.prose code { background: #eef0f3; padding: .1em .4em; border-radius: 5px; font-family: var(--mono); font-size: .9em; } .prose img { border-radius: 10px; } .prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }

/* ---------- quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.q-count { font-weight: 700; color: var(--ink-2); font-size: .9rem; margin-bottom: .5rem; }
.q-text { font-family: var(--head); font-size: 1.4rem; font-weight: 800; line-height: 1.3; margin: .9rem 0 1.2rem; }
.opts { display: grid; gap: .6rem; }
.opt { display: flex; gap: .85rem; align-items: center; text-align: left; width: 100%; padding: .85rem 1rem; border: 2px solid var(--line); background: #fff; border-radius: 12px; cursor: pointer; font-weight: 600; transition: border-color .12s, background .12s; }
.opt:hover:not([disabled]) { border-color: #b9bcc6; background: #fafafb; }
.opt .key { width: 30px; height: 30px; border-radius: 8px; background: #eceef2; display: grid; place-items: center; font-weight: 800; font-size: .88rem; flex: none; }
.opt.sel { border-color: var(--ink); } .opt.sel .key { background: var(--ink); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-l); } .opt.right .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-l); } .opt.wrong .key { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.explain { margin-top: 1rem; padding: .9rem 1.1rem; border-radius: 12px; background: #fff; border: 1px solid var(--line); animation: pop .2s ease-out; } .explain.good { border-color: var(--ok); } .explain.bad { border-color: var(--bad); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.exam-bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: .7rem 0; margin-bottom: 1rem; }
.timer { font-family: var(--mono); font-weight: 800; font-size: 1.2rem; padding: .3rem .8rem; border-radius: 10px; background: var(--ink); color: #fff; } .timer.low { background: var(--red); }
.exam-q { margin-bottom: 1rem; }
.result { text-align: center; padding: 2rem 1.2rem; }
.ring { --v: 0; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; background: conic-gradient(var(--c, var(--red)) calc(var(--v) * 1%), #e8eaee 0); }
.ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--head); font-size: 2.1rem; font-weight: 900; }
.review-item { padding: 1rem 0; border-bottom: 1px solid var(--line); } .review-item:last-child { border-bottom: 0; }
.review-item .a { padding: .35rem .7rem; border-radius: 8px; margin-top: .35rem; font-size: .93rem; font-weight: 600; background: #f3f4f6; } .review-item .a.right { background: var(--ok-l); color: var(--ok); } .review-item .a.wrong { background: var(--bad-l); color: var(--bad); }

/* ---------- editor ---------- */
.ed-item { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fff; margin-bottom: .8rem; }
.ed-item-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .7rem; } .ed-item-head b { flex: 1; font-family: var(--head); }
.opt-edit { display: flex; gap: .5rem; align-items: center; margin-bottom: .45rem; } .opt-edit input[type=radio] { accent-color: var(--ok); width: 18px; height: 18px; flex: none; }
.save-bar { position: sticky; bottom: 0; background: #fffffff2; backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .8rem 1.25rem; margin: 1.2rem -1.25rem -1.25rem; display: flex; gap: .6rem; justify-content: flex-end; align-items: center; border-radius: 0 0 var(--r) var(--r); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: #0b0c10aa; display: grid; place-items: center; padding: 1rem; z-index: 100; animation: fade .15s; }
.modal { background: #fff; border-radius: var(--r); padding: 1.5rem; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; animation: pop .18s ease-out; } .modal.wide { width: min(760px, 100%); }
.modal h3 { font-size: 1.25rem; } .modal .foot { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: .75rem 1.1rem; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px #0004; animation: pop .2s; max-width: 340px; } .toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .22s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: #0008; z-index: 25; }
  .topbar { display: flex; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .course-layout { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login-art .art-body { padding: 1.6rem; } .login-art .strip { width: calc(100% + 3.2rem); margin: 0 -1.6rem 1rem; } .login-art img.star { width: 56px; margin-bottom: 1rem; }
  .board-row { grid-template-columns: 110px minmax(0, 1fr) 120px; } .board-row .board-count { display: none; } .board-row.cols span:nth-child(3) { display: none; }
}
@media (max-width: 620px) {
  .grid.cols-2, .grid.cols-3, .form-grid { grid-template-columns: 1fr; } .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .passes { grid-template-columns: 1fr; } .pass { grid-template-columns: 1fr 88px; }
  .board-row { grid-template-columns: 1fr auto; } .board-row .board-time { grid-column: 1 / -1; } .board-row.cols { display: none; }
  h1 { font-size: 1.55rem; } .hero-body { padding: 1.1rem 1.2rem 1.3rem; } .hero h1 { font-size: 1.55rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
