/* URM Invigilate — URM Training Academy. Brand colours live here. */
:root{
  --navy:#10304a; --navy-2:#1b4566; --gold:#c8962e; --gold-soft:#f6ecd8;
  --bg:#f3f5f8; --card:#ffffff; --ink:#15212c; --muted:#5d6b78; --line:#dde3ea;
  --ok:#1f8a4c; --ok-soft:#e3f4ea; --warn:#b7791f; --warn-soft:#fdf3dc; --bad:#c0392b; --bad-soft:#fbe7e4; --info:#2266aa; --info-soft:#e4effa;
  --radius:12px; --shadow:0 1px 2px rgba(16,48,74,.06),0 4px 14px rgba(16,48,74,.06);
  --font:"Segoe UI",system-ui,-apple-system,"Helvetica Neue",Roboto,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:var(--font);background:var(--bg);color:var(--ink);font-size:16px;line-height:1.45;-webkit-text-size-adjust:100%}
a{color:var(--navy-2)}
h1,h2,h3{margin:0 0 .4em;line-height:1.2;color:var(--navy)}
h1{font-size:1.6rem}h2{font-size:1.25rem}h3{font-size:1.05rem}
p{margin:.3em 0 .8em}
small,.muted{color:var(--muted)}
.hidden{display:none!important}

/* top bar */
.topbar{background:var(--navy);color:#fff;display:flex;align-items:center;gap:12px;padding:10px 16px;position:sticky;top:0;z-index:20}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:.2px;color:#fff;text-decoration:none}
.brand-mark{width:34px;height:34px;border-radius:8px;background:var(--gold);display:grid;place-items:center;color:var(--navy);font-weight:800;font-size:11px;letter-spacing:.3px}
.brand small{display:block;color:#c9d6e2;font-weight:400;font-size:.75rem}
.topbar .spacer{flex:1}
.topbar button.ghost{color:#fff;border-color:rgba(255,255,255,.35)}

/* layout */
.wrap{max-width:1100px;margin:0 auto;padding:18px 16px 60px}
.narrow{max-width:620px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;margin-bottom:16px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
@media (max-width:720px){.grid2,.grid3{grid-template-columns:1fr}}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.row.between{justify-content:space-between}
.stack>*+*{margin-top:12px}

/* forms */
label{display:block;font-weight:600;font-size:.9rem;margin:0 0 4px;color:var(--navy)}
input[type=text],input[type=email],input[type=password],input[type=number],select,textarea{width:100%;font:inherit;padding:11px 12px;border:1px solid #c6d0da;border-radius:9px;background:#fff;color:var(--ink);min-height:44px}
textarea{min-height:90px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:2px solid var(--gold);outline-offset:1px;border-color:var(--gold)}
.field{margin-bottom:14px}
.check{display:flex;gap:10px;align-items:flex-start;font-weight:400;color:var(--ink);cursor:pointer}
.check input{width:20px;height:20px;margin-top:2px;flex:none}
button,.btn{font:inherit;font-weight:600;border-radius:9px;border:1px solid transparent;padding:10px 16px;min-height:44px;cursor:pointer;background:var(--navy);color:#fff;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;-webkit-tap-highlight-color:transparent}
button:hover{filter:brightness(1.08)}
button:disabled{opacity:.5;cursor:not-allowed;filter:none}
button.gold{background:var(--gold);color:var(--navy)}
button.ghost{background:transparent;color:var(--navy);border-color:#b9c5d1}
button.danger{background:var(--bad)}
button.ok{background:var(--ok)}
button.sm{min-height:34px;padding:6px 11px;font-size:.85rem}
button.block{width:100%}
.err{background:var(--bad-soft);color:var(--bad);border-radius:9px;padding:10px 12px;margin:10px 0;font-weight:600}
.note{background:var(--info-soft);color:#14466f;border-radius:9px;padding:10px 12px;margin:10px 0}
.warnbox{background:var(--warn-soft);color:#7a4f0c;border-radius:9px;padding:10px 12px;margin:10px 0}

/* chips */
.chip{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:2px 10px;font-size:.78rem;font-weight:700;background:#e8edf2;color:#33475a;white-space:nowrap}
.chip.ok{background:var(--ok-soft);color:var(--ok)} .chip.warn{background:var(--warn-soft);color:var(--warn)} .chip.bad{background:var(--bad-soft);color:var(--bad)} .chip.info{background:var(--info-soft);color:var(--info)} .chip.gold{background:var(--gold-soft);color:#7a5714}
.dot{width:9px;height:9px;border-radius:50%;background:#9aa7b3;display:inline-block}
.dot.on{background:#22b35e;box-shadow:0 0 0 3px rgba(34,179,94,.2)} .dot.off{background:var(--bad)}

/* steps */
.steps{display:flex;gap:6px;margin:0 0 16px;flex-wrap:wrap}
.steps span{flex:1;min-width:60px;height:5px;border-radius:3px;background:#d5dde5}
.steps span.done{background:var(--gold)} .steps span.cur{background:var(--navy)}

/* camera */
.cam{position:relative;background:#0c1620;border-radius:12px;overflow:hidden;aspect-ratio:4/3;width:100%}
.cam video,.cam img{width:100%;height:100%;object-fit:cover;display:block;transform:scaleX(-1)}
.cam img.noflip{transform:none}
.cam .badge{position:absolute;left:8px;top:8px}
.meter{height:10px;background:#e3e8ee;border-radius:6px;overflow:hidden}
.meter i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--ok),var(--gold));transition:width .1s}
.checklist{list-style:none;padding:0;margin:0}
.checklist li{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line)}
.checklist li:last-child{border-bottom:0}
.checklist .st{margin-left:auto}

/* exam screen */
body.exam{background:#eef1f5;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
body.exam textarea{user-select:text;-webkit-user-select:text}
.exambar{background:var(--navy);color:#fff;padding:8px 12px;display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:30}
.exambar .title{font-weight:700;font-size:.95rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.exambar .sub{font-size:.75rem;color:#c9d6e2}
.timer{font-variant-numeric:tabular-nums;font-weight:800;font-size:1.25rem;background:rgba(255,255,255,.12);padding:4px 10px;border-radius:8px;margin-left:auto}
.timer.low{background:var(--bad);animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.75}}
.selfcam{width:76px;height:57px;border-radius:7px;overflow:hidden;background:#000;flex:none;position:relative}
.selfcam video{width:100%;height:100%;object-fit:cover;transform:scaleX(-1)}
.selfcam .rec{position:absolute;top:3px;right:3px;width:8px;height:8px;border-radius:50%;background:#ff3b30;animation:pulse 1.4s infinite}
.examgrid{display:grid;grid-template-columns:1fr 250px;gap:16px;max-width:1100px;margin:0 auto;padding:16px}
@media (max-width:820px){.examgrid{grid-template-columns:1fr;padding:10px}}
.qcard{background:#fff;border-radius:14px;border:1px solid var(--line);padding:20px;box-shadow:var(--shadow)}
.qnum{color:var(--muted);font-weight:700;font-size:.85rem;text-transform:uppercase;letter-spacing:.5px}
.qtext{font-size:1.12rem;margin:8px 0 16px;white-space:pre-wrap}
.opt{display:flex;gap:12px;align-items:flex-start;border:2px solid var(--line);border-radius:11px;padding:13px 14px;margin-bottom:10px;cursor:pointer;background:#fff;transition:border-color .12s,background .12s}
.opt:hover{border-color:#b5c3d0}
.opt.sel{border-color:var(--navy);background:#eef4fa}
.opt .mk{width:24px;height:24px;border-radius:50%;border:2px solid #9fb0c0;flex:none;display:grid;place-items:center;font-size:.75rem;font-weight:800;color:#fff;margin-top:1px}
.opt.multi .mk{border-radius:6px}
.opt.sel .mk{background:var(--navy);border-color:var(--navy)}
.qnav{display:grid;grid-template-columns:repeat(auto-fill,minmax(40px,1fr));gap:6px}
.qnav button{min-height:40px;padding:0;background:#fff;color:var(--ink);border:1px solid #c6d0da;font-weight:700;position:relative}
.qnav button.ans{background:var(--navy);color:#fff;border-color:var(--navy)}
.qnav button.cur{outline:3px solid var(--gold);outline-offset:1px}
.qnav button.flag::after{content:"";position:absolute;top:3px;right:3px;width:7px;height:7px;border-radius:50%;background:var(--gold)}
.savestate{font-size:.8rem;color:var(--muted)}
.overlay{position:fixed;inset:0;background:rgba(10,24,36,.82);z-index:100;display:flex;align-items:center;justify-content:center;padding:18px}
.overlay .card{max-width:480px;width:100%;margin:0}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:18px;background:var(--bad);color:#fff;padding:12px 16px;border-radius:10px;font-weight:600;z-index:90;box-shadow:0 6px 20px rgba(0,0,0,.25);max-width:92vw}
.toast.info{background:var(--navy)}

/* console */
.tabs{display:flex;gap:4px;background:#fff;border-bottom:1px solid var(--line);padding:0 12px;overflow-x:auto;position:sticky;top:54px;z-index:15}
.tabs button{background:none;color:var(--muted);border-radius:0;border-bottom:3px solid transparent;padding:12px 14px}
.tabs button.on{color:var(--navy);border-bottom-color:var(--gold)}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
.tile{background:#fff;border:2px solid var(--line);border-radius:12px;overflow:hidden;cursor:pointer;transition:border-color .15s,box-shadow .15s}
.tile:hover{box-shadow:var(--shadow)}
.tile.alert{border-color:var(--bad);animation:flash 1s 3}
@keyframes flash{50%{box-shadow:0 0 0 4px rgba(192,57,43,.25)}}
.tile .cam{border-radius:0}
.tile .cam img{transform:none}
.tile .body{padding:9px 11px}
.tile .nm{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar{height:6px;background:#e3e8ee;border-radius:4px;overflow:hidden;margin:6px 0}
.bar i{display:block;height:100%;background:var(--navy)}
table{width:100%;border-collapse:collapse;font-size:.92rem}
th,td{text-align:left;padding:9px 8px;border-bottom:1px solid var(--line);vertical-align:top}
th{font-size:.78rem;text-transform:uppercase;letter-spacing:.4px;color:var(--muted);background:#f8fafc}
tr.click{cursor:pointer} tr.click:hover td{background:#f6f9fc}
.tablewrap{overflow-x:auto}
.drawer{position:fixed;top:0;right:0;bottom:0;width:min(560px,100vw);background:#fff;z-index:60;box-shadow:-10px 0 30px rgba(0,0,0,.2);display:flex;flex-direction:column}
.drawer header{padding:12px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px}
.drawer .content{overflow:auto;padding:16px;flex:1}
.shade{position:fixed;inset:0;background:rgba(10,24,36,.4);z-index:55}
.timeline{list-style:none;padding:0;margin:0}
.timeline li{display:flex;gap:10px;padding:8px 0;border-bottom:1px dashed var(--line);font-size:.9rem}
.timeline li.serious .lbl{color:var(--bad);font-weight:700}
.timeline li.dism{opacity:.45;text-decoration:line-through}
.timeline time{color:var(--muted);font-variant-numeric:tabular-nums;flex:none;width:64px;font-size:.82rem}
.timeline img{width:96px;border-radius:6px;cursor:zoom-in;flex:none}
.feed{max-height:70vh;overflow:auto}
.qedit{border:1px solid var(--line);border-radius:10px;padding:12px;margin-bottom:10px;background:#fbfcfd}
.qedit .optrow{display:flex;gap:8px;align-items:center;margin-bottom:6px}
.qedit .optrow input[type=text]{min-height:38px;padding:7px 10px}
.bigcode{font-size:2.6rem;font-weight:800;letter-spacing:6px;color:var(--navy);font-variant-numeric:tabular-nums}
.thumbs{display:flex;gap:8px;flex-wrap:wrap}
.thumbs img{width:120px;border-radius:8px;border:1px solid var(--line);cursor:zoom-in}
.kpi{background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.kpi b{display:block;font-size:1.6rem;color:var(--navy)}
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:200;display:flex;align-items:center;justify-content:center;cursor:zoom-out}
.lightbox img{max-width:94vw;max-height:90vh;border-radius:8px}

/* print (reports) */
@media print{
  .topbar,.tabs,.noprint,.drawer header button{display:none!important}
  body{background:#fff}
  .card{box-shadow:none;border:1px solid #ccc;break-inside:avoid}
  .drawer{position:static;width:auto;box-shadow:none}
  .drawer .content{overflow:visible}
  .shade{display:none}
}
@media (max-width:900px){#liveGrid{grid-template-columns:1fr!important}#kpis{grid-template-columns:repeat(3,1fr)!important}}
@media (max-width:480px){#kpis{grid-template-columns:repeat(2,1fr)!important}.tiles{grid-template-columns:1fr 1fr}.bigcode{font-size:2rem}}
#ovMsg{z-index:120}

/* Learning Portal assessment shown inside the invigilated page */
.extframe{position:fixed;top:52px;left:0;right:0;bottom:0;background:#fff}
.extframe iframe{width:100%;height:100%;border:0;display:block}
body.exam .exambar{min-height:52px}
