/* StreamSSL Dashboard - Clean Light Theme (ArchitectUI inspired) */
html {
  font-size: 90%;
}

:root {
  --sidebar-bg: #2d3250;
  --sidebar-active: #3e4470;
  --sidebar-text: rgba(255,255,255,.7);
  --sidebar-text-active: #fff;
  --sidebar-width: 216px;
  --header-bg: #fff;
  --header-height: 52px;
  --page-bg: #f1f4f6;
  --card-bg: #fff;
  --border: #e8ecf1;
  --text: #3b3f5c;
  --text-secondary: #888ea8;
  --text-muted: #acb0c3;
  --accent: #5b6abf;
  --accent-hover: #4a58a8;
  --accent-light: rgba(91,106,191,.1);
  --green: #1abc9c;
  --green-bg: rgba(26,188,156,.12);
  --red: #e7515a;
  --red-bg: rgba(231,81,90,.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --radius: 7px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  background: linear-gradient(135deg, #2d3250 0%, #424874 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-card .brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sidebar-bg);
  margin-bottom: 0.25rem;
}

.login-card .brand p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 0.75rem;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  padding: 0.3125rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: none;
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent-outline {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
}

.btn-accent-outline:hover {
  background: var(--accent);
  color: #fff;
}

.error-msg {
  color: var(--red);
  font-size: 0.8125rem;
  margin-top: 1rem;
  text-align: center;
  display: none;
}

/* ============================================
   DASHBOARD LAYOUT: sidebar + header + content
   ============================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand h2 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-brand span {
  color: rgba(255,255,255,.45);
  font-size: 0.6875rem;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.nav-section {
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.nav-section-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.375rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.75rem;
  border-radius: 5px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: all 0.15s ease;
  cursor: pointer;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,.5);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Header ---- */
.header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left .page-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.hamburger svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right .server-ip {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--page-bg);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
}

.header-right .btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.375rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.header-right .btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ---- Main content area ---- */
.content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
}

.main {
  padding: 1.5rem;
  max-width: 1600px;
  width: 100%;
}

/* ============================================
   SUMMARY CARDS
   ============================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.accent::before { background: var(--accent); }
.stat-card.green::before { background: var(--green); }
.stat-card.info::before { background: #3498db; }
.stat-card.orange::before { background: #e2a03f; }

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================
   SECTIONS / PANELS
   ============================================ */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.panel-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
}

.panel-body {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   TABLES
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.6875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f8f9fc;
}

.badge {
  display: inline-block;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-online {
  background: var(--green-bg);
  color: var(--green);
}

.badge-offline {
  background: var(--red-bg);
  color: var(--red);
}

.mono {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  color: var(--text);
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============================================
   PUBLISH POINTS PAGE
   ============================================ */
.panel-header-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* ---- Toolbar ---- */
.pub-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.pub-toolbar-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pub-toolbar-right {
  flex-shrink: 0;
}

/* ---- Inline forms (add category / add key) ---- */
.pub-inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.pub-inline-form .form-input {
  max-width: 320px;
}

/* ---- Category card ---- */
.pub-category {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.pub-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.pub-cat-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pub-cat-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.pub-cat-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pub-cat-keys {
  /* disclosure items */
}

.pub-cat-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.pub-cat-empty strong {
  color: var(--text-secondary);
}

/* category-level inline form */
.pub-category .pub-inline-form {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

/* ---- Disclosure item (stream key row) ---- */
.pub-item {
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item-header {
  display: flex;
  align-items: center;
  padding: 0.6875rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.pub-item-header:hover {
  background: #fafbfc;
}

.pub-item-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-right: 0.625rem;
}

.pub-item.open .pub-item-arrow {
  transform: rotate(90deg);
}

.pub-item-name {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.pub-item-tags {
  display: flex;
  gap: 0.3125rem;
  margin-right: 0.625rem;
}

.pub-tag {
  font-size: 0.625rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.0625rem 0.4375rem;
  border-radius: 3px;
  font-weight: 600;
}

.pub-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.pub-item-remove:hover {
  color: var(--red);
  background: var(--red-bg);
}

.pub-item-remove svg {
  width: 15px;
  height: 15px;
}

/* ---- Disclosure body (URLs) ---- */
.pub-item-body {
  display: none;
  padding: 0.25rem 1.25rem 1rem 2.625rem;
}

.pub-item.open .pub-item-body {
  display: block;
}

.pub-section {
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.375rem;
}

.pub-section:last-child {
  margin-bottom: 0;
}

.pub-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.3125rem;
}

.pub-fields {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pub-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pub-field-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 80px;
  flex-shrink: 0;
}

.pub-field-value {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
  overflow-x: auto;
  user-select: all;
}

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1875rem 0.4375rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy.copied {
  border-color: var(--green);
  color: var(--green);
}

/* ---- Empty page state ---- */
.pub-empty-page {
  text-align: center;
  padding: 3rem 1rem;
}

.pub-empty-icon {
  margin-bottom: 1rem;
}

.pub-empty-icon svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.pub-empty-page h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.pub-empty-page p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* ---- Page tips bar ---- */
.pub-page-tips {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  line-height: 1.7;
  margin-top: 0.5rem;
}

.pub-page-tips strong {
  color: var(--text);
}

/* ============================================
   DISPATCH TEST
   ============================================ */
.dispatch-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 1.25rem;
}

.dispatch-row .form-input {
  flex: 1;
  max-width: 360px;
}

.dispatch-result {
  margin: 0 1.25rem 1.25rem;
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
  display: none;
}

/* ============================================
   MOBILE SIDEBAR OVERLAY
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .content-wrapper {
    margin-left: 0;
  }
  .hamburger {
    display: block;
  }
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .main { padding: 1rem; }
  .dispatch-row { flex-direction: column; align-items: stretch; }
  .dispatch-row .form-input { max-width: 100%; }
  .header-right .server-ip {
    display: none;
  }
  .panel-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
  .header {
    padding: 0 1rem;
  }
  .header-left .page-title {
    font-size: 0.9375rem;
  }
  .stat-card .stat-value {
    font-size: 1.375rem;
  }
  .panel-header {
    padding: 0.875rem 1rem;
  }
  .server-health-body {
    padding: 1rem;
  }
}

/* ============================================
   VIDEO CONTAINER (Tools / Live / Player)
   ============================================ */
.video-container {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

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

/* ============================================
   CONTROLS ROW
   ============================================ */
.controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.controls-row .form-input {
  max-width: 280px;
  min-width: 0;
}

.controls-row select {
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}

.controls-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-success {
  background: var(--green);
  color: #fff;
  border: none;
}

.btn-success:hover {
  background: #17a589;
}

.btn-stop {
  background: var(--red);
  color: #fff;
  border: none;
}

.btn-stop:hover {
  background: #c0392b;
}

/* ============================================
   STATUS BADGE
   ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.live {
  background: var(--red-bg);
  color: var(--red);
}

.status-badge.live::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.status-badge.running {
  background: var(--green-bg);
  color: var(--green);
}

.status-badge.running::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-badge.stopped {
  background: #f0f0f0;
  color: var(--text-muted);
}

.status-badge.downloading {
  background: rgba(52,152,219,.12);
  color: #3498db;
}

/* ============================================
   LOG OUTPUT
   ============================================ */
.log-output {
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  padding: 1rem;
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 1rem;
}

.log-output:empty::after {
  content: 'No output yet...';
  color: #585b70;
}

/* ============================================
   PROTOCOL TABS (Player page)
   ============================================ */
.protocol-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}

.protocol-tab {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.protocol-tab:hover {
  color: var(--text);
}

.protocol-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================
   STREAM INFO
   ============================================ */
.stream-info {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stream-info dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stream-info dd {
  margin: 0;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
}

/* ============================================
   NOTICE BOX
   ============================================ */
.notice-box {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.notice-box.info {
  background: rgba(52,152,219,.08);
  border: 1px solid rgba(52,152,219,.2);
  color: #2471a3;
}

.notice-box.warning {
  background: rgba(226,160,63,.08);
  border: 1px solid rgba(226,160,63,.2);
  color: #b7791f;
}

.notice-box strong {
  font-weight: 600;
}

/* ============================================
   STREAM DETAIL TOGGLE & EXPANDABLE ROW
   ============================================ */
.detail-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.detail-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.stream-detail-row {
  display: none;
}

.stream-detail-row.open {
  display: table-row;
}

.stream-detail-row td {
  padding: 0 1.25rem 1rem 1.25rem;
  background: #f8f9fc;
  border-bottom: 1px solid var(--border);
}

.stream-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  padding: 0.75rem 0;
}

.detail-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.detail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-width: 72px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.8125rem;
  color: var(--text);
}

/* ============================================
   TYPE BADGE (RTMP / WebRTC)
   ============================================ */
.type-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-badge.type-rtmp {
  background: rgba(52,152,219,.12);
  color: #2471a3;
}

.type-badge.type-webrtc {
  background: rgba(142,68,173,.12);
  color: #8e44ad;
}

@media (max-width: 768px) {
  .stream-detail-grid {
    grid-template-columns: 1fr;
  }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  .controls-row .form-input {
    max-width: 100%;
  }
  .pub-toolbar {
    flex-direction: column;
  }
  .pub-inline-form {
    flex-wrap: wrap;
  }
  .pub-inline-form .form-input {
    max-width: 100%;
    flex: 1;
  }
  .pub-item-body {
    padding: 0.25rem 0.75rem 1rem 0.75rem;
  }
  .pub-field {
    flex-wrap: wrap;
  }
  .pub-field-value {
    min-width: 0;
    overflow-x: auto;
  }
}

/* ============================================
   HISTORY FILTERS
   ============================================ */
.history-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.history-filters .form-input {
  max-width: 220px;
}

.history-filters .form-input[type="date"] {
  max-width: 170px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-right: 0.75rem;
}

.page-ellipsis {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

@media (max-width: 768px) {
  .history-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .history-filters .form-input,
  .history-filters .form-input[type="date"] {
    max-width: 100%;
  }
}

/* ============================================
   MASTER SERVER HEALTH PANEL
   ============================================ */
.server-health-body {
  padding: 1.25rem;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.health-metric {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.health-metric-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.health-metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.health-metric-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.health-bar {
  height: 8px;
  background: var(--page-bg);
  border-radius: 4px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.4s ease, background-color 0.4s ease;
  min-width: 0;
}

.health-bar-fill.warn {
  background: #e2a03f;
}

.health-bar-fill.danger {
  background: var(--red);
}

.health-metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.health-bw-detail {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
}

.bw-direction {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text);
}

.bw-direction svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

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