* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --bg: #0f0f0f;
  --bg2: #1a1a1a;
  --bg3: #252525;
  --border: #2e2e2e;
  --text: #ececec;
  --muted: #9a9a9a;
  --accent: #c96442;
  --green: #3ecf8e;
  --danger: #ff6b6b;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ===== AUTH ===== */
.screen { position:fixed; inset:0; background:var(--bg); z-index:100; overflow-y:auto; }
.auth-screen { display:flex; align-items:center; justify-content:center; padding:24px; }
.auth-box {
  width:100%; max-width:380px;
  display:flex; flex-direction:column; gap:12px;
}
.brand { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.brand-icon {
  width:40px; height:40px; background:var(--accent); color:#fff;
  border-radius:12px; display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:20px;
}
.brand span { font-weight:600; font-size:18px; }
.auth-box h1 { font-size:26px; font-weight:600; letter-spacing:-0.3px; }
.auth-desc { color:var(--muted); font-size:14px; line-height:1.5; margin-bottom:4px; }
.auth-box input, .set-inp {
  width:100%; padding:14px 16px; background:var(--bg2); border:1px solid var(--border);
  border-radius:12px; color:var(--text); font-size:15px; font-family:inherit; outline:none;
}
.auth-box input:focus, .set-inp:focus { border-color:var(--accent); }
.btn-main {
  width:100%; padding:14px; background:var(--text); color:#111; border:none;
  border-radius:12px; font-size:15px; font-weight:600; cursor:pointer;
}
.btn-main:active { opacity:0.85; }
.btn-google {
  display:flex; align-items:center; justify-content:center; gap:10px;
  width:100%; padding:13px; background:var(--bg2); border:1px solid var(--border);
  border-radius:12px; color:var(--text); font-size:14px; font-weight:500; cursor:pointer;
}
.btn-google:active { background:var(--bg3); }
.btn-link {
  background:none; border:none; color:var(--muted); font-size:13px;
  cursor:pointer; text-decoration:underline; text-underline-offset:2px; align-self:center;
}
.or-line {
  display:flex; align-items:center; gap:12px; color:var(--muted); font-size:12px; margin:4px 0;
}
.or-line::before, .or-line::after { content:''; flex:1; height:1px; background:var(--border); }

.g-header { display:flex; align-items:center; gap:10px; font-weight:600; font-size:16px; }
.acc-btn {
  display:flex; align-items:center; gap:12px; width:100%; padding:12px;
  background:var(--bg2); border:1px solid var(--border); border-radius:12px;
  color:var(--text); cursor:pointer; text-align:left; margin-bottom:8px;
}
.acc-btn:active { border-color:var(--accent); }
.acc-av {
  width:40px; height:40px; border-radius:50%; background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:600; flex-shrink:0;
}
.acc-name { font-weight:550; font-size:14px; }
.acc-email { font-size:12px; color:var(--muted); }

.otp-boxes { display:flex; gap:8px; justify-content:center; margin:12px 0; }
.otp {
  width:46px; height:52px; text-align:center; font-size:20px; font-weight:600;
  background:var(--bg2); border:1px solid var(--border); border-radius:10px;
  color:var(--text); outline:none;
}
.otp:focus { border-color:var(--accent); }
.otp-status { text-align:center; font-size:13px; color:var(--muted); min-height:20px; }

/* ===== APP ===== */
.app { display:flex; height:100vh; background:var(--bg); }
.sidebar {
  width:270px; background:var(--bg2); border-right:1px solid var(--border);
  display:flex; flex-direction:column; flex-shrink:0;
  transition: transform .25s ease;
}
.side-top { padding:14px; }
.new-btn {
  width:100%; display:flex; align-items:center; gap:8px; padding:11px 14px;
  background:var(--bg3); border:1px solid var(--border); border-radius:10px;
  color:var(--text); font-size:14px; font-weight:500; cursor:pointer;
}
.side-chats { flex:1; overflow-y:auto; padding:0 10px 12px; }
.chat-item {
  padding:10px 12px; border-radius:8px; font-size:13px; color:var(--muted);
  cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:2px;
}
.chat-item:active, .chat-item.on { background:var(--bg3); color:var(--text); }
.side-bottom { padding:12px; border-top:1px solid var(--border); }
.side-user {
  display:flex; align-items:center; gap:10px; width:100%; background:none; border:none;
  color:var(--text); cursor:pointer; text-align:left; padding:6px; border-radius:10px;
}
.side-user:active { background:var(--bg3); }
.av {
  width:34px; height:34px; border-radius:50%; background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:600; font-size:14px; flex-shrink:0;
}
.av.big { width:44px; height:44px; font-size:18px; }
.side-user-info { min-width:0; }
.side-user-info div:first-child { font-size:13px; font-weight:550; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.muted { color:var(--muted); font-size:12px; }

.content { flex:1; display:flex; flex-direction:column; min-width:0; }
.bar {
  height:52px; display:flex; align-items:center; justify-content:space-between;
  padding:0 12px; border-bottom:1px solid transparent;
}
.icon {
  width:38px; height:38px; border:none; background:transparent; border-radius:10px;
  color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.icon:active { background:var(--bg3); }
.bar-title { font-size:15px; font-weight:550; color:var(--muted); }

.msgs { flex:1; overflow-y:auto; padding:16px 12px; }
.empty {
  height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; gap:16px; padding:20px; max-width:480px; margin:0 auto;
}
.empty-icon {
  width:52px; height:52px; background:var(--accent); color:#fff; border-radius:14px;
  display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:700;
}
.empty h2 { font-size:22px; font-weight:560; }
.sugs { display:grid; grid-template-columns:1fr 1fr; gap:8px; width:100%; }
.sugs button {
  padding:12px; background:var(--bg2); border:1px solid var(--border); border-radius:12px;
  color:var(--text); font-size:13px; text-align:left; cursor:pointer; line-height:1.35;
}
.sugs button:active { border-color:var(--accent); }

.msg { display:flex; gap:12px; max-width:720px; margin:0 auto 24px; padding:0 4px; width:100%; }
.msg-av {
  width:30px; height:30px; border-radius:50%; flex-shrink:0; display:flex;
  align-items:center; justify-content:center; font-weight:600; font-size:12px; margin-top:2px;
}
.msg.user .msg-av { background:#555; color:#fff; }
.msg.ai .msg-av { background:var(--accent); color:#fff; }
.msg-body { flex:1; min-width:0; }
.msg-role { font-size:13px; font-weight:600; margin-bottom:4px; }
.msg-txt { font-size:15px; line-height:1.65; white-space:pre-wrap; word-break:break-word; }
.msg.user .msg-txt {
  background:var(--bg3); padding:10px 14px; border-radius:14px; display:inline-block;
}
.typing { display:inline-flex; gap:4px; padding:6px 0; }
.typing i {
  width:6px; height:6px; background:var(--muted); border-radius:50%;
  animation: bounce 1.1s infinite ease-in-out;
}
.typing i:nth-child(2){ animation-delay:.15s }
.typing i:nth-child(3){ animation-delay:.3s }
@keyframes bounce {
  0%,80%,100%{ transform:scale(.6); opacity:.4 }
  40%{ transform:scale(1); opacity:1 }
}

.input-area { padding:0 12px 14px; max-width:768px; width:100%; margin:0 auto; }
.composer {
  display:flex; align-items:flex-end; gap:8px; background:var(--bg2);
  border:1px solid var(--border); border-radius:18px; padding:8px 10px 8px 14px;
}
.composer textarea {
  flex:1; border:none; outline:none; resize:none; background:transparent;
  color:var(--text); font-family:inherit; font-size:15px; line-height:1.45;
  max-height:140px; padding:6px 0;
}
.composer textarea::placeholder { color:#666; }
.send {
  width:36px; height:36px; border-radius:10px; border:none; background:var(--text);
  color:#111; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
}
.send:disabled { opacity:.25; cursor:default; }
.disc { text-align:center; font-size:11px; color:var(--muted); margin-top:8px; }

/* ===== SETTINGS ===== */
.settings { background:var(--bg); }
.set-head {
  height:52px; display:flex; align-items:center; justify-content:space-between;
  padding:0 8px; border-bottom:1px solid var(--border); font-weight:560; font-size:16px;
  position:sticky; top:0; background:var(--bg); z-index:5;
}
.set-body { padding:16px; max-width:520px; margin:0 auto; padding-bottom:40px; }
.set-card {
  display:flex; align-items:center; gap:12px; padding:14px; background:var(--bg2);
  border-radius:14px; margin-bottom:16px;
}
.set-name { font-weight:560; font-size:15px; }
.badge {
  margin-left:auto; background:var(--bg3); color:var(--muted); font-size:11px;
  padding:4px 10px; border-radius:20px; font-weight:500;
}
.set-group {
  background:var(--bg2); border-radius:14px; margin-bottom:12px; overflow:hidden;
}
.set-item {
  display:flex; align-items:center; gap:12px; width:100%; padding:14px 16px;
  background:none; border:none; border-bottom:1px solid var(--border);
  color:var(--text); font-size:14px; cursor:pointer; text-align:left;
}
.set-group .set-item:last-child { border-bottom:none; }
.set-item .right { margin-left:auto; }
.set-item.danger { color:var(--danger); }
.toggle-row { justify-content:space-between; }
.lbl { display:block; font-size:13px; color:var(--muted); margin:12px 0 6px; }
.sec-title { font-size:13px; color:var(--muted); margin:20px 0 10px; font-weight:500; }

.cap-item {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding:14px 0; border-bottom:1px solid var(--border);
}
.cap-title { font-size:14px; font-weight:500; margin-bottom:3px; }
.cap-desc { font-size:12px; color:var(--muted); line-height:1.4; }
.beta {
  font-size:10px; background:#3a2a1a; color:#e8a87c; padding:2px 6px;
  border-radius:4px; margin-left:4px; font-weight:600;
}

/* switch */
.switch { position:relative; width:44px; height:26px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.slider {
  position:absolute; inset:0; background:#444; border-radius:26px; cursor:pointer;
  transition:.2s;
}
.slider::before {
  content:''; position:absolute; width:20px; height:20px; left:3px; bottom:3px;
  background:#fff; border-radius:50%; transition:.2s;
}
.switch input:checked + .slider { background:#3b82f6; }
.switch input:checked + .slider::before { transform:translateX(18px); }

@media (max-width:768px) {
  .sidebar {
    position:fixed; left:0; top:0; bottom:0; z-index:50;
    transform:translateX(-100%);
  }
  .sidebar.open { transform:translateX(0); }
  .sugs { grid-template-columns:1fr; }
}
