@font-face {
  font-family: "Roboto";
  font-style: italic;
  font-weight: 900;
  font-display: swap;
  src: url("/static/fonts/Roboto-BlackItalic.ttf") format("truetype");
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  max-width: 1180px;
  margin: 24px auto;
  padding: 18px 24px;
  font-size: 0.88rem;
}

.site-footer a {
  color: var(--muted, #9aa7a0);
}

.legal-copy {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.65;
}

.legal-consent label {
  align-items: flex-start;
}

.legal-consent input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

:root {
  color-scheme: dark;
  --bg: #101312;
  --panel: #191f1d;
  --panel-2: #202724;
  --text: #eef4f1;
  --muted: #a7b4ae;
  --line: #33403a;
  --accent: #46c28e;
  --accent-2: #f2c14e;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #0d100f;
}

.brand {
  font-family: "Roboto", "Arial Black", sans-serif;
  font-size: 24px;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

nav a,
.link-button {
  color: var(--muted);
  text-decoration: none;
  font: inherit;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.operator-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 36px;
}

h2 {
  margin-bottom: 18px;
  font-size: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.setup-grid {
  margin-bottom: 18px;
}

.dashboard-grid {
  margin-bottom: 18px;
}

.panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.login-panel {
  width: min(420px, 100%);
  margin: 64px auto;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1412;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

input,
select {
  min-height: 40px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #04110b;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  background: var(--danger);
  color: #220808;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quick-card {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.quick-card strong {
  font-size: 17px;
}

.quick-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.quick-card button {
  width: 100%;
}

.quick-card.active {
  border-color: var(--accent);
  background: #14241d;
}

.primary-action {
  border-color: rgba(70, 194, 142, 0.7);
}

.output-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 14px 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.output-mode-bar > div {
  display: grid;
  gap: 4px;
}

.output-mode-bar > div span {
  color: var(--muted);
  font-size: 13px;
}

.output-mode-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.mode-choice {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-choice.active {
  color: var(--text);
}

.output-toggle {
  position: relative;
  display: block;
  width: 54px;
  height: 30px;
  flex: 0 0 54px;
  cursor: pointer;
}

.output-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.output-toggle > span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  transition: background 160ms ease, border-color 160ms ease;
}

.output-toggle > span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 160ms ease;
}

.output-toggle input:checked + span {
  border-color: var(--accent);
  background: #1d6d4c;
}

.output-toggle input:checked + span::after {
  transform: translateX(24px);
}

.output-toggle input:focus-visible + span {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.ingest-monitor {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121816;
  padding: 14px;
  margin-bottom: 18px;
}

.monitor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.monitor-heading div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monitor-heading span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.monitor-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(167, 180, 174, 0.12);
}

.ingest-monitor[data-state="receiving"] .monitor-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(70, 194, 142, 0.16);
}

.ingest-monitor[data-state="waiting"] .monitor-dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.16);
}

.ingest-monitor[data-state="stopped"] .monitor-dot {
  background: var(--muted);
}

.monitor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.monitor-stats div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 10px;
}

.monitor-stats span {
  color: var(--muted);
  font-size: 12px;
}

.monitor-stats strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.bitrate-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f1412;
  border: 1px solid var(--line);
}

.bitrate-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 220ms ease;
}

.bitrate-chart {
  width: 100%;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1412;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 12px;
}

.stat-grid span {
  color: var(--muted);
  font-size: 12px;
}

.stat-grid strong {
  overflow-wrap: anywhere;
}

.metrics {
  display: grid;
  gap: 12px;
  margin: 0;
}

.metrics div {
  display: grid;
  gap: 4px;
}

.connection-list {
  gap: 10px;
}

.copy-row dd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-row code {
  display: block;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1412;
  color: var(--text);
  padding: 9px 10px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.copy-button {
  min-width: 76px;
}

.destination-help {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 12px;
}

.destination-help div {
  display: grid;
  gap: 4px;
}

.destination-help strong {
  color: var(--text);
  font-size: 14px;
}

.destination-help span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.destination-field input {
  border-color: var(--accent);
}

.mobile-setup {
  width: min(720px, 100%);
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.status-live {
  color: #102015;
  background: var(--accent);
}

.status-clips {
  color: #191000;
  background: var(--accent-2);
}

.status-privacy {
  color: #eef4f1;
  background: #3c5f8f;
}

.status-auto {
  color: #102015;
  background: var(--accent);
}

.status-offline {
  color: #191000;
  background: var(--accent-2);
}

.status-error {
  color: #220808;
  background: var(--danger);
}

.alert {
  border: 1px solid #793232;
  border-radius: 6px;
  background: #2a1515;
  color: #ffdada;
  padding: 10px 12px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkline input {
  width: auto;
  min-height: auto;
}

.event-list {
  display: grid;
  gap: 10px;
}

.clip-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.clip-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 90px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.clip-list div {
  display: grid;
  gap: 5px;
}

.status-ready {
  color: #102015;
  background: var(--accent);
}

.status-failed {
  color: #220808;
  background: var(--danger);
}

.danger-text {
  color: #ffb4b4;
}

.event-list article {
  display: grid;
  grid-template-columns: 170px 130px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.event-list time,
.event-list span {
  color: var(--muted);
}

.admin-create {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.user-table {
  display: grid;
  gap: 1px;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.8fr 1fr 1.3fr;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
}

.table-head {
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.table-row {
  border-bottom: 1px solid var(--line);
}

.compact {
  display: grid;
  gap: 8px;
}

small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.parameter-tabs {
  display: grid;
  gap: 18px;
}

.parameter-tabs > input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.tab-buttons {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-buttons label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  white-space: nowrap;
  cursor: pointer;
}

.tab-panel {
  display: none;
}

#tab-setup:checked ~ .tab-buttons label[for="tab-setup"],
#tab-protection:checked ~ .tab-buttons label[for="tab-protection"],
#tab-clips:checked ~ .tab-buttons label[for="tab-clips"],
#tab-events:checked ~ .tab-buttons label[for="tab-events"] {
  border-color: var(--accent);
  background: #14241d;
}

#tab-setup:checked ~ .tab-setup-panel,
#tab-protection:checked ~ .tab-protection-panel,
#tab-clips:checked ~ .tab-clips-panel,
#tab-events:checked ~ .tab-events-panel {
  display: block;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar nav {
    gap: 14px;
  }

  .topbar nav > a[href="/dashboard"] {
    display: none;
  }

  .grid.two,
  .admin-create,
  .table-head,
  .table-row {
    grid-template-columns: 1fr;
  }

  .operator-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .output-mode-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .output-mode-form {
    width: 100%;
    justify-content: space-between;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .quick-card {
    min-height: auto;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .copy-row dd {
    grid-template-columns: 1fr;
  }

  .monitor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .monitor-stats {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .event-list article {
    grid-template-columns: 1fr;
  }

  .clip-list article {
    grid-template-columns: 1fr;
  }
}
