/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:  260px;
  --bg:         #f4f4f5;
  --surface:    #ffffff;
  --border:     #e4e4e7;
  --text:       #18181b;
  --muted:      #71717a;
  --accent:     #2563eb;
  --accent-dk:  #1d4ed8;
  --green:      #16a34a;
  --green-bg:   #dcfce7;
  --amber:      #d97706;
  --amber-bg:   #fef3c7;
  --blue:       #2563eb;
  --blue-bg:    #dbeafe;
  --red:        #dc2626;
  --red-bg:     #fee2e2;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08);
}

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

/* ── Layout ── */
#layout {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #1c1c1e;
  color: #e5e5e7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #3a3a3c;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 12px;
  border-bottom: 1px solid #3a3a3c;
  flex-shrink: 0;
}

/* ── Logo lockup ── */
.logo-lockup { display: flex; align-items: center; gap: 6px; }
.logo-icon { width: 22px; height: 22px; flex-shrink: 0; }
.logo-arrow { width: 12px; height: 12px; flex-shrink: 0; }
.logo-text { font-weight: 700; font-size: 12px; letter-spacing: -0.3px; }

.guide-link { font-size: 11px; color: #a1a1aa; text-decoration: none; }
.guide-link:hover { color: #fff; }

.connect-box {
  padding: 10px 10px 8px;
  border-bottom: 1px solid #3a3a3c;
  flex-shrink: 0;
}
.connect-box input[type="text"] {
  width: 100%;
  padding: 7px 9px;
  background: #2c2c2e;
  border: 1px solid #48484a;
  border-radius: 6px;
  color: #e5e5e7;
  font-size: 12px;
  outline: none;
  margin-bottom: 6px;
}
.connect-box input[type="text"]:focus { border-color: var(--accent); }
.connect-box input[type="text"]::placeholder { color: #636366; }
.connect-box button {
  width: 100%;
  padding: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.connect-box button:hover { background: var(--accent-dk); }
.connect-box button:disabled { background: #48484a; cursor: not-allowed; }

/* ── Billing box ── */
.billing-box {
  padding: 8px 10px;
  border-bottom: 1px solid #3a3a3c;
  flex-shrink: 0;
  background: #2c2c2e;
}
.billing-status { font-size: 11px; color: #a1a1aa; margin-bottom: 6px; line-height: 1.4; }
.billing-status strong { color: #e5e5e7; }
.billing-actions { display: flex; flex-direction: column; gap: 6px; }
.billing-actions button { width: 100%; font-size: 11px; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.billing-hint { font-size: 10px; color: #f59e0b; margin-top: 8px; line-height: 1.35; }

/* ── Welcome modal + help button ─────────────────────────────────────── */
.welcome-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.welcome-modal.hidden { display: none; }
.welcome-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); }
.welcome-card {
  position: relative; z-index: 1;
  background: #1c1c1e; color: #e5e5e7;
  max-width: 560px; width: calc(100% - 40px);
  max-height: 86vh; overflow-y: auto;
  padding: 26px 30px;
  border-radius: 12px;
  border: 1px solid #3a3a3c;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.welcome-close { position: absolute; top: 10px; right: 14px; background: transparent; color: #8e8e93; border: none; font-size: 24px; cursor: pointer; line-height: 1; padding: 0; }
.welcome-close:hover { color: #e5e5e7; }
.welcome-card h2 { margin: 0 0 6px; font-size: 20px; }
.welcome-lead { color: #a1a1aa; margin: 0 0 16px; font-size: 13px; }
.welcome-steps { padding-left: 22px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.welcome-steps li { font-size: 13px; line-height: 1.5; color: #c7c7cc; }
.welcome-steps strong { color: #e5e5e7; }
.welcome-steps em { color: #e5e5e7; font-style: normal; font-weight: 500; }
.welcome-warning { display: inline-block; color: #f59e0b; font-size: 12px; margin-top: 3px; }
.welcome-footer { background: #2c2c2e; padding: 10px 14px; border-radius: 8px; font-size: 12px; color: #c7c7cc; margin: 14px 0 16px; }
.welcome-footer a { color: #60a5fa; }
.welcome-dismiss { width: 100%; }

.help-btn {
  position: fixed; bottom: 14px; left: 14px; z-index: 9000;
  width: 34px; height: 34px; border-radius: 50%;
  background: #2c2c2e; color: #e5e5e7;
  border: 1px solid #3a3a3c;
  font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
}
.help-btn:hover { background: #3a3a3c; }
.help-btn.hidden { display: none; }
.payment-overdue-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #dc2626;
  border-radius: 4px;
  margin-left: 6px;
}

/* ── Sidebar search ── */
.sidebar-search {
  padding: 6px 10px;
  border-bottom: 1px solid #3a3a3c;
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  padding: 6px 9px;
  background: #2c2c2e;
  border: 1px solid #48484a;
  border-radius: 6px;
  color: #e5e5e7;
  font-size: 11px;
  outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-search input::placeholder { color: #636366; }

/* ── Bulk controls ── */
.bulk-controls {
  padding: 6px 10px;
  border-bottom: 1px solid #3a3a3c;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-select-label {
  font-size: 11px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.bulk-select-label input { accent-color: var(--accent); }
.bulk-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.bulk-actions button { font-size: 10px; padding: 3px 7px; color: #a1a1aa; border-color: #48484a; }
.bulk-actions button:hover { color: #fff; border-color: #636366; background: #2c2c2e; }

.sidebar-msg { font-size: 11px; margin-top: 6px; }
.sidebar-msg.error   { color: #f87171; }
.sidebar-msg.success { color: #4ade80; }

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.sidebar-empty { padding: 12px 14px; color: #636366; font-size: 12px; }

.ch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 6px;
  transition: background 0.1s;
}
.ch-item:hover    { background: #2c2c2e; }
.ch-item.active   { background: #3a3a3c; }
.ch-checkbox { width: 14px; height: 14px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.ch-avatar-wrap { flex-shrink: 0; }
.ch-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.ch-header-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.ch-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; flex-shrink: 0;
}
.ch-name  { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.ch-stats { font-size: 10px; color: #636366; }

/* Status dots */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.healthy  { background: var(--green); }
.status-dot.warning  { background: var(--amber); }
.status-dot.rejected { background: var(--red); }

.health-bar {
  padding: 8px 12px;
  font-size: 10px;
  color: #636366;
  border-top: 1px solid #3a3a3c;
  flex-shrink: 0;
}

/* ── Main ── */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ── Alert banner ── */
.alert-banner {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-item {
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.alert-item.warning {
  background: rgba(245,158,11,.06);
  border-color: rgba(245,158,11,.3);
}
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-dot.rejected { background: var(--red); }
.alert-dot.warning { background: var(--amber); }
.alert-text { flex: 1; color: var(--text); }

/* ── Analytics panel ── */
.analytics-panel {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.analytics-card {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
}
.analytics-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.analytics-next { font-size: 11px; font-weight: 500; color: var(--text); line-height: 1.3; }
.analytics-sub { font-size: 10px; color: var(--muted); }
.analytics-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 2px; }

/* ── Global search ── */
.global-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.search-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.search-header h3 { font-size: 14px; }
.search-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-filters select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text);
}

.empty-state {
  max-width: 400px;
  margin: 80px auto;
  text-align: center;
}
.empty-icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
  margin: 0 auto 16px;
}
.empty-state h2 { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p  { color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-state a  { color: var(--accent); }

/* ── Channel header ── */
.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.channel-header h2  { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.channel-header .handle { font-size: 12px; color: var(--muted); }

/* ── Health Dashboard ── */
.health-dashboard { margin-bottom: 14px; }
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.health-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.health-value { font-size: 13px; font-weight: 500; }
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-badge.healthy  { background: var(--green-bg); color: var(--green); }
.status-badge.warning  { background: var(--amber-bg); color: var(--amber); }
.status-badge.rejected { background: var(--red-bg);   color: var(--red);   }

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
}
.stat-chip .num  { font-weight: 700; font-size: 14px; }
.stat-chip.total         { background: #f4f4f5; }
.stat-chip.unscheduled   { background: #f4f4f5; }
.stat-chip.scheduled     { background: var(--amber-bg); border-color: #fcd34d; color: var(--amber); }
.stat-chip.published     { background: var(--green-bg); border-color: #86efac; color: var(--green); }
.stat-chip.rejected      { background: var(--red-bg);   border-color: #fca5a5; color: var(--red);   }

/* ── Tabs ── */
.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text); }

.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

/* ── Schedule dashboard ── */
.schedule-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.dash-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.dash-column h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 10px;
}
.dash-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  align-items: center;
}
.dash-item:last-child { border-bottom: none; }
.dash-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-channel { color: var(--muted); font-size: 10px; }
.dash-time { color: var(--accent); font-size: 10px; white-space: nowrap; flex-shrink: 0; }

/* ── Schedule type selector ── */
.schedule-type-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 500;
}
.schedule-type-selector select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface);
}

/* ── Schedule setup ── */
.schedule-setup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  max-width: 520px;
  margin-bottom: 16px;
}
.schedule-setup h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12px; margin-bottom: 16px; line-height: 1.5; }

.schedule-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row input[type="datetime-local"],
.form-row textarea,
.form-row select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: inherit;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; }
.field-hint { font-size: 11px; color: var(--muted); }

.sched-preview {
  background: var(--blue-bg);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #1d4ed8;
}

.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Auto-publish setup ── */
.auto-publish-setup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  max-width: 520px;
  margin-bottom: 16px;
}
.auto-publish-setup h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.auto-publish-form { display: flex; flex-direction: column; gap: 12px; }
.auto-publish-status { margin-top: 4px; }

.form-row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Schedule list ── */
.schedule-list { display: flex; flex-direction: column; gap: 4px; }
.sched-section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 12px 0 4px;
}
.sched-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.sched-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  width: 50px;
  flex-shrink: 0;
  text-align: center;
}
.sched-thumb {
  width: 72px; height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
  flex-shrink: 0;
}
.sched-title {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched-actions { display: flex; gap: 4px; flex-shrink: 0; }
.schedule-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ── Dual Catalog ── */
.dual-catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.catalog-column { display: flex; flex-direction: column; }
.catalog-column-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.catalog-column-header h3 { font-size: 13px; font-weight: 600; }
.catalog-list.scrollable { max-height: 70vh; overflow-y: auto; }

.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.pill.active       { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill:hover:not(.active) { border-color: #a1a1aa; color: var(--text); }

.catalog-list { display: flex; flex-direction: column; gap: 6px; }

.video-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.video-thumb {
  width: 100px; height: 56px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg);
  flex-shrink: 0;
}
.video-info { flex: 1; min-width: 0; }
.video-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.video-actions { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* ── Pipeline tracker ── */
.pipeline { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.pipeline-step {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}
.pipeline-step.active { background: var(--green-bg); color: var(--green); }
.pipeline-step.current { background: var(--accent); color: #fff; }
.pipeline-step.rejected-step { background: var(--red-bg); color: var(--red); }
.pipeline-connector { width: 8px; height: 1px; background: var(--border); flex-shrink: 0; }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.unscheduled { background: #f4f4f5;           color: #52525b; }
.badge.scheduled   { background: var(--amber-bg);   color: var(--amber); }
.badge.published   { background: var(--green-bg);   color: var(--green); }
.badge.rejected    { background: var(--red-bg);     color: var(--red); }
.badge.video       { background: var(--blue-bg);    color: var(--accent); }
.badge.short       { background: #faf5ff;           color: #7c3aed; }

/* ── Logs ── */
.logs-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.logs-toolbar select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text);
}
.logs-list { display: flex; flex-direction: column; gap: 4px; }
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.log-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.log-icon.success { background: var(--green-bg); color: var(--green); }
.log-icon.failed  { background: var(--red-bg);   color: var(--red); }
.log-icon.pending { background: var(--amber-bg); color: var(--amber); }
.log-content { flex: 1; min-width: 0; }
.log-action { font-size: 12px; font-weight: 500; text-transform: capitalize; }
.log-details { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.log-channel { color: var(--accent); }
.log-video { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.log-time { font-size: 10px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* ── Feed panel ── */
.feed-panel {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.feed-panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.feed-panel h4 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.feed-panel p  { color: var(--muted); font-size: 12px; }
.feed-section  { margin-top: 4px; }
.feed-url-row  { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.feed-url-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  color: var(--muted);
  outline: none;
  min-width: 0;
}

/* ── Feed validation ── */
.feed-validation {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
}
.val-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.val-dot.valid { background: var(--green); }
.val-dot.invalid { background: var(--red); }
.val-errors { padding-left: 20px; font-size: 11px; color: var(--red); margin-top: 4px; }
.val-errors li { margin-top: 2px; }

/* MSN Connection Status */
.msn-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.msn-status-card h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.msn-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.msn-status-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.msn-status-details code {
  font-size: 10px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
}
.msn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.msn-dot.connected { background: var(--green); }
.msn-dot.inactive { background: var(--amber); }
.msn-dot.never_fetched { background: var(--muted); }

.feed-info-box {
  background: var(--amber-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 16px 18px;
}
.feed-info-box h4 { color: var(--amber); }
.compliance-list {
  padding-left: 18px;
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.feed-info-box .note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--amber);
  border-top: 1px solid #fcd34d;
  padding-top: 8px;
}

.info-steps {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px 18px;
}
.info-steps ol {
  padding-left: 18px;
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.info-steps .note {
  margin-top: 10px;
  font-size: 11px;
  color: #1d4ed8;
  border-top: 1px solid #bfdbfe;
  padding-top: 8px;
}
.info-steps a { color: #1d4ed8; }

.sync-section, .danger-zone {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.danger-zone { border-color: #fca5a5; }

/* ── Buttons ── */
button {
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.12s;
}
button:hover    { background: var(--accent-dk); }
button:disabled { background: #d4d4d8; color: #a1a1aa; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.ghost:hover { background: #eff6ff; }

button.danger { background: var(--red); }
button.danger:hover { background: #b91c1c; }

button.ghost.danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
button.ghost.danger:hover { background: var(--red-bg); }

button.sm {
  padding: 4px 9px;
  font-size: 11px;
}

.text-btn {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 0;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
.text-btn:hover { background: transparent; }

/* ── Messages ── */
.success-msg { color: var(--green);  font-size: 12px; margin-top: 4px; }
.warning-msg { color: var(--yellow, #e2a832); font-size: 12px; margin-top: 4px; }
.error-msg   { color: var(--red);    font-size: 12px; margin-top: 4px; }
.muted       { color: var(--muted);  font-size: 12px; }
.hidden      { display: none !important; }

/* ── Cookie Upload ── */
#cookieTextarea {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
}
.char-count  { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal-box.modal-sm { max-width: 380px; }
.modal-box.modal-lg { max-width: 700px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 14px; font-weight: 600; }
.close-btn {
  background: transparent; border: none;
  color: var(--muted); font-size: 16px;
  padding: 2px 6px; cursor: pointer; line-height: 1;
  border-radius: 4px;
}
.close-btn:hover { background: var(--bg); color: var(--text); }
.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-actions { display: flex; gap: 8px; padding-top: 4px; }

/* ── Feed Preview ── */
.preview-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.preview-info { font-size: 12px; margin-bottom: 8px; }
.preview-rendered { display: flex; flex-direction: column; gap: 6px; }
.preview-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.preview-item:last-child { border-bottom: none; }
.preview-thumb { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: var(--bg); flex-shrink: 0; }
.preview-title { font-size: 12px; font-weight: 500; }
.xml-preview {
  background: #1c1c1e;
  color: #e5e5e7;
  padding: 16px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  overflow-x: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}
.spinner.dk {
  border-color: rgba(0,0,0,.12);
  border-top-color: var(--muted);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  body { overflow: auto; }
  #layout { flex-direction: column; height: auto; }
  #sidebar { width: 100%; min-width: unset; max-height: none; }
  #main { padding: 14px; }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
  .dual-catalog { grid-template-columns: 1fr; }
  .schedule-dashboard { grid-template-columns: 1fr; }
  .analytics-panel { gap: 6px; }
  .analytics-card { min-width: 70px; padding: 8px; }

  /* Tab nav: horizontally scroll rather than wrap. */
  .tab-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; padding: 8px 12px; }

  /* Channel header: stack avatar + text cleanly. */
  .channel-header { flex-wrap: wrap; gap: 10px; }

  /* Feed URL inputs: full width when they wrap onto their own line. */
  .feed-url-row { flex-direction: column; align-items: stretch; }
  .feed-url-row input, .feed-url-row button { width: 100%; }

  /* Bulk controls: stack the action buttons. */
  .bulk-controls { flex-direction: column; align-items: stretch; }
  .bulk-actions { flex-wrap: wrap; }

  /* Video card actions: stack under the title instead of overflowing. */
  .video-actions { justify-content: flex-start; width: 100%; margin-top: 6px; }

  /* Catalog paste URL row. */
  .catalog-url-row { flex-direction: column; gap: 6px; }
  .catalog-url-row input, .catalog-url-row button { width: 100%; }

  /* Drip feed and download settings rows that were side-by-side. */
  .drip-feed-card .form-row-inline,
  .form-row-inline { flex-wrap: wrap; gap: 8px; }

  /* Admin: user card actions stack. */
  .admin-user-btns { flex-wrap: wrap; }
  .admin-user-billing { flex-direction: column; align-items: stretch; }

  /* Danger zone buttons stack full-width. */
  .danger-zone button { width: 100%; }
  .danger-zone button + button { margin-top: 8px; }

  /* Welcome modal: use more screen, tighter padding. */
  .welcome-card { max-height: 92vh; padding: 20px 18px; width: calc(100% - 20px); }
  .welcome-card h2 { font-size: 18px; }
  .welcome-steps { padding-left: 20px; }
  .welcome-steps li { font-size: 13px; }

  /* Help button: slightly smaller and out of the way. */
  .help-btn { width: 32px; height: 32px; font-size: 14px; bottom: 10px; left: 10px; }
}

/* Phone-sized screens. */
@media (max-width: 480px) {
  .health-grid { grid-template-columns: 1fr; }
  .stats-bar .stat-chip { font-size: 11px; padding: 4px 10px; }
  .channel-header h2 { font-size: 1rem; }

  /* Billing box sits nicely in a narrower sidebar. */
  .billing-status { font-size: 10px; }
  .billing-actions button { font-size: 11px; padding: 7px 8px; }

  /* Welcome modal nearly fullscreen on phones. */
  .welcome-card { padding: 18px 14px; max-height: 94vh; }
}

/* ── Download Section ── */
.download-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.download-section h4 { margin-bottom: 6px; }
.download-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.download-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ── Compliance Issues (per-video) ── */

.compliance-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.compliance-fail {
  font-size: 11px;
  color: var(--red);
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 4px;
  padding: 1px 6px;
}
.compliance-age {
  font-size: 11px;
  color: var(--amber);
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ── Import Video ── */

.import-video-bar {
  margin-bottom: 14px;
}
.import-video-form {
  display: flex;
  gap: 8px;
}
.import-video-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
}
.import-video-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.import-video-form button {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.import-video-form button:hover { background: var(--accent-dk); }
.import-video-form button:disabled { opacity: .5; }
.import-msg {
  font-size: 12px;
  margin-top: 6px;
  padding: 4px 0;
}
.import-msg.success { color: var(--green); }
.import-msg.error { color: var(--red); }

/* ── Drip Feed ── */

.drip-feed-setup {
  padding: 16px 0;
}
.drip-feed-setup h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.drip-feed-setup .hint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.drip-feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.drip-feed-status {
  margin-top: 10px;
  font-size: 13px;
}

.drip-feed-info {
  background: var(--blue-bg);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.drip-feed-info h4 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.drip-feed-info ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.drip-feed-info li { margin-bottom: 2px; }

/* ── Admin Sidebar Button ── */

.admin-sidebar-btn {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.admin-sidebar-btn button {
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.admin-sidebar-btn button:hover { opacity: .9; }

/* ── Admin Panel ── */

.admin-panel {
  padding: 24px;
  overflow-y: auto;
  max-height: 100vh;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-panel-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.admin-section h3 {
  font-size: 15px;
  margin-bottom: 14px;
  font-weight: 700;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 700px) { .admin-form-grid { grid-template-columns: 1fr; } }

.admin-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.admin-field input[type="text"],
.admin-field input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
}
.admin-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}

.admin-channel-perms { margin-bottom: 14px; }
.admin-channel-perms h4 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.admin-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 4px;
}

.admin-perm-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.admin-perm-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.admin-perm-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.admin-perm-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-perm-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface);
  min-width: 100px;
  flex-shrink: 0;
}

.admin-submit-btn {
  padding: 9px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.admin-submit-btn:hover { background: var(--accent-dk); }
.admin-submit-btn:disabled { opacity: .5; }

/* User cards in admin panel */
.admin-user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg);
}

.admin-user-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-user-header strong { font-size: 14px; }

.admin-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.admin-role-badge.sa { background: #fef3c7; color: #92400e; }
.admin-role-badge.usr { background: var(--blue-bg); color: var(--blue); }

.admin-perm-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 4px;
  background: var(--green-bg);
  color: var(--green);
  vertical-align: middle;
}

.admin-user-perms {
  margin-bottom: 10px;
}
.admin-user-perms h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}

.admin-user-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-user-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-resetpw {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-resetpw input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  width: 180px;
}

/* ── Auth Pages ── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: auto;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}
.auth-logo .logo-icon { width: 28px; height: 28px; }
.auth-logo .logo-arrow { width: 14px; height: 14px; }

.auth-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 13px;
}

.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.auth-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
  transition: border-color .15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--red-bg);
  border-radius: var(--radius);
}

.auth-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.auth-btn:hover { background: var(--accent-dk); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── User Menu (sidebar) ── */

.user-menu {
  position: relative;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: background .15s;
  gap: 6px;
}
.user-menu-toggle:hover { background: var(--bg); }

.user-display-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 100;
}

.user-dropdown-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}
.user-dropdown-role.superadmin { background: #fef3c7; color: #92400e; }
.user-dropdown-role.user { background: var(--blue-bg); color: var(--blue); }

.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  font-size: 12px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-item.danger { color: var(--red); background: none; }
.user-dropdown-item.danger:hover { background: var(--red-bg); color: var(--red); }

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ── Users Management Page ── */

.users-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  overflow: auto;
}

.users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.users-header h1 { font-size: 22px; }
.users-header-left { display: flex; align-items: center; gap: 16px; }
.users-header-right { display: flex; align-items: center; gap: 12px; font-size: 12px; }

.back-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

.users-add-section,
.users-list-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.users-add-section h2,
.users-list-section h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

.add-user-form .auth-btn {
  max-width: 200px;
}

/* Channel permissions grid */
.channel-perms-section {
  margin-bottom: 16px;
}
.channel-perms-section h3 { font-size: 14px; margin-bottom: 8px; }

.channel-perms-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.channel-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius);
  gap: 12px;
}

.channel-perm-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.channel-perm-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-perm-title {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.perm-select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface);
  min-width: 110px;
}

/* User cards */
.user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg);
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.user-card-header strong { font-size: 14px; }
.user-card-header .muted { font-size: 12px; }

.user-card-toggle {
  margin-bottom: 10px;
}

.user-card-perms {
  margin-bottom: 12px;
}
.user-card-perms h4 {
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.user-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.reset-pw-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
  flex-wrap: wrap;
}
.reset-pw-form input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  width: 220px;
}

/* Role badges */
.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.role-badge.superadmin { background: #fef3c7; color: #92400e; }
.role-badge.user { background: var(--blue-bg); color: var(--blue); }

.perm-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.perm-badge.add-channels { background: var(--green-bg); color: var(--green); }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 9999;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
