:root {
  --primary: #0a3d62;
  --accent: #2e86de;
  --ink: #1f2733;
  --muted: #6b7684;
  --line: #e4e8ee;
  --bg: #f4f6f9;
  --danger: #c0392b;
  --ok: #1e8449;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

/* ---------- upload page ---------- */
.upload-page { display: flex; justify-content: center; padding: 32px 16px; }
.card {
  background: #fff;
  width: 100%;
  max-width: 1300px;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(16, 32, 55, 0.08);
  overflow: hidden;
}
.brand {
  background: var(--primary);
  color: #fff;
  padding: 28px 32px;
  text-align: center;
}
.brand .logo { max-height: 64px; max-width: 100%; height: auto; margin-bottom: 12px; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 650; }
.intro { padding: 22px 32px 4px; color: var(--muted); }
.closed-notice { padding: 40px 32px; text-align: center; font-size: 17px; color: var(--ink); }
.card .closed-notice { max-width: 640px; margin: 0 auto; }
form { padding: 8px 32px 32px; }
/* On a wide desktop card, keep the intro + form in a centred reading column so
   the description and fields don't sit hard against the left edge. The coloured
   header/footer still span the full card width. */
.card .intro, .card form { max-width: 1200px; margin-left: auto; margin-right: auto; }
label { display: block; margin: 16px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
input, textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea { min-height: 84px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.req { color: var(--danger); }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
label.check input { width: auto; margin-top: 3px; }

.filezone {
  margin-top: 20px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-weight: 500;
}
.filezone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, #fff); }
.filezone input[type=file] { display: none; }
.filezone-text strong { color: var(--accent); }
.filezone-text small { color: var(--muted); }

/* Cascading agenda session picker (Day → Room → Session) on the upload form. */
.session-picker { margin-top: 4px; }
.session-picker .sp-label { font-weight: 500; margin-bottom: 6px; }
.session-picker label { margin-top: 8px; }
.session-picker select { width: 100%; }

/* Linked-field dropdowns (fields bound to CSV columns). */
.lf-select, .lf-text { width: 100%; margin-top: 4px; }
.sp-link { display: inline-block; width: auto; margin: 8px 0 0; padding: 0; background: none; border: 0; color: var(--accent); font-size: 14px; cursor: pointer; }

/* Chosen-files list (multiple files → auto-zipped on upload). */
.filelist { list-style: none; margin: 12px 0 0; padding: 0; }
.filelist li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; font-size: 14px; }
.filelist .fl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .fl-size { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.filelist .fl-x { width: auto; margin: 0; padding: 0 8px; line-height: 1.4; font-size: 18px; background: none; color: var(--muted); border: 0; cursor: pointer; }
.filelist .fl-x:hover { color: #b23b2e; }
.filelist .fl-note { display: block; border: 0; border-radius: 0; padding: 8px 2px 0; margin: 4px 0 0; color: var(--muted); font-size: 13px; }

button {
  margin-top: 22px;
  width: 100%;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
button:hover { filter: brightness(0.95); }
button:disabled { opacity: 0.6; cursor: default; }

.progress { margin-top: 18px; height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.message { margin-top: 18px; padding: 14px 16px; border-radius: 9px; white-space: pre-line; font-size: 14px; }
.message.error { background: #fdecea; color: var(--danger); }
.message.success { background: transparent; padding: 0; }
.done { text-align: center; padding: 40px 24px 48px; }
.done .tick { width: 64px; height: 64px; line-height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 34px; }
.done h2 { margin: 0 0 8px; font-size: 22px; }
.done p { margin: 6px 0; color: var(--ink); }
.done-file { display: inline-block; margin: 18px 0 24px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fc; font-size: 14px; }
.done-file-name { font-weight: 600; }
.done-file-size { color: var(--muted); font-variant-numeric: tabular-nums; }
.again-btn { width: auto; margin: 0 auto; padding: 11px 22px; background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.again-btn:hover { background: color-mix(in srgb, var(--accent) 8%, #fff); filter: none; }
.muted { color: var(--muted); }
.foot { padding: 18px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.hidden { display: none !important; }
/* Presenter-facing help text shown under a form field's label. */
.field-help { display: block; margin-top: 3px; font-weight: 400; color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* ---------- admin ---------- */
/* Dependency-free WYSIWYG editor, Froala v5-styled: one framed box with a white
   toolbar of grouped icon buttons above the editing surface. */
.wz-label { display: block; }
.wz-box { border: 1px solid #dfe1e6; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); overflow: hidden; margin-top: 4px; }
.wz-box:focus-within { border-color: #2f6fed; box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.wysiwyg-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 5px 6px; margin: 0; background: #fff; border-bottom: 1px solid #edeef1; }
.wz-group { display: flex; align-items: center; gap: 1px; padding: 0 5px; }
.wz-group:first-child { padding-left: 2px; }
.wz-group + .wz-group { border-left: 1px solid #ececf0; }
.wysiwyg-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: #3a3f4b; font-size: 14px; line-height: 1; transition: background .12s, color .12s; }
.wysiwyg-btn:hover { background: #eef0f4; color: #14161c; }
.wysiwyg-btn:active { background: #e4e7ee; }
.wysiwyg-btn.active { background: #e7eefb; color: #2f6fed; }
.wysiwyg-btn svg { width: 17px; height: 17px; display: block; }
.wysiwyg-btn .wz-ch { font-size: 16px; font-weight: 600; }
.wysiwyg-colorwrap { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
.wysiwyg-colorwrap:hover { background: #eef0f4; }
.wysiwyg-color { width: 20px; height: 20px; padding: 0; border: 1px solid #d4d7de; border-radius: 4px; cursor: pointer; background: #fff; vertical-align: middle; }
.wysiwyg-size, .wysiwyg-line, .wysiwyg-font, .wysiwyg-format { width: auto; height: 30px; padding: 0 6px; margin: 0 0 0 3px; font-size: 13px; color: #3a3f4b; border: 1px solid #dfe1e6; border-radius: 6px; background: #fff; cursor: pointer; }
.wysiwyg-size:hover, .wysiwyg-line:hover, .wysiwyg-font:hover, .wysiwyg-format:hover { border-color: #c3c7d0; }
.wysiwyg-bgwrap .wysiwyg-color { border-radius: 4px; }
/* Fullscreen editing */
body.wz-full-lock { overflow: hidden; }
.wz-box.wz-full { position: fixed; inset: 0; z-index: 1200; margin: 0; border-radius: 0; border: 0; display: flex; flex-direction: column; box-shadow: none; }
.wz-box.wz-full .wysiwyg, .wz-box.wz-full .wysiwyg-src.src-open { flex: 1; min-height: 0; }
/* Symbol / emoji picker popover */
.wz-charpop { position: absolute; z-index: 1300; width: 300px; max-height: 340px; overflow-y: auto; padding: 8px 10px 10px; background: #fff; border: 1px solid #dfe1e6; border-radius: 10px; box-shadow: 0 8px 28px rgba(16, 24, 40, .18); }
.wz-clab { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 2px 4px; }
.wz-clab:first-child { margin-top: 2px; }
.wz-cgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.wz-cch { width: 100%; height: 32px; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; color: #1a2230; }
.wz-cch:hover { background: #eef0f4; }
/* Editor block formats, so headings/quotes read right while editing */
.wysiwyg h1 { font-size: 1.7em; margin: .2em 0 .3em; }
.wysiwyg h2 { font-size: 1.4em; margin: .2em 0 .3em; }
.wysiwyg h3 { font-size: 1.2em; margin: .2em 0 .3em; }
.wysiwyg h4 { font-size: 1.05em; margin: .2em 0 .3em; }
.wysiwyg blockquote { margin: .3em 0; padding: 2px 0 2px 12px; border-left: 3px solid #d4d7de; color: #555; }
.fontrows { display: flex; flex-direction: column; gap: 6px; }
.fontrow { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* Live streams (IVS): one card per channel with copyable RTMP / key / playback fields. */
.streamrows { display: flex; flex-direction: column; gap: 10px; }
.streamrow { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; }
.streamrow-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.streamrow-head strong { flex: 1; }
/* Label on its own line + input/buttons in a row below, so credentials stay
   fully visible and copyable on a phone (no fixed-width overflow). */
.stream-field { margin: 8px 0; }
.stream-field > label { display: block; margin: 0 0 3px; font-size: 13px; color: var(--muted, #667); }
.sf-row { display: flex; align-items: center; gap: 6px; }
.sf-row input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 6px; }
.sf-row .btn-sm { flex: 0 0 auto; }
.w-nntokbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; }
.w-nntokbar .btn-sm { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.w-vlist { display: flex; flex-direction: column; gap: 4px; }
.w-vrow { display: flex; align-items: center; gap: 8px; }
.w-panelfx { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.w-panelfx label { margin: 0; font-size: 12px; }
.w-panelfx input[type="number"] { width: 44px; }
.w-panelfx input[type="color"] { width: 30px; padding: 0; }
.w-place { display: inline-flex; align-items: center; gap: 4px; }
.w-place select { margin: 0; }
.w-map { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.w-map > label { margin: 0; }
/* Live mini preview of a screen (an iframe of its public page, scaled to a thumbnail). */
.scr-mini-wrap { display: inline-block; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #000; position: relative; }
.scr-mini { border: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.font-name { font-weight: 600; min-width: 140px; }
.font-sample { flex: 1; font-size: 20px; color: #333; }
.wysiwyg-src.src-open { display: block; width: 100%; min-height: 160px; margin: 0; font-family: "Courier New", monospace; font-size: 13px; line-height: 1.4; border: 0; border-radius: 0; padding: 12px 14px; background: #fafbfc; box-sizing: border-box; resize: vertical; }
.wysiwyg-src.src-open:focus { outline: none; }
.wysiwyg { min-height: 120px; border: 0; border-radius: 0; padding: 12px 14px; margin: 0; background: #fff; font-size: 14px; line-height: 1.5; overflow-y: auto; }
.wysiwyg:focus { outline: none; }
.wysiwyg p { margin: 0 0 8px; }
.wysiwyg:empty::before { content: attr(data-placeholder); color: #98a0ad; }
/* Collapsible Event & branding sections + hover "?" guides. */
.evsec { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #fff; }
.evsec > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 15px; list-style: none; display: flex; align-items: center; }
.evsec > summary::-webkit-details-marker { display: none; }
.evsec > summary::before { content: '▸'; margin-right: 10px; color: var(--muted); transition: transform .15s; }
.evsec[open] > summary::before { transform: rotate(90deg); }
.evsec[open] > summary { border-bottom: 1px solid var(--line); }
.evsec-body { padding: 6px 16px 16px; }
.evsave { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tip { display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; width: 17px; height: 17px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 11px; font-weight: 700; cursor: help; position: relative; flex: none; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 0; top: 24px; width: 260px; max-width: 70vw; background: #1f2733; color: #fff; padding: 9px 11px; border-radius: 8px; font-size: 12px; font-weight: 400; line-height: 1.45; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.25); white-space: normal; }
/* Custom-domain DNS record helper (Event & branding). */
.dns-help { margin: 4px 0 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fc; }
.dns-help > p:first-child { margin-top: 0; }
.dns-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.dns-table th, .dns-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dns-table th { font-weight: 600; color: var(--muted); }
.dns-table code { font-size: 12.5px; }
.dns-copy { width: auto; padding: 2px 8px; margin-left: 6px; font-size: 12px; }
.admin-body { background: var(--bg); }
.topbar { background: var(--primary); color: #fff; padding: 14px 22px; display: flex; align-items: center; gap: 16px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; }
.topbar select, .topbar button.link { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 7px; padding: 8px 12px; }
.topbar button.link { cursor: pointer; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 22px; }
/* Submissions grid uses the full desktop width. */
.wrap.wide { max-width: none; }
/* Keep Open/Download pinned to the right edge as the grid scrolls horizontally. */
.subs th.col-actions, .subs td.row-actions {
  position: sticky; right: 0; z-index: 1; white-space: nowrap;
  background: #fff; box-shadow: -8px 0 8px -8px rgba(0,0,0,.15);
}
.subs tbody tr:hover td.row-actions { background: #fafbfc; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { width: auto; margin: 0; background: transparent; color: var(--muted); border-radius: 8px 8px 0 0; padding: 10px 16px; font-size: 14px; }
.tabs button.active { color: var(--primary); border-bottom: 3px solid var(--accent); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: end; }
.filters label { margin: 0; font-size: 12px; color: var(--muted); }
.filters input, .filters select { margin-top: 4px; padding: 8px 10px; font-size: 14px; min-width: 150px; }
.filters button { width: auto; margin: 0; padding: 9px 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #fafbfc; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.uploaded { background: #eaf6ef; color: var(--ok); }
.badge.pending { background: #fdf3e3; color: #b9770e; }
.badge.purged { background: #eef1f5; color: var(--muted); }
.btn-sm { display: inline-block; width: auto; margin-top: 0; padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: 7px; background: var(--accent); color: #fff; border: 0; cursor: pointer; text-decoration: none; vertical-align: middle; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--line); }
/* A plain text-style link button (e.g. "← Back to screens"); the top bar keeps
   its own pill styling via the more-specific .topbar rule. */
button.link { width: auto; margin: 0; padding: 4px 2px; background: none; color: var(--accent); font-weight: 600; font-size: 14px; }
button.link:hover { filter: none; text-decoration: underline; }
.btn-sm.btn-danger { background: var(--danger); }
.up-toggle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.up-state { font-weight: 700; font-size: 13px; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px; }
.up-state.open { background: color-mix(in srgb, var(--ok) 16%, #fff); color: var(--ok); }
.up-state.closed { background: color-mix(in srgb, var(--danger) 14%, #fff); color: var(--danger); }
/* Agenda RAG upload-status */
.rag { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.rag-green { background: var(--ok); }
.rag-amber { background: #e0a800; }
.rag-red { background: var(--danger); }
/* Split approval: a small green/amber pie (proportion set inline via conic-gradient). */
.rag-pie { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; border: 1px solid rgba(0,0,0,0.12); box-sizing: border-box; }
/* Editable agenda table */
.ag-table td { padding: 4px 6px; }
.ag-cell { width: 100%; min-width: 90px; margin: 0; padding: 6px 8px; font-size: 13px; box-sizing: border-box; }
.ag-table th .ag-coldel { width: auto; margin: 0 0 0 4px; font-size: 12px; line-height: 1; }
.ag-newrow td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.rag-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.rag-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); }
.rag-p-green { background: color-mix(in srgb, var(--ok) 12%, #fff); }
.rag-p-amber { background: color-mix(in srgb, #e0a800 14%, #fff); }
.rag-p-red { background: color-mix(in srgb, var(--danger) 10%, #fff); }
/* NAS health cards */
.dh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.dh-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.dh-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 14px; }
.dh-row { display: flex; gap: 10px; font-size: 13px; padding: 3px 0; border-top: 1px solid var(--bg); }
.dh-k { color: var(--muted); flex: 0 0 74px; }
.dh-v { flex: 1; min-width: 0; word-break: break-word; }
.dh-err { color: var(--danger); }
.dh-bar { display: inline-block; width: 90px; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 22%, #eee); vertical-align: middle; overflow: hidden; }
.dh-bar i { display: block; height: 100%; background: var(--ok); }
.dh-bar.low { background: color-mix(in srgb, var(--danger) 22%, #eee); }
.dh-bar.low i { background: var(--danger); }
/* Room screens admin */
.scr-bgrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px; }
.scr-bgrow label { margin: 0; }
.scr-thumb { max-height: 90px; max-width: 160px; border: 1px solid var(--line); border-radius: 6px; background: #000; object-fit: cover; aspect-ratio: 16/9; }
.scr-thumb.sm { max-height: 54px; max-width: 96px; }
/* Agenda import wizard */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.map-grid label { margin: 0; }
.req { color: var(--danger); }
/* Player-diagnostics viewer (admin) */
.diag-cols { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }
.diag-cols > div { flex: 1; min-width: 220px; }
.diag-feat { border-collapse: collapse; width: 100%; font-size: 13px; }
.diag-feat td { padding: 2px 8px 2px 0; border-bottom: 1px solid var(--line); }
.diag-feat td:last-child { text-align: right; white-space: nowrap; }
.sc-block { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #fff; }
.sc-block > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.sc-block[open] > summary { border-bottom: 1px solid var(--line); }
.sc-block.sc-conflict { border-color: #e0a800; }
/* The ⚠ chip + note live in the DOM always; shown only while the block conflicts,
   toggled live as the times are edited. */
.sc-block:not(.sc-conflict) .sc-warn,
.sc-block:not(.sc-conflict) .sc-warn-note { display: none; }
.sc-warn { color: #9a6b00; font-weight: 600; }
.sc-warn-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: color-mix(in srgb, #e0a800 14%, #fff); border: 1px solid #e0a800; color: #7a5400; }
.sc-body { padding: 12px 14px; }
.sc-times { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 6px 0; }
.sc-times label { margin: 0; }
/* 16:9 live preview canvas with a draggable/resizable text box */
/* outline (not border) so the frame doesn't shift the % positioning — the preview
   then matches the borderless public page exactly. */
.scr-canvas { position: relative; width: 100%; max-width: 640px; aspect-ratio: 16/9; background: #000; outline: 1px solid var(--line); outline-offset: -1px; border-radius: 8px; overflow: hidden; margin: 4px 0 10px; }
.scr-cbg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.scr-box { position: absolute; display: table; box-sizing: border-box; outline: 1px dashed rgba(255,255,255,0.8); cursor: move; touch-action: none; }
/* Match the public page (screen.php .ccell/.ctxt) EXACTLY so the preview is truthful:
   padding on the text div (3%), no text-shadow, gaps only from line spacing. */
.scr-box-cell { display: table-cell; padding: 0; }
.scr-box-txt { font-family: Arial, Helvetica, sans-serif; color: #fff; line-height: 1.2; padding: 3%; box-sizing: border-box; word-wrap: break-word; }
.scr-box-txt p, .scr-box-txt div { margin: 0; }
.scr-rz { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: var(--accent); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; touch-action: none; }
.w-cfg { font-size: 13px; }
.w-cfg .wf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.w-cfg label { margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.w-cfg .w-fp { width: 60px; }
.w-cfg .w-col { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; }
/* Screen editor header + per-section widget bars */
.scr-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 2px; }
.w-section { margin: 4px 0 6px; }
.w-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.w-bar select { margin: 0; width: auto; min-width: 150px; }
.w-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card, #fff); font-size: 13px; }
.w-chip strong { font-weight: 600; }
h5.wsub { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 2px; }
details.pg-block { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; margin: 8px 0; }
details.pg-block > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.pg-block .pg-body { padding-top: 6px; }
.btn-sm:disabled { opacity: .5; cursor: not-allowed; }
.row-actions a, .row-actions button { margin-right: 6px; }
/* Batch actions on the submissions list */
.batchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.batch-count { font-size: 13px; color: var(--muted); margin-right: 4px; }
.subs .col-sel { width: 34px; text-align: center; }
.subs .col-sel input { cursor: pointer; }
.login-card { max-width: 380px; margin: 8vh auto; }
.muted-block { color: var(--muted); font-size: 14px; }
.stat { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
/* Submissions pager */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.pager .pg { background: #fff; color: var(--accent); border: 1px solid var(--line, #d9dee5); }
.pager .pg:hover:not([disabled]) { background: color-mix(in srgb, var(--accent) 8%, #fff); filter: none; }
.pager .pg.active { background: var(--accent); color: #fff; border-color: var(--accent); cursor: default; }
.pager .pg[disabled] { opacity: .45; cursor: default; }
.pager .pg-gap { padding: 0 2px; color: var(--muted); }
h2.section { font-size: 16px; margin: 4px 0 14px; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }
code { background: #f0f2f5; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } .card { border-radius: 0; } }

/* Drag-to-reorder field rows (admin Fields tab) */
.draghandle { cursor: grab; color: var(--muted, #888); user-select: none; width: 1.5rem; text-align: center; }
tr.dragging { opacity: .5; }

/* Clickable variable chips for the file/folder template */
.tokchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 14px; }
.tokchips .tok { width: auto; font: 12px/1.4 ui-monospace, monospace; padding: 3px 8px; border: 1px solid var(--line, #ccc); border-radius: 999px; background: var(--panel, #f5f5f5); cursor: pointer; }
.tokchips .tok:hover { border-color: var(--accent, #4a7); }
.tokchips .tok-custom { border-style: dashed; }
.tokchips .tokdiv { font-size: 12px; opacity: .7; }

/* Submission detail: versions, change log, checked badge */
.badge.checked { background: #1f9d55; color: #fff; }
.verlist, .loglist { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.verlist li, .loglist li { padding: 6px 10px; border: 1px solid var(--line, #ddd); border-radius: 8px; font-size: 13px; }

/* Grouped, labelled variable chips */
.tokchips { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 16px; }
.tokgroup { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toklabel { width: 100%; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .6; margin-bottom: 2px; }
.tokchips .tok-agenda { border-style: dashed; }

/* Change-password modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; overflow-y: auto; }
/* Cap the height so a tall modal (e.g. the field editor) scrolls inside itself
   instead of running off the top/bottom of the screen. */
.modal { max-width: 380px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-wide { max-width: 560px; }

/* Variable chips: explicit dark text (were inheriting the button white) */
.tokchips .tok { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.tokchips .tok:hover { background: var(--bg); border-color: var(--accent); color: var(--ink); filter: none; }
.tokchips .tok-custom { border-style: dashed; border-color: var(--accent); }
.tokchips .tok-agenda { border-style: dashed; }
.tokchips .toklabel { color: var(--muted); }

/* Submissions column picker */
.colpicker { margin: 6px 0 10px; }
.colpicker summary { cursor: pointer; color: var(--accent); font-size: 13px; width: max-content; font-weight: 600; }
.colmenu { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; background: #fff; }
.colmenu label { margin: 0; font-weight: 400; }

/* Login helper links */
.login-links { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; flex-wrap: wrap; }
.login-links .link { width: auto; font-size: 13px; }

/* Back-office agenda auto-suggest banner (submission detail) */
.agenda-suggest { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, #fff); border-radius: 10px; padding: 12px 14px; margin: 6px 0 14px; }
.agenda-suggest .sg-head { font-size: 14px; }
.agenda-suggest .help { margin: 4px 0 10px; }
.sg-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.sg-row:first-of-type { border-top: 0; }
.sg-vals { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sg-cand { font-size: 12px; }
.sg-chip { font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.sg-apply { width: auto; flex: 0 0 auto; }
.sg-filled { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
