:root { --bg: #f6f7f9; --card: #fff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --accent: #2563eb;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: #111827; color: #fff; }
.topbar nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #d1d5db; }
.topbar nav a.active { color: #fff; font-weight: 600; }
.brand { font-size: 16px; }
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.row > select, .row > input[type=text] { width: auto; flex: 1 1 180px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; }
textarea { min-height: 90px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
button, .btn { display: inline-block; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600;
  background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: #e5e7eb; color: var(--ink); }
button.danger { background: var(--bad); }
button.link { background: none; color: inherit; padding: 0; font-weight: 400; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e5e7eb; }
.pill.ready, .pill.ended, .pill.connected { background: #dcfce7; color: var(--ok); }
.pill.processing, .pill.queued, .pill.started, .pill.opened { background: #fef3c7; color: var(--warn); }
.pill.failed { background: #fee2e2; color: var(--bad); }
.progress { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s; }
.thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #111; display: block; }
.preview { display: grid; grid-template-columns: minmax(240px, 420px) 1fr; gap: 18px; align-items: start; }
.preview canvas { width: 100%; aspect-ratio: 3 / 4; background: #000; border-radius: 10px; display: block; }
@media (max-width: 760px) { .preview { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; 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; }
tr.click { cursor: pointer; }
tr.click:hover { background: #f9fafb; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.copy { display: flex; gap: 8px; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; }
.qr img { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.copy input { flex: 1; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 10; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.login { max-width: 380px; margin: 10vh auto; }
details summary { cursor: pointer; font-weight: 600; margin-top: 10px; }
.consent { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 4px; }
.ws-switch { width: auto; max-width: 220px; padding: 5px 8px; background: #1f2937; color: #fff; border-color: #374151; }
.meter { margin: 6px 0; font-size: 13px; }
.meter .row { flex-wrap: nowrap; gap: 8px; }
.meter .row span:last-child { white-space: nowrap; }
.meter .bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.meter .bar > div { height: 100%; background: var(--ok); }
.meter.near .bar > div { background: var(--warn); }
.meter.full .bar > div { background: var(--bad); }
.banner { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; font-size: 14px; }
.banner.bad { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.tag { display: inline-block; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
@media (max-width: 640px) { .topbar { flex-wrap: wrap; gap: 10px; } .ws-switch { max-width: none; flex: 1; }
  .topbar nav { order: 3; flex-basis: 100%; gap: 14px; } #logout { margin-left: auto; } }
.wide { max-width: 1400px; margin: 0 auto; }
.container:has(.wide) { max-width: 1400px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
textarea.tall { min-height: 320px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.banner.ok { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
ul.issues { margin: 8px 0 12px; padding-left: 18px; font-size: 13px; max-height: 260px; overflow: auto; }
ul.issues li { margin: 3px 0; }
ul.issues li.error { color: var(--bad); }
ul.issues li.warning { color: #92400e; }
details.section { border-top: 1px solid var(--line); padding: 6px 0; }
details.section summary { margin-top: 0; }
table.segments td { font-size: 13px; padding: 5px 6px; }
table.segments td.num { white-space: nowrap; color: var(--muted); width: 1%; }
table.segments td.over { color: var(--bad); font-weight: 600; }
a.btn { text-decoration: none; }
a.btn.secondary { background: #e5e7eb; color: var(--ink); }
.card.sticky { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
@media (max-width: 1000px) { .card.sticky { position: static; max-height: none; } }
