/* ============================================================
   aurael — main stylesheet
   Theme: Clean SaaS / black & white / LTR
   ============================================================ */

/* self-hosted Inter — no third-party font network calls */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/inter-latin-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/inter-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/inter-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/inter-latin-700.woff2') format('woff2'); }

:root {
  --bg: #050506;
  --panel: #0c0c0e;
  --panel-2: #131316;
  --hover: #1a1a1e;
  --border: #232327;
  --border-soft: #1a1a1e;
  --text: #f4f4f5;
  --muted: #9a9aa2;
  --faint: #5f5f68;
  --danger: #f87171;
  --font: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, Menlo, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(255, 255, 255, .18); }
img { display: block; max-width: 100%; }
button, input, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #26262b; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #36363d; }

.hidden { display: none !important; }

button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid rgba(255,255,255,.3); outline-offset: 2px; }

/* ============================================================
   App layout
   ============================================================ */
.app { display: flex; height: 100dvh; }

/* ------------------ Sidebar ------------------ */
.sidebar {
  width: 288px;
  flex-shrink: 0;
  background: #0a0a0c;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  z-index: 60;
}

.side-head { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.side-logo { width: 30px; height: 30px; }
.side-brand { font-size: 19px; font-weight: 700; letter-spacing: .6px; }

.new-chat {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #fff; color: #0a0a0b;
  border: none; border-radius: 12px;
  padding: 11px 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .15s;
}
.new-chat:hover { background: #e4e4e7; }
.new-chat:active { transform: scale(.98); }

/* Studio / Coder nav buttons */
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; color: #c9c9cf;
  padding: 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s; text-align: left;
}
.nav-btn:hover { background: var(--hover); color: #fff; }
.nav-btn.on { background: #1e1e23; color: #fff; }

.chat-list { flex: 1; overflow-y: auto; margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.chat-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 24px 8px; }

.chat-item {
  display: flex; align-items: center; gap: 4px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  color: #c9c9cf; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: #1e1e23; color: #fff; }
.chat-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-del, .chat-edit {
  flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center;
  background: none; border: none; color: #7c7c85; border-radius: 7px; cursor: pointer;
  opacity: 0; transition: .15s;
}
.chat-item:hover .chat-del, .chat-item:hover .chat-edit { opacity: 1; }
.chat-del:hover, .chat-edit:hover { background: #2a2a30; color: #fff; }
@media (hover: none) { .chat-del, .chat-edit { opacity: 1; } }

/* inline rename */
.rename-input {
  flex: 1; min-width: 0;
  background: #0f0f12; border: 1px solid #3a3a42; border-radius: 8px;
  color: #fff; font-size: 13.5px; padding: 4px 8px; outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.05);
}

.side-foot {
  margin-top: 10px; padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  text-align: center; font-size: 11.5px; color: var(--faint);
}

/* ------------------ Main column ------------------ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Top bar */
.topbar {
  height: 58px; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
}

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex-shrink: 0;
  background: none; border: 1px solid var(--border); border-radius: 10px;
  color: #d4d4d8; cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: var(--hover); color: #fff; }
.only-mobile { display: none; }

.chat-title {
  font-size: 14.5px; font-weight: 500; color: #d8d8dd;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%;
}
.spacer { flex: 1; }

.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  border: 1px solid #2e2e34; background: #1a1a1e; cursor: pointer; padding: 0;
  transition: box-shadow .2s;
}
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, #3f3f46, #18181c);
  text-transform: uppercase;
}

/* User menu */
.user-menu {
  position: absolute; top: 54px; right: 14px; min-width: 240px;
  background: #151518; border: 1px solid var(--border); border-radius: 16px;
  padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.55); z-index: 80; display: none;
}
.user-menu.open { display: block; animation: pop .18s ease; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.menu-name { font-size: 14px; font-weight: 600; }
.menu-email {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; color: #e7e7ea; font-size: 13.5px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  text-align: left; transition: background .15s;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(248,113,113,.09); }

/* ------------------ Messages area ------------------ */
.scroller { flex: 1; overflow-y: auto; }

/* Welcome state */
.empty {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px 22px 60px; position: relative;
}
.empty::before {
  content: ''; position: absolute; top: -140px; left: 50%; transform: translateX(-50%);
  width: 640px; height: 430px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.06), transparent);
}
.hero-logo {
  width: 86px; height: 86px; margin-bottom: 24px; position: relative;
  filter: drop-shadow(0 0 26px rgba(255,255,255,.22));
  animation: heroIn .6s ease;
}
.hero-title { font-size: clamp(24px, 4vw, 32px); font-weight: 700; margin-bottom: 8px; animation: heroIn .6s ease .05s both; }
.hero-sub { font-size: 15.5px; color: var(--muted); margin-bottom: 32px; animation: heroIn .6s ease .1s both; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 700px; animation: heroIn .6s ease .15s both; }
.chip {
  border: 1px solid #26262b; background: #0f0f12; color: #c6c6cd;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: .2s;
}
.chip:hover { background: #18181d; color: #fff; border-color: #3b3b43; transform: translateY(-1px); }

/* Messages */
.messages {
  max-width: 820px; margin: 0 auto;
  padding: 30px 20px 12px;
  display: flex; flex-direction: column; gap: 24px;
}

.msg { display: flex; gap: 12px; }
.msg.enter { animation: msgIn .3s ease; }
.msg-user { justify-content: flex-end; }

/* user bubble */
.bubble {
  max-width: min(78%, 580px);
  background: #1a1a1f; border: 1px solid #242429;
  padding: 11px 17px; border-radius: 18px;
  font-size: 14.5px; line-height: 1.8;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* AI message */
.ai-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #101013; border: 1px solid #232328;
  display: grid; place-items: center; flex-shrink: 0; margin-top: 3px;
}
.ai-avatar img { width: 18px; height: 18px; }
.ai-content { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.9; color: #ececef; padding-top: 2px; overflow-wrap: anywhere; }

/* Persian/RTL assistant answers */
.ai-content.rtl { direction: rtl; text-align: right; }

/* Markdown */
.markdown p { margin: .45em 0; }
.markdown > p:first-child { margin-top: 0; }
.markdown > p:last-child { margin-bottom: 0; }
.markdown ul, .markdown ol { padding-inline-start: 1.5em; margin: .45em 0; }
.markdown li { margin: .18em 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-weight: 700; line-height: 1.5; margin: .9em 0 .4em; }
.markdown h1 { font-size: 1.35em; } .markdown h2 { font-size: 1.22em; }
.markdown h3 { font-size: 1.1em; }  .markdown h4 { font-size: 1em; }
.markdown blockquote {
  border-inline-start: 3px solid #34343b;
  padding-inline-start: 13px; color: #bcbcc3; margin: .6em 0;
}
.markdown hr { border: none; border-top: 1px solid #242428; margin: .9em 0; }
.markdown :not(pre) > code {
  background: #1d1d22; border: 1px solid #2c2c32;
  padding: .05em .45em; border-radius: 6px;
  font-family: var(--mono); font-size: .86em;
  direction: ltr; unicode-bidi: embed;
}
.markdown a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.markdown strong { font-weight: 700; }
.markdown del { color: #8a8a92; }

/* code block */
.codeblock {
  margin: 14px 0; border: 1px solid #26262b; border-radius: 14px;
  overflow: hidden; background: #0a0a0c;
  direction: ltr; text-align: left;
}
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; background: #111114; border-bottom: 1px solid #222226;
  font-size: 12px; color: #8e8e97; font-family: var(--mono);
}
.copy-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: #9a9aa2;
  font-family: var(--font); font-size: 12px; cursor: pointer;
  padding: 4px 9px; border-radius: 7px; transition: .15s;
}
.copy-btn:hover { background: #1f1f24; color: #fff; }
.copy-btn.copied { color: #4ade80; }
.codeblock pre { padding: 16px; margin: 0; overflow-x: auto; }
.codeblock pre code {
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  color: #e9e9ee; white-space: pre; background: none; border: none; padding: 0;
}

/* "typing" indicator */
.typing { display: flex; gap: 5px; padding: 12px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #8a8a93;
  animation: bounce 1.1s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

.error-text { color: #fda4a4; }

/* message action bar (copy / like / dislike / regenerate — ChatGPT style) */
.ai-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-actions { display: flex; gap: 2px; margin: 4px 0 0 -6px; direction: ltr; }
.action-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: none; border: none; border-radius: 8px;
  color: #8a8a92; cursor: pointer; transition: background .15s, color .15s;
}
.action-btn:hover { background: #1f1f24; color: #fff; }
.action-btn.on { color: #fff; background: #26262c; }
.action-btn.on[data-act="like"] { color: #4ade80; background: rgba(74,222,128,.13); }
.action-btn.on[data-act="like"]:hover { background: rgba(74,222,128,.2); color: #4ade80; }
.action-btn.on[data-act="dislike"] { color: #f87171; background: rgba(248,113,113,.13); }
.action-btn.on[data-act="dislike"]:hover { background: rgba(248,113,113,.2); color: #f87171; }
.action-btn.copied { color: #4ade80; }

/* ------------------ Composer ------------------ */
.composer-wrap { flex-shrink: 0; padding: 12px 16px 16px; }

.composer {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  background: #141417; border: 1px solid #2a2a30; border-radius: 28px;
  padding: 9px 10px;
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: #48484f; box-shadow: 0 0 0 4px rgba(255,255,255,.05); }

#input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none; resize: none;
  color: #fff; font-size: 15px; line-height: 1.7;
  max-height: 200px; padding: 8px 12px;
}
#input::placeholder { color: #6a6a73; }

.send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; flex-shrink: 0;
  background: #fff; color: #0a0a0b;
  display: grid; place-items: center; cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.send-btn:hover:not(:disabled) { transform: scale(1.07); }
.send-btn:disabled { opacity: .3; cursor: default; }

/* stop square — shown while the AI is answering */
.send-btn.stop { background: #fff; color: #0a0a0b; }
.send-btn.stop:hover { transform: none; }
.send-btn.stop { animation: stopPulse 1.6s ease-out infinite; }
@keyframes stopPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.25); }
  70%  { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.composer-hint { text-align: center; font-size: 11px; color: #55555d; margin-top: 9px; }

/* coming-soon tools */
.soon-badge {
  display: inline-block; margin: 6px 0 14px; padding: 5px 14px;
  border: 1px solid #3a3a42; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, #2a2a30, #141417);
}
.composer.disabled { opacity: .45; }
#input:disabled { cursor: not-allowed; }

/* ============================================================
   Sign-in page
   ============================================================ */
body.login-body {
  overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 24px;
  position: relative;
}

.glow {
  position: fixed; top: -260px; left: 50%; transform: translateX(-50%);
  width: 760px; height: 560px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.08), transparent);
}

.login-card {
  position: relative; width: min(430px, 100%);
  background: #0c0c0e; border: 1px solid #222227; border-radius: 26px;
  padding: 48px 44px 34px; text-align: center;
  box-shadow: 0 40px 90px rgba(0,0,0,.55);
  animation: cardIn .5s ease;
}

.login-logo {
  width: 84px; height: 84px; margin: 0 auto 16px;
  filter: drop-shadow(0 0 24px rgba(255,255,255,.22));
}
.login-brand { font-size: 32px; font-weight: 700; letter-spacing: 1.5px; line-height: 1.2; }
.login-tag { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* step dots */
.step-dots { display: flex; gap: 6px; justify-content: center; margin: 22px 0 26px; }
.step-dots i { width: 6px; height: 6px; border-radius: 50%; background: #2a2a30; transition: background .3s; }
.step-dots i.on { background: #fff; }

.login-step.anim { animation: cardIn .35s ease; }
.step-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.step-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; line-height: 1.7; }
.code-email { color: #e8e8ec; direction: ltr; display: inline-block; }

/* inputs */
.text-input {
  width: 100%;
  background: #101013; border: 1px solid #2a2a30; border-radius: 14px;
  color: #fff; font-size: 15px; padding: 13px 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#email-input { direction: ltr; text-align: left; }
.text-input:focus { border-color: #4a4a52; box-shadow: 0 0 0 4px rgba(255,255,255,.05); }
.text-input::placeholder { color: #6a6a73; }

.field-error { color: #fda4a4; font-size: 12.5px; margin-top: 8px; margin-bottom: -4px; }

/* action button */
.email-btn {
  width: 100%; margin-top: 16px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #fff; color: #0a0a0b; border: none; border-radius: 999px;
  padding: 13px 20px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .15s, opacity .15s;
  min-height: 49px;
}
.email-btn:hover:not(:disabled):not(.loading) { background: #e7e7ea; transform: translateY(-1px); }
.email-btn:disabled { opacity: .35; cursor: default; }
.email-btn.loading { opacity: .85; cursor: wait; }

.btn-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,.22); border-top-color: #0a0a0b;
  border-radius: 50%; display: none;
  animation: spin .8s linear infinite;
}
.email-btn.loading .btn-spinner { display: block; }

/* OTP digits */
.otp { display: flex; gap: 10px; direction: ltr; justify-content: center; margin: 4px 0 6px; }
.otp-digit {
  width: 46px; height: 56px; text-align: center;
  font-size: 22px; font-weight: 700; color: #fff;
  background: #101013; border: 1px solid #2a2a30; border-radius: 12px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.otp-digit:focus { border-color: #56565e; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.otp.shake { animation: shake .4s; }

/* links */
.resend { font-size: 13px; color: #8a8a92; margin-top: 16px; }
.cooldown { color: #5f5f68; }
.link-btn {
  background: none; border: none; color: #d0d0d6;
  font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover:not(:disabled) { color: #fff; }
.link-btn:disabled { color: #55555d; cursor: default; text-decoration: none; }
.link-btn.subtle { display: block; margin: 12px auto 0; color: #7a7a84; }
.link-btn.subtle:hover { color: #b9b9c0; }

/* name step */
.name-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700; color: #fff; text-transform: uppercase;
  background: linear-gradient(135deg, #3f3f46, #18181c);
  border: 1px solid #2e2e34;
}

.login-note { margin-top: 28px; font-size: 12px; color: #76767f; }

.login-footer {
  position: fixed; bottom: 16px; left: 0; right: 0;
  text-align: center; font-size: 12px; color: #4c4c55;
}

/* ------------------ toast ------------------ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1b1b1f; border: 1px solid #2d2d33; color: #eee;
  padding: 11px 20px; border-radius: 13px; font-size: 13.5px;
  z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
  box-shadow: 0 14px 44px rgba(0,0,0,.55);
  max-width: min(92vw, 480px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ------------------ mobile overlay ------------------ */
.overlay {
  position: fixed; inset: 0; z-index: 55; display: none;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* ------------------ animations ------------------ */
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop   { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cardIn{ from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes heroIn{ from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ============================================================
   Responsive
   ============================================================ */
/* desktop sidebar collapse (toggle button) */
.sidebar { transition: margin-left .28s ease; }
@media (min-width: 921px) {
  .app.sb-closed .sidebar { margin-left: -289px; }
}

@media (max-width: 920px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: 284px;
    transform: translateX(-110%);
    transition: transform .3s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 80px rgba(0,0,0,.6); }
  .only-mobile { display: grid; }
  .chat-title { max-width: 42%; }
}

@media (max-width: 560px) {
  .login-card { padding: 40px 24px 30px; border-radius: 22px; }
  .login-logo { width: 72px; height: 72px; }
  .login-brand { font-size: 27px; }
  .otp { gap: 8px; }
  .otp-digit { width: 40px; height: 50px; font-size: 20px; }
  .messages { padding: 22px 14px 8px; gap: 20px; }
  .bubble { max-width: 88%; }
  .composer-wrap { padding: 10px 12px 14px; }
  .hero-title { font-size: 24px; }
  .hero-sub { font-size: 14.5px; }
  .chips { gap: 8px; }
  .chip { font-size: 12.5px; padding: 8px 14px; }
}

/* ============================================================
   Responsive & overflow hardening (audit pass)
   ============================================================ */

/* viewport height fallback (older mobile browsers) */
.app { height: 100vh; height: 100dvh; }
body.login-body { min-height: 100vh; min-height: 100dvh; }

/* iPhone home-bar safe area */
.composer-wrap { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.topbar { padding-left: calc(18px + env(safe-area-inset-left, 0px)); padding-right: calc(18px + env(safe-area-inset-right, 0px)); }

/* inputs ≥16px → iOS no longer auto-zooms on focus */
.text-input, #input, .rename-input { font-size: 16px; }

/* empty / coming-soon state: stays centered but NEVER clips on short screens */
.empty {
  justify-content: flex-start;
  background: radial-gradient(640px 430px at 50% 0%, rgba(255,255,255,.06), transparent 60%);
}
.empty::before, .empty::after { display: block; content: ''; flex: 1 0 0; min-height: 6px; }
.empty::before { order: -1; }
.empty::after { order: 99; }
.empty > * { order: 1; }

/* login page: on short screens stop gluing the footer to the screen bottom */
@media (max-height: 680px) {
  body.login-body { flex-direction: column; }
  .login-footer { position: static; margin: 22px 0 14px; }
  .login-card { padding-top: 34px; padding-bottom: 28px; }
}

/* short landscape phones: tighten the hero so it always fits */
@media (max-height: 620px) {
  .empty { padding-top: 12px; padding-bottom: 20px; }
  .hero-logo { width: 56px; height: 56px; margin-bottom: 12px; }
  .hero-title { font-size: 22px; margin-bottom: 6px; }
  .hero-sub { margin-bottom: 18px; font-size: 14px; }
}

/* very narrow phones (320–400px): otp must fit, code blocks shrink a bit */
@media (max-width: 400px) {
  .otp { gap: 6px; }
  .otp-digit { width: 38px; height: 48px; font-size: 19px; }
  .chat-title { max-width: 36%; font-size: 13.5px; }
  .codeblock pre { padding: 12px; }
  .codeblock pre code { font-size: 12.5px; }
  .sidebar { width: min(284px, 85vw); }
  .toast { bottom: 14px; font-size: 12.5px; padding: 10px 14px; }
}

/* markdown images never overflow */
.ai-content img { max-width: 100%; height: auto; border-radius: 10px; }

/* kill any horizontal overflow — the stray glow element was wider than mobile screens */
html, body { overflow-x: hidden; }
.empty::before, .empty::after {
  position: static; width: auto; height: auto; top: auto; left: auto;
  transform: none; background: none; pointer-events: none;
}
