/* FTEJerez — shared brand + base + common components (v5.1) */
/* ============ FTEJerez brand palette ============ */
  :root{
    /* v5.13.5 branding: admin-tunable chrome. Defaults REPRODUCE the pre-branding look exactly.
       JS (applyBranding in common.js) overrides these four from the public `branding` payload and
       computes the two -fg values from relative luminance of the chosen colours. */
    --brand-border:#181E53;      /* topbar band (the "page border"); default = the original navy */
    --brand-border-fg:#ffffff;   /* text/pills/buttons on the band — auto contrast */
    --brand-page:#f4f6fb;        /* page background; default = the original --bg */
    --brand-page-fg:#1d2330;     /* base text on the page background — auto contrast */
    --navy:#181E53;        /* primary */
    --blue:#0070C0;        /* accent  */
    --ref:#0082CB;         /* reference accent */
    --navy-tint:#EEF1F8;
    --blue-tint:#E5F1FA;
    --ink:#1d2330;
    --muted:#5a6478;
    --line:#d9dee8;
    --bg:#f4f6fb;
    --white:#ffffff;
    --ok:#1d8348;
    --ok-tint:#e6f4ec;
    --bad:#c0392b;
    --bad-tint:#fbeae8;
    --warn:#C8841A;
    --flag:#E0A800;
    --radius:10px;
    --shadow:0 1px 3px rgba(24,30,83,.08), 0 6px 24px rgba(24,30,83,.06);
    --fs:15px;
  }
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
    font-family:"Segoe UI",Arial,Helvetica,sans-serif;
    color:var(--brand-page-fg); background:var(--brand-page); font-size:var(--fs); line-height:1.5;   /* v5.13.5: brand-tunable page chrome */
  }
button{font-family:inherit}
a{color:var(--blue)}
/* ============ Top bar ============ */
  .topbar{
    background:var(--brand-border); color:var(--brand-border-fg); display:flex; align-items:center;
    justify-content:space-between; padding:0 20px; height:58px;
    box-shadow:0 2px 8px rgba(24,30,83,.25); position:sticky; top:0; z-index:50;
  }
.wordmark{font-weight:800; letter-spacing:.5px; font-size:20px; display:flex; align-items:baseline; gap:1px}
.wordmark .fte{color:#fff}
.wordmark .jerez{color:#5BC2F4}
.wordmark .sub{font-size:11px; font-weight:600; letter-spacing:2px; color:#aebbe0; margin-left:10px; text-transform:uppercase}
.topbar .right{display:flex; gap:10px; align-items:center}
.pill{background:color-mix(in srgb, var(--brand-border-fg) 14%, transparent); padding:5px 11px; border-radius:20px; font-size:12.5px; color:var(--brand-border-fg)}
/* v5.13.5 branding: header identity slot (image -> rich text -> Q mark) + powered-by footer */
.brandSlot{display:flex; align-items:center; gap:10px; min-width:0; height:100%}
.brandSlot img{max-height:38px; max-width:260px; display:block}
.brandSlot .brandText{font-weight:800; letter-spacing:.5px; font-size:20px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:340px}
.brandSlot .sub{font-size:11px; font-weight:600; letter-spacing:2px; opacity:.75; text-transform:uppercase; white-space:nowrap}
.poweredBy{text-align:center; margin:26px 0 14px; color:var(--brand-page-fg); opacity:.55; font-size:11px; line-height:1.5}
.poweredBy .qmark{font-weight:800; letter-spacing:3px; font-size:11.5px}
.poweredBy .aircademy{font-style:italic; font-size:10.5px}
/* ============ Layout ============ */
  .wrap{max-width:980px; margin:28px auto; padding:0 18px}
.wrap.wide{max-width:1180px}
.card{background:var(--white); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow)}
.card.pad{padding:26px}
h1,h2,h3{color:var(--navy); margin:0 0 .5em}
h1{font-size:26px; font-weight:800}
h2{font-size:20px; font-weight:700}
h3{font-size:16px; font-weight:700}
.eyebrow{color:var(--blue); font-weight:700; letter-spacing:1.5px; text-transform:uppercase; font-size:12px; margin-bottom:6px}
.muted{color:var(--muted)}
.hr{height:1px; background:var(--line); border:0; margin:18px 0}
/* ============ Buttons ============ */
  .btn{
    appearance:none; border:1px solid var(--navy); background:var(--navy); color:#fff;
    padding:10px 18px; border-radius:8px; font-weight:600; font-size:14.5px; cursor:pointer;
    transition:filter .12s ease, transform .02s ease;
  }
.btn:hover{filter:brightness(1.12)}
.btn:active{transform:translateY(1px)}
.btn.secondary{background:#fff; color:var(--navy)}
.btn.blue{background:var(--blue); border-color:var(--blue)}
.btn.ghost{background:transparent; border-color:var(--line); color:var(--navy)}
.btn.danger{background:#fff; color:var(--bad); border-color:var(--bad)}
.btn.lg{padding:14px 24px; font-size:16px}
.btn:disabled{opacity:.5; cursor:not-allowed}
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible{
    outline:3px solid rgba(0,112,192,.4); outline-offset:1px;
  }
/* ============ Forms ============ */
  label.fld{display:block; font-weight:600; color:var(--navy); margin:14px 0 5px}
input[type=text],input[type=number],input[type=password],select,textarea{
    width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px;
    font-size:15px; background:#fff; color:var(--ink);
  }
textarea{resize:vertical; min-height:70px}
.row{display:flex; gap:14px; flex-wrap:wrap}
.row > *{flex:1; min-width:160px}
/* ============ Home tiles ============ */
  .tiles{display:grid; grid-template-columns:1fr 1fr; gap:18px; margin-top:22px}
.tile{padding:28px; cursor:pointer; transition:transform .12s ease, box-shadow .12s ease; border-top:4px solid var(--blue)}
.tile:hover{transform:translateY(-3px); box-shadow:0 10px 30px rgba(24,30,83,.13)}
.tile h2{margin-top:6px}
.tile .ic{font-size:30px}
@media(max-width:640px){ .tiles{grid-template-columns:1fr} }
/* ============ Exam chrome ============ */
  .exam-grid{display:grid; grid-template-columns:1fr 240px; gap:20px; align-items:start}
@media(max-width:860px){ .exam-grid{grid-template-columns:1fr} }
.qmeta{display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap;
    padding-bottom:12px; border-bottom:2px solid var(--navy-tint); margin-bottom:18px}
.qmeta .qno{font-weight:800; color:var(--navy); font-size:17px}
.qmeta .badge{background:var(--blue-tint); color:var(--ref); font-weight:700; padding:3px 10px; border-radius:14px; font-size:12.5px}
.qmeta .subj{background:var(--navy-tint); color:var(--navy); font-weight:600; padding:3px 10px; border-radius:14px; font-size:12.5px}
.stem{font-size:16.5px; line-height:1.65; margin-bottom:18px; white-space:pre-wrap}
.typehint{color:var(--muted); font-size:13px; margin-bottom:14px}
.opt{display:flex; align-items:flex-start; gap:11px; border:1px solid var(--line); border-radius:9px;
    padding:12px 14px; margin-bottom:10px; cursor:pointer; background:#fff; transition:border-color .1s, background .1s}
.opt:hover{border-color:var(--blue)}
.opt.sel{border-color:var(--blue); background:var(--blue-tint)}
.opt input{margin-top:3px; flex:0 0 auto; width:auto}
.opt .lab{flex:1}
.opt.correct{border-color:var(--ok); background:var(--ok-tint)}
.opt.wrong{border-color:var(--bad); background:var(--bad-tint)}
.inline-select{display:inline-block; min-width:120px; width:auto; margin:0 3px; padding:5px 8px;
    border:1px solid var(--blue); border-radius:6px; background:var(--blue-tint); font-weight:600; color:var(--navy)}
.blankwrap{display:inline}
.nav-btns{display:flex; justify-content:space-between; gap:12px; margin-top:20px}
.comment-box{margin-top:18px; border-top:1px dashed var(--line); padding-top:14px}
.comment-box summary{cursor:pointer; color:var(--blue); font-weight:600}
/* navigator panel */
  .navi{position:sticky; top:78px}
.navi h3{font-size:13px; text-transform:uppercase; letter-spacing:1px; color:var(--muted)}
.timer{font-size:30px; font-weight:800; color:var(--navy); text-align:center; letter-spacing:1px;
    background:var(--navy-tint); border-radius:9px; padding:12px; margin-bottom:14px; font-variant-numeric:tabular-nums}
.timer.warn{color:#fff; background:var(--bad); animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.78}}
.grid-nav{display:grid; grid-template-columns:repeat(5,1fr); gap:7px}
.gn{aspect-ratio:1; border:1px solid var(--line); border-radius:7px; background:#fff; cursor:pointer;
    font-weight:700; color:var(--navy); font-size:13.5px; position:relative}
.gn:hover{border-color:var(--blue)}
.gn.answered{background:var(--navy); color:#fff; border-color:var(--navy)}
.gn.current{outline:3px solid var(--blue); outline-offset:1px}
.gn.flagged::after{content:""; position:absolute; top:3px; right:3px; width:7px; height:7px; border-radius:50%; background:var(--flag)}
.legend{font-size:12px; color:var(--muted); margin-top:12px; line-height:1.8}
.legend .dot{display:inline-block; width:11px; height:11px; border-radius:3px; vertical-align:-1px; margin-right:5px}
/* ============ Results ============ */
  .scorehead{display:flex; align-items:center; gap:26px; flex-wrap:wrap}
.ring{--p:0; width:120px; height:120px; border-radius:50%; flex:0 0 auto;
    background:conic-gradient(var(--blue) calc(var(--p)*1%), var(--navy-tint) 0);
    display:flex; align-items:center; justify-content:center}
.ring.pass{background:conic-gradient(var(--ok) calc(var(--p)*1%), var(--navy-tint) 0)}
.ring.fail{background:conic-gradient(var(--bad) calc(var(--p)*1%), var(--navy-tint) 0)}
.ring span{background:#fff; width:92px; height:92px; border-radius:50%; display:flex; align-items:center;
    justify-content:center; font-size:24px; font-weight:800; color:var(--navy)}
.verdict{font-size:24px; font-weight:800}
.verdict.pass{color:var(--ok)}
.verdict.fail{color:var(--bad)}
.rev-q{border:1px solid var(--line); border-radius:9px; padding:16px; margin-bottom:14px}
.rev-q .tag{font-weight:700; font-size:13px; padding:2px 9px; border-radius:12px; margin-left:6px}
.tag.ok{background:var(--ok-tint); color:var(--ok)}
.tag.no{background:var(--bad-tint); color:var(--bad)}
.expl{background:var(--blue-tint); border-left:3px solid var(--blue); padding:10px 13px; border-radius:0 7px 7px 0; margin-top:10px; font-size:14px}
/* ============ Admin ============ */
  .qlist{width:100%; border-collapse:collapse; margin-top:14px}
.qlist th,.qlist td{text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:top}
.qlist th{color:var(--navy); font-size:12px; text-transform:uppercase; letter-spacing:.5px}
.qlist tr:hover td{background:var(--navy-tint)}
.typetag{font-size:11.5px; font-weight:700; padding:2px 8px; border-radius:10px; background:var(--blue-tint); color:var(--ref); white-space:nowrap}
.opt-row{display:flex; gap:10px; align-items:center; margin-bottom:8px}
.opt-row input[type=text]{flex:1}
.opt-row .mark{display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); white-space:nowrap}
.blank-edit{border:1px solid var(--line); border-radius:8px; padding:12px; margin-bottom:10px; background:var(--navy-tint)}
.blank-edit h4{margin:0 0 8px; color:var(--navy); font-size:14px}
/* ============ Misc ============ */
  .banner{padding:11px 16px; border-radius:8px; font-size:13.5px; margin-bottom:18px; display:flex; gap:10px; align-items:center}
.banner.demo{background:#fff7e6; border:1px solid #ffe1a8; color:#7a5400}
.banner.err{background:var(--bad-tint); border:1px solid #f2c4be; color:var(--bad)}
.hidden{display:none !important}
.toast{position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:var(--navy); color:#fff;
    padding:12px 20px; border-radius:8px; box-shadow:var(--shadow); z-index:200; opacity:0; transition:opacity .2s, bottom .2s}
.toast.show{opacity:1; bottom:30px}
.spin{display:inline-block; width:16px; height:16px; border:2px solid var(--line); border-top-color:var(--blue); border-radius:50%; animation:rot .7s linear infinite}
@keyframes rot{to{transform:rotate(360deg)}}
.center{text-align:center}
.foot{ text-align:center; color:var(--muted); font-size:12px; padding:24px}
