@charset "UTF-8";

:root {
  color-scheme: dark;
  --bg: #090d16;
  --panel: #0d121d;
  --panel-raised: #111826;
  --panel-soft: #141d2b;
  --line: rgba(177, 195, 219, 0.11);
  --line-bright: rgba(177, 195, 219, 0.18);
  --text: #eef3fa;
  --muted: #8895a9;
  --muted-soft: #657286;
  --mint: #79e3d0;
  --mint-deep: #42baa9;
  --violet: #b8a8ff;
  --blue: #90baff;
  --amber: #efc98c;
  --danger: #ffb3a8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  font-family: "Segoe UI", "Noto Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html { height: 100%; min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  height: 100%;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 77% 0%, rgba(52, 93, 112, 0.12), transparent 38%),
    radial-gradient(ellipse at 0% 92%, rgba(111, 80, 159, 0.09), transparent 32%),
    var(--bg);
  direction: rtl;
}
button, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
svg { width: 1.25rem; height: 1.25rem; display: block; }
.icon-definitions, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; inset-block-start: 10px; inset-inline-start: 10px; z-index: 20; padding: 10px 14px; border-radius: 10px; color: #081310; background: var(--mint); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
[hidden] { display: none !important; }

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); width: 100%; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 28px 20px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(15, 21, 33, 0.96), rgba(11, 16, 26, 0.98));
  border-inline-start: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; color: var(--mint); border: 1px solid rgba(121, 227, 208, 0.28); border-radius: 14px; background: linear-gradient(145deg, rgba(121, 227, 208, 0.12), rgba(123, 104, 196, 0.12)); box-shadow: inset 0 0 18px rgba(121, 227, 208, 0.05), 0 7px 25px rgba(0, 0, 0, 0.2); }
.brand-mark svg { width: 25px; height: 25px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong, .mobile-brand strong { font-size: 15px; letter-spacing: 0.13em; direction: ltr; }
.brand-copy strong span, .mobile-brand strong span { color: var(--mint); font-weight: 600; }
.brand-copy small { color: var(--muted-soft); font-size: 11px; letter-spacing: 0.01em; }
.new-chat-button { display: flex; align-items: center; gap: 10px; width: 100%; margin-block-start: 42px; padding: 12px 13px; border: 1px solid rgba(121, 227, 208, 0.22); border-radius: 12px; color: #cce9e4; background: linear-gradient(110deg, rgba(121, 227, 208, 0.1), rgba(121, 227, 208, 0.025)); cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.new-chat-button:hover { border-color: rgba(121, 227, 208, 0.48); background: rgba(121, 227, 208, 0.13); transform: translateY(-1px); }
.new-chat-button svg { width: 19px; height: 19px; color: var(--mint); }
.new-chat-button span { font-size: 13px; font-weight: 600; }
.new-chat-button kbd { margin-inline-start: auto; color: #738193; font: 10px/1.2 inherit; }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin: 31px 7px 9px; }
.sidebar-section-label { color: #78879c; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.history-count { display: grid; min-width: 20px; height: 20px; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: #8291a5; background: rgba(255, 255, 255, 0.025); font-size: 9px; }
.history-list { display: grid; gap: 5px; max-height: min(34vh, 340px); overflow-y: auto; padding-inline: 2px; scrollbar-width: thin; scrollbar-color: rgba(148, 166, 191, 0.2) transparent; }
.history-entry { display: flex; align-items: center; gap: 2px; min-width: 0; padding: 2px; border: 1px solid transparent; border-radius: 10px; transition: border-color 150ms ease, background 150ms ease; }
.history-entry:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.025); }
.history-select { display: grid; flex: 1; min-width: 0; gap: 4px; padding: 8px 9px; border: 0; border-radius: 8px; color: #c4cfdd; background: transparent; text-align: right; cursor: pointer; }
.history-select[aria-current="page"] { color: #e5f5f2; background: rgba(121, 227, 208, 0.075); }
.history-title, .history-preview, .history-date { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-title { font-size: 11px; font-weight: 600; }
.history-preview { color: #78869a; font-size: 9px; }
.history-date { color: #647287; font-size: 8px; }
.history-delete { display: grid; width: 29px; height: 29px; flex: none; place-items: center; border: 0; border-radius: 8px; color: #718097; background: transparent; cursor: pointer; opacity: 0.68; transition: color 150ms ease, background 150ms ease, opacity 150ms ease; }
.history-delete:hover, .history-delete:focus-visible { color: var(--danger); background: rgba(255, 179, 168, 0.08); opacity: 1; }
.history-delete svg { width: 14px; height: 14px; }
.history-empty { margin: 4px 8px 0; color: #69778b; font-size: 10px; line-height: 1.7; }
.sidebar-note { position: relative; min-height: 148px; margin-block-start: 28px; padding: 17px; overflow: hidden; border: 1px solid rgba(176, 163, 255, 0.12); border-radius: 14px; background: linear-gradient(137deg, rgba(84, 68, 143, 0.14), rgba(17, 25, 39, 0.7) 68%); }
.note-icon { position: relative; z-index: 1; display: grid; width: 31px; height: 31px; place-items: center; color: var(--violet); border: 1px solid rgba(184, 168, 255, 0.22); border-radius: 10px; background: rgba(184, 168, 255, 0.08); }
.note-icon svg { width: 17px; height: 17px; }
.sidebar-note p { position: relative; z-index: 1; margin: 14px 0 0; color: #e4e0fb; font-size: 13px; line-height: 1.85; }
.sidebar-note p span { color: #9a96b5; }
.note-orbit { position: absolute; inset-inline-end: -43px; inset-block-end: -79px; width: 150px; height: 150px; border: 1px solid rgba(184, 168, 255, 0.1); border-radius: 50%; box-shadow: 0 0 0 17px rgba(184, 168, 255, 0.025), 0 0 0 36px rgba(184, 168, 255, 0.02); }
.sidebar-spacer { flex: 1; min-height: 40px; }
.privacy-note { display: flex; align-items: center; gap: 10px; padding: 13px 11px; border-block: 1px solid var(--line); }
.privacy-note > svg { width: 20px; height: 20px; color: #83cfc1; flex: none; }
.privacy-note div { display: grid; gap: 3px; }
.privacy-note strong { color: #c9d5df; font-size: 11px; font-weight: 600; }
.privacy-note span { color: var(--muted-soft); font-size: 10px; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 15px 2px 0; color: #6f7d90; font-size: 10px; letter-spacing: 0.08em; direction: ltr; }
.footer-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--mint-deep); }
.footer-version { margin-inline-start: auto; color: #59667a; letter-spacing: 0; direction: rtl; }

.main-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; height: 100%; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 0 clamp(20px, 4vw, 62px); border-block-end: 1px solid rgba(177, 195, 219, 0.075); }
.topbar-context { display: flex; align-items: center; gap: 11px; color: #8c98aa; font-size: 12px; }
.topbar-context #current-chat-title { display: block; max-width: min(42vw, 420px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-line { width: 23px; height: 1px; background: linear-gradient(90deg, transparent, rgba(121, 227, 208, 0.6)); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 31px; padding: 0 11px; border: 1px solid rgba(121, 227, 208, 0.13); border-radius: 999px; color: #9cbab5; background: rgba(121, 227, 208, 0.045); font-size: 10px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #6dd8be; box-shadow: 0 0 8px rgba(109, 216, 190, 0.48); }
.status-pill[data-state="checking"] .status-dot { background: #d3b870; box-shadow: 0 0 8px rgba(211, 184, 112, 0.38); animation: status-pulse 1.15s ease-in-out infinite; }
.status-pill[data-state="offline"] { border-color: rgba(239, 201, 140, 0.22); color: #d4b788; background: rgba(239, 201, 140, 0.06); }
.status-pill[data-state="offline"] .status-dot { background: #e1b66c; box-shadow: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: #aeb9c7; background: rgba(255, 255, 255, 0.025); cursor: pointer; transition: border-color 150ms ease, color 150ms ease, background 150ms ease; }
.icon-button:hover { border-color: rgba(121, 227, 208, 0.3); color: var(--mint); background: rgba(121, 227, 208, 0.06); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button span { font-size: 11px; }
.mobile-brand, .mobile-new-chat, .mobile-history-button { display: none; }
.history-dialog { width: min(440px, calc(100% - 28px)); max-height: min(82vh, 650px); max-height: min(82dvh, 650px); margin: auto; padding: 19px; overflow: hidden; border: 1px solid rgba(177, 195, 219, 0.15); border-radius: 20px; color: var(--text); background: linear-gradient(145deg, #111925, #0b101a); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48); }
.history-dialog::backdrop { background: rgba(3, 6, 11, 0.74); backdrop-filter: blur(5px); }
.history-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.history-dialog-header h2 { margin: 0; color: #edf2f8; font-size: 16px; font-weight: 650; }
.history-dialog-header p { margin: 6px 0 0; color: #8290a3; font-size: 10px; }
.history-dialog-close { width: 34px; min-height: 34px; padding: 0; flex: none; }
.history-list--dialog { max-height: min(60vh, 470px); max-height: min(60dvh, 470px); margin-block-start: 17px; }
.history-list--dialog .history-entry { border-color: rgba(177, 195, 219, 0.07); background: rgba(255, 255, 255, 0.02); }
.history-list--dialog .history-select { padding: 12px 10px; }
.history-list--dialog .history-title { font-size: 12px; }
.history-list--dialog .history-preview { font-size: 10px; }
.history-list--dialog .history-delete { opacity: 1; }
.history-dialog .history-empty { margin: 16px 3px 4px; }

.conversation-layout { display: grid; grid-template-rows: minmax(0, 1fr) auto; width: min(100%, 1050px); height: 100%; min-height: 0; margin-inline: auto; padding-inline: clamp(20px, 5vw, 80px); overflow: hidden; }
.chat-log { position: relative; height: 100%; min-height: 0; padding: 38px 4px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior-y: contain; scrollbar-color: rgba(148, 166, 191, 0.22) transparent; scrollbar-width: thin; }
.welcome-state { display: flex; flex-direction: column; align-items: center; padding: clamp(19px, 3vh, 34px) 0 26px; text-align: center; animation: reveal-up 480ms cubic-bezier(0.2, 0.65, 0.3, 1) both; }
.welcome-mark-wrap { position: relative; display: grid; width: 68px; height: 68px; margin-block-end: 23px; place-items: center; }
.welcome-mark { display: grid; width: 62px; height: 62px; place-items: center; border: 1px solid rgba(121, 227, 208, 0.23); border-radius: 21px; color: var(--mint); background: linear-gradient(145deg, rgba(121, 227, 208, 0.12), rgba(122, 101, 193, 0.12)); box-shadow: inset 0 0 19px rgba(121, 227, 208, 0.055), 0 0 52px rgba(69, 176, 162, 0.09); transform: rotate(-5deg); }
.welcome-mark svg { width: 35px; height: 35px; transform: rotate(5deg); }
.welcome-glint { position: absolute; inset-block-start: 0; inset-inline-end: 0; width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--violet); box-shadow: 0 0 12px rgba(184, 168, 255, 0.7); }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #8c99ac; font-size: 10px; letter-spacing: 0.035em; }
.eyebrow > span { width: 16px; height: 1px; background: var(--mint-deep); }
.welcome-state h1 { margin: 13px 0 0; color: #f1f4fa; font-size: clamp(28px, 4vw, 38px); font-weight: 600; letter-spacing: -0.045em; }
.welcome-state h1 span { color: var(--mint); }
.welcome-subtitle { margin: 10px 0 0; color: #9ba7b8; font-size: 13px; line-height: 1.9; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(100%, 620px); margin-block-start: 28px; text-align: right; }
.suggestion-card { position: relative; display: flex; align-items: center; gap: 11px; min-height: 72px; padding: 11px 12px; overflow: hidden; border: 1px solid rgba(174, 191, 214, 0.1); border-radius: 13px; color: var(--text); background: linear-gradient(115deg, rgba(24, 33, 48, 0.82), rgba(15, 22, 33, 0.8)); text-align: right; cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.suggestion-card:hover { border-color: rgba(121, 227, 208, 0.26); background: linear-gradient(115deg, rgba(29, 45, 58, 0.9), rgba(18, 27, 41, 0.92)); box-shadow: 0 9px 24px rgba(0, 0, 0, 0.13); transform: translateY(-2px); }
.suggestion-icon { display: grid; width: 35px; height: 35px; flex: none; place-items: center; border: 1px solid rgba(255, 255, 255, 0.065); border-radius: 11px; background: rgba(255, 255, 255, 0.035); color: #c6bafc; font-size: 12px; font-weight: 700; }
.suggestion-icon svg { width: 16px; height: 16px; }
.suggestion-icon--violet { color: var(--violet); background: rgba(184, 168, 255, 0.07); }
.suggestion-icon--mint { color: var(--mint); background: rgba(121, 227, 208, 0.065); direction: ltr; }
.suggestion-icon--blue { color: var(--blue); background: rgba(144, 186, 255, 0.07); direction: ltr; }
.suggestion-icon--amber { color: var(--amber); background: rgba(239, 201, 140, 0.065); }
.suggestion-card > span:nth-child(2) { display: grid; gap: 5px; min-width: 0; }
.suggestion-card strong { color: #d8e0ea; font-size: 11px; font-weight: 600; }
.suggestion-card small { overflow: hidden; color: #7d899b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-arrow { width: 14px; height: 14px; flex: none; margin-inline-start: auto; color: #6f7d90; opacity: 0.7; transition: color 160ms ease, transform 160ms ease; }
.suggestion-card:hover .suggestion-arrow { color: var(--mint); transform: translate(-2px, -2px); }
.welcome-footnote { display: flex; align-items: center; gap: 10px; margin-block-start: 23px; color: #667489; font-size: 10px; }
.footnote-line { width: 22px; height: 1px; background: rgba(144, 160, 183, 0.16); }

.message-list { display: flex; flex-direction: column; gap: 22px; width: min(100%, 760px); margin-inline: auto; }
.message { display: flex; flex-direction: column; gap: 8px; width: fit-content; max-width: min(88%, 690px); animation: reveal-up 260ms ease both; }
.message--user { align-self: flex-start; }
.message--assistant { align-self: stretch; width: 100%; max-width: 100%; }
.message-meta { display: flex; align-items: center; gap: 8px; color: #7d899b; font-size: 10px; }
.message--user .message-meta { padding-inline: 3px; }
.message--assistant .message-meta { padding-inline: 1px; }
.message-avatar { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid rgba(121, 227, 208, 0.17); border-radius: 8px; color: var(--mint); background: rgba(121, 227, 208, 0.07); }
.message-avatar svg { width: 14px; height: 14px; }
.message-content { padding: 13px 16px; border: 1px solid rgba(177, 195, 219, 0.12); border-radius: 5px 16px 16px 16px; color: #e4eaf2; background: rgba(24, 33, 47, 0.86); font-size: 13px; line-height: 1.95; overflow-wrap: anywhere; white-space: pre-wrap; }
.message--user .message-content { border-color: rgba(121, 227, 208, 0.16); border-radius: 16px 5px 16px 16px; color: #e9f2f1; background: linear-gradient(135deg, rgba(35, 77, 76, 0.62), rgba(27, 47, 57, 0.84)); }
.message--assistant .message-content { padding: 1px 0 0; border: 0; color: #d6dee8; background: transparent; }
.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-block-end: 0; }
.message-content h3 { margin: 17px 0 8px; color: #eff3f8; font-size: 14px; font-weight: 650; }
.message-content ul, .message-content ol { display: grid; gap: 6px; margin: 8px 0 13px; padding-inline-start: 22px; }
.message-content li::marker { color: var(--mint); }
.message-content strong { color: #f1f5f9; font-weight: 650; }
.message-content code { padding: 2px 5px; border: 1px solid rgba(177, 195, 219, 0.1); border-radius: 5px; color: #c4b7ff; background: rgba(155, 134, 242, 0.08); direction: ltr; unicode-bidi: plaintext; }
.message-content pre { max-width: 100%; margin: 12px 0; padding: 13px 15px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #0a0f18; direction: ltr; text-align: left; }
.message-content pre code { padding: 0; border: 0; color: #b6cfcd; background: transparent; direction: ltr; }
.message-actions { display: flex; align-items: center; gap: 8px; margin-block-start: 1px; }
.copy-button, .retry-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 0; border-radius: 7px; color: #728096; background: transparent; font-size: 10px; cursor: pointer; transition: color 150ms ease, background 150ms ease; }
.copy-button:hover, .retry-button:hover { color: var(--mint); background: rgba(121, 227, 208, 0.055); }
.copy-button svg, .retry-button svg { width: 14px; height: 14px; }
.message--error .message-content { padding: 11px 13px; border: 1px solid rgba(239, 201, 140, 0.17); border-radius: 10px; color: #d9bd92; background: rgba(109, 78, 38, 0.12); font-size: 12px; }
.retry-button { color: #cdb68e; }
.loading-indicator { display: flex; align-items: center; gap: 11px; padding-block: 3px; color: #94a0b1; font-size: 11px; }
.loading-orbit { display: flex; align-items: center; gap: 4px; height: 16px; }
.loading-orbit span { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); animation: typing 1.1s ease-in-out infinite; }
.loading-orbit span:nth-child(2) { animation-delay: 140ms; background: #94d8d0; }
.loading-orbit span:nth-child(3) { animation-delay: 280ms; background: var(--violet); }

.composer-area { position: relative; padding: 16px 0 max(16px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(9, 13, 22, 0), rgba(9, 13, 22, 0.96) 19%); }
.composer { position: relative; width: min(100%, 760px); margin-inline: auto; padding: 10px 12px 9px 10px; border: 1px solid rgba(177, 195, 219, 0.15); border-radius: 17px; background: linear-gradient(145deg, rgba(17, 24, 37, 0.98), rgba(14, 20, 31, 0.98)); box-shadow: 0 13px 42px rgba(0, 0, 0, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.025); transition: border-color 160ms ease, box-shadow 160ms ease; }
.composer:focus-within { border-color: rgba(121, 227, 208, 0.3); box-shadow: 0 13px 42px rgba(0, 0, 0, 0.23), 0 0 0 3px rgba(121, 227, 208, 0.035); }
.composer textarea { display: block; width: 100%; min-height: 36px; max-height: 180px; padding: 8px 9px 6px; resize: none; overflow-y: auto; border: 0; outline: 0; color: #eaf0f6; background: transparent; font-size: 13px; line-height: 1.8; }
.composer textarea::placeholder { color: #727e91; }
.composer textarea:focus-visible { outline: 0; }
.composer-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline: 5px 1px; }
.composer-hint { color: #68768a; font-size: 9px; }
.composer-hint span { padding-inline: 4px; color: #465265; }
.send-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 76px; min-height: 35px; padding: 0 12px; border: 1px solid rgba(121, 227, 208, 0.18); border-radius: 11px; color: #091512; background: linear-gradient(120deg, #88e8d6, #6ad3c1); box-shadow: 0 4px 14px rgba(93, 207, 187, 0.12); cursor: pointer; transition: opacity 150ms ease, filter 150ms ease, transform 150ms ease; }
.send-button:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.send-button:disabled { color: #8b9e9a; background: #263a39; border-color: rgba(121, 227, 208, 0.08); box-shadow: none; cursor: not-allowed; }
.send-button span { font-size: 11px; font-weight: 700; }
.send-button svg { width: 16px; height: 16px; transform: rotate(0deg); }
.send-button:disabled svg { opacity: 0.55; }
.disclaimer { margin: 10px 0 0; color: #626f82; font-size: 9px; text-align: center; }
.setup-notice { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 0; padding: 11px 13px; border: 1px solid rgba(239, 201, 140, 0.19); border-radius: 11px; color: #d5bb92; background: rgba(99, 73, 42, 0.13); font-size: 11px; line-height: 1.75; }
.setup-notice-icon { display: grid; width: 17px; height: 17px; flex: none; place-items: center; border-radius: 50%; color: #13100b; background: #d6b779; font-size: 10px; font-weight: 800; }
.setup-notice p { margin: 0; }
.toast { position: fixed; z-index: 15; inset-inline-start: 50%; inset-block-end: calc(26px + env(safe-area-inset-bottom)); padding: 10px 15px; border: 1px solid rgba(121, 227, 208, 0.2); border-radius: 11px; color: #d9f4ee; background: rgba(18, 34, 39, 0.96); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.account-chip { display: flex; align-items: center; gap: 10px; min-width: 0; padding-inline-start: 11px; border-inline-start: 1px solid var(--line); }
.account-identity { display: grid; gap: 2px; min-width: 0; text-align: right; }
.account-identity strong, .account-identity small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity strong { color: #d6e0ea; font-size: 10px; font-weight: 600; }
.account-identity small { color: #78869a; font-size: 8px; direction: ltr; text-align: right; }
.account-signout { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; color: #95a4b6; background: rgba(255, 255, 255, 0.02); cursor: pointer; }
.account-signout:hover { border-color: rgba(255, 179, 168, 0.28); color: var(--danger); background: rgba(255, 179, 168, 0.055); }
.account-signout svg { width: 14px; height: 14px; }
.account-signout span { font-size: 9px; }

.auth-gate { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 15px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; background: radial-gradient(ellipse at 50% 0%, rgba(64, 120, 122, 0.17), transparent 42%), rgba(5, 8, 14, 0.89); backdrop-filter: blur(18px); }
.auth-card { display: flex; flex-direction: column; width: min(100%, 430px); max-height: min(92vh, 800px); max-height: min(92dvh, 800px); padding: clamp(22px, 4vw, 34px); overflow-y: auto; border: 1px solid rgba(177, 195, 219, 0.14); border-radius: 24px; background: linear-gradient(145deg, rgba(19, 28, 42, 0.98), rgba(10, 15, 24, 0.99)); box-shadow: 0 35px 110px rgba(0, 0, 0, 0.48); }
.auth-brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: #edf4fa; text-decoration: none; direction: ltr; }
.auth-brand .brand-mark { width: 37px; height: 37px; border-radius: 12px; }
.auth-brand .brand-mark svg { width: 22px; height: 22px; }
.auth-brand > strong { font-size: 14px; letter-spacing: 0.11em; }
.auth-brand > strong span { color: var(--mint); }
.auth-kicker { margin-block-start: 29px; color: var(--mint); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.auth-card h1 { margin: 9px 0 0; color: #f0f4f9; font-size: clamp(22px, 6vw, 28px); font-weight: 650; letter-spacing: -0.03em; }
.auth-description { margin: 8px 0 18px; color: #8d9bae; font-size: 11px; line-height: 1.8; }
.auth-setup-state { margin-block-start: 5px; padding: 14px; border: 1px solid rgba(239, 201, 140, 0.2); border-radius: 12px; color: #d6c3a4; background: rgba(239, 201, 140, 0.055); font-size: 10px; line-height: 1.8; }
.auth-setup-state strong { color: #f1d9b2; font-size: 11px; }
.auth-setup-state p { margin: 5px 0 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-block-end: 17px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 8, 14, 0.42); }
.auth-tab { min-height: 36px; border: 0; border-radius: 8px; color: #8795a8; background: transparent; font: inherit; font-size: 10px; cursor: pointer; }
.auth-tab.is-active { color: #dff7f1; background: linear-gradient(110deg, rgba(121, 227, 208, 0.13), rgba(121, 227, 208, 0.055)); box-shadow: inset 0 0 0 1px rgba(121, 227, 208, 0.11); }
.auth-form { display: grid; gap: 12px; }
.auth-field { display: grid; gap: 7px; color: #c9d4e0; font-size: 10px; }
.auth-field small { color: #78869a; font-size: 9px; }
.auth-field input { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid rgba(177, 195, 219, 0.13); border-radius: 10px; outline: 0; color: #edf3f8; background: rgba(3, 7, 13, 0.46); font: inherit; font-size: 12px; direction: ltr; text-align: left; transition: border-color 150ms ease, box-shadow 150ms ease; }
.auth-field input::placeholder { color: #58677b; }
.auth-field input:focus { border-color: rgba(121, 227, 208, 0.55); box-shadow: 0 0 0 3px rgba(121, 227, 208, 0.08); }
.auth-submit { min-height: 43px; margin-block-start: 3px; border: 1px solid rgba(121, 227, 208, 0.28); border-radius: 11px; color: #071513; background: linear-gradient(110deg, #83e7d3, #76dbc7); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; transition: filter 150ms ease, transform 150ms ease; }
.auth-submit:hover { filter: brightness(1.04); transform: translateY(-1px); }
.auth-submit:disabled, .google-signin:disabled, .auth-text-button:disabled { cursor: wait; opacity: 0.65; }
.auth-text-button { justify-self: center; padding: 5px 8px; border: 0; color: #90baff; background: transparent; font: inherit; font-size: 9px; cursor: pointer; }
.auth-text-button:hover { color: #bed6ff; text-decoration: underline; }
.auth-message { margin: 0; color: #ffb3a8; font-size: 10px; line-height: 1.6; }
.auth-message:empty { display: none; }
.auth-message[data-type="success"] { color: #90dfce; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: #68768a; font-size: 9px; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; content: ""; background: var(--line); }
.google-signin { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 43px; border: 1px solid rgba(177, 195, 219, 0.17); border-radius: 11px; color: #d9e2ec; background: rgba(255, 255, 255, 0.035); font: inherit; font-size: 10px; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.google-signin:hover { border-color: rgba(177, 195, 219, 0.32); background: rgba(255, 255, 255, 0.065); }
.google-mark { color: #8ab4f8; font: 700 16px/1 Arial, sans-serif; }
.email-verification { display: grid; gap: 11px; }
.email-verification h2 { margin: 0; color: #eff4fa; font-size: 17px; }
.email-verification p:not(.auth-message) { margin: 0; color: #99a6b7; font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
.auth-disclosure { margin: 16px 0 0; color: #707e92; font-size: 8px; line-height: 1.8; text-align: center; }

@keyframes reveal-up { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes typing { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
@keyframes status-pulse { 50% { opacity: 0.45; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { padding-inline: 16px; }
  .conversation-layout { padding-inline: clamp(18px, 4vw, 40px); }
  .topbar { padding-inline: 25px; }
}

@media (max-width: 760px) {
  html { height: auto; min-height: 100%; min-width: 320px; overflow-x: hidden; overflow-y: auto; scroll-behavior: auto; }
  body { height: auto; min-height: 100vh; min-height: 100svh; overflow: visible; }
  .app-shell { display: block; height: auto; min-height: 100vh; min-height: 100svh; overflow: visible; }
  .sidebar { display: none; }
  .main-panel { display: flex; flex-direction: column; height: auto; min-height: 100vh; min-height: 100svh; }
  .topbar { position: relative; z-index: 2; min-height: 59px; padding-inline: 15px; background: rgba(10, 15, 24, 0.88); backdrop-filter: blur(14px); }
  .mobile-brand { display: inline-flex; align-items: center; gap: 9px; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 11px; }
  .mobile-brand .brand-mark svg { width: 20px; height: 20px; }
  .mobile-brand strong { font-size: 12px; }
  .mobile-history-button { display: inline-flex; width: 33px; min-height: 32px; padding: 0; }
  .topbar-context { display: none; }
  .topbar-actions { gap: 6px; }
  .status-pill { display: inline-flex; justify-content: center; width: 25px; min-height: 25px; padding: 0; }
  .status-pill #connection-label, .account-identity, .account-signout span { display: none; }
  .account-chip { padding-inline-start: 0; border-inline-start: 0; }
  .account-signout { width: 30px; min-height: 30px; padding: 0; }
  .account-signout svg { width: 15px; height: 15px; }
  .install-button { width: 33px; min-height: 32px; padding: 0; }
  .install-button span { display: none; }
  .mobile-new-chat { display: inline-flex; width: 33px; min-height: 32px; padding: 0; }
  .mobile-new-chat svg { color: var(--mint); }
  .conversation-layout { display: flex; flex-direction: column; width: 100%; height: auto; min-height: calc(100vh - 59px); min-height: calc(100svh - 59px); padding-inline: 15px; overflow: visible; }
  .chat-log { flex: 1 0 auto; height: auto; padding: 25px 1px 16px; overflow: visible; touch-action: auto; overscroll-behavior: auto; }
  .welcome-state { padding-block: 15px 17px; }
  .welcome-mark-wrap { width: 57px; height: 57px; margin-block-end: 16px; }
  .welcome-mark { width: 53px; height: 53px; border-radius: 18px; }
  .welcome-mark svg { width: 30px; height: 30px; }
  .welcome-state h1 { margin-block-start: 10px; font-size: clamp(26px, 7vw, 33px); }
  .welcome-subtitle { margin-block-start: 7px; font-size: 12px; }
  .suggestion-grid { gap: 8px; margin-block-start: 21px; }
  .suggestion-card { min-height: 68px; gap: 8px; padding: 9px; border-radius: 12px; }
  .suggestion-icon { width: 31px; height: 31px; border-radius: 9px; }
  .suggestion-card strong { font-size: 10px; }
  .suggestion-card small { max-width: 122px; font-size: 9px; }
  .suggestion-arrow { display: none; }
  .welcome-footnote { margin-block-start: 17px; font-size: 9px; }
  .footnote-line { width: 12px; }
  .composer-area { position: sticky; z-index: 3; bottom: 0; flex: none; padding-block: 10px max(11px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(9, 13, 22, 0.96), rgba(9, 13, 22, 0.99) 16%); }
  .composer { padding: 8px 9px 7px; border-radius: 15px; }
  .composer textarea { min-height: 34px; max-height: 145px; padding: 7px; font-size: 13px; }
  .send-button { min-width: 68px; min-height: 33px; }
  .disclaimer { margin-block-start: 7px; font-size: 8px; }
  .composer-hint { font-size: 8px; }
  .message { max-width: 94%; }
  .message-content { padding: 11px 13px; font-size: 12px; }
  .message--assistant .message-content { padding-inline: 1px; }
  .setup-notice { margin-block-start: 10px; font-size: 10px; }
  .auth-gate { padding-inline: 12px; }
  .auth-card { padding: 22px 19px; border-radius: 20px; }
  .auth-kicker { margin-block-start: 23px; }
  .auth-disclosure { font-size: 7.5px; }
}

@media (max-width: 380px) {
  .topbar { padding-inline: 11px; }
  .conversation-layout { padding-inline: 11px; }
  .suggestion-grid { gap: 6px; }
  .suggestion-card { min-height: 64px; gap: 7px; padding: 7px; }
  .suggestion-icon { width: 27px; height: 27px; }
  .suggestion-card small { max-width: 108px; }
  .status-pill { gap: 6px; padding-inline: 7px; }
  .composer-hint { letter-spacing: -0.02em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
