/* Cyberjurist Academy — chat-first, mobile-first UI.
   WhatsApp-like layout and interaction grammar; own palette and type. */
:root {
  --head: #0B3A46;         /* deep teal-ink header */
  --head-2: #0F4C5C;
  --accent: #E8A33D;       /* saffron */
  --accent-ink: #4A2E00;
  --green: #1F9D72;
  --red: #C8463D;
  --amber: #C98A12;
  --bg: #F5F2EC;
  --panel: #FFFFFF;
  --line: #E6E0D6;
  --text: #13232A;
  --muted: #5E7078;
  --wall: #ECE6DC;
  --wall-dot: rgba(11, 58, 70, .06);
  --in: #FFFFFF;
  --out: #DCF2E6;
  --chip: #FFFFFF;
  --chip-line: #CFE3DA;
  --sel: #EAF4F0;
  --shadow: 0 1px 1.5px rgba(16, 35, 42, .13);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, 'Lucida Grande', Arial, Ubuntu, Cantarell, 'Fira Sans', 'Noto Sans', sans-serif;  /* WhatsApp: SF on Apple, Roboto on Android, Segoe UI on Windows */
  --serif: var(--font);   /* WhatsApp uses one sans-serif family everywhere */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1418; --panel: #111C21; --line: #22323A; --text: #E7EEF0; --muted: #93A6AD;
    --wall: #0A1216; --wall-dot: rgba(232, 163, 61, .05); --in: #1A2830; --out: #0E4A3C; --chip: #16242B; --chip-line: #24414A; --sel: #15302B;
    --shadow: 0 1px 1.5px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.2px; line-height: 1.34; letter-spacing: normal; word-spacing: normal; font-kerning: normal; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
a { color: var(--head-2); }
@media (prefers-color-scheme: dark) { a { color: #7FD1BB; } }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
code { background: var(--sel); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.boot { margin: auto; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; min-height: 42px; }
.btn.primary { background: var(--head-2); border-color: var(--head-2); color: #fff; }
.btn.primary:hover { background: var(--head); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.block { width: 100%; margin-top: 8px; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.btn-col .btn { justify-content: flex-start; border-radius: 10px; }

/* ---------- auth / onboarding ---------- */
.auth-screen { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 24px 16px 40px; background:
  radial-gradient(1200px 500px at 50% -200px, var(--head-2), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--panel); border-radius: 16px; padding: 24px 20px; box-shadow: 0 10px 40px rgba(11,58,70,.18); margin-top: 12px; }
.auth-card.wide { max-width: 640px; }
.brand { text-align: center; margin-bottom: 14px; }
.brand .logo img { width: 64px; height: 64px; }
.brand h1 { font-family: var(--serif); font-size: 28px; margin: 6px 0 2px; }
.brand .tag { margin: 0; color: var(--muted); font-size: 14px; }
.brand .issuers { margin: 8px 0 0; font-size: 11.5px; text-transform: uppercase; color: var(--head-2); font-weight: 700; }
@media (prefers-color-scheme: dark) { .brand .issuers { color: var(--accent); } }
form label, .auth-card > label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 0; color: var(--muted); }
form label input, .auth-card > label input { margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--text); }
label.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--head-2); }
.hint { font-size: 12px; margin-top: 3px; } .hint.ok { color: var(--green); } .hint.no { color: var(--red); }
.form-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.notice { background: var(--sel); padding: 12px 14px; border-radius: 8px; font-size: 13px; margin: 12px 0; }
.notice.ok { border-color: var(--green); }
.notice b { display: block; margin-bottom: 4px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.pw-meter { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.pw-meter[data-s="3"] span { background: var(--amber); } .pw-meter[data-s="4"] span, .pw-meter[data-s="5"] span { background: var(--green); }
.demo-banner { background: #FFF3CD; color: #5C4400; font-size: 12.5px; padding: 8px 12px; border-radius: 8px; max-width: 640px; text-align: center; }
.onb-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.onb-head h2 { margin: 0; font-family: var(--serif); }
.onb-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.q { font-weight: 700; margin: 18px 0 8px; font-size: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--chip-line); background: var(--chip); border-radius: 18px; padding: 7px 13px; cursor: pointer; font-size: 13.5px; text-align: left; }
.pill small { display: block; color: var(--muted); font-size: 11px; }
.pill.on { background: var(--head-2); color: #fff; border-color: var(--head-2); }
.pill.on small { color: #cfe; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 1fr; height: 100dvh; overflow: hidden; }
#side, #main { min-height: 0; height: 100dvh; overflow: hidden; }
#side { display: flex; flex-direction: column; background: var(--panel); }
#main { display: none; background: var(--wall); }
.shell.show-main #side { display: none; }
.shell.show-main #main { display: flex; flex-direction: column; }
@media (min-width: 900px) {
  .shell { grid-template-columns: minmax(340px, 30%) 1fr; max-width: 1600px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); }
  .shell #side, .shell.show-main #side { display: flex; border-right: 1px solid var(--line); }
  .shell #main, .shell.show-main #main { display: flex; flex-direction: column; }
  .chat-head .back, .page-head .back { display: none; }
}
.top { background: var(--head); color: #fff; padding: 12px 16px 0; padding-top: max(12px, env(safe-area-inset-top)); }
.top-row { display: flex; align-items: center; justify-content: space-between; }
.app-title { font-family: var(--serif); font-size: 21px; font-weight: 700; }
.top-icons { display: flex; gap: 6px; }
.ico { background: none; border: 0; color: inherit; font-size: 18px; padding: 6px 8px; border-radius: 50%; cursor: pointer; text-decoration: none; }
.ico:hover { background: rgba(255,255,255,.12); }
.tabs { display: flex; margin-top: 10px; }
.tab { flex: 1; text-align: center; color: rgba(255,255,255,.72); text-decoration: none; font-weight: 700; font-size: 13.5px; padding: 10px 4px 11px; border-bottom: 3px solid transparent; text-transform: uppercase; }
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; font-size: 11px; background: rgba(255,255,255,.18); padding: 1px 6px; border-radius: 9px; }
.chat-list { flex: 1; overflow-y: auto; }
.archived { position: relative; display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.archived > span { font-size: 22px; width: 48px; text-align: center; }
.archived .sub { font-size: 12.5px; color: var(--muted); }
.stretch { position: absolute; inset: 0; }
.chat-row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.chat-row:hover, .chat-row.active { background: var(--sel); }
.chat-row.locked { opacity: .62; }
.avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: #fff; background: var(--head-2); }
.avatar.big { width: 64px; height: 64px; font-size: 30px; }
.cr-mid { flex: 1; min-width: 0; }
.cr-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-sub.done { color: #2B8AC9; }
.cr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cr-time { font-size: 11.5px; color: var(--muted); }
.badge { background: var(--green); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; }
.side-foot { font-size: 11px; color: var(--muted); padding: 10px 16px; border-top: 1px solid var(--line); }

/* ---------- welcome ---------- */
.welcome { margin: auto; text-align: center; padding: 30px 20px; max-width: 520px; }
.welcome-logo { width: 96px; opacity: .95; }
.welcome h2 { font-family: var(--serif); font-size: 28px; margin: 12px 0 6px; }

/* ---------- chat ---------- */
.chat, .assess { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; background: var(--head); color: #fff; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); flex: none; }
.chat-head .avatar { width: 40px; height: 40px; font-size: 19px; }
.back { color: #fff; text-decoration: none; font-size: 30px; line-height: 1; padding: 0 6px 4px; }
.ch-mid { flex: 1; min-width: 0; }
.ch-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.ch-status { font-size: 12px; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-status.typing { color: var(--accent); font-style: italic; }
.chat-body { flex: 1; overflow-y: auto; padding: 12px 4% 18px; display: flex; flex-direction: column; gap: 3px;
  background-color: var(--wall);
  background-image: radial-gradient(var(--wall-dot) 1.2px, transparent 1.3px), radial-gradient(var(--wall-dot) 1.2px, transparent 1.3px);
  background-size: 22px 22px; background-position: 0 0, 11px 11px; scroll-padding-bottom: 20px; }
.chat-foot { flex: none; background: var(--bg); padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); min-height: 56px; }
.sys-chip, .date-chip { align-self: center; font-size: 12px; background: color-mix(in srgb, var(--panel) 85%, var(--accent)); color: var(--muted); padding: 5px 12px; border-radius: 8px; margin: 8px 0; box-shadow: var(--shadow); text-align: center; max-width: 90%; }
.sys-chip { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); color: var(--text); }
.date-chip.section { font-weight: 700; color: var(--text); text-transform: uppercase; font-size: 11.5px; margin-top: 16px; }
.msg { position: relative; max-width: min(78%, 560px); padding: 7px 10px 18px; border-radius: var(--radius); box-shadow: var(--shadow); word-wrap: break-word; margin: 2px 0; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }
.msg.in { align-self: flex-start; background: var(--in); border-top-left-radius: 2px; min-width: 120px; }
.msg.out { align-self: flex-end; background: var(--out); border-top-right-radius: 2px; min-width: 112px; }
.msg.wide { max-width: min(92%, 640px); width: 100%; }
.msg .meta { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ticks { color: #3E9FD6; font-size: 11px; letter-spacing: -2px; }
.vn { background: none; border: 0; padding: 0 2px; cursor: pointer; font-size: 12px; opacity: .7; }
.vn.playing { opacity: 1; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.txt { font-size: 15px; }
.bubble-head { font-size: 11.5px; font-weight: 700; color: var(--head-2); margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { .bubble-head { color: var(--accent); } }
.ref-tag { background: var(--sel); padding: 1px 7px; border-radius: 6px; }
.tag-q { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 35%, transparent); padding: 1px 8px; border-radius: 6px; }
@media (prefers-color-scheme: dark) { .tag-q { color: #FFE2B0; } }
.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-2px); } }

/* chips (quick replies) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.chip { border: 1px solid var(--chip-line); background: var(--chip); color: var(--head-2); font-weight: 600; border-radius: 18px; padding: 9px 15px; cursor: pointer; text-align: left; font-size: 14px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .chip { color: #9FE3CF; } }
.chip:hover { background: var(--sel); }
.chip.ghost { box-shadow: none; }
.composer { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.fake-input { flex: 1; background: var(--panel); border-radius: 20px; padding: 10px 14px; font-size: 14px; }
.send { border-radius: 22px; }

/* cards */
.card-lab { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.card-title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.card-stat { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--head-2); line-height: 1.1; margin: 4px 0; }
@media (prefers-color-scheme: dark) { .card-stat { color: var(--accent); } }
.card { --k: var(--head-2); background: color-mix(in srgb, var(--k) 8%, transparent); padding: 10px 12px; border-radius: 10px; }
.card.k-caution { --k: var(--red); } .card.k-practice { --k: var(--green); } .card.k-illustration { --k: #6A4C93; }
.card.k-stat, .card.k-news { --k: var(--accent); } .card.k-foryou { --k: #2B8AC9; } .card.k-statute { --k: var(--head-2); }
.card-ref { font-size: 12px; color: var(--muted); margin-top: 6px; }
.casefile { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cf-top { display: flex; gap: 10px; align-items: center; background: var(--sel); padding: 10px; }
.cf-ico { font-size: 26px; } .cf-title { font-weight: 700; } .cf-cite { font-size: 12px; color: var(--muted); }
.cf-row { padding: 8px 10px; border-top: 1px solid var(--line); font-size: 14px; }
.cf-row b { display: block; font-size: 11.5px; text-transform: uppercase; color: var(--muted); }
.cf-row.lesson { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cf-link { display: block; padding: 8px 10px; border-top: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--sel); font-size: 12px; }
.tline ol { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--accent); }
.tline li { position: relative; padding: 4px 0 8px 8px; }
.tline li::before { content: ''; position: absolute; left: -21px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--in); }
.tl-when { display: block; font-weight: 700; font-size: 13px; color: var(--head-2); }
@media (prefers-color-scheme: dark) { .tl-when { color: var(--accent); } }
.summary ul { margin: 4px 0 8px; padding-left: 20px; } .summary li { margin: 3px 0; }
.refs { border-top: 1px dashed var(--line); padding-top: 6px; font-size: 13px; }

/* polls & activities */
.poll-q { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.poll-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin: 6px 0; cursor: pointer; font-size: 14px; }
.opt:hover:not(:disabled) { background: var(--sel); }
.opt:disabled { cursor: default; }
.opt .radio, .opt .check { width: 18px; height: 18px; flex: none; border: 2px solid var(--muted); border-radius: 50%; margin-top: 1px; }
.opt .check { border-radius: 4px; }
.opt.picked .radio, .opt.picked .check { border-color: var(--head-2); background: radial-gradient(var(--head-2) 45%, transparent 50%); }
.opt.multi.picked .check { background: var(--head-2); }
.opt.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.fb { display: none; margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 14px; background: var(--sel); }
.fb.show { display: block; } .fb.no { background: color-mix(in srgb, var(--amber) 14%, transparent); }
.myth-item { border-top: 1px solid var(--line); padding: 8px 0; }
.myth-s { font-weight: 600; } .myth-v { font-size: 12.5px; font-weight: 700; margin: 2px 0; }
.myth-item.ok .myth-v { color: var(--green); } .myth-item.no .myth-v { color: var(--red); }
.myth-why { font-size: 13.5px; color: var(--muted); }
.myth-ask { background: var(--sel); border-radius: 8px; padding: 10px; margin-top: 6px; font-size: 15px; }
.ord-ans { margin: 6px 0; padding-left: 24px; min-height: 8px; }
.ord-li { background: var(--sel); border-radius: 6px; padding: 6px 8px; margin: 4px 0; cursor: pointer; font-size: 14px; }
.ord-li.right { background: color-mix(in srgb, var(--green) 15%, transparent); } .ord-li.wrong { background: color-mix(in srgb, var(--red) 12%, transparent); }
.ord-src { display: flex; flex-wrap: wrap; gap: 6px; }
.m-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.m-row select { padding: 7px; font-size: 13px; }
.m-row.right { background: color-mix(in srgb, var(--green) 10%, transparent); } .m-row.wrong { background: color-mix(in srgb, var(--red) 8%, transparent); }
.m-correct { grid-column: 1 / -1; font-size: 12.5px; color: var(--green); }
@media (max-width: 420px) { .m-row { grid-template-columns: 1fr; } }
.mock { border: 8px solid #1d1d1f; border-radius: 22px; background: #fff; color: #111; overflow: hidden; max-width: 340px; margin: 8px auto; }
.mock-bar { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 12px; background: #f2f2f2; font-weight: 700; }
.mock-row { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #eee; background: #fff; color: #111; padding: 9px 12px; font-size: 13.5px; cursor: pointer; }
.mock-row.btn-look { background: #0A7D5A; color: #fff; text-align: center; font-weight: 700; margin: 6px 0; }
.mock-row.small-print { font-size: 10.5px; color: #777; }
.mock-row.big { font-size: 16px; font-weight: 700; }
.mock-row.flag { outline: 2px dashed var(--amber); outline-offset: -3px; background: #FFF8E6; color: #111; }
.mock-row.bad { box-shadow: inset 4px 0 0 var(--red); }
.reflect textarea { margin-top: 6px; }
.flash-card { width: 100%; min-height: 120px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, var(--sel), var(--panel)); cursor: pointer; padding: 18px 14px; font-size: 15.5px; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.flash-card.flipped { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.fc-front { font-weight: 700; } .fc-hint { font-size: 11px; color: var(--muted); }
.scen-head { background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 10px 12px; border-radius: 10px; }
.msg.scen-fb.good { background: color-mix(in srgb, var(--green) 14%, var(--in)); } .msg.scen-fb.bad { background: color-mix(in srgb, var(--red) 12%, var(--in)); }
.msg.scen-end { background: color-mix(in srgb, var(--accent) 18%, var(--in)); }
.end-card { align-self: center; text-align: center; background: var(--panel); border-radius: 14px; padding: 18px; margin: 18px 0; box-shadow: 0 6px 24px rgba(0,0,0,.12); max-width: 440px; }
.end-emoji { font-size: 44px; }
.end-card h3 { margin: 4px 0; font-family: var(--serif); font-size: 22px; }

/* assessment */
.assess-body { flex: 1; overflow-y: auto; padding: 14px 4% 90px; }
.aq { background: var(--panel); border-radius: 12px; padding: 12px 14px; margin: 10px 0; box-shadow: var(--shadow); }
.aq-n { font-size: 12px; font-weight: 700; color: var(--muted); }
.aq-q { font-weight: 700; margin: 2px 0 8px; }
.aq-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; cursor: pointer; font-size: 14px; }
.aq-opt input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--head-2); }
.aq-opt:has(input:checked) { border-color: var(--head-2); background: var(--sel); }
.assess-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; background: var(--panel); padding: 10px 14px; border-radius: 12px; box-shadow: 0 -2px 14px rgba(0,0,0,.1); }
.result { text-align: center; background: var(--panel); border-radius: 14px; padding: 18px; }
.result h3 { font-family: var(--serif); font-size: 24px; margin: 4px 0; }
.result.pass h3 { color: var(--green); } .result.fail h3 { color: var(--amber); }
.aq.review.ok { background: color-mix(in srgb, var(--green) 9%, var(--panel)); } .aq.review.no { background: color-mix(in srgb, var(--red) 8%, var(--panel)); }
.rv-line { font-size: 14px; } .rv-line.ok { color: var(--green); font-weight: 600; } .rv-line.no { color: var(--red); }
.rv-exp { font-size: 13.5px; background: var(--sel); padding: 8px 10px; border-radius: 8px; margin-top: 6px; }

/* pages */
.page { flex: 1; overflow-y: auto; padding: 0 0 40px; background: var(--bg); }
.page > *:not(.page-head) { margin-left: 16px; margin-right: 16px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: center; gap: 8px; background: var(--head); color: #fff; padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 2; }
.page-head h2 { margin: 0; font-size: 18px; }
.page h4 { margin-top: 22px; margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; align-items: center; }
.stat, .ring { background: var(--panel); border-radius: 12px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; font-family: var(--serif); } .stat small, .ring small { color: var(--muted); }
.ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) var(--p), var(--line) 0); padding: 10px; margin: auto; }
.ring > div { background: var(--panel); width: 100%; height: 100%; border-radius: 50%; display: grid; place-content: center; }
.ring b { font-size: 24px; font-family: var(--serif); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.bdg { background: var(--panel); border-radius: 12px; padding: 8px 4px; text-align: center; opacity: .5; box-shadow: var(--shadow); }
.bdg.on { opacity: 1; background: color-mix(in srgb, var(--accent) 20%, var(--panel)); }
.bdg span { font-size: 24px; display: block; } .bdg small { font-size: 11px; font-weight: 700; }
.case-mod { margin-top: 20px; }
.case-item { background: var(--panel); border-radius: 10px; padding: 10px 12px; margin: 8px 0; box-shadow: var(--shadow); font-size: 14px; }
.case-item summary { cursor: pointer; }
.case-item.locked { opacity: .55; }
.prof { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 16px; font-size: 14px; }
.kv span { color: var(--muted); }
.admin-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; }
@media (max-width: 700px) { .admin-form { grid-template-columns: 1fr; } }

/* certificate */
.cert-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cert { background: #FFFDF8; color: #1b2a30; margin-top: 14px; border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,.15); aspect-ratio: 297 / 210; max-width: 1000px; padding: 2.2%; container-type: inline-size; }
.cert-inner { height: 100%; border: 3px double #B88A2E; outline: 1px solid #0B3A46; outline-offset: -10px; padding: 3% 6%; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between;
  background: radial-gradient(circle at 50% 120%, rgba(232,163,61,.12), transparent 60%); }
.cert-issuers { display: flex; justify-content: space-between; width: 100%; font-size: 1.5cqw; font-weight: 700; text-transform: uppercase; color: #0B3A46; }
.cert-logo { width: 7cqw; }
.cert-kicker { font-family: var(--serif); font-size: 4.2cqw; color: #0B3A46; }
.cert-pre, .cert-text, .cert-org { font-size: 1.7cqw; color: #445; }
.cert-name { font-family: var(--serif); font-size: 4.6cqw; color: #8A5A00; border-bottom: 1px solid #B88A2E; padding: 0 4cqw .4cqw; }
.cert-course { font-family: var(--serif); font-size: 2.6cqw; font-weight: 700; color: #0B3A46; }
.cert-mods { font-size: 1.05cqw; color: #667; max-width: 92%; }
.cert-meta { display: flex; gap: 3cqw; font-size: 1.5cqw; font-weight: 700; }
.cert-sigs { display: flex; justify-content: space-around; width: 100%; }
.sig { display: flex; flex-direction: column; align-items: center; font-size: 1.2cqw; }
.sig-line { width: 18cqw; border-bottom: 1px solid #333; height: 3.4cqw; }
.cert-code { font-size: 1.15cqw; color: #445; font-family: var(--font); }
.cert-law { font-size: 1cqw; color: #889; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: fixed; inset: 0; margin: 0; width: 297mm; height: 210mm; max-width: none; box-shadow: none; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; padding: 18px; max-width: 560px; width: 100%; max-height: 85dvh; overflow-y: auto; }
.modal h3 { margin-top: 0; font-family: var(--serif); }
.modal-body { font-size: 14px; } .modal-body textarea { margin-top: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 20px); background: #1d2b31; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .25s; z-index: 60; max-width: 92vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #136B4E; } .toast.err { background: #9B2C25; }

/* verify page */
.verify { max-width: 520px; margin: 40px auto; padding: 0 16px; }
.verify .res { margin-top: 16px; }

/* ---------- partner branding ---------- */
.partners { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; align-items: center; font-size: 11.5px; color: var(--muted); }
.partner { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.partner-lab { font-size: 10px; text-transform: uppercase; font-weight: 700; }
.partner-id { display: flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; }
.partner-id img { width: 28px; height: 28px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.partners.auth { margin-top: 18px; max-width: 520px; }
.partners.side { padding: 10px 8px; border-top: 1px solid var(--line); gap: 8px; flex-wrap: nowrap; align-items: flex-start; }
.partners.side .partner { flex: 1; min-width: 0; }
.partners.side .partner-lab { font-size: 9px; }
.partners.side .partner-id { flex-direction: column; gap: 3px; font-size: 10.5px; line-height: 1.25; }
.partners.side .partner-id img { width: 26px; height: 26px; }
.partners.page { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.brand .logo img { width: 84px; height: auto; }
.welcome-logo { width: 110px; height: auto; }
.welcome-brand { font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--head-2); }
.cert-brand { display: flex; align-items: center; justify-content: center; gap: 1.5cqw; font-family: var(--serif); font-size: 2.4cqw; font-weight: 700; color: #0B3A46; }
.cert-brand .cert-logo { width: 6cqw; height: auto; }
.cert-partners { display: flex; justify-content: center; gap: 6cqw; width: 100%; border-top: 1px solid #e3d7bd; padding-top: .8cqw; }
.cert-partners .cp { display: flex; align-items: center; gap: .8cqw; font-size: 1.35cqw; color: #334; }
.cert-partners .cp small { display: block; font-size: 1cqw; text-transform: uppercase; color: #778; }
.cert-partners .cp b, .cert-partners .cp small { white-space: nowrap; text-align: left; }
.cert-partners .cp > div { text-align: left; }
.cert-partners .cp img { width: 4.4cqw; height: 4.4cqw; object-fit: contain; }
.verify-card .partners { margin-top: 18px; }

/* ===================== v2: tiers, credentials, exam, public pages ===================== */
.grp { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 16px 4px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 11.5px; text-transform: uppercase; color: var(--head-2); }
.grp span { text-transform: none; color: var(--muted); font-size: 12px; }
.chat-row.upsell { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.chat-row.upsell .cr-time { color: var(--head-2); font-weight: 700; }
.archived.active { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
.plan-chip { display: inline-block; background: var(--sel); color: var(--head-2); border: 1px solid var(--chip-line); border-radius: 14px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tier-card { background: var(--panel); border-radius: 14px; padding: 14px 16px; margin: 12px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.tier-card h3 { margin: 0 0 6px; font-size: 16px; }
.tier-card .kv { margin: 8px 0; }
.tier-card.locked { border-style: dashed; }
.tier-card ul { padding-left: 18px; margin: 6px 0; font-size: 14px; }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tier-grid .tier-card { margin: 0; }
.tier-certified { border-top: 4px solid #5B1F2E; } .tier-practitioner { border-top: 4px solid var(--head-2); } .tier-awareness { border-top: 4px solid #2E6F8E; }
.serif { font-family: var(--serif); }

/* credentials */
.cred-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px !important; }
.cred-tab { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; text-decoration: none; color: inherit; font-size: 13px; }
.cred-tab small { display: block; color: var(--muted); }
.cred-tab.on { border-color: var(--head-2); box-shadow: 0 0 0 2px var(--head-2) inset; }
.cred-tab.have small { color: var(--green); font-weight: 700; }
.btn.li { background: #0A66C2; border-color: #0A66C2; color: #fff; }
.li-logo { background: #fff; color: #0A66C2; font-weight: 700; border-radius: 3px; padding: 0 4px; font-size: 12px; line-height: 16px; }
.cert-inner { position: relative; }
.cert-qr { position: absolute; right: 3.2%; bottom: 7%; width: 9cqw; text-align: center; }
.cert-qr svg { width: 100%; height: auto; display: block; }
.cert-qr small { font-size: .85cqw; color: #556; }
.cert-certified .cert-inner { border-color: #8A6A1E; outline-color: #5B1F2E; }
.cert-certified .cert-kicker { color: #5B1F2E; }
.cert-awareness .cert-inner { border-color: #4E8EAA; }
.cred-extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0; margin-top: 10px; }
.cred-extras .tier-card { margin: 12px 0; } .cred-extras > * { margin-left: 8px; margin-right: 8px; }
.badge-box { display: flex; gap: 14px; align-items: center; background: var(--panel); border-radius: 14px; padding: 12px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.badge-art svg { width: 120px; height: auto; display: block; }
.badge-box p { margin: 4px 0; }
.status { display: inline-block; border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.status.valid { background: #DDF3E8; color: #11643F; } .status.expired { background: #FBEFD5; color: #7A5200; } .status.revoked { background: #F9DEDC; color: #8C1D18; }

/* assignment */
.case-brief { background: var(--panel); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.tasks li { margin: 6px 0; } .tasks .mk { color: var(--muted); white-space: nowrap; }
.asg-text { min-height: 360px; line-height: 1.55; }

/* proctored exam */
.cam-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 16px; }
@media (max-width: 700px) { .cam-row { grid-template-columns: 1fr; } }
.cam-big { width: 100%; max-width: 420px; aspect-ratio: 4 / 3; background: #000; border-radius: 12px; object-fit: cover; transform: scaleX(-1); }
.id-prev { width: 100%; max-width: 320px; border-radius: 10px; margin-top: 6px; border: 2px solid var(--green); }
.exam { display: flex; flex-direction: column; height: 100%; background: var(--bg); user-select: none; }
.exam textarea { user-select: text; }
.ex-head { display: flex; align-items: center; gap: 12px; background: #2A0F17; color: #fff; padding: 8px 14px; position: sticky; top: 0; z-index: 3; }
.ex-head > div:first-child { flex: 1; } .ex-head .muted { color: #D9C3C8; }
.ex-timer { font: 500 20px/1 var(--font); font-variant-numeric: tabular-nums; background: rgba(255,255,255,.1); padding: 6px 10px; border-radius: 8px; }
.ex-timer.low { background: var(--red); }
.cam-mini { width: 84px; height: 63px; object-fit: cover; border-radius: 8px; background: #000; transform: scaleX(-1); border: 2px solid #E8C26A; }
.ex-body { overflow-y: auto; padding: 8px 16px 80px; max-width: 920px; width: 100%; margin: 0 auto; }
.ex-sec { font-family: var(--serif); margin: 22px 0 6px; color: #5B1F2E; }
.ex-q textarea { min-height: 120px; }
.fs-warn { position: fixed; inset: 0; background: rgba(20, 8, 12, .86); color: #fff; display: flex; align-items: center; justify-content: center; text-align: center; z-index: 50; padding: 20px; }
.fs-warn[hidden] { display: none; }

/* examiner */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 16px; }
.gallery figure { margin: 0; } .gallery img { width: 100%; border-radius: 8px; display: block; }
.gallery figcaption { font-size: 11px; color: var(--muted); }
.flag-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.flagpill { display: inline-block; background: var(--sel); border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.flagpill.hi { background: #FBE3D4; color: #8C3A12; }
.cand-ans { white-space: pre-wrap; background: var(--sel); border-radius: 8px; padding: 10px; font-size: 14px; }
.cand-ans.long { max-height: 60vh; overflow-y: auto; }
.mark-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.mark-row input:not(.mk-in) { flex: 1; min-width: 200px; }
.mk-in { width: 80px !important; display: inline-block; }

/* public pages */
body.pub { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.pub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--head); color: #fff; padding: 10px 16px; }
.pub-head nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pub-head nav a { color: #D7E6E9; text-decoration: none; font-weight: 600; font-size: 14px; }
.pub-head nav a.on { color: #fff; border-bottom: 2px solid var(--accent); }
.pub-head nav a.btn { color: #fff; background: var(--accent-ink); border-color: var(--accent); }
.pub-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: var(--serif); font-size: 19px; font-weight: 700; }
.pub-brand img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.pub-main { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 16px 30px; }
.pub-hero { padding: 28px 0 8px; }
.pub-hero h1, .pub-sec h1 { font-family: var(--serif); font-size: clamp(24px, 4vw, 34px); margin: 0 0 8px; }
.pub-sec { padding: 12px 0; }
.pub-sec h2 { font-family: var(--serif); border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 2px; }
.pub-sec .kv { margin: 10px 0; }
.pub-sec .admin-form { grid-template-columns: 2fr 1fr auto; }
@media (max-width: 700px) { .pub-sec .admin-form { grid-template-columns: 1fr; } }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.toc { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.toc a { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; font-size: 13px; text-decoration: none; }
.pol { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pol .tier-card { margin: 0; } .pol p { font-size: 14px; margin: 0; }
.board { text-align: center; } .board .avatar { margin: 0 auto 6px; }
.pub-foot { border-top: 1px solid var(--line); padding: 14px 16px 24px; text-align: center; background: var(--panel); }
.pub-foot .partners { justify-content: center; }
.cred-card { display: flex; gap: 20px; align-items: flex-start; background: var(--panel); border-radius: 16px; padding: 18px; margin-top: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.08); border-top: 5px solid var(--green); }
.cred-card.expired { border-top-color: var(--amber); } .cred-card.revoked { border-top-color: var(--red); }
.cred-card h2 { font-family: var(--serif); margin: 6px 0 2px; font-size: 26px; }
.cred-card .cred-name { font-weight: 700; color: var(--head-2); }
.cred-card .kv { margin: 12px 0; }
.cred-card .badge-art svg { width: 160px; }
@media (max-width: 640px) { .cred-card { flex-direction: column; align-items: center; text-align: center; } .cred-card .kv { text-align: left; } }
@media print { .cert-qr { display: block; } }

.cred-card .status { display: inline-block; margin-bottom: 2px; }
.cred-card h2 { display: block; border: 0; padding: 0; }
.shell.exam-mode { grid-template-columns: 1fr !important; }
.shell.exam-mode #side { display: none !important; }
.shell.exam-mode #main { display: flex !important; flex-direction: column; }
.badge-box { flex-wrap: wrap; }

/* ---------- WhatsApp typography ---------- */
.msg { font-size: 14.2px; line-height: 19px; }
.msg .meta { font-size: 11px; }
.app-title { font-size: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cr-title { font-size: 16px; font-weight: 400; }
.cr-sub { font-size: 14px; }
.cr-time { font-size: 12px; }
.ch-title { font-size: 16px; font-weight: 500; }
.ch-status { font-size: 13px; }
.tab { font-size: 14px; font-weight: 500; }
h1, h2, h3, h4, .brand h1, .welcome h2, .end-card h3, .result h3, .modal h3, .onb-head h2 { font-weight: 500; }
.btn { font-weight: 500; }
.app-ver { flex-basis: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.partners.side .app-ver { font-size: 10px; }
.partners.side { flex-wrap: wrap; } .partners.side .partner { flex: 1 1 0; }

/* ===================== v2.2: stacked "Brought to you by" credits ===================== */
.partners, .partners.side, .partners.auth, .partners.page { flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 12px; text-align: center; }
.partners .credits-title { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--muted); }
.partners .partner { flex: none; width: 100%; gap: 5px; }
.partners .partner-lab { font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.partners .partner-id { flex-direction: row; justify-content: center; gap: 9px; font-size: 13px; line-height: 1.3; }
.partners .partner-id img { width: 44px; height: 44px; border-radius: 8px; }
.partners.side { padding: 14px 10px; gap: 10px; }
.partners.side .partner-id { flex-direction: column; gap: 4px; font-size: 11px; }
.partners.side .partner-id img { width: 40px; height: 40px; }
.partners .disclaimer { max-width: 440px; font-size: 11.5px; line-height: 1.45; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
.partners.side .disclaimer { font-size: 10px; }
.partners .app-ver { flex-basis: auto; }
.brand .logo img { width: 150px; height: auto; border-radius: 12px; }
.welcome-logo { width: 150px; height: auto; border-radius: 12px; }
.pub-brand img { object-fit: contain; }

/* v2.2: "Brought to you by" shows just the two companies, side by side, each logo above its name */
.partners .credits-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-style: normal; font-family: inherit; font-weight: 600; color: var(--muted); }
.partners .partner-row { display: flex; justify-content: center; align-items: flex-start; gap: 0; width: 100%; max-width: 480px; }
.partners .partner-row .partner { flex: 1 1 0; width: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 2px 14px; }
.partners .partner-row .partner + .partner { border-left: 1px solid var(--line); }
.partners .partner-row .partner img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.partners .partner-name { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text); text-align: center; }
.partners.side .partner-row .partner { padding: 2px 6px; }
.partners.side .partner-row .partner img { width: 46px; height: 46px; }
.partners.side .partner-name { font-size: 10.5px; }
.partners.side .credits-title { font-size: 10px; }

/* v2.2: text header links instead of emoji icons; letters/numbers in avatars */
.top-row .ico, a.ico { font-size: 13px; font-weight: 600; border-radius: 8px; padding: 6px 10px; }
.avatar { font-weight: 700; font-family: var(--serif); }
.bdg span { font-size: 18px; font-weight: 700; }

/* v2.2: login shows the logo only; tagline set as the heading; credits hidden while studying; one-line disclaimer */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.brand .tag { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--text); margin-top: 8px; }
.shell.in-lesson .partners.side { display: none; }
.partners .disclaimer { max-width: none; white-space: nowrap; font-size: 11px; }
.partners.auth { max-width: 600px; }
.partners.side .disclaimer { white-space: normal; }
@media (max-width: 600px) { .partners .disclaimer { white-space: normal; } }
