:root {
  --bg: #08131d;
  --panel: rgba(10, 24, 36, 0.84);
  --line: rgba(126, 168, 201, 0.16);
  --text: #eef5fb;
  --muted: #9fb5c9;
  --accent: #00d4a6;
  --accent-2: #ff8a3d;
  --danger: #ff6b6b;
  --glow: rgba(0, 212, 166, 0.18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 212, 166, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 138, 61, 0.18), transparent 24%),
    linear-gradient(145deg, #07111a 0%, #0c1925 50%, #122335 100%);
  font-family: "Segoe UI", Arial, sans-serif;
}
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 10, 16, 0.72);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 19, 28, 0.98), rgba(12, 27, 39, 0.92));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
}
.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.login-hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}
.shell { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.shell.locked {
  pointer-events: none;
  user-select: none;
  filter: blur(6px);
}
.sidebar {
  padding: 28px; border-right: 1px solid var(--line); background: rgba(4, 12, 19, 0.55);
  backdrop-filter: blur(20px); display: flex; flex-direction: column; gap: 20px;
}
.content { padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.hero, .panel, .card, .side-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}
.hero, .panel { padding: 22px; }
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.hero-actions, .actions, .card-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.eyebrow, .card-label, label span, .stamp {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: var(--muted);
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 34px; line-height: 1; margin-top: 6px; }
h2 { font-size: 34px; max-width: 780px; }
h3 { font-size: 24px; }
.muted { color: var(--muted); margin-top: 10px; line-height: 1.55; }
.side-card, .card { padding: 18px; }
.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.menu-btn {
  text-align: left;
  background: rgba(10, 22, 33, 0.84);
}
.menu-btn.active {
  border-color: rgba(0, 212, 166, 0.4);
  box-shadow: 0 10px 24px rgba(0, 212, 166, 0.12);
}
.side-list { padding-left: 18px; color: var(--muted); line-height: 1.8; margin: 10px 0 0; }
.big-number { font-size: 40px; color: var(--accent); font-weight: 700; margin-top: 8px; }
.panel-head, .card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.kpi-grid.slim { margin-bottom: 18px; }
.kpi {
  padding: 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(9, 23, 36, 0.95), rgba(14, 33, 48, 0.82));
  border: 1px solid var(--line);
}
.kpi-value { display: block; font-size: 30px; margin-top: 8px; color: var(--accent); font-weight: 700; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.route-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.form-grid.compact-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
.wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 8px; }
.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.date-entry {
  display: grid;
  grid-template-columns: 1fr 152px;
  gap: 10px;
  align-items: center;
}
input, select, textarea, button {
  border-radius: 14px; border: 1px solid var(--line); background: rgba(9, 20, 30, 0.95);
  color: var(--text); padding: 12px 14px; font: inherit;
}
textarea { resize: vertical; }
button { cursor: pointer; transition: transform 0.16s ease, box-shadow 0.16s ease; }
button:hover { transform: translateY(-1px); }
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #0f9e83); color: #06241f; border-color: transparent;
  box-shadow: 0 12px 28px var(--glow); font-weight: 700;
}
.ghost-btn { background: rgba(13, 26, 39, 0.88); }
.danger-btn { border-color: rgba(255, 107, 107, 0.5); color: #ffd3d3; }
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar input,
.toolbar select {
  min-width: 260px;
}
.pagination-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.pagination-info {
  color: var(--muted);
  font-size: 13px;
}
.pagination-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.bitrate-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.bitrate-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.bitrate-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid var(--line);
  color: var(--accent);
  background: rgba(0, 212, 166, 0.08);
}
.bitrate-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.bitrate-stat {
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 19, 28, 0.7);
}
.bitrate-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}
.table-wrap, .channel-grid, .alert-list, .metric-stack { display: flex; flex-direction: column; gap: 12px; }
.playout-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.playout-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 19, 28, 0.92), rgba(12, 27, 39, 0.84));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.playout-card.local-active {
  border-color: rgba(0, 212, 166, 0.45);
  background: linear-gradient(180deg, rgba(4, 38, 30, 0.96), rgba(10, 62, 46, 0.88));
  box-shadow: 0 18px 40px rgba(0, 212, 166, 0.14);
}
.playout-card.local-waiting {
  border-color: rgba(255, 138, 61, 0.5);
  background: linear-gradient(180deg, rgba(54, 28, 8, 0.96), rgba(83, 43, 10, 0.88));
  box-shadow: 0 18px 40px rgba(255, 138, 61, 0.14);
}
.playout-card.remote-active {
  border-color: rgba(126, 212, 255, 0.42);
  background: linear-gradient(180deg, rgba(8, 28, 48, 0.96), rgba(11, 45, 82, 0.88));
  box-shadow: 0 18px 40px rgba(126, 212, 255, 0.12);
}
.playout-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  flex-wrap: wrap;
}
.playout-state-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
}
.playout-state-pill.local-active {
  color: #9af6dc;
  background: rgba(0, 212, 166, 0.16);
  border-color: rgba(0, 212, 166, 0.4);
}
.playout-state-pill.local-waiting {
  color: #ffd8b8;
  background: rgba(255, 138, 61, 0.18);
  border-color: rgba(255, 138, 61, 0.45);
}
.playout-state-pill.remote-active {
  color: #bfeaff;
  background: rgba(126, 212, 255, 0.16);
  border-color: rgba(126, 212, 255, 0.36);
}
.inline-note {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  line-height: 1.6;
}
.table { width: 100%; border-collapse: collapse; overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.channel-card {
  padding: 18px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 19, 28, 0.98), rgba(12, 27, 39, 0.86)); display: flex; flex-direction: column; gap: 14px;
}
.channel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.badge { padding: 6px 10px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; border: 1px solid var(--line); }
.badge.active { color: #7ef0ce; background: rgba(0, 212, 166, 0.1); }
.badge.suspended, .badge.expired { color: #ffd1d1; background: rgba(255, 107, 107, 0.12); }
.badge.scheduled { color: #ffe0b3; background: rgba(255, 138, 61, 0.12); }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meta-item { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); }
.meta-item strong { display: block; margin-top: 6px; font-size: 14px; word-break: break-word; }
.alert { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.metric-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.metric-row:last-child { border-bottom: 0; }
.metric-row > span,
.metric-row > strong {
  min-width: 0;
}
.metric-row > strong {
  max-width: 60%;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
}
.playout-card .actions {
  position: relative;
  z-index: 2;
}
.chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(22px, 1fr)); align-items: end; gap: 8px; min-height: 180px; }
.preview-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.preview-video {
  width: 100%;
  min-height: 260px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #050b12;
}
.bar-wrap { display: flex; flex-direction: column; gap: 8px; justify-content: end; align-items: center; }
.bar { width: 100%; max-width: 24px; border-radius: 999px 999px 8px 8px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); min-height: 6px; }
.bar-label { font-size: 11px; color: var(--muted); }
.code-block { max-height: 280px; overflow: auto; white-space: pre-wrap; border-radius: 16px; background: #08111a; padding: 16px; color: #8ee3ff; }
.analytics-picker { margin-bottom: 18px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; padding: 14px 18px; border-radius: 14px; background: #0f2434;
  border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}
.hidden { display: none; }
.multistream-grid { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.ms-channel-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(8, 19, 28, 0.92), rgba(12, 27, 39, 0.84));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ms-channel-card.ms-card-live {
  border-color: rgba(0, 212, 166, 0.45);
  box-shadow: 0 18px 40px rgba(0, 212, 166, 0.12);
}
.ms-channel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 12px;
}
.ms-channel-name { font-size: 16px; display: block; margin-bottom: 4px; }
.ms-channel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ms-dest-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}
.ms-dest-row:has(.ms-live) { border-color: rgba(0, 212, 166, 0.35); }
.ms-dest-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ms-dest-url-hint { color: var(--muted); font-size: 12px; font-family: monospace; word-break: break-all; }
.ms-dest-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ms-key-input { flex: 1; min-width: 180px; }
.ms-action-btn { min-width: 68px; flex-shrink: 0; }
.ms-status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ms-live { color: #9af6dc; background: rgba(0, 212, 166, 0.16); border-color: rgba(0, 212, 166, 0.4); }
.ms-idle { color: var(--muted); background: rgba(255, 255, 255, 0.04); border-color: var(--line); }

@media (max-width: 1120px) {
  .shell, .grid-two { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .content, .sidebar { padding: 18px; }
  .hero, .form-grid, .form-grid.compact-form, .meta-grid, .bitrate-summary, .date-entry { grid-template-columns: 1fr; }
  .hero { align-items: start; }
}
