:root{
  --bg:#f2f4f7;
  --card:#ffffff;
  --muted:#5b6473;
  --text:#131722;
  --accent:#2f6df6;
  --accent2:#22c55e;
  --danger:#ef4444;
  --ink:#0b1020;
  --soft:#eef2f7;
  --soft2:#e7ecf5;
  --focus: rgba(47,109,246,0.16);
  --border: 1px solid rgba(17,24,39,0.12);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17,24,39,0.08);
  --shadow2: 0 18px 44px rgba(17,24,39,0.10);
  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:var(--font);color:var(--text);background:var(--bg)}
a{color:var(--accent); text-decoration:none}
.wrap{max-width:1280px; margin:0 auto; padding:18px}

/* Motion */
@keyframes popIn{from{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1}}
@keyframes floatIn{from{transform:translateY(14px) scale(0.99);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}
@keyframes pulseRing{0%{box-shadow:0 0 0 0 rgba(47,109,246,0.22)}70%{box-shadow:0 0 0 14px rgba(47,109,246,0.0)}100%{box-shadow:0 0 0 0 rgba(47,109,246,0.0)}}
@keyframes shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}

.card{
  background:var(--card);
  border:var(--border);
  border-radius:calc(var(--radius) + 2px);
  box-shadow:var(--shadow);
  padding:18px;
  animation:floatIn 260ms ease-out both;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.card:hover{box-shadow:var(--shadow2)}
.row{display:flex; gap:14px; flex-wrap:wrap}
.col{flex:1 1 320px}

/* Headings */
h1{font-size:22px; letter-spacing:-0.01em; margin:0 0 8px 0}
h2{font-size:18px; letter-spacing:-0.01em; margin:0 0 8px 0; color:var(--text)}
p{margin:8px 0; color:var(--muted); line-height:1.55}
label{display:block; margin:10px 0 6px 0; color:var(--muted); font-size:13px}

/* Inputs */
input,button,select,textarea{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:var(--border);
  background:#fff;
  color:var(--text);
  outline:none;
  transition:transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}
input:focus,textarea:focus,select:focus{border-color:rgba(47,109,246,0.55);box-shadow:0 0 0 5px var(--focus)}
input:hover,textarea:hover,select:hover{border-color:rgba(17,24,39,0.18)}

button{
  appearance:none;
  border:1px solid rgba(0,0,0,.12);
  background:#e9ecef;
  color:#111;
  padding:12px 14px;
  border-radius:12px;
  font-weight:600;
  cursor:pointer;
  box-shadow:none;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s ease, box-shadow .15s ease;
}

button:hover{ background:#dde1e6; box-shadow: 0 12px 26px rgba(17,24,39,0.10); }
button:active{ transform: translateY(1px) scale(0.995); }
button.primary{
  background:#111;
  color:#fff;
  border-color:#111;
}
button.primary:hover{ background:#000; }
button:disabled{ opacity:.55; cursor:not-allowed; transform:none; }
button.primary{background:var(--accent);border-color:rgba(47,109,246,0.55);color:#fff}

/* Small micro-interaction ripple (pure CSS) */
button{position:relative; overflow:hidden}
button::after{
  content:"";
  position:absolute;
  inset:-40%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), rgba(255,255,255,0) 55%);
  opacity:0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 220ms ease;
  pointer-events:none;
}
button:hover::after{opacity:1; transform: scale(1)}

.small{font-size:12px;color:var(--muted)}
.badge{display:inline-flex;align-items:left;gap:8px;padding:8px 10px;border-radius:999px;border:var(--border);background:#fff;color:var(--muted);font-size:12px}

/* Topbar */
.topbar{position:sticky;top:0;z-index:10;background:rgba(242,244,247,0.82);backdrop-filter:blur(12px);border-bottom:var(--border)}
.topbar-inner{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:12px 18px;max-width:980px;margin:0 auto}
.topbar-inner .right{order:-1}
.topbar-inner .right .badge{padding:8px 12px}
.topbar-inner .badge{box-shadow: 0 8px 18px rgba(17,24,39,0.06)}

.timer{font-variant-numeric:tabular-nums;font-weight:800;color:var(--text)}
.section{margin-top:16px}

/* Question blocks */
.q{border:var(--border);border-radius:14px;padding:14px;background:#fff;margin:12px 0;transition:border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease}
.q:hover{border-color:rgba(17,24,39,0.18); box-shadow: 0 12px 26px rgba(17,24,39,0.06)}
.q-title{font-weight:800;margin:0 0 8px 0}

/* Choice as selectable card */
.choice{display:flex;gap:12px;align-items:flex-start;padding:10px 10px;border-radius:12px; border:1px solid rgba(17,24,39,0.10); background: linear-gradient(0deg, #fff, #fff);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.choice:hover{border-color:rgba(47,109,246,0.22); box-shadow: 0 10px 22px rgba(17,24,39,0.06); transform: translateY(-1px)}
.choice input{width:auto;margin-top:3px; accent-color: var(--accent)}

/* If JS adds .selected to choice wrapper, style it */
.choice.selected{border-color:rgba(47,109,246,0.55); box-shadow: 0 14px 28px rgba(47,109,246,0.12); background: var(--soft)}

.hr{height:1px;background:rgba(17,24,39,0.10);margin:14px 0}

/* Notice */
.notice{padding:10px 12px;border-radius:12px;border:var(--border);background:#fff;color:var(--muted);animation:popIn 180ms ease-out both}
.notice.ok{border-color:rgba(34,197,94,0.55)}
.notice.bad{border-color:rgba(239,68,68,0.55)}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px;border-bottom:var(--border);text-align:left;font-size:13px;color:var(--muted)}
.table th{color:var(--text);font-weight:800}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}
.videoWrap{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start}
.videoCard{flex:1 1 360px;border:var(--border);border-radius:14px;background:#fff;padding:12px}
video{width:100%;border-radius:12px;border:1px solid rgba(17,24,39,0.12);background:#0b0f1a}
.faceBox{position:relative;border-radius:12px;overflow:hidden}
.faceOverlay{position:absolute;inset:0;pointer-events:none;border-radius:12px;border:2px solid rgba(47,109,246,0.0);transition:border-color 120ms ease}
.faceOverlay.ok{border-color:rgba(34,197,94,0.85);animation:pulseRing 1.4s ease-out infinite}

/* Audio player (native controls restyle where possible) */
audio{width:100%; margin:10px 0 0 0; border-radius:12px; border:1px solid rgba(17,24,39,0.12); background: var(--soft); padding:6px}
audio:focus{outline:none; box-shadow:0 0 0 5px var(--focus)}

/* WebKit media controls */
audio::-webkit-media-controls-enclosure{border-radius:12px; background: var(--soft)}
audio::-webkit-media-controls-panel{background: var(--soft)}
audio::-webkit-media-controls-play-button{filter: grayscale(0) contrast(1.1)}
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display{color: var(--ink)}
audio::-webkit-media-controls-timeline{border-radius:999px}
audio::-webkit-media-controls-volume-slider{border-radius:999px}

/* Candidates layout tightening (overrides inline styles if needed) */
.toolbar{margin:8px 0 !important; gap:10px !important}
.searchWrap{align-items:stretch !important}
.filtersUnder{margin-top:0 !important}

/* Pagination buttons tighter */
.pager{margin-top:10px !important}

@media (max-width:600px){
  .wrap{padding:14px}
  .topbar-inner{padding:10px 14px}
  .row{gap:12px}
  button{padding:12px}
}


/* from admin.html */
.grid3{
      display:grid;
      grid-template-columns: 1.2fr 1fr 0.8fr;
      gap:16px;
    }
    @media (max-width: 980px){
      .grid3{grid-template-columns:1fr}
    }
    .help{font-size:12px; color:var(--muted); margin-top:6px}
    .row2{display:flex; gap:10px; align-items:center}
    .row2 > *{flex:1}
    .mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
    .ok{color:var(--ok)}
    .bad{color:var(--bad)}

/* from candidates.html */
.toolbar{
      display:flex;
      flex-direction:column;
      gap:10px;
      align-items:stretch;
      justify-content:flex-start;
      margin: 10px 0 10px 0;
    }
    .searchWrap{display:flex; gap:10px; align-items:center; width:100%}
    .searchWrap input{flex:1; background:#fff !important; color:#111 !important; font-size:14px !important; -webkit-text-fill-color:#858585 !important; padding:10px 12px !important;}
    .searchWrap input::placeholder{color: var(--muted) !important; opacity:1;}
    .searchWrap button{width:auto !important; flex:0 0 auto !important; padding:10px 12px !important; border-radius:10px !important;}
    .filtersUnder{display:flex; align-items:center; gap:10px; margin-top:-2px}
    .controlsRow{display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; margin-top:0}
    .rightControls{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

.toolbar{
      display:flex;
      flex-direction:column;
      gap:10px;
      align-items:stretch;
      justify-content:flex-start;
      margin: 10px 0 10px 0;
    }
                    .filtersUnder{display:flex; align-items:center; gap:10px; margin-top:-2px}
    .controlsRow{display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; margin-top:0}
    .rightControls{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

                    .pill{
      display:inline-flex;
      align-items:center;
      gap:8px;
      padding:8px 10px;
      border-radius:999px;
      border: var(--border);
      background:#fff;
      color: var(--muted);
      font-size:12px;
      cursor:pointer;
      user-select:none;
    }
    .pill input{width:auto; margin:0}
    .pager{
      display:flex; gap:10px; align-items:center; justify-content:flex-end;
      margin-top: 12px;
      flex-wrap:wrap;
    }
    .pager button{width:auto; padding:10px 12px}
        .kpi{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
    .kpi .badge{font-weight:800}
    .rowlink{cursor:pointer}
    .muted{color:var(--muted)}

.dropzone{
  border:2px dashed rgba(0,0,0,0.2);
  border-radius:12px;
  padding:16px;
  text-align:center;
  background:rgba(0,0,0,0.02);
}
.dropzone.dragover{
  border-color:rgba(0,0,0,0.45);
  background:rgba(0,0,0,0.05);
}


/* Examiner grading UI */
.writingBox{
  max-width: 360px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.055);
  font-size: 12px;
  line-height: 1.35;
}
.miniInput{
  width: 86px;
}
.gradeBtn{
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(34,197,94,0.25);
}
.gradeBtn:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}
.gradeBtn.saved{
  background: rgba(34,197,94,0.35);
}
.gradeBtn.error{
  background: rgba(239,68,68,0.30);
}
