:root {
  color-scheme: dark;
  --ink: #f5f8fb;
  --muted: #93a4b6;
  --muted-strong: #bac6d3;
  --bg: #06101c;
  --bg-deep: #040b13;
  --panel: #0c1a2a;
  --panel-raised: #112338;
  --panel-soft: #0a1624;
  --line: #203247;
  --line-strong: #30465f;
  --brand: #33d4c4;
  --brand-strong: #5ee6d9;
  --brand-ink: #041614;
  --accent: #8da2ff;
  --warning: #f5b84b;
  --danger: #ff6f79;
  --success: #59d58d;
  --info: #62b5ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar: 250px;
  --header: 74px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg-deep);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -8%, rgba(51, 212, 196, 0.12), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(141, 162, 255, 0.1), transparent 26rem),
    var(--bg);
}

body.is-locked {
  overflow: hidden;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: var(--brand-strong);
}

img,
video {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--brand-strong);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 8px 16px rgba(51, 212, 196, 0.16));
}

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-size: 1.08rem;
  letter-spacing: 0.08em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.subtle,
.section-copy {
  color: var(--muted);
  line-height: 1.6;
}

.icon {
  width: 21px;
  height: 21px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.btn,
.icon-btn,
.nav-button,
.tab-button,
.category-chip {
  border: 0;
  cursor: pointer;
}

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 17px;
  font-weight: 780;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
  border-color: rgba(255, 111, 121, 0.38);
  background: rgba(255, 111, 121, 0.1);
  color: #ffb2b8;
}

.btn-small {
  min-height: 38px;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.83rem;
}

.btn[disabled],
.icon-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.field-label {
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.search-field {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: #081522;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-field:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(51, 212, 196, 0.12);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 54px;
}

.password-field .icon-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.85rem;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  background: rgba(98, 181, 255, 0.08);
  color: #c8e6ff;
  font-size: 0.84rem;
  line-height: 1.5;
}

.notice.error {
  border-color: rgba(255, 111, 121, 0.3);
  background: rgba(255, 111, 121, 0.09);
  color: #ffd0d4;
}

.notice.success {
  border-color: rgba(89, 213, 141, 0.3);
  background: rgba(89, 213, 141, 0.08);
  color: #c7f6da;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.status-online,
.status-active,
.status-healthy,
.status-connected,
.status-ok,
.status-ready {
  border-color: rgba(89, 213, 141, 0.25);
  color: var(--success);
  background: rgba(89, 213, 141, 0.07);
}

.status-warning,
.status-degraded,
.status-pending {
  border-color: rgba(245, 184, 75, 0.25);
  color: var(--warning);
  background: rgba(245, 184, 75, 0.07);
}

.status-danger,
.status-offline,
.status-blocked,
.status-revoked,
.status-error {
  border-color: rgba(255, 111, 121, 0.25);
  color: var(--danger);
  background: rgba(255, 111, 121, 0.07);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 250px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  background: rgba(255, 255, 255, 0.018);
}

.empty-state .icon-wrap {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  border-radius: 18px;
  background: rgba(51, 212, 196, 0.1);
  color: var(--brand);
}

.empty-state p {
  max-width: 420px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background: #132437;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
  animation: shimmer 1.5s infinite;
  content: "";
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* Authentication */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}

.auth-showcase {
  position: relative;
  display: flex;
  min-height: 720px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--line);
  padding: clamp(28px, 5vw, 72px);
  background:
    linear-gradient(160deg, rgba(51, 212, 196, 0.08), transparent 46%),
    linear-gradient(30deg, #08182a, #06101c 68%);
}

.auth-showcase::before,
.auth-showcase::after {
  position: absolute;
  border: 1px solid rgba(51, 212, 196, 0.18);
  border-radius: 50%;
  content: "";
}

.auth-showcase::before {
  width: 34vw;
  height: 34vw;
  right: -14vw;
  bottom: 4vh;
}

.auth-showcase::after {
  width: 22vw;
  height: 22vw;
  right: -8vw;
  bottom: 10vh;
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: auto 0;
}

.auth-copy h1 {
  max-width: 660px;
  font-size: clamp(2.5rem, 5.6vw, 5.5rem);
  line-height: 0.98;
}

.auth-copy h1 span {
  color: var(--brand);
}

.auth-copy p {
  max-width: 540px;
  margin: 22px 0 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.7;
}

.auth-benefits {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 48px;
}

.auth-benefits span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(4, 11, 19, 0.42);
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-panel {
  display: grid;
  min-height: 720px;
  place-items: center;
  padding: 28px;
  background: rgba(4, 11, 19, 0.44);
}

.auth-card {
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 42px);
  background: rgba(12, 26, 42, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card .brand {
  margin-bottom: 38px;
}

.auth-card h2 {
  margin-bottom: 10px;
  font-size: 1.7rem;
}

.auth-form {
  display: grid;
  gap: 19px;
  margin-top: 28px;
}

.auth-form .btn {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
}

.auth-footer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

/* Application shell */
.app-shell {
  min-height: 100vh;
  padding-left: var(--sidebar);
}

.sidebar {
  position: fixed;
  z-index: 90;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  background: rgba(6, 16, 28, 0.96);
  backdrop-filter: blur(20px);
}

.sidebar .brand {
  margin: 0 8px 34px;
}

.nav-label {
  margin: 12px 12px 8px;
  color: #63758a;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 5px;
}

.nav-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 700;
  text-align: left;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
}

.nav-button[aria-current="page"] {
  background: rgba(51, 212, 196, 0.11);
  color: var(--brand-strong);
}

.nav-button[aria-current="page"] .icon {
  filter: drop-shadow(0 0 8px rgba(51, 212, 196, 0.35));
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.mini-profile {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #06101c;
  font-size: 0.8rem;
  font-weight: 900;
}

.profile-copy {
  min-width: 0;
}

.profile-copy strong,
.profile-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: 0.8rem;
}

.profile-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.app-header {
  position: sticky;
  z-index: 70;
  top: 0;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(32, 50, 71, 0.8);
  padding: 12px clamp(18px, 3vw, 40px);
  background: rgba(6, 16, 28, 0.88);
  backdrop-filter: blur(18px);
}

.mobile-brand,
.menu-toggle {
  display: none;
}

.header-search {
  position: relative;
  width: min(440px, 40vw);
}

.header-search .icon {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 18px;
  color: var(--muted);
  pointer-events: none;
}

.header-search input {
  padding-left: 42px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.content {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: clamp(24px, 3vw, 42px);
}

.page-view {
  animation: view-in 180ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-head p {
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.service-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 25px;
  border: 1px solid rgba(89, 213, 141, 0.2);
  border-radius: 13px;
  padding: 11px 14px;
  background: rgba(89, 213, 141, 0.06);
  color: #bef3d3;
  font-size: 0.82rem;
}

.service-banner .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(89, 213, 141, 0.11);
}

.category-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  margin: 0 -4px 25px;
  padding: 4px;
  scrollbar-width: thin;
}

.category-chip {
  min-height: 40px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  font-weight: 750;
}

.category-chip:hover,
.category-chip[aria-pressed="true"] {
  border-color: rgba(51, 212, 196, 0.35);
  background: rgba(51, 212, 196, 0.1);
  color: var(--brand-strong);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 17px;
}

.section-head h2,
.section-head p {
  margin-bottom: 0;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.channel-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.channel-card:hover,
.channel-card:focus-within {
  z-index: 1;
  transform: translateY(-3px);
  border-color: rgba(51, 212, 196, 0.45);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
}

.channel-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(51, 212, 196, 0.1), rgba(141, 162, 255, 0.09)),
    #071321;
}

.channel-preview::after {
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(transparent, rgba(4, 11, 19, 0.8));
  content: "";
}

.channel-logo {
  width: 78px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #101820;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.channel-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
}

.live-label {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  padding: 5px 8px;
  background: #e7354a;
  color: white;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-label::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.favorite-btn {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(4, 11, 19, 0.68);
  color: white;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.favorite-btn[aria-pressed="true"] {
  color: #ffd95b;
}

.favorite-btn[aria-pressed="true"] .icon {
  fill: currentColor;
}

.play-channel {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.play-channel::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  transform: translate(-50%, -44%) scale(0.92);
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(4, 11, 19, 0.7);
  color: white;
  opacity: 0;
  backdrop-filter: blur(8px);
  content: "\25B6";
  transition: opacity 140ms ease, transform 140ms ease;
}

.play-channel:hover::after,
.play-channel:focus-visible::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.channel-meta {
  padding: 15px;
}

.channel-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.channel-number {
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 900;
}

.channel-title-row h3 {
  overflow: hidden;
  margin-bottom: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-name {
  overflow: hidden;
  margin: 10px 0 7px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-next {
  overflow: hidden;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: #1b2c3e;
}

.progress-track span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: linear-gradient(145deg, var(--panel), rgba(10, 22, 36, 0.86));
}

.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.04em;
}

.metric-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(51, 212, 196, 0.08);
  color: var(--brand);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  padding: 17px 19px;
}

.panel-head h2,
.panel-head h3,
.panel-head p {
  margin-bottom: 0;
}

.panel-body {
  padding: 19px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 15px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.table-primary {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 180px;
}

.table-primary .channel-logo {
  width: 42px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  font-size: 0.56rem;
}

.table-primary strong,
.table-primary small {
  display: block;
}

.table-primary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.017);
}

.list-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.list-row-copy {
  min-width: 0;
}

.list-row-copy strong,
.list-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

.device-icon {
  width: 42px;
  height: 42px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: rgba(141, 162, 255, 0.09);
  color: var(--accent);
}

.guide-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.guide-date {
  min-width: 165px;
}

.guide-list {
  display: grid;
  gap: 10px;
}

.guide-channel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.guide-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
  border-right: 1px solid var(--line);
  padding: 14px;
}

.guide-programs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
}

.guide-program {
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: var(--panel-soft);
}

.guide-program.is-current {
  border-color: rgba(51, 212, 196, 0.35);
  background: rgba(51, 212, 196, 0.07);
}

.guide-program time,
.guide-program strong {
  display: block;
}

.guide-program time {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.71rem;
}

.guide-program strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Player */
.dialog-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 7, 12, 0.84);
  backdrop-filter: blur(12px);
}

.player-dialog,
.form-dialog {
  width: min(100%, 1120px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #071321;
  box-shadow: var(--shadow);
}

.form-dialog {
  width: min(100%, 650px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 17px;
}

.dialog-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dialog-title h2,
.dialog-title p {
  overflow: hidden;
  margin-bottom: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.player-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  overflow: hidden;
  place-items: center;
  background: #010306;
}

.player-stage video {
  width: 100%;
  height: 100%;
  background: black;
}

.player-state {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  text-align: center;
}

.spinner {
  width: 42px;
  height: 42px;
  margin-bottom: 13px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.player-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 17px;
}

.player-info p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 20px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 15px 20px;
}

.toast-region {
  position: fixed;
  z-index: 400;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(380px, calc(100vw - 44px));
  gap: 9px;
}

.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 13px 14px;
  background: #102239;
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  animation: toast-in 180ms ease both;
  font-size: 0.82rem;
  line-height: 1.5;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.admin-only {
  color-scheme: light;
  --ink: #202733;
  --muted: #687386;
  --muted-strong: #4d596a;
  --bg: #f3f5f7;
  --bg-deep: #e9edf1;
  --panel: #ffffff;
  --panel-raised: #f5f8fb;
  --panel-soft: #f7f9fb;
  --line: #dce2e8;
  --line-strong: #aeb9c5;
  --brand: #0d6efd;
  --brand-strong: #0b5ed7;
  --brand-ink: #ffffff;
  --accent: #0d6efd;
  --warning: #9a6500;
  --danger: #c92a3a;
  --success: #16794a;
  --info: #0969c3;
  --shadow: 0 20px 50px rgba(30, 42, 55, 0.14);
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.admin-only .auth-showcase {
  border-color: #343d43;
  background:
    linear-gradient(145deg, rgba(13, 110, 253, 0.2), transparent 48%),
    #20272b;
  color: #ffffff;
}

.admin-only .auth-showcase::before,
.admin-only .auth-showcase::after {
  border-color: rgba(84, 160, 255, 0.3);
}

.admin-only .auth-showcase .brand,
.admin-only .auth-showcase .subtle,
.admin-only .auth-showcase .auth-copy p {
  color: #eef4fa;
}

.admin-only .auth-showcase .brand-copy small {
  color: #c4ced7;
}

.admin-only .auth-copy h1 span,
.admin-only .eyebrow {
  color: var(--brand);
}

.admin-only .auth-showcase .eyebrow,
.admin-only .auth-showcase .auth-copy h1 span {
  color: #54a0ff;
}

.admin-only .auth-panel {
  background: #eef1f4;
}

.admin-only .auth-card {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.admin-only .sidebar {
  border-color: #343d43;
  background: #20272b;
  color: #ffffff;
  backdrop-filter: none;
}

.admin-only .sidebar .brand,
.admin-only .sidebar .profile-copy strong {
  color: #ffffff;
}

.admin-only .sidebar .brand-copy small,
.admin-only .sidebar .profile-copy small {
  color: #aeb9c1;
}

.admin-only .sidebar .nav-label {
  color: #89959e;
}

.admin-only .sidebar .nav-button {
  color: #d4dce2;
}

.admin-only .sidebar .nav-button:hover {
  background: #2b3439;
  color: #ffffff;
}

.admin-only .sidebar .nav-button[aria-current="page"] {
  background: var(--brand);
  color: #ffffff;
}

.admin-only .sidebar .nav-button[aria-current="page"] .icon {
  filter: none;
}

.admin-only .sidebar-footer {
  border-color: #3a444a;
}

.admin-only .app-header {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 9px rgba(30, 42, 55, 0.05);
}

.admin-only .panel,
.admin-only .metric-card,
.admin-only .integration-card,
.admin-only .health-card {
  background: #ffffff;
}

.admin-only .metric-card {
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(30, 42, 55, 0.04);
}

.admin-only .metric-icon,
.admin-only .integration-logo {
  background: #eaf2ff;
  color: var(--brand);
}

.admin-only .field input,
.admin-only .field select,
.admin-only .field textarea,
.admin-only .search-field {
  background: #ffffff;
  color: var(--ink);
}

.admin-only .field input[readonly] {
  background: #edf1f4;
  color: var(--muted-strong);
  cursor: not-allowed;
}

.admin-only .btn-primary {
  background: var(--brand);
  color: #ffffff;
}

.admin-only .btn-primary:hover {
  background: var(--brand-strong);
}

.admin-only .btn-secondary {
  background: #ffffff;
  color: var(--ink);
}

.admin-only .btn-secondary:hover {
  background: #f0f4f7;
}

.admin-only .empty-state {
  background: #f8fafc;
}

.admin-only .skeleton {
  background: #e5eaf0;
}

.admin-only .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
}

.admin-only .data-table tbody tr:hover {
  background: #f8fafc;
}

.admin-only .form-dialog,
.admin-only .player-dialog {
  background: #ffffff;
}

.admin-only .toast {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.admin-only .usage-bar {
  background: #dfe5eb;
}

.admin-only .status-unknown,
.admin-only .status-not-monitored {
  border-color: var(--line);
  background: #f2f4f7;
  color: var(--muted-strong);
}

.admin-only .status-suspended {
  border-color: rgba(154, 101, 0, 0.26);
  background: rgba(154, 101, 0, 0.08);
  color: var(--warning);
}

.admin-only .status-cancelled {
  border-color: rgba(201, 42, 58, 0.25);
  background: rgba(201, 42, 58, 0.07);
  color: var(--danger);
}

.admin-only .filter-panel {
  margin-bottom: 16px;
}

.admin-only .filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  padding: 18px 19px 8px;
}

.admin-only .filter-summary {
  min-height: 1.4em;
  margin: 0;
  padding: 4px 19px 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-only .admin-data-table {
  min-width: 920px;
}

.admin-only .table-actions {
  flex-wrap: wrap;
}

.admin-only .channel-selector {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px;
}

.admin-only .channel-selector legend {
  padding: 0 7px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 750;
}

.admin-only .selection-summary {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-only .checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
  padding: 3px;
}

.admin-only .check-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: #ffffff;
  cursor: pointer;
}

.admin-only .check-option:hover,
.admin-only .check-option:focus-within {
  border-color: #8bb9ff;
  background: #f4f8ff;
}

.admin-only .check-option.is-managed {
  border-style: dashed;
  background: #f1f5f9;
  cursor: default;
}

.admin-only .check-option.is-managed:hover,
.admin-only .check-option.is-managed:focus-within {
  border-color: var(--line-strong);
  background: #f1f5f9;
}

.admin-only .check-option input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.admin-only .check-option strong,
.admin-only .check-option small {
  display: block;
}

.admin-only .check-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.admin-only .selection-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.admin-only #simpleDialogBackdrop .form-dialog {
  width: min(100%, 780px);
}

.admin-only #subscriberDialogBackdrop .form-dialog {
  width: min(100%, 780px);
}

.admin-only .subscriber-group-selector .checkbox-list {
  max-height: 250px;
}

.admin-only .channel-logo-preview {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 78px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  padding: 10px 12px;
  background: #f8fafc;
}

.admin-only .channel-logo-preview > img,
.admin-only .channel-logo-preview > .channel-logo {
  width: 78px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: #ffffff;
}

.admin-only .channel-logo-preview > span:last-child {
  min-width: 0;
}

.admin-only .channel-logo-preview strong,
.admin-only .channel-logo-preview small {
  display: block;
}

.admin-only .channel-logo-preview small {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-only #channelPreviewDialogBackdrop .player-dialog {
  width: min(100%, 980px);
}

.admin-only #channelPreviewDialogBackdrop .player-stage {
  color: #ffffff;
}

.admin-only .dialog-head .section-copy {
  margin-bottom: 0;
  font-size: 0.8rem;
}

.integration-grid,
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.integration-card,
.health-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--panel);
}

.integration-card-head,
.health-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 13px;
}

.integration-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(141, 162, 255, 0.1);
  color: #cbd3ff;
  font-weight: 900;
}

.integration-card p,
.health-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.integration-meta,
.health-meta {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.key-value {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.77rem;
}

.key-value strong {
  color: var(--muted-strong);
  font-weight: 750;
  text-align: right;
}

.usage-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #1a2a3c;
}

.usage-bar span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

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

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .auth-page {
    grid-template-columns: minmax(0, 0.8fr) minmax(390px, 1fr);
  }

  .auth-copy h1 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
  }
}

@media (max-width: 820px) {
  :root {
    --header: 66px;
  }

  .auth-page {
    display: block;
  }

  .auth-showcase {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
  }

  .app-shell {
    padding-left: 0;
  }

  .sidebar {
    width: min(88vw, 310px);
    transform: translateX(-105%);
    box-shadow: var(--shadow);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 80;
    inset: 0;
    background: rgba(2, 7, 12, 0.72);
  }

  .menu-toggle,
  .mobile-brand {
    display: inline-flex;
  }

  .mobile-brand .brand-copy {
    display: none;
  }

  .header-search {
    flex: 1;
    width: auto;
  }

  .header-actions .hide-mobile {
    display: none;
  }

  .admin-only .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    padding: 24px 18px 36px;
  }

  .guide-channel {
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .guide-channel-info .channel-logo {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-header {
    gap: 8px;
    padding: 10px 12px;
  }

  .mobile-brand {
    display: none;
  }

  .header-search input {
    min-height: 44px;
  }

  .page-head {
    display: block;
  }

  .page-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }

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

  .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .channel-meta {
    padding: 12px;
  }

  .channel-logo {
    width: 58px;
    height: 43px;
  }

  .channel-title-row {
    display: block;
  }

  .channel-title-row h3 {
    margin-top: 4px;
    font-size: 0.84rem;
  }

  .program-name {
    margin-top: 7px;
    font-size: 0.72rem;
  }

  .program-next {
    display: none;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    padding: 15px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-only .filter-grid,
  .admin-only .checkbox-list {
    grid-template-columns: 1fr;
  }

  .admin-only .filter-panel .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-only .filter-panel .panel-head .btn {
    width: 100%;
  }

  .dialog-backdrop {
    align-items: end;
    padding: 0;
  }

  .player-dialog,
  .form-dialog {
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .player-info {
    grid-template-columns: 1fr;
  }

  .guide-channel {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .guide-channel-info {
    padding: 10px;
  }

  .guide-program {
    min-width: 185px;
  }

  .list-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-row > .btn {
    width: 100%;
  }

  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    display: none;
  }

  .admin-only .data-table th:nth-child(3),
  .admin-only .data-table td:nth-child(3) {
    display: table-cell;
  }
}

@media (min-width: 1500px) {
  :root {
    --sidebar: 275px;
  }

  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  }

  .nav-button,
  .category-chip,
  .btn {
    min-height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
