:root {
  --bg: #0b0e14;
  --panel: #121722;
  --panel-2: #1a2130;
  --line: #232c3f;
  --text: #e8ecf4;
  --muted: #8b96ab;
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, .14);
  --live: #34d399;
  --live-soft: rgba(52, 211, 153, .14);
  --off: #f87171;
  --off-soft: rgba(248, 113, 113, .12);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

.is-hidden {
  display: none !important;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- Logo banner (top) ---------- */
.logo-banner {
  padding: 16px 20px 4px;
  text-align: center;
}

.logo-banner img {
  width: min(480px, 88%);
  height: auto;
  display: inline-block;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(11, 14, 20, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
}

.brand span {
  color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 104px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--off-soft);
  color: var(--off);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-pill.is-live {
  background: var(--live-soft);
  color: var(--live);
}

.status-pill.is-live .dot {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, .5);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill.is-live .dot {
    animation: none;
  }
}

.topbar .spacer {
  flex: 1;
}

.topbar a {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

@media (max-width: 640px) {
  .wrap {
    padding: 12px;
    gap: 10px;
  }
}

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

/* ---------- Card header row ---------- */
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
}

.summary {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  transition: border-color .12s, color .12s;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn.open {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Compact status strip ---------- */
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stat {
  color: var(--text);
  white-space: nowrap;
}

.stat .k {
  color: var(--muted);
}

.stat .running {
  color: var(--live);
}

.stat .stopped {
  color: var(--muted);
}

.stat b {
  font-weight: 500;
  display: inline-block;
  min-width: 0;
}

/* ---------- Preview ---------- */
.preview-thumb {
  position: relative;
  width: 280px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  cursor: zoom-in;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  margin-top: 12px;
}

.preview-thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

.preview-thumb .enlarge-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
}

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .88);
  padding: 24px;
  cursor: zoom-out;
}

.preview-overlay.open {
  display: flex;
}

.preview-overlay video {
  max-width: 100%;
  max-height: 92vh;
  width: min(1100px, 100%);
  border-radius: 12px;
  background: #000;
}

.offline-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

/* ---------- Copy rows ---------- */
.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  min-height: 38px;
}

.copy-label {
  flex: none;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 108px;
}

.copy-url {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.copy-btn {
  flex: none;
  min-width: 82px;
  /* Copy/Copied swap: no shift */
  padding: 8px 0;
  font-size: 13px;
  text-align: center;
}

.copy-btn.copied {
  border-color: var(--live);
  color: var(--live);
}

@media (max-width: 520px) {
  .copy-row {
    flex-wrap: wrap;
  }

  .copy-label {
    min-width: 0;
    width: 100%;
  }
}

/* ---------- Settings panels (collapsed by default) ---------- */
.settings-panel {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-panel.open {
  display: block;
}

.opt-group {
  margin: 0 0 14px;
}

.opt-group:last-child {
  margin-bottom: 0;
}

.opt-label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.opt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.opt::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: border-color .12s, background .12s;
}

.opt:hover {
  border-color: var(--accent);
}

.opt.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.opt.selected::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel-2);
}

.opt:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------- Buttons ---------- */
.btn {
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0e14;
}

.btn.start {
  background: var(--live);
  border-color: var(--live);
  color: #06281c;
}

.btn.stop {
  background: transparent;
  border-color: var(--off);
  color: var(--off);
}

.btn.danger {
  background: transparent;
  border-color: var(--off);
  color: var(--off);
}

.btn.ghost {
  background: transparent;
}

.toggle-btn {
  min-width: 156px;
  text-align: center;
  flex: none;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Inputs ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input:not([type]),
.form-input {
  display: block;
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 11px 13px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--panel-2);
  color: var(--text);

  font-family: inherit;
  font-size: 14px;
  line-height: 22px;

  appearance: none;
  -webkit-appearance: none;
}

input::placeholder {
  color: #5c6679;
}

.input-group {
  margin-bottom: 12px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}

.hint code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 5px;
  word-break: break-all;
}

/* ---------- Add restream wizard ---------- */
.wizard {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.wizard.open {
  display: block;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-title {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* ---------- Item lists ---------- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.item-list:empty {
  margin-top: 0;
}

.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  min-height: 60px;
}

.item.active-item {
  border-color: var(--live);
}

.item .item-main {
  flex: 1;
  min-width: 180px;
}

.item .item-name {
  font-weight: 600;
  font-size: 14px;
}

.item .item-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  word-break: break-all;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 0;
  min-width: 76px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge.on {
  background: var(--live-soft);
  color: var(--live);
}

.badge.off-b {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--line);
}

.item .btn {
  padding: 7px 0;
  font-size: 13px;
  min-width: 96px;
  text-align: center;
}

a.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

a.open-link:hover {
  text-decoration: none;
  background: var(--accent-soft);
}

.stream-key-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.stream-key-link:hover:not(:disabled) {
  background: var(--accent-soft);
}

.empty {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .item {
    align-items: flex-start;
  }

  .item .item-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .item .item-actions .btn {
    flex: 1;
  }
}

/* ---------- Footer ---------- */
.footer {
  margin-top: auto;
  padding: 24px 20px 18px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.footer img {
  width: min(300px, 70vw);
  height: auto;
  display: block;
}

.footer .copyright {
  font-size: 12px;
  color: var(--muted);
}
/* ---------- Forms and messages ---------- */

.form-card {
  width: min(100%, 520px);
  margin: 20px auto;
}

.form-card label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input:not([type]):focus,
.form-input:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.admin-add-panel label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}



.card-action {
  margin-left: auto;
}

.admin-add-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.generated-password {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  font-family: var(--mono);
  word-break: break-all;
}

.ok,
.error,
.err {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.ok {
  color: var(--live);
  background: var(--live-soft);
  border: 1px solid var(--live);
}

.error,
.err {
  color: var(--off);
  background: var(--off-soft);
  border: 1px solid var(--off);
}

input[type="file"] {
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar .spacer {
    display: none;
  }

  .topbar a {
    padding: 4px 2px;
  }

  .status-pill {
    margin-left: auto;
  }

  .card-action {
    width: 100%;
    margin-left: 0;
  }
}
.repository-link {
  color: inherit;
  text-decoration: none;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.repository-link:hover,
.repository-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.repository-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}
.footer-logo-link {
  display: inline-flex;
  border-radius: 6px;
}

.footer-logo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}