:root {
  --bg: #0b0c0d;
  --panel: #111315;
  --panel-2: #17191c;
  --line: #25282c;
  --text: #ecece8;
  --muted: #8a8d91;
  --accent: #d8ff67;
  --accent-dark: #101409;
  --danger: #ff746c;
  --sidebar: 286px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100%; }
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 18px 14px 14px; background: #0e1011; border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 0 4px 20px; }
.brand-row strong, .brand-row span, .sidebar-footer strong, .sidebar-footer span { display: block; }
.brand-row strong { font-size: 15px; letter-spacing: -.2px; }
.brand-row span, .sidebar-footer span { color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; background: var(--accent); color: var(--accent-dark); font-weight: 900; }
.brand-mark.large { width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 13px; font-size: 18px; }
.new-chat { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 12px; border: 1px solid #32363a; border-radius: 10px; background: var(--panel-2); text-align: left; cursor: pointer; }
.new-chat:hover { border-color: #4a4f54; background: #1d2023; }
.new-chat span { color: var(--accent); font-size: 18px; line-height: 1; }
kbd { margin-left: auto; padding: 1px 5px; border: 1px solid #363a3e; border-radius: 4px; color: #72767b; background: #121416; font: 10px inherit; }
.search { display: flex; align-items: center; gap: 8px; margin: 14px 2px 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); background: #141618; }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.search input::placeholder { color: #666a6e; }
.history-label { padding: 9px 10px 6px; color: #666a6f; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; }
.chat-item { position: relative; display: flex; align-items: center; width: 100%; margin: 2px 0; padding: 9px 31px 9px 10px; border: 0; border-radius: 8px; color: #aeb1b5; background: transparent; text-align: left; cursor: pointer; }
.chat-item:hover, .chat-item.active { color: var(--text); background: #1a1c1f; }
.chat-item.active::before { position: absolute; left: 0; width: 2px; height: 18px; border-radius: 2px; background: var(--accent); content: ""; }
.chat-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item time { display: none; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; padding: 13px 8px 2px; border-top: 1px solid var(--line); }
.sidebar-footer > div:nth-child(2) { min-width: 0; flex: 1; }
.sidebar-footer strong { overflow: hidden; color: #c7c9c7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #777; box-shadow: 0 0 0 3px #232528; }
.status-dot.online { background: var(--accent); box-shadow: 0 0 0 3px rgba(216,255,103,.12); }
.main { position: relative; display: flex; min-width: 0; min-height: 0; height: 100%; overflow: hidden; flex-direction: column; background: radial-gradient(circle at 50% -20%, #191c1d 0, var(--bg) 44%); }
.topbar { z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 62px; flex: 0 0 auto; padding: 0 22px; border-bottom: 1px solid rgba(43,46,49,.75); backdrop-filter: blur(12px); }
.conversation-title { padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; font-weight: 650; cursor: pointer; }
.conversation-title:hover { background: #1a1c1e; }
.conversation-title span { color: var(--muted); font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.privacy-pill { padding: 5px 9px; border: 1px solid #282b2e; border-radius: 99px; color: var(--muted); font-size: 10px; }
.privacy-pill i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--accent); }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-btn:hover { color: var(--text); background: #1c1e20; }
.messages { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; }
.message-list { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 210px; }
.welcome { display: flex; min-height: calc(100vh - 300px); align-items: center; justify-content: center; text-align: center; }
.welcome-inner { max-width: 560px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.welcome h1 { margin: 12px 0 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -.045em; }
.welcome p { max-width: 470px; margin: 0 auto; color: var(--muted); font-size: 15px; }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 28px; }
.suggestion { padding: 13px; border: 1px solid var(--line); border-radius: 11px; color: #b7b9bb; background: rgba(19,21,23,.7); cursor: pointer; text-align: left; }
.suggestion:hover { border-color: #3e4346; background: #191b1d; }
.suggestion b { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; }
.suggestion span { color: var(--muted); font-size: 10px; }
.message { display: grid; grid-template-columns: 30px 1fr; gap: 13px; margin-bottom: 28px; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #303337; border-radius: 8px; color: #b7b9bb; background: #17191b; font-size: 10px; font-weight: 800; }
.message.assistant .avatar { border-color: rgba(216,255,103,.4); color: var(--accent-dark); background: var(--accent); }
.message-head { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 7px; }
.message-head strong { font-size: 12px; }
.message-head time { color: #62666a; font-size: 9px; }
.message-body { color: #d6d7d4; font-size: 14px; line-height: 1.72; overflow-wrap: anywhere; }
.message-body p { margin: 0 0 10px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body pre { overflow-x: auto; padding: 14px; border: 1px solid #292c2f; border-radius: 9px; background: #08090a; }
.message-body code { padding: 2px 4px; border-radius: 4px; color: #ddfca0; background: #1b1e18; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.message-body pre code { padding: 0; color: #d5d7d3; background: transparent; }
.message-body ul, .message-body ol { padding-left: 22px; }
.message-tools { margin-top: 8px; opacity: 0; transition: opacity .15s; }
.message:hover .message-tools { opacity: 1; }
.tool-button { padding: 3px 7px; border: 0; border-radius: 5px; color: #777b7f; background: transparent; cursor: pointer; font-size: 10px; }
.tool-button:hover { color: var(--text); background: #1a1c1e; }
.cursor { display: inline-block; width: 6px; height: 14px; margin-left: 2px; background: var(--accent); vertical-align: -2px; animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-wrap { position: absolute; right: 0; bottom: 0; left: 0; padding: 42px 20px 14px; background: linear-gradient(transparent, var(--bg) 35%); }
.composer { width: min(760px, 100%); margin: 0 auto; padding: 13px 14px 10px; border: 1px solid #33373a; border-radius: 15px; background: #181a1c; box-shadow: 0 16px 45px rgba(0,0,0,.4); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #50554f; box-shadow: 0 16px 50px rgba(0,0,0,.5), 0 0 0 1px rgba(216,255,103,.08); }
.composer textarea { display: block; width: 100%; max-height: 180px; resize: none; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.55; }
.composer textarea::placeholder { color: #777b7e; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.hint { color: #5e6266; font-size: 9px; }
.send-btn { width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--accent-dark); background: var(--accent); cursor: pointer; font-size: 17px; font-weight: 800; }
.send-btn:hover { filter: brightness(1.08); }
.send-btn:disabled { color: #777; background: #303337; cursor: default; }
.send-btn.stop { color: white; background: #44484c; font-size: 0; }
.send-btn.stop::after { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: white; content: ""; }
.disclaimer { margin: 8px 0 0; color: #55595d; font-size: 9px; text-align: center; }
.modal-backdrop { z-index: 20; position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(5,6,7,.84); backdrop-filter: blur(10px); }
.modal-backdrop.hidden { display: none; }
.modal { width: min(380px, 100%); padding: 30px; border: 1px solid #303337; border-radius: 18px; background: #141618; box-shadow: 0 25px 80px #000; text-align: center; }
.modal h1 { margin: 0 0 6px; font-size: 24px; }
.modal p { margin: 0 0 20px; color: var(--muted); }
.modal input { width: 100%; padding: 11px 12px; border: 1px solid #363a3e; border-radius: 9px; outline: none; color: var(--text); background: #0d0f10; }
.modal input:focus { border-color: #69705e; }
.modal button { width: 100%; margin-top: 10px; padding: 11px; border: 0; border-radius: 9px; color: var(--accent-dark); background: var(--accent); font-weight: 800; cursor: pointer; }
.modal .form-error { min-height: 20px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }
.toast { z-index: 30; position: fixed; right: 18px; bottom: 18px; max-width: 360px; padding: 10px 13px; border: 1px solid #34383b; border-radius: 9px; background: #1b1e20; box-shadow: 0 12px 35px #0008; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: #633a3a; color: #ffb1ac; }
.empty-list { padding: 24px 10px; color: #666a6e; font-size: 11px; text-align: center; }
.mobile-only { display: none; }

@media (max-width: 760px) {
  .shell { display: block; height: 100%; }
  .main { height: 100vh; height: 100dvh; }
  .mobile-only { display: grid; }
  .sidebar { z-index: 10; position: fixed; inset: 0 auto 0 0; width: min(310px, 88vw); box-shadow: 20px 0 60px #000b; transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .brand-row .mobile-only { margin-left: auto; }
  .topbar { padding: 0 12px; }
  .privacy-pill { display: none; }
  .message-list { width: calc(100% - 26px); padding: 26px 0 max(190px, calc(150px + env(safe-area-inset-bottom))); }
  .welcome { min-height: calc(100vh - 260px); }
  .suggestions { grid-template-columns: 1fr; }
  .suggestion:nth-child(3) { display: none; }
  .composer-wrap { padding-right: 10px; padding-bottom: max(14px, env(safe-area-inset-bottom)); padding-left: 10px; }
  .hint { display: none; }
}
