*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f5f7;
  color: #111827;
  min-height: 100svh;
}

/* ── Login screen ─────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111218;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand-row { display: flex; align-items: center; gap: 10px; }
.login-logo { height: 40px; width: auto; filter: invert(1); }
.login-wordmark { font-size: 20px; font-weight: 800; color: #111827; letter-spacing: -.01em; }
.login-box h2 { font-size: 22px; font-weight: 800; color: #111827; }
.login-sub { font-size: 14px; color: #6b7280; margin-top: -4px; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100svh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #111218;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100svh;
  overflow-y: auto;
}

.sidebar-top { display: flex; flex-direction: column; }

.sidebar-brand {
  padding: 24px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand-row { display: flex; align-items: center; gap: 9px; }
.sidebar-logo { height: 30px; width: auto; }
.sidebar-wordmark { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -.01em; }

.sidebar-portaal {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.22);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 8px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.45);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.75); }
.nav-item.active { background: #E30613; color: #fff; }

/* ── Sidebar footer ──────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user-row { display: flex; align-items: center; gap: 10px; }

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #E30613;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.35); }

.sidebar-logout-btn {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: none;
  border-radius: 7px;
  color: rgba(255,255,255,.45);
  font: 13px/1 'Inter', sans-serif;
  padding: 8px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar-logout-btn:hover { background: rgba(255,255,255,.11); color: rgba(255,255,255,.75); }

/* ── Content area ────────────────────────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; background: #f4f5f7; }

.content-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 36px 28px 72px;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title { font-size: 24px; font-weight: 800; color: #111827; }
.page-sub { font-size: 13px; color: #6b7280; margin-top: 5px; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E30613;
  flex-shrink: 0;
  animation: pulse 1.8s ease-in-out infinite;
}

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

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font: 600 14px/1 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: #E30613; border-color: transparent; color: #fff; }
.btn-full { width: 100%; justify-content: center; margin-top: 4px; }
.btn-primary:hover { background: #c40010; }
.btn-ghost { background: transparent; border-color: #e5e7eb; color: #6b7280; }
.btn-ghost:hover { background: #f9fafb; color: #374151; }
.btn-danger { background: rgba(220,38,38,.07); border-color: rgba(220,38,38,.2); color: #dc2626; }
.btn-danger:hover { background: rgba(220,38,38,.13); }
.btn-sm { height: 33px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn-text { background: none; border: none; color: #6b7280; font: 600 13px/1 'Inter', sans-serif; cursor: pointer; padding: 4px 0; }
.btn-text:hover { color: #374151; }
.btn-text.danger { color: #dc2626; }
.btn-text.danger:hover { color: #b91c1c; }

/* ── Add panel ───────────────────────────────────────────────────────────── */
.add-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}

.add-panel-inner { padding: 24px; }
.add-panel-inner h3 { font-size: 15px; font-weight: 700; margin-bottom: 18px; color: #111827; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 600px) { .edit-grid { grid-template-columns: 1fr; } }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 13px; font-weight: 600; color: #374151; }
.opt { font-weight: 400; color: #9ca3af; }
.label-hint { font-weight: 400; color: #9ca3af; font-size: 12px; }

.form-row input, .form-row select {
  height: 38px;
  padding: 0 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #111827;
  font: 14px/1 'Inter', sans-serif;
  outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: #E30613; }

.hint { font-size: 12px; color: #9ca3af; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.form-msg { font-size: 13px; color: #6b7280; }
.form-msg.ok { color: #16a34a; }
.form-msg.err { color: #dc2626; }

/* ── Login field ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: #374151; }
.field input {
  height: 44px;
  padding: 0 14px;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 9px;
  color: #111827;
  font: 15px/1 'Inter', sans-serif;
  outline: none;
}
.field input:focus { border-color: #E30613; }
.error-line { font-size: 13px; color: #dc2626; min-height: 18px; }

/* ── Tenant table ────────────────────────────────────────────────────────── */
.tenant-table {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.table-head {
  display: grid;
  grid-template-columns: 1fr 110px 130px 100px 150px;
  padding: 10px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table-head > div {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.th-actions { text-align: right; }

/* ── Tenant row ──────────────────────────────────────────────────────────── */
.tenant-row { border-bottom: 1px solid #f3f4f6; }
.tenant-row:last-child { border-bottom: none; }

.row-main {
  display: grid;
  grid-template-columns: 1fr 110px 130px 100px 150px;
  align-items: center;
  padding: 14px 20px;
  gap: 8px;
}

.td-club { display: flex; align-items: center; gap: 12px; }

.club-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.club-name { font-size: 14px; font-weight: 700; color: #111827; }
.club-meta { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.club-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.club-color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }

.slug-chip {
  font-size: 12px;
  font-family: 'Menlo', 'Consolas', monospace;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 5px;
  color: #374151;
}

.yt-indicator {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af;
}
.yt-indicator::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; }
.yt-indicator.ok { color: #16a34a; }
.yt-indicator.ok::before { background: #16a34a; }

.status-indicator {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af;
}
.status-indicator::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; }
.status-indicator.live { color: #E30613; }
.status-indicator.live::before { background: #E30613; }

.td-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

/* ── Row detail (expanded edit) ──────────────────────────────────────────── */
.row-detail {
  border-top: 1px solid #f0f0f0;
  padding: 24px 20px;
  background: #fafafa;
}

/* ── Section label ───────────────────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Utility helpers (replaces inline styles blocked by CSP) ─────────────── */
.form-msg-mt { margin-top: 6px; }
.form-actions-mt { margin-top: 8px; }
.squad-edit-grid-mt { margin-top: 6px; }
.label-dim { font-weight: 400; color: #9ca3af; }

/* ── Logo upload ─────────────────────────────────────────────────────────── */
.logo-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-preview-lg { width: 52px; height: 52px; border-radius: 10px; object-fit: contain; border: 1px solid #e5e7eb; background: #f3f4f6; flex-shrink: 0; }
.logo-upload-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Color input ─────────────────────────────────────────────────────────── */
.color-input-row { display: flex; align-items: center; gap: 8px; }
.color-picker-swatch { width: 36px; height: 36px; padding: 2px; border: 1px solid #e5e7eb; border-radius: 7px; background: none; cursor: pointer; flex-shrink: 0; }
.color-hex-input { flex: 1; height: 36px; padding: 0 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 7px; color: #111827; font: 13px/1 monospace; outline: none; }
.color-hex-input:focus { border-color: #E30613; }

/* ── YouTube section ─────────────────────────────────────────────────────── */
.yt-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e5e7eb; }
.yt-section-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.yt-badge .ok { color: #16a34a; font-size: 13px; font-weight: 600; }
.yt-badge .no { color: #9ca3af; font-size: 13px; }
.yt-setup-details { margin-top: 8px; }
.yt-setup-summary { font-size: 13px; color: #6b7280; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.yt-setup-summary::-webkit-details-marker { display: none; }
.yt-setup-steps { margin: 10px 0 0 16px; display: flex; flex-direction: column; gap: 7px; }
.yt-setup-steps li { font-size: 13px; color: #6b7280; line-height: 1.55; }
.yt-setup-steps strong { color: #111827; }
.yt-setup-steps em { color: #374151; font-style: normal; font-weight: 500; }
.yt-setup-steps code { font-family: monospace; font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; color: #111827; }
.yt-redirect-uri { display: inline-block; margin-top: 4px; }

/* ── Squads section ──────────────────────────────────────────────────────── */
.squads-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e5e7eb; }
.squads-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.squad-admin-list { display: flex; flex-direction: column; gap: 6px; }
.squad-item { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.squad-item-expandable { display: flex; flex-direction: column; }
.squad-item-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.squad-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.squad-item-name { font-size: 13px; font-weight: 600; color: #111827; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.squad-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.squad-playlist-badge { font-size: 11px; font-weight: 600; color: #16a34a; border: 1px solid rgba(22,163,74,.25); padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.squad-playlist-badge.no { color: #9ca3af; border-color: #e5e7eb; }
.squad-edit-inline { padding: 12px; border-top: 1px solid #e5e7eb; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.squad-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.squad-edit-label { font-size: 12px; font-weight: 600; color: #374151; display: block; margin-bottom: 4px; }
.squad-playlist-row { display: flex; gap: 8px; align-items: center; }
.squad-playlist-input { flex: 1; height: 34px; padding: 0 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 7px; color: #111827; font: 12px/1 monospace; outline: none; }
.squad-playlist-input:focus { border-color: #E30613; }
.squad-playlist-select { flex: 1; height: 34px; padding: 0 8px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 7px; color: #111827; font: 13px/1 'Inter', sans-serif; outline: none; }
.squad-add-form { margin-top: 10px; padding: 14px; background: #f9fafb; border: 1.5px dashed #e5e7eb; border-radius: 8px; display: flex; flex-direction: column; gap: 10px; }
.squad-add-form input[type="text"] { height: 36px; padding: 0 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 7px; color: #111827; font: 13px/1 'Inter', sans-serif; outline: none; width: 100%; }
.squad-add-form input[type="text"]:focus { border-color: #E30613; }
.muted-small { font-size: 12px; color: #9ca3af; }

/* ── Danger zone ─────────────────────────────────────────────────────────── */
.danger-zone { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(220,38,38,.12); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.danger-label { font-size: 13px; color: #9ca3af; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty { color: #9ca3af; font-size: 13px; padding: 28px 20px; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.dash-section { margin-bottom: 28px; }
.dash-section-title { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 10px; }
.dash-table { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.dash-table-head {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr .9fr;
  padding: 10px 20px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
}
.dash-table-head-tenant { grid-template-columns: 1.6fr .7fr .9fr .7fr .9fr; }
.dash-table-head > div { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; }
.dash-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr .9fr;
  align-items: center; padding: 12px 20px; gap: 8px;
  border-bottom: 1px solid #f3f4f6; font-size: 13px; color: #374151;
}
.dash-row-tenant { grid-template-columns: 1.6fr .7fr .9fr .7fr .9fr; }
.dash-row:last-child { border-bottom: none; }
.dash-row .muted { color: #9ca3af; }
.dash-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; display: inline-block; }
.dash-badge.ok { color: #16a34a; background: #f0fdf4; }
.dash-badge.warn { color: #b45309; background: #fffbeb; }

/* ── Activity feed ────────────────────────────────────────────────────────── */
.activity-feed { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.activity-row { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f3f4f6; }
.activity-row:last-child { border-bottom: none; }
.activity-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #9ca3af; flex-shrink: 0; }
.activity-row.warn .activity-dot { background: #d97706; }
.activity-body { flex: 1; min-width: 0; }
.activity-msg { font-size: 13px; color: #111827; line-height: 1.4; }
.activity-meta { margin-top: 3px; font-size: 11px; color: #9ca3af; display: flex; align-items: center; gap: 10px; }
.activity-detail-btn { border: none; background: none; padding: 0; font-size: 11px; color: #E30613; cursor: pointer; text-decoration: underline; }
.activity-detail { margin-top: 6px; padding: 8px 10px; background: #f9fafb; border-radius: 6px; font: 11px/1.5 monospace; color: #6b7280; white-space: pre-wrap; word-break: break-word; }
