:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10131a;
  color: #e8edf8;
  --panel: #191f2b;
  --border: #303a4e;
  --muted: #9aa7bd;
  --accent: #76a9ff;
  --danger: #ff8794;
  --success: #7ee7ad;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar, main {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}
.topbar {
  padding: 32px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .72rem;
  font-weight: 700;
}
h1, h2 { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); }
h2 { font-size: 1rem; }
.account { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: .9rem; }
main { padding: 20px 0 48px; }

.notice {
  margin-bottom: 20px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #151b27;
}
.notice[data-type="error"] { color: var(--danger); border-color: #87404b; }
.notice[data-type="success"] { color: var(--success); border-color: #39745a; }

.dashboard-grid, .split {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); }
.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel);
  overflow: hidden;
}
.panel-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-controls { display: flex; align-items: center; gap: 12px; }
.status {
  border-radius: 999px;
  padding: 3px 8px;
  background: #253555;
  color: #b7d0ff;
  font-size: .75rem;
  white-space: nowrap;
}
.status.muted { background: #29303d; color: var(--muted); }
.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}
.details dt { color: var(--muted); text-transform: capitalize; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.queue-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.queue-grid span { display: block; color: var(--muted); font-size: .8rem; }
.queue-grid strong { display: block; margin-top: 4px; font-size: 1.7rem; }
.stream-placeholder { min-height: 110px; display: grid; align-content: center; gap: 6px; }
.stream-placeholder p, .form-note { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.live-panel { grid-column: 1 / -1; }
.live-screen {
  min-height: 220px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0b1018;
}
.live-screen img {
  width: 100%;
  min-height: 220px;
  max-height: 420px;
  object-fit: contain;
  background: #05070b;
}
.live-screen .stream-placeholder { padding: 18px; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: #c6d0e4; font-size: .85rem; }
input, select {
  width: 100%;
  color: inherit;
  background: #101722;
  border: 1px solid #3a465c;
  border-radius: 6px;
  padding: 9px 10px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.primary {
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  color: #08111e;
  background: var(--accent);
  font-weight: 700;
}
.primary:disabled { opacity: .55; cursor: wait; }
.form-note { margin-top: 14px; }
.text-button {
  padding: 0;
  color: var(--accent);
  background: none;
  border: 0;
  font-size: .85rem;
}
.list { margin: 0; padding-left: 18px; display: grid; gap: 9px; }
.list.empty { list-style: none; padding-left: 0; color: var(--muted); }
.list li[data-state="ALARM"] { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 740px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: .88rem; overflow-wrap: anywhere; }
dialog {
  width: min(900px, calc(100% - 32px));
  max-height: 85vh;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
dialog::backdrop { background: rgb(0 0 0 / 65%); }
dialog article { min-width: 0; }
.receipt { max-height: 60vh; overflow: auto; padding: 14px; background: #101722; border-radius: 6px; font-size: .78rem; }

@media (max-width: 850px) {
  .dashboard-grid, .split { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; gap: 16px; flex-direction: column; }
}
