/* CB OMAS — shared styles. Sober and institutional: an exam screen, not an app. Light only, so every device shows
   the same thing; system fonts, so nothing has to be downloaded on a phone hotspot; every control ≥ 44 px. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #f6f8fa;
  --line: #d8dee5; --line-strong: #b4bec9;
  --ink: #1b2632; --ink-2: #445263; --muted: #657385;
  --primary: #1d4f7c; --primary-dark: #163d61; --primary-ink: #ffffff; --primary-soft: #e6eef6;
  --head: #14273b;
  --ok: #24724a; --ok-soft: #e4f2ea; --warn: #9a5b00; --warn-soft: #fbf0dc; --bad: #a8261d; --bad-soft: #fbe7e5;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid #5b9bd5; outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 56px; background: var(--head); color: #fff; position: sticky; top: 0; z-index: 5; }
.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; min-width: 0; flex: 0 1 auto; }
.top .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .brand img { flex: none; }
.top .btn, .top .who { flex: none; }
.top .brand img { width: 30px; height: 30px; background: #fff; border-radius: 4px; padding: 2px; }
.top .grow { flex: 1; }
.top .who { font-size: 14px; color: #c9d4df; }
.top .btn { min-height: 38px; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); font-size: 14px; }
.top .btn:hover { border-color: #fff; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.center { text-align: center; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.danger { color: var(--bad); border-color: #d9a4a0; }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.big { min-height: 54px; font-size: 18px; padding: 0 26px; }
.btn.block { width: 100%; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; font-size: 18px; }
.field input:focus, .field select:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); }
.field small { display: block; color: var(--muted); margin-top: 4px; font-size: 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfdccb; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #ecd3a6; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: #efc1bc; }
.badge.cur { background: var(--primary-soft); color: var(--primary); border-color: #c3d5e8; }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #c3d5e8; }
.note.ok { background: var(--ok-soft); color: #1b5a39; border-color: #bfdccb; }
.note.warn { background: var(--warn-soft); color: #7a4800; border-color: #ecd3a6; }
.note.bad { background: var(--bad-soft); color: #8a1f17; border-color: #efc1bc; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.ico { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }

/* Toast and dialogs */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--head); color: #fff; padding: 12px 18px; border-radius: var(--radius); z-index: 80; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; font-weight: 500; }
#toast.on { opacity: 1; }
#toast.bad { background: var(--bad); }
.modal-back { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(15, 24, 35, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 70; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 520px; width: 100%; padding: 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); max-height: calc(100vh - 32px); overflow: auto; -webkit-overflow-scrolling: touch; }
.modal h2 { margin: 0 0 10px; font-size: 21px; }
.modal p { margin: 0 0 10px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal.wide { max-width: 860px; }

/* Sign-in */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.hero .card { max-width: 440px; width: 100%; text-align: center; padding: 32px 28px; }
.hero img.logo { width: 84px; height: 84px; }
.hero h1 { margin: 14px 0 4px; font-size: 24px; }

/* Rich text and pictures of a subject */
.rich b { font-weight: 700; }
.figs { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.figs button { padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: zoom-in; max-width: 100%; }
.figs img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.figs .S img { max-height: 170px; } .figs .M img { max-height: 320px; } .figs .L img { max-height: 520px; }
.figs .L { flex-basis: 100%; }
.lightbox { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(10, 15, 22, .94); z-index: 90; display: flex; flex-direction: column; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; color: #fff; padding: 8px 12px; }
.lightbox .view { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; align-items: center; justify-content: center; padding: 8px; background: #fff; }
.lightbox img { width: 100%; height: 100%; object-fit: contain; }
.lightbox img.full { width: auto; height: auto; max-width: none; max-height: none; background: #fff; }
.lightbox .btn { background: #fff; }

@media (max-width: 600px) {
  .card { padding: 16px; }
  .btn.big { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
