/* ==========================================================================
   QRMSC — organiser dashboard (loaded after site.css and app.css)
   ========================================================================== */

.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.login-card { width: min(420px, 100%); background: var(--card); border-radius: var(--radius-lg); padding: 2.5rem 2rem; box-shadow: var(--shadow); text-align: center; }
.login-card img { margin: 0 auto 1.25rem; }
.login-card h1 { font-size: 1.9rem; margin-bottom: .5rem; }
.login-card > p { color: var(--slate-soft); margin-bottom: 1.5rem; }
.login-card .field { text-align: left; }
.login-card .input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }

.admin-header { padding-bottom: 0; }
.sync { white-space: nowrap; }
.admin-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.admin-tabs button {
  position: relative; padding: .8rem 1rem .9rem; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-family: var(--sans); font-weight: 600; font-size: .98rem; color: var(--slate-soft);
  display: inline-flex; align-items: center; gap: .45rem;
}
.admin-tabs button[aria-current="page"] { color: var(--deep); }
.admin-tabs button[aria-current="page"]::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--deep); }
.count { min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: var(--wheat); color: #fff; font-family: var(--sans); font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }

.admin-main { padding-top: 2rem; padding-bottom: 5rem; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; margin-bottom: 1.5rem; }
.view-head h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
.view-head p { margin: .35rem 0 0; color: var(--slate-soft); }
.view-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.stat { background: var(--card); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: 0 0 0 1px var(--line); font-family: var(--sans); }
.stat b { display: block; font-size: 2.2rem; line-height: 1; color: var(--deep); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: .45rem; font-size: .9rem; color: var(--slate-soft); }
.stat--alert { background: var(--wheat-soft); box-shadow: none; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

/* Panel control rows */
.control-list { display: grid; gap: 1rem; }
.control {
  background: var(--card); border-radius: var(--radius-lg); padding: 1.25rem 1.4rem; box-shadow: 0 0 0 1px var(--line);
  display: grid; gap: .9rem;
}
.control--live { box-shadow: 0 0 0 2px var(--deep); }
.control-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; align-items: start; }
.control h2 { font-size: 1.35rem; }
.control .meta { margin-top: .2rem; }
.control-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.seg { display: inline-flex; padding: .2rem; gap: .2rem; background: var(--paper-2); border-radius: 999px; }
.seg button { border: 0; background: none; padding: .45rem .8rem; border-radius: 999px; cursor: pointer; font-family: var(--sans); font-weight: 600; font-size: .85rem; color: var(--slate-soft); }
.seg button[aria-pressed="true"] { background: var(--deep); color: var(--paper); }
.control-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; font-family: var(--sans); font-size: .9rem; color: var(--slate-soft); }
.toggle { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-family: var(--sans); font-size: .92rem; font-weight: 600; color: var(--deep); }
.toggle input { appearance: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--disc-2); position: relative; cursor: pointer; transition: background .25s var(--ease); flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--deep); }
.toggle input:checked::after { transform: translateX(1.1rem); }
.reveal { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.reveal > span { font-family: var(--sans); font-size: .85rem; color: var(--slate-soft); margin-right: .25rem; }
.reveal button {
  display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-size: .85rem; font-weight: 600; border: 1.5px solid var(--deep); background: var(--deep); color: var(--paper);
}
.reveal button.is-hidden { background: transparent; color: var(--slate-soft); border-style: dashed; border-color: var(--line-strong); }
.reveal button svg { width: .95rem; height: .95rem; }

/* Questions */
.q-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.q-toolbar .select { width: auto; min-width: 260px; max-width: 100%; }
.q-filters { display: flex; flex-wrap: wrap; gap: .3rem; padding: .25rem; background: var(--paper-2); border-radius: 999px; }
.q-filters button { border: 0; background: none; padding: .45rem .85rem; border-radius: 999px; cursor: pointer; font-family: var(--sans); font-weight: 600; font-size: .88rem; color: var(--slate-soft); }
.q-filters button[aria-pressed="true"] { background: var(--card); color: var(--deep); box-shadow: 0 1px 3px rgba(54, 59, 40, .18); }
.q-list { display: grid; gap: .75rem; }
.q-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: start;
  background: var(--card); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: 0 0 0 1px var(--line);
}
.q-card.is-fresh { animation: fresh 3s var(--ease); }
@keyframes fresh { from { box-shadow: 0 0 0 2px var(--wheat), 0 0 0 8px var(--wheat-soft); } }
.q-card--dismissed { opacity: .6; }
.q-card .q-body { font-size: 1.12rem; line-height: 1.5; margin: 0; white-space: pre-wrap; }
.q-card .q-meta { margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; font-family: var(--sans); font-size: .85rem; color: var(--slate-soft); }
.q-card .q-meta b { color: var(--deep); font-weight: 600; }
.q-card .q-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.star { border: 0; background: none; cursor: pointer; padding: .15rem; color: var(--disc-2); }
.star svg { width: 1.5rem; height: 1.5rem; }
.star[aria-pressed="true"] { color: var(--wheat); }
.q-edit .textarea { min-height: 90px; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: .35rem; border-radius: 8px; color: var(--slate-soft); }
.icon-btn:hover { background: var(--paper-2); color: var(--deep); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; display: block; }
@media (max-width: 680px) {
  .q-card { grid-template-columns: auto minmax(0, 1fr); }
  .q-card .q-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Panel list + editor */
.p-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.p-row:first-child { border-top: 1px solid var(--line); }
.p-row h2 { font-size: 1.2rem; }
.p-order { display: grid; gap: .1rem; }
.p-row .actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.editor { display: grid; gap: 2rem; max-width: 980px; }
.editor fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 1rem; }
.editor legend { font-family: var(--sans); font-size: 1.3rem; font-weight: 700; color: var(--deep); padding: 0; margin-bottom: .25rem; }
.editor .help { font-family: var(--sans); font-size: .88rem; color: var(--slate-soft); margin: -0.5rem 0 0; }
.editor .field + .field { margin-top: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }
.repeat { display: grid; gap: .75rem; }
.repeat-item { background: var(--card); border-radius: var(--radius); padding: 1rem; box-shadow: 0 0 0 1px var(--line); display: grid; gap: .75rem; }
.repeat-item--hidden { box-shadow: 0 0 0 1.5px var(--line-strong); background: transparent; border: 1px dashed var(--line-strong); }
.repeat-head { display: flex; gap: .75rem; align-items: center; }
.repeat-head .input { flex: 1; }
.repeat-tools { display: flex; gap: .2rem; align-items: center; flex-wrap: wrap; }
.panelist-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: .6rem; align-items: center; }
@media (max-width: 680px) { .panelist-row { grid-template-columns: 1fr auto; } .panelist-row .input:first-child { grid-column: 1 / -1; } }
.editor-bar { position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: 1rem 0; background: linear-gradient(to top, var(--paper) 75%, transparent); }
.editor-bar .spacer { flex: 1; }

/* Attendees */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .92rem; }
table.data th { text-align: left; font-weight: 600; color: var(--slate-soft); padding: .75rem .9rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--paper-2); }
table.data td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td b { color: var(--deep); }

/* Settings */
.settings { display: grid; gap: 1.25rem; max-width: 760px; }
.setting { background: var(--card); border-radius: var(--radius-lg); padding: 1.4rem 1.5rem; box-shadow: 0 0 0 1px var(--line); display: grid; gap: .8rem; }
.setting h2 { font-size: 1.2rem; }
.setting p { margin: 0; color: var(--slate-soft); font-size: 1rem; }
.qr-preview { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
.qr-preview .qr { width: 140px; height: 140px; padding: .5rem; background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.qr-preview .qr svg { width: 100%; height: 100%; display: block; }
.qr-preview code { font-family: var(--sans); font-weight: 600; color: var(--deep); word-break: break-all; }

/* ---------- Moderator view ---------- */
.moderator { position: fixed; inset: 0; z-index: 200; background: var(--deep-2); color: var(--paper); overflow-y: auto; --mod-size: 2rem; }
.mod-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; padding: 1rem var(--gutter); background: var(--deep-2); border-bottom: 1px solid var(--line-light); }
.mod-bar h1 { color: var(--paper); font-size: 1.25rem; }
.mod-bar .meta { color: rgba(244, 243, 234, .65); }
.mod-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.mod-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; padding: 1.5rem var(--gutter) 4rem; }
.mod-queue { display: grid; gap: 1rem; align-content: start; }
.mod-q { background: rgba(244, 243, 234, .06); border-radius: var(--radius-lg); padding: 1.5rem 1.75rem; border: 1px solid var(--line-light); }
.mod-q:first-child { background: var(--paper); color: var(--slate); border-color: var(--paper); }
.mod-q p { font-family: var(--serif); font-size: var(--mod-size); line-height: 1.3; margin: 0; }
.mod-q .who { margin-top: .9rem; font-family: var(--sans); font-size: 1rem; color: rgba(244, 243, 234, .7); display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; justify-content: space-between; }
.mod-q:first-child .who { color: var(--slate-soft); }
.mod-q .who b { color: inherit; font-weight: 600; }
.mod-q .btn--light { min-height: 40px; }
.mod-q:first-child .btn--light { border-color: var(--deep); color: var(--deep); }
.mod-q:first-child .btn--light:hover { background: var(--deep); color: var(--paper); }
.mod-empty { padding: 3rem 1.5rem; text-align: center; border: 1.5px dashed var(--line-light); border-radius: var(--radius-lg); font-family: var(--sans); color: rgba(244, 243, 234, .7); }
.mod-side { display: grid; gap: 1.25rem; align-content: start; font-family: var(--sans); }
.mod-side h2 { color: var(--paper); font-size: 1rem; margin-bottom: .6rem; }
.mod-side .reveal { flex-direction: column; align-items: stretch; }
.mod-side .reveal button { justify-content: flex-start; border-color: var(--wheat-soft); background: var(--wheat-soft); color: var(--deep); padding: .6rem .9rem; font-size: .92rem; border-radius: 10px; }
.mod-side .reveal button.is-hidden { background: transparent; color: rgba(244, 243, 234, .7); border-color: rgba(244, 243, 234, .3); }
.mod-side .waiting { padding: 1rem; border-radius: var(--radius); background: rgba(244, 243, 234, .06); color: rgba(244, 243, 234, .8); font-size: .95rem; }
.mod-side .waiting b { color: var(--wheat-soft); font-size: 1.6rem; display: block; }
@media (max-width: 900px) { .mod-grid { grid-template-columns: 1fr; } .moderator { --mod-size: 1.5rem; } }

/* ---------- Venue poster (printed from Settings) ---------- */
.poster { display: none; }
@media print {
  body.printing-poster > *:not(.poster) { display: none !important; }
  body.printing-poster .poster { display: flex !important; }
  .poster { min-height: 96vh; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8mm; font-family: var(--sans); color: #2A2E1F; }
  .poster img { width: 34mm; height: 34mm; }
  .poster h1 { font-size: 34pt; line-height: 1.05; }
  .poster p { font-family: var(--serif); font-size: 15pt; max-width: 150mm; margin: 0; }
  .poster .qr { width: 95mm; height: 95mm; }
  .poster .qr svg { width: 100%; height: 100%; }
  .poster .url { font-size: 16pt; font-weight: 700; }
  .poster .code { font-size: 22pt; font-weight: 800; letter-spacing: .12em; padding: 3mm 8mm; border: 1.5pt solid #2A2E1F; border-radius: 4mm; }
}

.moderator .toggle input { background: rgba(244, 243, 234, .25); }
.moderator .toggle input:checked { background: var(--wheat); }
@media (max-width: 560px) { .sync { display: none; } }
