:root {
  --bg: #f5f6fa;
  --card: #fff;
  --text: #2d3436;
  --muted: #636e72;
  --primary: #6c5ce7;
  --online: #00b894;
  --offline: #dfe6e9;
  --live: #00cec9;
  --vod: #fd79a8;
  --danger: #d63031;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--card);
  box-shadow: var(--shadow);
}
.logo { font-weight: 700; font-size: 1.25rem; color: var(--primary); }
.header nav { display: flex; align-items: center; gap: 1rem; }
.header nav a { color: var(--text); text-decoration: none; }
.header nav a:hover { color: var(--primary); }
.user { color: var(--muted); font-size: 0.9rem; margin-right: 0.5rem; }
#logoutBtn { background: var(--muted); color: #fff; border: none; padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer; }
#logoutBtn:hover { background: var(--danger); }

.main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.page h1 { margin: 0 0 1rem; font-size: 1.5rem; }
.page.hidden { display: none; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.card-icon { font-size: 1.5rem; }
.card-value { font-size: 1.75rem; font-weight: 700; }
.card-label { font-size: 0.85rem; color: var(--muted); }
.card-online .card-value { color: var(--online); }
.card-total .card-value { color: var(--primary); }
.card-offline .card-value { color: var(--muted); }
.card-live .card-value { color: var(--live); }
.card-vod .card-value { color: var(--vod); }

.form { padding: 1rem; margin-bottom: 1.5rem; }
.form h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.form-row { margin-bottom: 0.75rem; }
.form-row label { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; color: var(--muted); }
.form input, .form select {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.form button, button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0.25rem;
}
.form button:hover { opacity: 0.9; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: 10px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #f8f9fa; font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.table td .url { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; border-radius: 4px; border: none; cursor: pointer; background: var(--muted); color: #fff; }
.btn-sm.danger { background: var(--danger); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--card); margin-bottom: 0.5rem; border-radius: 8px; box-shadow: var(--shadow); }

.tabs { margin-bottom: 1rem; }
.tabs button { padding: 0.5rem 1rem; margin-right: 0.5rem; border: 1px solid #ddd; background: var(--card); border-radius: 6px; cursor: pointer; }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-panel.hidden { display: none; }

.logs-pre {
  margin: 0;
  padding: 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  overflow: auto;
  max-height: 70vh;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
  max-width: 420px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.btn-sm.edit { background: var(--primary); }
