/* PROTRAINING Live Poll: admin area */
:root {
  --teal: #156668;
  --teal-dark: #0E3E3F;
  --aqua: #2EF5FF;
  --sand: #DAD8C3;
  --ink: #2F3E3E;
  --muted: #4D5F5F;
  --bg: #F7F6EF;
  --card: #FFFFFF;
  --line: #E6E4D6;
  --line-strong: #CFCDBC;
  --teal-soft: #E3F1F1;
  --amber-soft: #FFF6E0;
  --amber-ink: #6B4700;
  --red: #A3262A;
  --red-soft: #FBE3E1;
  --green-soft: #D9F4E4;
  --green-ink: #14532D;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-danger { color: var(--red); border-color: #E7B7B4; }
.btn-danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 16px; padding: 0 26px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(21, 102, 104, .35); outline-offset: 2px;
}

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=url], input[type=date], select, textarea {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--ink);
  min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input[type=color] { width: 52px; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.form-section { margin-top: 8px; font-size: 16px; color: var(--teal); }

/* Toggle switch */
.switch { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; font-size: 14px; color: var(--ink); font-weight: 500; cursor: pointer; }
.switch .text { display: flex; flex-direction: column; }
.switch .text small { font-size: 12px; color: var(--muted); font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 26px; flex: none; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { left: 23px; }
.switch input:focus-visible + .track { outline: 3px solid rgba(21,102,104,.35); outline-offset: 2px; }

/* Alerts and badges */
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-ok { background: var(--green-soft); color: var(--green-ink); }
.alert-info { background: var(--teal-soft); color: var(--teal-dark); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-live { background: var(--green-soft); color: var(--green-ink); }
.badge-draft { background: var(--amber-soft); color: var(--amber-ink); }
.badge-ended { background: #EFEDE2; color: var(--muted); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge-dark { background: var(--teal); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.08); vertical-align: middle; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--teal-dark); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 24px; padding: 36px 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card.wide { max-width: 720px; }
.auth-logo { width: 220px; height: auto; margin-bottom: 8px; }

/* App shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidenav { flex: 1 1 240px; max-width: 100%; background: var(--teal-dark); color: #fff; padding: 26px 16px; display: flex; flex-direction: column; gap: 4px; }
.sidenav .brand { padding: 0 10px 4px; }
.sidenav .brand img { width: 180px; height: auto; display: block; }
.sidenav .brand-sub { font-size: 12px; color: var(--sand); padding: 6px 10px 20px; }
.sidenav a.nav { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; color: var(--sand); text-decoration: none; font-size: 15px; }
.sidenav a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidenav a.nav.active { background: rgba(46,245,255,.14); color: #fff; font-weight: 600; }
.sidenav .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.sidenav .me a { color: var(--sand); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; background: var(--sand); color: var(--teal-dark); }
.avatar.admin { background: var(--teal); color: #fff; }
.avatar.super { background: var(--aqua); color: var(--teal-dark); }
.main { flex: 999 1 560px; min-width: 0; padding: 30px clamp(16px, 3vw, 40px) 60px; display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 900px) {
  .sidenav { flex: 0 0 248px; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; }
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.view-pill { display: inline-flex; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; margin-bottom: 8px; }

/* Cards and tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.card-pad { padding: 22px; }
.card-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; color: var(--teal); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; }
table.data td { padding: 14px; border-top: 1px solid #EFEDE2; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 22px; }
table.data th:last-child, table.data td:last-child { padding-right: 22px; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data .actions .btn { margin-left: 4px; }
.sub { font-size: 12px; color: var(--muted); }
.empty { padding: 40px 22px; text-align: center; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(14, 62, 63, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 22px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.modal .qr-box { align-self: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.modal .qr-box canvas, .modal .qr-box img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }
.code-big { font-size: 30px; font-weight: 800; letter-spacing: .08em; color: var(--teal); text-align: center; }

/* Builder */
.builder-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.builder { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.builder .col-list { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.builder .col-edit { flex: 999 1 420px; min-width: 0; }
.builder .col-side { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.qitem { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: #fff; border: 2px solid var(--line); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.qitem.active { border-color: var(--teal); }
.qitem .num { width: 26px; height: 26px; border-radius: 8px; background: var(--teal-soft); color: var(--teal); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.qitem .type { font-size: 11px; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: .06em; }
.qitem .title { font-size: 14px; line-height: 1.35; word-break: break-word; }
.qitem.quiz .type { color: var(--amber-ink); }
.qitem.content .type { color: var(--muted); }
.qmove { display: flex; flex-direction: column; gap: 2px; margin-left: auto; }
.qmove button { border: none; background: transparent; color: var(--muted); cursor: pointer; width: 26px; height: 22px; border-radius: 6px; font-size: 12px; }
.qmove button:hover { background: var(--teal-soft); color: var(--teal); }
.type-group { display: flex; flex-direction: column; gap: 8px; }
.type-group .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--teal); }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.quiz { border-color: #E0B44C; background: var(--amber-soft); color: var(--amber-ink); }
.chip.quiz.on { background: #B07D10; border-color: #B07D10; color: #fff; }
.chip.content { background: var(--bg); font-weight: 500; }
.chip.content.on { background: var(--muted); border-color: var(--muted); color: #fff; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row input[type=text] { flex: 1; }
.opt-row .correct { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.opt-row .correct input { width: 18px; height: 18px; accent-color: #B07D10; }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.icon-btn:hover { color: var(--red); border-color: var(--red); }
.save-state { font-size: 13px; color: var(--muted); }
.upload-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.upload-box img { max-width: 100%; max-height: 180px; border-radius: 12px; border: 1px solid var(--line); }
.qr-inline { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-inline canvas { width: 160px; height: 160px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.theme-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.theme-preview .tp-top { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.theme-preview img { height: 18px; width: auto; align-self: flex-start; }
.readonly-note { background: var(--amber-soft); color: var(--amber-ink); padding: 12px 16px; border-radius: 12px; font-size: 14px; }

/* Report */
.report { max-width: 980px; }
.report-q { padding: 22px; display: flex; flex-direction: column; gap: 12px; break-inside: avoid; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 2fr) 5fr 60px; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 14px; border-radius: 7px; background: #EFEDE2; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--teal); border-radius: 7px; }
.bar.correct span { background: #B07D10; }
.words { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.answers-list { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.answers-list div { padding: 8px 12px; background: var(--bg); border-radius: 10px; }
@media print {
  .sidenav, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .card { border-color: #ddd; }
}
