/* webinarsd base styles - light/dark, mobile first */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #5b6475;
  --line: #dde1e8; --accent: #1f6feb; --accent-text: #ffffff;
  --ok: #1a7f37; --warn: #9a6700; --err: #cf222e; --live: #d1242f;
  --radius: 8px; --gap: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1117; --panel: #161b22; --text: #e6edf3; --muted: #9da7b3;
          --line: #30363d; --accent: #4493f8; --ok: #3fb950; --warn: #d29922;
          --err: #f85149; --live: #ff6b6b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); }
header.top { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap;
  padding: 10px var(--gap); background: var(--panel); border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 700; margin-right: auto; }
header.top nav a { margin-right: 12px; text-decoration: none; }
header.top form { display: inline; margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: var(--gap); }
main.narrow { max-width: 440px; }
main.wide { max-width: 1600px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--gap); margin-bottom: var(--gap); }
h1 { font-size: 1.5rem; margin: 0 0 var(--gap); }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=url], input[type=search], select, textarea, input:not([type]) {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 140px; font-family: ui-monospace, monospace; font-size: .9rem; }
.row { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 720px) { .row.two { grid-template-columns: 1fr 1fr; }
                            .row.three { grid-template-columns: 1fr 1fr 1fr; } }
button, .btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--err); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--gap); align-items: center; }
.error-text { color: var(--err); font-size: .9rem; margin-top: 4px; }
.notice { padding: 10px 12px; border-radius: 6px; margin-bottom: var(--gap); border: 1px solid var(--line); }
.notice.ok { border-color: var(--ok); color: var(--ok); }
.notice.err { border-color: var(--err); color: var(--err); }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); }
.badge.live { color: var(--live); border-color: var(--live); font-weight: 700; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: var(--gap); }
.toolbar input { max-width: 280px; }
pre.snippet { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px;
  overflow-x: auto; font-size: .85rem; }
.htmx-request .spinner { display: inline; }
.spinner { display: none; }
#ws-log { min-height: 160px; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px; margin-bottom: 8px; background: var(--bg); }
#ws-log p { margin: 2px 0; }
#ws-form { display: flex; gap: 8px; }
.lang-switch a { margin-left: 6px; }

.player { padding: 0; overflow: hidden; }
.player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.idle-media { background: #000; }
.idle-media img, .idle-media video { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.idle-media video { aspect-ratio: 16 / 9; }
.idle-media iframe { pointer-events: none; }
.countdown { font-size: 1.25rem; font-weight: 600; }
.countdown span { font-variant-numeric: tabular-nums; }
.field { margin-bottom: 4px; }
details summary { cursor: pointer; color: var(--accent); }
.description img { max-width: 100%; height: auto; }
body.embed main { padding-top: 0; }
/* inside a WordPress page with a transparent background: the light colors
   (the theme of the WordPress page, not the dark mode of the device) */
body.embed.transparent { background: transparent; color-scheme: light;
  --bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #5b6475;
  --line: #dde1e8; --accent: #1f6feb; --ok: #1a7f37; --warn: #9a6700;
  --err: #cf222e; --live: #d1242f; }

/* ----- webinar room ----- */
.room-page main { max-width: none; }
.room-top .brand { margin-right: 8px; }
.room-top .lang-switch { margin-left: auto; }
.ws-state { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); display: inline-block; }
.ws-state.ok { background: var(--ok); }
.ws-state.off { background: var(--err); }
.room { display: grid; gap: var(--gap); padding: var(--gap); grid-template-columns: 1fr; max-width: 1500px; margin: 0 auto; }
@media (min-width: 980px) { .room { grid-template-columns: minmax(0, 1fr) 380px; } }
.room-side { display: flex; flex-direction: column; padding: 0; min-height: 60vh; max-height: calc(100vh - 90px); }
@media (max-width: 979px) { .room-side { max-height: none; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: 0; border-radius: 0; background: none; padding: 10px 6px; border-bottom: 2px solid transparent; }
.tab.active { border-bottom-color: var(--accent); font-weight: 600; }
.tab-unseen { display: inline-block; min-width: 1.4em; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #d32f2f; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.3; text-align: center; vertical-align: middle; }
.tab-panel { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px; overflow: hidden; }
.tab-panel.active { display: flex; }
.chat-list { flex: 1; overflow-y: auto; min-height: 200px; }
.chat-msg { padding: 4px 0; border-bottom: 1px solid var(--line); word-wrap: break-word; }
.chat-msg .who { font-weight: 600; }
.chat-msg.team .who { color: var(--accent); }
.chat-msg .when, .question .when { color: var(--muted); font-size: .8rem; }
.send-form { display: flex; gap: 8px; margin-top: 8px; }
.send-form textarea { min-height: 0; font-family: inherit; }
.q-list { overflow-y: auto; flex: 1; margin-top: 8px; }
.question { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; }
.question.selected { border-color: var(--accent); }
.question.answered { opacity: .85; }
.question.hidden-q { opacity: .5; }
.q-head .who { font-weight: 600; }
.q-body { margin: 4px 0; white-space: pre-wrap; }
.q-answer { border-left: 3px solid var(--ok); padding-left: 8px; margin-top: 4px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.q-actions button, .toggle button { padding: 4px 8px; font-size: .85rem; }
.answer-form { display: flex; gap: 4px; flex-basis: 100%; }
form.inline { display: inline; margin: 0; }
.people { list-style: none; padding: 0; margin: 0; overflow-y: auto; }
.people li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.toggle button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.hand-box { margin-top: 8px; }
.cta-box { border-color: var(--accent); }
.player-empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.speaker { display: grid; gap: var(--gap); padding: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 980px) { .speaker { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); } }
.q-list.big .q-body { font-size: 1.3rem; }
.q-list.big .question { padding: 12px; }
.speaker .chat-list { max-height: 40vh; }
.ws-state.poll { background: var(--warn); }
/* rich text editor */
.editor-box { background: var(--bg); border-radius: 6px; }
.editor-box .ql-toolbar, .editor-box .ql-container { border-color: var(--line); }
.editor-box .ql-container { min-height: 180px; font-size: 1rem; font-family: inherit; }
.editor-box .ql-editor { min-height: 180px; color: var(--text); }
.editor-toggle { margin-top: 4px; font-size: .85rem; }
@media (prefers-color-scheme: dark) { .ql-snow .ql-stroke { stroke: var(--text); } .ql-snow .ql-fill { fill: var(--text); } .ql-snow .ql-picker { color: var(--text); } }
.shortcodes { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.shortcodes button { font-size: .8rem; padding: 2px 6px; font-family: ui-monospace, monospace; }
.mail-preview { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.actions-cell { white-space: nowrap; }
.actions-cell > * { margin-right: 10px; }
.actions-cell form { display: inline; margin: 0; }
/* certificate editor */
.cert-editor { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cert-editor { grid-template-columns: minmax(0, 1fr) 360px; } }
.cert-stage { background: #8a919c; border-radius: var(--radius); padding: 16px; overflow: hidden; outline: none; }
.cert-stage:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.cert-scale { transform-origin: 0 0; }
.cert-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.cert-tools button { padding: 5px 10px; }
.cert-props label { margin-top: 8px; }
.cert-props .row { gap: 8px; }
.cert-props input[type=number] { width: 100%; }
.cert-props .editor-box .ql-container, .cert-props .editor-box .ql-editor { min-height: 90px; }
.cert-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 6px; }
.cert-files button { padding: 2px; height: 72px; background: #fff; }
.cert-files img { max-width: 100%; max-height: 100%; display: block; margin: auto; }
.ph-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.ph-list button { font-size: .75rem; padding: 2px 6px; font-family: ui-monospace, monospace; }
.cert-page .ce.sel { outline: 2px dashed #0a66ff; outline-offset: 1px; }
.cert-page .ce.edit { cursor: move; }
.cert-page .ce .rh { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px;
  background: #0a66ff; cursor: nwse-resize; border-radius: 2px; }
.cert-page .ce-qr.empty { background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 20% 20%; opacity: .5; }
/* polls */
.poll-panel { border-color: var(--accent); }
.poll-q { border: 0; padding: 0; margin: 0 0 12px; }
.poll-q legend { font-weight: 600; margin-bottom: 4px; }
.poll-q .req { color: var(--err); }
.poll-thanks { color: var(--ok); font-weight: 600; }
.poll-results .pr-q { margin: 10px 0; }
.pr-title { font-weight: 600; margin-bottom: 4px; }
.pr-opt { margin: 4px 0; }
.pr-label { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.pr-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.pr-bar span { display: block; height: 100%; background: var(--accent); }
.pr-text { font-size: .9rem; border-left: 3px solid var(--line); padding-left: 8px; margin: 4px 0; white-space: pre-wrap; }
#poll-host { margin-top: 16px; }
.speaker #poll-host { margin-top: 0; }
.poll-launch select { flex: 1; }
.pq-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.pq-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pq-opt { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin: 4px 0; }
.pq-tools button { padding: 3px 8px; font-size: .85rem; }
/* roles and people */
.perm-group .perm { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.perm-group .perm input { margin-top: 4px; }
.filters { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-items: end; }
.filters label { margin: 0 0 2px; font-size: .85rem; }
.card-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--gap); }
.card-nav a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.history .when { white-space: nowrap; }
.history .details { white-space: pre-wrap; }
tr.ended td { color: var(--muted); }
/* generic tables of values */
.lookup-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lookup-row .lk-field { flex: 1 1 140px; min-width: 120px; }
.lookup-row .lk-field:last-child { flex: 0 0 auto; }
.lk-label { font-size: .8rem; margin: 0 0 2px; color: var(--muted); }
.lookup-settings .lk-field { margin-bottom: 10px; }
.lookup-new { border-bottom: 0; }

/* protocol */
.pre { white-space: pre-wrap; }
.print-page { background: #fff; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.print-table th, .print-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
@media print { .no-print { display: none !important; } .print-page main { max-width: none; padding: 0; } }
.filters .full { grid-column: 1 / -1; }
.filters .full input, .filters .full textarea { width: 100%; }

/* messages */
.conv-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.conv-row.unread b { color: var(--accent); }
.thread { max-height: 60vh; overflow-y: auto; }
.msg { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: var(--bg, #f5f6f8); max-width: 80%; }
.msg.mine { margin-left: auto; background: #e8f0fe; }
.msg-head { font-size: .85rem; margin-bottom: 2px; }
.msg-report summary { font-size: .8rem; cursor: pointer; }

/* v3 phase 3α: newsletter composer */
.cmp-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin-bottom: var(--gap); }
.cmp-head-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; flex: 1 1 420px; }
.cmp-head-fields > div:first-child { flex: 1 1 280px; }
.cmp-head-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cmp-msg { font-size: .9rem; color: var(--muted, #5b6475); }
.cmp-msg.err, #cmp-test-msg.err { color: var(--err); }
.cmp-grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cmp-grid { grid-template-columns: minmax(380px, 5fr) 7fr; } }
.cmp-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.cmp-add button { padding: 6px 10px; }
.cmp-blocks { list-style: none; margin: 0 0 8px; padding: 0; }
.cmp-block { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; background: var(--panel); cursor: pointer; }
.cmp-block > .muted { flex: 1 1 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-block.sel { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.cmp-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cmp-acts { display: flex; gap: 6px; font-size: .85rem; }
.cmp-props label, .cmp-style label { display: block; }
.cmp-props label > input, .cmp-props label > select { display: block; width: 100%; margin-top: 2px; }
.cmp-col { display: flex; gap: 6px; margin: 8px 0; }
.cmp-pick { display: grid; gap: 6px; }
.cmp-thumb { max-width: 160px; max-height: 90px; border: 1px solid var(--line); border-radius: 4px; }
.cmp-style summary { cursor: pointer; font-weight: 700; }
.cmp-style input[type=color] { width: 100%; height: 36px; padding: 2px; }
.cmp-view-bar { display: flex; gap: 6px; margin-bottom: 8px; }
.cmp-view-bar [aria-pressed=true] { border-color: var(--accent); font-weight: 700; }
.cmp-frame { overflow-x: auto; text-align: center; }
.cmp-frame .mail-preview { min-height: 640px; max-width: 100%; display: inline-block; }
#cmp-plain { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
/* help: the page help under the header (templates/help/<lang>/...) and the
   hints under the fields */
.page-help-wrap { max-width: 1100px; margin: 0 auto; padding: var(--gap) var(--gap) 0; }
.page-help { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: .5rem 1rem; }
.page-help > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.page-help[open] > summary { margin-bottom: .4rem; }
.page-help-body { line-height: 1.5; }
.page-help-body h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.page-help-body p, .page-help-body ul, .page-help-body ol { margin: .3rem 0; }
.page-help-body li { margin: .15rem 0; }
.hint { display: block; color: var(--muted); font-size: .85rem; margin: .15rem 0 .5rem; line-height: 1.4; }
.next-step { border-left: 4px solid var(--ok); }
.next-step ol { margin: .3rem 0 0; padding-left: 1.4rem; }
.next-step li.done { color: var(--muted); }
.next-step li.done::marker { content: "✓  "; color: var(--ok); }
.next-step li.todo { font-weight: 600; }
