:root {
  --bg: #0b0a14;
  --surface: rgba(24, 18, 43, 0.85);
  --border: rgba(168, 85, 247, 0.22);
  --purple: #7c3aed;
  --purple-bright: #a855f7;
  --gold: #ffb800;
  --emerald: #10b981;
  --crimson: #ef4444;
  --text: #f8fafc;
  --muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: radial-gradient(circle at top right, #1f113a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(13, 10, 26, 0.94);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; background: #fff; }
.brand-name { font-size: 18px; font-weight: 800; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav-list { display: flex; flex-direction: column; gap: 8px; }
.nav-btn {
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn.is-active, .nav-btn:hover {
  background: rgba(124, 58, 237, 0.16);
  color: var(--text);
  border-color: var(--border);
}

.sidebar-foot { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.guardrail-pill {
  background: rgba(255, 184, 0, 0.14);
  color: var(--gold);
  border: 1px solid rgba(255, 184, 0, 0.35);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.main { padding: 24px 28px 80px; max-width: 1200px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--purple-bright); text-transform: uppercase; margin-bottom: 4px; }
.page-title { font-size: 24px; font-weight: 800; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.btn-ghost { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-top { display: flex; justify-content: space-between; align-items: center; }
.channel-name { font-weight: 700; font-size: 15px; }
.channel-handle { font-size: 13px; color: var(--gold); font-weight: 600; text-decoration: none; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge-emerald { background: rgba(16, 185, 129, 0.16); color: var(--emerald); }
.badge-gold { background: rgba(255, 184, 0, 0.16); color: var(--gold); }
.badge-purple { background: rgba(168, 85, 247, 0.18); color: var(--purple-bright); }
.badge-crimson { background: rgba(239, 68, 68, 0.16); color: var(--crimson); }

.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 18px; font-weight: 800; }

.rec-question { font-size: 16px; font-weight: 700; line-height: 1.45; margin-bottom: 14px; }
.rec-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.rec-opt { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 10px 12px; border-radius: 10px; font-size: 13px; }

.caption-box { margin-bottom: 18px; }
.caption-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.caption-actions { display: flex; gap: 8px; align-items: center; }
.select-sm { background: #141026; color: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.caption-textarea {
  width: 100%;
  background: rgba(10, 8, 20, 0.8);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
}

.card-preview-row, .cards-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.card-item {
  background: rgba(10, 8, 20, 0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-item img { width: 100%; border-radius: 10px; object-fit: cover; background: #160c2d; }
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

.schedule-list, .history-list { display: flex; flex-direction: column; gap: 12px; }
.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 14px 16px;
  border-radius: 14px;
  flex-wrap: wrap;
}
.row-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.row-sub { font-size: 12px; color: var(--muted); }
.row-link { color: var(--gold); font-weight: 700; font-size: 12px; text-decoration: none; }

.mobile-nav { display: none; }

.toast {
  position: fixed;
  bottom: 78px;
  right: 20px;
  background: #1e1638;
  border: 1px solid var(--gold);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 99;
}
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px 14px 86px; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(13, 10, 26, 0.96);
    border-top: 1px solid var(--border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .m-nav-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 4px;
    border-radius: 10px;
  }
  .m-nav-btn.is-active { background: rgba(124, 58, 237, 0.22); color: var(--gold); }
}
