/* PaperGenie Tests */
:root {
  --tp-brand: #0A6FD6; --tp-ink: #0f1b33; --tp-muted: #667085; --tp-line: #e6eaf2; --tp-bg: #f5f7fb;
  --tp-ok: #16a34a; --tp-bad: #dc2626; --tp-warn: #f59e0b; --tp-violet: #7c3aed; --tp-radius: 14px;
}
html, body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tp-ink); background: var(--tp-bg); }
a { color: var(--tp-brand); }
.btn-primary { background: var(--tp-brand); border-color: var(--tp-brand); }
.btn-primary:hover, .btn-primary:focus { background: color-mix(in srgb, var(--tp-brand) 85%, #000); border-color: color-mix(in srgb, var(--tp-brand) 85%, #000); }
.btn { border-radius: 10px; font-weight: 500; }
.form-control, .form-select { border-radius: 10px; border-color: #d5dbe6; }
.form-control:focus, .form-select:focus { border-color: var(--tp-brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--tp-brand) 18%, transparent); }
.card, .tp-card { border: 1px solid var(--tp-line); border-radius: var(--tp-radius); background: #fff; box-shadow: 0 4px 16px rgba(15, 27, 51, .04); }
.tp-card { padding: 18px; }
.text-muted { color: var(--tp-muted) !important; }
.badge { font-weight: 600; }

/* ---------- logo ---------- */
.tp-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--tp-ink); }
.tp-logo img { height: 36px; width: auto; }
.tp-logo-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tp-brand); color: #fff; font-size: 18px; }
.tp-logo span { display: flex; flex-direction: column; line-height: 1.1; }
.tp-logo b { font-size: 15px; }
.tp-logo small { font-size: 11.5px; color: var(--tp-muted); }

/* ---------- staff shell ---------- */
.tp-shell { display: flex; min-height: 100vh; }
.tp-side { width: 248px; background: #0f1b33; color: #c9d2e3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; flex-shrink: 0; }
.tp-side .tp-logo { color: #fff; padding: 4px 6px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.tp-side .tp-logo small { color: #93a1bb; }
.tp-side .tp-logo img { background: #fff; border-radius: 8px; padding: 3px; }
.tp-side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #c9d2e3; text-decoration: none; font-weight: 500; font-size: 14.5px; margin-bottom: 2px; }
.tp-side nav a i { font-size: 17px; opacity: .85; }
.tp-side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.tp-side nav a.on { background: var(--tp-brand); color: #fff; }
.tp-side-foot { margin-top: auto; font-size: 12px; color: #7f8ba3; padding: 8px 6px; }
.tp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tp-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--tp-line); position: sticky; top: 0; z-index: 20; }
.tp-top h1 { font-size: 19px; font-weight: 700; margin: 0; }
.tp-user { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; border-radius: 10px; text-align: left; }
.tp-user span small { display: block; font-size: 11.5px; color: var(--tp-muted); }
.tp-avatar { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--tp-brand) 14%, #fff); color: var(--tp-brand); display: grid !important; place-items: center; font-weight: 700; }
.tp-content { padding: 24px; max-width: 1280px; width: 100%; }
@media (max-width: 991.98px) {
  .tp-side { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .tp-side.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .tp-content { padding: 16px; }
  .tp-top { padding: 12px 16px; }
}

/* stats */
.tp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tp-stat { background: #fff; border: 1px solid var(--tp-line); border-radius: var(--tp-radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.tp-stat i { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--tp-brand) 12%, #fff); color: var(--tp-brand); }
.tp-stat b { font-size: 24px; display: block; line-height: 1.1; }
.tp-stat span { color: var(--tp-muted); font-size: 13px; }

/* tables */
.tp-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tp-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--tp-muted); font-weight: 600; background: #f8fafc; padding: 10px 12px; border-bottom: 1px solid var(--tp-line); white-space: nowrap; }
.tp-table td { padding: 12px; border-bottom: 1px solid var(--tp-line); vertical-align: middle; font-size: 14px; }
.tp-table tr:last-child td { border-bottom: 0; }
.tp-table tr:hover td { background: #fafbfe; }

/* status pills */
.tp-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 30px; white-space: nowrap; }
.tp-pill.draft { background: #eef1f6; color: #475467; }
.tp-pill.published, .tp-pill.live { background: #dcfce7; color: #15803d; }
.tp-pill.upcoming { background: #e0edff; color: #1d4ed8; }
.tp-pill.closed, .tp-pill.ended { background: #f1f5f9; color: #64748b; }
.tp-pill.done { background: #ede9fe; color: #6d28d9; }

/* picker */
.tp-qcard { border: 1px solid var(--tp-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; display: flex; gap: 12px; cursor: pointer; }
.tp-qcard:hover { border-color: color-mix(in srgb, var(--tp-brand) 50%, #fff); }
.tp-qcard.in { border-color: var(--tp-brand); background: color-mix(in srgb, var(--tp-brand) 5%, #fff); }
.tp-qcard .chk { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c3cad8; display: grid; place-items: center; color: #fff; margin-top: 2px; }
.tp-qcard.in .chk { background: var(--tp-brand); border-color: var(--tp-brand); }
.tp-qcard .q { font-size: 14.5px; }
.tp-qcard .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; margin-top: 6px; font-size: 13px; color: #475467; }
.tp-qcard .meta { font-size: 11.5px; color: var(--tp-muted); margin-top: 6px; }
.q-img img { max-width: 100%; max-height: 260px; margin: 8px 0; border-radius: 8px; }
.tp-sticky { position: sticky; top: 76px; }

/* ---------- student area ---------- */
.tp-stop { background: #fff; border-bottom: 1px solid var(--tp-line); padding: 12px 0; position: sticky; top: 0; z-index: 20; }
.tp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 30px; background: #f1f4f9; font-size: 13px; font-weight: 500; }
.tp-scontent { padding-top: 24px; padding-bottom: 32px; min-height: calc(100vh - 130px); }
.tp-sfoot { text-align: center; font-size: 12px; color: var(--tp-muted); padding: 16px; }
.tp-testcard { background: #fff; border: 1px solid var(--tp-line); border-radius: 16px; padding: 18px; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.tp-testcard h3 { font-size: 17px; font-weight: 700; margin: 0; }
.tp-testcard .facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--tp-muted); }
.tp-testcard .facts i { margin-right: 4px; }

/* login */
.tp-login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.tp-login-art { background: radial-gradient(900px 500px at 10% 0%, color-mix(in srgb, var(--tp-brand) 45%, #0f1b33), #0f1b33); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.tp-login-art h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 800; line-height: 1.15; }
.tp-login-art ul { list-style: none; padding: 0; margin: 24px 0 0; }
.tp-login-art li { display: flex; gap: 10px; margin-bottom: 12px; color: #d6deee; }
.tp-login-art li i { color: #fbbf24; }
.tp-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.tp-login-form form { width: 100%; max-width: 380px; }
.tp-login-form h1 { font-size: 26px; font-weight: 800; }
.tp-tabs { display: flex; background: #f1f4f9; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.tp-tabs a { flex: 1; text-align: center; padding: 8px; border-radius: 9px; text-decoration: none; color: var(--tp-muted); font-weight: 600; font-size: 14px; }
.tp-tabs a.on { background: #fff; color: var(--tp-ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
@media (max-width: 860px) { .tp-login { grid-template-columns: 1fr; } .tp-login-art { padding: 28px 22px; } .tp-login-art ul { display: none; } }

/* ---------- exam screen ---------- */
body.tp-exam { background: #eef2f8; overflow: hidden; }
.ex-top { height: 60px; background: #0f1b33; color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 18px; }
.ex-top .title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-top .who { font-size: 12.5px; color: #aab6cd; }
.ex-timer { margin-left: auto; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border-radius: 10px; padding: 6px 12px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; }
.ex-timer.low { background: var(--tp-bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .75; } }
.ex-body { display: grid; grid-template-columns: 1fr 320px; height: calc(100vh - 60px); }
.ex-q { display: flex; flex-direction: column; min-width: 0; }
.ex-secs { display: flex; gap: 6px; padding: 10px 18px 0; overflow-x: auto; }
.ex-secs button { border: 1px solid var(--tp-line); background: #fff; border-radius: 9px 9px 0 0; padding: 7px 14px; font-weight: 600; font-size: 13.5px; color: var(--tp-muted); white-space: nowrap; }
.ex-secs button.on { background: var(--tp-brand); border-color: var(--tp-brand); color: #fff; }
.ex-card { flex: 1; overflow-y: auto; background: #fff; margin: 0 18px; border-radius: 0 14px 14px 14px; border: 1px solid var(--tp-line); padding: 22px 26px; }
.ex-qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ex-qno { font-weight: 800; font-size: 16px; }
.ex-tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: #f1f4f9; color: #475467; }
.ex-marks { margin-left: auto; font-size: 12.5px; color: var(--tp-muted); }
.ex-marks b.p { color: var(--tp-ok); } .ex-marks b.n { color: var(--tp-bad); }
.ex-text { font-size: 16.5px; line-height: 1.65; }
.ex-opts { margin-top: 18px; display: grid; gap: 10px; }
.ex-opt { display: flex; align-items: flex-start; gap: 12px; border: 1.5px solid var(--tp-line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; transition: border-color .12s, background .12s; font-size: 15.5px; }
.ex-opt:hover { border-color: color-mix(in srgb, var(--tp-brand) 45%, #fff); }
.ex-opt .k { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid #c3cad8; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; color: #475467; }
.ex-opt.sel { border-color: var(--tp-brand); background: color-mix(in srgb, var(--tp-brand) 6%, #fff); }
.ex-opt.sel .k { background: var(--tp-brand); border-color: var(--tp-brand); color: #fff; }
.ex-foot { display: flex; gap: 8px; padding: 12px 18px; flex-wrap: wrap; align-items: center; }
.ex-foot .btn { padding: 9px 16px; }
.ex-side { background: #fff; border-left: 1px solid var(--tp-line); display: flex; flex-direction: column; min-height: 0; }
.ex-me { padding: 14px 16px; border-bottom: 1px solid var(--tp-line); display: flex; gap: 10px; align-items: center; }
.ex-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px 16px; font-size: 12px; color: #475467; border-bottom: 1px solid var(--tp-line); }
.ex-legend span { display: flex; align-items: center; gap: 6px; }
.ex-pal { padding: 14px 16px; overflow-y: auto; flex: 1; }
.ex-pal h6 { font-size: 12.5px; font-weight: 700; color: var(--tp-muted); text-transform: uppercase; letter-spacing: .4px; margin: 4px 0 8px; }
.ex-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-bottom: 14px; }
.pb { height: 36px; border-radius: 8px; border: 1px solid #cfd6e3; background: #fff; font-weight: 700; font-size: 13px; color: #475467; position: relative; }
.pb.cur { outline: 2px solid var(--tp-ink); outline-offset: 1px; }
.pb.na { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }          /* visited, not answered */
.pb.ans { background: var(--tp-ok); border-color: var(--tp-ok); color: #fff; }   /* answered */
.pb.rev { background: var(--tp-violet); border-color: var(--tp-violet); color: #fff; border-radius: 50%; } /* marked for review */
.pb.ansrev { background: var(--tp-violet); border-color: var(--tp-violet); color: #fff; border-radius: 50%; }
.pb.ansrev::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.ex-submit { padding: 14px 16px; border-top: 1px solid var(--tp-line); }
.ex-save { font-size: 12px; color: var(--tp-muted); }
.ex-warn { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 100; }
@media (max-width: 991.98px) {
  body.tp-exam { overflow: auto; }
  .ex-body { grid-template-columns: 1fr; height: auto; }
  .ex-card { margin: 0 10px; padding: 16px; min-height: 55vh; }
  .ex-secs { padding: 8px 10px 0; }
  .ex-foot { padding: 10px; }
  .ex-side { border-left: 0; border-top: 1px solid var(--tp-line); }
  .ex-grid { grid-template-columns: repeat(8, 1fr); }
  .ex-top { padding: 0 10px; } .ex-top .who { display: none; }
}

/* result */
.rs-hero { background: linear-gradient(135deg, #0f1b33, color-mix(in srgb, var(--tp-brand) 60%, #0f1b33)); color: #fff; border-radius: 18px; padding: 26px; display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
.rs-ring { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#fbbf24 calc(var(--p) * 1%), rgba(255,255,255,.15) 0); }
.rs-ring div { width: 104px; height: 104px; border-radius: 50%; background: #0f1b33; display: grid; place-items: center; text-align: center; }
.rs-ring b { font-size: 26px; display: block; } .rs-ring small { font-size: 12px; color: #c9d2e3; }
.rs-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.rs-facts div { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; }
.rs-facts b { display: block; font-size: 20px; } .rs-facts span { font-size: 12.5px; color: #c9d2e3; }
.rv-q { background: #fff; border: 1px solid var(--tp-line); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.rv-opt { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; margin-top: 6px; border: 1px solid var(--tp-line); font-size: 14.5px; }
.rv-opt.right { border-color: #86efac; background: #f0fdf4; }
.rv-opt.wrong { border-color: #fca5a5; background: #fef2f2; }
.rv-exp { margin-top: 10px; background: #f8fafc; border-left: 3px solid var(--tp-brand); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
@media (max-width: 640px) { .rs-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* layout helpers + phone fixes */
.min-w-0 { min-width: 0; }
.ex-top > .min-w-0 { flex: 1; }
.ex-timer { flex-shrink: 0; }
@media (max-width: 575.98px) {
  .ex-top { gap: 8px; }
  .ex-top img { display: none; }
  .ex-timer { font-size: 15px; padding: 5px 9px; }
  .ex-foot .btn { flex: 1 1 calc(50% - 8px); padding: 9px 8px; font-size: 14px; }
  .ex-foot .ms-auto { margin-left: 0 !important; }
  .ex-text { font-size: 15.5px; }
}
/* case studies */
.tp-case-tag { font-size: 12px; font-weight: 700; color: var(--tp-brand); margin-bottom: 6px; }
.tp-case-passage { background: #f8fafc; border-left: 3px solid var(--tp-brand); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.tp-case-child { font-size: 13.5px; margin: 6px 0 0 4px; }
.tp-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex-passage { background: #f8fafc; border: 1px solid var(--tp-line); border-left: 4px solid var(--tp-brand); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 15px; line-height: 1.65; max-height: 38vh; overflow: auto; }
.ex-passage .lbl { font-size: 12px; font-weight: 700; color: var(--tp-brand); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.rv-passage { background: #f8fafc; border-left: 3px solid var(--tp-brand); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 14.5px; }