:root {
  --bg: #07070f;
  --bg-side: #0b0b16;
  --bg-card: #12121f;
  --bg-input: #0e0e1a;
  --border: #1c1c30;
  --text: #eef0ff;
  --muted: #8b8db0;
  --accent: #8b5cf6;
  --accent2: #6366f1;
  --pink: #c084fc;
  --cyan: #22d3ee;
  --bubble-user: #5b21b6;
  --bubble-ai: #12121f;
  --glow: rgba(139, 92, 246, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}
.app {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  height: 100vh;
}

/* LEFT */
.sidebar {
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
}
.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #22d3ee, #8b5cf6, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  box-shadow: 0 0 20px var(--glow);
}
.brand-name { font-weight: 700; font-size: 18px; }

.new-chat-btn {
  width: 100%;
  padding: 11px;
  margin-bottom: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.new-chat-btn:hover { filter: brightness(1.1); }

.history-wrap { max-height: 140px; display: flex; flex-direction: column; margin-bottom: 8px; min-height: 0; }
.history-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 0 6px 6px;
}
.icon-tiny { background: none; border: none; cursor: pointer; opacity: 0.7; font-size: 12px; }
.history-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.history-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  text-align: left; padding: 8px 10px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
}
.history-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.history-item.active { background: rgba(139,92,246,0.2); color: #c4b5fd; }
.history-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .x { opacity: 0; border: none; background: none; color: var(--muted); cursor: pointer; }
.history-item:hover .x { opacity: 1; }
.history-empty { font-size: 12px; color: var(--muted); padding: 8px; text-align: center; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border: none; border-radius: 12px;
  background: transparent; color: var(--muted); font-size: 14px;
  font-weight: 500; cursor: pointer; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,0.35), rgba(139,92,246,0.15));
  color: #c4b5fd;
}

.premium-card {
  background: linear-gradient(160deg, rgba(88,28,135,0.5), rgba(30,27,75,0.8));
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 16px;
  padding: 14px;
  margin-top: auto;
}
.premium-card.side { margin-top: auto; }
.prem-title { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.premium-card p { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.prem-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(90deg, #22d3ee, #8b5cf6, #ec4899);
}
.prem-btn.full { margin-top: 8px; }
.prem-btn:hover { filter: brightness(1.08); }
.prem-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 4px; }
.prem-sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.prem-list { list-style: none; font-size: 12px; color: #c4b5fd; margin-bottom: 8px; }
.prem-list li { margin-bottom: 4px; }

/* MAIN */
.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(99,102,241,0.15), transparent 50%), var(--bg);
  position: relative;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.status-pills { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pill {
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #64748b; margin-left: 6px;
}
.dot.green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-text { margin-right: 4px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); cursor: pointer; font-size: 14px;
}
.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff; font-weight: 700; cursor: pointer;
}

.view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.view.active { display: flex; }

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  position: relative;
}
.glow-orb {
  width: 220px; height: 140px;
  background: radial-gradient(circle, rgba(99,102,241,0.45), rgba(236,72,153,0.2), transparent 70%);
  filter: blur(8px);
  position: absolute;
  top: 28%;
  pointer-events: none;
}
.glitch-title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -1.5px;
  background: linear-gradient(90deg, #22d3ee, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  margin-bottom: 8px;
}
.tagline { color: var(--muted); font-size: 14px; margin-bottom: 28px; position: relative; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(580px, 94%);
  background: var(--bg-input);
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
  box-shadow: 0 0 30px rgba(99,102,241,0.15);
  position: relative;
  margin-bottom: 18px;
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
}
.search-bar input::placeholder { color: var(--muted); }
.spark { color: #a78bfa; font-size: 14px; }
.bar-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer; color: var(--muted);
  border: none; background: transparent; font-size: 14px;
}
.bar-icon:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px var(--glow);
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chips {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  max-width: 640px; position: relative;
}
.chip {
  background: rgba(18,18,31,0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

.powered {
  margin-top: 36px;
  font-size: 12px;
  color: var(--muted);
  position: relative;
}

.chat-area { flex: 1; overflow-y: auto; padding: 20px 24px 12px; }
.chat-area.hidden { display: none; }
.messages { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.message {
  display: flex; gap: 12px; align-items: flex-start;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.message.user { flex-direction: row-reverse; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.avatar.ai { background: linear-gradient(135deg, #22d3ee, #8b5cf6); }
.avatar.user { background: #334155; }
.bubble-wrap { max-width: 75%; display: flex; flex-direction: column; gap: 4px; }
.message.user .bubble-wrap { align-items: flex-end; }
.bubble {
  padding: 14px 16px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.6; word-break: break-word;
}
.message.user .bubble { background: var(--bubble-user); border-bottom-right-radius: 6px; }
.message.assistant .bubble {
  background: var(--bubble-ai); border: 1px solid var(--border); border-bottom-left-radius: 6px;
}
.time { font-size: 11px; color: var(--muted); padding: 0 4px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 8px 0 8px 18px; }
.bubble li { margin-bottom: 4px; }
.bubble strong { color: #fff; }
.bubble a { color: #a78bfa; }
.bubble pre {
  background: #080810; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; overflow-x: auto; margin: 10px 0; font-size: 13px;
}
.bubble code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.bubble p code {
  background: rgba(139,92,246,0.2); padding: 2px 5px; border-radius: 4px; color: #c4b5fd;
}
.bubble img.msg-image { max-width: 220px; border-radius: 10px; margin-top: 8px; display: block; }
.typing { display: flex; gap: 4px; padding: 4px 0; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: none; }
  30% { transform: translateY(-5px); }
}

.composer {
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; width: calc(100% - 40px); margin: 0 auto 18px;
  background: var(--bg-input); border: 1px solid rgba(139,92,246,0.3);
  border-radius: 999px; padding: 8px 8px 8px 14px;
}
.composer.hidden { display: none; }
.composer input[type="text"] {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14.5px; font-family: inherit;
}
.composer input::placeholder { color: var(--muted); }
.attach {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 16px;
}
.attach:hover { color: var(--text); }
.img-preview { display: flex; align-items: center; gap: 6px; }
.img-preview.hidden { display: none; }
.img-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.img-preview button { border: none; background: none; color: var(--muted); cursor: pointer; }

.panel { padding: 28px; overflow-y: auto; }
.panel h2 { font-size: 22px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.prompt-card, .tool-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
.prompt-card:hover, .tool-card:hover { border-color: var(--accent); }
.btn-danger {
  background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3);
  color: #fca5a5; padding: 10px 16px; border-radius: 10px; cursor: pointer; font-size: 13px;
}

/* RIGHT */
.rightbar {
  background: var(--bg-side);
  border-left: 1px solid var(--border);
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.rb-section h3 { font-size: 13px; font-weight: 600; }
.rb-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.rb-head a, .link-btn {
  font-size: 11px; color: var(--accent); text-decoration: none;
  background: none; border: none; cursor: pointer;
}
.tool-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); cursor: pointer; margin-bottom: 8px;
}
.tool-row:hover { border-color: var(--accent); }
.tool-row b { display: block; font-size: 13px; }
.tool-row small { color: var(--muted); font-size: 11px; }
.ti {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(99,102,241,0.2); font-size: 14px; flex-shrink: 0;
}
.ti.img { background: rgba(236,72,153,0.2); }
.ti.web { background: rgba(34,211,238,0.15); }
.ti.doc { background: rgba(96,165,250,0.2); }

.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px; cursor: pointer;
}
.recent-item:hover { background: rgba(255,255,255,0.04); }
.recent-item .ri-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-card); display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.recent-item .ri-title { font-size: 13px; }
.recent-item .ri-time { font-size: 11px; color: var(--muted); }

@media (max-width: 1100px) {
  .app { grid-template-columns: 200px 1fr; }
  .rightbar { display: none; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
