:root {
  --bg: #0e1014; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --text: #e8eaf0; --muted: #8b93a5; --accent: #f5b83d; --rec: #ef4444; --ok: #22c55e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--accent); color: #1a1300; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.ghost:hover { border-color: var(--muted); }
button.small { padding: 5px 10px; font-size: 13px; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
label > input, label > select { margin-top: 4px; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
label.check input { width: auto; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 10px var(--rec); }
.brand .show { font-weight: 500; color: var(--muted); font-size: 14px; margin-left: 6px; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { background: var(--panel); padding: 32px; border-radius: 14px; width: min(360px, 92vw); border: 1px solid var(--line); }
.login .sub { color: var(--muted); margin: 4px 0 16px; }
.login button { width: 100%; margin-top: 18px; padding: 11px; }
.err { color: var(--rec); min-height: 1.2em; margin: 10px 0 0; }

/* header */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.presence { display: flex; gap: 12px; margin-left: auto; }
.presence span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.presence span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #444b59; }
.presence span.on { color: var(--text); }
.presence span.on::before { background: var(--ok); }
.conn { font-size: 12.5px; color: var(--muted); }
.conn.bad { color: var(--rec); }

.recbar { background: var(--rec); color: #fff; font-weight: 700; padding: 8px 20px; display: flex; gap: 10px; align-items: center; letter-spacing: .03em; }
.recbar .rectime { margin-left: auto; font-variant-numeric: tabular-nums; }
.recdot { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

main { display: grid; grid-template-columns: 1fr 360px; gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 980px) { main { grid-template-columns: 1fr; } }

/* prep */
.weeknav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.weeklabel { display: flex; flex-direction: column; min-width: 190px; text-align: center; }
.weeklabel span { color: var(--muted); font-size: 12.5px; }
#copyTitles { margin-left: auto; }
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.days button { background: var(--panel); color: var(--text); border: 1px solid var(--line); font-weight: 600; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; }
.days button small { color: var(--muted); font-weight: 400; font-size: 12px; }
.days button.today { border-color: #4b5160; }
.days button.active { background: var(--accent); color: #1a1300; border-color: var(--accent); }
.days button.active small { color: #3d2e00; }

.links { display: flex; flex-direction: column; gap: 12px; }
.link { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; }
.link.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.link.ready { border-left: 4px solid var(--ok); }
.link header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.link .num { flex: 0 0 auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.link .title { font-weight: 600; font-size: 16px; }
.link .meta { display: flex; gap: 10px; align-items: center; margin-left: auto; white-space: nowrap; }
.link .editing { font-size: 12px; color: var(--accent); }
.link .by { font-size: 12px; color: var(--muted); }
.link .grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
@media (max-width: 700px) { .link .grid { grid-template-columns: 1fr; } }
.link .grid label { margin-top: 0; }
.link .linklist { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-size: 13px; }
.link .linklist a { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.link .linklist a:hover { text-decoration: underline; }
.link .recbtn-small { font-size: 12px; padding: 4px 9px; }

/* side */
.side { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.peerstate { font-weight: 600; margin-bottom: 12px; }
.peerstate.ok { color: var(--ok); }
.peerstate.warn { color: var(--accent); }
.meters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.meter { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.meter .bar { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.meter .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok) 0 70%, var(--accent) 70% 88%, var(--rec) 88%); background-size: 280px 100%; transition: width 60ms linear; }
.stats { font-size: 12.5px; color: var(--muted); min-height: 1.2em; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
#startAudio { width: 100%; }
.devices { margin-top: 12px; }
.devices summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.target { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.target strong { color: var(--text); }
.recbtn { width: 100%; background: var(--rec); color: #fff; font-size: 16px; padding: 12px; }
.recbtn.stop { background: var(--text); color: var(--bg); }
.upload { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 1.2em; }
.upload.bad { color: var(--rec); }
.recordings { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; }
.take { border-top: 1px solid var(--line); padding-top: 10px; font-size: 13.5px; }
.take:first-child { border-top: 0; padding-top: 0; }
.take .t { font-weight: 600; }
.take .d { color: var(--muted); font-size: 12px; }
.take .files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.take .files a { color: var(--accent); text-decoration: none; font-size: 13px; }
.take .files a:hover { text-decoration: underline; }
.take .files .pending { color: var(--muted); font-size: 12px; }
.take .del { margin-left: auto; background: none; color: var(--muted); padding: 2px 6px; font-weight: 400; font-size: 12px; }
.take .del:hover { color: var(--rec); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 20; }
.recbar[hidden] { display: none; }

.links .hour { margin: 10px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.links .hour:first-child { margin-top: 0; }
.link .num { max-width: 120px; text-align: center; display: flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 92px; }
.link .num small { font-size: 10.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
@media (min-width: 981px) { .side { position: sticky; top: 66px; align-self: start; max-height: calc(100vh - 80px); overflow: auto; } }
.take .okmark { color: var(--ok); font-size: 12.5px; }
.take .zip { background: var(--accent); color: #1a1300 !important; padding: 5px 10px; border-radius: 7px; font-weight: 600; }
.take .zip:hover { text-decoration: none !important; filter: brightness(1.08); }

/* ---- v2: big timer, DONE, mixer, guests ---- */
.bigtime { font-size: 56px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--muted); line-height: 1.05; margin: 4px 0 10px; }
body.recording .bigtime { color: var(--rec); text-shadow: 0 0 18px rgba(239,68,68,.35); }
.recbar { font-size: 17px; padding: 10px 20px; }
.recbar .rectime { font-size: 26px; }
.donebtn { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 12px; font-size: 13px; }
.donebtn:hover { border-color: var(--ok); color: var(--ok); }
.donebtn.on { background: var(--ok); border-color: var(--ok); color: #04210f; }
.link.done { opacity: .45; background: transparent; }
.link.done .grid { display: none; }
.link.done header { margin-bottom: 0; }
.link.done input.title { text-decoration: line-through; }
.link.done:hover, .link.done:focus-within { opacity: .8; }
.link.done:focus-within .grid { display: grid; }
.mixer { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.strip { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.strip-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 600; }
.strip-top small { color: var(--muted); font-weight: 400; }
.sstate { color: var(--muted); font-weight: 400; font-size: 12px; white-space: nowrap; }
.strip .meter { display: flex; align-items: center; gap: 6px; margin: 6px 0; grid-template-columns: none; }
.strip .meter .bar { flex: 1; }
.clip { font-size: 10px; color: #444b59; border: 1px solid #2a2f3a; border-radius: 4px; padding: 0 4px; }
.clip.on { color: #fff; background: var(--rec); border-color: var(--rec); }
.fader { display: flex; align-items: center; gap: 8px; }
.fader input[type=range] { flex: 1; padding: 0; accent-color: var(--accent); }
.fader span { width: 42px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mute { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 3px 9px; font-size: 12px; font-weight: 500; }
.mute.on { background: var(--rec); border-color: var(--rec); color: #fff; }
.strip.master { background: transparent; }
.host-only { display: none; }
body.is-host .host-only { display: block; }
.inviterow { display: flex; gap: 8px; }
.inviterow button { white-space: nowrap; }
.invites { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.invite { border-top: 1px solid var(--line); padding-top: 8px; font-size: 13.5px; }
.invactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.btnlink { background: var(--accent); color: #1a1300; border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
.btnlink.wa { background: #25d366; color: #052e14; }
/* guest page */
.guestwrap { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.guestwrap .brand { justify-content: center; margin-top: 8px; }
.gh { font-size: 26px; margin: 0 0 8px; }
.steps { padding-left: 20px; line-height: 1.7; }
button.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 16px; }
body.guest .recbar { justify-content: center; }
