/* NexMind AI — App styles (auth, dashboard, chat, wallet, modals) */
:root {
  --bg:      #04060d;
  --bg2:     #070b16;
  --card:    #0b1120;
  --card2:   #0e1526;
  --border:  rgba(120,160,255,0.10);
  --border2: rgba(120,160,255,0.18);
  --primary: #22d3ee;
  --primary2:#0ea5e9;
  --accent:  #8b5cf6;
  --pink:    #f472b6;
  --green:   #34d399;
  --amber:   #fbbf24;
  --red:     #f87171;
  --text:    #eef2ff;
  --muted:   #8b93a7;
  --dim:     #4b5568;
  --radius:  16px;
  --glow:    0 0 60px rgba(34,211,238,0.12);
}

/* Bolt-style dashboard palette (scoped to the app shell) — matches Bolt reference project */
.app-layout {
  --bg:      #141516;
  --bg2:     #111214;
  --card:    #1e2024;
  --card2:   #1d2126;
  --card3:   #17191d;
  --border:  #2b2e33;
  --border2: #30343a;
  --primary: #3988f5;
  --primary2:#4f9cff;
  --accent:  #69a9ff;
  --pink:    #f472b6;
  --green:   #34d399;
  --amber:   #fbbf24;
  --red:     #f87171;
  --text:    #edf0f4;
  --muted:   #989faa;
  --dim:     #5f636f;
  --glow:    0 0 60px rgba(79,156,255,0.12);
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html,body { height:100%; }
body {
  background:var(--bg); color:var(--text);
  font-family:'DM Sans',system-ui,sans-serif;
  font-size:15px; line-height:1.6; overflow-x:hidden;
}
h1,h2,h3,h4 { font-family:'Syne',sans-serif; line-height:1.2; }
.hero-serif { font-family:'Fraunces','Syne',serif; font-weight:500; }
button { font-family:inherit; cursor:pointer; }
a { color:inherit; text-decoration:none; }
input,textarea,select { font-family:inherit; font-size:14px; color:var(--text); }
textarea { resize:none; }

.page { display:none; min-height:100vh; }
.page.active { display:block; }
.hidden { display:none !important; }

/* ---------- Buttons ---------- */
.btn-primary {
  padding:10px 22px; border-radius:10px; border:none;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:#04060d; font-size:14px; font-weight:700;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  transition:all .2s;
}
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 6px 20px rgba(34,211,238,0.35); }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-ghost {
  padding:9px 20px; border:1px solid var(--border2); border-radius:10px;
  color:var(--muted); background:transparent; font-size:14px; font-weight:500;
  transition:all .2s;
}
.btn-ghost:hover { border-color:var(--primary); color:var(--primary); }
.btn-block { width:100%; }
.btn-sm { padding:7px 14px; font-size:13px; border-radius:8px; }
.btn-loader {
  width:16px; height:16px; border-radius:50%;
  border:2px solid rgba(245,241,234,0.15); border-top-color:var(--text);
  animation:spin .7s linear infinite;
}
.btn-loader:not(.hidden) { display:inline-block; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ---------- Fields ---------- */
.field { margin-bottom:16px; }
.field label { display:block; font-size:12.5px; font-weight:600; color:var(--muted); margin-bottom:7px; letter-spacing:.3px; }
.field input, .field textarea, .field select {
  width:100%; padding:11px 14px; border-radius:10px;
  background:var(--card2); border:1px solid var(--border);
  outline:none; transition:border-color .2s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color:var(--primary); }
.field input:disabled { opacity:.5; }
.field textarea { line-height:1.55; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:40px 20px; position:relative;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(34,211,238,0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 90%, rgba(139,92,246,0.08), transparent 70%),
    var(--bg);
}
.auth-card {
  width:100%; max-width:420px; background:var(--card);
  border:1px solid var(--border2); border-radius:20px;
  padding:38px 34px; box-shadow:0 30px 90px rgba(0,0,0,0.5), var(--glow);
  animation:fadeUp .5s ease both;
}
.auth-logo { display:flex; align-items:center; gap:10px; font-family:'Syne',sans-serif; font-size:19px; font-weight:800; margin-bottom:26px; }
.auth-card h2 { font-size:24px; font-weight:800; margin-bottom:6px; }
.auth-card > p { color:var(--muted); font-size:14px; margin-bottom:22px; }
.auth-error {
  background:rgba(248,113,113,0.08); border:1px solid rgba(248,113,113,0.25);
  color:var(--red); font-size:13px; padding:10px 14px; border-radius:10px; margin-bottom:16px;
}
.auth-switch { text-align:center; font-size:13.5px; color:var(--muted); margin-top:18px; }
.auth-switch a { color:var(--primary); font-weight:600; cursor:pointer; }
.auth-back { display:block; text-align:center; margin-top:14px; font-size:13px; color:var(--dim); cursor:pointer; transition:color .2s; }
.auth-back:hover { color:var(--muted); }

/* ---------- App layout ---------- */
.app-layout { display:flex; height:100vh; overflow:hidden; }
.app-sidebar {
  width:290px; flex-shrink:0; background:var(--bg2); border-right:1px solid var(--border);
  display:flex; flex-direction:column; padding:0;
  overflow:hidden;
}
.sidebar-top { display:flex; align-items:center; gap:8px; padding:12px 8px 8px; flex-shrink:0; }
.sidebar-brand { display:flex; align-items:center; gap:10px; font-family:'DM Sans',system-ui,sans-serif; font-size:15px; font-weight:600; letter-spacing:-0.01em; color:#f3f6fb; flex:1; min-width:0; }
.brand-icon {
  width:28px; height:28px; border-radius:8px; flex-shrink:0;
  background:linear-gradient(135deg,#4f9cff,#1769d5);
  display:flex; align-items:center; justify-content:center;
  color:#fff; box-shadow:0 0 18px rgba(47,136,255,0.22);
}
.brand-icon svg { width:16px; height:16px; }
.sidebar-collapse-btn {
  flex-shrink:0; width:28px; height:28px; display:flex; align-items:center; justify-content:center;
  background:transparent; border:none; border-radius:8px;
  color:var(--dim); cursor:pointer; transition:all .15s;
}
.sidebar-collapse-btn:hover { background:#202328; color:#d9e5f7; }
.sidebar-collapse-btn svg { width:15px; height:15px; transition:transform .25s ease; }

/* Collapsed (icon-only) sidebar */
.app-sidebar { transition:width .25s ease; }
.app-sidebar.collapsed { width:72px; }
.app-sidebar.collapsed .sidebar-top { flex-direction:column; height:auto; }
.app-sidebar.collapsed .sidebar-brand span,
.app-sidebar.collapsed .new-chat-btn span,
.app-sidebar.collapsed .sidebar-btn span,
.app-sidebar.collapsed .sidebar-history,
.app-sidebar.collapsed .sidebar-user-meta,
.app-sidebar.collapsed .user-chevron,
.app-sidebar.collapsed .wallet-mini-label,
.app-sidebar.collapsed .sidebar-section,
.app-sidebar.collapsed .sidebar-bottom .design-btn span { display:none; }
.app-sidebar.collapsed .sidebar-brand { justify-content:center; }
.app-sidebar.collapsed .new-chat-btn { justify-content:center; padding:10px 0; }
.app-sidebar.collapsed .sidebar-btn { justify-content:center; padding:10px 0; }
.app-sidebar.collapsed .sidebar-nav { align-items:center; }
.app-sidebar.collapsed .sidebar-user { justify-content:center; padding:8px 0; }
.app-sidebar.collapsed .wallet-mini { justify-content:center; padding:8px 0; }
.app-sidebar.collapsed .sidebar-collapse-btn svg { transform:rotate(180deg); }
.sidebar-nav { display:flex; flex-direction:column; gap:2px; flex-shrink:0; padding:0 8px; }
.new-chat-btn {
  display:flex; align-items:center; gap:8px; width:100%;
  padding:10px 12px; border-radius:8px;
  border:none; background:#3a3d42;
  color:#f1f4f9; font-size:14px; font-weight:500; cursor:pointer; transition:background .15s;
}
.new-chat-btn svg { width:16px; height:16px; flex-shrink:0; color:#b9d5ff; }
.new-chat-btn:hover { background:#454950; }

/* Claude-style New chat button (Bolt reference) */
.claude-new {
  background:#3a3d42; border:none; border-radius:8px;
  padding:10px 12px; height:auto; font-size:14px; font-weight:500;
  display:flex; align-items:center; gap:8px; width:100%;
  color:#f1f4f9; cursor:pointer; transition:background .15s;
}
.claude-new:hover { background:#454950; }

.sidebar-divider { height:1px; background:var(--border); margin:8px 6px; }
.sidebar-btn {
  display:flex; align-items:center; gap:10px; width:100%;
  padding:8px 12px; background:transparent; border:none; border-radius:8px;
  color:#c8ccd4; font-size:14px; font-weight:400; cursor:pointer;
  transition:background .15s; text-align:left;
}
.sidebar-btn svg { width:17px; height:17px; flex-shrink:0; color:#a9c9ff; }
.sidebar-btn:hover { background:#202328; color:#d8e3f5; }
.sidebar-btn.active { background:#202328; color:#d8e3f5; box-shadow:none; }
.sidebar-btn .upgrade-badge {
  margin-left:auto; border:1px solid #31598d; border-radius:999px;
  padding:1px 8px; font-size:11px; color:#80b6ff; flex-shrink:0;
}

/* Claude-style: sidebar sections (Projects / Chats and tasks) */
.sidebar-section {
  display:flex; align-items:center; gap:8px; width:100%;
  padding:8px 12px; background:transparent; border:none;
  font-size:12px; color:#8f96a3; cursor:pointer; transition:color .15s;
  text-align:left; flex-shrink:0;
}
.sidebar-section:hover { color:#d8e3f5; }
.sidebar-section .section-chevron { width:14px; height:14px; transition:transform .2s; flex-shrink:0; }
.sidebar-section .section-chevron.open { transform:rotate(180deg); }
.sidebar-section .section-icon { width:16px; height:16px; margin-left:auto; color:#9dbff0; flex-shrink:0; }
.sidebar-section-body { padding:0 8px 4px; flex-shrink:0; }
.sidebar-section-empty {
  background:#1b1e23; border-radius:8px; padding:8px 12px;
  font-size:12px; color:#7f8794; margin:0 4px;
}

/* Claude-style: Chat history section */
.sidebar-history {
  flex:1; display:flex; flex-direction:column; min-height:0; overflow:hidden;
  padding:8px 0 0;
}
.sidebar-history-header {
  font-size:12px; font-weight:400; text-transform:none; letter-spacing:normal;
  color:#8f96a3; padding:8px 12px 4px; flex-shrink:0;
}
.sidebar-history-list {
  flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:1px;
  padding:0 8px;
}
.sidebar-history-group-label {
  font-size:12px; font-weight:500; color:#6b7280;
  padding:10px 12px 6px; flex-shrink:0;
}
.sidebar-history-item {
  padding:8px 12px; border-radius:8px; cursor:pointer; transition:background .12s;
  font-size:14px; color:#a8aebc; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  display:flex; align-items:center; gap:10px;
}
.sidebar-history-item:hover { background:#1a1d22; color:#e8edf4; }
.sidebar-history-item.active { background:#1d2126; color:#e8edf4; }
.sidebar-history-item .hist-icon { width:16px; height:16px; flex-shrink:0; color:#5f636f; }
.sidebar-history-item .hist-title { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar-history-item .hist-time { font-size:12px; color:#5f636f; opacity:0; transition:opacity .12s; flex-shrink:0; }
.sidebar-history-item:hover .hist-time { opacity:1; }
.sidebar-history-empty { font-size:12px; color:#7f8794; padding:8px 12px; font-style:italic; }

.sidebar-bottom { display:flex; flex-direction:column; gap:0; padding-top:0; border-top:1px solid var(--border); flex-shrink:0; }
.design-btn {
  display:flex; align-items:center; gap:10px; width:100%;
  padding:12px 16px; background:transparent; border:none; border-top:1px solid var(--border);
  color:#c8ccd4; font-size:14px; cursor:pointer; transition:background .15s; text-align:left;
}
.design-btn svg { width:17px; height:17px; color:#a9c9ff; flex-shrink:0; }
.design-btn:hover { background:#1b1e23; }
.wallet-mini {
  background:transparent; border:none; border-radius:8px;
  padding:4px 12px; display:flex; align-items:center; justify-content:space-between;
}
.wallet-mini-label { font-size:12px; letter-spacing:normal; text-transform:none; color:var(--dim); }
.wallet-mini-amt { font-size:13px; font-weight:500; color:var(--text); font-family:'DM Sans',system-ui,sans-serif; }
.sidebar-user { display:flex; align-items:center; gap:10px; padding:12px 16px; border-top:1px solid var(--border); cursor:pointer; transition:background .2s; width:100%; background:none; border-left:none; border-right:none; border-bottom:none; color:inherit; font-family:inherit; }
.sidebar-user:hover { background:#1b1e23; }
.user-menu { position:relative; }
.user-chevron { width:16px; height:16px; margin-left:auto; color:#8e96a3; flex-shrink:0; }
.sidebar-user-meta { display:flex; align-items:center; gap:4px; min-width:0; flex:1; }
.sidebar-user-plan { font-size:14px; color:#8e96a3; font-weight:400; white-space:nowrap; }
.sidebar-user-plan::before { content:"\00b7\00a0"; }
.user-menu-dropdown {
  position:absolute; bottom:calc(100% + 8px); left:0; right:0; z-index:200;
  background:#26292e; border:1px solid #3a4049; border-radius:12px;
  padding:6px; box-shadow:0 18px 50px rgba(0,0,0,0.55); animation:fadeUp .18s ease both;
}
.user-menu-dropdown button {
  display:flex; align-items:center; gap:10px; width:100%;
  padding:9px 12px; border:none; border-radius:8px; background:none;
  color:#c5cad2; font-size:13px; font-weight:400; cursor:pointer; transition:all .15s;
  text-align:left;
}
.user-menu-dropdown button svg { width:16px; height:16px; flex-shrink:0; }
.user-menu-dropdown button:hover { background:#2f323a; color:#e8edf4; }
.user-menu-dropdown button:last-child:hover { color:var(--red); }
.sidebar-avatar {
  width:28px; height:28px; border-radius:50%; flex-shrink:0;
  background:#2e333b;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:500; color:#d7e5fa;
  box-shadow:none;
}
.sidebar-user-name { font-size:14px; font-weight:500; color:#d7dbe3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar-user-icons { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.sidebar-user-icons svg { width:16px; height:16px; color:#a9c9ff; cursor:pointer; }
.sidebar-user-icons svg:hover { color:#d9e5f7; }

.app-main { flex:1; min-width:0; display:flex; flex-direction:column; height:100vh; background:var(--bg); position:relative; }

/* Topbar */
.topbar {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:10px 24px; border-bottom:1px solid var(--border);
  background:rgba(4,6,13,0.72); backdrop-filter:blur(22px);
  flex-shrink:0; flex-wrap:wrap; min-height:52px;
}
.topbar-left { display:flex; align-items:baseline; gap:10px; }
.topbar-greeting { font-family:'Syne',sans-serif; font-size:15px; font-weight:700; }
.topbar-name { color:var(--muted); font-size:13px; }
.topbar-right { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.provider-status { display:flex; gap:12px; flex-wrap:wrap; }
.status-item { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--dim); font-weight:600; }
.status-dot { width:7px; height:7px; border-radius:50%; background:var(--dim); }
.status-dot.active { background:var(--green); box-shadow:0 0 8px rgba(52,211,153,0.6); }
.status-dot.inactive { background:var(--dim); }

/* Tabs */
.tab-panel { display:none; flex:1; padding:28px; overflow-y:auto; min-height:0; }
.tab-panel.active { display:flex; flex-direction:column; }
#tab-chat { overflow:hidden; }
.panel-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; flex-shrink:0; }
.panel-head h2 { font-size:22px; font-weight:800; }
.panel-sub { font-size:14px; color:var(--muted); margin:22px 0 12px; font-family:'DM Sans',sans-serif; font-weight:600; }

/* ---------- Chat: empty state ---------- */
.app-center {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:40px 24px; max-width:760px; margin:0 auto; width:100%; min-height:0;
}
.welcome-pill {
  display:inline-flex; align-items:center; gap:6px;
  background:#17191d; border:1px solid transparent; border-radius:8px;
  padding:8px 12px; font-size:14px; font-weight:400; color:#989faa;
  box-shadow:0 1px 2px rgba(0,0,0,0.3); margin-bottom:24px;
}
.welcome-pill .pill-dot { color:#545b66; }
.welcome-pill a { color:#69a9ff; font-weight:400; text-decoration:underline; text-underline-offset:2px; }
.welcome-pill a:hover { color:#9bc8ff; text-decoration:underline; }
.welcome-greeting {
  display:flex; align-items:center; justify-content:center; gap:12px;
  margin-bottom:8px;
}
.welcome-sparkles {
  width:36px; height:36px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#4f9cff;
}
.welcome-sparkles svg { width:36px; height:36px; }
.app-center-icon {
  width:56px; height:56px; border-radius:16px; margin-bottom:20px;
  background:linear-gradient(135deg,var(--primary),var(--accent));
  display:flex; align-items:center; justify-content:center;
  font-size:26px; color:#fff; box-shadow:0 0 40px rgba(79,156,255,0.3);
}
.app-center h2:not(.hero-greeting) { font-size:30px; font-weight:800; margin-bottom:6px; letter-spacing:-0.02em; }
.app-center > p { color:var(--muted); margin-bottom:28px; font-size:15px; }
.suggest-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; width:100%; margin-bottom:24px; }
.suggest-card {
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:16px 12px; color:var(--muted); font-size:13px; font-weight:600;
  transition:all .2s;
}
.suggest-card:hover { border-color:var(--border2); color:var(--text); background:var(--card2); transform:none; box-shadow:none; }
.suggest-icon { font-size:22px; }
.app-center-input-row {
  display:flex; align-items:flex-end; gap:10px; width:100%;
  background:var(--card); border:1px solid var(--border2); border-radius:14px;
  padding:10px; transition:border-color .2s;
}
.app-center-input-row:focus-within { border-color:var(--primary); }
.app-center-input-row textarea {
  flex:1; background:transparent; border:none; outline:none;
  padding:8px 6px; max-height:200px; line-height:1.5;
}
.attach-btn {
  width:32px; height:32px; border-radius:8px; flex-shrink:0;
  background:transparent; border:none;
  display:flex; align-items:center; justify-content:center;
  color:#9ca3ad; transition:background .15s;
}
.attach-btn:hover { background:#2a2d33; color:var(--text); }
.send-btn {
  width:32px; height:32px; border-radius:8px; flex-shrink:0;
  background:var(--primary); color:#fff;
  border:none; font-size:15px; font-weight:700;
  display:flex; align-items:center; justify-content:center; transition:all .2s;
}
.send-btn:hover { background:var(--primary2); }
.send-btn:disabled { background:#3a3d42; color:#6e747e; cursor:not-allowed; }
.model-select {
  background:transparent; border:none; border-radius:8px;
  padding:6px 10px; font-size:13px; font-weight:500; color:#c5cad2; outline:none;
  max-width:230px; cursor:pointer; transition:background .15s;
}
.model-select:hover { background:#2a2d33; color:var(--text); }
.model-select:focus { background:#2a2d33; }

/* ---------- Chat: conversation ---------- */
.chat-area {
  flex:1; display:flex; flex-direction:column; min-height:0;
  max-width:860px; width:100%; margin:0 auto;
}
.chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 4px; border-bottom:1px solid #2a2d32; margin-bottom:16px;
  flex-shrink:0;
}
.chat-messages { flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:18px; padding:6px 2px 20px; min-height:0; }
.chat-msg { display:flex; gap:14px; animation:fadeUp .3s ease both; }
.chat-msg-avatar {
  width:32px; height:32px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:15px;
  background:linear-gradient(135deg,#4f9cff,#1769d5); color:#fff;
}
.chat-msg-avatar svg { width:16px; height:16px; }
.chat-msg.user .chat-msg-avatar,
.chat-msg.assistant .chat-msg-avatar { background:linear-gradient(135deg,#4f9cff,#1769d5); color:#fff; }
.chat-msg-body { display:flex; flex-direction:column; gap:4px; max-width:82%; }
.chat-msg-label { padding:0 4px; font-size:12px; font-weight:500; color:#9aa1ad; }
.chat-msg-content {
  background:#1d2126; border-radius:16px 16px 16px 4px;
  padding:12px 16px; font-size:15px; line-height:1.65;
  color:#e8edf4;
}
.chat-msg.user .chat-msg-content {
  background:#3988f5; color:#fff;
}
.chat-msg-content p { white-space:pre-wrap; word-break:break-word; }
.chat-msg-content p:first-child { margin-top:0; }
.chat-msg-content p:last-child { margin-bottom:0; }
.chat-msg-content strong { font-weight:700; color:#fff; }
.chat-msg-content em { font-style:italic; }
.chat-msg-content code {
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:13px;
  background:rgba(255,255,255,0.09); padding:1px 6px; border-radius:6px;
}
.chat-msg.user .chat-msg-content code { background:rgba(255,255,255,0.18); }
.chat-msg-content pre.chat-code {
  background:#14171b; border:1px solid rgba(255,255,255,0.08); border-radius:10px;
  padding:10px 12px; overflow-x:auto; font-size:13px; line-height:1.5; margin:8px 0;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.chat-msg-content ol, .chat-msg-content ul { margin:6px 0 6px 20px; padding:0; }
.chat-msg-content li { margin:2px 0; }
.chat-msg-content h4, .chat-msg-content h5 { margin:10px 0 4px; font-weight:700; color:#fff; }
.chat-msg-content h4 { font-size:15px; }
.chat-msg-content h5 { font-size:14px; }
.chat-msg-time { padding:0 4px; font-size:12px; color:#5f636f; }
.chat-msg-meta { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px; }
.model-badge {
  font-size:10.5px; font-weight:700; padding:2px 9px; border-radius:100px;
  background:rgba(79,156,255,0.12); color:var(--accent);
}
.cost-badge { background:rgba(52,211,153,0.12); color:var(--green); }
.typing-indicator { display:flex; gap:5px; padding:4px 0; }
.typing-indicator span {
  width:7px; height:7px; border-radius:50%; background:var(--primary2);
  animation:typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay:.15s; }
.typing-indicator span:nth-child(3) { animation-delay:.3s; }
@keyframes typing { 0%,60%,100% { opacity:.25; transform:translateY(0); } 30% { opacity:1; transform:translateY(-4px); } }

.chat-input-area { border-top:1px solid var(--border); padding-top:14px; }
.chat-input-row {
  display:flex; align-items:flex-end; gap:10px;
  background:var(--card); border:1px solid var(--border2); border-radius:16px;
  padding:10px; transition:border-color .2s;
  max-width:650px; margin:0 auto;
}
.chat-input-row:focus-within { border-color:#3a4049; }
.chat-input-row textarea {
  flex:1; background:transparent; border:none; outline:none;
  padding:8px 6px; max-height:200px; line-height:1.5;
  color:var(--text); font-family:'DM Sans',sans-serif; font-size:15px;
}
.chat-input-row textarea::placeholder { color:#6e747e; }

/* File previews */
.dash-file-preview { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.dash-file-preview-item {
  display:flex; align-items:center; gap:7px;
  background:var(--card2); border:1px solid var(--border);
  border-radius:10px; padding:6px 10px; font-size:12px; color:var(--muted);
}
.dash-file-preview-item img { width:34px; height:34px; border-radius:6px; object-fit:cover; }
.file-remove {
  background:none; border:none; color:var(--dim); cursor:pointer;
  display:flex; align-items:center; padding:2px;
}
.file-remove:hover { color:var(--red); }
.file-error {
  background:rgba(248,113,113,0.08); border:1px solid rgba(248,113,113,0.25);
  color:var(--red); font-size:12.5px; padding:8px 12px; border-radius:8px; margin:8px 0;
}
.message-attachments { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.message-attachment img { max-width:220px; border-radius:10px; border:1px solid var(--border); }
.file-attachment {
  display:flex; align-items:center; gap:6px; font-size:12px;
  background:var(--card2); border:1px solid var(--border); border-radius:8px; padding:6px 10px;
}

/* ---------- Wallet ---------- */
.wallet-hero {
  display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap;
  background:linear-gradient(150deg,var(--bg2),var(--bg));
  border:1px solid var(--border2); border-radius:20px; padding:30px;
  position:relative; overflow:hidden;
}
.wallet-hero::before {
  content:''; position:absolute; top:-80px; right:-80px; width:240px; height:240px;
  background:radial-gradient(circle,rgba(79,156,255,0.15),transparent 70%);
}
.wallet-label { font-size:11px; letter-spacing:2px; text-transform:uppercase; color:var(--dim); }
.wallet-balance { font-family:'Syne',sans-serif; font-size:42px; font-weight:800; margin-top:4px; }
.wallet-txn-list { display:flex; flex-direction:column; gap:8px; }
.wallet-txn-row {
  display:flex; justify-content:space-between; align-items:center;
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:12px 16px; font-size:13.5px; color:var(--muted);
}
.wallet-txn-row .amt { font-weight:700; font-family:'JetBrains Mono',monospace; }
.wallet-txn-row .amt.plus { color:var(--green); }
.wallet-txn-row .amt.minus { color:var(--pink); }
.wallet-empty { color:var(--dim); font-size:13.5px; padding:20px 0; text-align:center; }

/* ---------- Usage ---------- */
.usage-list { display:flex; flex-direction:column; gap:8px; }
.usage-row {
  display:flex; justify-content:space-between; align-items:center; gap:14px;
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:12px 16px;
}
.usage-main { display:flex; flex-direction:column; min-width:0; }
.usage-model { font-size:13.5px; font-weight:600; color:var(--text); }
.usage-provider { font-size:11px; color:var(--dim); text-transform:capitalize; }
.usage-side { display:flex; align-items:center; gap:12px; flex-shrink:0; }
.usage-tokens { font-size:11.5px; color:var(--dim); font-family:'JetBrains Mono',monospace; }
.usage-cost { font-size:12.5px; font-weight:700; font-family:'JetBrains Mono',monospace; color:var(--text); }
.usage-cost.free { color:var(--green); }
.usage-time { font-size:11px; color:var(--dim); }

/* ---------- Tools ---------- */
.tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:14px; }
.tool-card {
  display:flex; flex-direction:column; align-items:center; gap:10px;
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  padding:24px 16px; color:var(--text); font-size:14px; font-weight:600;
  transition:all .25s;
}
.tool-card:hover { border-color:var(--primary); transform:translateY(-3px); box-shadow:0 16px 40px rgba(0,0,0,0.4); }
.tool-icon { font-size:26px; }
.tool-output {
  margin-top:16px; background:var(--bg2); border:1px solid var(--border2);
  border-radius:12px; padding:16px; font-size:13.5px; line-height:1.65;
  white-space:pre-wrap; max-height:320px; overflow-y:auto;
}

/* ---------- Settings ---------- */
.settings-card {
  background:var(--card); border:1px solid var(--border); border-radius:16px;
  padding:26px; max-width:480px;
}

/* ---------- Modals ---------- */
.modal { position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; padding:20px; }
.modal-overlay { position:absolute; inset:0; background:rgba(2,4,10,0.8); backdrop-filter:blur(6px); }
.modal-card {
  position:relative; width:100%; max-width:440px;
  background:var(--card); border:1px solid var(--border2); border-radius:18px;
  box-shadow:0 40px 120px rgba(0,0,0,0.6); animation:fadeUp .3s ease both;
  overflow:hidden;
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
  font-family:'Syne',sans-serif; font-size:15px; font-weight:700;
}
.modal-close {
  background:none; border:none; color:var(--dim); font-size:16px; cursor:pointer;
  width:30px; height:30px; border-radius:8px; transition:all .2s;
}
.modal-close:hover { background:var(--card2); color:var(--text); }
.modal-body { padding:22px 20px; }
.topup-msg { font-size:13px; margin-bottom:14px; min-height:18px; }
.topup-msg.success { color:var(--green); }
.topup-msg.error { color:var(--red); }

/* Chat modal (landing demo) */
.chat-modal-card { max-width:560px; height:min(620px, 85vh); display:flex; flex-direction:column; }
.chat-modal-messages { flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:14px; }
.chat-modal-messages .chat-msg-content { max-width:85%; }
.chat-modal-input-row {
  display:flex; align-items:flex-end; gap:10px; padding:14px;
  border-top:1px solid var(--border); background:var(--bg2);
}
.chat-modal-input-row textarea {
  flex:1; background:var(--card); border:1px solid var(--border2); border-radius:12px;
  padding:10px 14px; outline:none; max-height:160px; line-height:1.5;
}
.chat-modal-input-row textarea:focus { border-color:var(--primary); }

/* ---------- Landing demo chat ---------- */
.landing-chat {
  max-width:720px; margin:48px auto 0;
  background:var(--card); border:1px solid var(--border2); border-radius:20px;
  padding:18px; box-shadow:0 30px 90px rgba(0,0,0,0.5), var(--glow);
}
.landing-chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding-bottom:14px; border-bottom:1px solid var(--border); margin-bottom:14px;
}
.landing-chat-status {
  font-size:11px; font-weight:700; padding:3px 12px; border-radius:100px;
  background:rgba(52,211,153,0.12); color:var(--green);
}
.landing-chat-input-row {
  display:flex; align-items:flex-end; gap:10px;
  background:var(--bg2); border:1px solid var(--border2); border-radius:14px;
  padding:10px; transition:border-color .2s;
}
.landing-chat-input-row:focus-within { border-color:var(--primary); }
.landing-chat-input-row textarea {
  flex:1; background:transparent; border:none; outline:none;
  padding:8px 6px; max-height:200px; line-height:1.5;
}
.landing-quick-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:14px; }
.landing-quick-actions button {
  padding:7px 14px; border-radius:100px; font-size:12.5px; font-weight:600;
  background:var(--bg2); border:1px solid var(--border); color:var(--muted);
  transition:all .2s;
}
.landing-quick-actions button:hover { border-color:var(--primary); color:var(--primary); }

/* =====================================================
   BOLT-STYLE HERO (empty chat state)
===================================================== */
.hero-wrap {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  flex:1; padding:24px; text-align:center; min-height:0;
}
.hero-burst {
  font-size:34px; line-height:1; margin-bottom:22px;
  color:var(--primary);
  filter:drop-shadow(0 0 24px rgba(79,156,255,0.35));
}
.hero-greeting {
  font-family:'DM Sans',system-ui,sans-serif; font-weight:600;
  font-size:39px; line-height:1.2; letter-spacing:-0.035em; color:#f1f3f6;
}
@media (min-width: 640px) {
  .hero-greeting { font-size:46px; }
}
.hero-subtitle {
  color:var(--muted); margin-top:6px; font-size:15px;
}
.chat-input-wrap {
  flex-shrink:0; width:100%; max-width:650px; margin:0 auto;
  padding:8px 16px 16px;
}
.hero-input-box {
  width:100%;
  background:#1e2024; border:1px solid #30343a;
  border-radius:16px; padding:14px 16px 10px;
  box-shadow:0 8px 24px rgba(0,0,0,0.35);
  text-align:left; transition:border-color .2s;
}
.hero-input-box:focus-within { border-color:#3a4049; }
.hero-input-box textarea {
  width:100%; background:transparent; border:none; outline:none;
  color:#e6e9ee; font-family:'DM Sans',system-ui,sans-serif; font-size:15px;
  resize:none; min-height:28px; max-height:200px;
}
.hero-input-box textarea::placeholder { color:#6e747e; }
.hero-toolbar {
  display:flex; align-items:center; justify-content:space-between;
  margin-top:4px; padding-top:4px;
}
.hero-toolbar-left { display:flex; align-items:center; gap:2px; }
.hero-toolbar-right { display:flex; align-items:center; gap:2px; }
.hero-chip {
  display:flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:8px;
  font-size:14px; font-weight:400; color:#c5cad2;
  background:transparent; border:none;
  cursor:pointer; transition:background .15s;
}
.hero-chip svg { color:#9ca3ad; }
.hero-chip:hover { background:#2a2d33; color:#e8edf4; }
.model-select-wrap {
  display:flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:8px;
  font-size:14px; font-weight:400; color:#c5cad2;
  cursor:pointer; transition:background .15s;
}
.model-select-wrap:hover { background:#2a2d33; }
.model-sparkles { width:16px; height:16px; color:#4f9cff; flex-shrink:0; }
.model-select-wrap select {
  background:transparent; border:none; outline:none;
  color:inherit; font:inherit; cursor:pointer;
  -webkit-appearance:none; appearance:none;
  padding-right:4px; max-width:170px;
}
.model-select-wrap .model-chevron { width:14px; height:14px; color:#9ca3ad; flex-shrink:0; }
.hero-send-btn {
  width:32px; height:32px; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  background:#3988f5; color:#fff; border:none; cursor:pointer;
  transition:all .15s; font-size:14px;
}
.hero-send-btn:disabled { background:#3a3d42; color:#6e747e; cursor:not-allowed; }
.hero-send-btn:not(:disabled):hover { background:#4f9cff; }
.input-disclaimer {
  margin-top:8px; text-align:center; font-size:12px; color:#5f636f;
}

/* Bolt reference: Upgrade notice banner (welcome state) */
.upgrade-notice {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  width:100%; max-width:650px; margin:0 auto 8px;
  border:1px solid #30343a; border-radius:12px; background:#181a1e;
  padding:8px 16px; font-size:14px; color:#e2e5ea; flex-shrink:0;
}
.upgrade-notice a { color:#69a9ff; text-decoration:underline; text-underline-offset:2px; }
.upgrade-notice a:hover { color:#9bc8ff; }
.upgrade-notice .upgrade-notice-btn {
  border:none; border-radius:8px; background:#35383d;
  padding:4px 12px; font-size:14px; font-weight:500; color:#eceef1;
  cursor:pointer; transition:background .15s; flex-shrink:0;
}
.upgrade-notice .upgrade-notice-btn:hover { background:#454950; }

/* Bolt reference: help button (top-right of main) */
.help-btn {
  position:absolute; right:20px; top:20px; z-index:10;
  border:none; border-radius:8px; background:transparent;
  padding:8px; color:#9da4af; cursor:pointer; transition:all .15s;
}
.help-btn:hover { background:#202328; color:#d9e5f7; }
.help-btn svg { width:20px; height:20px; }

/* Bolt reference: upgrade modal */
.upgrade-modal-overlay {
  position:absolute; inset:0; z-index:20;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.45); padding:0 16px;
}
.upgrade-modal {
  width:100%; max-width:384px; border-radius:16px;
  border:1px solid #3b424b; background:#202328; padding:24px;
  box-shadow:0 25px 60px rgba(0,0,0,0.5);
}
.upgrade-modal h2 { font-family:'DM Sans',system-ui,sans-serif; font-size:18px; font-weight:600; color:#fff; margin-bottom:8px; }
.upgrade-modal p { font-size:14px; line-height:1.6; color:#adb4c0; margin-bottom:20px; }
.upgrade-modal .upgrade-modal-btn {
  width:100%; border:none; border-radius:8px; background:#3988f5;
  padding:10px 16px; font-size:14px; font-weight:500; color:#fff;
  cursor:pointer; transition:background .15s;
}
.upgrade-modal .upgrade-modal-btn:hover { background:#4f9cff; }

/* Mic button active state */
.hero-chip.active {
  background:rgba(239,68,68,0.15); color:var(--red);
  animation:pulse-mic 1s ease infinite;
}
@keyframes pulse-mic {
  0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,0.3)} 50%{box-shadow:0 0 0 6px rgba(239,68,68,0)}
}

/* Sidebar user chip (Claude-style, bottom-left) */
.sidebar-user-chip {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:12px;
  cursor:pointer; transition:background .15s;
}
.sidebar-user-chip:hover { background:var(--card); }

/* Sidebar collapse toggle */
.sidebar-collapse-btn {
  width:100%; display:flex; align-items:center; gap:8px;
  padding:9px 12px; border-radius:10px;
  font-size:13px; font-weight:600; color:var(--muted);
  background:transparent; border:1px solid transparent;
  cursor:pointer; transition:all .15s; text-align:left;
}
.sidebar-collapse-btn:hover { background:var(--card); color:var(--text); }

/* =====================================================
   ADDITIONAL CHAT STYLES
===================================================== */
.chat-area {
  flex:1; display:flex; flex-direction:column; min-height:0;
  max-width:860px; width:100%; margin:0 auto;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--card2); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:var(--dim); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .provider-status { display:none; }
  .tab-panel { padding:20px 16px; }
  .chat-msg-content { max-width:88%; }
}
@media (max-width: 640px) {
  .app-sidebar { width:60px; padding:14px 8px; }
  .sidebar-btn { justify-content:center; padding:11px 0; }
  .sidebar-btn span, .sidebar-brand span, .sidebar-user-name, .sidebar-user-plan, .sidebar-user-meta, .user-chevron, .new-chat-btn span { display:none; }
  .new-chat-btn { justify-content:center; padding:11px 0; }
  .sidebar-history { display:none; }
  .wallet-mini { flex-direction:column; gap:2px; padding:6px 4px; }
  .hero-input-box { max-width:100%; }
  .hero-toolbar { flex-wrap:wrap; gap:8px; }
  .hero-greeting { font-size:26px; }
  .wallet-hero { padding:22px; }
  .wallet-balance { font-size:32px; }
  .usage-side { gap:8px; }
  .usage-time { display:none; }
}

/* ---------- Settings ---------- */
.settings-role {
  display:inline-block; padding:5px 14px; border-radius:100px;
  background:rgba(79,156,255,0.12); color:var(--accent);
  font-size:12.5px; font-weight:700; border:1px solid rgba(79,156,255,0.3);
}
.settings-actions { display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; }

/* ---------- WhatsApp demo input ---------- */
.wa-input {
  flex:1; background:#152238; border:1px solid var(--border); border-radius:20px;
  padding:8px 14px; font-size:12.5px; color:var(--text); outline:none;
  transition:border-color .2s;
}
.wa-input:focus { border-color:var(--green); }
.wa-send {
  width:32px; height:32px; border-radius:50%; border:none; cursor:pointer;
  background:linear-gradient(135deg,#25d366,#128c7e);
  display:flex; align-items:center; justify-content:center; font-size:14px; color:#fff;
  transition:transform .15s;
}
.wa-send:hover { transform:scale(1.08); }
.wa-chat { overflow-y:auto; }

/* ---------- Admin Panel ---------- */
.admin-tabs { display:flex; gap:8px; flex-wrap:wrap; }
.admin-tab {
  padding:7px 16px; border-radius:100px; font-size:12.5px; font-weight:600;
  background:var(--card2); border:1px solid var(--border); color:var(--muted);
  cursor:pointer; transition:all .2s;
}
.admin-tab:hover { color:var(--text); border-color:var(--border2); }
.admin-tab.active { background:rgba(79,156,255,0.12); color:var(--primary); border-color:rgba(79,156,255,0.35); }
.admin-panel { display:flex; flex-direction:column; gap:18px; margin-top:20px; }
.admin-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; }
.admin-stat {
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  padding:20px; display:flex; flex-direction:column; gap:6px;
}
.admin-stat-num { font-family:'Syne',sans-serif; font-size:28px; font-weight:800; color:var(--primary); }
.admin-stat-label { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:1px; }
.admin-note {
  background:rgba(79,156,255,0.07); border:1px solid rgba(79,156,255,0.2);
  border-radius:12px; padding:14px 18px; font-size:13px; color:var(--muted);
}
.admin-table-wrap {
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  overflow-x:auto;
}
.admin-table { width:100%; border-collapse:collapse; font-size:13px; min-width:560px; }
.admin-table th {
  text-align:left; padding:12px 16px; font-size:11px; letter-spacing:1px;
  text-transform:uppercase; color:var(--dim); background:var(--card2);
  border-bottom:1px solid var(--border);
}
.admin-table td { padding:11px 16px; border-bottom:1px solid var(--border); color:var(--muted); }
.admin-table tr:last-child td { border-bottom:none; }
.admin-table tr:hover td { background:rgba(79,156,255,0.03); }
.admin-empty { text-align:center; color:var(--dim); padding:22px !important; }
.admin-dim { color:var(--dim); }
.role-badge {
  display:inline-block; padding:2px 10px; border-radius:100px; font-size:11px; font-weight:700;
  background:rgba(79,156,255,0.1); color:var(--primary); border:1px solid rgba(79,156,255,0.2);
}
.role-badge.admin { background:rgba(79,156,255,0.12); color:var(--accent); border-color:rgba(79,156,255,0.3); }
.key-code { font-family:'JetBrains Mono',monospace; font-size:11.5px; color:var(--text); }
.admin-filter-row { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.admin-check { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); cursor:pointer; }
.admin-conv-list { display:flex; flex-direction:column; gap:12px; }
.admin-conv {
  background:var(--card); border:1px solid var(--border); border-radius:14px; padding:16px;
}
.admin-conv.flagged { border-color:rgba(244,114,182,0.4); background:rgba(244,114,182,0.04); }
.admin-conv-head { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.admin-conv-phone { font-weight:700; font-size:14px; }
.admin-conv-state { font-size:12px; color:var(--muted); }
.admin-conv-time { margin-left:auto; font-size:11.5px; color:var(--dim); }
.admin-conv-actions { display:flex; gap:10px; margin-top:12px; }
.admin-conv-msgs { margin-top:12px; display:flex; flex-direction:column; gap:8px; }
.admin-msg {
  display:flex; gap:10px; align-items:baseline; font-size:13px;
  background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:9px 12px;
}
.admin-msg.out { border-left:3px solid var(--green); }
.admin-msg.in { border-left:3px solid var(--primary); }
.admin-msg-dir { font-size:10.5px; font-weight:700; color:var(--dim); text-transform:uppercase; flex-shrink:0; }
.admin-msg-body { flex:1; color:var(--text); }
.admin-msg-time { font-size:11px; color:var(--dim); flex-shrink:0; }
.admin-stock-form {
  display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  background:var(--card); border:1px solid var(--border); border-radius:14px; padding:14px;
}
.admin-stock-form input, .admin-stock-form select {
  background:var(--bg2); border:1px solid var(--border2); border-radius:10px;
  padding:9px 12px; color:var(--text); font-size:13px; outline:none; min-width:150px;
}
.admin-stock-form input:focus, .admin-stock-form select:focus { border-color:var(--primary); }