:root {
  --navy: #002e5d;
  --navy-2: #0b3d73;
  --blue: #0062b8;
  --sky: #e8f1fb;
  --ink: #14213d;
  --muted: #5b6b82;
  --line: #e3e8ef;
  --bg: #f6f8fb;
  --card: #ffffff;
  --green: #12805c;
  --green-bg: #e6f5ef;
  --red: #c0392b;
  --red-bg: #fdecea;
  --amber: #b26a00;
  --amber-bg: #fff4e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3d8bfd, #7fc1ff); display: grid; place-items: center; font-weight: 800; color: var(--navy); }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 12px; opacity: .7; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #dfe9f6; text-decoration: none; padding: 9px 10px; border-radius: 10px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: #fff; color: var(--navy); font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.soon { margin-left: auto; font-size: 10px; background: rgba(255,255,255,.18); padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; font-size: 12px; opacity: .75; }
.side-foot button { background: none; border: 0; color: #fff; opacity: .8; padding: 0; cursor: pointer; text-decoration: underline; }
main { padding: 28px 36px 60px; max-width: 1180px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: 13px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--sky); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label.f { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=password], select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd7f5; border-color: var(--blue); }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--sky); color: var(--navy); font-weight: 600; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.gray { background: #eef1f5; color: var(--muted); }
.toggle { display: inline-flex; background: #eef2f7; border-radius: 10px; padding: 3px; }
.toggle button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.toggle button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch input { width: 36px; height: 20px; appearance: none; background: #cfd8e3; border-radius: 99px; position: relative; cursor: pointer; transition: .15s; }
.switch input::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .15s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 18px; }
.note { background: var(--amber-bg); color: #6b4300; border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-top: 10px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.ghost .spinner, .loading .spinner { border-color: #c9d6e6; border-top-color: var(--navy); }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 18px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* today */
.hero { background: linear-gradient(120deg, var(--navy), #11508f); color: #fff; border: 0; }
.hero h1 { color: #fff; }
.hero .muted { color: #cfe0f5; }
.task { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task .tico { width: 40px; height: 40px; border-radius: 12px; background: var(--sky); display: grid; place-items: center; font-size: 18px; flex: none; }
.task .tt { font-weight: 600; }
.task .btn { margin-left: auto; }
.bar { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar.good > i { background: var(--green); }
.bar.bad > i { background: var(--red); }
.bar.mid > i { background: #e0a100; }
.subj { display: grid; grid-template-columns: 1fr 120px 44px; gap: 12px; align-items: center; padding: 7px 0; font-size: 14px; }

/* flashcards */
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.deck { cursor: pointer; padding: 16px; transition: .12s; }
.deck:hover { border-color: var(--blue); transform: translateY(-1px); }
.deck b { display: block; }
.flash { max-width: 760px; margin: 0 auto; }
.face { min-height: 220px; font-size: 19px; line-height: 1.6; padding: 30px; }
.face .cloze { color: var(--blue); font-weight: 700; }
.face .extra { font-size: 14px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 14px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.rate button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 700; }
.rate button small { display: block; font-weight: 500; color: var(--muted); }
.rate .again { color: var(--red); } .rate .hard { color: var(--amber); } .rate .good { color: var(--green); } .rate .easy { color: var(--blue); }

/* questions */
.q { max-width: 820px; }
.stem { font-size: 16px; line-height: 1.65; white-space: pre-wrap; }
.choice { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; margin-top: 8px; cursor: pointer; }
.choice:hover:not(:disabled) { border-color: var(--blue); background: #fafcff; }
.choice .ltr { width: 26px; height: 26px; border-radius: 50%; background: #eef2f7; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.choice.right { border-color: var(--green); background: var(--green-bg); }
.choice.wrong { border-color: var(--red); background: var(--red-bg); }
.choice:disabled { cursor: default; color: inherit; opacity: 1; }
.task .row .btn { margin-left: 0; }
.explain { margin-top: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.sources { margin-top: 10px; }
.sources summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.src { font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--sky); margin-top: 8px; background: #fff; }
.src b { color: var(--navy); }

/* tutor */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.msgs { flex: 1; overflow-y: auto; padding: 6px 4px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 12px 15px; border-radius: 14px; }
.msg.user { white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .fu { margin-top: 10px; padding: 10px 12px; background: var(--sky); border-radius: 10px; font-weight: 600; color: var(--navy); }
.cite { font-size: 11px; background: var(--sky); color: var(--navy); border-radius: 6px; padding: 0 5px; font-weight: 700; }
.composer { display: flex; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.composer textarea { min-height: 52px; height: 52px; }

/* faculty */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.risk td { background: #fff8f7; }
.item { margin-bottom: 14px; }
.item textarea.stem-edit { min-height: 120px; }
.choices-edit { display: grid; gap: 6px; }
.choices-edit .row { flex-wrap: nowrap; }
.choices-edit input[type=radio] { width: auto; }
.hist { font-size: 12px; color: var(--muted); margin-top: 10px; }
.steps { display: flex; gap: 6px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.steps span { padding: 3px 9px; border-radius: 99px; background: #eef1f5; color: var(--muted); }
.steps span.on { background: var(--navy); color: #fff; }
.steps span.done { background: var(--green-bg); color: var(--green); }
.vp { text-align: center; padding: 60px 30px; }
.vp .big { font-size: 54px; }

/* gate */
.gate { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy), #11508f); padding: 20px; }
.gate .card { width: 100%; max-width: 420px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; overflow-x: auto; gap: 8px; }
  .brand { padding: 0 6px 0 0; }
  .brand b { white-space: nowrap; }
  .brand span, .nav-label, .side-foot, .soon { display: none; }
  .nav { display: flex; gap: 4px; }
  #fac-nav:not(.hidden) { display: contents; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  main { padding: 18px 14px 50px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: 1fr 1fr; }
  .rate { grid-template-columns: 1fr 1fr; }
  .chat { height: calc(100vh - 260px); }
  table.t { display: block; overflow-x: auto; }
}
