:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #ebe8e2;
  --ink: #1b2223;
  --ink-2: #5b6566;
  --line: #d9d5cd;
  --brand: #0f3d3e;
  --brand-ink: #ffffff;
  --accent: #1f7a6d;
  --live: #d64933;
  --wait: #c98a12;
  --ok: #2f7d4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111617; --surface: #1a2122; --surface-2: #232c2d; --ink: #eef1f0; --ink-2: #9aa6a5;
    --line: #2e393a; --brand: #2a8c80; --accent: #4fb3a5; --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 5; }
.topbar .title { font-weight: 650; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar button, .topbar a { color: inherit; background: rgba(255,255,255,.12); border: 0; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer; }
.brandmark { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brandmark svg { width: 26px; height: 26px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 160px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input, textarea, select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { min-height: 96px; resize: vertical; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 12px; padding: 12px 18px; cursor: pointer; text-decoration: none; background: var(--brand); color: var(--brand-ink); min-height: 46px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); padding: 8px 10px; min-height: 0; }
.btn.danger { background: var(--live); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

.error { background: #fde8e4; color: #8a2414; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .error { background: #3a1d18; color: #ffb4a6; } }
.notice { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.pill.live { background: var(--live); color: #fff; }
.pill.ok { background: var(--ok); color: #fff; }

/* Meeting credentials */
.creds { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start; }
.creds .v { font-size: 1.4rem; font-weight: 700; white-space: nowrap; }
.creds img { width: 92px; height: 92px; background: #fff; border-radius: 8px; padding: 4px; }
@media (max-width: 520px) { .creds { grid-template-columns: 1fr 1fr; } .creds img { grid-column: span 2; justify-self: center; width: 140px; height: 140px; } .creds .v { font-size: 1.2rem; } }

/* Speak button */
.speak-zone { display: flex; flex-direction: column; align-items: center; padding: 18px 0 8px; }
.speak { --lvl: 0; position: relative; width: 196px; height: 196px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-size: 1.5rem; font-weight: 750; color: #fff; background: var(--brand); box-shadow: 0 10px 30px rgba(15,61,62,.35); touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .2s, transform .1s; }
.speak:active { transform: scale(.97); }
.speak::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 6px solid var(--live); opacity: 0; transform: scale(calc(1 + var(--lvl) * .18)); transition: transform .08s linear; }
.speak .sub { display: block; font-size: .85rem; font-weight: 500; opacity: .9; margin-top: 4px; }
.speak.speaking { background: var(--live); box-shadow: 0 10px 30px rgba(214,73,51,.4); }
.speak.speaking::before { opacity: .55; }
.speak.queued { background: var(--wait); }
.speak.listening { background: var(--accent); }
.speak.listening::before { opacity: .45; border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: .85rem; padding: 6px 12px; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.seg button:disabled { opacity: .45; cursor: default; }
.speak.busy { background: var(--ink-2); }
.speak:disabled { opacity: .55; }
.floor-status { margin-top: 14px; text-align: center; min-height: 1.5em; font-weight: 600; }
.queue { text-align: center; font-size: .9rem; }

/* Transcript feed */
.feed { display: flex; flex-direction: column; gap: 4px; }
.line { padding: 10px 12px; border-radius: 12px; }
.line:hover { background: var(--surface-2); }
.line .who { font-weight: 700; font-size: .9rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.line .who time { font-weight: 500; color: var(--ink-2); font-size: .8rem; }
.line .text { white-space: pre-wrap; word-wrap: break-word; }
.line .text[contenteditable="true"] { outline: 2px solid var(--accent); border-radius: 6px; padding: 4px; background: var(--surface); }
.line.live .who::after { content: "● speaking"; color: var(--live); font-size: .75rem; font-weight: 700; animation: blink 1.2s infinite; }
.line.processing .who::after { content: "finishing…"; color: var(--wait); font-size: .75rem; font-weight: 600; }
.line .tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.line .tools button { font-size: .8rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.line .tools audio { height: 32px; max-width: 100%; }
.line.mine .who { color: var(--accent); }
@keyframes blink { 50% { opacity: .35; } }

.typebox { display: flex; gap: 8px; margin-top: 12px; }
.typebox input { flex: 1; }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; transition: transform .25s; max-width: 92vw; z-index: 50; }
#toast.show { transform: translateX(-50%) translateY(0); }

/* Projector screen */
.screen { position: fixed; inset: 0; background: #0b1414; color: #f2f5f4; display: grid; grid-template-rows: auto 1fr auto; font-family: var(--font); }
.screen header { display: flex; align-items: center; gap: 24px; padding: 2.2vh 3vw; border-bottom: 1px solid #1f2e2e; }
.screen header h1 { font-size: clamp(20px, 2.6vw, 44px); margin: 0; flex: 1; }
.screen .join { display: flex; align-items: center; gap: 18px; font-size: clamp(14px, 1.3vw, 24px); color: #a9bab8; }
.screen .join b { color: #fff; font-size: 1.3em; letter-spacing: .06em; }
.screen .join img { width: clamp(80px, 9vw, 170px); height: auto; background: #fff; padding: 6px; border-radius: 10px; }
.screen main { overflow: hidden; padding: 3vh 4vw; display: flex; flex-direction: column; justify-content: flex-end; gap: 2.4vh; }
.screen .past { color: #8fa3a1; font-size: clamp(18px, 2vw, 36px); }
.screen .past b, .screen .now b { color: #7fd6c8; font-weight: 700; }
.screen .now { font-size: clamp(26px, 3.6vw, 68px); line-height: 1.25; font-weight: 600; }
.screen .now .spk { display: inline-flex; align-items: center; gap: .4em; font-size: .55em; color: #ff8a73; margin-bottom: .2em; }
.screen .now .spk::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: #ff5a3d; animation: blink 1.2s infinite; }
.screen footer { padding: 1.4vh 3vw; color: #6f8482; font-size: clamp(12px, 1vw, 18px); display: flex; justify-content: space-between; gap: 16px; }
.screen .idle { color: #6f8482; font-size: clamp(22px, 2.6vw, 48px); }

/* Chairperson speaking list */
.chairq { border-color: var(--wait); }
.chairq .list li { padding: 6px 0; gap: 8px; }
.who-btn { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; min-height: 52px; }
.who-btn:hover { border-color: var(--accent); }
.who-btn .n { width: 28px; height: 28px; border-radius: 50%; background: var(--wait); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.who-btn .grow { flex: 1; min-width: 0; }
.who-btn .go { color: var(--accent); font-weight: 650; font-size: .9rem; white-space: nowrap; }
.chairq .x { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px; width: 40px; height: 52px; cursor: pointer; font-size: 1rem; }
#hand.raised { background: var(--wait); color: #fff; border-color: transparent; }
.screen .sq { color: #ffc861; font-weight: 600; }

/* Meeting phase */
.pill.wait { background: var(--wait); color: #fff; }

/* Current agenda item above the Speak button */
.nowitem { text-align: center; font-size: .95rem; padding: 8px 12px; margin: -4px -4px 4px; border-radius: 10px; background: var(--surface-2); }

/* Agenda card */
.agenda .aglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agitem { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.agitem:hover:not(:disabled) { border-color: var(--accent); }
.agitem:disabled { cursor: default; }
.agitem .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .8rem; }
.agitem .grow { flex: 1; min-width: 0; }
.aglist li.cur .agitem { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: 600; }
.aglist li.cur .n { background: var(--accent); color: #fff; }
.agitem .tag { font-size: .72rem; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 99px; }
.agenda .res { margin: 4px 0 2px 36px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .88rem; display: flex; gap: 8px; align-items: flex-start; }
.agenda .res .x { margin-left: auto; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.agnote { background: color-mix(in srgb, var(--wait) 16%, var(--surface)); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; font-size: .9rem; }
.agnote .link { margin-left: 8px; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink-2); font-size: .85rem; margin: 0; }
label.check input { width: auto; }

/* Transcript line item tag */
.line .who .itm { font-size: .72rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 1px 7px; border-radius: 99px; }
.line .who .itm:empty { display: none; }
.line .tools .itemsel { width: auto; max-width: 100%; padding: 4px 8px; font-size: .8rem; }

/* Minutes card */
.minutes { border-color: var(--accent); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; vertical-align: -2px; animation: spin .8s linear infinite; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Projector additions */
.screen header .grow { flex: 1; min-width: 0; }
.screen .scur { margin-top: .4vh; color: #7fd6c8; font-size: clamp(14px, 1.5vw, 28px); font-weight: 600; }
.screen .banner { align-self: center; text-align: center; margin: auto 0; font-size: clamp(28px, 4vw, 72px); font-weight: 650; color: #e9efee; }
.screen .banner .sub { font-size: .4em; font-weight: 500; color: #8fa3a1; margin-top: .6em; }
.screen footer { align-items: center; }
.spkbtn { font: inherit; font-size: clamp(12px, 1vw, 18px); color: #a9bab8; background: transparent; border: 1px solid #2c3d3d; border-radius: 99px; padding: 6px 14px; cursor: pointer; }
.spkbtn.on { color: #0b1414; background: #7fd6c8; border-color: #7fd6c8; font-weight: 700; }

/* Invite link box */
.invite { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.invite label { margin: 0; }
.invrow { display: flex; gap: 8px; }
.invrow input { flex: 1; min-width: 0; font-size: .85rem; padding: 10px; }
.invite a.btn { min-height: 40px; padding: 8px 14px; }

/* Agenda sub-items */
.agsubs { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 2px 36px; }
.agsub { display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: .88rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.agsub:hover:not(:disabled) { border-color: var(--accent); }
.agsub:disabled { cursor: default; }
.agsub .sn { font-weight: 700; color: var(--ink-2); min-width: 2.4em; }
.agsub .grow { flex: 1; min-width: 0; }
.agsub.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: 600; }
.agsub.cur .sn { color: var(--accent); }

/* Chairperson link */
.chairlink { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.chairlink summary { cursor: pointer; }
.chairlink .list li { padding: 6px 0; }

.trsw { display: grid; grid-template-columns: auto auto; gap: 6px 10px; align-items: center; justify-content: start; }
@media (max-width: 420px) { .trsw { grid-template-columns: 1fr; } }

/* Attendee microphone list */
.people .list li { padding: 8px 0; gap: 8px; flex-wrap: wrap; }
.pill.off { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }

.people .list li.attn { background: color-mix(in srgb, var(--wait) 12%, var(--surface)); border-radius: 10px; padding: 8px 10px; border-top-color: transparent; }

/* Waiting room */
.lobby { border-color: var(--wait); }
.lobby .list li { gap: 8px; }
.danger-text { color: var(--live) !important; }
.overlay { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); display: grid; place-items: center; padding: 24px; }
.ovbox { max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px; box-shadow: var(--shadow); }
.spinner.big { width: 36px; height: 36px; border-width: 3px; margin: 0 auto 14px; display: block; }
