:root {
  --accent: #F2E557;
  --ink: #1A1A18;
  --muted: #6B6A64;
  --line: #E7E5DC;
  --line2: #EFEDE6;
  --bg: #F6F5F0;
  --side: #141416;
  --red-bg: #FDECEC; --red: #B42318;
  --green-bg: #EEF6EC; --green: #2D6A1F;
  --gray-bg: #EFEDE6; --gray: #4A4945;
  --amber-bg: #FFF4D6; --amber: #8A5A00;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, "PingFang SC", "Hiragino Sans", "Noto Sans SC", system-ui, sans-serif; font-size: 14px; }
a { color: #5B5300; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0; font-size: 16px; }

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 240px; min-width: 200px; background: var(--side); color: #E9E8E2; padding: 28px 16px; display: flex; flex-direction: column; gap: 28px; }
.brand { padding: 0 8px; }
.brand b { display: block; font-size: 24px; color: var(--accent); letter-spacing: -.5px; }
.brand span { font-size: 12px; color: #9A9992; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #E9E8E2; text-decoration: none; }
.nav a:hover { background: #24242a; }
.nav a.on { background: var(--accent); color: #111; font-weight: 600; }
.nav svg { width: 18px; height: 18px; }
.side .who { margin-top: auto; padding: 0 8px; font-size: 12px; color: #8A8983; display: flex; flex-direction: column; gap: 8px; }
.side .who button { all: unset; cursor: pointer; color: #C9C8C2; text-decoration: underline; }
main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 700px) { main { padding: 20px 16px 48px; } .side { max-width: none; } }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.head p { margin: 6px 0 0; color: var(--muted); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 700; margin: 4px 0; }
.stat .n { font-size: 12px; color: var(--muted); }

.btn { height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid #DAD7CC; background: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9b5a6; }
.btn.dark { background: var(--side); color: var(--accent); border-color: var(--side); font-weight: 600; }
.btn.yellow { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { height: 38px; padding: 0 16px; border-radius: 99px; border: 1px solid #DAD7CC; background: #fff; cursor: pointer; }
.tabs button.on { background: var(--side); color: #fff; border-color: var(--side); }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); padding: 24px 12px; text-align: center; }

.tag { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.gray { background: var(--gray-bg); color: var(--gray); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--gray); }
.f input, .f select, .f textarea { height: 42px; border-radius: 10px; border: 1px solid #DAD7CC; padding: 0 12px; background: #fff; color: var(--ink); }
.f textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--side); }

.code { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
.drop { border: 2px dashed #CFCBBE; border-radius: 14px; padding: 18px; text-align: center; background: #FBFAF6; cursor: pointer; }
.bar { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--side); width: 0; transition: width .2s; }

.modal-bg { position: fixed; inset: 0; background: rgba(20, 20, 22, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 10; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal video { width: 100%; border-radius: 10px; background: #000; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--side); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--side); padding: 16px; }
.login form { background: #fff; border-radius: 20px; padding: 36px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login b { font-size: 30px; }
.login b span { background: var(--accent); padding: 0 6px; border-radius: 6px; }
.lesson { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.lesson:last-child { border-bottom: none; }
.lesson .t { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.modal.wide { width: min(760px, 100%); }
.langs { display: inline-flex; gap: 2px; padding: 3px; background: #24242a; border-radius: 99px; align-self: flex-start; }
.langs button, .side .who .langs button { all: unset; text-decoration: none; cursor: pointer; padding: 4px 10px; border-radius: 99px; font-size: 12px; color: #C9C8C2; }
.langs button.on, .side .who .langs button.on { background: var(--accent); color: #111; font-weight: 600; }
.login .langs { background: #EFEBDF; }
.login .langs button { color: var(--muted); }
.login .langs button.on { background: var(--side); color: var(--accent); }
