:root {
  color-scheme: light;
  --shell-bg: #edf3f8;
  --shell-ink: #102033;
  --shell-muted: #536779;
  --shell-soft: #71869a;
  --panel-bg: rgba(255, 255, 255, 0.96);
  --panel-bg-strong: rgba(248, 251, 255, 0.98);
  --panel-border: rgba(148, 163, 184, 0.28);
  --panel-border-strong: rgba(192, 204, 216, 0.72);
  --panel-shadow: 0 26px 80px rgba(15, 23, 42, 0.09);
  --sidebar-bg: linear-gradient(180deg, #09111d 0%, #10273b 52%, #09121d 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --accent: #0f766e;
  --accent-strong: #0b5d58;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --signal: #ea580c;
  --signal-soft: rgba(234, 88, 12, 0.12);
  --success-soft: rgba(22, 163, 74, 0.12);
  --info-soft: rgba(37, 99, 235, 0.12);
  --danger-soft: rgba(225, 29, 72, 0.12);
  --line-soft: rgba(203, 213, 225, 0.9);
}

.dark {
  color-scheme: dark;
  --shell-bg: #020817;
  --shell-ink: #eff6ff;
  --shell-muted: #bfd0e2;
  --shell-soft: #8ea4b7;
  --panel-bg: rgba(8, 15, 29, 0.92);
  --panel-bg-strong: rgba(13, 22, 38, 0.96);
  --panel-border: rgba(62, 79, 101, 0.96);
  --panel-border-strong: rgba(92, 110, 132, 0.82);
  --panel-shadow: 0 30px 90px rgba(2, 8, 23, 0.46);
  --sidebar-bg: linear-gradient(180deg, #050b15 0%, #0c1a2d 58%, #070d18 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --accent-soft: rgba(45, 212, 191, 0.16);
  --signal-soft: rgba(251, 146, 60, 0.18);
  --success-soft: rgba(74, 222, 128, 0.15);
  --info-soft: rgba(96, 165, 250, 0.18);
  --danger-soft: rgba(251, 113, 133, 0.15);
  --line-soft: rgba(34, 47, 66, 0.98);
}

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--shell-ink);
  background: var(--shell-bg);
}

[x-cloak] {
  display: none !important;
}

.shell-background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 24%),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(237, 243, 248, 0.96));
  pointer-events: none;
}

.dark .shell-background {
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.14), transparent 22%),
    radial-gradient(circle at top right, rgba(251, 146, 60, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(2, 8, 23, 0.98), rgba(5, 12, 24, 0.95));
}

.login-shell {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.28), transparent 30%),
    radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.2), transparent 24%),
    linear-gradient(160deg, #ecfeff 0%, #f8fafc 42%, #fff7ed 100%);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}

.login-panel,
.panel {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, var(--panel-bg) 0%, var(--panel-bg-strong) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 1.5rem;
  box-shadow: var(--panel-shadow);
}

.sidebar-panel {
  background: var(--sidebar-bg);
  border-right-color: var(--sidebar-border);
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--shell-ink);
}

.form-input {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.98);
  padding: 0.8rem 0.95rem;
  color: var(--shell-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.dark .form-input {
  border-color: var(--panel-border-strong);
  background: rgba(11, 19, 34, 0.95);
  color: var(--shell-ink);
}

.form-input::placeholder {
  color: var(--shell-soft);
}

.form-help {
  margin-top: 0.4rem;
  display: block;
  font-size: 0.77rem;
  color: var(--shell-muted);
}

.form-error {
  margin-top: 0.4rem;
  display: block;
  font-size: 0.8rem;
  color: #be123c;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  transition: all 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: white;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.24);
}

.secondary-button {
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--shell-ink);
}

.dark .secondary-button {
  border-color: var(--panel-border-strong);
  background: rgba(10, 17, 30, 0.98);
  color: var(--shell-ink);
}

.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: white;
}

.nav-link {
  display: flex;
  align-items: center;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  color: #d9e5f0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link-active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  transform: translateX(2px);
}

.mobile-nav {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-top: 0.85rem;
  scrollbar-width: none;
}

.mobile-nav::-webkit-scrollbar {
  display: none;
}

.mobile-nav-link {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.78);
  color: var(--shell-muted);
  padding: 0.62rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.dark .mobile-nav-link {
  background: rgba(10, 17, 30, 0.96);
  color: var(--shell-soft);
}

.mobile-nav-link-active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(20, 184, 166, 0.16));
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.36);
}

.summary-card {
  border-radius: 1.5rem;
  border: 1px solid var(--panel-border);
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.96));
  padding: 1.35rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
}

.dark .summary-card {
  border-color: var(--panel-border);
  background:
    radial-gradient(circle at top right, rgba(45, 212, 191, 0.09), transparent 32%),
    linear-gradient(180deg, rgba(10, 18, 31, 0.98), rgba(13, 22, 38, 0.98));
}

.summary-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.summary-value {
  margin-top: 0.65rem;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--shell-ink);
}

.summary-note {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--shell-muted);
}

.action-tile {
  display: block;
  border-radius: 1.5rem;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.95));
  padding: 1.25rem;
}

.dark .action-tile {
  border-color: var(--panel-border);
  background: linear-gradient(180deg, rgba(9, 17, 31, 0.98), rgba(12, 20, 35, 0.95));
}

.action-tile h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--shell-ink);
}

.action-tile p {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--shell-muted);
}

.table-head {
  background: rgba(148, 163, 184, 0.06);
}

.table-head th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.table-row td {
  border-top: 1px solid var(--line-soft);
  padding: 1rem 1.25rem;
  vertical-align: top;
  font-size: 0.92rem;
  color: var(--shell-ink);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-online {
  background: var(--success-soft);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.24);
}

.status-ready {
  background: var(--info-soft);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.24);
}

.status-offline {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.2);
}

.status-disabled {
  background: var(--danger-soft);
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.22);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(241, 245, 249, 0.92);
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--shell-ink);
}

.dark .pill {
  border-color: rgba(71, 85, 105, 0.82);
  background: rgba(15, 23, 42, 0.92);
}

.copy-link {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.08);
  padding: 0.38rem 0.72rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.copy-link:hover {
  background: rgba(15, 118, 110, 0.14);
}

.dark .copy-link {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.2);
  color: #8af0e3;
}

.detail-card {
  border-radius: 1.25rem;
  border: 1px solid var(--panel-border);
  background: rgba(248, 251, 255, 0.98);
  padding: 1rem;
}

.dark .detail-card {
  border-color: var(--panel-border);
  background: rgba(11, 19, 34, 0.96);
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(8px);
}

.modal-panel {
  width: min(100%, 980px);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  border-radius: 1.75rem;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98));
  padding: 1.5rem;
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.3);
  color: var(--shell-ink);
}

.dark .modal-panel {
  border-color: var(--panel-border);
  background: linear-gradient(180deg, rgba(3, 10, 21, 0.99), rgba(8, 15, 29, 0.99));
}

.page-banner {
  position: relative;
  overflow: hidden;
}

.page-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 32%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 45%);
  pointer-events: none;
}

.streams-page {
  display: flex;
  flex-direction: column;
}

.viewport-fill {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 60vh;
}

.viewport-fill > .table-shell {
  display: flex;
  min-height: 100%;
  flex: 1 1 auto;
  flex-direction: column;
}

.viewport-fill > .table-shell > .overflow-x-auto,
.viewport-fill > .table-shell > .grid {
  flex: 1 1 auto;
}

.viewport-fill > .table-shell > .px-6.pb-6 {
  margin-top: auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-card {
  border-radius: 1.15rem;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.74);
  padding: 0.9rem 1rem;
}

.dark .metric-card {
  background: rgba(11, 19, 34, 0.84);
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.metric-value {
  margin-top: 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--shell-ink);
}

.responsive-url {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  color: var(--shell-muted);
}

.stream-card {
  border-radius: 1.35rem;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  padding: 1rem;
  box-shadow: var(--panel-shadow);
}

.dark .stream-card {
  background: linear-gradient(180deg, rgba(10, 17, 30, 0.98), rgba(13, 22, 38, 0.98));
}

.stream-card-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.stream-card-grid-tight {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stream-meta {
  border-radius: 1rem;
  border: 1px solid var(--panel-border);
  background: rgba(241, 245, 249, 0.78);
  padding: 0.85rem;
}

.dark .stream-meta {
  background: rgba(15, 23, 42, 0.78);
}

.meta-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.meta-value {
  margin-top: 0.35rem;
  color: var(--shell-ink);
  font-size: 0.92rem;
  word-break: break-word;
}

.table-shell {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.table-shell .overflow-x-auto {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
}

.action-cell {
  position: relative;
}

.action-menu {
  position: relative;
  display: inline-flex;
}

.action-menu-open {
  z-index: 120;
}

.action-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.96);
  padding: 0.65rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--shell-ink);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.dark .action-trigger {
  background: rgba(10, 17, 30, 0.98);
}

.action-trigger:hover {
  transform: translateY(-1px);
}

.action-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.7rem);
  z-index: 130;
  width: min(24rem, calc(100vw - 2rem));
  border-radius: 1.25rem;
  border: 1px solid var(--panel-border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 255, 0.98));
  padding: 0.95rem;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.18);
}

.dark .action-dropdown {
  background: linear-gradient(180deg, rgba(6, 12, 24, 0.99), rgba(11, 19, 34, 0.98));
}

.action-dropdown-section + .action-dropdown-section {
  margin-top: 0.85rem;
}

.action-dropdown-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.action-dropdown-body {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.action-dropdown-stack {
  display: grid;
  gap: 0.55rem;
}

.action-dropdown-divider {
  margin: 0.95rem 0;
  border-top: 1px solid var(--line-soft);
}

.action-dropdown-links {
  display: grid;
  gap: 0.45rem;
}

.action-dropdown-links form,
.action-dropdown-links button,
.action-dropdown-links a {
  width: 100%;
}

.dropdown-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 0.95rem;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  padding: 0.75rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--shell-ink);
}

.dark .dropdown-link {
  background: rgba(30, 41, 59, 0.52);
}

.dropdown-link:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dropdown-link-danger {
  color: #be123c;
}

.dropdown-link-danger:hover {
  background: var(--danger-soft);
  color: #9f1239;
}

.surface-muted {
  color: var(--shell-muted);
}

.surface-soft {
  color: var(--shell-soft);
}

@media (max-width: 767px) {
  .panel,
  .login-panel,
  .summary-card {
    border-radius: 1.25rem;
  }
}

@media (min-width: 640px) {
  .stream-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .stream-card-grid-tight {
    grid-template-columns: 1fr;
  }

  .action-dropdown {
    width: min(22rem, calc(100vw - 3rem));
  }
}
