:root {
  --bg: #070713;
  --panel: rgba(255,255,255,.075);
  --panel-strong: rgba(255,255,255,.12);
  --line: rgba(255,255,255,.14);
  --text: #f7f7ff;
  --muted: #a9a9c6;
  --muted2: #747492;
  --accent: #8b5cf6;
  --accent2: #06b6d4;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --shadow: 0 24px 70px rgba(0,0,0,.42);
}

* { box-sizing: border-box; min-width: 0; }
html, body {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(139,92,246,.22), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(6,182,212,.18), transparent 26%),
    linear-gradient(135deg, #04040b 0%, #0b0b1e 55%, #050510 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
img, video, iframe, svg { max-width: 100%; }
code {
  display: inline-block;
  color: #c4b5fd;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.orb {
  position: fixed;
  width: 420px;
  height: 420px;
  pointer-events: none;
  filter: blur(28px);
  opacity: .45;
  border-radius: 50%;
  z-index: 0;
}
.orb-one { background: #7c3aed; left: -180px; top: 90px; }
.orb-two { background: #0891b2; right: -190px; bottom: -120px; }

.glass {
  background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.045));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
.app-shell.wide {
  display: block;
}

.sidebar {
  border-radius: 28px;
  padding: 22px;
  min-height: calc(100vh - 44px);
  position: sticky;
  top: 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 10px 30px rgba(124,58,237,.4);
}
.brand-mark.big {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  font-size: 22px;
}
.brand strong { display: block; font-size: 18px; letter-spacing: -1px; }
.brand em { display: block; color: var(--muted); font-style: normal; font-size: 12px; }

.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 16px;
  transition: .18s ease;
}
.nav-link-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(59,130,246,.16);
  border: 1px solid rgba(147,197,253,.22);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  background: rgba(255,255,255,.11);
  transform: translateX(2px);
}
.sidebar nav a.active .nav-badge {
  color: #fff;
  background: rgba(34,211,238,.20);
  border-color: rgba(125,211,252,.36);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.sidebar-footer strong { display: block; color: #fff; }
.sidebar-footer span { display: block; margin: 2px 0 12px; }
.sidebar-footer a { color: #c4b5fd; }

.mobile-topbar {
  display: none;
}

.main {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.hero {
  border-radius: 32px;
  padding: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow {
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 12px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: .92;
  letter-spacing: -3px;
  margin-bottom: 14px;
}
h2 { letter-spacing: -1px; margin-bottom: 8px; }
p { color: var(--muted); line-height: 1.5; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 14px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  transition: .16s ease;
  max-width: 100%;
  text-align: center;
  white-space: normal;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.btn.danger {
  background: rgba(251,113,133,.16);
  color: #fecdd3;
  border-color: rgba(251,113,133,.35);
}
.btn.small { min-height: 34px; padding: 7px 11px; border-radius: 12px; font-size: 13px; }
.btn.full { width: 100%; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  border-radius: 24px;
  padding: 20px;
}
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 38px; letter-spacing: -2px; margin-top: 8px; }

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 18px;
}
.panel {
  border-radius: 28px;
  padding: 22px;
  margin-bottom: 20px;
  min-width: 0;
  max-width: 100%;
}
.panel-head,
.page-head,
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin-bottom: 0; }
.card-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.stack { display: grid; gap: 10px; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.045);
  border-radius: 18px;
  min-width: 0;
}
.list-row:hover { background: rgba(255,255,255,.08); }
.list-row > div { min-width: 0; }
.list-row strong { display: block; }
.list-row span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.list-row strong,
.list-row span { overflow-wrap: anywhere; }
.list-row em { color: var(--muted2); font-style: normal; font-size: 13px; text-align: right; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 12px currentColor;
}
.dot.online { background: var(--good); color: var(--good); }
.dot.stale { background: var(--warn); color: var(--warn); }
.dot.offline { background: var(--bad); color: var(--bad); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #ddd6fe;
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
  font-weight: 800;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.data-table th {
  color: var(--muted2);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: middle;
}
.data-table td span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.data-table tr:hover td { background: rgba(255,255,255,.035); }
.table-link,
.table-sub-link,
.data-table td strong,
.data-table td span {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
label.full,
.form-actions.full,
.form-divider.full,
.preview-duo.full,
.device-meta.full { grid-column: 1 / -1; }
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
input, select, textarea {
  width: 100%;
  color: #fff;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(139,92,246,.72);
  box-shadow: 0 0 0 4px rgba(139,92,246,.16);
}
select option { background: #111122; color: #fff; }
textarea { min-height: 120px; resize: vertical; }
pre { max-width: 100%; overflow-x: auto; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.input-action-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.input-action-row select,
.input-action-row input {
  flex: 1 1 auto;
  min-width: 0;
}
.btn.icon-btn {
  width: 44px;
  min-width: 44px;
  padding: 0;
}
.btn.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
}
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.upload-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.upload-file-name {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text);
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-divider {
  padding-top: 10px;
  color: #c4b5fd;
  border-top: 1px solid var(--line);
  font-weight: 900;
}

.cards-grid,
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
}
.card,
.media-card {
  border-radius: 26px;
  padding: 20px;
}
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.media-card {
  display: grid;
  gap: 10px;
}
.media-card img,
.media-card video {
  width: 100%;
  height: 160px;
  border-radius: 18px;
  object-fit: contain;
  background: rgba(0,0,0,.32);
  display: block;
}
.media-icon {
  width: 100%;
  height: 160px;
  border-radius: 18px;
  background: rgba(0,0,0,.25);
  display: grid;
  place-items: center;
  color: #c4b5fd;
  font-weight: 900;
}
.media-card span { color: var(--muted); font-size: 12px; }
.media-usage {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(0,0,0,.16);
}
.media-usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.media-usage-head > span:last-child {
  text-align: right;
}
.media-usage-list {
  display: grid;
  gap: 6px;
}
.media-usage-link {
  display: block;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}
.media-usage-link:hover {
  background: rgba(255,255,255,.08);
}
.media-usage-link strong,
.media-usage-link span {
  display: block;
}

.toast {
  /*
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  */
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.toast.success { color: #bbf7d0; border-color: rgba(52,211,153,.32); background: rgba(52,211,153,.12); }
.toast.danger { color: #fecdd3; border-color: rgba(251,113,133,.32); background: rgba(251,113,133,.12); }
.toast.warn { color: #fde68a; border-color: rgba(251,191,36,.32); background: rgba(251,191,36,.12); }

.login-wrap,
.install-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.login-card,
.install-card {
  width: min(460px, 100%);
  border-radius: 34px;
  padding: 34px;
}
.login-card button[type="submit"] {
  margin-top: 12px;
}
.login-brand {
  text-align: center;
  margin-bottom: 26px;
}
.login-brand .brand-mark {
  margin: 0 auto 14px;
}
.login-brand h1 {
  font-size: 44px;
  margin-bottom: 8px;
}

.device-meta {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0,0,0,.16);
}
.device-meta span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
.device-meta a {
  color: #e9d5ff;
  text-decoration: none;
}
.device-meta a:hover {
  color: #fff;
  text-decoration: underline;
}
.playback-source-meta strong {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.two,
  .cards-grid,
  .media-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head,
  .panel-head,
  .card-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .preview-duo { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .orb {
    display: none;
  }
  .app-shell {
    display: block;
    padding: 10px;
  }
  .mobile-topbar {
    position: sticky;
    top: 10px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 20px;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .mobile-brand .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    flex: 0 0 auto;
  }
  .mobile-brand strong,
  .mobile-brand em {
    display: block;
  }
  .mobile-brand strong {
    font-size: 16px;
    letter-spacing: -0.5px;
  }
  .mobile-brand em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
  }
  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 46px;
    height: 42px;
    flex: 0 0 auto;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    cursor: pointer;
  }
  .mobile-menu-button span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
  }
  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 84px;
    z-index: 49;
    display: none !important;
    min-height: 0;
    max-height: calc(100vh - 100px);
    margin: 0;
    overflow: auto;
  }
  .sidebar .brand {
    display: none;
  }
  .sidebar nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .sidebar nav a {
    padding: 11px 12px;
    text-align: center;
  }
  .sidebar nav a:hover,
  .sidebar nav a.active {
    transform: none;
  }
  .sidebar-footer {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  body.mobile-nav-open .sidebar {
    display: flex !important;
  }
  body.mobile-nav-open .mobile-menu-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.mobile-nav-open .mobile-menu-button span:nth-child(2) {
    opacity: 0;
  }
  body.mobile-nav-open .mobile-menu-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .hero, .panel, .card, .media-card { border-radius: 22px; padding: 18px; }
  .panel:has(> .data-table) {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .page-head > .btn {
    align-self: flex-start;
    width: auto;
  }
  .sidebar { border-radius: 22px; padding: 18px; }
  .brand { margin-bottom: 18px; }
  h1 { font-size: 34px; letter-spacing: -1px; line-height: 1; }
  h2 { overflow-wrap: anywhere; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat strong { font-size: 34px; }
  .hero-actions .btn,
  .form-actions .btn { flex: 1 1 100%; }
  .input-action-row,
  .secret-input-row,
  .upload-picker-row,
  .preview-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .input-action-row .btn,
  .secret-input-row .btn,
  .upload-picker-row .btn {
    width: 100%;
  }
  .btn.icon-btn {
    width: 100%;
    min-width: 0;
  }
  .list-row {
    align-items: flex-start;
    display: grid;
    gap: 10px;
  }
  .list-row em {
    text-align: left;
  }
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
  }
  .data-table thead {
    display: none;
  }
  .data-table tr {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  }
  .data-table tr:hover td {
    background: transparent;
  }
  .data-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: start;
    gap: 8px 10px;
    padding: 8px 4px;
    border: 0;
    overflow-wrap: anywhere;
  }
  .data-table td::before {
    content: attr(data-label);
    grid-column: 1;
    color: var(--muted2);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .data-table td[data-label=""] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
  }
  .data-table td[data-label=""]::before {
    display: none;
  }
  .data-table td[data-label=""] .btn {
    flex: 1 1 auto;
  }
  .data-table td span {
    overflow-wrap: anywhere;
  }
  .data-table td > * {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
  }
  .data-table td strong .dot {
    position: static;
    transform: none;
    margin-right: 8px;
  }
  .dot[data-tooltip]::after {
    left: 0;
    min-width: 220px;
    max-width: min(300px, calc(100vw - 48px));
    transform: translateY(4px);
  }
  .media-usage-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .media-usage-head > span:last-child {
    text-align: left;
  }
}

.danger-zone {
  border-color: rgba(251,113,133,.28);
  background: linear-gradient(145deg, rgba(251,113,133,.10), rgba(255,255,255,.04));
}
.danger-zone h2 {
  color: #fecdd3;
}


/* v5 usability polish */
.pill.compact {
  display: inline-flex;
  min-width: auto;
  width: auto;
  justify-content: center;
  align-items: center;
  padding: 4px 9px;
  line-height: 1;
  white-space: nowrap;
}
.pill.status-active,
.pill.active {
  color: #bbf7d0;
  background: rgba(52,211,153,.14);
  border-color: rgba(52,211,153,.32);
}
.pill.status-pending,
.pill.status-orphan {
  color: #fde68a;
  background: rgba(251,191,36,.14);
  border-color: rgba(251,191,36,.34);
}
.pill.status-paused {
  color: #fecdd3;
  background: rgba(251,113,133,.14);
  border-color: rgba(251,113,133,.32);
}
.muted-note,
.form-hint {
  color: var(--muted2);
  font-size: 12px;
  line-height: 1.4;
}
.color-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 9px 12px;
}
.color-control input[type="color"] {
  padding: 0;
  width: 46px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.color-control span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
input[type="range"] {
  accent-color: var(--accent);
  padding: 8px 0;
  background: transparent;
  border: 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: start;
  background: rgba(0,0,0,.14);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 12px 14px;
}
.toggle-row.compact-toggle {
  min-height: 0;
}
.playlist-default-toggle {
  align-items: center;
  min-height: 74px;
}
.playlist-default-toggle > span:first-child {
  min-width: 0;
}
.playlist-default-toggle strong {
  display: block;
  color: #fff;
}
.playlist-default-toggle em {
  display: block;
  margin-top: 4px;
  color: var(--muted2);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.4;
}
.playlist-default-readonly strong {
  display: block;
  margin-bottom: 8px;
}
.ios-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}
.ios-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ios-toggle span {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.20);
  transition: .2s;
  border-radius: 999px;
}
.ios-toggle span:before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 2px;
  top: 2px;
  background: #fff;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.ios-toggle input:checked + span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.ios-toggle input:checked + span:before {
  transform: translateX(22px);
}
.mention-wrap {
  position: relative;
}
.mention-menu {
  display: none;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  background: rgba(10,10,24,.96);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  padding: 8px;
}
.mention-menu button {
  display: block;
  width: 100%;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
.mention-menu button:hover {
  background: rgba(255,255,255,.10);
}
.preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slide-preview-wrap {
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(0,0,0,.25);
}
.preview-label {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.slide-preview-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}
.slides-sort-list {
  display: grid;
  gap: 10px;
}
.slide-sort-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
  border-radius: 18px;
  padding: 12px;
}
.slide-sort-row.dragging {
  opacity: .45;
  border-color: rgba(139,92,246,.7);
}
.drag-handle {
  cursor: grab;
  color: var(--muted2);
  font-weight: 900;
  text-align: center;
  user-select: none;
}
.slide-sort-main strong {
  display: block;
}
.slide-sort-main span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.media-card .btn {
  margin-top: 4px;
}
.data-table .pill {
  vertical-align: middle;
}

.html-editor-shell {
  position: relative;
  min-height: 360px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: rgba(0,0,0,.32);
  overflow: hidden;
}
.html-editor-shell:focus-within {
  border-color: rgba(139,92,246,.72);
  box-shadow: 0 0 0 4px rgba(139,92,246,.16);
}
.html-highlight,
.html-code-input {
  margin: 0;
  min-height: 360px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.html-highlight {
  position: absolute;
  inset: 0;
  overflow: auto;
  color: #e5e7eb;
  pointer-events: none;
}
.html-code-input {
  position: relative;
  z-index: 2;
  color: transparent;
  caret-color: #ffffff;
  background: transparent;
  resize: vertical;
}
.html-code-input:focus {
  box-shadow: none;
  border-color: transparent;
}
.html-code-input::selection {
  background: rgba(139,92,246,.42);
}
.tok-tag { color: #93c5fd; }
.tok-attr { color: #c4b5fd; }
.tok-string { color: #86efac; }
.tok-comment { color: #64748b; }
.tok-entity { color: #fbbf24; }
.tok-punct { color: #94a3b8; }

.preview-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.preview-refresh {
  float: right;
  color: #c4b5fd;
  font-weight: 800;
}
.slide-preview-empty {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.command-panel {
  margin-top: 18px;
}
.remote-command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  margin: 16px 0 20px;
}
.remote-command-form .full {
  grid-column: 1 / -1;
}
.remote-command-form textarea {
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.command-history {
  display: grid;
  gap: 10px;
}
.command-history pre {
  max-height: 280px;
  overflow: auto;
  background: rgba(0,0,0,.34);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: #e5e7eb;
  white-space: pre-wrap;
}
.command-history details summary {
  cursor: pointer;
  color: #c4b5fd;
  font-weight: 800;
}
@media (max-width: 980px) {
  .remote-command-form {
    grid-template-columns: 1fr;
  }
}
.command-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 10px;
}
.command-history-head h3 {
  margin: 0 0 4px;
}
@media (max-width: 760px) {
  .command-history-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.data-table td strong {
  position: relative;
  display: inline-block;
}

.data-table td strong .dot {
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.dot[data-tooltip] {
  cursor: help;
}

.dot[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-18px) translateY(4px);
  min-width: 260px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 8, 20, .96);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 18px 45px rgba(0,0,0,.45);
  color: #f7f7ff;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity .08s ease, transform .08s ease;
  z-index: 1000;
}

.dot[data-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: rgba(8, 8, 20, .96);
  opacity: 0;
  pointer-events: none;
  transition: opacity .08s ease;
  z-index: 1001;
}

.dot[data-tooltip]:hover::after,
.dot[data-tooltip]:focus::after {
  opacity: 1;
  transform: translateX(-18px) translateY(0);
}

.dot[data-tooltip]:hover::before,
.dot[data-tooltip]:focus::before {
  opacity: 1;
}

.list-row,
.stack,
.panel {
  overflow: visible;
}

.list-row strong.device-dot-label {
  position: relative;
  display: inline-block;
  padding-left: 21px;
}

.list-row strong.device-dot-label .dot {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.clickable-row {
  cursor: pointer;
}
.clickable-row:focus td {
  background: rgba(139,92,246,.10);
  outline: none;
}
.clickable-row:focus-visible td:first-child {
  box-shadow: inset 4px 0 0 rgba(139,92,246,.85);
}
.device-status-panel {
  margin-bottom: 16px;
}
.device-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.device-status-grid .device-meta {
  min-width: 0;
}
.device-status-grid .device-meta strong {
  display: flex;
  align-items: center;
  gap: 8px;
}
.device-meta code a {
  color: #e9d5ff;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.device-meta code a:hover {
  color: #fff;
  text-decoration: underline;
}
@media (max-width: 980px) {
  .device-status-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}
@media (max-width: 620px) {
  .device-status-grid {
    grid-template-columns: 1fr;
  }
}

.js-local-time {
  white-space: nowrap;
}

.secret-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.secret-input-row input {
  flex: 1 1 auto;
  min-width: 0;
}
.secret-input-row .btn {
  flex: 0 0 auto;
}

.live-refresh-note {
  display: block;
  margin-top: 10px;
}

.empty-state.compact {
  padding: 14px 16px;
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 16px;
  color: var(--muted2);
  background: rgba(255,255,255,.025);
  font-size: 13px;
}

.device-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.device-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  color: #fff;
}
.device-choice input {
  width: auto;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.device-choice span {
  min-width: 0;
}
.device-choice strong,
.device-choice em,
.sync-device-list span {
  display: block;
  overflow-wrap: anywhere;
}
.device-choice em {
  margin-top: 3px;
  color: var(--muted2);
  font-size: 12px;
  font-style: normal;
}
.sync-device-list {
  display: grid;
  gap: 3px;
}

@media (max-width: 640px) {
  .preview-duo {
    grid-template-columns: 1fr;
  }
  .device-choice-list {
    grid-template-columns: 1fr;
  }
  .data-table td strong .dot,
  .list-row strong.device-dot-label .dot {
    position: static;
    transform: none;
    margin-right: 8px;
  }
  .list-row strong.device-dot-label {
    padding-left: 0;
  }
  .dot[data-tooltip]:hover::after,
  .dot[data-tooltip]:focus::after {
    transform: translateY(0);
  }
  .js-local-time {
    white-space: normal;
  }
  .command-history pre {
    max-width: 100%;
  }
}
