/* =========================================================================
   DESIGN SYSTEM ADAPTIF: MONSTER AI (Crimson Obsidian) & ARJUNA AI (Spatial Glass)
   ========================================================================= */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --transition: 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tema Default Dark — Arjuna AI (Spatial Obsidian + Indigo/Cyan) */
html[data-theme="dark"] {
  --bg-base: #090d16;
  --bg-elevated: rgba(17, 24, 39, 0.72);
  --bg-solid: #111827;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-1: #6366f1;
  --accent-2: #06b6d4;
  --accent-glow: rgba(99, 102, 241, 0.32);
  --bubble-user: linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(6, 182, 212, 0.16));
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* Tema Khusus Monster AI (Stealth Matte Black + Crimson/Amber) */
html[data-mode="monster"][data-theme="dark"] {
  --bg-base: #070709;
  --bg-elevated: rgba(18, 16, 20, 0.78);
  --bg-solid: #121014;
  --accent-1: #e11d48;
  --accent-2: #f59e0b;
  --accent-glow: rgba(225, 29, 72, 0.35);
  --bubble-user: linear-gradient(135deg, rgba(225, 29, 72, 0.24), rgba(245, 158, 11, 0.15));
}

/* Tema Terang (Frosted Light Studio) */
html[data-theme="light"] {
  --bg-base: #f3f6fb;
  --bg-elevated: rgba(255, 255, 255, 0.84);
  --bg-solid: #ffffff;
  --bg-hover: rgba(15, 23, 42, 0.05);
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-1: #4f46e5;
  --accent-2: #0891b2;
  --accent-glow: rgba(79, 70, 229, 0.22);
  --bubble-user: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(8, 145, 178, 0.10));
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);
}

html[data-mode="monster"][data-theme="light"] {
  --accent-1: #be123c;
  --accent-2: #d97706;
  --accent-glow: rgba(190, 18, 60, 0.22);
  --bubble-user: linear-gradient(135deg, rgba(190, 18, 60, 0.12), rgba(217, 119, 6, 0.10));
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Scrollbar Halus */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* =========================================================================
   LATAR AURORA ANIMASI & GLASSMORPHISM
   ========================================================================= */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.28;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 520px;
  height: 520px;
  top: -140px;
  left: -100px;
  background: radial-gradient(circle, var(--accent-1), transparent 70%);
}

.orb-2 {
  width: 480px;
  height: 480px;
  bottom: -160px;
  right: -80px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  animation-delay: -6s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border-subtle) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, black 15%, transparent 75%);
  opacity: 0.35;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.14); }
}

.glass-panel {
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
}

.animate-scale-in {
  animation: scaleIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================================================
   TOMBOL & INPUT MODERN
   ========================================================================= */
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.88rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--border-subtle); }

.btn-full { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(239, 68, 68, 0.12); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn svg, .pill-btn svg, .tool-btn svg, .btn-primary svg, .btn-secondary svg { width: 17px; height: 17px; stroke-width: 1.9; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: var(--bg-hover);
  transition: var(--transition);
}
.pill-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.pill-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* =========================================================================
   LAYAR AUTH (LOGIN / REGISTER)
   ========================================================================= */
.auth-screen {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 34px 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-logo-wrap { text-align: center; margin-bottom: 24px; }
.brand-orb {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 10px 30px var(--accent-glow);
}
.brand-orb.sm { width: 38px; height: 38px; margin: 0; border-radius: 12px; }
.auth-logo-wrap h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-subtitle { font-size: 0.86rem; color: var(--text-secondary); margin-top: 6px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-hover);
  margin-bottom: 20px;
}
.auth-tab {
  padding: 8px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}
.auth-tab.active { background: var(--bg-solid); color: var(--text-primary); }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrap svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
}
.input-icon-wrap input { padding-left: 40px !important; }

input[type="text"], input[type="password"], input[type="number"], textarea, .modern-select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] textarea,
html[data-theme="light"] .modern-select {
  background: rgba(255, 255, 255, 0.92);
}

input:focus, textarea:focus, .modern-select:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.83rem;
  margin-bottom: 14px;
}

/* =========================================================================
   SHELL APLIKASI UTAMA & SIDEBAR
   ========================================================================= */
.app-shell {
  position: relative;
  z-index: 2;
  display: flex;
  height: 100%;
  width: 100%;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  border-top: none;
  border-bottom: none;
  border-left: none;
  z-index: 30;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
}
.brand-identity { display: flex; align-items: center; gap: 11px; }
.brand-title { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.02em; }
.mode-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
}

.sidebar-actions { padding: 0 14px 12px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--bubble-user);
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--border-strong);
}

.history-section {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}
.history-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 8px 8px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.session-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.session-item.active { background: var(--bg-hover); color: var(--text-primary); font-weight: 600; border-left: 3px solid var(--accent-1); }
.session-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-del { opacity: 0; color: var(--text-muted); transition: var(--transition); }
.session-item:hover .session-del { opacity: 1; }
.session-del:hover { color: var(--danger); }

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  flex-shrink: 0;
}
.user-name { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.footer-btns { display: flex; gap: 4px; }

/* =========================================================================
   MAIN AREA & TOPBAR
   ========================================================================= */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topbar {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-top: none;
  border-left: none;
  border-right: none;
  z-index: 15;
}

.topbar-left, .topbar-right, .topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-picker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.picker-icon { width: 16px; height: 16px; color: var(--accent-1); flex-shrink: 0; }
.modern-select { width: auto; min-width: 210px; padding: 7px 12px; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.modern-select.compact { min-width: 155px; font-weight: 500; }
.modern-select.full { width: 100%; }

.model-badges { display: flex; gap: 5px; }
.badge-pill {
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-vision { background: rgba(6, 182, 212, 0.16); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.35); }
.badge-thinking { background: rgba(139, 92, 246, 0.16); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.35); }
.badge-uncensored { background: rgba(225, 29, 72, 0.18); color: #fb7185; border: 1px solid rgba(225, 29, 72, 0.42); }
.badge-active { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.badge-off { background: rgba(239, 68, 68, 0.16); color: #f87171; }

/* =========================================================================
   WORKSPACE CHAT & ARTIFACTS SPLIT PANEL
   ========================================================================= */
.workspace-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-split-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.chat-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Layar Sambutan */
.welcome-hero {
  margin: auto;
  max-width: 720px;
  text-align: center;
  padding: 20px 10px;
  animation: scaleIn 0.35s ease;
}
.hero-orb {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 14px 42px var(--accent-glow);
  animation: pulseOrb 3.5s ease-in-out infinite;
}
.hero-orb svg { width: 32px; height: 32px; }
@keyframes pulseOrb {
  0%, 100% { transform: scale(1); box-shadow: 0 14px 40px var(--accent-glow); }
  50% { transform: scale(1.05); box-shadow: 0 18px 55px var(--accent-glow); }
}

.welcome-hero h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 10px; }
.welcome-hero p { font-size: 0.94rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 28px; }

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: left;
}
.quick-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.quick-card svg { width: 20px; height: 20px; color: var(--accent-1); flex-shrink: 0; margin-top: 2px; }
.quick-card strong { display: block; font-size: 0.88rem; margin-bottom: 3px; }
.quick-card span { font-size: 0.78rem; color: var(--text-secondary); }
.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-1);
  box-shadow: 0 10px 28px var(--accent-glow);
}

/* Gelembung Pesan Chat */
.message-row {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  gap: 14px;
  animation: fadeUp 0.22s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
}
.message-row.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.message-row.user .msg-avatar {
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.msg-body { flex: 1; min-width: 0; max-width: 88%; }
.message-row.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

.msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.65;
  font-size: 0.94rem;
  word-wrap: break-word;
}
.message-row.user .msg-bubble {
  background: var(--bubble-user);
  border: 1px solid var(--border-strong);
  border-top-right-radius: 4px;
}
.message-row.assistant .msg-bubble {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 4px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.msg-attachments img {
  max-width: 240px;
  max-height: 180px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  object-fit: cover;
}
.doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
}

/* Thinking Accordion (Ala Claude / DeepSeek) */
.thinking-box {
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.thinking-box summary {
  padding: 9px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.thinking-content {
  padding: 0 14px 12px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  max-height: 260px;
  overflow-y: auto;
}

/* Markdown Styling */
.markdown-body p { margin-bottom: 10px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 14px 0 8px; font-weight: 700; }
.markdown-body ul, .markdown-body ol { margin: 8px 0 12px 22px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.86rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border-strong); padding: 8px 10px; text-align: left; }
.markdown-body th { background: var(--bg-hover); }
.markdown-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-hover);
}

.code-block-wrap {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0d1117;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #9ca3af;
}
.code-block-actions { display: flex; gap: 6px; }
.code-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 0.74rem;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.08);
  transition: var(--transition);
}
.code-action-btn:hover { background: var(--accent-1); color: #fff; }
.code-block-wrap pre { margin: 0; padding: 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.55; }

/* Animasi Kursor Mengetik */
.typing-dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-1);
  animation: bounceDot 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* =========================================================================
   COMPOSER INPUT (AURORA BORDER SAAT STREAMING)
   ========================================================================= */
.composer-wrapper {
  padding: 10px 20px 16px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

.composer-box {
  border-radius: 20px;
  padding: 12px 14px 10px;
  box-shadow: var(--shadow-lg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.composer-box:focus-within {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-lg);
}
.composer-box.generating {
  border-color: var(--accent-2);
  box-shadow: 0 0 26px var(--accent-glow);
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.attach-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
}
.attach-chip img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.attach-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#chat-input {
  width: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  resize: none;
  padding: 4px 4px 10px;
  max-height: 190px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}
.composer-tools-left, .composer-tools-right { display: flex; align-items: center; gap: 6px; }

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.tool-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tool-btn.highlight-tool {
  background: var(--bubble-user);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.tool-btn.recording {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  animation: pulseOrb 1.2s infinite;
}

.send-btn, .stop-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: var(--transition);
}
.send-btn { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); box-shadow: 0 5px 16px var(--accent-glow); }
.send-btn:hover { transform: scale(1.06); }
.stop-btn { background: var(--danger); }

.incognito-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--warning);
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(245, 158, 11, 0.14);
}
.composer-hint { text-align: center; font-size: 0.73rem; color: var(--text-muted); margin-top: 8px; }
.composer-hint kbd {
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

/* =========================================================================
   PANEL KANAN: CANVAS / ARTIFACTS
   ========================================================================= */
.canvas-panel {
  width: 46%;
  min-width: 380px;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  border-top: none;
  border-right: none;
  border-bottom: none;
  animation: slideInRight 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.canvas-title-group { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.88rem; min-width: 0; }
.canvas-title-group span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-tabs { display: flex; gap: 4px; background: var(--bg-hover); padding: 3px; border-radius: 9px; }
.canvas-tab { padding: 5px 11px; border-radius: 7px; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.canvas-tab.active { background: var(--bg-solid); color: var(--text-primary); }
.canvas-actions { display: flex; gap: 4px; }

.canvas-body { flex: 1; min-height: 0; position: relative; background: #fff; }
.canvas-iframe { width: 100%; height: 100%; border: none; background: #fff; }
.canvas-mermaid { width: 100%; height: 100%; overflow: auto; padding: 24px; background: #0f172a; display: flex; align-items: center; justify-content: center; }
.canvas-code { width: 100%; height: 100%; overflow: auto; padding: 16px; background: #0d1117; color: #e5e7eb; font-family: var(--font-mono); font-size: 0.83rem; }

/* =========================================================================
   ADMIN DASHBOARD (TOKEN LEDGER, SAKELAR MODEL & KUOTA USER)
   ========================================================================= */
.admin-view { overflow-y: auto; padding: 26px 24px 48px; }
.admin-container { max-width: 1180px; width: 100%; margin: 0 auto; }

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.admin-header h2 { font-size: 1.45rem; font-weight: 700; margin-bottom: 4px; }
.admin-header p { font-size: 0.88rem; color: var(--text-secondary); max-width: 640px; }
.admin-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card { padding: 20px; border-radius: var(--radius-md); }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 10px; }
.stat-label svg { width: 16px; height: 16px; color: var(--accent-1); }
.stat-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-value.accent {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 14px;
}
.section-heading h3 { font-size: 1.05rem; font-weight: 700; }
.section-note { font-size: 0.78rem; color: var(--text-muted); }

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.model-card {
  padding: 18px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}
.model-card.disabled-card { opacity: 0.62; border-style: dashed; }
.model-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-card-title { font-weight: 700; font-size: 0.96rem; margin-bottom: 3px; }
.model-card-slug { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted); word-break: break-all; }

.token-meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: var(--bg-hover);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-fill.high { background: linear-gradient(90deg, #10b981, #06b6d4); }
.progress-fill.mid { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-fill.low { background: linear-gradient(90deg, #ef4444, #f43f5e); }

.model-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* Sakelar Toggle Switch Modern */
.switch-wrap, .toggle-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle-inline { padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 500; }
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 99px;
  background: var(--border-strong);
  transition: var(--transition);
  flex-shrink: 0;
}
.switch-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: var(--transition);
}
.switch-input:checked + .switch-slider { background: var(--success); }
.switch-input:checked + .switch-slider::after { transform: translateX(20px); }

/* Tabel Modern */
.table-card { border-radius: var(--radius-md); overflow-x: auto; }
.modern-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.modern-table th, .modern-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.modern-table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.modern-table tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }

/* =========================================================================
   MODALS & SCREENSHOT CROPPER
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-dialog {
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-dialog.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title-row { display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-secondary); cursor: pointer; }

.preset-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.preset-chip {
  padding: 6px 11px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  transition: var(--transition);
}
.preset-chip:hover { border-color: var(--accent-1); color: var(--accent-1); }
.preset-chip.accent { background: var(--bubble-user); border-color: var(--accent-1); }

.modern-range { width: 100%; accent-color: var(--accent-1); }
.range-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* Screenshot Cropper */
.screenshot-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.toolbar-hint { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.screenshot-canvas-wrap {
  flex: 1;
  min-height: 360px;
  max-height: 62vh;
  background: #050507;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 14px;
}
#screenshot-canvas {
  max-width: 100%;
  max-height: 58vh;
  cursor: crosshair;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #fff;
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

/* =========================================================================
   RESPONSIVE MOBILE & TABLET
   ========================================================================= */
.mobile-only { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 25; }

@media (max-width: 920px) {
  .mobile-only { display: inline-flex; }
  .hide-sm { display: none; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .quick-prompts, .form-row-2, .checkbox-grid { grid-template-columns: 1fr; }
  .modern-select { min-width: 145px; }
  .modern-select.compact { display: none; }
  .canvas-panel {
    position: fixed;
    inset: 62px 0 0 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    z-index: 20;
  }
}