/* Telegram broadcast controls: scoped to this page only. */
form[data-telegram-slot] { padding: 16px; }
form[data-telegram-slot] fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
form[data-telegram-slot] .form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
form[data-telegram-slot] label { display: grid; gap: 5px; min-width: 0; }
form[data-telegram-slot] label:has([name="key"]) { grid-column: 1 / -1; }
form[data-telegram-slot] .panel-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
form[data-telegram-search] { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 12px; }
form[data-telegram-search] label { flex: 1 1 260px; }
@media(max-width:720px) { form[data-telegram-slot] .form-grid { grid-template-columns: minmax(0,1fr); } }
/* Keep the page scrollbar usable when the operating system hides overlay bars. */
html { overflow-y: scroll; scrollbar-gutter: stable; }
html::-webkit-scrollbar { width: 12px; height: 12px; }
html::-webkit-scrollbar-track { background: #101923; }
html::-webkit-scrollbar-thumb { background: #718396; border: 2px solid #101923; border-radius: 8px; }
html::-webkit-scrollbar-thumb:hover { background: #a8b6c5; }
:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(14, 20, 30, 0.88);
  --panel-strong: rgba(18, 26, 38, 0.98);
  --ink: #f4f8fb;
  --muted: #a8b6c5;
  --line: rgba(177, 194, 212, 0.18);
  --accent: #1fb79e;
  --accent-2: #4f8fe8;
  --accent-3: #f0a04a;
  --warn: #ffd18a;
  --bad: #ff8f84;
  --good: #75e2a0;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.30);
}

.assistant-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, white 10%);
  border-radius: 50%;
  background: var(--accent);
  color: #03120f;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 900;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.assistant-launcher.is-dragging {
  cursor: grabbing;
  transition: none;
}

.stream-action-menu-open .assistant-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.86);
}

.drawer-open .assistant-launcher,
.drawer-open .assistant-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.86);
}

.assistant-panel {
  position: fixed;
  right: 18px;
  bottom: 74px;
  z-index: 69;
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  width: min(390px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(10, 17, 27, 0.97);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px);
}

.assistant-head,
.assistant-form {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border-bottom: 1px solid var(--line);
}

.assistant-head { justify-content: space-between; }
.assistant-head > div { display: grid; gap: 2px; }
.assistant-head small { color: var(--muted); font-size: 10px; }
.assistant-messages { display: grid; align-content: start; gap: 9px; padding: 12px; overflow-y: auto; }
.assistant-message { display: grid; gap: 7px; max-width: 92%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(19, 29, 42, 0.92); font-size: 12px; line-height: 1.45; white-space: pre-line; }
.assistant-message.user { justify-self: end; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 13%, rgba(19, 29, 42, 0.95)); }
.assistant-message button { justify-self: start; }
.assistant-form { align-items: stretch; border-top: 1px solid var(--line); border-bottom: 0; }
.assistant-form textarea { min-height: 50px; max-height: 110px; resize: vertical; }
.assistant-form button { flex: 0 0 auto; }

.local-ai-manager { display: grid; gap: 12px; min-width: 0; }
.local-ai-engine-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.local-ai-model-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.local-ai-model-card { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(7, 12, 20, 0.52); }
.local-ai-model-card.installed { border-color: color-mix(in srgb, var(--good) 44%, var(--line)); }
.local-ai-model-card > div { display: grid; min-width: 0; gap: 3px; }
.local-ai-model-card small { color: var(--muted); }
.local-ai-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.local-ai-actions button:disabled { cursor: not-allowed; opacity: 0.48; filter: saturate(0.35); }

@media (max-width: 560px) {
  .assistant-launcher { right: 10px; bottom: 10px; }
  .assistant-panel { right: 7px; bottom: 64px; width: calc(100vw - 14px); max-height: calc(100vh - 76px); }
  .local-ai-model-list { grid-template-columns: 1fr; }
}

.bulk-stream-import {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.bulk-import-source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.45fr);
  gap: 12px;
}

.bulk-import-source-grid .wide {
  grid-row: span 2;
}

.bulk-import-source-grid textarea {
  min-height: 174px;
  resize: vertical;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.stream-import-options {
  border: 1px solid var(--line);
  background: rgba(8, 16, 27, 0.72);
  border-radius: 6px;
  overflow: hidden;
}

.stream-import-options summary {
  cursor: pointer;
  padding: 11px 13px;
  font-weight: 700;
}

.stream-import-options .form-grid {
  padding: 0 13px 13px;
}

.bulk-import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.bulk-import-actions .muted {
  margin-right: auto;
}

.bulk-import-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}

.bulk-import-actions button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.bulk-import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
}

.bulk-import-summary span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 35, 0.78);
  border-radius: 6px;
}

.bulk-import-summary strong {
  font-size: 18px;
}

.bulk-import-preview {
  max-width: 100%;
  overflow: auto;
}

.bulk-import-preview table {
  min-width: 860px;
}

.bulk-import-preview .muted-row {
  opacity: 0.62;
}

.bulk-import-preview td small {
  display: block;
  margin-top: 3px;
}

.stream-source-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .bulk-import-source-grid {
    grid-template-columns: 1fr;
  }

  .bulk-import-source-grid .wide {
    grid-row: auto;
  }

  .bulk-import-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body[data-theme="blue"] {
  --accent: #4f8fe8;
  --accent-2: #28c4d8;
  --accent-3: #f0a04a;
}

body[data-theme="red"] {
  --accent: #ff625c;
  --accent-2: #2fb4c8;
  --accent-3: #f0b957;
}

body[data-theme="green"] {
  --accent: #75e2a0;
  --accent-2: #4f8fe8;
  --accent-3: #d4a33d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

body.auth-pending #loginView,
body.auth-pending #appView {
  visibility: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(7, 11, 18, 0.38), rgba(7, 11, 18, 0.64)),
    linear-gradient(125deg,
      #0d6a60 0%,
      #174f8a 34%,
      #652f68 68%,
      #70461f 100%),
    #070b12;
  background-repeat: no-repeat;
  background-position: center, 0% 45%, center;
  background-size: cover, 240% 240%, cover;
  animation: ambientSpectrum 14s ease-in-out infinite alternate;
}

body[data-motion="off"]::before {
  animation: none;
}

@keyframes ambientSpectrum {
  0% {
    background-position: center, 0% 40%, center;
  }

  50% {
    background-position: center, 55% 62%, center;
  }

  100% {
    background-position: center, 100% 45%, center;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(20, 29, 42, 0.92);
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
}

button:hover {
  border-color: rgba(219, 231, 244, 0.42);
  background: rgba(28, 39, 55, 0.96);
}

button.is-disabled,
button.is-disabled:hover {
  cursor: default;
  opacity: 0.54;
  border-color: var(--line);
  background: rgba(20, 29, 42, 0.72);
  color: var(--muted);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary.is-disabled,
button.primary.is-disabled:hover {
  background: rgba(31, 183, 158, 0.36);
  border-color: rgba(31, 183, 158, 0.28);
  color: #dce8ec;
}

.ghost {
  background: rgba(255, 255, 255, 0.04);
  color: #edf4fb;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-weight: 800;
}

.app:not([data-active-tab="dashboard"]) button,
.app:not([data-active-tab="dashboard"]) input,
.app:not([data-active-tab="dashboard"]) select,
.app:not([data-active-tab="dashboard"]) textarea {
  font-size: 12px;
}

.app:not([data-active-tab="dashboard"]) button {
  min-height: 32px;
}

.app:not([data-active-tab="dashboard"]) input,
.app:not([data-active-tab="dashboard"]) select,
.app:not([data-active-tab="dashboard"]) textarea {
  min-height: 34px;
  padding: 7px 9px;
}

.hidden {
  display: none !important;
}

.login-wrap {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(7, 11, 18, 0.76), rgba(7, 11, 18, 0.38), rgba(7, 11, 18, 0.76)),
    linear-gradient(145deg, rgba(7, 11, 18, 0.30), rgba(8, 15, 26, 0.72));
}

.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("/assets/backgrounds/world-panel-login-bg-1600.jpg") center center / cover no-repeat;
  opacity: 0.64;
  filter: saturate(1.08) contrast(1.05);
}

.login-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(7, 11, 18, 0.70), rgba(7, 11, 18, 0.12), rgba(7, 11, 18, 0.70)),
    linear-gradient(125deg,
      rgba(18, 168, 145, 0.22),
      rgba(33, 112, 198, 0.18),
      rgba(177, 64, 150, 0.15),
      rgba(228, 142, 58, 0.18));
  background-size: cover, 220% 220%;
  background-position: center, 0% 50%;
  animation: loginSpectrum 18s ease-in-out infinite alternate;
  pointer-events: none;
}

body[data-motion="off"] .login-wrap::after {
  animation: none;
}

@keyframes loginSpectrum {
  0% {
    background-position: center, 0% 50%;
  }

  100% {
    background-position: center, 100% 50%;
  }
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  background: rgba(13, 19, 29, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
  text-align: center;
  backdrop-filter: blur(18px);
}

.login-panel > div {
  display: grid;
  justify-items: center;
  width: 100%;
}

.login-brand {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  justify-items: center;
  align-items: center;
  width: 100%;
  text-align: center;
}

.login-brand img {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: contain;
}

.login-brand h1 {
  text-align: center;
}

.login-panel h1,
.topbar h2 {
  margin: 0;
}

.topbar h2 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.panel-release-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  border: 1px solid rgba(87, 212, 185, 0.34);
  border-radius: 999px;
  background: rgba(24, 133, 114, 0.16);
  color: #a9e7d8;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  justify-items: center;
  width: 100%;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-panel label {
  align-items: center;
  text-align: center;
  width: 100%;
}

.login-panel input {
  text-align: center;
}

.login-panel .primary {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 11, 18, 0.78);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--bad);
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 78px 1fr;
}

.app.sidebar-collapsed.sidebar-hovered,
.app.sidebar-collapsed:has(.sidebar:hover) {
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  height: 100vh;
  padding: 18px;
  background:
    linear-gradient(160deg, rgba(23, 107, 95, 0.34), rgba(45, 95, 154, 0.26), rgba(217, 120, 47, 0.12)),
    #111820;
  color: #edf2f7;
  overflow: hidden;
  transition: width 160ms ease, padding 160ms ease;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr 34px;
  align-items: center;
  gap: 10px;
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
}

.asset-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-cover-safe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.brand small {
  display: block;
  color: #9fb0c3;
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow-y: auto;
  padding-right: 3px;
}

#logoutButton {
  width: 100%;
}

.nav-button {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  background: transparent;
  border-color: transparent;
  color: #c9d5e2;
  font-size: 13px;
  text-align: left;
}

.nav-group .nav-button {
  grid-template-columns: 24px 1fr 16px;
}

.nav-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  justify-self: center;
}

.nav-button.active,
.nav-button:hover {
  background: #1d2834;
  border-color: #2b3b4d;
  color: #fff;
}

.nav-submenu {
  display: grid;
  gap: 4px;
  margin: 5px 0 3px 32px;
  padding: 6px;
  border: 1px solid rgba(177, 194, 212, 0.16);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.48);
}

.nav-submenu button {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.035);
  border-color: transparent;
  color: #d9e4ef;
  font-size: 12px;
  text-align: left;
}

.nav-submenu button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  justify-self: center;
}

.nav-submenu button:hover {
  border-color: rgba(117, 226, 160, 0.34);
  color: #fff;
}

.nav-submenu button.active {
  background: rgba(31, 183, 158, 0.18);
  border-color: rgba(31, 183, 158, 0.44);
  color: #fff;
}

.nav-subgroup {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.nav-submenu .nav-subgroup-toggle {
  grid-template-columns: 18px minmax(0, 1fr) 14px;
  background: rgba(255, 255, 255, 0.055);
  font-weight: 800;
}

.nav-subgroup-items {
  display: grid;
  gap: 3px;
  margin-left: 12px;
  padding-left: 6px;
  border-left: 1px solid rgba(117, 226, 160, 0.24);
}

.nav-subgroup-items button {
  min-width: 0;
}

.management-log-nav-items {
  max-height: min(46vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
}

.nav-subgroup-items button span,
.nav-subgroup-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-submenu-label {
  padding: 6px 8px 2px;
  color: #8fa1b6;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .sidebar {
  padding: 14px 10px;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .brand {
  grid-template-columns: 52px;
  justify-content: center;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .brand-copy,
.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .sidebar-toggle,
.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-button strong,
.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-group .nav-group-toggle svg:last-child,
.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-submenu,
.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) #logoutButton {
  display: none;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) nav {
  padding-right: 0;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 36px;
  padding: 8px;
}

.app.sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-group .nav-button {
  grid-template-columns: 1fr;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(6, 10, 16, 0.58);
}

.app[data-layout="top"] {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.app[data-layout="top"] .sidebar {
  position: sticky;
  top: 0;
  z-index: 6;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  align-items: center;
  height: auto;
  min-height: 74px;
  padding: 12px 18px;
  overflow: visible;
}

.app[data-layout="top"] .brand {
  min-width: 220px;
}

.app[data-layout="top"] nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
  padding-right: 0;
}

.app[data-layout="top"] .nav-button {
  grid-template-columns: 22px auto;
  width: auto;
  min-width: 112px;
  white-space: nowrap;
}

.app[data-layout="top"] .nav-group {
  position: relative;
}

.app[data-layout="top"] .nav-group .nav-button {
  grid-template-columns: 22px auto 16px;
}

.app[data-layout="top"] .nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  width: 220px;
  margin: 0;
  box-shadow: var(--shadow);
  background: rgba(13, 19, 29, 0.98);
}

.app[data-layout="top"] #logoutButton {
  min-width: 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  min-width: 0;
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(10, 16, 25, 0.92), rgba(16, 25, 37, 0.84)),
    linear-gradient(110deg, rgba(31, 183, 158, 0.12), rgba(79, 143, 232, 0.10), rgba(240, 160, 74, 0.08));
  backdrop-filter: blur(10px);
}

.toolbar {
  position: relative;
  z-index: 19;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: visible;
}

.language-select {
  width: auto;
  min-width: 138px;
}

.search-scope-select {
  width: auto;
  min-width: 154px;
  max-width: 210px;
}

.toolbar input {
  width: min(300px, 36vw);
}

.line-list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 20, 30, 0.48);
}

.line-list-toolbar select {
  width: auto;
  min-width: 180px;
}

.line-list-count {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.management-log-switcher {
  margin: 0 0 12px;
}

.management-log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.mass-edit-entity {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.mass-edit-entity button {
  min-width: 0;
}

.mass-edit-entity button.active {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  color: var(--text);
}

.mass-edit-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 10px 0;
}

.mass-edit-form label {
  min-width: 0;
}

.mass-edit-form select[multiple] {
  min-height: 118px;
}

.mass-edit-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.mass-edit-selection .muted {
  margin-inline-start: auto;
}

.mass-edit-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(150px, 0.8fr)) minmax(90px, 0.35fr);
  gap: 8px;
  margin: 16px 0 10px;
}

.mass-edit-operation {
  display: grid;
  gap: 5px;
  margin-bottom: 7px;
}

.mass-edit-grid table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

.mass-edit-grid .mass-edit-pick-column { width: 44px; }
.mass-edit-grid .mass-edit-name-column { width: 36%; }
.mass-edit-grid .mass-edit-category-column { width: 23%; }
.mass-edit-grid .mass-edit-status-column { width: 110px; }
.mass-edit-grid .mass-edit-tmdb-column { width: 90px; }
.mass-edit-grid .mass-edit-media-table .mass-edit-name-column { width: 32%; }
.mass-edit-grid th, .mass-edit-grid td { padding: 10px 14px; vertical-align: middle; }
.mass-edit-grid th:first-child, .mass-edit-grid td:first-child { padding: 10px 12px; }
.mass-edit-grid td { height: 64px; }
.mass-edit-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mass-edit-name { min-width: 0; }
.mass-edit-name strong { display: block; color: var(--ink); font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.mass-edit-name .mass-edit-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.mass-edit-logo, .mass-edit-no-image { flex: 0 0 42px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.mass-edit-logo { display: block; object-fit: contain; padding: 3px; }
.mass-edit-no-image { display: grid; place-items: center; color: var(--muted); border-style: dashed; }
.mass-edit-poster { flex: 0 0 34px; }
.mass-edit-text { display: block; color: var(--ink); font-size: 13px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.mass-edit-tmdb-id { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mass-edit-grid .status { min-width: 0; }



.mass-edit-grid tbody tr.mass-edit-row {
  cursor: pointer;
  transition: background-color 100ms ease, box-shadow 100ms ease;
}

.mass-edit-grid tbody tr.mass-edit-row:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.mass-edit-grid tbody tr.mass-edit-row.selected {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.mass-edit-grid.dragging,
.mass-edit-grid.dragging * {
  user-select: none;
}

.mass-edit-poster {
  display: block;
  width: 34px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  background: var(--panel);
}



.mass-edit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 2px;
  color: var(--muted);
}

.mass-edit-pagination .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1100px) {
  .mass-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mass-edit-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .mass-edit-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .mass-edit-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .mass-edit-selection .muted {
    width: 100%;
    margin-inline-start: 0;
  }
}

.management-log-grid button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 10px;
  overflow-wrap: anywhere;
  text-align: left;
}

.ticket-conversation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--border);
}

.ticket-conversation-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ticket-conversation-head span:not(.status) {
  color: var(--muted);
  font-size: 12px;
}

.ticket-conversation {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 560px);
  overflow: auto;
  padding: 14px 2px;
}

.ticket-message {
  width: min(88%, 680px);
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
}

.ticket-message.admin {
  margin-inline-start: auto;
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.ticket-message header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.ticket-message p {
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ticket-reply-form {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.user-menu {
  position: relative;
}

.user-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 116px;
  padding: 0 12px;
  background: rgba(79, 143, 232, 0.20);
  border-color: rgba(79, 143, 232, 0.32);
  color: #f4f8fb;
  font-weight: 800;
}

.user-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 218px;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(24, 33, 45, 0.98);
  box-shadow: var(--shadow);
}

.user-dropdown button {
  min-height: 36px;
  padding: 8px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #cfd9e5;
  text-align: left;
}

.user-dropdown button:hover {
  background: rgba(79, 143, 232, 0.18);
  color: #fff;
}

.user-dropdown hr {
  width: 100%;
  margin: 8px 0;
  border: 0;
  border-top: 1px solid rgba(177, 194, 212, 0.14);
}

html[dir="rtl"] .nav-button,
html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}

html[dir="rtl"] .user-dropdown {
  right: auto;
  left: 0;
}

html[dir="rtl"] .user-dropdown button {
  text-align: right;
}

html[dir="rtl"] .drawer-backdrop {
  justify-content: flex-start;
}

html[dir="rtl"] .drawer {
  border-left: 0;
  border-right: 1px solid var(--line);
  box-shadow: 20px 0 45px rgba(0, 0, 0, 0.38);
}

.content {
  padding: 22px 24px 36px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.compact-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 38px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 15, 24, 0.38);
}

.compact-status-row .status {
  flex: 0 0 auto;
}

.app:not([data-active-tab="dashboard"]) .content {
  font-size: 13px;
  gap: 14px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(17, 24, 32, 0.42);
  backdrop-filter: blur(3px);
}

.drawer {
  width: min(620px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel-strong);
  box-shadow: -20px 0 45px rgba(0, 0, 0, 0.38);
  border-left: 1px solid var(--line);
}

.drawer-backdrop.drawer-page-mode {
  padding: 16px;
  justify-content: center;
  align-items: stretch;
  background: var(--bg);
  backdrop-filter: none;
}

.drawer-backdrop.drawer-page-mode .drawer {
  width: min(1180px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}

.drawer-backdrop.bouquet-editor-drawer {
  padding: 12px;
  justify-content: center;
  align-items: stretch;
}

.drawer-backdrop.bouquet-editor-drawer .drawer {
  width: min(1500px, calc(100vw - 24px));
  max-width: none;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.action-menu-host {
  position: relative;
  overflow: visible;
}

.action-menu {
  position: relative;
}

.action-menu > summary {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu-items {
  margin-top: 6px;
  min-width: 180px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.action-menu-items > button,
.action-menu-items > a {
  width: 100%;
  justify-content: flex-start;
}


.drawer-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  margin: 0;
}

.drawer-body {
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.drawer-body > * {
  min-width: 0;
  max-width: 100%;
}

.drawer-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.drawer-form .wide,
.drawer-form .full {
  grid-column: 1 / -1;
}

.server-provision-form {
  gap: 16px;
}

.server-provision-form [hidden] {
  display: none !important;
}

.server-provision-services {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
}

.server-provision-services legend {
  padding: 0 6px;
  font-weight: 800;
}

.server-provision-services .check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.server-provision-services .check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

@media (max-width: 720px) {
  .server-provision-services .check-grid {
    grid-template-columns: 1fr;
  }
}

.stream-tools-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stream-tools-tabs button {
  min-height: 52px;
  border-radius: 0;
}

.stream-tools-tabs button.active {
  border-color: #4f91e8;
  background: #4f91e8;
  color: #fff;
}

.stream-tools-tabs svg {
  width: 17px;
  height: 17px;
  margin-right: 7px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-tools-body,
.stream-tool-preview {
  display: grid;
  gap: 12px;
}

.stream-tool-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.stream-tool-form label,
.stream-tool-preview article {
  display: grid;
  gap: 7px;
}

.stream-tool-form .full {
  grid-column: 1 / -1;
}

.stream-tool-form textarea,
.stream-tool-preview code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stream-tool-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.stream-tool-preview {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stream-tool-preview-heading,
.stream-tool-preview article {
  padding: 12px 14px;
}

.stream-tool-preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(79, 145, 232, .1);
}

.stream-tool-preview article {
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
}

.stream-tool-preview article small {
  grid-column: 1 / -1;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .stream-tools-tabs,
  .stream-tool-form {
    grid-template-columns: 1fr;
  }

  .stream-tool-form .full {
    grid-column: auto;
  }
}

.server-provision-step,
.server-provision-progress {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, var(--accent) 12%);
}

.server-provision-step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.server-provision-step-title > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  color: #062b27;
  background: var(--accent);
  font-weight: 900;
}

.server-provision-step-title div {
  display: grid;
  gap: 3px;
}

.server-provision-step-title strong { font-size: 17px; }
.server-provision-step-title small { color: var(--muted); }
.server-provision-step .line-form-grid { padding: 0; }

.server-host-key-result {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 9px;
  background: rgba(21, 199, 177, 0.08);
  overflow-wrap: anywhere;
}

.server-host-key-result span { color: var(--muted); font-size: 12px; }
.server-host-key-confirm { margin-top: 12px; }
.server-provision-progress { display: grid; gap: 10px; }
.server-provision-progress progress { width: 100%; height: 14px; accent-color: var(--accent); }
.server-provision-progress pre { max-height: 180px; overflow: auto; white-space: pre-wrap; color: var(--muted); }
.server-provision-error { padding: 12px; border: 1px solid var(--danger); border-radius: 9px; color: var(--danger); }

@media (max-width: 720px) {
  .server-provision-step { padding: 12px; }
}

.import-section-picker {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-section-picker legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 720px) {
  .choice-grid {
    grid-template-columns: 1fr;
  }
}

.first-party-device-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.first-party-device-item {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
}

.first-party-device-main,
.first-party-device-key,
.first-party-device-status {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.first-party-device-hash {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.first-party-device-statuses {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.first-party-device-status small {
  color: var(--muted);
  font-size: 10px;
}

.first-party-device-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .first-party-device-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .first-party-device-key,
  .first-party-device-statuses {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .first-party-device-list {
    padding-inline: 12px;
  }

  .first-party-device-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .first-party-device-actions {
    justify-content: flex-start;
  }
}

.settings-section-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 0;
}

.settings-section-nav button {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 7px;
  text-align: start;
}

.settings-section-nav button strong {
  font-size: 12px;
}

.settings-section-nav button small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.25;
}

.settings-section-nav button.active small {
  color: color-mix(in srgb, white 72%, var(--muted));
}

.settings-section-nav button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 24%, rgba(8, 13, 21, 0.86));
  color: #fff;
}

.settings-more {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.settings-more > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.settings-more > summary::-webkit-details-marker {
  display: none;
}

.settings-more > summary span {
  color: var(--muted);
  font-size: 12px;
  text-align: end;
}

.settings-navigation .settings-more > summary {
  display: grid;
  justify-content: stretch;
  gap: 3px;
}

.settings-navigation .settings-more > summary span {
  text-align: start;
  line-height: 1.3;
}

.settings-section-nav-secondary {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
}

.settings-drawer .drawer {
  width: min(1180px, 100%);
}

.settings-friendly-layout {
  grid-template-columns: minmax(205px, 235px) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.settings-navigation {
  display: grid;
  grid-column: 1;
  gap: 8px;
  position: sticky;
  top: 0;
}

.settings-nav-title {
  padding: 2px 2px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-mobile-selector {
  display: none;
}

.settings-section-content {
  display: block;
  grid-column: 2;
  min-width: 0;
}

.settings-section-content > [data-settings-section] {
  margin: 0;
}

.settings-section-content > [data-settings-section]:not([open]) {
  display: none;
}

.settings-finder {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(260px, 1.1fr);
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.settings-finder label {
  display: grid;
  gap: 7px;
}

.settings-finder span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.line-list-toolbar [data-line-search-query] {
  width: min(320px, 34vw);
  min-width: 210px;
}

.tmdb-config-needed {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 0;
}

.tmdb-config-needed button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  white-space: nowrap;
}

.tmdb-config-needed button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

@media (max-width: 680px) {
  .settings-finder {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-friendly-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-navigation,
  .settings-section-content {
    grid-column: 1;
  }

  .settings-navigation {
    position: static;
  }

  .settings-navigation > .settings-section-nav,
  .settings-navigation > .settings-more,
  .settings-nav-title {
    display: none;
  }

  .settings-mobile-selector {
    display: grid;
    gap: 6px;
  }

  .line-list-toolbar [data-line-search-query] {
    width: 100%;
    min-width: 0;
  }
}

.line-form-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(38, 49, 63, 0.72);
}

.line-form-tabs-three {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.line-form-tabs-six {
  grid-template-columns: repeat(6, minmax(92px, 1fr));
}

.line-form-tabs-seven {
  grid-template-columns: repeat(7, minmax(80px, 1fr));
}

.line-form-tabs-five {
  grid-template-columns: repeat(5, minmax(105px, 1fr));
}

.line-client-form-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow-x: visible;
}

.line-client-form-tabs button {
  min-width: 0;
  padding: 10px 8px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.line-client-form-tabs button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .line-client-form-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.line-form-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 50px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbe5ef;
  font-weight: 800;
  white-space: nowrap;
}

.line-form-tabs button.active {
  background: #4f8fe8;
  color: #fff;
}

.reseller-form-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow-x: visible;
}

.reseller-form-tabs button {
  min-width: 0;
  padding: 9px 7px;
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
}

.reseller-form-tabs button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .reseller-form-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.line-form-tabs svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-form-tabs button > strong[data-bouquet-tab-count] {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
  line-height: 1.2;
}

.line-form-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.line-form-panel[hidden] {
  display: none;
}

.line-package-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(50, 198, 178, 0.35);
  border-radius: 10px;
  background: rgba(16, 45, 54, 0.58);
}

.line-package-picker label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.line-package-picker select {
  width: 100%;
  min-width: 0;
}

.line-package-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(5, 13, 22, 0.54);
}

.line-package-summary strong,
.line-package-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.line-expiration-control {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 8px 10px;
  align-items: end;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(5, 13, 22, 0.42);
}

.line-expiration-control label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.line-expiration-control button {
  min-height: 46px;
}

.line-expiration-control [data-line-expiration-status] {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.line-package-expiration {
  gap: 6px;
}

@media (max-width: 640px) {
  .line-expiration-control {
    grid-template-columns: 1fr;
  }

  .line-expiration-control [data-line-expiration-status] {
    grid-column: 1;
  }
}

.bouquet-xui-editor {
  display: contents;
}

.bouquet-xui-page {
  min-width: 0;
  margin: -22px -24px -36px;
  background: #323c4a;
  color: #c8d5e4;
}

.bouquet-xui-module-bar {
  position: relative;
  z-index: 7;
  min-height: 70px;
  padding: 0 24px;
  overflow: visible;
  border-bottom: 1px solid rgba(221, 231, 242, 0.08);
  background: #3b4653;
}

.bouquet-xui-module-menus {
  display: flex;
  align-items: stretch;
  min-height: 70px;
  gap: 6px;
}

.bouquet-xui-menu {
  position: relative;
}

.bouquet-xui-menu > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 70px;
  padding: 0 14px;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  list-style: none;
  user-select: none;
}

.bouquet-xui-menu > summary::-webkit-details-marker,
.bouquet-xui-split-action summary::-webkit-details-marker {
  display: none;
}

.bouquet-xui-menu > summary svg:first-child {
  width: 19px;
  height: 19px;
  color: #e6f1ff;
}

.bouquet-xui-menu > summary svg:last-child {
  width: 13px;
  height: 13px;
  transition: transform 140ms ease;
}

.bouquet-xui-menu[open] > summary svg:last-child {
  transform: rotate(180deg);
}

.bouquet-xui-menu-popover,
.bouquet-xui-split-action details > div {
  position: absolute;
  z-index: 12;
  display: grid;
  min-width: 238px;
  padding: 9px 0;
  border: 1px solid rgba(204, 218, 235, 0.08);
  background: #45515f;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.28);
}

.bouquet-xui-menu-popover {
  inset-inline-start: -18px;
  top: 70px;
}

.bouquet-xui-menu-popover button,
.bouquet-xui-split-action details > div button {
  justify-content: flex-start;
  min-height: 43px;
  padding: 9px 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c8d5e4;
  font-size: 14px;
  font-weight: 500;
  text-align: start;
}

.bouquet-xui-menu-popover button:hover,
.bouquet-xui-menu-popover button.active,
.bouquet-xui-split-action details > div button:hover {
  background: rgba(20, 26, 35, 0.18);
  color: #55a0ff;
}

.bouquet-xui-workspace {
  min-height: 720px;
  padding: 26px clamp(22px, 7vw, 110px) 44px;
}

.bouquet-xui-workspace-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
}

.bouquet-xui-split-action {
  display: flex;
  align-items: stretch;
}

.bouquet-xui-split-action > button,
.bouquet-xui-split-action summary {
  min-height: 40px;
  border-radius: 0;
  background: #0879dd;
  color: #fff;
}

.bouquet-xui-split-action > button {
  padding: 8px 17px;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.24);
}

.bouquet-xui-split-action details {
  position: relative;
}

.bouquet-xui-split-action summary {
  display: grid;
  place-items: center;
  width: 48px;
  cursor: pointer;
  list-style: none;
}

.bouquet-xui-split-action summary svg {
  width: 14px;
  height: 14px;
}

.bouquet-xui-split-action details > div {
  inset-inline-end: 0;
  top: 42px;
}

.bouquet-xui-card {
  min-height: 600px;
  padding: 26px 24px;
  border: 1px solid rgba(204, 218, 235, 0.05);
  background: #3b4654;
  box-shadow: 0 9px 25px rgba(0, 0, 0, 0.12);
}

.bouquet-xui-module-bar svg,
.bouquet-order-drag svg,
.bouquet-order-save svg {
  width: 16px;
  height: 16px;
}

.bouquet-xui-list-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.bouquet-xui-list-controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 700;
}

.bouquet-xui-list-controls input {
  width: min(330px, 42vw);
  min-height: 42px;
  border-radius: 0;
  background: #465260;
}

.bouquet-xui-list-controls select {
  width: 82px;
  min-height: 42px;
  border-radius: 0;
  background: #465260;
}

.bouquet-xui-table {
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

.bouquet-xui-table th,
.bouquet-xui-table td,
.app:not([data-active-tab="dashboard"]) .bouquet-xui-table th,
.app:not([data-active-tab="dashboard"]) .bouquet-xui-table td {
  height: 64px;
  padding: 12px 18px;
  border-bottom-color: rgba(221, 231, 242, 0.06);
}

.bouquet-xui-table thead th,
.app:not([data-active-tab="dashboard"]) .bouquet-xui-table thead th {
  height: 58px;
  background: rgba(33, 41, 52, 0.2);
  color: #c5d1df;
  font-size: 12px;
}

.bouquet-xui-table tbody tr:nth-child(odd) td {
  background: rgba(73, 84, 98, 0.34);
}

.bouquet-xui-table tbody tr:nth-child(even) td {
  background: rgba(49, 59, 72, 0.2);
}

.bouquet-xui-table-wrap.sticky-actions-table table > thead > tr > th:last-child {
  background: #394452;
}

.bouquet-xui-table-wrap.sticky-actions-table table > tbody > tr:nth-child(odd) > td:last-child {
  background: #465260;
}

.bouquet-xui-table-wrap.sticky-actions-table table > tbody > tr:nth-child(even) > td:last-child {
  background: #3c4755;
}

.bouquet-xui-table th:first-child,
.bouquet-xui-table td:first-child,
.bouquet-xui-table th:nth-child(n+3),
.bouquet-xui-table td:nth-child(n+3) {
  text-align: center;
}

.bouquet-xui-table th:first-child,
.bouquet-xui-table td:first-child {
  width: 90px;
}

.bouquet-xui-table th:nth-child(3),
.bouquet-xui-table th:nth-child(4),
.bouquet-xui-table th:nth-child(5),
.bouquet-xui-table th:nth-child(6) {
  width: 120px;
}

.bouquet-xui-table th:last-child,
.bouquet-xui-table td:last-child {
  width: 160px;
  min-width: 160px;
  padding-inline: 8px;
}

.actions.bouquet-xui-actions {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 5px;
}

.bouquet-xui-actions .icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 5px;
  border: 0;
  background: rgba(24, 32, 42, 0.12);
  color: #e5edf7;
}

.bouquet-xui-actions .icon-button:hover {
  background: rgba(8, 121, 221, 0.28);
  color: #fff;
}

.bouquet-xui-count {
  font-weight: 800;
}

.bouquet-xui-count > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 32px;
  padding: 4px 8px;
  background: rgba(31, 40, 52, 0.28);
}

.bouquet-xui-sort {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
}

.bouquet-xui-sort-glyph {
  color: #738195;
  font-size: 14px;
  font-weight: 400;
}

.bouquet-xui-sort.active .bouquet-xui-sort-glyph {
  color: #66a9ff;
}

.bouquet-xui-pagination,
.bouquet-order-save {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.bouquet-xui-pagination > div {
  display: flex;
  align-items: center;
  gap: 0;
}

.bouquet-xui-page-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgba(205, 219, 235, 0.08);
  border-inline-end-width: 0;
  border-radius: 0;
  background: #465260;
  color: #d1dce8;
}

.bouquet-xui-page-button:last-child {
  border-inline-end-width: 1px;
}

.bouquet-xui-page-button.active {
  background: #4f8fe8;
  color: #fff;
}

.bouquet-xui-page-button svg {
  width: 14px;
  height: 14px;
}

.bouquet-xui-page-ellipsis {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  min-height: 42px;
  background: #465260;
}

.bouquet-order-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.bouquet-order-item {
  display: grid;
  grid-template-columns: 42px 52px minmax(70px, 100px) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  transition: border-color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.bouquet-order-item.is-dragging {
  opacity: 0.45;
}

.bouquet-order-item.is-drag-target {
  border-color: var(--accent);
  transform: translateY(2px);
}

.bouquet-order-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 7px;
  color: var(--muted);
  cursor: grab;
}

.bouquet-order-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 30px;
  border-radius: 5px;
  background: rgba(79, 143, 232, 0.18);
  color: var(--ink);
  font-weight: 800;
}

.bouquet-order-id {
  color: var(--muted);
}

.bouquet-order-item > .actions {
  display: flex;
  gap: 6px;
}

.bouquet-editor-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(240px, 1.4fr) minmax(110px, auto);
  align-items: end;
  gap: 10px;
}

.bouquet-editor-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(23, 42, 61, 0.66);
}

.bouquet-editor-selected span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bouquet-editor-selected strong {
  font-size: 18px;
}

.bouquet-editor-table {
  max-height: min(52vh, 560px);
  overflow: auto;
}

.bouquet-editor-table table {
  min-width: 660px;
}

.bouquet-editor-table tr.is-selected td {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.bouquet-editor-table th:first-child,
.bouquet-editor-table td:first-child {
  width: 84px;
  text-align: center;
}

.bouquet-editor-table th:last-child,
.bouquet-editor-table td:last-child {
  width: 86px;
  text-align: center;
}

.bouquet-editor-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.bouquet-editor-pagination > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bouquet-editor-pagination strong {
  min-width: 120px;
  color: var(--ink);
  text-align: center;
}

.bouquet-content-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 480px;
  color: #dbe7f4;
}

.bouquet-content-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.bouquet-content-heading h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(23px, 2vw, 31px);
  font-weight: 500;
}

.bouquet-content-heading p {
  max-width: 850px;
  margin: 8px 0 0;
  color: #aebccc;
  line-height: 1.55;
}

.bouquet-content-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin: 0 -24px 32px;
  border-top: 1px solid rgba(218, 229, 242, 0.05);
  border-bottom: 1px solid rgba(218, 229, 242, 0.08);
  background: rgba(73, 84, 98, 0.4);
}

.bouquet-content-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #edf4fb;
  font-weight: 700;
}

.bouquet-content-tabs button.active {
  background: #4f8fe8;
  color: #fff;
}

.bouquet-content-tabs small {
  min-width: 25px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(19, 29, 40, 0.28);
  font-size: 11px;
}

.bouquet-dual-list {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 72px minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  max-width: 1220px;
  margin: 0 auto;
}

.bouquet-dual-list > section {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.bouquet-dual-list header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #f6f9fc;
}

.bouquet-dual-list header span {
  color: #aebccc;
  font-size: 12px;
  font-weight: 700;
}

.bouquet-dual-list input,
.bouquet-dual-list select {
  width: 100%;
  border-radius: 0;
  background: #465260;
  color: #eef5fc;
}

.bouquet-dual-list input {
  min-height: 42px;
}

.bouquet-dual-list select {
  height: clamp(370px, 50vh, 610px);
  padding: 0;
  border-color: rgba(216, 228, 241, 0.1);
  overflow: auto;
  font-size: 14px;
}

.bouquet-dual-list option {
  min-height: 31px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(218, 229, 242, 0.035);
}

.bouquet-dual-list option:checked {
  background: linear-gradient(#4f8fe8, #4f8fe8);
  color: #fff;
}

.bouquet-transfer-controls {
  display: grid;
  gap: 8px;
}

.bouquet-transfer-controls button,
.bouquet-priority-controls button {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: #0879dd;
  color: #fff;
}

.bouquet-transfer-controls svg,
.bouquet-priority-controls svg {
  width: 16px;
  height: 16px;
}

.bouquet-content-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1220px;
  margin: 24px auto 0;
}

.bouquet-priority-controls,
.bouquet-save-controls,
.bouquet-details-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bouquet-priority-controls button:nth-child(-n+4) {
  background: #98519a;
}

.bouquet-priority-controls button.alphabetical {
  width: auto;
  min-width: 90px;
  padding-inline: 17px;
}

.bouquet-save-controls {
  justify-content: flex-end;
}

.bouquet-save-controls > span,
.bouquet-details-actions > span {
  color: #aebccc;
  font-size: 13px;
  font-weight: 700;
}

.bouquet-save-controls > button,
.bouquet-details-actions > button {
  min-height: 44px;
  border-radius: 0;
}

.bouquet-details-page {
  max-width: 980px;
  margin: 0 auto;
}

.bouquet-details-page form {
  display: grid;
  gap: 22px;
  padding: 28px;
  background: rgba(30, 39, 50, 0.24);
}

.bouquet-details-page form > label:not(.bouquet-enabled-toggle) {
  display: grid;
  gap: 9px;
  color: #c8d5e4;
  font-weight: 700;
}

.bouquet-details-page form input[type="text"],
.bouquet-details-page form input:not([type]) {
  min-height: 48px;
  border-radius: 0;
  background: #465260;
}

.bouquet-enabled-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce7f2;
  font-weight: 700;
}

.bouquet-enabled-toggle input {
  width: 18px;
  height: 18px;
}

.bouquet-details-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(218, 229, 242, 0.08);
}

.bouquet-details-actions > span {
  margin-inline-end: auto;
}

@media (max-width: 760px) {
  .bouquet-xui-list-controls,
  .bouquet-xui-pagination,
  .bouquet-order-save {
    align-items: stretch;
    flex-direction: column;
  }

  .bouquet-xui-list-controls input {
    width: 100%;
  }

  .bouquet-xui-page {
    margin: -22px -14px -36px;
  }

  .bouquet-xui-module-bar {
    padding: 0 8px;
  }

  .bouquet-xui-menu > summary {
    padding: 0 10px;
  }

  .bouquet-xui-workspace {
    padding: 20px 12px 34px;
  }

  .bouquet-xui-card {
    padding: 18px 12px;
  }

  .bouquet-order-item {
    grid-template-columns: 36px 44px 1fr auto;
  }

  .bouquet-order-id {
    display: none;
  }

  .bouquet-editor-toolbar {
    grid-template-columns: 1fr;
  }

  .bouquet-editor-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .bouquet-editor-pagination > div {
    justify-content: space-between;
  }

  .bouquet-content-tabs {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    margin-inline: -12px;
  }

  .bouquet-dual-list {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .bouquet-transfer-controls {
    grid-template-columns: repeat(2, 1fr);
  }

  .bouquet-transfer-controls button {
    width: 100%;
  }

  .bouquet-content-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .bouquet-priority-controls,
  .bouquet-save-controls,
  .bouquet-details-actions {
    flex-wrap: wrap;
  }
}

.line-form-help {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid rgba(79, 143, 232, 0.34);
  border-radius: 7px;
  background: rgba(23, 42, 61, 0.66);
}

.line-form-help span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field-explanation {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.add-stream-grid label > .field-explanation {
  grid-column: 2;
  margin-top: -20px;
}

.line-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.line-form-grid > .full,
.line-form-grid > .wide,
.line-form-grid-single > * {
  grid-column: 1 / -1;
}

.reseller-section-permissions {
  display: grid;
  gap: 9px;
}

.reseller-section-permissions .check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reseller-section-permissions .check-grid label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-weight: 700;
}

.reseller-section-permissions .check-grid input[type="checkbox"] {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.server-selection-tree {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.52);
}

.server-selection-tree-head {
  display: grid;
  gap: 3px;
}

.server-selection-tree-head strong {
  color: #e7eff8;
  font-size: 14px;
}

.server-selection-tree-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.server-selection-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.server-selection-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: rgba(17, 26, 38, 0.76);
}

.server-selection-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
}

.server-selection-group-title > span,
.server-selection-node-state {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #7f8997;
}

.server-selection-group.assigned .server-selection-group-title > span,
.server-selection-node.ready .server-selection-node-state {
  background: #39d98a;
  box-shadow: 0 0 8px rgba(57, 217, 138, 0.5);
}

.server-selection-group-title small {
  margin-left: auto;
  color: var(--muted);
}

.server-selection-nodes {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.server-selection-node {
  display: grid !important;
  grid-template-columns: auto auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #d8e2ed !important;
}

.server-selection-node:hover {
  border-color: rgba(79, 143, 232, 0.5);
  background: rgba(79, 143, 232, 0.08);
}

.server-selection-node:has(input:checked) {
  border-color: #4f8fe8;
  background: rgba(79, 143, 232, 0.15);
}

.server-selection-node input {
  margin: 0;
}

.server-selection-node-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.server-selection-node-copy strong,
.server-selection-node-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-selection-node-copy small,
.server-selection-empty {
  color: var(--muted);
  font-size: 11px;
}

.multi-select-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.multi-select-dropdown {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 11, 18, 0.78);
}

.multi-select-dropdown > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 5px 9px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.multi-select-dropdown > summary::-webkit-details-marker {
  display: none;
}

.multi-select-dropdown > summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-dropdown > summary strong {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  text-align: center;
  font-size: 12px;
}

.multi-select-dropdown > summary svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.multi-select-dropdown[open] > summary svg {
  transform: rotate(180deg);
}

.multi-select-search {
  padding: 5px 8px;
  border-top: 1px solid var(--line);
}

.multi-select-search input {
  width: 100%;
  min-height: 30px;
  padding-block: 4px;
}

.multi-select-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 144px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.multi-select-options label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 32px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  line-height: 1.2;
}

.multi-select-options [hidden] {
  display: none;
}

.multi-select-options label:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.multi-select-options input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.app:not([data-active-tab="dashboard"]) .multi-select-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

.multi-select-options label span {
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 520px) {
  .multi-select-options {
    grid-template-columns: 1fr;
  }

  .multi-select-options label:nth-child(odd) {
    border-right: 0;
  }
}

/* XUI-style assignment controls used by Live TV, Movies and Series. */
.xui-assignment-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(130px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  z-index: 1;
}

.xui-assignment-field:has(.xui-assignment-dropdown[open]) {
  z-index: 80;
}

.xui-assignment-title {
  padding: 9px 0;
  color: var(--muted);
}

.xui-assignment-dropdown {
  position: relative;
  overflow: visible;
  border-radius: 0;
  background: #414b59;
}

.xui-assignment-dropdown > summary {
  grid-template-columns: minmax(0, 1fr) auto 18px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #526071;
  border-radius: 0;
  background: #414b59;
  color: #d9e2ec;
}

.panel:has(.xui-assignment-dropdown[open]),
.drawer:has(.xui-assignment-dropdown[open]),
.drawer-backdrop:has(.xui-assignment-dropdown[open]) {
  backdrop-filter: none;
}

.xui-assignment-menu {
  position: fixed;
  top: max(18px, calc(50vh - 210px));
  bottom: auto;
  left: var(--xui-menu-left, 18px);
  z-index: 120;
  display: flex;
  width: var(--xui-menu-width, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  height: min(420px, calc(100vh - 36px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  min-height: 0;
  border: 1px solid #526071;
  background: #414b59;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
  flex-direction: column;
}

.xui-assignment-menu > .xui-assignment-menu-head,
.xui-assignment-menu > .multi-select-search,
.xui-assignment-menu > .xui-assignment-create {
  flex-shrink: 0;
}

.xui-assignment-menu-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 8px 7px 14px;
  border-bottom: 1px solid #526071;
  background: #36404d;
}

.xui-assignment-menu-head strong {
  color: #fff;
  font-size: 15px;
}

.xui-assignment-menu-head span {
  color: #cbd5df;
  font-size: 12px;
}

.xui-assignment-menu-head button {
  min-width: 36px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #657386;
  background: #2c3541;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.xui-assignment-options {
  display: block;
  grid-template-columns: 1fr;
  min-height: 0;
  max-height: none;
  flex: 1 1 0;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-top: 1px solid #526071;
  background: #414b59;
}

.xui-assignment-options label,
.xui-assignment-options label:nth-child(odd) {
  position: relative;
  display: block;
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  border-right: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5df;
  cursor: pointer;
}

.xui-assignment-options label:hover {
  background: rgba(79, 143, 232, 0.3);
}

.xui-assignment-options label:has(input:checked) {
  background: #4f8fe8;
  color: #fff;
}

.xui-assignment-options label:has(input:checked)::after {
  position: absolute;
  right: 15px;
  color: #fff;
  content: "\2713";
  font-size: 17px;
  font-weight: 900;
}

.xui-assignment-options input,
.app:not([data-active-tab="dashboard"]) .xui-assignment-options input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.xui-assignment-options label span {
  display: block;
  padding-right: 34px;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xui-assignment-empty {
  display: block;
  padding: 18px 14px;
  line-height: 1.45;
}

.xui-assignment-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #526071;
  background: #36404d;
}

.xui-assignment-create input {
  min-width: 0;
  min-height: 40px;
  border-color: #657386;
  background: #111923;
}

.xui-assignment-create button {
  min-height: 40px;
  white-space: nowrap;
}

.xui-assignment-create [data-stream-assignment-status] {
  grid-column: 1 / -1;
  min-height: 0;
  font-size: 12px;
}

/* Compact single-column status tree matching the XUI server picker. */
.server-selection-tree {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
  padding: 18px 16px;
  border: 0;
  background: transparent;
}

.server-selection-groups {
  position: relative;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-left: 30px;
}

.server-selection-groups::before {
  content: "";
  position: absolute;
  top: 15px;
  bottom: 17px;
  left: 12px;
  border-left: 1px dotted #5c6978;
}

.server-selection-group {
  position: relative;
  border: 0;
  overflow: visible;
  background: transparent;
}

.server-selection-group::before {
  content: "";
  position: absolute;
  top: 16px;
  left: -18px;
  width: 18px;
  border-top: 1px dotted #5c6978;
}

.server-selection-group-title {
  min-height: 32px;
  padding: 0;
  border: 0;
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border-radius: 0;
  cursor: default;
}

.server-selection-group-title > span,
.server-selection-node-state {
  border-radius: 1px;
  background: #aab5c1;
  box-shadow: none;
}

.server-selection-group.assigned .server-selection-group-title > span,
.server-selection-node.ready .server-selection-node-state {
  background: #39b83f;
  box-shadow: none;
}

.server-selection-group-title strong {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  background: #3c4653;
  color: #fff;
  font-size: 13px;
}

.server-selection-group.assigned .server-selection-group-title strong {
  background: #20972b;
}

.server-selection-nodes {
  position: relative;
  gap: 2px;
  padding: 2px 0 2px 28px;
}

.server-selection-nodes::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 14px;
  left: 10px;
  border-left: 1px dotted #5c6978;
}

.server-selection-node {
  position: relative;
  grid-template-columns: 8px 18px minmax(0, 1fr) !important;
  padding: 6px 8px;
  width: 100%;
  text-align: left;
  background: transparent;
}

.server-selection-nodes > .server-selection-branch > .server-selection-node::before {
  content: "";
  position: absolute;
  left: -18px;
  width: 18px;
  border-top: 1px dotted #5c6978;
}

.server-selection-node input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.server-selection-node > svg {
  width: 16px;
  height: 16px;
  color: #b9c7d6;
}

.server-selection-node-copy small {
  display: none;
}

.server-selection-node-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}

.server-selection-branch {
  position: relative;
  min-width: 0;
}

.server-selection-children {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-left: 28px;
  padding-left: 18px;
}

.server-selection-children:not(:empty)::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 14px;
  left: 0;
  border-left: 1px dotted #5c6978;
}

.server-selection-children > .server-selection-branch::before {
  content: "";
  position: absolute;
  top: 16px;
  left: -18px;
  width: 18px;
  border-top: 1px dotted #5c6978;
}

.server-selection-branch.dragging {
  opacity: 0.45;
}

.server-selection-node[draggable="true"] {
  cursor: grab;
}

.server-selection-node[draggable="true"]:active {
  cursor: grabbing;
}

@media (max-width: 760px) {
  .server-selection-tree,
  .xui-assignment-field {
    grid-template-columns: 1fr;
  }

  .xui-assignment-create {
    grid-template-columns: 1fr;
  }
}

.server-media-browser-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 7, 13, 0.76);
}

.server-media-browser {
  display: flex;
  width: min(1180px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  min-height: 440px;
  border: 1px solid #526071;
  background: #3f4957;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
  color: #e5edf6;
  flex-direction: column;
}

.server-media-browser > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #526071;
  background: #343e4b;
}

.server-media-browser h3,
.server-media-browser h4 { margin: 0; }
.server-media-browser header small { color: #b7c3d0; font-weight: 700; }
.server-media-browser header button { min-width: 40px; min-height: 40px; padding: 0; font-size: 28px; }

.server-media-browser-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 18px;
}

.server-media-browser-controls label { display: grid; gap: 7px; min-width: 0; color: #d2dbe5; font-weight: 700; }
.server-media-browser-controls input,
.server-media-browser-controls select { width: 100%; background: #46515f; border-color: #596779; color: #eef4fb; }
.server-media-browser-controls .input-with-button { grid-template-columns: minmax(0, 1fr) 44px 44px; }
.server-media-browser-controls label:nth-child(2) .input-with-button { grid-template-columns: minmax(0, 1fr) 44px; }
.server-media-browser-controls button { border-radius: 0; background: #4b86b1; }
.server-media-browser-controls [data-media-browser-clear] { background: #db6a0c; font-size: 22px; }
.server-media-browser-status { padding: 0 18px 12px; }

.server-media-browser-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.45fr);
  gap: 1px;
  min-height: 0;
  flex: 1 1 auto;
  border-top: 1px solid #526071;
  background: #526071;
}

.server-media-browser-columns > section {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  background: #3f4957;
  flex-direction: column;
}

.server-media-browser-columns h4 { padding: 0 4px 10px; color: #d7e0ea; text-transform: uppercase; font-size: 13px; }
.server-media-browser-list { min-height: 0; overflow: auto; flex: 1 1 auto; }
.server-media-browser-list > button {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 0;
  background: transparent;
  color: #dbe5ef;
  text-align: left;
}
.server-media-browser-list > button:hover { background: #4d8bd0; color: #fff; }
.server-media-browser-list > button:disabled { cursor: default; opacity: 0.62; }
.server-media-browser-list > button:disabled:hover { background: transparent; color: #dbe5ef; }
.server-media-browser-list > button > svg { width: 18px; }
.server-media-browser-list > button > span:not(.server-media-file-type) { display: grid; min-width: 0; gap: 2px; }
.server-media-browser-list strong,
.server-media-browser-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-media-browser-list small { color: #bdc8d4; }
.server-media-file-type { min-width: 46px; padding: 4px 6px; background: #2c3541; color: #8fd5ff; text-align: center; font-size: 11px; font-weight: 800; }
.server-media-file-type.is-incompatible { color: #c5ced8; }
.server-media-browser-list { overflow-anchor: none; overscroll-behavior: contain; }
.server-media-browser-list > button { height: 58px; min-height: 58px; max-height: 58px; box-sizing: border-box; }
.media-browser-spacer { pointer-events: none; flex-shrink: 0; }
.server-media-browser-continuous { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 18px; border-top: 1px solid #526071; color: #d2dbe5; }
.server-media-browser-continuous [hidden] { display: none; }
.server-media-browser-columns h4 small { color: #bdc8d4; font-weight: 400; }
.stream-management-table.stream-api-source-table { table-layout: auto; }
.stream-api-source-table .stream-col-api-label { width: 110px; min-width: 90px; text-align: center; white-space: nowrap; }
.stream-col-api-label .channel-separator-badge { width: fit-content; font-size: 11px; line-height: 1.25; }
.stream-api-source-table .stream-col-api-updated { width: 260px; min-width: 205px; white-space: nowrap; }
.stream-col-api-updated time { display: block; font-variant-numeric: tabular-nums; }
.stream-col-api-updated small { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; white-space: normal; }
.server-media-browser-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 18px;
  border-top: 1px solid #526071;
  background: #343e4b;
}
.server-media-browser-pagination > span { min-width: 190px; color: #d2dbe5; text-align: center; }
.server-media-browser-pagination button { display: inline-flex; align-items: center; gap: 7px; min-width: 126px; justify-content: center; }
.server-media-browser-pagination button svg { width: 16px; }

@media (max-width: 760px) {
  .server-media-browser-controls,
  .server-media-browser-columns { grid-template-columns: 1fr; }
  .server-media-browser-columns { overflow-y: auto; }
  .server-media-browser-columns > section { min-height: 240px; }
  .server-media-browser-pagination { flex-wrap: wrap; }
  .server-media-browser-pagination > span { order: -1; width: 100%; }
}

.created-channel-basics {
  margin-bottom: 12px;
}

.created-channel-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.created-channel-composer > section {
  min-width: 0;
}

.created-channel-composer h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.created-channel-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 124px;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(4, 11, 19, 0.38);
}

.created-channel-list > .muted {
  margin: auto;
  padding: 12px;
  text-align: center;
  font-size: 12px;
}

.created-channel-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
}

.created-channel-item > div:first-child {
  display: grid;
  min-width: 0;
}

.created-channel-item strong,
.created-channel-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.created-channel-item strong {
  font-size: 12px;
}

.created-channel-item small {
  color: var(--muted);
  font-size: 11px;
}

.created-channel-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.created-channel-item-actions .icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 6px;
}

@media (max-width: 760px) {
  .created-channel-composer {
    grid-template-columns: minmax(0, 1fr);
  }

  .created-channel-list {
    max-height: 240px;
  }
}

.drawer-section {
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.section-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.drawer-section .grid-form {
  padding-top: 0;
  border-bottom: 0;
}

.source-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.source-tools span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.source-tools button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
}

.track-picker {
  min-height: 0;
}

.track-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.track-picker-grid.audio-only {
  grid-template-columns: minmax(0, 1fr);
}

.track-picker-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.mpd-quality-panel {
  margin-top: 18px;
  border: 1px solid rgba(117, 137, 160, 0.28);
  border-radius: 8px;
  background: rgba(6, 12, 20, 0.62);
  overflow: hidden;
}

.mpd-quality-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: #edf5ff;
}

.mpd-quality-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mpd-quality-head button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 152px;
  justify-content: center;
}

.mpd-quality-head svg,
.add-stream-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mpd-quality-head span,
.mpd-quality-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mpd-quality-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 14px;
  flex-wrap: wrap;
}

.mpd-quality-panel .track-picker-grid {
  margin: 0 16px 16px;
}

.advanced-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.42);
  overflow: hidden;
}

.advanced-block summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--text);
  font-weight: 800;
  list-style: none;
}

.advanced-block summary::-webkit-details-marker {
  display: none;
}

.advanced-block summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.advanced-block[open] summary::after {
  content: "-";
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.advanced-grid .wide,
.advanced-grid .full {
  grid-column: 1 / -1;
}

.smart-tooltip-anchor {
  anchor-name: --smart-tooltip-target;
}

.smart-tooltip {
  position: fixed;
  position-anchor: --smart-tooltip-target;
  z-index: 100;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(172, 190, 214, 0.32);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(8, 13, 21, 0.88), rgba(18, 26, 38, 0.76));
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(140%);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
}

.smart-tooltip-below {
  top: calc(anchor(bottom) + 12px);
}

.smart-tooltip-above {
  bottom: calc(100vh - anchor(top) + 12px);
}

.smart-tooltip-center {
  left: anchor(center);
  transform: translate(-50%, 4px);
}

.smart-tooltip-above.smart-tooltip-center {
  transform: translate(-50%, -4px);
}

.smart-tooltip-left {
  left: 12px;
  transform: translateY(4px);
}

.smart-tooltip-right {
  right: 12px;
  transform: translateY(4px);
}

.smart-tooltip-above.smart-tooltip-left,
.smart-tooltip-above.smart-tooltip-right {
  transform: translateY(-4px);
}

.smart-tooltip.visible.smart-tooltip-center {
  opacity: 1;
  transform: translate(-50%, 0);
}

.smart-tooltip.visible.smart-tooltip-left,
.smart-tooltip.visible.smart-tooltip-right {
  opacity: 1;
  transform: translateY(0);
}

.smart-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(172, 190, 214, 0.32);
  background: rgba(11, 17, 27, 0.94);
  transform: translateX(-50%) rotate(45deg);
}

.smart-tooltip-below::before {
  top: -6px;
  border-right: 0;
  border-bottom: 0;
}

.smart-tooltip-above::before {
  bottom: -6px;
  border-left: 0;
  border-top: 0;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  background: rgba(18, 26, 38, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.signal-strip {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  color: #fff;
  border-radius: 8px;
  background:
    linear-gradient(105deg, rgba(8, 13, 21, 0.98), rgba(17, 109, 98, 0.76), rgba(42, 91, 168, 0.74), rgba(172, 92, 38, 0.68));
  background-size: 240% 240%;
  animation: signalSweep 18s ease-in-out infinite alternate;
}

body[data-motion="off"] .signal-strip {
  animation: none;
}

@keyframes signalSweep {
  0% {
    background-position: 0% 50%, center;
  }

  100% {
    background-position: 100% 50%, center;
  }
}

.signal-strip h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.signal-strip p {
  margin: 0;
  color: #d6e8ea;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-xui-overview {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.dashboard-primary-metrics {
  gap: 0;
}

.dashboard-primary-metrics .metric {
  min-width: 0;
  border: 0;
  border-inline-end: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.dashboard-primary-metrics .metric:last-child {
  border-inline-end: 0;
}

.dashboard-content-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: rgba(7, 14, 23, 0.48);
}

.dashboard-content-metrics .server-value-pill {
  min-width: 0;
  padding-inline: 12px;
  border-inline-end: 1px solid var(--line);
}

.dashboard-content-metrics .server-value-pill:last-child {
  border-inline-end: 0;
}

.dashboard-management-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: rgba(14, 25, 38, 0.74);
}

.dashboard-management-overview button {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: start;
}

.dashboard-management-overview button:last-child {
  border-inline-end: 0;
}

.dashboard-management-overview button:hover,
.dashboard-management-overview button:focus-visible {
  background: rgba(38, 184, 163, 0.12);
}

.dashboard-management-overview svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dashboard-management-overview span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-management-overview strong {
  color: var(--text);
  font-size: 15px;
}

.dashboard-proxy-status {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

.dashboard-proxy-panel {
  width: 100%;
  height: max-content;
  min-height: 0;
  align-self: start;
  box-sizing: border-box;
}

.dashboard-proxy-panel .panel-head {
  min-height: 48px;
  padding: 8px 12px;
}

.dashboard-proxy-panel.collapsed,
.dashboard-proxy-panel.collapsed .panel-head {
  height: 48px !important;
  min-height: 48px;
  max-height: 48px;
}

.dashboard-proxy-panel.collapsed {
  display: block;
  overflow: hidden;
}

.dashboard-proxy-panel .panel-head > .actions {
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: nowrap;
}

.dashboard-proxy-panel .panel-head > .actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-proxy-panel-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dashboard-proxy-panel-title small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-proxy-help {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
}

.dashboard-proxy-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-proxy-manage {
  min-height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  white-space: nowrap;
}

.dashboard-proxy-manage svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dashboard-proxy-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 14, 23, 0.48);
}

.dashboard-proxy-metrics > span {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-inline-end: 1px solid var(--line);
}

.dashboard-proxy-metrics > span:last-child {
  border-inline-end: 0;
}

.dashboard-proxy-metrics small,
.dashboard-proxy-check small,
.dashboard-proxy-latency small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-proxy-metrics strong {
  font-size: 18px;
}

.dashboard-proxy-metrics .is-ok strong {
  color: var(--good);
}

.dashboard-proxy-metrics .is-error strong {
  color: var(--bad);
}

.dashboard-proxy-metrics .is-untested strong {
  color: var(--warn);
}

.dashboard-proxy-list {
  display: grid;
  gap: 7px;
}

.dashboard-proxy-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) minmax(160px, auto) minmax(72px, auto);
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 15, 25, 0.62);
}

.dashboard-proxy-resource-wrap {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-proxy-resource-metrics {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(80px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.dashboard-proxy-resource-metrics > span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-inline-end: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.dashboard-proxy-resource-metrics > span:last-child {
  border-inline-end: 0;
}

.dashboard-proxy-resource-metrics small,
.dashboard-proxy-telemetry-source,
.dashboard-proxy-telemetry-unavailable {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.dashboard-proxy-resource-metrics strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-proxy-telemetry-source,
.dashboard-proxy-telemetry-unavailable {
  flex: 0 0 auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-proxy-identity,
.dashboard-proxy-check,
.dashboard-proxy-latency {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dashboard-proxy-identity strong,
.dashboard-proxy-identity small,
.dashboard-proxy-check strong,
.dashboard-proxy-check em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-proxy-identity small,
.dashboard-proxy-check em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.dashboard-proxy-more {
  color: var(--muted);
  text-align: end;
}

.dashboard-activity {
  display: grid;
  grid-template-columns: minmax(190px, 0.32fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.dashboard-activity-heading {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  align-content: center;
}

.dashboard-activity-heading > strong {
  grid-column: 1 / -1;
  font-size: 14px;
}

.dashboard-activity-heading span {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-activity-heading b {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 17px;
}

.dashboard-activity-chart {
  min-width: 0;
  height: 66px;
  display: grid;
  grid-template-columns: repeat(24, minmax(3px, 1fr));
  gap: 3px;
  align-items: end;
  padding-top: 4px;
  border-bottom: 1px solid rgba(157, 177, 201, 0.22);
}

.dashboard-activity-column {
  position: relative;
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
}

.dashboard-activity-column i {
  width: 100%;
  height: 3%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #43d8c2, #238eaf);
  opacity: 0.88;
}

.dashboard-activity-column.level-1 i { height: 10%; }
.dashboard-activity-column.level-2 i { height: 20%; }
.dashboard-activity-column.level-3 i { height: 30%; }
.dashboard-activity-column.level-4 i { height: 40%; }
.dashboard-activity-column.level-5 i { height: 50%; }
.dashboard-activity-column.level-6 i { height: 60%; }
.dashboard-activity-column.level-7 i { height: 70%; }
.dashboard-activity-column.level-8 i { height: 80%; }
.dashboard-activity-column.level-9 i { height: 90%; }
.dashboard-activity-column.level-10 i { height: 100%; }

.dashboard-activity-column small {
  position: absolute;
  bottom: -15px;
  inset-inline-start: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-advanced-sections {
  display: grid;
  gap: 12px;
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.compact-stats > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 6px 14px;
  border-inline-end: 1px solid var(--line);
}

.compact-stats > div:last-child {
  border-inline-end: 0;
}

.compact-stats span {
  color: var(--muted);
  font-size: 11px;
}

.compact-stats strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.metric,
.panel,
.row-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(16px);
}

.metric {
  padding: 16px;
}

.metric.compact {
  padding: 12px 14px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.metric.compact strong {
  font-size: 22px;
}

.server-status-board {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.server-status-board.alternate {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
}

.dashboard-country-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px 12px;
}

.dashboard-country-map span {
  display: grid;
  grid-template-columns: 30px minmax(36px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(161, 178, 201, 0.18);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.62);
}

.dashboard-country-map progress {
  width: 100%;
  height: 6px;
  appearance: none;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(161, 178, 201, 0.16);
}

.dashboard-country-map progress::-webkit-progress-bar {
  background: rgba(161, 178, 201, 0.16);
}

.dashboard-country-map progress::-webkit-progress-value {
  background: var(--accent);
}

.dashboard-country-map progress::-moz-progress-bar {
  background: var(--accent);
}

.dashboard-country-map small {
  color: var(--muted);
}

.resource-server-fleet {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.resource-server-fleet > strong {
  font-size: 14px;
}

.resource-server-fleet .server-status-board {
  padding: 0;
}

.resource-server-fleet .server-status-row summary,
.resource-server-fleet .server-status-detail {
  grid-template-columns: minmax(0, 1fr);
}

.resource-server-fleet .server-status-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-width: 0;
}

.resource-server-fleet .server-status-values {
  min-width: 0;
}

.resource-server-fleet .server-status-rings {
  justify-content: start;
}

.server-resource-limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.server-resource-limits > span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.server-resource-limits small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.resource-log-policies {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.resource-log-policy-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.6fr) minmax(220px, 1fr) minmax(150px, auto);
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.resource-log-policy-row small.ok {
  color: var(--success);
}

.resource-log-policy-row small.bad {
  color: var(--danger);
}

.resource-log-policy-row small span,
.resource-log-policy-row small em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.resource-log-policy-row small em {
  color: var(--warning);
}

.server-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.server-stat-tile {
  min-height: 54px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid rgba(161, 178, 201, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(25, 38, 54, 0.92), rgba(10, 18, 29, 0.82)),
    radial-gradient(circle at 20% 0%, rgba(31, 183, 158, 0.22), transparent 38%);
}

.server-stat-tile span,
.server-mini-ring small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.server-stat-tile strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.server-status-row {
  border: 1px solid rgba(161, 178, 201, 0.18);
  border-radius: 8px;
  background: rgba(8, 15, 25, 0.62);
}

.server-status-row summary {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.server-status-row summary::-webkit-details-marker {
  display: none;
}

.server-status-row summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.server-status-row[open] summary::after {
  transform: rotate(180deg);
}

.server-status-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.server-status-name strong,
.server-status-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-status-name strong {
  font-size: 14px;
}

.server-status-name span {
  color: var(--muted);
  font-size: 11px;
}

.server-status-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr)) 84px;
  gap: 8px;
  align-items: center;
}

.server-value-pill {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.server-value-pill small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.server-value-pill b {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-status-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 0 10px 10px;
}

.server-status-values {
  display: grid;
  grid-template-columns: repeat(6, minmax(80px, 1fr));
  gap: 8px;
}

.server-status-rings {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 8px;
}

.server-traffic-source {
  display: flex;
  justify-content: flex-end;
  padding: 0 10px 8px;
}

.server-network-interfaces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.server-network-interfaces > span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  align-items: baseline;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.48);
}

.server-network-interfaces small {
  overflow: hidden;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-network-interfaces code {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 11px;
  white-space: normal;
}

.server-mini-ring {
  --ring-color: var(--accent);
  --ring-shadow: rgba(31, 183, 158, 0.18);
  position: relative;
  width: 76px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(14, 22, 35, 0.98) 0 58%, transparent 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 34px var(--ring-shadow);
}

.server-mini-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.server-mini-ring circle {
  fill: none;
  stroke-width: 5;
}

.server-ring-track {
  stroke: rgba(161, 178, 201, 0.22);
}

.server-ring-value {
  stroke: var(--ring-color);
  stroke-linecap: round;
}

.server-mini-ring b,
.server-mini-ring small {
  position: relative;
  z-index: 1;
}

.server-mini-ring b {
  font-size: 12px;
  font-weight: 900;
}

.server-mini-ring.cpu {
  --ring-color: #20d1b2;
  --ring-shadow: rgba(32, 209, 178, 0.16);
}

.server-mini-ring.mem {
  --ring-color: #62a8ff;
  --ring-shadow: rgba(98, 168, 255, 0.18);
}

.server-mini-ring.disk {
  --ring-color: #f0a04a;
  --ring-shadow: rgba(240, 160, 74, 0.18);
}

.server-mini-ring.network {
  --ring-color: #b989ff;
  --ring-shadow: rgba(185, 137, 255, 0.18);
}

.server-mini-ring.clients {
  --ring-color: #e7d45a;
  --ring-shadow: rgba(231, 212, 90, 0.18);
}

.server-mini-ring.over-threshold {
  --ring-color: #ff6b6b;
  --ring-shadow: rgba(255, 107, 107, 0.3);
}

.panel {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-head {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.app:not([data-active-tab="dashboard"]) .panel-head {
  min-height: 48px;
  padding: 10px 12px;
}

.app:not([data-active-tab="dashboard"]) .panel-head h3 {
  font-size: 14px;
}

.app:not([data-active-tab="dashboard"]) .panel-head .actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.panel-toggle {
  display: inline-grid;
  place-items: center;
}

.panel-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel.collapsed .panel-head {
  border-bottom: 0;
}

.panel.collapsed .panel-body {
  display: none;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.app:not([data-active-tab="dashboard"]) .grid-form {
  gap: 10px;
  padding: 12px;
}

.grid-form .wide {
  grid-column: span 2;
}

.grid-form .full {
  grid-column: 1 / -1;
}

.panel-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.app:not([data-active-tab="dashboard"]) .panel-filters {
  gap: 10px;
  padding: 12px;
}

.table-wrap {
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.sticky-actions-table table > thead > tr > th:last-child,
.sticky-actions-table table > tbody > tr > td:last-child {
  position: sticky;
  inset-inline-end: 0;
  background: rgba(13, 20, 30, 0.98);
  box-shadow: -10px 0 14px -14px rgba(0, 0, 0, 0.95);
}

.sticky-actions-table table > thead > tr > th:last-child {
  z-index: 4;
}

.sticky-actions-table table > tbody > tr > td:last-child {
  z-index: 2;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.app:not([data-active-tab="dashboard"]) th,
.app:not([data-active-tab="dashboard"]) td {
  padding: 8px 10px;
  font-size: 12px;
}

.app:not([data-active-tab="dashboard"]) th {
  font-size: 11px;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.status.ok {
  background: rgba(117, 226, 160, 0.15);
  color: var(--good);
}

.status.off {
  background: rgba(255, 143, 132, 0.15);
  color: var(--bad);
}

.status.bad {
  background: rgba(255, 143, 132, 0.15);
  color: var(--bad);
}

.status.warn {
  background: rgba(255, 209, 138, 0.16);
  color: var(--warn);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
}

.row-card {
  padding: 14px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.app:not([data-active-tab="dashboard"]) .row-card {
  padding: 11px;
  gap: 6px;
}

.app:not([data-active-tab="dashboard"]) .row-card strong {
  font-size: 12px;
}

.app:not([data-active-tab="dashboard"]) .row-card span {
  font-size: 12px;
}

.row-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plex-sync-status {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.plex-sync-status small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.plex-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.plex-result {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.plex-result:empty {
  display: none;
}

.plex-preview-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.plex-preview-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.5fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.plex-preview-row:last-child {
  border-bottom: 0;
}

.plex-preview-row span {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 620px) {
  .plex-preview-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

.subsection {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.subsection h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.subsection-heading > button {
  flex: 0 0 auto;
}

.app:not([data-active-tab="dashboard"]) .subsection h4 {
  font-size: 11px;
}

.quick-stream-form {
  display: grid;
  grid-template-columns: minmax(170px, 240px) minmax(280px, 1fr) minmax(220px, 320px) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.quick-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: stretch;
}

.quick-status > div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.48);
}

.quick-url {
  min-width: 0;
}

.quick-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.quick-actions button {
  min-width: 112px;
}

.quick-result,
#quickAdvancedSummary {
  grid-column: 1 / -1;
  margin: 0;
}

.add-stream-shell {
  display: grid;
  background: rgba(42, 54, 70, 0.54);
}

.add-stream-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  background: rgba(57, 70, 86, 0.74);
}

.add-stream-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 58px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbe5ef;
  font-weight: 800;
}

.add-stream-tabs button.active {
  background: #4f8fe8;
  color: #fff;
}

.add-stream-tabs svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add-stream-meta {
  display: flex;
  gap: 12px;
  padding: 18px 24px 0;
}

.add-stream-meta > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.add-stream-tab-body {
  padding: 22px 24px 24px;
}

.add-stream-grid {
  display: grid;
  gap: 20px 28px;
  align-items: center;
}

.add-stream-grid label {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  color: #c7d4e1;
  font-weight: 800;
}

.add-stream-grid label > input,
.add-stream-grid label > select,
.add-stream-grid label > textarea,
.input-with-button {
  grid-column: 2;
}

.add-stream-grid textarea {
  min-height: 76px;
}

.source-fallback-control {
  display: grid;
  grid-column: 2;
  gap: 6px;
  min-width: 0;
}

.source-fallback-control small {
  font-weight: 600;
  line-height: 1.35;
}

.source-priority-editor {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 11, 18, 0.52);
}

.source-priority-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-priority-head button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
}

.source-priority-list {
  display: grid;
  gap: 6px;
}

.source-priority-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.add-stream-grid .source-priority-row label,
.source-priority-row label {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #c7d4e1;
  font-weight: 700;
}

.add-stream-grid .source-priority-row label > input,
.source-priority-row label > input {
  grid-column: 2;
  min-width: 0;
}

.source-priority-number,
.source-priority-lock {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.source-priority-lock {
  width: 34px;
  background: rgba(32, 199, 168, 0.12);
  color: var(--success);
}

.source-priority-actions svg,
.source-priority-remove svg,
.source-priority-head svg {
  width: 14px;
  height: 14px;
}

.source-priority-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.source-priority-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 32px;
  min-height: 32px;
  gap: 5px;
  padding: 5px 8px;
  white-space: nowrap;
}

.source-priority-actions button span {
  font-size: 11px;
  font-weight: 750;
}

.source-priority-row.source-priority-primary-media {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
}

.source-priority-row.source-priority-primary-media label {
  display: block;
}

.source-priority-row.source-priority-primary-media label > input {
  display: block;
  width: 100%;
  min-height: 44px;
  grid-column: auto;
  border-radius: 8px 0 0 8px;
}

.source-priority-primary-media .source-priority-actions {
  gap: 0;
  align-self: stretch;
}

.source-priority-primary-media .source-priority-actions .server-media-browser-button {
  width: 48px;
  min-width: 48px;
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: #4b86b1;
}

.source-priority-primary-media .source-priority-actions .server-media-browser-button:last-child {
  border-radius: 0 8px 8px 0;
}

.source-priority-primary-media .source-priority-actions .server-media-browser-button span {
  display: none;
}

@media (max-width: 720px) {
  .source-priority-row {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .source-priority-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .source-priority-row.source-priority-primary-media {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .source-priority-row.source-priority-primary-media .source-priority-actions {
    grid-column: 2;
  }
}

.source-priority-editor > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.add-stream-optional {
  border: 1px solid var(--line);
  background: rgba(7, 15, 24, 0.48);
}

.add-stream-optional > summary {
  min-height: 48px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.add-stream-optional-grid {
  padding: 16px;
  display: grid;
  gap: 18px 28px;
}

.add-stream-optional-grid label {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  color: #c7d4e1;
  font-weight: 800;
}

.dashboard-quick-operations {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border-block: 1px solid var(--line);
  background: rgba(8, 17, 27, 0.72);
}

.dashboard-quick-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 8px;
}

.dashboard-quick-grid button {
  min-width: 0;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.dashboard-quick-grid button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dashboard-quick-grid button span {
  min-width: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.dashboard-stream-attention {
  display: grid;
  gap: 10px;
  margin: 12px 16px;
  padding: 14px;
  border: 1px solid rgba(31, 183, 158, 0.25);
  border-radius: 9px;
  background: rgba(8, 17, 27, 0.72);
}

.dashboard-stream-attention.has-issues {
  border-color: rgba(235, 178, 70, 0.38);
  background: rgba(70, 48, 14, 0.16);
}

.dashboard-attention-heading,
.dashboard-attention-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-attention-heading > div,
.dashboard-attention-list article > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dashboard-attention-heading span,
.dashboard-attention-list article span,
.dashboard-attention-more {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.dashboard-attention-list {
  display: grid;
  gap: 6px;
}

.dashboard-attention-list article {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 11, 18, 0.48);
}

.dashboard-attention-list article button,
.dashboard-attention-heading > button {
  flex: 0 0 auto;
}

.dashboard-attention-clear {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--ok);
}

.dashboard-attention-clear svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

@media (max-width: 1280px) {
  .app:not([data-layout="top"]) .topbar {
    gap: 12px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .app:not([data-layout="top"]) .topbar > div:first-child {
    min-width: 0;
    flex: 0 1 200px;
  }

  .app:not([data-layout="top"]) .toolbar {
    min-width: 0;
    flex: 1 1 auto;
  }

  .app:not([data-layout="top"]) .language-select {
    min-width: 110px;
  }

  .app:not([data-layout="top"]) .search-scope-select {
    min-width: 128px;
  }

  .app:not([data-layout="top"]) .toolbar input {
    width: auto;
    min-width: 120px;
    flex: 1 1 180px;
  }
}

@media (max-width: 1480px) {
  .dashboard-quick-operations {
    grid-template-columns: 1fr;
  }

  .dashboard-quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .dashboard-activity {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dashboard-activity-heading {
    grid-template-columns: minmax(0, 1fr) max-content max-content;
    align-items: center;
  }

  .dashboard-activity-heading > strong {
    grid-column: auto;
  }

  .dashboard-activity-heading b {
    display: inline;
    margin: 0 0 0 3px;
    font-size: 13px;
  }

  .dashboard-primary-metrics,
  .dashboard-content-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-primary-metrics .metric:nth-child(2),
  .dashboard-content-metrics .server-value-pill:nth-child(2) {
    border-inline-end: 0;
  }

  .dashboard-primary-metrics .metric:nth-child(-n + 2),
  .dashboard-content-metrics .server-value-pill:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-management-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-management-overview button:nth-child(2n) {
    border-inline-end: 0;
  }

  .dashboard-management-overview button:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-proxy-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-proxy-metrics > span {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-proxy-metrics > span:nth-child(2n) {
    border-inline-end: 0;
  }

  .dashboard-proxy-metrics > span:last-child {
    border-bottom: 0;
  }

  .dashboard-proxy-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-proxy-panel-title small {
    display: none;
  }

  .dashboard-proxy-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-proxy-manage {
    width: 100%;
  }

  .dashboard-proxy-resource-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-proxy-resource-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-proxy-resource-metrics > span {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-proxy-resource-metrics > span:nth-child(2n) {
    border-inline-end: 0;
  }

  .dashboard-proxy-resource-metrics > span:last-child {
    border-bottom: 0;
  }

  .dashboard-stream-attention {
    margin-inline: 10px;
  }

  .dashboard-attention-heading,
  .dashboard-attention-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-attention-heading > button,
  .dashboard-attention-list article button {
    width: 100%;
  }

  .add-stream-optional-grid label {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
}

.input-with-button input,
.input-with-button select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.stream-player-shell {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(4, 12, 21, 0.82);
}

.stream-player-shell video {
  width: 100%;
  max-height: min(52vh, 520px);
  aspect-ratio: 16 / 9;
  background: #02060a;
  object-fit: contain;
}

.stream-player-channel-logo {
  width: min(180px, 40%);
  height: 64px;
  justify-self: center;
  object-fit: contain;
}

.stream-player-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stream-player-toolbar > span {
  flex: 1 1 260px;
  color: var(--muted);
}

.stream-player-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.stream-player-toolbar svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-log-list,
.stream-log-node {
  display: grid;
  gap: 10px;
}

.stream-log-node > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stream-log-node pre {
  margin: 0;
  min-height: 220px;
  max-height: 58vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(2, 7, 13, 0.94);
  color: #c9e7df;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.input-with-button button {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: rgba(79, 143, 232, 0.82);
}

.input-with-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.add-stream-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}

.add-stream-actions button {
  min-width: 94px;
}

.stream-console {
  display: grid;
  gap: 0;
  width: 100%;
  min-width: 0;
}

.stream-section-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
  overflow-x: auto;
}

.stream-section-tab {
  display: inline-grid;
  grid-template-columns: 16px auto minmax(22px, auto);
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(19, 30, 43, 0.84);
  white-space: nowrap;
}

.stream-section-tab svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-section-tab span {
  font-size: 13px;
  font-weight: 800;
}

.stream-section-tab small {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.stream-section-tab.active {
  border-color: rgba(31, 183, 158, 0.64);
  background: rgba(31, 183, 158, 0.17);
  color: #f5fffb;
}

.stream-section-tab.primary {
  margin-left: auto;
  grid-template-columns: 16px auto;
  background: var(--accent);
  color: #06251e;
}

.stream-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(6, minmax(112px, 0.7fr));
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--line);
}

.stream-toolbar input,
.stream-toolbar select {
  min-height: 40px;
  background: rgba(42, 54, 70, 0.78);
}

.toolbar-status {
  display: flex;
  align-items: center;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
  align-self: center;
  justify-self: start;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.toolbar-notice {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.toolbar-notice.ok {
  background: rgba(38, 201, 161, 0.16);
  color: var(--accent-2);
}

.toolbar-notice.bad {
  background: rgba(255, 116, 116, 0.16);
  color: #ff9b9b;
}

.toolbar-notice.warn {
  background: rgba(240, 160, 74, 0.16);
  color: #f4c784;
}

.endpoint-load-warning {
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-inline-start: 3px solid #e9b85b;
  background: rgba(78, 57, 23, 0.42);
  color: #f5d99e;
  font-size: 13px;
  line-height: 1.35;
}

@media (min-width: 1500px) {
  .stream-toolbar {
    grid-template-columns: minmax(220px, 1.2fr) repeat(6, minmax(112px, 0.7fr)) minmax(220px, auto);
  }

  .toolbar-status {
    grid-column: auto;
    justify-self: end;
    white-space: nowrap;
  }
}

@media (max-width: 1280px) {
  .stream-toolbar {
    grid-template-columns: minmax(200px, 1.2fr) repeat(6, minmax(100px, 0.7fr));
    gap: 8px;
  }
}

.stream-table-wrap {
  overflow: visible;
  min-width: 0;
  max-width: 100%;
}

.stream-pagination {
  min-height: 42px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stream-pagination .actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.stream-pagination select {
  width: 74px;
  min-height: 34px;
}

.stream-page-index {
  min-width: 72px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stream-table {
  min-width: 1780px;
  table-layout: fixed;
}

.stream-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 13, 22, 0.58);
}

.stream-section-summary > div:first-child {
  min-width: 180px;
}

.stream-section-summary strong {
  display: block;
  color: #f4f8ff;
  font-size: 14px;
}

.stream-section-summary span {
  color: var(--muted);
  font-size: 11px;
}

.summary-pills {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.summary-pills span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(151, 164, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #cbd5e1;
  white-space: nowrap;
}

.summary-pills b {
  color: #f8fafc;
  font-size: 12px;
}

.summary-pills .ok b {
  color: #73f1ad;
}

.summary-pills .warn b {
  color: #ffd078;
}

.summary-pills .bad b {
  color: #ff9d9d;
}

.section-insights {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

.section-insights span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(31, 183, 158, 0.22);
  border-radius: 6px;
  background: rgba(31, 183, 158, 0.07);
  color: #cfeee8;
  white-space: nowrap;
}

.section-insights b {
  color: #75e2c8;
  font-size: 12px;
}

.stream-home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.stream-home-action {
  min-height: 126px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 10px;
  padding: 16px;
  text-align: left;
  border-radius: 8px;
  background: rgba(9, 16, 26, 0.54);
}

.stream-home-action.primary {
  background:
    linear-gradient(135deg, rgba(31, 183, 158, 0.24), rgba(79, 143, 232, 0.16)),
    rgba(9, 16, 26, 0.54);
  border-color: rgba(31, 183, 158, 0.54);
}

.stream-home-action svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stream-home-action strong {
  font-size: 15px;
  color: #f4f8ff;
}

.stream-home-action span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stream-table th:nth-child(1),
.stream-table td:nth-child(1) {
  width: 92px;
}

.stream-table th:nth-child(2),
.stream-table td:nth-child(2) {
  width: 250px;
}

.stream-table th:nth-child(3),
.stream-table td:nth-child(3) {
  width: 360px;
}

.stream-table th:nth-child(4),
.stream-table td:nth-child(4) {
  width: 130px;
}

.stream-table th:nth-child(5),
.stream-table td:nth-child(5) {
  width: 92px;
  text-align: center;
}

.stream-table th:nth-child(6),
.stream-table td:nth-child(6) {
  width: 68px;
  text-align: center;
}

.stream-table th:nth-child(7),
.stream-table td:nth-child(7) {
  width: 68px;
  text-align: center;
}

.stream-table th:nth-child(8),
.stream-table td:nth-child(8) {
  width: 60px;
  text-align: center;
}

.stream-table th:nth-child(9),
.stream-table td:nth-child(9) {
  width: 330px;
  overflow: hidden;
  contain: inline-size;
}

.stream-table th:last-child,
.stream-table td:last-child {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  padding-left: 10px;
  padding-right: 14px;
  border-left: 1px solid rgba(151, 164, 184, 0.22);
  background: rgba(14, 20, 30, 0.98);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.stream-table th:last-child {
  background: rgba(18, 26, 38, 0.98);
}

.stream-table td {
  background: rgba(255, 255, 255, 0.018);
  padding-top: 8px;
  padding-bottom: 8px;
}

.stream-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.042);
}

.stream-table tbody tr:nth-child(even) td:last-child {
  background: rgba(19, 27, 38, 0.98);
}

.stream-name-line,
.stream-source-line,
.stream-status-line {
  display: flex;
  align-items: center;
  min-width: 0;
}

.stream-name-line {
  gap: 9px;
}

.stream-row-logo {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(151, 164, 184, 0.28);
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.stream-row-logo img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px;
  object-fit: contain;
}

button.catalog-poster-button { padding: 0; cursor: pointer; }
button.catalog-poster-button:focus-visible { outline: 2px solid var(--accent, #24c1ae); outline-offset: 3px; }
.catalog-metadata-dialog { width: min(920px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); overflow: auto; overscroll-behavior: contain; padding: 0; border: 1px solid var(--border, #354356); border-radius: 14px; background: #111923; color: var(--ink, #e5edf6); box-shadow: 0 24px 80px #0008; }
.catalog-metadata-dialog::backdrop { background: rgba(2, 7, 13, .78); }
.catalog-metadata-dialog > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; background: #111923; border-bottom: 1px solid var(--border, #354356); }
.catalog-metadata-dialog h3 { margin: 0; overflow-wrap: anywhere; }
.catalog-metadata-dialog > header button { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; }
.catalog-metadata-dialog > header button svg { width: 16px; height: 16px; flex: 0 0 16px; }
.catalog-metadata-content { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 24px; padding: 24px; }
.catalog-metadata-content h4 { margin-top: 0; }
.catalog-metadata-poster { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; }
.catalog-metadata-no-poster { padding: 24px 12px; text-align: center; color: var(--muted, #aab8c8); border: 1px solid var(--border, #354356); border-radius: 8px; }
.catalog-metadata-plot, .catalog-metadata-fields dd { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.catalog-metadata-fields { display: grid; gap: 12px; margin-bottom: 0; }
.catalog-metadata-fields > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; }
.catalog-metadata-fields dt { color: var(--muted, #aab8c8); }
.catalog-metadata-fields dd { margin: 0; }
.catalog-metadata-status { padding: 24px; }
@media (max-width: 620px) {
  .catalog-metadata-content { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 20px; }
  .catalog-metadata-content > aside { width: min(180px, 100%); margin-inline: auto; }
  .catalog-metadata-fields > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .catalog-metadata-dialog > header { padding: 14px; gap: 10px; }
}

.stream-row-logo.is-empty::after {
  width: 13px;
  height: 9px;
  content: "";
  border: 1px solid rgba(151, 164, 184, 0.42);
  border-radius: 2px;
  background: linear-gradient(135deg, rgba(151, 164, 184, 0.08), rgba(36, 193, 174, 0.14));
}

.stream-source-line,
.stream-status-line {
  gap: 8px;
}

.stream-source-line code,
.stream-status-line small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-name-line strong {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.stream-name-line small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-source-line code {
  display: inline-block;
  max-width: 100%;
  margin-top: 0;
}

.stream-table small {
  display: inline-block;
  margin-top: 0;
  color: var(--muted);
}

.stream-actions {
  flex-wrap: nowrap;
  gap: 5px;
  justify-content: flex-end;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 1px;
  scrollbar-width: thin;
}

.stream-actions .icon-button {
  flex: 0 0 auto;
  width: 26px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.stream-actions .stream-stop-button {
  color: #ffb0b0;
  border-color: rgba(255, 108, 108, 0.46);
  background: rgba(122, 35, 42, 0.22);
}

.stream-actions .stream-stop-button:hover,
.stream-actions .stream-stop-button:focus-visible {
  color: #ffe0e0;
  border-color: rgba(255, 125, 125, 0.78);
  background: rgba(145, 39, 48, 0.38);
}

.stream-actions .icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stream-actions .icon-button.is-busy svg {
  animation: actionSpin 800ms linear infinite;
}

@keyframes actionSpin {
  to {
    transform: rotate(360deg);
  }
}

.mini-player {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-color: rgba(31, 183, 158, 0.78);
  background: var(--accent);
}

.mini-player svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.epg-led {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.epg-led.on {
  background: #39c66c;
}

.epg-led.off {
  background: rgba(255, 255, 255, 0.10);
}

.epg-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  border-color: transparent;
}

.epg-button:hover {
  border-color: rgba(57, 198, 108, 0.42);
  background: rgba(57, 198, 108, 0.10);
}

.stream-info-grid {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) repeat(4, 40px);
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.stream-info-empty {
  display: inline-block;
  color: var(--muted);
  font-weight: 800;
}

.stream-info-grid span {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
}

.stream-info-grid span:first-child {
  justify-items: start;
}

.stream-info-grid .quality-main strong {
  max-width: 92px;
  color: #f4f8ff;
}

.stream-info-grid strong,
.stream-info-grid small {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
}

.stream-info-grid strong {
  font-size: 12px;
  line-height: 1.15;
}

.stream-info-grid small {
  font-size: 11px;
  line-height: 1.1;
  color: var(--muted);
}

.stream-info-grid svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Compact channel management keeps the existing stream-info component intact. */
.stream-management-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(640px, 1fr);
  gap: 12px 18px;
  padding: 12px 16px;
}

.stream-toolbar-primary,
.stream-toolbar-filters,
.stream-page-size-label,
.stream-auto-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-toolbar-primary {
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
}

.stream-page-size-label select {
  width: 70px;
  min-height: 36px;
}

.stream-toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 6px;
  background: var(--line);
}

.stream-auto-refresh i,
.stream-log-panel-head i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #39d7a3;
  box-shadow: 0 0 10px rgba(57, 215, 163, 0.8);
}

.stream-selected-count {
  margin-left: auto;
  font-size: 11px;
}

.stream-bulk-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(31, 183, 158, 0.28);
  border-radius: 6px;
  background: rgba(31, 183, 158, 0.08);
}

.stream-bulk-actions strong {
  margin-right: 4px;
  color: var(--ink);
}

.stream-bulk-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.stream-bulk-actions button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-bulk-actions .stream-bulk-clear {
  margin-left: auto;
}

.line-bulk-actions {
  margin: 0 0 10px;
}

.line-bulk-inline-notice,
.line-bulk-notice {
  font-size: 12px;
}

.line-bulk-inline-notice {
  margin-left: 4px;
}

.line-bulk-notice {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(42, 54, 70, 0.7);
}

.line-bulk-inline-notice.ok,
.line-bulk-notice.ok {
  color: var(--good);
}

.line-bulk-inline-notice.warn,
.line-bulk-notice.warn {
  color: var(--warn);
}

.line-bulk-inline-notice.bad,
.line-bulk-notice.bad {
  color: var(--bad);
}

.stream-toolbar-filters {
  justify-content: flex-end;
  min-width: 0;
  flex-wrap: wrap;
}

.stream-toolbar-filters select {
  width: auto;
  min-width: 132px;
  max-width: 190px;
}

.stream-search-field {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(42, 54, 70, 0.78);
}

.stream-search-field svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.stream-search-field input {
  min-width: 0;
  width: 100%;
  padding-inline: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.stream-advanced-filters {
  grid-column: 1 / -1;
  color: var(--muted);
}

.stream-advanced-filters > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
}

.stream-advanced-filters > summary::-webkit-details-marker {
  display: none;
}

.stream-advanced-filters > summary svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-advanced-filters > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}

.stream-management-status {
  grid-column: 1 / -1;
  margin-top: -4px;
}

.stream-management-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: clamp(9px, 0.68vw, 12px);
}

.stream-management-table th,
.stream-management-table td {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  border-left: 0 !important;
  overflow: visible !important;
  contain: none !important;
  padding-right: clamp(3px, 0.45vw, 8px);
  padding-left: clamp(3px, 0.45vw, 8px);
  overflow-wrap: anywhere;
}

.stream-management-table .stream-col-select { width: 3% !important; text-align: center; }
.stream-management-table .stream-col-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0;
  accent-color: var(--accent);
  vertical-align: middle;
}
.stream-management-table .stream-col-id { width: 6% !important; }
.stream-management-table .stream-col-name { width: 18% !important; }
.stream-management-table .stream-col-server { width: 12% !important; }
.stream-management-table .stream-col-source { width: 8% !important; text-align: center; }
.stream-management-table .stream-col-drm { width: 7% !important; text-align: center; }
.stream-management-table .stream-col-mode { width: 7% !important; text-align: center; }
.stream-management-table .stream-col-status { width: 15% !important; text-align: center; }
.stream-management-table .stream-col-active,
.stream-management-table .stream-col-limit { width: 5% !important; text-align: center; }
.stream-management-table .stream-col-info { width: 14% !important; }
.stream-management-table .stream-col-player { width: 6% !important; text-align: center; }
.stream-management-table .stream-col-actions {
  position: static;
  width: 7% !important;
  text-align: right;
  background: inherit;
  box-shadow: none;
}

.stream-player-row-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  padding: 6px;
  border-color: rgba(82, 151, 236, 0.72);
  background: rgba(20, 111, 207, 0.82);
  color: #fff;
}

.stream-player-row-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.series-player-output {
  display: grid;
  gap: 12px;
}

.series-management-table .series-col-id { width: 6% !important; }
.series-management-table .series-col-name { width: 22% !important; }
.series-management-table .series-col-category { width: 15% !important; }
.series-management-table .series-col-count { width: 5% !important; text-align: center; }
.series-management-table .series-col-status { width: 7% !important; text-align: center; }
.series-management-table .series-col-date { width: 12% !important; white-space: normal; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.series-management-table .series-col-actions { width: 16% !important; }

.series-management-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.series-management-actions .icon-button {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  padding: 6px;
}

.series-management-actions .icon-button svg {
  width: 16px;
  height: 16px;
}

.stream-management-table thead .stream-col-actions {
  background: inherit;
}

.stream-management-table tbody tr.is-selected td {
  background: rgba(31, 183, 158, 0.10);
}

.stream-management-table tbody tr.is-selected td:last-child {
  background: rgba(24, 48, 50, 0.98);
}

.stream-management-table .stream-name-line {
  height: auto;
  min-height: 38px;
  align-items: flex-start;
}

.stream-management-table .stream-status-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin-inline: auto;
  text-align: center;
}

.stream-management-table .stream-status-line > .status {
  flex: 0 0 auto;
}

.stream-management-table .stream-status-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.stream-management-table .stream-status-copy > small {
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}

.stream-management-table .stream-status-copy > .restart-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: max-content;
  overflow: visible;
  white-space: nowrap;
}

.stream-management-table .stream-status-copy > .restart-counter svg {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-management-table .stream-info-grid {
  grid-template-columns: minmax(82px, 102px) repeat(4, minmax(42px, 50px));
  justify-content: start;
  column-gap: 8px;
  row-gap: 2px;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

.source-priority-head-compact {
  justify-content: flex-end;
}

.catalog-movie-source {
  display: grid;
  gap: 7px;
}

.stream-management-table .stream-info-grid .quality-main {
  grid-column: auto;
  justify-items: start;
}

.stream-management-table .stream-info-grid > span:not(.quality-main) {
  gap: 2px;
}

.stream-management-table .stream-info-grid .stream-playback-mode {
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
}

.restart-wsp-button {
  color: #ffd3d3 !important;
}

.runtime-alert-list,
.runtime-restart-progress {
  display: grid;
  gap: 8px;
}

.runtime-alert,
.runtime-restart-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 17, 27, 0.66);
}

.runtime-alert.bad,
.runtime-restart-row.bad { border-color: rgba(255, 99, 99, 0.55); }
.runtime-alert.ok,
.runtime-restart-row.ok { border-color: rgba(57, 198, 108, 0.45); }

.runtime-alert > div,
.runtime-restart-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.runtime-alert span:not(.status),
.runtime-alert small,
.runtime-restart-row span,
.runtime-restart-row small { color: var(--muted); }

.runtime-restart-indicator {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--muted);
}

.runtime-restart-row.pending .runtime-restart-indicator {
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.runtime-restart-row.ok .runtime-restart-indicator { color: #39c66c; background: #39c66c; }
.runtime-restart-row.bad .runtime-restart-indicator { color: #ff6363; background: #ff6363; }

@media (max-width: 900px) {
  .stream-management-table .stream-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

.stream-management-table .stream-source-badge,
.stream-management-table .stream-drm-badge,
.stream-management-table .stream-mode-badge,
.stream-management-table .status {
  min-width: 0;
  max-width: 100%;
  padding-right: clamp(3px, 0.4vw, 8px);
  padding-left: clamp(3px, 0.4vw, 8px);
  white-space: normal;
}

.stream-management-table .stream-row-logo {
  flex-basis: clamp(24px, 2.2vw, 34px);
  width: clamp(24px, 2.2vw, 34px);
  height: clamp(24px, 2.2vw, 34px);
}

.stream-management-table .stream-management-actions,
.stream-management-table .stream-action-trigger {
  max-width: 100%;
}

.stream-management-table .stream-action-trigger {
  justify-content: center;
  padding-right: 4px;
  padding-left: 4px;
  white-space: normal;
}

.stream-name-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.stream-name-copy strong {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.stream-name-copy small,
.stream-col-source small {
  color: var(--muted);
  font-size: 10px;
}

.stream-channel-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.stream-epg-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.82;
}

.stream-epg-indicator i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 14%, transparent);
}

.stream-epg-indicator.is-active { color: var(--good); }
.stream-epg-indicator.is-available { color: #7eb8f5; }
.stream-epg-indicator.is-empty,
.stream-epg-indicator.is-disabled { color: var(--warn); }
.stream-epg-indicator.is-unmapped { opacity: 0.5; }

.stream-col-source {
  display: table-cell;
}

.stream-col-source small {
  display: block;
  margin-top: 5px;
}

.stream-source-badge,
.stream-drm-badge,
.stream-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(111, 157, 224, 0.28);
  border-radius: 5px;
  background: rgba(52, 103, 176, 0.16);
  color: #9fcaff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stream-source-badge.source-dash {
  border-color: rgba(173, 92, 255, 0.34);
  background: rgba(105, 44, 173, 0.18);
  color: #cb94ff;
}

.stream-source-badge.source-hls {
  border-color: rgba(37, 196, 125, 0.34);
  background: rgba(24, 129, 81, 0.18);
  color: #69e6a9;
}

.stream-drm-badge.drm-widevine,
.stream-drm-badge.drm-playready {
  border-color: rgba(239, 170, 50, 0.38);
  background: rgba(151, 91, 13, 0.20);
  color: #ffc84d;
}

.stream-drm-badge.is-pending {
  opacity: 0.68;
}

.stream-mode-badge {
  border-color: rgba(67, 143, 245, 0.36);
  background: rgba(41, 89, 164, 0.2);
  color: #81b8ff;
}

.stream-playback-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 4px auto 0;
  padding: 2px 7px;
  border: 1px solid rgba(111, 157, 224, 0.3);
  border-radius: 999px;
  color: #aab8c8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-transform: uppercase;
}

.stream-playback-mode.adaptive {
  border-color: rgba(43, 201, 139, 0.38);
  background: rgba(22, 133, 91, 0.16);
  color: #69e6a9;
}

.stream-playback-mode.normal {
  border-color: rgba(79, 143, 232, 0.38);
  background: rgba(52, 103, 176, 0.14);
  color: #9fcaff;
}

.stream-playback-mode.pending {
  opacity: 0.7;
}

.stream-management-actions {
  display: inline-block;
  text-align: left;
}

.stream-management-actions > .stream-action-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stream-management-actions > .stream-action-trigger svg,
.stream-action-popover svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-action-popover {
  position: fixed;
  z-index: 90;
  inset: auto;
  top: var(--stream-action-menu-top, 12px);
  left: var(--stream-action-menu-left, 12px);
  right: auto;
  margin: 0;
  min-width: 190px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 2px;
}

.stream-action-popover[hidden] {
  display: none !important;
}

.stream-action-popover.is-viewport-positioned {
  top: var(--stream-action-menu-top);
  left: var(--stream-action-menu-left);
  right: auto;
  margin: 0;
}

.stream-action-popover button {
  min-height: 34px;
  border: 0;
  background: transparent;
}

.stream-action-popover button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.stream-log-drawer {
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 8, 16, 0.76);
}

.stream-log-drawer .drawer {
  width: min(980px, 96vw);
  height: min(760px, 94vh);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.stream-log-drawer .drawer-head {
  display: none;
}

.stream-log-drawer .drawer-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.stream-test-drawer {
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 8, 16, 0.76);
}

.stream-test-drawer .drawer {
  width: min(920px, 96vw);
  max-height: 94vh;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.stream-test-drawer .drawer-body {
  overflow: auto;
}

.stream-test-drawer .drawer-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.stream-test-drawer .drawer-actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-log-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 15px;
}

.stream-log-title-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 149, 209, 0.18);
  color: #52c7ff;
}

.stream-log-title-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-log-dialog-head > div:last-child {
  display: grid;
  gap: 3px;
}

.stream-log-dialog-head strong {
  color: #f5f8ff;
  font-size: 20px;
}

.stream-log-dialog-head span {
  color: var(--muted);
}

.stream-log-dialog-head small {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-log-dialog-head small b {
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 500;
}

.stream-log-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.stream-log-summary > div {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.stream-log-summary > div:last-child {
  border-right: 0;
}

.stream-log-summary small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stream-log-summary strong {
  overflow: hidden;
  color: #f0f5fc;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-log-runtime {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0 22px 16px;
}

.stream-log-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.stream-log-tabs button {
  min-height: 48px;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
}

.stream-log-tabs button.is-active {
  border-bottom-color: #42c7ff;
  color: #42c7ff;
}

.stream-log-tabs button span {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
}

.stream-log-panel {
  min-height: 0;
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  padding-top: 12px;
}

.stream-log-panel.is-active {
  display: grid;
}

.stream-log-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stream-log-panel-head small {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.stream-log-panel .stream-log-list,
.stream-recovery-log {
  min-height: 0;
  overflow: auto;
}

.stream-log-panel .stream-log-node pre {
  min-height: 250px;
  max-height: none;
  color: #ff8a8a;
  border-radius: 8px;
}

.stream-recovery-log {
  display: grid;
  align-content: start;
  gap: 8px;
}

.stream-recovery-row {
  display: grid;
  grid-template-columns: 150px 120px minmax(0, 1fr);
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #ff7777;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.stream-recovery-row.ok {
  border-left-color: #43d7a3;
}

.stream-recovery-row time,
.stream-recovery-row small {
  color: var(--muted);
  font-size: 11px;
}

.stream-recovery-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stream-recovery-row small {
  grid-column: 3;
}

.stream-log-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.stream-log-actions {
  margin: 0;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

.stream-log-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.stream-log-actions svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stream-test-loading {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.stream-test-loading small {
  max-width: 520px;
  color: var(--muted);
}

.stream-test-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(79, 143, 232, 0.2);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: stream-test-spin 0.8s linear infinite;
}

@keyframes stream-test-spin {
  to { transform: rotate(360deg); }
}

.stream-test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.stream-test-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.stream-test-head > div strong {
  color: #f3f7fd;
  font-size: 18px;
}

.stream-test-head > div span {
  color: var(--muted);
  font-size: 12px;
}

.stream-test-checks {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
}

.stream-test-check {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.stream-test-check > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 111, 111, 0.14);
  color: #ff8787;
}

.stream-test-check.ok > span {
  background: rgba(56, 207, 160, 0.14);
  color: #4fe0b2;
}

.stream-test-check svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.stream-test-check > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.stream-test-check small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.stream-test-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0 18px 18px;
  border: 1px solid var(--line);
  background: var(--line);
}

.stream-test-metrics > div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px;
  background: rgba(10, 17, 27, 0.98);
}

.stream-test-metrics > .wide {
  grid-column: span 2;
}

.stream-test-metrics small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stream-test-metrics strong {
  overflow: hidden;
  color: #edf4fc;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.probe-result.hint,
.probe-result.note {
  border-color: rgba(79, 143, 232, 0.3);
  background: rgba(79, 143, 232, 0.08);
}

@media (max-width: 1180px) {
  .stream-management-toolbar {
    grid-template-columns: 1fr;
  }

  .stream-toolbar-filters {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 1650px) {
  .stream-management-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .stream-toolbar-filters {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .stream-log-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stream-log-summary > div:nth-child(2) {
    border-right: 0;
  }

  .stream-recovery-row {
    grid-template-columns: 1fr;
  }

  .stream-recovery-row small {
    grid-column: auto;
  }

  .stream-test-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.config-block {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 0;
  padding: 14px;
}

.config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.035);
}

.config-head.copy-only {
  justify-content: flex-end;
}

.deploy-node-configs {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.deploy-config-detail .config-block {
  padding-top: 0;
}

.config-head button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.config-head svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.config-block pre {
  margin: 0;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: rgba(5, 8, 13, 0.74);
  color: #dce8f4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.checklist {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.checklist div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-zone {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 143, 132, 0.36);
  border-radius: 8px;
  background: rgba(255, 143, 132, 0.09);
  color: #ffd7d3;
}

.danger-zone span {
  color: var(--muted);
}

[data-source-quality-picker] [data-quality-options] label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

[data-source-quality-picker] [data-quality-options] input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}

.info-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(31, 183, 158, 0.28);
  border-radius: 8px;
  background: rgba(31, 183, 158, 0.08);
  color: #d9fbf3;
}

.info-note span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.info-note.warning {
  border-color: rgba(255, 209, 138, 0.42);
  background: rgba(255, 209, 138, 0.09);
  color: #ffe5b8;
}

.info-note.warning span {
  color: #dfc89f;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.check-row input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.drawer-loading {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
}

.import-analysis-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(39, 194, 167, 0.36);
  border-radius: 8px;
  background: rgba(39, 194, 167, 0.09);
  color: var(--text);
}

.import-analysis-progress > span:last-child {
  display: grid;
  gap: 3px;
}

.import-analysis-progress small {
  color: var(--muted);
}

.probe-result {
  display: grid;
  gap: 6px;
  margin: 18px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.probe-result.ok {
  border-color: rgba(117, 226, 160, 0.42);
  background: rgba(117, 226, 160, 0.10);
}

.probe-result.bad {
  border-color: rgba(255, 143, 132, 0.42);
  background: rgba(255, 143, 132, 0.10);
}

.probe-result span {
  color: var(--muted);
}

.probe-preview {
  margin: 0 18px 18px;
  padding: 14px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.72);
  color: #dce8f4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state,
.table-footer {
  padding: 14px;
  color: var(--muted);
}

.stream-empty {
  min-height: 150px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.stream-empty strong {
  color: #f5f8ff;
  font-size: 16px;
}

.stream-empty span {
  max-width: 520px;
}

.table-footer {
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.line-endpoint-grid {
  grid-template-columns: minmax(0, 1fr);
}

.line-endpoint-grid .endpoint-top {
  flex-wrap: wrap;
}

.line-endpoint-grid .endpoint-top strong {
  min-width: 0;
  white-space: normal;
}

.line-endpoint-grid .endpoint-actions {
  margin-left: auto;
}

.line-endpoint-grid .endpoint-card code {
  width: 100%;
  word-break: break-word;
}

.stream-worker-runtime {
  margin: 0 14px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stream-worker-runtime > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  color: #e9f2fb;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.stream-worker-node-count {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.stream-worker-runtime-list {
  display: grid;
}

.stream-worker-node {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(80px, .65fr) minmax(130px, 1.35fr) minmax(105px, .9fr) minmax(120px, 1fr) minmax(80px, .7fr);
  align-items: center;
  gap: 8px 14px;
  padding: 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.stream-worker-node-state,
.stream-worker-node-name,
.stream-worker-node-result,
.stream-worker-node-source,
.stream-worker-node-updated {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.stream-worker-node-state {
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  font-weight: 750;
}

.stream-worker-node-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.stream-worker-node-state.ok,
.stream-worker-node-result small.ok {
  color: var(--ok);
}

.stream-worker-node-state.warn {
  color: var(--warn);
}

.stream-worker-node-state.bad,
.stream-worker-node-result small.bad {
  color: var(--bad);
}

.stream-worker-node-source.ok small {
  color: var(--ok);
}

.stream-worker-node-source.warn small {
  color: var(--warn);
}

.stream-worker-node strong,
.stream-worker-node small,
.stream-worker-node-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stream-worker-node small,
.stream-worker-node-message {
  color: var(--muted);
}

.stream-worker-node-message {
  grid-column: 2 / -1;
  line-height: 1.35;
}

.stream-worker-runtime-empty {
  padding: 12px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .resource-log-policy-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .stream-worker-node {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stream-worker-node-message {
    grid-column: 1 / -1;
  }
}

body[data-ui-mode="simple"] .advanced-only {
  display: none !important;
}

body[data-ui-mode="simple"] .operator-stream-form {
  width: min(920px, 100%);
  margin-inline: auto;
}

body[data-ui-mode="simple"] .operator-auto-note {
  border-color: rgba(31, 183, 158, 0.34);
  background: rgba(31, 183, 158, 0.08);
}

body[data-ui-mode="simple"] .operator-stream-actions {
  justify-content: flex-end;
}

body[data-ui-mode="simple"] .stream-table-wrap {
  overflow-x: hidden;
}

body[data-ui-mode="simple"] .stream-management-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
}

body[data-ui-mode="simple"] .stream-management-table th,
body[data-ui-mode="simple"] .stream-management-table td {
  padding-right: clamp(2px, 0.35vw, 6px);
  padding-left: clamp(2px, 0.35vw, 6px);
}

body[data-ui-mode="simple"] .stream-management-table .stream-col-actions {
  min-width: 0 !important;
  max-width: none !important;
}

body[data-ui-mode="simple"] .stream-management-table .stream-col-select { width: 4% !important; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-id { width: 7% !important; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-name { width: 27% !important; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-server { width: 14% !important; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-status { width: 16% !important; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-audience { width: 8% !important; text-align: center; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-info { width: 25% !important; text-align: center; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-player { width: 6% !important; text-align: center; }
body[data-ui-mode="simple"] .stream-management-table .stream-col-actions { width: 7% !important; }

.stream-output-server {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.stream-output-server > svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stream-output-server strong {
  min-width: 0;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.stream-output-server strong .wsp-ip {
  display: block;
  max-width: 100%;
}

body[data-ui-mode="simple"] .stream-col-audience,
body[data-ui-mode="simple"] .stream-col-audience > span,
body[data-ui-mode="simple"] .stream-operator-quality {
  align-items: center;
  justify-content: center;
}

body[data-ui-mode="simple"] .stream-col-audience {
  gap: 5px;
}

body[data-ui-mode="simple"] .stream-col-audience > span {
  display: inline-flex;
  gap: 3px;
  margin-inline: 2px;
}

body[data-ui-mode="simple"] .stream-col-audience .stream-connection-ratio {
  justify-content: center;
  white-space: nowrap;
}

body[data-ui-mode="simple"] .stream-col-audience svg {
  width: 11px;
  height: 11px;
}

body[data-ui-mode="simple"] .stream-operator-quality {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

body[data-ui-mode="simple"] .stream-operator-quality small {
  color: var(--muted);
}

body[data-ui-mode="simple"] .stream-operator-quality .stream-playback-mode {
  color: #aab8c8;
}

body[data-ui-mode="simple"] .stream-operator-quality .stream-playback-mode.adaptive {
  color: #69e6a9;
}

body[data-ui-mode="simple"] .stream-operator-quality .stream-playback-mode.normal {
  color: #9fcaff;
}

@media (max-width: 760px) {
  body[data-ui-mode="simple"] .stream-management-toolbar {
    padding: 10px;
  }

  body[data-ui-mode="simple"] .stream-toolbar-primary,
  body[data-ui-mode="simple"] .stream-toolbar-filters {
    white-space: normal;
  }

  body[data-ui-mode="simple"] .stream-toolbar-filters > *,
  body[data-ui-mode="simple"] .stream-search-field {
    flex: 1 1 150px;
    min-width: 0;
    max-width: none;
  }

  body[data-ui-mode="simple"] .stream-management-table {
    font-size: clamp(8px, 1.7vw, 11px);
  }
}

.ui-mode-form {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ui-mode-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 17, 27, 0.68);
  cursor: pointer;
}

.ui-mode-choice:has(input:checked) {
  border-color: var(--accent);
  background: rgba(35, 190, 168, 0.1);
}

.ui-mode-choice input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.ui-mode-choice span {
  display: grid;
  gap: 6px;
}

.ui-mode-choice small {
  color: var(--muted);
  line-height: 1.45;
}

.drawer-divider {
  height: 1px;
  margin: 6px 0 18px;
  background: var(--line);
}

.endpoint-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(16px);
}

.endpoint-top {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.endpoint-top strong {
  white-space: nowrap;
}

.endpoint-card code {
  display: block;
  max-width: 100%;
  color: #dce8f4;
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.endpoint-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.endpoint-actions .icon-button {
  display: inline-grid;
  place-items: center;
}

.endpoint-actions .icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.copied {
  border-color: rgba(117, 226, 160, 0.72);
  color: var(--good);
}

.mono {
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.proxy-row-actions {
  min-width: max-content;
  align-items: center;
  flex-wrap: nowrap;
}

.proxy-row-actions > button {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.proxy-row-actions .proxy-test-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.proxy-row-actions .proxy-test-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entity-row-proxies td:last-child {
  width: 1%;
}

.proxy-status-summary {
  display: grid;
  width: min(280px, 26vw);
  gap: 4px;
  overflow: visible;
  white-space: normal;
}

.proxy-status-summary .status {
  width: max-content;
  max-width: 100%;
}

.proxy-status-summary small {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-test-result {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 16px;
}

.proxy-test-result > .info-note {
  min-width: 0;
}

.proxy-test-result-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.proxy-test-result-metrics .metric {
  min-width: 0;
  padding: 14px;
}

.proxy-test-result-metrics .metric strong {
  min-width: 0;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.35;
}

.proxy-test-result > .drawer-actions {
  margin: 0 -16px -16px;
}

@media (max-width: 460px) {
  .proxy-test-result-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

.entity-row-lines .actions {
  min-width: max-content;
  flex-wrap: nowrap;
}

.line-col-select {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.line-col-select input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.entity-row-lines.is-selected td {
  background: rgba(31, 183, 158, 0.08);
}

.line-password {
  display: inline-block;
  color: #f2f6fb;
  font-family: Consolas, Menlo, monospace;
  white-space: nowrap;
}

.runtime-duration {
  display: grid;
  gap: 2px;
  min-width: 64px;
  white-space: nowrap;
}

.runtime-duration strong {
  color: var(--good);
  font-variant-numeric: tabular-nums;
}

.runtime-duration small {
  color: var(--muted);
  font-size: 10px;
}

.runtime-duration .restart-counter {
  align-items: center;
  display: inline-flex;
  gap: 3px;
  width: max-content;
}

.runtime-duration .restart-counter svg {
  height: 11px;
  width: 11px;
}

.entity-row-lines td:last-child {
  min-width: 390px;
}

.actions .icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 15, 24, 0.34);
}

.category-type-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.category-type-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 10px;
  white-space: nowrap;
}

.category-type-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
}

.category-type-tab.active {
  border-color: rgba(39, 205, 178, 0.68);
  background: rgba(31, 183, 158, 0.14);
  color: #effffa;
}

.category-type-tab.active span {
  border-color: rgba(39, 205, 178, 0.45);
  color: var(--good);
}

.category-list-toolbar select {
  width: 190px;
  margin-left: auto;
}

.category-list-count {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.category-table {
  min-width: 860px;
}

.category-table-wrap {
  max-height: calc(100vh - 285px);
  min-height: 260px;
  overscroll-behavior: contain;
}

.category-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #101923;
}

.category-table th,
.category-table td {
  white-space: nowrap;
}

.category-table .category-name-cell {
  width: 100%;
  min-width: 220px;
  white-space: normal;
}

.category-order,
.category-count {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.category-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #dbe8f4;
  background: rgba(255, 255, 255, 0.035);
}

.category-type-live {
  border-color: rgba(39, 205, 178, 0.38);
  color: #75e2c9;
}

.category-type-vod {
  border-color: rgba(239, 184, 82, 0.38);
  color: #f0c877;
}

.category-type-series {
  border-color: rgba(92, 161, 228, 0.42);
  color: #8fc8ff;
}

.category-type-radio {
  border-color: rgba(224, 119, 142, 0.38);
  color: #f0a1b3;
}

.category-actions {
  min-width: 76px;
  flex-wrap: nowrap;
}

.category-actions .icon-button {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
}

.epg-national-profiles {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.epg-national-head > div {
  display: grid;
  gap: 5px;
}

.epg-national-head strong {
  font-size: 1rem;
}

.epg-national-head span {
  max-width: 920px;
  color: var(--muted);
}

.epg-country-selector {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(31, 196, 181, 0.34);
  border-radius: 12px;
  background: rgba(11, 55, 60, 0.34);
}

.epg-country-selector label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.epg-country-selector select,
.epg-country-selector button {
  min-height: 44px;
}

@media (max-width: 720px) {
  .epg-country-selector {
    grid-template-columns: 1fr;
  }
}

.epg-language-groups {
  display: grid;
  gap: 9px;
}

.epg-country-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 21, 31, 0.58);
}

.epg-country-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.epg-country-group > summary::-webkit-details-marker {
  display: none;
}

.epg-country-group > summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.epg-country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.epg-country-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  min-height: 62px;
  padding: 9px 10px;
  text-align: left;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(17, 31, 44, 0.74);
}

.epg-country-profile strong,
.epg-country-profile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epg-country-profile > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.epg-country-profile small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.epg-country-profile.configured {
  border-color: rgba(241, 194, 92, 0.5);
}

.epg-country-profile.ready {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(20, 83, 45, 0.2);
}

.epg-source-actions {
  flex-wrap: nowrap;
  min-width: 170px;
}

.epg-source-actions .icon-button {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
}

.epg-source-actions .icon-button svg {
  width: 16px;
  height: 16px;
}

.epg-source-url {
  width: min(28vw, 360px);
  max-width: min(28vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-status {
  min-height: 20px;
  color: var(--bad);
}

.danger {
  border-color: rgba(255, 143, 132, 0.38);
  color: var(--bad);
}

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

.entity-relation {
  display: block;
  width: min(220px, 24vw);
  overflow: hidden;
  color: #dce8f4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-relation.warn {
  color: var(--bad);
}

/* Keep the viewing duration below the title despite entity-relation's block rule. */
.entity-relation.runtime-duration {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.entity-relation.runtime-duration > strong,
.entity-relation.runtime-duration > small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-network-address {
  display: inline-grid;
  gap: 3px;
  line-height: 1.2;
  vertical-align: middle;
}

.server-network-address small {
  color: var(--muted);
  font-size: 0.78rem;
}

.entity-date {
  white-space: nowrap;
}

@media (max-width: 700px) {
  .entity-relation {
    width: 180px;
  }
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: minmax(92px, 230px) minmax(0, 1fr);
  }

  .app.sidebar-collapsed {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app.sidebar-collapsed.sidebar-hovered,
  .app.sidebar-collapsed:has(.sidebar:hover) {
    grid-template-columns: minmax(92px, 230px) minmax(0, 1fr);
  }

  .app[data-layout="top"] {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .app[data-layout="top"].sidebar-collapsed,
  .app[data-layout="top"].sidebar-collapsed.sidebar-hovered,
  .app[data-layout="top"].sidebar-collapsed:has(.sidebar:hover) {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100vh;
    padding: 12px;
  }

  nav {
    grid-template-columns: 1fr;
  }

  .app[data-layout="top"] .sidebar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    overflow: visible;
  }

  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .brand-copy,
  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .sidebar-toggle,
  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-button strong,
  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-group .nav-group-toggle svg:last-child,
  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) .nav-submenu,
  .app[data-layout="top"].sidebar-collapsed:not(.sidebar-hovered):not(:has(.sidebar:hover)) #logoutButton {
    display: initial;
  }

  .app[data-layout="top"] nav {
    flex-wrap: wrap;
  }

  .category-list-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .category-type-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .category-list-toolbar select {
    width: min(100%, 240px);
    margin-left: 0;
  }

  .server-status-board,
  .grid-form,
  .panel-filters,
  .endpoint-grid,
  .split,
  .add-stream-tabs,
  .line-form-grid {
    grid-template-columns: 1fr;
  }

  .server-selection-groups {
    grid-template-columns: 1fr;
  }

  .line-form-tabs {
    grid-template-columns: repeat(5, minmax(112px, 1fr));
  }

  .server-status-row summary,
  .server-status-detail {
    grid-template-columns: 1fr;
  }

  .server-status-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .server-status-values {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .server-status-rings {
    grid-template-columns: repeat(3, 76px);
    justify-content: start;
  }

  .signal-strip {
    min-height: 92px;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
  }

  .signal-strip h3 {
    font-size: 16px;
  }

  .signal-strip p {
    font-size: 12px;
    line-height: 1.35;
  }

  .endpoint-card {
    align-items: stretch;
  }

  .login-wrap {
    place-items: center;
  }

  .login-wrap::before {
    inset: 0;
    background-size: cover;
    background-position: center center;
    opacity: 0.42;
  }

  body::before {
    background-position: center, 0% 50%, center;
    background-size: cover, 240% 240%, cover;
  }

  .grid-form .wide,
  .grid-form .full {
    grid-column: auto;
  }

  .add-stream-grid label {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .add-stream-grid label > input,
  .add-stream-grid label > select,
  .add-stream-grid label > textarea,
  .input-with-button {
    grid-column: auto;
  }

  .add-stream-grid label > .field-explanation {
    grid-column: auto;
    margin-top: 4px;
  }

  .source-fallback-control {
    grid-column: auto;
  }

  .add-stream-grid .source-priority-row label,
  .source-priority-row label {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .add-stream-grid .source-priority-row label > input,
  .source-priority-row label > input {
    grid-column: 1;
  }

  .add-stream-meta {
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar input {
    width: 100%;
  }

  .drawer {
    width: 100%;
  }

  .drawer-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-stats > div:nth-child(2) {
    border-inline-end: 0;
  }

  .compact-stats > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .signal-strip {
    grid-template-columns: 1fr;
  }

  .server-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .server-status-summary,
  .server-status-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .server-status-rings {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }

  .server-mini-ring {
    width: 62px;
  }
}

@media (max-width: 720px) {
  .app,
  .app.sidebar-collapsed,
  .app.sidebar-collapsed.sidebar-hovered,
  .app.sidebar-collapsed:has(.sidebar:hover) {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app:not(.sidebar-collapsed) .sidebar,
  .app.sidebar-collapsed.sidebar-hovered .sidebar,
  .app.sidebar-collapsed:has(.sidebar:hover) .sidebar {
    position: fixed;
    left: 0;
    z-index: 40;
    width: 230px;
    box-shadow: 14px 0 28px rgba(0, 0, 0, 0.38);
  }

  .workspace {
    min-width: 0;
  }

  .topbar,
  .content {
    width: 100%;
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .toolbar {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .language-select,
  .search-scope-select,
  .toolbar input {
    min-width: 0;
    flex: 1 1 128px;
  }

  .user-button {
    min-width: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .signal-strip {
    animation: none;
  }
}

/* Standard mode keeps the complete page inside the current screen instead of
   creating nested horizontal viewports. Labels and actions reflow; features
   remain available. */
@media (max-width: 1280px) {
  body[data-ui-mode="simple"] .app:not([data-layout="top"]) {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  body[data-ui-mode="simple"] .app.sidebar-collapsed:not([data-layout="top"]) {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  body[data-ui-mode="simple"] .content {
    min-width: 0;
    padding: 14px 12px 28px;
  }

  body[data-ui-mode="simple"] .topbar {
    min-width: 0;
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  body[data-ui-mode="simple"] .toolbar {
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  body[data-ui-mode="simple"] .toolbar > *,
  body[data-ui-mode="simple"] .toolbar input,
  body[data-ui-mode="simple"] .language-select,
  body[data-ui-mode="simple"] .search-scope-select {
    min-width: 0;
    max-width: 100%;
  }

  body[data-ui-mode="simple"] .table-wrap,
  body[data-ui-mode="simple"] .bulk-import-preview,
  body[data-ui-mode="simple"] .category-table-wrap {
    max-width: 100%;
    overflow-x: visible;
  }

  body[data-ui-mode="simple"] table:not(.stream-management-table),
  body[data-ui-mode="simple"] .bulk-import-preview table,
  body[data-ui-mode="simple"] .category-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  body[data-ui-mode="simple"] table:not(.stream-management-table) th,
  body[data-ui-mode="simple"] table:not(.stream-management-table) td,
  body[data-ui-mode="simple"] .category-table th,
  body[data-ui-mode="simple"] .category-table td {
    min-width: 0;
    padding-inline: clamp(3px, 0.55vw, 8px);
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  body[data-ui-mode="simple"] .sticky-actions-table table > thead > tr > th:last-child,
  body[data-ui-mode="simple"] .sticky-actions-table table > tbody > tr > td:last-child {
    position: static;
    box-shadow: none;
  }

  body[data-ui-mode="simple"] .entity-row-lines td:last-child,
  body[data-ui-mode="simple"] .category-table .category-name-cell {
    min-width: 0;
  }

  body[data-ui-mode="simple"] .entity-relation {
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  body[data-ui-mode="simple"] .line-form-tabs {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    overflow-x: visible;
  }

  body[data-ui-mode="simple"] .line-client-form-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-ui-mode="simple"] .stream-section-tabs,
  body[data-ui-mode="simple"] .category-type-tabs,
  body[data-ui-mode="simple"] .stream-actions {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (max-width: 620px) {
  body[data-ui-mode="simple"] .line-client-form-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  body[data-ui-mode="simple"] .app:not([data-layout="top"]):not(.sidebar-collapsed) {
    grid-template-columns: 188px minmax(0, 1fr);
  }

  body[data-ui-mode="simple"] .sidebar {
    padding-inline: 10px;
  }

  body[data-ui-mode="simple"] .nav-submenu {
    margin-left: 20px;
  }
}

.server-status-row summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg);
}

.server-status-row[open] summary::after {
  transform: rotate(225deg);
}

.firewall-fleet {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.firewall-node {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(9, 17, 27, 0.78);
  overflow: hidden;
}

.firewall-node > summary {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(150px, 1fr) minmax(170px, 1.1fr) minmax(170px, 1.1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.firewall-node > summary::-webkit-details-marker {
  display: none;
}

.firewall-node[open] > summary {
  border-bottom: 1px solid var(--line);
  background: rgba(22, 35, 49, 0.72);
}

.firewall-node-name,
.firewall-route-pill {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.firewall-node-name strong,
.firewall-route-pill b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firewall-node-name small,
.firewall-route-pill small {
  color: var(--muted);
  font-size: 11px;
}

.firewall-node-content {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.firewall-networks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.firewall-network {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 10px;
  min-width: 0;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
}

.firewall-network:last-child {
  border-right: 0;
}

.firewall-network.offline {
  opacity: 0.56;
}

.firewall-network span {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.firewall-network code {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--good);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firewall-network .firewall-output-url {
  color: var(--muted);
  font-size: 11px;
}

.firewall-route-roles {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 4px;
}

.firewall-route-roles small,
.firewall-route-state {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  line-height: 1.2;
}

.firewall-network .firewall-route-state {
  grid-column: 1 / -1;
  justify-self: start;
}

.firewall-route-state.ok {
  border-color: color-mix(in srgb, var(--good) 45%, transparent);
  color: var(--good);
}

.firewall-route-state.bad {
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
  color: var(--bad);
}

.firewall-route-state.warn {
  color: var(--warn);
}

.firewall-policy-form {
  display: grid;
  gap: 10px;
}

.firewall-toggle-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.firewall-toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.firewall-toggle-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.firewall-advanced {
  border-bottom: 1px solid var(--line);
}

.firewall-advanced > summary {
  padding: 9px 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.vpn-runtime-list {
  display: grid;
  gap: 6px;
  padding: 2px 0 10px;
}

.vpn-runtime-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(140px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(12, 22, 34, 0.68);
}

.vpn-runtime-row > span:first-child {
  display: grid;
  gap: 2px;
}

.vpn-runtime-row small,
.vpn-runtime-row code {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vpn-runtime-row .vpn-profile-ready { color: #67d6a4; }
.vpn-runtime-row .vpn-profile-bad { color: #ff9b9b; }

.vpn-runtime-row .actions {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
}

.vpn-runtime-row button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}

.firewall-port-grid,
.firewall-list-grid {
  display: grid;
  gap: 8px;
  padding: 2px 0 10px;
}

.firewall-port-grid {
  grid-template-columns: repeat(7, minmax(105px, 1fr));
}

.firewall-list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.firewall-port-grid label,
.firewall-list-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.firewall-list-grid textarea {
  resize: vertical;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.firewall-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.firewall-actions button {
  white-space: nowrap;
}

.danger-soft {
  border-color: rgba(255, 143, 132, 0.45);
  color: var(--bad);
}

.stream-logo-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.stream-logo-picker > label {
  min-width: 0;
}

.stream-logo-picker > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  white-space: nowrap;
}

.stream-logo-picker > button svg {
  width: 16px;
  height: 16px;
}

.stream-logo-results {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}

.tmdb-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 17, 27, 0.78);
}

.tmdb-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tmdb-picker-head > div,
.tmdb-result-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tmdb-picker-head span,
.tmdb-result-copy small,
.tmdb-result-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.tmdb-picker-head button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tmdb-picker-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.tmdb-language {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.tmdb-language span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tmdb-language select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
}

.tmdb-picker-head svg {
  width: 15px;
  height: 15px;
}

.tmdb-results {
  display: grid;
  gap: 7px;
  min-height: 0;
}

.tmdb-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 7px;
  max-height: 360px;
  overflow-y: auto;
}

.tmdb-result {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-height: 92px;
  padding: 7px;
  text-align: left;
}

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

.tmdb-poster {
  display: grid;
  place-items: center;
  width: 62px;
  height: 78px;
  overflow: hidden;
  border-radius: 4px;
  background: #101923;
}

.tmdb-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tmdb-result-copy > span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: normal;
}

@media (max-width: 680px) {
  .tmdb-picker-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tmdb-picker-actions {
    justify-content: stretch;
  }

  .tmdb-picker-actions button {
    flex: 1 1 150px;
    justify-content: center;
  }

  .tmdb-language {
    flex: 1 1 100%;
  }

  .tmdb-results-grid {
    grid-template-columns: 1fr;
  }
}

.stream-logo-results-title {
  color: var(--text);
  font-size: 12px;
}

.stream-logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
  max-height: 330px;
  overflow-y: auto;
}

.stream-logo-choice {
  display: grid;
  grid-template-rows: 88px auto;
  gap: 7px;
  min-width: 0;
  min-height: 142px;
  padding: 8px;
  border-color: var(--line);
  background: rgba(8, 17, 27, 0.78);
  text-align: left;
}

.stream-logo-choice:hover,
.stream-logo-choice.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, rgba(8, 17, 27, 0.9));
}

.stream-logo-preview {
  display: grid;
  place-items: center;
  width: 100%;
  height: 88px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  background-color: #f1f4f7;
  background-image: linear-gradient(45deg, #dfe4e8 25%, transparent 25%), linear-gradient(-45deg, #dfe4e8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dfe4e8 75%), linear-gradient(-45deg, transparent 75%, #dfe4e8 75%);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.stream-logo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stream-logo-choice-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stream-logo-choice-copy strong,
.stream-logo-choice-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-logo-choice-copy strong {
  font-size: 11px;
}

.stream-logo-choice-copy small,
.stream-logo-message {
  color: var(--muted);
  font-size: 10px;
}

.remote-api-summary,
.remote-api-module-grid,
.remote-api-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.remote-api-summary > div,
.remote-api-module-card,
.remote-api-resource-scope {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 17, 27, 0.74);
}

.remote-api-summary > div strong {
  font-size: 20px;
}

.remote-api-summary > div span,
.remote-api-resource-scope > span {
  color: var(--muted);
  font-size: 11px;
}

.remote-api-module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.remote-api-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.remote-api-permission-grid fieldset {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 1180px) {
  .firewall-node > summary {
    grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr);
  }

  .firewall-toggle-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .firewall-port-grid {
    grid-template-columns: repeat(4, minmax(105px, 1fr));
  }

  .vpn-runtime-row {
    grid-template-columns: minmax(140px, 1fr) auto minmax(120px, 1fr);
  }

  .vpn-runtime-row .actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .stream-logo-picker {
    grid-template-columns: 1fr;
  }

  .stream-logo-picker > button {
    justify-content: center;
  }

  .firewall-node > summary,
  .firewall-networks,
  .firewall-toggle-row,
  .firewall-list-grid,
  .firewall-port-grid {
    grid-template-columns: 1fr;
  }

  .firewall-network {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .firewall-network:last-child {
    border-bottom: 0;
  }

  .firewall-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .vpn-runtime-row {
    grid-template-columns: 1fr auto;
  }

  .vpn-runtime-row code,
  .vpn-runtime-row .actions {
    grid-column: 1 / -1;
  }

  .vpn-runtime-row .actions button {
    flex: 1 1 0;
  }
}
.nav-dashboard-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
}

.nav-dashboard-header .nav-button,
.app[data-layout="top"] .nav-dashboard-header .nav-button {
  grid-template-columns: 24px minmax(0, 1fr);
  width: 100%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.nav-dashboard-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 36px;
  padding: 0;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: transparent;
  border-color: transparent;
  color: #c9d5e2;
}

.nav-dashboard-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.nav-dashboard-toggle.active,
.nav-dashboard-toggle:hover {
  background: #1d2834;
  border-color: #2b3b4d;
  color: #fff;
}

.stream-logo-upload-status {
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
}

.stream-logo-upload-status:not(.hidden) {
  display: inline-flex;
}

.stream-logo-upload-status img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 5px;
  background: rgba(8, 17, 27, 0.72);
}

.online-clients-page-note {
  margin-bottom: 14px;
}

.stream-epg-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stream-epg-tabs button {
  min-height: 44px;
  border-radius: 4px;
}

.stream-epg-tabs button.active {
  border-color: #4f91e8;
  background: #4f91e8;
  color: #fff;
}

.stream-epg-selection {
  padding: 10px 12px;
  border: 1px solid #2a4053;
  border-radius: 7px;
  background: #0d1a25;
  color: #d8e8f7;
}

.stream-epg-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stream-epg-panel[hidden] {
  display: none;
}

.stream-epg-results {
  grid-column: 1 / -1;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #283847;
  background: #101923;
}

.stream-epg-result-group > strong {
  display: block;
  padding: 10px 12px 6px;
  color: #9eacba;
  font-size: 12px;
  text-transform: uppercase;
}

.stream-epg-result-list {
  display: grid;
}

.stream-epg-result-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid #243240;
  border-radius: 0;
  text-align: left;
  background: #17222e;
}

.stream-epg-result-group[hidden],
.stream-epg-result-list button[hidden] {
  display: none !important;
}

.stream-epg-result-list button:hover,
.stream-epg-result-list button.selected {
  background: #397cc9;
  color: #fff;
}

.stream-epg-result-list button small {
  color: inherit;
  opacity: .72;
}

@media (max-width: 720px) {
  .stream-epg-tabs,
  .stream-epg-panel {
    grid-template-columns: 1fr;
  }
}

/* Keep every panel selection control compact and visually consistent. */
input[type="checkbox"] {
  box-sizing: border-box;
  flex: 0 0 14px !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  margin: 0;
  padding: 0 !important;
  accent-color: var(--accent);
  vertical-align: middle;
}


/* Compact category summaries; full names remain available in the drawer. */
.stream-name-copy .stream-category-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 2px 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.stream-category-preview {
  min-width: 0;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-category-more {
  flex: none;
  color: #7eb8f5;
  white-space: nowrap;
}
.stream-category-summary:hover .stream-category-preview { text-decoration: underline; }
.stream-category-summary:focus-visible { outline: 2px solid #7eb8f5; outline-offset: 3px; }
.stream-category-browser { display: grid; gap: 10px; min-width: 0; }
.stream-category-browser > label { font-weight: 600; }
.stream-category-browser > input { width: 100%; min-width: 0; }
.stream-category-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: min(50vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stream-category-list li { padding: 10px 12px; white-space: normal; overflow-wrap: anywhere; }
.stream-category-list li + li { border-top: 1px solid var(--line); }
.stream-category-list li[hidden], .stream-category-browser [hidden] { display: none; }

/* Episode multiple entry: XUI arrangement, native accessible switches. */
.episode-multiple-shell { max-width: 980px; margin: 22px auto; background: #3a424e; }
.episode-multiple-shell .episode-form-heading { background: #303844; padding: 18px 0 24px; }
.episode-multiple-shell .episode-form-heading h3 { font-size: 24px; font-weight: 500; }
.episode-multiple-shell .episode-form-heading > button { background: #0066b7; border: 0; border-radius: 0; color: #fff; }
.episode-multiple-shell .add-stream-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 28px solid #3f4753; background: #454d58; }
.episode-multiple-shell .add-stream-tabs button { min-height: 54px; font-size: 16px; font-weight: 500; }
.episode-multiple-shell .add-stream-tabs button.active { background: #4d8cde; }
.episode-multiple-shell .add-stream-tab-body { padding: 30px; }
.episode-multiple-shell .episode-advanced-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 42px 48px; padding: 14px 0; }
.episode-multiple-shell .episode-advanced-grid > .wide { grid-column: 1 / -1; }
.episode-multiple-shell .episode-batch-switch { position: relative; display: flex !important; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; cursor: pointer; font-size: 16px; font-weight: 600; color: #bac4d0; }
.episode-multiple-shell .episode-batch-switch > .episode-option-caption { width: auto; height: auto; border-radius: 0; background: transparent; flex: 1; }
.episode-multiple-shell .episode-batch-switch > .episode-option-caption::before { content: none; }
.episode-multiple-shell .episode-option-help { color: #8b9dad; font-size: 15px; cursor: help; }
.episode-multiple-shell .episode-batch-switch > .episode-switch-slider { width: 92px; height: 38px; border-radius: 24px; background: #fff; border: 1px solid #d9dde2; }
.episode-multiple-shell .episode-batch-switch > .episode-switch-slider::before { left: 1px; top: 1px; width: 34px; height: 34px; box-shadow: 0 1px 3px #0004; }
.episode-multiple-shell .episode-batch-switch input:checked + .episode-switch-slider { background: #4d8cde; border-color: #4d8cde; }
.episode-multiple-shell .episode-batch-switch input:checked + .episode-switch-slider::before { transform: translateX(54px); }
.episode-multiple-shell .episode-batch-switch input:disabled + .episode-switch-slider { background: #9ba1a7; border-color: #9ba1a7; cursor: default; }
.episode-multiple-shell .episode-batch-switch input:disabled + .episode-switch-slider::before { background: #aeb3b8; }
.episode-multiple-shell .episode-profile-row, .episode-multiple-shell .episode-subtitle-row { display: grid; grid-template-columns: minmax(220px, .9fr) minmax(0, 1.8fr); gap: 28px; align-items: center; color: #bac4d0; font-weight: 600; }
.episode-multiple-shell .episode-profile-row select { background: #444d59; border: 1px solid #505b68; border-radius: 0; min-height: 44px; color: #bac4d0; }
.episode-multiple-shell .episode-subtitle-row .input-with-button { grid-template-columns: minmax(0, 1fr) 44px; }
.episode-multiple-shell .episode-subtitle-row input { min-width: 0; width: 100%; }
.episode-multiple-shell .episode-subtitle-row button { background: #4d8cde; border-radius: 0; }
.episode-multiple-shell .episode-subtitle-row button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.episode-multiple-shell .episode-common-information, .episode-multiple-shell .episode-extra-options { margin-top: 24px; }
.episode-multiple-shell .episode-common-information > summary, .episode-multiple-shell .episode-extra-options > summary { color: #bac4d0; cursor: pointer; padding: 12px 0; }
.episode-multiple-shell .add-stream-actions { display: flex; gap: 12px; margin-top: 30px; }
.episode-multiple-shell .add-stream-actions [data-episode-tab="servers"], .episode-multiple-shell .add-stream-actions [data-episode-tab="advanced"], .episode-multiple-shell .add-stream-actions button[type="submit"] { margin-left: auto; }
.episode-multiple-shell .add-stream-actions > button { border-radius: 0; }
@media (max-width: 760px) {
  .episode-multiple-shell { margin: 8px 0; }
  .episode-multiple-shell .add-stream-tab-body { padding: 20px; }
  .episode-multiple-shell .episode-advanced-grid { grid-template-columns: 1fr; gap: 24px; }
  .episode-multiple-shell .episode-profile-row, .episode-multiple-shell .episode-subtitle-row { grid-template-columns: 1fr; gap: 10px; }
  .episode-multiple-shell .episode-profile-row select, .episode-multiple-shell .episode-subtitle-row .input-with-button { grid-column: 1; }
  .episode-multiple-shell .add-stream-tabs button { font-size: 13px; }
}

.episode-batch-shell .episode-batch-table { min-width: 780px; width: 100%; }
.episode-batch-shell .episode-batch-table th:first-child { width: 100px; }
.episode-batch-shell .episode-batch-table th:nth-child(2) { width: 30%; }
.episode-batch-shell .episode-batch-table th:last-child { width: 52px; }
.episode-batch-shell .episode-batch-table input { width: 100%; min-width: 0; }
.episode-batch-shell .episode-batch-table .input-with-button { display: flex; gap: 8px; }
.episode-batch-shell .episode-batch-table .input-with-button input { flex: 1; }
.episode-batch-shell .stream-table-wrap { margin: 20px 0 14px; }
.episode-batch-shell section[hidden] { display: none !important; }
.episode-batch-shell [data-episode-add] { margin-right: 16px; }
.episode-batch-shell .add-stream-actions { margin-top: 24px; }

.episode-batch-shell .episode-batch-table th:last-child { width: 92px; }
.episode-batch-shell .episode-batch-table button { padding: 8px; white-space: nowrap; min-width: 60px; }

/* Remote API controls: keep icons intrinsic and actions aligned at every width. */
.panel-toolbar:has(> [data-create-remote-api-user]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}
.panel-toolbar:has(> [data-create-remote-api-user]) > span {
  flex: 1 1 280px;
  min-width: 0;
  line-height: 1.5;
}
[data-create-remote-api-user],
.remote-api-module-card > button,
.remote-api-simple-card .actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  height: auto;
  padding: 8px 14px;
  line-height: 1.25;
  align-self: center;
}
[data-create-remote-api-user] {
  flex: 0 0 auto;
  white-space: nowrap;
}
[data-create-remote-api-user] > svg,
.remote-api-module-card button > svg,
.remote-api-simple-card button > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.remote-api-module-card {
  align-content: start;
  min-width: 0;
}
.remote-api-module-card .checkbox-row,
.remote-api-permission-grid .checkbox-row,
.remote-api-resource-scope .checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 36px;
}
.remote-api-module-card .checkbox-row > input[type="checkbox"],
.remote-api-permission-grid .checkbox-row > input[type="checkbox"],
.remote-api-resource-scope .checkbox-row > input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
}
.remote-api-simple-card .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.server-values-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.server-values-input {
  display: flex;
  gap: 8px;
}
.line-form-tabs.server-form-tabs {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}


/* API guide: bounded outline icons and consistent copy actions. */
.app[data-active-tab="api-docs"] .remote-api-doc-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.app[data-active-tab="api-docs"] .remote-api-doc-grid > .row-card {
  grid-template-rows: auto auto 1fr auto auto;
  align-content: start;
  gap: 10px;
}

.app[data-active-tab="api-docs"] .remote-api-doc-grid code {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.app[data-active-tab="api-docs"] button[data-copy] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  height: auto;
  padding: 8px 12px;
  line-height: 1.25;
  align-self: end;
}

.app[data-active-tab="api-docs"] button[data-copy] > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app[data-active-tab="api-docs"] .panel-toolbar:has(> button[data-copy]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.app[data-active-tab="api-docs"] .panel-toolbar:has(> button[data-copy]) > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Connected API account password visibility */
.remote-api-password-control { display:flex; align-items:center; gap:8px; min-width:0; }
.remote-api-password-control > input { flex:1 1 0; min-width:0; width:0; }
.remote-api-password-control > button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; align-self:center; height:auto; min-height:36px; padding:8px 12px; line-height:1.25; white-space:nowrap; }


/* Episode management keeps media metadata visible for idle on-demand assets. */
.episode-series-picker{width:min(560px,calc(100vw - 32px));background:var(--panel,#151c26);border:1px solid var(--border,#293747);border-radius:12px;padding:20px;display:grid;gap:16px}
.episode-series-picker header,.episode-series-picker footer,.episode-form-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.episode-series-picker h3,.episode-form-heading h3{margin:0}
.episode-series-picker label{display:grid;gap:8px}.episode-series-picker select{min-height:180px;width:100%}
.episode-series-picker input{width:100%}.episode-form-heading{padding:16px 20px}
.stream-episode-table .episode-sort-button{border:0;background:transparent;padding:0;color:inherit;font:inherit;white-space:nowrap}
.stream-episode-table .episode-row-actions{display:flex;gap:4px;justify-content:flex-end}
.stream-episode-table .episode-row-actions button{width:30px;min-width:30px;height:30px;padding:6px}
.stream-episode-table .stream-col-actions{width:142px;min-width:142px}
.stream-episode-table .stream-col-name{width:28%}.stream-episode-table .stream-col-server{width:14%}
.stream-episode-table .stream-col-info{width:21%;min-width:180px}
.stream-management-table.stream-episode-table .stream-col-info{text-align:center}
.stream-management-table.stream-episode-table .stream-info-grid{grid-template-columns:minmax(80px,1.6fr) repeat(3,minmax(28px,1fr));gap:6px;width:100%;max-width:300px;margin-inline:auto;justify-content:center}
.stream-management-table.stream-episode-table .stream-info-grid .quality-main{justify-items:center}
.stream-episode-table .stream-row-logo{width:28px;height:40px;flex-basis:28px}
.stream-episode-table td{padding-top:8px!important;padding-bottom:8px!important}
body[data-ui-mode="simple"] .stream-episode-table .stream-col-id{width:6%}
body[data-ui-mode="simple"] .stream-episode-table .stream-col-name{width:28%}
body[data-ui-mode="simple"] .stream-episode-table .stream-col-info{width:21%}
body[data-ui-mode="simple"] .stream-episode-table .stream-col-actions{width:142px;min-width:142px}
.episode-batch-shell [data-episode-panel="details"]>.add-stream-grid{margin-bottom:16px}
.episode-batch-shell .episode-batch-table input{width:100%}

/* Reserve space for all episode actions in both UI modes. */
.episode-row-actions .icon-button svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.episode-row-actions button[data-delete]{color:var(--bad,#ff7272)}
.stream-table-wrap:has(.stream-episode-table){overflow-x:auto!important}
.stream-management-table.stream-episode-table{min-width:1050px!important;table-layout:fixed}
.stream-management-table.stream-episode-table .stream-col-select,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-select{width:3%!important}
.stream-management-table.stream-episode-table .stream-col-id,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-id{width:5%!important}
.stream-management-table.stream-episode-table .stream-col-name,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-name{width:25%!important}
.stream-management-table.stream-episode-table .stream-col-server,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-server{width:12%!important}
.stream-management-table.stream-episode-table .stream-col-status,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-status{width:9%!important}
.stream-management-table.stream-episode-table .stream-col-audience,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-audience{width:104px!important;min-width:104px!important}
.stream-management-table.stream-episode-table .stream-col-info,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-info{width:19%!important}
.stream-management-table.stream-episode-table .stream-col-player,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-player{width:5%!important}
.stream-management-table.stream-episode-table .stream-col-actions,body[data-ui-mode="simple"] .stream-management-table.stream-episode-table .stream-col-actions{width:154px!important;min-width:154px!important}
.stream-episode-table .stream-col-audience{white-space:nowrap;font-size:10px}

/* Keep the selected-series chip from stretching the episode header. */
.panel-head [data-clear-series-filter]{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}
.panel-head [data-clear-series-filter] svg{width:14px;height:14px;flex:0 0 14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.panel-head [data-clear-series-filter] span{max-width:24ch;overflow:hidden;text-overflow:ellipsis}

/* Keep the selected-series chip from stretching the episode header. */
.panel-head [data-clear-series-filter]{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}
.panel-head [data-clear-series-filter] svg{width:14px;height:14px;flex:0 0 14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.panel-head [data-clear-series-filter] span{max-width:24ch;overflow:hidden;text-overflow:ellipsis}


/* Keep the selected-series chip from stretching the episode header. */
.panel-head [data-clear-series-filter]{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}
.panel-head [data-clear-series-filter] svg{width:14px;height:14px;flex:0 0 14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.panel-head [data-clear-series-filter] span{max-width:24ch;overflow:hidden;text-overflow:ellipsis}


.drawer-backdrop.episode-editor-drawer{justify-content:center;align-items:center;padding:20px}.episode-editor-drawer .drawer{width:min(1100px,100%);height:min(940px,calc(100vh - 40px));border:1px solid var(--line);border-radius:8px}.episode-editor-form.episode-single-shell{max-width:none;margin:0}.episode-editor-form .line-form-tabs{display:grid;grid-template-columns:repeat(4,1fr);margin-bottom:24px}.episode-editor-form .episode-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}.episode-editor-form .episode-edit-grid>.wide{grid-column:1/-1}.episode-editor-form .episode-edit-grid>label{grid-template-columns:150px minmax(0,1fr)}.episode-editor-form .episode-edit-grid>label.wide,.episode-editor-form .episode-edit-grid .episode-season-picker>label{grid-template-columns:220px minmax(0,1fr)}.episode-editor-form textarea{min-height:110px}.episode-editor-form .episode-switch{position:relative;display:flex!important;justify-content:space-between;align-items:center;gap:16px}.episode-switch input{position:absolute;width:1px!important;height:1px;opacity:0}.episode-switch>span{display:block;width:54px;height:28px;border-radius:18px;background:#697580;position:relative;flex-shrink:0}.episode-switch>span:before{content:'';position:absolute;left:3px;top:3px;width:22px;height:22px;background:white;border-radius:50%;transition:transform .12s}.episode-switch input:checked+span{background:var(--accent)}.episode-switch input:checked+span:before{transform:translateX(26px)}.episode-switch input:focus-visible+span{outline:2px solid var(--accent);outline-offset:3px}.episode-edit-navigation{display:flex;justify-content:space-between;margin-top:20px}.episode-edit-navigation [data-episode-edit-next]{margin-left:auto}.episode-editor-form [hidden]{display:none!important}@media(max-width:700px){.drawer-backdrop.episode-editor-drawer{padding:0}.episode-editor-drawer .drawer{height:100%;border-radius:0}.episode-editor-form .episode-edit-grid{grid-template-columns:1fr}.episode-editor-form .episode-edit-grid>label,.episode-editor-form .episode-edit-grid>label.wide,.episode-editor-form .episode-season-picker>label{grid-template-columns:1fr!important;gap:8px}.episode-editor-form label>input,.episode-editor-form label>textarea,.episode-editor-form label>select,.episode-editor-form .input-with-button{grid-column:1!important}.episode-editor-form .line-form-tabs{font-size:11px}}

.episode-single-shell{max-width:760px;margin:16px auto}
.episode-single-shell .episode-form-heading{padding:16px}.episode-single-shell .add-stream-tab-body{padding:20px}
.episode-single-shell .episode-season-picker{display:grid;grid-template-columns:minmax(0,1fr) 34px;gap:8px;align-items:start}
.episode-single-shell .episode-season-picker>button{height:34px;padding:7px;margin-top:0}
.episode-single-shell .episode-season-picker>button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2}
.episode-single-shell .episode-season-picker>[data-episode-tmdb-status],.episode-single-shell .episode-tmdb-resolution{grid-column:1/-1}
.episode-single-shell .add-stream-grid{grid-template-columns:1fr 1fr}.episode-single-shell .add-stream-grid>.wide{grid-column:1/-1}
.episode-single-shell .episode-series-choice{display:grid;gap:12px}.episode-single-shell [hidden]{display:none!important}
.episode-single-shell .add-stream-grid{align-items:start}.episode-single-shell .add-stream-grid label{grid-template-columns:180px minmax(0,1fr);gap:12px}.episode-single-shell .add-stream-grid>label:not(.wide){grid-template-columns:120px minmax(0,1fr)}.episode-single-shell .add-stream-grid label>.field-explanation{margin-top:0}.episode-single-shell label.wide{display:grid;gap:12px}.episode-single-shell input,.episode-single-shell textarea,.episode-single-shell select{width:100%}
.episode-single-shell textarea[name="notes"]{min-height:90px}
@media(max-width:700px){.episode-single-shell .add-stream-grid{grid-template-columns:1fr}.episode-single-shell{margin:8px 0}.episode-single-shell .episode-form-heading{flex-wrap:wrap}}

.interactive-browser-controls{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.interactive-browser-address{display:flex;gap:8px;margin:12px 0}.interactive-browser-address input{flex:1;min-width:0}.interactive-browser-frame{display:block;width:100%;height:75vh;min-height:540px;border:1px solid var(--border,#334155);border-radius:8px;background:#0b1018}.interactive-browser-idle{padding:70px 20px;text-align:center;color:#94a3b8;border:1px solid #334155;border-radius:8px}.interactive-browser-panel [data-browser-message]{overflow-wrap:anywhere}
.channel-separator-badge,
.status.separator {
  display: inline-block;
  color: #9fdde3;
  background: #17454d;
  border-radius: 6px;
  padding: 3px 8px;
}


/* IP columns reserve their flag slot before GeoIP decoration loads. */
.line-table-wrap {
  max-width: 100%;
  overflow-x: auto !important;
}
.line-table-wrap table.line-management-table {
  width: 100%;
  min-width: 1380px !important;
  table-layout: auto !important;
}
.line-table-wrap .entity-relation {
  width: auto;
  max-width: 24ch;
  white-space: normal;
  overflow-wrap: anywhere;
}
.line-table-wrap table [data-line-field="username"] { min-width: 120px; }
.line-table-wrap table [data-line-field="password"] { min-width: 160px; }
.line-table-wrap .line-password {
  max-width: 24ch;
  white-space: normal;
  overflow-wrap: anywhere;
}
.line-table-wrap table [data-line-field="ownerName"] { min-width: 120px; }
.line-table-wrap table [data-line-field="packageId"] { min-width: 160px; }
.line-table-wrap table [data-line-field="expiresAt"],
.line-table-wrap table [data-line-field="lastConnectionAt"] { min-width: 145px; }
.line-table-wrap table [data-line-field="lastRechargeAt"] { min-width: 110px; }
.line-table-wrap table [data-line-field="connectionIps"] {
  min-width: 180px;
  width: 180px;
  white-space: nowrap;
}
.line-table-wrap table [data-line-field="connectionIps"] .runtime-duration {
  width: max-content;
  min-width: calc(15ch + 27px);
}
.line-table-wrap table [data-line-field="connectionIps"] strong {
  font-variant-numeric: tabular-nums;
}
.line-table-wrap table [data-line-field="currentStreams"] { min-width: 145px; }
.line-table-wrap table [data-line-field="actions"] {
  min-width: 100px;
  width: 100px;
}
.line-table-wrap table thead th { white-space: normal; line-height: 1.35; }

/* Dashboard: compact server cards with stable space for IP addresses and flags. */
.dashboard-server-cards.server-status-board {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 14px;
  align-items: start;
  padding: 14px;
}
.dashboard-server-cards .server-status-row { min-width: 0; border-radius: 12px; }
.dashboard-server-cards .server-status-row > summary {
  grid-template-columns: minmax(0, 1fr) auto 12px;
  gap: 18px 10px;
  padding: 18px;
}
.dashboard-server-cards .server-status-name { gap: 8px; min-width: 0; }
.dashboard-server-cards .server-status-name > strong {
  font-size: 16px; white-space: normal; overflow-wrap: anywhere;
}
.dashboard-server-cards .server-status-name > span {
  display: flex; align-items: center; min-height: 22px; font-size: 12px;
  overflow: visible; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dashboard-server-cards .server-status-name .wsp-ip { flex: 0 0 auto; }
.dashboard-server-cards .server-status-row > summary > .status {
  grid-column: 2; grid-row: 1; min-width: 68px; text-align: center;
}
.dashboard-server-cards .server-status-row > summary::after { grid-column: 3; grid-row: 1; }
.dashboard-server-cards .server-status-summary {
  grid-column: 1 / -1; grid-row: 2;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 76px;
  gap: 16px 12px; padding-top: 16px;
  border-top: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.dashboard-server-cards .server-status-summary > :last-child { grid-column: 3; grid-row: 1 / 3; }
.dashboard-server-cards .server-value-pill small { font-size: 10px; }
.dashboard-server-cards .server-value-pill b { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
.dashboard-server-cards .server-status-detail {
  grid-template-columns: minmax(0, 1fr); padding: 0 18px 18px; gap: 16px;
}
.dashboard-server-cards .server-status-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-server-cards .server-status-rings { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-items: center; }
.dashboard-server-cards .server-internal-address { margin: 0; color: var(--muted); font-size: 12px; }
@media (min-width: 1700px) {
  .dashboard-server-cards.server-status-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .dashboard-server-cards.server-status-board { padding: 8px; }
  .dashboard-server-cards .server-status-row > summary { padding: 12px; gap: 14px 8px; }
  .dashboard-server-cards .server-status-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px; gap: 12px 8px; }
  .dashboard-server-cards .server-value-pill b { font-size: 13px; }
}

/* Stable space for session controls, including the video Fingerprint. */
.live-connections-table td:last-child .actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; min-width:0; }
.live-connections-table td:last-child .actions button { min-width:0; white-space:normal; }
.live-connections-table td:last-child [data-disconnect-connection] { grid-column:1 / -1; }
