/* BYU MED AI: navy and royal on ice. Bricolage Grotesque for headings, Public Sans for text. */
:root {
  --navy: #002e5d;
  --navy-deep: #001a38;
  --royal: #0062b8;
  --royal-soft: #dbe9f8;
  --ice: #eef3f9;
  --ice-2: #e3ebf5;
  --card: #ffffff;
  --ink: #0f1b2d;
  --muted: #5a6a80;
  --line: #d9e2ee;
  --mint: #138a68;
  --mint-bg: #e2f5ee;
  --coral: #d9363e;
  --coral-bg: #fdecec;
  --amber: #9a5b00;
  --amber-bg: #fff3dc;
  --display: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
  --text: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-1: 0 1px 2px rgba(0, 46, 93, .06);
  --shadow-2: 0 2px 4px rgba(0, 46, 93, .05), 0 12px 32px -12px rgba(0, 46, 93, .18);
  color: var(--ink);
  font-family: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ice); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--royal); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); color: var(--navy); margin: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.1; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 14px; }
h3 { font-size: 15px; font-weight: 650; margin-bottom: 8px; }
p { max-width: 72ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.i { flex: none; display: block; }
:focus-visible { outline: 2.5px solid var(--royal); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--navy); color: #fff; padding: 22px 14px 18px;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(0, 98, 184, .45), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; text-decoration: none; color: #fff; }
.brand img { height: 30px; width: auto; display: block; }
.brand .wm { white-space: nowrap; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; line-height: 1; }
.brand .sub { font-size: 12px; color: #b9cde6; line-height: 1.2; border-left: 1px solid rgba(255,255,255,.25); padding-left: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; color: #8fabcf; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; color: #d6e3f3; text-decoration: none;
  padding: 9px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: #fff; color: var(--navy); font-weight: 650; box-shadow: 0 6px 18px -8px rgba(0,0,0,.5); }
.nav a.active .i { color: var(--royal); }
.soon { margin-left: auto; font-size: 11px; color: #b9cde6; border: 1px solid rgba(255,255,255,.22); padding: 0 8px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--royal); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.side-foot .who { flex: 1; min-width: 0; line-height: 1.25; }
.side-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { color: #9fb8d8; font-size: 12px; }
.side-foot button { background: none; border: 0; color: #b9cde6; cursor: pointer; padding: 6px; border-radius: 8px; }
.side-foot button:hover { background: rgba(255,255,255,.1); color: #fff; }
main { padding: 34px clamp(18px, 4vw, 48px) 72px; max-width: 1200px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.head .muted { max-width: 64ch; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); padding: 22px; }
.card.flat { background: var(--ice-2); border-color: transparent; box-shadow: none; }
.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: 18px 20px; display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-family: var(--display); font-size: 32px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; line-height: 1.1; display: flex; align-items: center; gap: 8px; }
.stat .v .i { color: #e8742a; }
.stat .l { font-size: 13px; color: var(--muted); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; background: var(--royal); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  transition: background .15s, transform .1s;
}
.btn:hover { background: #00539c; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--ice); }
.btn.sm { padding: 6px 13px; font-size: 13.5px; }
.btn.green { background: var(--mint); }
.btn.red { background: var(--coral); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label.f { display: block; font-size: 13.5px; font-weight: 600; margin: 14px 0 6px; color: var(--navy); }
input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 4px var(--royal-soft); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--royal-soft); color: var(--navy); font-weight: 600; }
.pill.green { background: var(--mint-bg); color: var(--mint); }
.pill.red { background: var(--coral-bg); color: var(--coral); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.gray { background: var(--ice-2); color: var(--muted); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.chip .i { opacity: 0; width: 0; transition: opacity .12s, width .12s; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.on .i { opacity: 1; width: 14px; }
.chip.on .muted { color: #b9cde6; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.toggle { display: inline-flex; background: var(--ice-2); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.toggle button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.toggle button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow-1); }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; font-weight: 500; }
.switch input { width: 38px; height: 22px; appearance: none; background: #c5d2e3; border-radius: 99px; position: relative; cursor: pointer; transition: .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { left: 18px; }
.note { background: var(--amber-bg); color: #6b4300; border-radius: 12px; padding: 11px 15px; font-size: 13.5px; }
.err { background: var(--coral-bg); color: var(--coral); border-radius: 12px; padding: 11px 15px; font-size: 14px; margin-top: 10px; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h2 { margin-bottom: 6px; }
.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: var(--line); border-top-color: var(--royal); }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 18px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Today: the one bold moment ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.mission {
  position: relative; overflow: hidden; border-radius: 24px; padding: 30px; color: #fff;
  background: linear-gradient(155deg, var(--navy) 0%, var(--navy-deep) 100%);
  box-shadow: var(--shadow-2);
}
.mission::before {
  content: ""; position: absolute; inset: auto -20% -55% auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 98, 184, .55), transparent 65%); pointer-events: none;
}
.mission .date { color: #9fb8d8; font-size: 14px; }
.mission h1 { color: #fff; font-size: clamp(30px, 3.4vw, 42px); margin: 4px 0 10px; }
.mission .lede { color: #c9d8ec; max-width: 46ch; margin: 0 0 22px; }
.mission-top { display: flex; gap: 24px; align-items: center; justify-content: space-between; position: relative; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: rgba(255,255,255,.14); }
.ring .fill { stroke: #6fb4ff; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .lbl b { font-family: var(--display); font-size: 34px; display: block; }
.ring .lbl span { font-size: 12px; color: #9fb8d8; }
.steps-list { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.steps-list li {
  counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 14px;
}
.steps-list li::before {
  content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(111,180,255,.18); color: #cfe5ff; font-weight: 700; font-size: 13.5px; font-family: var(--display);
}
.steps-list .tt { font-weight: 600; color: #fff; }
.steps-list .dd { font-size: 13px; color: #a9c0de; }
.steps-list .go { display: inline-flex; align-items: center; gap: 6px; color: #fff; background: var(--royal); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; text-decoration: none; }
.steps-list .go:hover { background: #1677d1; }
.side-stats { display: grid; align-content: start; gap: 16px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.bar { height: 8px; background: var(--ice-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--royal); border-radius: 99px; }
.bar.good > i { background: var(--mint); }
.bar.bad > i { background: var(--coral); }
.bar.mid > i { background: #e0a100; }
.subj { display: grid; grid-template-columns: minmax(0, 1fr) 120px 46px; gap: 12px; align-items: center; padding: 8px 0; font-size: 14px; }
.subj b { text-align: right; font-variant-numeric: tabular-nums; }

/* generic task rows (materials) */
.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(--royal-soft); color: var(--royal); display: grid; place-items: center; flex: none; }
.task .tt { font-weight: 600; }

/* ---------- flashcards ---------- */
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.deck { display: flex; flex-direction: column; gap: 4px; padding: 18px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.deck:hover { border-color: var(--royal); box-shadow: var(--shadow-2); }
.deck b { font-family: var(--display); font-weight: 650; font-size: 16px; color: var(--navy); }
.deck .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--royal-soft); color: var(--royal); display: grid; place-items: center; margin-bottom: 8px; }
.flash { max-width: 780px; margin: 0 auto; }
.face {
  min-height: 260px; font-size: 20px; line-height: 1.6; padding: 40px 44px; border-radius: 22px; box-shadow: var(--shadow-2);
}
.face.flip { animation: flip .32s ease-out; }
@keyframes flip { from { transform: perspective(900px) rotateX(10deg); opacity: .4; } to { transform: none; opacity: 1; } }
.face img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; display: block; }
.face .cloze { color: var(--royal); font-weight: 700; background: var(--royal-soft); border-radius: 6px; padding: 0 5px; }
.face .extra { font-size: 14.5px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 22px; padding-top: 16px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.rate button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 13px; cursor: pointer; font-weight: 700; font-size: 15px; transition: border-color .15s, background .15s; }
.rate button:hover { background: var(--ice); }
.rate button small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.rate .again { color: var(--coral); } .rate .hard { color: var(--amber); } .rate .good { color: var(--mint); } .rate .easy { color: var(--royal); }
.rate .again:hover { border-color: var(--coral); } .rate .hard:hover { border-color: #e0a100; } .rate .good:hover { border-color: var(--mint); } .rate .easy:hover { border-color: var(--royal); }

/* ---------- questions ---------- */
.q { max-width: 840px; }
.stem { font-size: 16.5px; line-height: 1.7; white-space: pre-wrap; }
.choice {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 14px; padding: 13px 15px; margin-top: 9px; cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover:not(:disabled) { border-color: var(--royal); background: #f7fbff; }
.choice .ltr { width: 28px; height: 28px; border-radius: 50%; background: var(--ice-2); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.choice.right { border-color: var(--mint); background: var(--mint-bg); }
.choice.right .ltr { background: var(--mint); color: #fff; }
.choice.wrong { border-color: var(--coral); background: var(--coral-bg); }
.choice.wrong .ltr { background: var(--coral); color: #fff; }
.choice:disabled { cursor: default; color: inherit; opacity: 1; }
.explain { margin-top: 18px; background: var(--ice); border-radius: 14px; padding: 18px; }
.sources { margin-top: 12px; }
.sources summary { cursor: pointer; font-size: 13.5px; color: var(--royal); font-weight: 600; }
.src { font-size: 13.5px; padding: 9px 12px; border-left: 3px solid var(--royal-soft); margin-top: 8px; background: #fff; border-radius: 0 10px 10px 0; }
.src b { color: var(--navy); }

/* ---------- tutor ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 440px; padding: 0; overflow: hidden; }
.msgs { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(#fff, #fafcff); }
.msg { max-width: 80%; padding: 13px 16px; border-radius: 18px; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-1); }
.msg .fu { margin-top: 12px; padding: 11px 13px; background: var(--royal-soft); border-radius: 12px; font-weight: 600; color: var(--navy); }
.cite { font-size: 11px; background: var(--royal-soft); color: var(--royal); border-radius: 6px; padding: 1px 6px; font-weight: 700; vertical-align: 1px; }
.composer { display: flex; gap: 10px; border-top: 1px solid var(--line); padding: 14px; background: #fff; align-items: flex-end; }
.composer textarea { min-height: 50px; height: 50px; border-radius: 14px; }

/* ---------- faculty ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.risk td { background: #fff7f7; }
.item { margin-bottom: 16px; }
.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; accent-color: var(--mint); }
.hist { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.steps { display: flex; gap: 6px; align-items: center; font-size: 12.5px; flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 99px; background: var(--ice-2); color: var(--muted); font-weight: 600; }
.steps span.on { background: var(--navy); color: #fff; }
.steps span.done { background: var(--mint-bg); color: var(--mint); }
.task .row .btn { margin-left: 0; }
.vp { text-align: center; padding: 64px 30px; }
.vp .big { width: 72px; height: 72px; border-radius: 22px; background: var(--royal-soft); color: var(--royal); display: grid; place-items: center; margin: 0 auto 16px; }

/* ---------- gate ---------- */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(90% 70% at 15% 10%, #0a4f96 0%, transparent 60%), var(--navy-deep);
}
.gate .card { width: 100%; max-width: 420px; border-radius: 22px; padding: 30px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); }
.gate .brand { color: var(--navy); padding: 0 0 22px; }
.gate .brand .sub { color: var(--muted); border-left-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 980px) {
  .today { grid-template-columns: minmax(0, 1fr); }
}
@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; background-image: none; }
  .brand { padding: 0 6px 0 4px; }
  .brand .sub, .nav-label, .side-foot, .soon { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  #fac-nav:not(.hidden) { display: contents; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  main { padding: 20px 14px 56px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4, .mini-stats { grid-template-columns: 1fr 1fr; }
  .mission { padding: 22px; border-radius: 20px; }
  .mission-top { flex-direction: column-reverse; align-items: flex-start; }
  .steps-list li { grid-template-columns: 30px minmax(0, 1fr); }
  .steps-list .go { grid-column: 2; justify-self: start; }
  .rate { grid-template-columns: 1fr 1fr; }
  .chat { height: calc(100vh - 250px); }
  table.t { display: block; overflow-x: auto; }
  .face { padding: 26px 22px; font-size: 18px; }
}

.qlinks{margin-top:14px;padding-top:10px;border-top:1px dashed #d5dfeb;font-size:13px;color:#4b5b70}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
@media (max-width:860px){.grid2{grid-template-columns:1fr}}
.tbl{width:100%;border-collapse:collapse}.tbl th,.tbl td{text-align:left;padding:6px 8px;border-bottom:1px solid #e6ecf3}
.callout{background:var(--ice,#eef3f9);border-radius:12px;padding:12px 14px}
.pday summary{cursor:pointer;list-style:none}.pday summary::-webkit-details-marker{display:none}
.ptask{display:flex;gap:12px;align-items:center;padding:12px 0;border-top:1px solid #e6ecf3}.ptask:first-of-type{margin-top:10px}
.ptask input{width:20px;height:20px;flex:none;accent-color:var(--royal,#0062b8)}
.ptask .ico{color:var(--royal,#0062b8);flex:none}.ptask.done>div:not(.ico){opacity:.5;text-decoration:line-through}
.ptask .ids{margin-top:6px;word-break:break-word;color:#4b5b70}
@media (max-width:640px){.ptask{flex-wrap:wrap}.ptask .btn{margin-left:32px}}
