:root {
  --bg: #0f1512;
  --panel: #16201b;
  --line: #26352d;
  --text: #e6efe9;
  --muted: #8fa79a;
  --accent: #5fd39a;
  --accent-dim: #245c42;
  --danger: #f0796b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: #111a15;
}

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 18px 0 8px; }

.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--accent);
  margin-bottom: 4px;
}

main { padding: 20px 24px 60px; max-width: 1500px; margin: 0 auto; }

.layout {
  display: grid;
  grid-template-columns: 310px minmax(360px, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1200px) { .layout { grid-template-columns: 300px 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  main { padding: 14px; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: #d8ffe9;
  font-size: 11px;
  white-space: nowrap;
}
.pill.secondary { background: #22302a; color: var(--muted); }
.pill.error { background: #4a201c; color: #ffc7bf; }

button, .button {
  appearance: none;
  border: 1px solid var(--accent-dim);
  background: #1d4c37;
  color: #eafff4;
  padding: 9px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, .button:hover { background: #276348; }
button.secondary, .button.secondary { background: #1b2621; border-color: var(--line); color: var(--text); }
button.secondary:hover, .button.secondary:hover { background: #24332b; }
button.small { padding: 5px 9px; font-size: 12px; }
button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }

input, select {
  width: 100%;
  background: #0f1713;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
}
input:focus, select:focus { outline: 1px solid var(--accent-dim); }

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

.grid-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.grid-buttons.nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 18px; font-size: 12px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0 4px; }

.meta { margin: 10px 0; font-size: 12px; }
.capabilities { display: flex; flex-wrap: wrap; gap: 4px; }
.capabilities span { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #223029; color: #b9d3c5; }
.capabilities span.off { background: #2c2320; color: #b08d84; }

.screen-stage {
  position: relative;
  min-height: 260px;
  background: #0a0f0c;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}
.screen-stage img { width: 100%; height: auto; display: block; cursor: crosshair; }
.screen-stage p { padding: 24px; text-align: center; max-width: 320px; }

.stream {
  min-height: 120px;
  background: #0a0f0c;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stream img { max-width: 100%; display: block; }
audio { width: 100%; margin-top: 8px; }

.list { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.list .item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
}
.list .item:hover { background: #202e27; }
.list .item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item span { color: var(--muted); font-size: 11px; }

.code {
  background: #0a100d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: 11px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow: auto;
}
.code.tall { min-height: 420px; max-height: 72vh; }

.events { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; font-size: 12px; }
.events li { display: grid; grid-template-columns: 58px 70px 1fr; gap: 6px; padding: 4px 0; border-bottom: 1px solid #1c2822; }
.events time { color: #64766c; font-family: var(--mono); font-size: 10px; }
.events b { color: var(--accent); font-weight: 500; font-size: 10px; text-transform: uppercase; }
.events span { color: #c3d5ca; word-break: break-word; }

.gate { max-width: 460px; margin: 40px auto; }
.provision { display: grid; gap: 8px; margin: 12px 0; font-size: 12px; }
.provision div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.provision code { font-family: var(--mono); color: #b9d3c5; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.qr { background: #fff; padding: 10px; border-radius: 8px; width: max-content; margin: 10px 0; }
.qr img, .qr canvas { display: block; width: 220px; height: 220px; }

footer { text-align: center; color: #5e7167; font-size: 11px; padding: 20px; border-top: 1px solid var(--line); }
code { font-family: var(--mono); font-size: .92em; }
