:root {
  --bg: #06060b;
  --bg-card: rgba(14, 14, 22, 0.75);
  --bg-hover: rgba(22, 22, 36, 0.9);
  --border: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(168, 85, 247, 0.35);
  --text: #f0f0f8;
  --text-muted: #8b8ba8;
  --primary: #a855f7;
  --primary-light: #c084fc;
  --accent: #22d3ee;
  --gold: #fbbf24;
  --success: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --sidebar-w: 270px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --gold-glow: rgba(251, 191, 36, 0.15);
  --cyan-glow: rgba(34, 211, 238, 0.12);
  --mono: "JetBrains Mono", monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Background effects */
.bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -10%; left: -5%;
}

.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #0891b2 0%, transparent 70%);
  bottom: 10%; right: 5%;
  animation-delay: -4s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
  top: 40%; left: 40%;
  animation-delay: -8s;
  opacity: 0.25;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent);
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 6px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.brand-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.4);
}

.brand-icon svg { width: 22px; height: 22px; color: #fff; }

.brand-block h1 { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.brand-block p { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(168,85,247,0.18), rgba(34,211,238,0.08));
  color: var(--primary-light);
  border-color: rgba(168, 85, 247, 0.25);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.1);
}

.sidebar-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.feature-item {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-item span { color: var(--gold); font-size: 10px; }

.sidebar-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-pill {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}

.stat-pill.accent {
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.06);
}

.stat-val { display: block; font-size: 15px; font-weight: 800; }
.stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 14px 6px 0;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.status-dot.pulse {
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 56px;
  max-width: 1280px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
  font-family: var(--mono);
}

.topbar h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff 30%, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar p { color: var(--text-muted); font-size: 15px; }

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  font-family: var(--mono);
  letter-spacing: 0.08em;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.chip-live, .chip-ver {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

.chip-live {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--success);
}

.chip-ver {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: var(--primary-light);
}

.live-tag::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

.panel { display: none; }
.panel.active { display: block; }

/* Steps */
.steps-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  padding: 0 4px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.step span {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--mono);
}

.step.active { color: var(--text); }
.step.active span {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
}

.step-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin: 0 12px;
  max-width: 60px;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-glow, .card-premium {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 24px 60px rgba(0,0,0,0.45);
}

.card-premium {
  background: linear-gradient(160deg, rgba(16,16,28,0.9), rgba(10,10,18,0.85));
  border: 1px solid rgba(255,255,255,0.06);
}

.card-premium:hover {
  border-color: rgba(168, 85, 247, 0.18);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.card-header h3 { font-size: 17px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.badge {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
}

.badge.glow.selected,
.badge.selected {
  background: rgba(168, 85, 247, 0.15);
  color: var(--primary-light);
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

.layout-grid { display: grid; gap: 20px; }

/* Template grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 12, 20, 0.6);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s;
  font: inherit;
  color: inherit;
}

.template-card:hover {
  border-color: rgba(168, 85, 247, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 24px rgba(168, 85, 247, 0.08);
}

.template-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 0 30px rgba(168, 85, 247, 0.2);
}

.template-card-accent { height: 3px; }

.template-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.template-card-body strong { font-size: 14px; font-weight: 700; }
.template-card-body span { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

.template-check {
  position: absolute;
  top: 14px; right: 14px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}

.template-check svg { width: 14px; height: 14px; }
.template-card.selected .template-check { display: flex; }

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 13px; font-weight: 600; }
.field span em { color: var(--danger); font-style: normal; }

.field input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 6, 12, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.field textarea {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 6, 12, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
  transition: all 0.2s;
  line-height: 1.55;
}

.field input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field small { font-size: 11px; color: var(--text-muted); }
.field small code {
  font-family: var(--mono);
  font-size: 10px;
  background: rgba(168, 85, 247, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.field-full { grid-column: 1 / -1; }

/* Content Engine */
.content-engine {
  padding: 0;
  background: linear-gradient(145deg, rgba(168,85,247,0.05), rgba(251,191,36,0.03));
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 14px;
  overflow: hidden;
}

.engine-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.engine-header strong { font-size: 14px; display: block; }
.engine-header small { font-size: 11px; color: var(--text-muted); }

.engine-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(6,6,12,0.5);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: all 0.2s;
}

.mode-tab:hover { border-color: rgba(168,85,247,0.3); }

.mode-tab.active {
  border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(34,211,238,0.06));
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.1);
}

.mode-icon { font-size: 22px; flex-shrink: 0; }
.mode-text strong { display: block; font-size: 13px; }
.mode-text small { font-size: 10px; color: var(--text-muted); }

.mode-panel { display: none; flex-direction: column; gap: 14px; }
.mode-panel.active { display: flex; }
.mode-panel.hidden { display: none !important; }

.hint-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.hint-box span:first-child { font-size: 18px; flex-shrink: 0; }
.hint-box strong { color: var(--gold); }
.hint-box.info {
  background: var(--cyan-glow);
  border: 1px solid rgba(34, 211, 238, 0.2);
}
.hint-box:not(.info) {
  background: var(--gold-glow);
  border: 1px dashed rgba(251, 191, 36, 0.3);
}

/* AI Panel legacy */
.ai-panel {
  padding: 0;
  background: linear-gradient(135deg, rgba(168,85,247,0.06), rgba(34,211,238,0.04));
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 14px;
  overflow: hidden;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.ai-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.ai-panel-head strong { font-size: 14px; display: block; }
.ai-panel-head small { font-size: 11px; color: var(--text-muted); }

.ai-options { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }

/* Switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 48px; height: 26px;
  margin-left: auto;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.25s;
  border: 1px solid var(--border);
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 2px; bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}

.switch input:checked + .switch-slider {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-color: transparent;
}

.switch input:checked + .switch-slider::before { transform: translateX(22px); }

/* Toggle chip */
.toggle-chip {
  display: flex;
  cursor: pointer;
}

.toggle-chip input { display: none; }

.toggle-chip-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6,6,12,0.5);
  width: 100%;
  transition: all 0.2s;
}

.toggle-chip input:checked + .toggle-chip-inner {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.06);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.08);
}

.toggle-chip-inner strong { font-size: 13px; }
.toggle-chip-inner small { font-size: 11px; color: var(--text-muted); }

.random-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px dashed rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.random-hint .dice { font-size: 20px; }
.random-hint strong { color: var(--gold); }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(168, 85, 247, 0.4);
}

.btn-generate {
  background: linear-gradient(135deg, #f59e0b, #ef4444, var(--primary));
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  color: #fff;
  padding: 14px 28px;
  box-shadow: 0 4px 24px rgba(245, 158, 11, 0.35);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.45);
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: rgba(168, 85, 247, 0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Result */
.result-card { margin-top: 4px; }
.result-actions { display: flex; gap: 8px; flex-shrink: 0; }

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-chip {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(6,6,12,0.6);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
}

.meta-chip strong { color: var(--text); font-family: var(--font); }

.result-ai {
  margin-bottom: 16px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(34,211,238,0.04));
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 12px;
}

.result-ai h4 {
  font-size: 10px;
  margin-bottom: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--mono);
}

.result-ai .ai-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.5;
}

.result-ai .ai-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

.result-ai .ai-topic {
  margin-top: 10px;
  font-size: 11px;
  color: var(--gold);
  font-family: var(--mono);
}

.preview-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  height: 500px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.2);
}

.preview-frame-wrap iframe { width: 100%; height: 100%; border: none; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(6,6,12,0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.history-item:hover { border-color: rgba(168, 85, 247, 0.2); }

.history-item-info strong { display: block; font-size: 14px; margin-bottom: 3px; }
.history-item-info span { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.history-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  padding: 16px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  max-width: 380px;
  animation: slideUp 0.3s ease;
  backdrop-filter: blur(12px);
}

.toast.success {
  background: rgba(16, 50, 36, 0.9);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.toast.error {
  background: rgba(50, 16, 16, 0.9);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 72px; padding: 16px 10px; }
  .brand-block p, .brand-block h1, .nav-item span:not(.nav-icon),
  .sidebar-footer span:not(.status-dot), .sidebar-stats { display: none; }
  .brand-block { justify-content: center; padding-bottom: 16px; }
  .nav-item { justify-content: center; padding: 12px; }
  .main { margin-left: 72px; padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 24px; }
  .steps-row { display: none; }
  .history-item { flex-direction: column; align-items: flex-start; }
}

/* ── Login page ── */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px 28px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 60px rgba(124, 58, 237, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
}

.login-logo svg { width: 24px; height: 24px; }

.login-brand h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.35;
  max-width: 200px;
}

.login-brand p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-head { margin-bottom: 24px; }

.login-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.login-head p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 13px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }

.login-field span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 50px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-wrap:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.login-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.login-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
}

.login-input-wrap input::placeholder { color: #5c5c78; }

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  margin-top: 6px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 28px rgba(168, 85, 247, 0.35);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(168, 85, 247, 0.45);
}

.login-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.login-foot code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.login-copy {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: #5c5c78;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.field-check input { accent-color: var(--primary); width: 16px; height: 16px; }

.deploy-check {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.15);
}

.ai-deploy { margin-top: 12px; font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.ai-deploy.ok { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.25); color: #6ee7b7; }
.ai-deploy.ok a { color: #34d399; }
.ai-deploy.err { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.25); color: #fca5a5; }

/* Bar Menu Atas */
.bar-menu-section {
  margin-top: 4px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(34, 211, 238, 0.05));
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.bar-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bar-menu-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-menu-title strong { font-size: 15px; display: block; }
.bar-menu-title small { color: var(--text-muted); font-size: 12px; }

.bar-menu-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.15);
  font-size: 16px;
}

.bar-menu-count {
  background: rgba(251, 191, 36, 0.12);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.25);
  font-size: 11px;
  padding: 4px 10px;
}

.bar-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.bar-menu-field small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.85;
}

.bar-menu-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.bar-menu-note code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.ai-bars {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}