/* ============================================================
   Siesta — Design tokens (dark, lebih gelap dari revisi sebelumnya)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:         #070B14;
  --surface:    #0D131F;
  --surface-2:  #141B2B;
  --border:     #1A2436;
  --border-2:   #212C42;
  --text:       #E8EDF4;
  --text-2:     #7C8AA0;
  --text-3:     #414D63;
  --accent:     #81D4FA;
  --accent-dim: rgba(129, 212, 250, 0.12);
  --green:      #00E676;
  --red:        #FF5252;

  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  --font-brand: 'Bebas Neue', 'Impact', sans-serif;
  --font-body:  'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'Cascadia Code', 'Fira Code', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 0 1px rgba(129, 212, 250, 0.1), 0 8px 24px rgba(129, 212, 250, 0.08);

  /* ============================================================
     KOORDINAT TETAP — sumber kebenaran tunggal untuk ukuran
     komponen independen. Semua position:fixed di bawah memakai
     variabel ini, BUKAN dihitung otomatis dari flexbox/JS. */
  --sidebar-width: 280px;
  --top-bar-height: 56px;
  --search-bar-height: 52px;
}

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

html {
  height: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 20% 15%, rgba(129, 212, 250, 0.08), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(129, 212, 250, 0.05), transparent 45%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
textarea { font-family: inherit; }

/* ============================================================
   PRINSIP ARSITEKTUR:
   Setiap komponen berikut adalah position:fixed BERDIRI SENDIRI.
   Tidak ada parent wrapper bersama (.app dihapus total). Tidak ada
   flexbox/grid antar-komponen. Ukuran satu komponen TIDAK PERNAH
   mempengaruhi posisi komponen lain — semua koordinat dihitung dari
   variabel --*-height tetap di atas, bukan diukur runtime.
   ============================================================ */

/* ---------------- 1. SIDEBAR (independen) ---------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  max-width: 85vw;
  z-index: 100;
  background: rgba(13, 19, 31, 0.85);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-soft);
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 20px 8px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a8e4ff, var(--accent) 65%, #4FC3F7 100%);
  box-shadow: 0 0 14px rgba(129, 212, 250, 0.4);
  flex-shrink: 0;
  animation: logo-spin 50s linear infinite;
}
.brand-name { font-family: var(--font-brand); font-size: 20px; letter-spacing: 0.03em; color: var(--text); }

.icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-2);
  transition: background var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--accent-dim); color: var(--text); }

.new-chat-btn {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13.5px; font-weight: 500; margin-bottom: 20px; flex-shrink: 0;
  transition: background var(--transition-base), border-color var(--transition-base);
}
.new-chat-btn:hover { background: var(--accent-dim); border-color: var(--border-2); }

.history-section { flex: 1; overflow-y: auto; min-height: 0; }
.history-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-3); padding: 0 8px 8px 8px;
}
.history-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.history-item {
  padding: 9px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
}
.history-item:hover { background: var(--surface-2); color: var(--text); }
.history-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.history-empty { padding: 12px 10px; font-size: 12.5px; color: var(--text-3); font-style: italic; }

.sidebar-bottom { padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; flex-shrink: 0; }
.model-badge { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); }
.model-badge-text { display: flex; flex-direction: column; line-height: 1.3; }
.model-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.model-sub { font-size: 11px; color: var(--text-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-idle { background: var(--text-3); }
.dot-pulse { background: var(--accent); animation: pulse 2.2s infinite; }
.dot-live { background: var(--green); animation: pulse-live 2s ease-in-out infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(129, 212, 250, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(129, 212, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(129, 212, 250, 0); }
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
  50% { opacity: 0.6; box-shadow: 0 0 12px var(--green); }
}

/* ---------------- Akun (sidebar bottom, gaya ChatGPT/Gemini) ---------------- */

.account-section { margin-top: 8px; position: relative; }

.account-login-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 8px; border-radius: var(--radius-md); color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background var(--transition-base), color var(--transition-base);
}
.account-login-btn:hover { background: var(--surface-2); color: var(--text); }

.account-profile-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border-radius: var(--radius-md);
  transition: background var(--transition-base);
}
.account-profile-btn:hover { background: var(--surface-2); }

.account-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #a8e4ff, var(--accent) 65%, #4FC3F7 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #0B111E;
  overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; flex: 1;
}

.account-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  background: rgba(20, 27, 43, 0.92);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--border-2); border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft); padding: 6px;
  opacity: 0; transform: translateY(6px) scale(0.98); pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.account-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---------------- 2. TOP BAR (independen) ---------------- */
/* position:fixed top:0 — TIDAK PERNAH bergerak, tinggi tetap
   dari --top-bar-height, tidak bergantung pada elemen manapun. */

/* ---------------- app-main: kontainer flex utama ---------------- */
/* Menyatukan top-bar, search-bar, chat-scroll, composer dalam SATU
   aliran flex-column. Dikombinasikan dengan interactive-widget=
   resizes-content, browser akan memotong tinggi 100dvh kontainer ini
   secara resmi saat keyboard muncul — chat-scroll (flex:1) yang
   mengalah/mengecil, top-bar & composer tetap di posisi wajar tanpa
   memicu window panning (yang terjadi saat elemen fixed terisolasi). */

.app-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: relative;
}

@media (min-width: 1024px) {
  body.sidebar-open .app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left var(--transition-slow), width var(--transition-slow);
  }
}

/* ---------------- 2. TOP BAR (bagian dari flow app-main) ---------------- */

.top-bar {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: var(--top-bar-height);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(13, 19, 31, 0.8);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.top-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129, 212, 250, 0.35) 50%, transparent);
}

.header-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #a8e4ff, var(--accent) 65%, #4FC3F7 100%);
  box-shadow: 0 0 10px rgba(129, 212, 250, 0.3);
  overflow: hidden;
  animation: logo-spin 50s linear infinite;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-name {
  font-family: var(--font-brand);
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.header-spacer {
  flex: 1;
}

/* Status indicator — dipakai di header & model badge sidebar.
   Warna ditentukan oleh class status-online/status-offline/status-busy
   yang ditambahkan via JS berdasarkan data dari mea_product_status. */

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-dot-icon {
  color: var(--text-3);
  transition: color var(--transition-base);
}

.status-online .status-dot-icon {
  color: var(--green);
  filter: drop-shadow(0 0 4px rgba(0, 230, 118, 0.6));
}

.status-offline .status-dot-icon {
  color: var(--red);
  filter: drop-shadow(0 0 4px rgba(255, 82, 82, 0.6));
}

.status-busy .status-dot-icon {
  color: #f5a623;
  filter: drop-shadow(0 0 4px rgba(245, 166, 35, 0.6));
}

/* ---------------- Chat actions dropdown (independen, anchored ke top-bar) ---------------- */

.chat-actions { position: relative; flex-shrink: 0; }

.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: rgba(20, 27, 43, 0.9);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--border-2); border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft); padding: 6px; z-index: 60;
  opacity: 0; transform: translateY(-6px) scale(0.98); pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.dropdown-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text); text-align: left;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--accent-dim); }
.dropdown-item.danger:hover { background: rgba(255, 82, 82, 0.12); color: var(--red); }
.dropdown-item svg { flex-shrink: 0; opacity: 0.8; }
.dropdown-item .chevron { margin-left: auto; opacity: 0.5; }
.dropdown-panel { display: flex; flex-direction: column; gap: 1px; animation: panel-in 0.15s ease; }
.dropdown-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: translateX(0); } }

/* ---------------- 3. SEARCH BAR (independen) ---------------- */
/* position:fixed dengan top dihitung dari --top-bar-height (angka
   tetap), BUKAN "menyambung" ke bawah top-bar secara otomatis. */

.search-bar {
  position: absolute;
  top: var(--top-bar-height);
  left: 0;
  right: 0;
  height: var(--search-bar-height);
  z-index: 45;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: rgba(13, 19, 31, 0.85);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.search-bar.visible { display: flex; }

.search-input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 12px; color: var(--text); font-size: 13.5px; outline: none;
  transition: border-color var(--transition-base);
}
.search-input:focus { border-color: rgba(129, 212, 250, 0.4); }
.search-input::placeholder { color: var(--text-3); }
.search-count { font-size: 12px; color: var(--text-3); white-space: nowrap; min-width: 44px; text-align: center; }
.search-nav-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-2); flex-shrink: 0;
  transition: background var(--transition-base), color var(--transition-base);
}
.search-nav-btn:hover:not(:disabled) { background: var(--accent-dim); color: var(--text); }
.search-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------------- 4. CHAT SCROLL AREA (independen) ---------------- */
/* position:fixed dengan top/bottom EKSPLISIT dari variabel tetap.
   Area ini TIDAK PERNAH resize akibat keyboard, karena top & bottom-nya
   adalah angka tetap relatif viewport asli — bukan flex:1 yang mengalir
   dari parent yang bisa berubah. */

.chat-scroll {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Padding sederhana — tinggi composer sudah otomatis "diperhitungkan"
     karena composer adalah sibling dalam flex flow yang sama, bukan lagi
     overlay fixed yang butuh padding kompensasi manual. */
  padding: 24px;
  z-index: 1;
}

body.search-open .chat-scroll {
  padding-top: calc(24px + var(--search-bar-height));
}

.empty-state {
  max-width: 640px; margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px;
}

.empty-mark { width: 72px; height: 72px; margin-bottom: 22px; flex-shrink: 0; cursor: pointer; filter: drop-shadow(0 0 16px rgba(129, 212, 250, 0.35)); }

.empty-state h1 { font-family: var(--font-brand); font-size: 30px; letter-spacing: 0.02em; margin-bottom: 8px; font-weight: 400; }
.empty-state p { font-size: 14px; color: var(--text-2); max-width: 420px; line-height: 1.6; margin-bottom: 32px; }

.suggestion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.suggestion-card {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13px;
  text-align: left; transition: background var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
}
.suggestion-card:hover { background: var(--surface-2); border-color: var(--border-2); transform: translateY(-1px); color: var(--text); }
.suggestion-icon { color: var(--accent); font-size: 14px; flex-shrink: 0; }

.messages { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.msg-row { display: flex; animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

.bubble {
  max-width: 72%; padding: 9px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word; position: relative;
}
.msg-row.user .bubble { background: var(--accent); color: #0B111E; border-bottom-right-radius: 4px; }
.msg-row.assistant .bubble { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.bubble-time { display: block; font-size: 10.5px; margin-top: 4px; opacity: 0.65; text-align: right; }
.msg-row.user .bubble-time { color: rgba(11, 17, 30, 0.65); }
.msg-row.assistant .bubble-time { color: var(--text-3); }

.thinking-col { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bubble-thinking { padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); }
.thinking-logo { width: 32px; height: 32px; flex-shrink: 0; margin-left: 4px; animation: logo-spin 12s linear infinite; opacity: 0.85; }
.thinking-logo .thinking-center { animation: thinking-blink 1s steps(1, end) infinite; }
@keyframes thinking-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.25; } }

.typing-indicator { display: flex; gap: 4px; padding: 4px 2px; }
.typing-indicator span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.5; animation: typing 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.bubble mark { background: var(--accent); color: #0B111E; border-radius: 3px; padding: 0 2px; }
.bubble.search-current mark { background: var(--green); }
.msg-row.search-current .bubble { box-shadow: 0 0 0 2px var(--accent); }

/* ---------------- 5. COMPOSER (paling independen) ---------------- */
/* position:fixed bottom:0 — CSS MURNI, TIDAK ADA JS untuk positioning
   sama sekali. Browser native yang menangani keyboard virtual. Tinggi
   composer TETAP dari --composer-height (bukan diukur runtime). */

.composer-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  z-index: 20;
  padding: 12px 24px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg);
}

.composer {
  max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 10px 10px 10px 18px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.composer:focus-within { border-color: rgba(129, 212, 250, 0.4); box-shadow: 0 0 0 3px rgba(129, 212, 250, 0.08); }

.composer-input {
  flex: 1; background: none; border: none; outline: none; resize: none; color: var(--text);
  font-size: 14.5px; line-height: 1.5; max-height: 120px; padding: 6px 0;
}
.composer-input::placeholder { color: var(--text-3); }

.send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--accent); color: #0B111E;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background var(--transition-base), transform var(--transition-fast), opacity var(--transition-base);
}
.send-btn:hover:not(:disabled) { background: #a8e4ff; }
.send-btn:active:not(:disabled) { transform: scale(0.94); }
.send-btn:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }

.composer-hint { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 8px; line-height: 1.4; }

/* ============================================================
   Siesta logo — sistem animasi (independen, tidak berubah)
   ============================================================ */

.logo-petals .petal, .splash-petals .petal {
  opacity: 0; transform-origin: 100px 100px; animation: petal-appear 0.4s ease forwards;
}
.petal-1 { animation-delay: 0s; }
.petal-2 { animation-delay: 0.15s; }
.petal-3 { animation-delay: 0.30s; }
.petal-4 { animation-delay: 0.45s; }
.petal-5 { animation-delay: 0.60s; }
@keyframes petal-appear { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

.logo-center {
  opacity: 0;
  animation: petal-appear 0.3s ease forwards 0.75s, breathe-glow 3s ease-in-out infinite 1.1s;
}
@keyframes breathe-glow {
  0%, 100% { r: 5; filter: drop-shadow(0 0 2px rgba(129, 212, 250, 0.4)); }
  50% { r: 7; filter: drop-shadow(0 0 10px rgba(129, 212, 250, 0.8)); }
}

.empty-mark { animation: logo-spin 12s linear infinite; }
@keyframes logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (hover: hover) and (pointer: fine) {
  .empty-mark { transition: filter 0.3s ease; }
  .empty-mark:hover { filter: drop-shadow(0 0 24px rgba(129, 212, 250, 0.6)); }
  .empty-mark:hover .logo-petals { animation: hover-scale-pulse 1.2s ease-in-out infinite; transform-origin: 100px 100px; }
}
@keyframes hover-scale-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.splash-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: var(--bg); transition: opacity 0.5s ease;
}
.splash-screen.fade-out { opacity: 0; pointer-events: none; }
.splash-logo { width: 96px; height: 96px; filter: drop-shadow(0 0 20px rgba(129, 212, 250, 0.4)); }
.splash-text {
  font-family: var(--font-brand); font-size: 22px; letter-spacing: 0.15em; color: var(--text);
  opacity: 0; animation: splash-text-in 0.5s ease forwards; animation-delay: 0.9s;
}
@keyframes splash-text-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   Modal system (independen, position:fixed overlay)
   ============================================================ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition-base);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-box {
  width: 100%; max-width: 340px;
  background: rgba(20, 27, 43, 0.92);
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  border: 1px solid var(--border-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft); padding: 24px; text-align: center;
  transform: scale(0.95) translateY(8px); transition: transform var(--transition-base);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }

.modal-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px auto; }
.modal-icon.danger { background: rgba(255, 82, 82, 0.12); color: var(--red); }
.modal-icon.accent { background: var(--accent-dim); color: var(--accent); }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.modal-text { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-btn { flex: 1; padding: 10px; border-radius: var(--radius-md); font-size: 13.5px; font-weight: 500; transition: background var(--transition-fast), opacity var(--transition-fast); }
.modal-btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.modal-btn.secondary:hover { background: var(--border); }
.modal-btn.danger { background: var(--red); color: #0B111E; }
.modal-btn.danger:hover { opacity: 0.9; }

.progress-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width 0.15s ease; }
.progress-percent { font-size: 12px; color: var(--text-3); }

/* ============================================================
   Responsive — DESKTOP: sidebar bisa "mendorong" konten via margin
   statis pada .app-main (satu titik kontrol, bukan per-elemen);
   MOBILE/TABLET: sidebar overlay penuh.
   ============================================================ */

@media (min-width: 1024px) {
  body.sidebar-open .sidebar-overlay {
    display: none; /* desktop tidak perlu overlay gelap saat sidebar terbuka */
  }
}

/* Tablet & Mobile (<1024px): sidebar SELALU overlay penuh, tidak
   pernah mendorong konten (konten tetap 100% lebar). */
@media (max-width: 1023px) {
  .suggestion-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .top-bar { padding: 0 12px; }
  .chat-scroll { padding-left: 12px; padding-right: 12px; }
  .composer-wrap { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .bubble { max-width: 84%; }
  .empty-state h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
