/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: 18px 18px 16px; border-bottom: 1px solid var(--line-2); }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; color: var(--ink-2); font-weight: 550; font-size: 13.5px; }
.nav a:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--brand-50); color: var(--brand-700); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .sep { height: 1px; background: var(--line-2); margin: 10px 6px; }
.nav .badge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .crumbs { flex: 1; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.user-btn:hover { background: #f7f9fb; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.menu { position: absolute; right: 28px; top: 54px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 210px; padding: 6px; z-index: 50; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; font-size: 12.5px; }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); }
.menu button:hover { background: var(--line-2); }

#view { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }
.page-h { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h .titles { flex: 1; min-width: 240px; }
.page-h p { margin: 4px 0 0; color: var(--muted); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #eef7fc 0%, #f4f6f9 55%); }
.login-card { width: 100%; max-width: 400px; padding: 32px; }
.login-card .logo { margin-bottom: 22px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.stat.live .v { color: var(--brand-700); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- live monitor ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.live-card { overflow: hidden; }
.live-cam { aspect-ratio: 4 / 3; background: #1b2735; position: relative; display: grid; place-items: center; color: #8a99ab; font-size: 12.5px; }
.live-cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-cam .tag { position: absolute; left: 10px; top: 10px; background: rgba(0, 0, 0, .55); color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.live-cam .vio { position: absolute; right: 10px; top: 10px; }
.live-info { padding: 12px 14px; }
.live-info .name { font-weight: 650; }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: var(--brand); }

/* ---------- questions editor ---------- */
.q-card { padding: 16px 18px; display: flex; gap: 14px; }
.q-num { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-50); color: var(--brand-700); font-weight: 700; display: grid; place-items: center; flex: none; font-size: 13px; }
.q-body { flex: 1; min-width: 0; }
.q-text { white-space: pre-wrap; font-weight: 550; margin-bottom: 10px; word-wrap: break-word; }
.q-opts { display: grid; gap: 6px; }
.q-opt { display: flex; gap: 9px; align-items: flex-start; padding: 7px 10px; border-radius: 7px; background: #f8fafc; border: 1px solid var(--line-2); font-size: 13.5px; }
.q-opt .l { font-weight: 700; color: var(--muted); width: 16px; flex: none; }
.q-opt.correct { background: var(--green-bg); border-color: #c4e6d3; }
.q-opt.correct .l { color: var(--green); }
.q-opt.picked { box-shadow: inset 3px 0 0 var(--brand); }
.q-opt.picked.wrong { background: var(--red-bg); border-color: #f1caca; box-shadow: inset 3px 0 0 var(--red); }
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.q-actions { display: flex; flex-direction: column; gap: 6px; }
.opt-edit { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.opt-edit .l { width: 22px; font-weight: 700; color: var(--muted); text-align: center; }

/* ---------- settings ---------- */
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 12px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.callout { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: #135d80; }
.callout b { color: #0e4a66; }

/* ---------- results ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 550; }
.kpi .v { font-size: 19px; font-weight: 700; margin-top: 3px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.tl-item:last-child { border-bottom: 0; }
.tl-time { width: 92px; flex: none; font-size: 12.5px; color: var(--muted); }
.tl-time b { display: block; color: var(--ink); font-size: 13px; }
.tl-body { flex: 1; min-width: 0; }
.tl-imgs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumb { width: 132px; aspect-ratio: 4 / 3; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; background: #1b2735; display: block; }
.thumb.screen { width: 176px; aspect-ratio: 16 / 9; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery figure .thumb { width: 100%; }
.gallery figcaption { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; background: none; font: inherit; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand-700); border-bottom-color: var(--brand); }
.lightbox img { max-width: 100%; display: block; margin: 0 auto; border-radius: 8px; }

.invite-results { margin-top: 14px; }
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box input { font-family: var(--mono); font-size: 12px; height: 32px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  #view { padding: 18px; }
  .topbar { padding: 0 18px; }
}

/* cards inside grids/stacks use the grid gap, not the stacked-card margin */
.kpis > .card + .card, .stats > .card + .card, .live-grid > .card + .card, .stack > .card + .card { margin-top: 0; }
