:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f3f5f9;
  --surface-hover: #eceff5;
  --text: #18202b;
  --text-soft: #667085;
  --text-faint: #98a2b3;
  --line: #e6e9ef;
  --primary: #625bf6;
  --primary-dark: #4f46e5;
  --primary-soft: #eeedff;
  --danger: #e34d59;
  --danger-soft: #fff0f1;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
  --shadow-lg: 0 22px 70px rgba(34, 39, 56, .14);
  --sidebar-width: 280px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.login-view {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: 28px 18px 52px;
  background:
    radial-gradient(circle at 52% 16%, rgba(255,255,255,.95) 0, rgba(248,249,255,.9) 31%, transparent 55%),
    linear-gradient(145deg, #f7f7ff 0%, #f3f8fb 49%, #f8f9fc 100%);
}
.login-view::before {
  position: absolute; inset: 0; content: ""; opacity: .28; pointer-events: none;
  background-image: linear-gradient(rgba(98,91,246,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(98,91,246,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}
.login-orb { position: absolute; border-radius: 999px; filter: blur(1px); opacity: .48; }
.login-orb-one { width: 430px; height: 430px; left: -170px; top: -170px; background: radial-gradient(circle, rgba(101,91,246,.18), transparent 68%); }
.login-orb-two { width: 420px; height: 420px; right: -190px; bottom: -190px; background: radial-gradient(circle, rgba(37,188,211,.15), transparent 68%); }
.login-card {
  position: relative; z-index: 1; width: min(100%, 420px); padding: 40px 38px 34px; border: 1px solid rgba(255,255,255,.9); border-radius: 28px;
  background: rgba(255,255,255,.84); box-shadow: 0 28px 80px rgba(68,73,110,.12), inset 0 1px rgba(255,255,255,.9); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-login { justify-content: center; }
.brand-mark { position: relative; display: inline-block; width: 49px; height: 42px; color: var(--primary); }
.brand-mark span { position: absolute; display: block; height: 8px; border-radius: 99px; transform: rotate(-38deg); background: currentColor; box-shadow: 0 5px 14px rgba(98,91,246,.2); }
.brand-mark span:nth-child(1) { width: 26px; left: 2px; top: 22px; }
.brand-mark span:nth-child(2) { width: 31px; left: 12px; top: 17px; background: linear-gradient(90deg, #6159f6, #5082ed); }
.brand-mark span:nth-child(3) { width: 21px; right: 0; top: 8px; background: #2bb8dc; }
.brand-mark-small { width: 38px; height: 34px; transform: scale(.82); transform-origin: left center; margin-right: -5px; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 21px; font-weight: 750; letter-spacing: -.6px; }
.brand-copy small { color: var(--text-faint); font-size: 11px; letter-spacing: .5px; }
.login-heading { margin: 38px 0 26px; text-align: center; }
.login-heading h1 { margin: 0 0 9px; font-size: 28px; letter-spacing: -.9px; }
.login-heading p { margin: 0; color: var(--text-soft); font-size: 14px; }
.stack-form { display: flex; flex-direction: column; gap: 18px; }
.stack-form label { display: flex; flex-direction: column; gap: 8px; color: #3d4654; font-size: 13px; font-weight: 620; }
.input-shell { display: flex; height: 50px; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(249,250,252,.8); transition: .2s ease; }
.input-shell:focus-within { border-color: rgba(98,91,246,.64); background: white; box-shadow: 0 0 0 3px rgba(98,91,246,.1); }
.input-shell > svg { width: 18px; color: var(--text-faint); }
.input-shell input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.input-shell input::placeholder, textarea::placeholder, input::placeholder { color: #b0b7c3; }
.icon-button { display: inline-grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; }
.icon-button:hover { background: var(--surface-hover); }
.password-toggle { width: 30px; height: 30px; color: var(--text-faint); }
.primary-button, .secondary-button, .danger-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 0 18px; font-weight: 680; border: 0; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.primary-button { color: white; background: linear-gradient(135deg, #6c63f7, #5750e8); box-shadow: 0 8px 18px rgba(91,82,237,.2); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(91,82,237,.28); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--text-soft); }
.danger-button { width: 100%; color: var(--danger); background: var(--danger-soft); }
.login-button { width: 100%; height: 50px; margin-top: 3px; border-radius: 14px; }
.login-button svg { width: 18px; }
.login-note { margin: 24px 0 0; text-align: center; color: var(--text-faint); font-size: 12px; }
.login-footer { position: absolute; z-index: 1; bottom: 22px; color: #a5adba; font-size: 11px; letter-spacing: .4px; }
.form-error { margin: -5px 0 0; color: var(--danger); font-size: 12px; font-weight: 500; }

.app-view { display: flex; width: 100%; height: 100dvh; background: var(--surface); }
.sidebar { display: flex; width: var(--sidebar-width); height: 100%; flex: 0 0 var(--sidebar-width); flex-direction: column; border-right: 1px solid var(--line); background: #f8f9fb; }
.sidebar-top { display: flex; height: 76px; align-items: center; justify-content: space-between; padding: 0 22px; }
.new-chat-button { display: flex; height: 46px; align-items: center; gap: 10px; margin: 2px 16px 20px; padding: 0 14px; border: 1px solid #deddfd; border-radius: 13px; background: var(--primary-soft); color: #554de1; font-weight: 650; }
.new-chat-button:hover { border-color: #ccc9fc; background: #e8e6ff; }
.new-chat-button svg { width: 18px; }
.new-chat-button span { flex: 1; text-align: left; }
.new-chat-button kbd { padding: 2px 5px; border: 1px solid rgba(98,91,246,.16); border-radius: 5px; background: rgba(255,255,255,.55); color: #8d87e8; font-size: 10px; font-family: inherit; }
.conversation-section { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 0 10px; }
.section-label { display: flex; height: 32px; align-items: center; justify-content: space-between; padding: 0 10px; color: var(--text-faint); font-size: 11px; font-weight: 650; letter-spacing: .4px; }
.section-label .icon-button { width: 28px; height: 28px; }
.section-label svg { width: 15px; }
.conversation-list { overflow-y: auto; padding: 4px 0; scrollbar-width: thin; }
.conversation-item { position: relative; display: flex; height: 43px; align-items: center; gap: 9px; padding: 0 10px; border-radius: 10px; color: #596273; font-size: 13px; }
.conversation-item:hover { background: #eff1f5; }
.conversation-item.active { background: white; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 620; }
.conversation-item > svg { width: 17px; flex: 0 0 auto; color: #9ba3b1; }
.conversation-item.active > svg { color: var(--primary); }
.conversation-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-delete { display: none; width: 28px; height: 28px; color: var(--text-faint); }
.conversation-item:hover .conversation-delete, .conversation-item:focus-within .conversation-delete { display: inline-grid; }
.conversation-delete:hover { color: var(--danger); background: var(--danger-soft); }
.conversation-empty { padding: 32px 10px; text-align: center; color: var(--text-faint); font-size: 12px; }
.sidebar-account { padding: 12px; border-top: 1px solid var(--line); }
.account-button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.account-button:hover { background: var(--surface-hover); }
.avatar { display: inline-grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 11px; background: linear-gradient(135deg, #685ff4, #35a9dc); color: white; font-size: 11px; font-weight: 750; box-shadow: 0 5px 12px rgba(78,91,218,.18); }
.account-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.account-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.account-copy small { color: var(--text-faint); font-size: 10px; }
.account-button > svg { width: 16px; color: var(--text-faint); }

.chat-main { position: relative; display: flex; min-width: 0; height: 100%; flex: 1; flex-direction: column; background: var(--surface); }
.chat-header { position: relative; z-index: 4; display: flex; height: 64px; flex: 0 0 64px; align-items: center; justify-content: center; padding: 0 24px; border-bottom: 1px solid rgba(230,233,239,.8); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.model-picker-wrap { position: relative; display: flex; height: 38px; align-items: center; gap: 8px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; }
.model-picker-wrap:hover { background: white; border-color: #d6dae2; }
.model-status-dot { width: 7px; height: 7px; border-radius: 99px; background: #22b88b; box-shadow: 0 0 0 3px rgba(34,184,139,.11); }
.model-status-dot.unavailable { background: #a5adba; box-shadow: 0 0 0 3px rgba(152,162,179,.12); }
.model-status-dot.restricted { background: #e0a12f; box-shadow: 0 0 0 3px rgba(224,161,47,.13); }
.model-picker-wrap select { max-width: 210px; appearance: none; padding-right: 22px; border: 0; outline: 0; background: transparent; color: #3d4654; font-size: 12px; font-weight: 650; }
.model-picker-wrap > svg { position: absolute; right: 8px; width: 14px; pointer-events: none; color: var(--text-faint); }
.model-picker-trigger { display: none; }
.header-actions { position: absolute; right: 20px; display: flex; align-items: center; gap: 8px; }
.avatar-header { display: none; width: 32px; height: 32px; border-radius: 10px; }
.mobile-only { display: none; }
.chat-scroll { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.welcome-panel { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: clamp(60px, 10vh, 110px) 0 36px; text-align: center; }
.welcome-symbol { position: relative; width: 58px; height: 52px; margin: 0 auto 20px; }
.welcome-symbol span { position: absolute; height: 9px; border-radius: 99px; transform: rotate(-37deg); }
.welcome-symbol span:nth-child(1) { width: 31px; left: 3px; top: 29px; background: #625bf6; }
.welcome-symbol span:nth-child(2) { width: 37px; left: 14px; top: 22px; background: linear-gradient(90deg, #625bf6, #4c8de8); }
.welcome-symbol span:nth-child(3) { width: 26px; right: 0; top: 10px; background: #2bb8dc; }
.welcome-panel h1 { margin: 0 0 12px; font-size: clamp(25px, 3vw, 32px); letter-spacing: -1.2px; }
.welcome-panel > p { max-width: 520px; margin: 0 auto; color: var(--text-soft); font-size: 14px; line-height: 1.8; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 38px; }
.suggestion-card { display: flex; min-height: 76px; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; text-align: left; box-shadow: 0 2px 5px rgba(16,24,40,.025); transition: .18s ease; }
.suggestion-card:hover { transform: translateY(-2px); border-color: #d9dce4; box-shadow: 0 8px 24px rgba(33,39,56,.08); }
.suggestion-icon { display: inline-grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border-radius: 11px; }
.suggestion-icon svg { width: 20px; }
.suggestion-blue { color: #4a7be7; background: #edf3ff; }
.suggestion-amber { color: #e99a2b; background: #fff7e7; }
.suggestion-violet { color: #8b63e8; background: #f5efff; }
.suggestion-green { color: #28a77b; background: #ebf9f4; }
.suggestion-card > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.suggestion-card strong { font-size: 13px; }
.suggestion-card small { overflow: hidden; color: var(--text-faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-arrow { width: 15px; flex: 0 0 auto; color: #b7bdc7; }
.messages { width: min(820px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 56px; }
.message { display: flex; gap: 12px; margin-bottom: 28px; }
.message.user { justify-content: flex-end; }
.message-avatar { display: inline-grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.message-avatar svg { width: 18px; }
.message-body { min-width: 0; max-width: min(680px, calc(100% - 45px)); }
.message.user .message-body { padding: 11px 15px; border-radius: 16px 16px 4px 16px; background: #f0f1f5; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.message.assistant .message-body { padding-top: 3px; line-height: 1.78; word-break: break-word; }
.message-model-badge { display: inline-flex; max-width: 100%; align-items: center; margin: 0 0 9px; padding: 3px 8px; border: 1px solid #dcdaf8; border-radius: 999px; background: #f7f6ff; color: #5851bc; font-size: 10px; font-weight: 680; line-height: 1.4; overflow-wrap: anywhere; }
.message-content { min-width: 0; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 12px; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 { margin: 20px 0 9px; line-height: 1.35; }
.message-content h1 { font-size: 20px; }.message-content h2 { font-size: 17px; }.message-content h3 { font-size: 15px; }
.message-content h4 { font-size: 14px; }.message-content h5 { font-size: 13px; }.message-content h6 { color: var(--text-soft); font-size: 12px; }
.message-content ul, .message-content ol { margin: 8px 0 14px; padding-left: 22px; }
.message-content ul ul, .message-content ul ol, .message-content ol ul, .message-content ol ol { margin: 4px 0; }
.message-content li { margin: 4px 0; }
.message-content blockquote { margin: 12px 0; padding: 3px 13px; border-left: 3px solid #cbc8fa; color: var(--text-soft); }
.message-content blockquote blockquote { margin-left: 4px; }
.message-content hr { height: 1px; margin: 20px 0; border: 0; background: var(--line); }
.message-content strong { font-weight: 720; }.message-content del { color: var(--text-soft); }
.message-content details { margin: 12px 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; }
.message-content summary { cursor: pointer; font-weight: 650; }
.message-content kbd { padding: 1px 5px; border: 1px solid #ccd1d9; border-bottom-width: 2px; border-radius: 5px; background: #f7f8fa; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-content mark { padding: 1px 3px; border-radius: 3px; background: #fff0a8; }
.message-content a { color: #4f48cf; text-decoration: underline; text-decoration-color: #c4c0f4; text-underline-offset: 2px; overflow-wrap: anywhere; }
.message-content a:hover { text-decoration-color: currentColor; }
.message-content code.inline-code { padding: 2px 5px; border-radius: 5px; background: #f1f2f5; color: #cf3f62; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.markdown-task-item { list-style: none; }
.markdown-task-checkbox { width: 14px; height: 14px; margin: 0 7px 0 -21px; vertical-align: -2px; accent-color: var(--primary); }
.markdown-image { display: block; width: auto; max-width: 100%; height: auto; max-height: min(62vh, 680px); margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; object-fit: contain; }
.markdown-external-image-link, .markdown-image-blocked { display: inline-flex; max-width: 100%; align-items: center; margin: 7px 0; padding: 5px 8px; border-radius: 7px; background: #f3f4f7; color: var(--text-soft); font-size: 11px; overflow-wrap: anywhere; }
.markdown-table-wrap { width: 100%; max-width: 100%; margin: 14px 0; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; border: 1px solid #e1e4eb; border-radius: 12px; background: #fff; }
.markdown-table-wrap:focus-visible { outline: 2px solid rgba(98,91,246,.48); outline-offset: 2px; }
.markdown-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.55; }
.markdown-table th, .markdown-table td { min-width: 110px; max-width: 280px; padding: 9px 11px; border-right: 1px solid #e7e9ef; border-bottom: 1px solid #e7e9ef; vertical-align: top; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.markdown-table th { background: #f5f6fa; color: #3e4654; font-weight: 700; }
.markdown-table .markdown-align-left { text-align: left; }
.markdown-table .markdown-align-center { text-align: center; }
.markdown-table .markdown-align-right { text-align: right; }
.markdown-table tbody tr:nth-child(even) td { background: #fafbfc; }
.markdown-table tr > :last-child { border-right: 0; }
.markdown-table tbody tr:last-child td { border-bottom: 0; }
.code-block { position: relative; overflow: hidden; margin: 14px 0; border: 1px solid #303540; border-radius: 12px; background: #1f232b; color: #eef1f5; }
.code-header { display: flex; height: 34px; align-items: center; justify-content: space-between; padding: 0 10px 0 13px; border-bottom: 1px solid rgba(255,255,255,.08); color: #9da6b5; font-size: 10px; }
.code-copy { border: 0; background: transparent; color: #b7c0ce; font-size: 10px; }
.code-block pre { overflow-x: auto; margin: 0; padding: 14px; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }
.message-tools { display: flex; gap: 3px; margin-top: 6px; opacity: 0; transition: opacity .15s ease; }
.message:hover .message-tools { opacity: 1; }
.message-tools button { width: 28px; height: 28px; color: var(--text-faint); }
.typing-cursor { display: inline-block; width: 7px; height: 16px; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--primary); animation: blink 1s infinite; }
.message-error { padding: 10px 12px; border: 1px solid #ffd6da; border-radius: 10px; background: #fff5f6; color: #c53d49; font-size: 12px; }
.choose-model-button { display: block; margin-top: 8px; padding: 7px 10px; border: 1px solid currentColor; border-radius: 8px; background: #fff; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.choose-model-button:focus-visible { outline: 2px solid #7c6cff; outline-offset: 2px; }
.web-search-notice { display: inline-flex; margin: 0 0 10px; padding: 5px 9px; border-radius: 8px; font-size: 10px; }
.web-search-notice.used { background: #eaf8f2; color: #218b6b; }
.web-search-notice.not-used { background: #fff7e7; color: #9a671c; }
.weather-notice { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin: 0 0 10px; padding: 5px 9px; border-radius: 8px; font-size: 10px; overflow-wrap: anywhere; }
.weather-notice.used { background: #e8f8fb; color: #187b8c; }
.weather-notice.not-used { background: #fff7e7; color: #9a671c; }
.weather-notice a { max-width: 100%; color: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.weather-notice a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.message-attachments { display: grid; width: min(560px, calc(100vw - 82px)); grid-template-columns: 1fr; gap: 12px; margin: 12px 0 4px; }
.image-attachment { overflow: hidden; margin: 0; border: 1px solid #e1e4eb; border-radius: 15px; background: #f7f8fb; box-shadow: 0 5px 18px rgba(32,39,55,.07); }
.image-attachment-preview { display: grid; min-height: 170px; place-items: center; overflow: hidden; background: linear-gradient(145deg, #f4f5f9, #ebeef4); color: var(--text-soft); text-decoration: none; }
.image-attachment-preview:not([href]) { cursor: default; }
.image-attachment img { display: block; width: 100%; max-height: min(64vh, 720px); height: auto; object-fit: contain; }
.image-attachment-error { padding: 36px 20px; color: var(--text-faint); font-size: 12px; text-align: center; }
.image-attachment-actions { display: flex; min-height: 40px; align-items: center; justify-content: flex-end; gap: 7px; padding: 6px 8px; border-top: 1px solid #e7e9ef; background: rgba(255,255,255,.94); }
.image-attachment-actions a { display: inline-flex; min-height: 28px; align-items: center; padding: 0 9px; border-radius: 8px; color: #514acb; font-size: 10px; font-weight: 650; text-decoration: none; }
.image-attachment-actions a:hover { background: var(--primary-soft); }
.image-attachment-actions a:focus-visible { outline: 2px solid rgba(98,91,246,.48); outline-offset: 1px; }
.processing-steps { width: min(100%, 560px); margin: 0 0 12px; overflow: hidden; border: 1px solid #e1e4f0; border-radius: 13px; background: linear-gradient(145deg, #fbfbff, #f7f8fc); box-shadow: 0 3px 14px rgba(52, 55, 92, .05); }
.processing-steps summary { display: grid; min-height: 44px; grid-template-columns: 10px auto minmax(0, 1fr) auto 10px; align-items: center; gap: 8px; padding: 8px 10px; list-style: none; cursor: pointer; touch-action: manipulation; }
.processing-steps summary::-webkit-details-marker { display: none; }
.processing-steps summary:focus-visible { outline: 2px solid rgba(98, 91, 246, .55); outline-offset: -2px; }
.processing-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px rgba(98, 91, 246, .1); animation: processing-pulse 1.4s ease-in-out infinite; }
.processing-title { color: #3f4654; font-size: 12px; font-weight: 700; white-space: nowrap; }
.processing-current { min-width: 0; overflow: hidden; color: #697386; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.processing-elapsed { color: #9299a7; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.processing-chevron { width: 7px; height: 7px; transform: rotate(45deg); border-right: 1.5px solid #9299a7; border-bottom: 1.5px solid #9299a7; transition: transform .16s ease; }
.processing-steps[open] .processing-chevron { transform: rotate(225deg); }
.processing-step-list { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 10px 12px 12px; border-top: 1px solid #e8eaf2; list-style: none; }
.processing-step-list li { display: grid; min-width: 0; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 7px; color: #657080; font-size: 11px; line-height: 1.5; }
.processing-step-marker { display: inline-grid; width: 16px; height: 16px; margin-top: 1px; place-items: center; border-radius: 50%; background: #e8eaf1; color: white; font-size: 10px; font-weight: 800; }
.processing-step-list li[data-state="done"] .processing-step-marker { background: #29a77d; }
.processing-step-list li[data-state="done"] .processing-step-marker::after { content: "✓"; }
.processing-step-list li[data-state="active"] { color: #3f3a9e; font-weight: 620; }
.processing-step-list li[data-state="active"] .processing-step-marker { border: 2px solid #8f89f8; border-top-color: transparent; background: transparent; animation: processing-spin .9s linear infinite; }
.processing-step-list li[data-state="warning"] .processing-step-marker { background: #e8a23a; }
.processing-step-list li[data-state="warning"] .processing-step-marker::after { content: "!"; }
.processing-step-list li[data-state="error"] .processing-step-marker { background: #df5863; }
.processing-step-list li[data-state="error"] .processing-step-marker::after { content: "×"; }
.processing-steps[data-status="completed"] .processing-indicator { background: #29a77d; box-shadow: 0 0 0 4px rgba(41, 167, 125, .1); animation: none; }
.processing-steps[data-status="failed"] .processing-indicator { background: #df5863; box-shadow: 0 0 0 4px rgba(223, 88, 99, .1); animation: none; }
.processing-steps[data-status="stopped"] .processing-indicator { background: #e8a23a; box-shadow: 0 0 0 4px rgba(232, 162, 58, .1); animation: none; }
@keyframes blink { 0%, 45% { opacity: 1; } 55%, 100% { opacity: .15; } }
@keyframes processing-spin { to { transform: rotate(360deg); } }
@keyframes processing-pulse { 50% { opacity: .45; transform: scale(.82); } }

.composer-area { position: relative; z-index: 3; flex: 0 0 auto; padding: 8px 24px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 18%, #fff); }
.composer { width: min(820px, 100%); margin: 0 auto; padding: 11px 11px 9px 15px; border: 1px solid #dfe3e9; border-radius: 18px; background: white; box-shadow: 0 8px 28px rgba(24,32,43,.08), 0 1px 3px rgba(24,32,43,.04); transition: .2s ease; }
.composer:focus-within { border-color: #cbc8f5; box-shadow: 0 10px 32px rgba(72,67,153,.11), 0 0 0 3px rgba(98,91,246,.06); }
.composer textarea { display: block; width: 100%; max-height: 180px; resize: none; overflow-y: auto; padding: 0 2px 8px; border: 0; outline: 0; background: transparent; color: var(--text); line-height: 1.6; }
.composer-bottom { display: flex; min-height: 31px; align-items: center; justify-content: flex-end; gap: 8px; }
.composer-modes { display: flex; min-width: 0; align-items: center; gap: 12px; margin-right: auto; }
.composer-mode-control { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; color: #626b79; font-size: 10px; cursor: pointer; user-select: none; }
.composer-mode-control[hidden] { display: none; }
.composer-mode-control input { position: absolute; z-index: 1; width: 28px; height: 22px; left: 0; top: 50%; margin: 0; transform: translateY(-50%); opacity: 0; cursor: pointer; }
.composer-mode-switch { position: relative; width: 28px; height: 16px; border-radius: 99px; background: #d8dce4; transition: .16s ease; }
.composer-mode-switch::after { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(24,32,43,.22); transition: .16s ease; }
.composer-mode-control input:checked + .composer-mode-switch { background: var(--primary); }
.composer-mode-control input:checked + .composer-mode-switch::after { transform: translateX(12px); }
.composer-mode-control input:focus-visible + .composer-mode-switch { outline: 2px solid rgba(98,91,246,.45); outline-offset: 2px; }
.composer-mode-control:has(input:disabled) { cursor: default; opacity: .55; }
.composer-hint { margin-right: auto; padding-left: 2px; color: #b1b7c2; font-size: 10px; }
.send-button { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 0; border-radius: 11px; background: var(--primary); color: white; transition: .16s ease; }
.send-button:hover { transform: translateY(-1px); background: var(--primary-dark); }
.send-button:disabled { cursor: default; opacity: .35; transform: none; }
.send-button svg { width: 18px; }
.stop-button span { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.ai-disclaimer { margin: 7px 0 0; text-align: center; color: #b0b6c0; font-size: 9px; }

.modal { max-width: none; max-height: none; margin: auto; padding: 0; border: 0; border-radius: 21px; background: transparent; color: var(--text); overflow: visible; }
.modal::backdrop { background: rgba(25,30,41,.37); backdrop-filter: blur(4px); }
.modal-card { width: min(440px, calc(100vw - 28px)); padding: 24px; border: 1px solid rgba(255,255,255,.8); border-radius: 21px; background: white; box-shadow: var(--shadow-lg); }
.modal-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.modal-heading > div { min-width: 0; flex: 1; }
.modal-heading h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.4px; }
.modal-heading p { margin: 0; color: var(--text-faint); font-size: 11px; }
.modal-icon { display: inline-grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.modal-close { align-self: flex-start; margin: -4px -5px 0 0; color: var(--text-faint); }
.model-picker-sheet { width: min(520px, calc(100vw - 28px)); padding: 10px 16px 18px; border: 1px solid rgba(255,255,255,.86); border-radius: 24px; background: white; box-shadow: var(--shadow-lg); }
.model-picker-handle { display: none; width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 99px; background: #d8dce4; }
.model-picker-heading { display: flex; align-items: flex-start; gap: 14px; padding: 4px 2px 14px; }
.model-picker-heading > div { min-width: 0; flex: 1; }
.model-picker-heading h2 { margin: 0 0 5px; font-size: 19px; letter-spacing: -.45px; }
.model-picker-heading p { margin: 0; color: var(--text-faint); font-size: 11px; line-height: 1.5; }
.model-picker-heading .icon-button { margin-top: -3px; color: var(--text-faint); }
.model-picker-options { display: flex; max-height: min(52dvh, 420px); flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px; overscroll-behavior: contain; scrollbar-width: thin; }
.model-option { display: flex; width: 100%; min-height: 66px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: 15px; background: #f8f9fb; text-align: left; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.model-option:hover { border-color: #e1e3eb; background: white; transform: translateY(-1px); }
.model-option[aria-current="true"] { border-color: #d8d5ff; background: linear-gradient(145deg, #faf9ff, #f4f5ff); box-shadow: 0 3px 12px rgba(88,80,225,.07); }
.model-option:focus-visible { outline: 2px solid rgba(98,91,246,.52); outline-offset: 2px; }
.model-option:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.model-option-icon { display: inline-grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: #eeedff; color: #625bf6; }
.model-option-icon.image { background: #e9f8f4; color: #219b78; }
.model-option-icon svg { width: 19px; }
.model-option-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.model-option-title { display: flex; min-width: 0; align-items: center; gap: 7px; }
.model-option-title strong { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.model-option-copy small { display: -webkit-box; overflow: hidden; color: var(--text-faint); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.model-option-badge { flex: 0 0 auto; padding: 2px 6px; border-radius: 99px; background: #e9e7ff; color: #574fd2; font-size: 8px; font-weight: 700; }
.model-option-badge.unavailable { background: #eceef2; color: #747d8b; }
.model-option-check { display: inline-grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 99px; color: transparent; }
.model-option[aria-current="true"] .model-option-check { background: var(--primary); color: white; }
.model-option-check svg { width: 14px; stroke-width: 2.3; }
.model-restricted-option { display: flex; min-height: 60px; align-items: center; gap: 11px; padding: 10px 12px; border: 1px dashed #e2d5ad; border-radius: 14px; background: #fffaf0; color: #77642c; }
.model-restricted-option .model-option-icon { width: 36px; height: 36px; background: #fff1cb; color: #a57618; }
.model-restricted-option strong { display: block; font-size: 12px; }
.model-restricted-option small { display: block; margin-top: 3px; color: #9a8858; font-size: 10px; }
.model-picker-note { margin: 13px 3px 0; color: var(--text-faint); font-size: 9px; line-height: 1.55; }
.compact-form { gap: 14px; }
.compact-form input, .compact-form select, .form-grid input, .form-grid select { width: 100%; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fafbfc; }
.compact-form input:focus, .compact-form select:focus, .form-grid input:focus, .form-grid select:focus { border-color: #aaa5f0; box-shadow: 0 0 0 3px rgba(98,91,246,.08); }
.compact-form small { color: var(--text-faint); font-size: 10px; font-weight: 450; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.account-modal-card { width: min(400px, calc(100vw - 28px)); }
.avatar-large { width: 46px; height: 46px; border-radius: 14px; font-size: 14px; }
.account-actions-list { display: flex; flex-direction: column; gap: 5px; margin: 5px 0 18px; }
.account-actions-list > button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 11px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.account-actions-list > button:hover { background: var(--surface-soft); }
.account-actions-list > button > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; gap: 2px; }
.account-actions-list strong { font-size: 13px; }.account-actions-list small { color: var(--text-faint); font-size: 10px; }
.account-actions-list > button > svg { width: 16px; color: var(--text-faint); }
.action-icon { display: inline-grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--surface-soft); color: #697386; }
.action-icon svg { width: 18px; }
.danger-button svg { width: 17px; }
.admin-modal { width: 100%; height: 100%; border-radius: 0; }
.admin-modal-card { width: min(760px, calc(100vw - 28px)); max-height: min(760px, calc(100dvh - 30px)); overflow-y: auto; }
.admin-heading { position: sticky; z-index: 2; top: -24px; margin: -24px -24px 20px; padding: 24px 24px 15px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(10px); }
.codex-settings { margin-bottom: 22px; padding: 16px; border: 1px solid #dcd9ff; border-radius: 15px; background: linear-gradient(145deg, #faf9ff, #f6f7ff); }
.codex-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.codex-settings-heading h3 { margin: 0 0 4px; font-size: 14px; }
.codex-settings-heading p { margin: 0; color: var(--text-faint); font-size: 10px; }
.codex-settings-note { margin: 12px 0; color: var(--text-soft); font-size: 11px; line-height: 1.65; }
.codex-settings > .secondary-button { min-height: 36px; padding-inline: 13px; font-size: 11px; }
.codex-auth-box { margin-top: 13px; padding: 13px; border: 1px dashed #aaa5f0; border-radius: 12px; background: white; }
.codex-auth-box > p { margin: 0 0 9px; color: var(--text-soft); font-size: 11px; }
.codex-code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.codex-code-row code { flex: 1; color: #4039ae; font: 700 18px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 1px; overflow-wrap: anywhere; }
.codex-auth-box > .primary-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; text-decoration: none; font-size: 11px; }
.codex-auth-box > small { display: block; margin-top: 9px; color: var(--text-faint); font-size: 9px; line-height: 1.5; }
.codex-settings > .form-error { margin-top: 10px; }
.admin-section-heading { margin-top: 0; }
.create-user-form { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fafbfc; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; color: #515a69; font-size: 11px; font-weight: 620; }
.create-user-form .primary-button { min-height: 40px; margin-top: 14px; font-size: 12px; }
.create-user-form .primary-button svg { width: 16px; }
.user-list-heading { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 10px; }
.user-list-heading h3 { margin: 0; font-size: 14px; }.user-list-heading span { color: var(--text-faint); font-size: 10px; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; }
.user-info { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.user-info strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { color: var(--text-faint); font-size: 10px; }
.user-info .user-model-access { color: #735f21; font-weight: 620; }
.status-badge { padding: 3px 7px; border-radius: 99px; background: #eaf8f2; color: #218b6b; font-size: 9px; }
.status-badge.inactive { background: var(--surface-soft); color: var(--text-faint); }
.user-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.user-actions button { min-height: 34px; padding: 0 9px; border: 0; border-radius: 8px; background: var(--surface-soft); color: var(--text-soft); font-size: 10px; }
.user-actions button:hover { background: var(--surface-hover); }
.user-actions .model-access-button { background: #f2efff; color: #5146b8; }
.user-actions .model-access-button.granted { background: #fff4df; color: #8b6115; }
.credential-card { width: min(390px, calc(100vw - 28px)); text-align: center; }
.success-symbol { display: inline-grid; width: 48px; height: 48px; place-items: center; border-radius: 99px; background: #eaf8f2; color: #218b6b; }
.credential-card h2 { margin: 15px 0 7px; font-size: 19px; }.credential-card > p { margin: 0; color: var(--text-soft); font-size: 11px; line-height: 1.7; }
.credential-box { display: flex; align-items: center; gap: 8px; margin: 18px 0; padding: 11px 11px 11px 15px; border: 1px dashed #aaa5f0; border-radius: 12px; background: #f8f7ff; }
.credential-box code { flex: 1; color: #4039ae; font: 700 15px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .4px; overflow-wrap: anywhere; }
.credential-card > .primary-button { width: 100%; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { max-width: min(340px, calc(100vw - 32px)); padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(28,34,45,.94); color: white; box-shadow: var(--shadow-lg); font-size: 11px; animation: toast-in .2s ease; }
.toast.error { background: rgba(174,49,60,.96); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-105%); box-shadow: 16px 0 50px rgba(23,30,43,.16); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 19; inset: 0; display: block; background: rgba(27,32,43,.28); backdrop-filter: blur(2px); }
  .chat-header { height: 58px; flex-basis: 58px; justify-content: flex-start; padding: 0 14px; }
  .chat-header > .mobile-only { margin-right: 8px; }
  .model-picker-wrap { max-width: calc(100vw - 150px); height: 36px; padding: 0; border: 0; background: transparent; }
  .model-picker-wrap:hover { border-color: transparent; background: transparent; }
  .model-picker-wrap > .model-status-dot, .model-picker-wrap > select, .model-picker-wrap > svg { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; pointer-events: none; }
  .model-picker-trigger { display: flex; width: 100%; min-width: 0; height: 36px; align-items: center; gap: 8px; padding: 0 9px 0 11px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; color: #3d4654; }
  .model-picker-trigger:hover { border-color: #d6dae2; background: white; }
  .model-picker-trigger:focus-visible { outline: 2px solid rgba(98,91,246,.46); outline-offset: 2px; }
  .model-picker-trigger:disabled { cursor: default; opacity: .56; }
  .model-picker-trigger > span:nth-child(2) { min-width: 0; overflow: hidden; flex: 1; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .model-picker-trigger > svg { width: 14px; flex: 0 0 auto; color: var(--text-faint); transition: transform .18s ease; }
  .model-picker-trigger[aria-expanded="true"] > svg { transform: rotate(180deg); }
  .model-picker-dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; }
  .model-picker-dialog[open] { display: flex; align-items: flex-end; justify-content: center; }
  .model-picker-dialog::backdrop { background: rgba(25,30,41,.37); backdrop-filter: blur(4px); }
  .model-picker-sheet { width: 100%; max-height: min(74dvh, 590px); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 24px 24px 0 0; box-shadow: 0 -20px 60px rgba(34,39,56,.16); animation: model-sheet-in .2s ease-out; }
  .model-picker-handle { display: block; }
  .model-picker-options { max-height: min(52dvh, 430px); }
  .model-option { min-height: 68px; }
  .header-actions { right: 12px; }
  .avatar-header { display: inline-grid; }
  .welcome-panel { width: min(100% - 28px, 560px); padding-top: clamp(45px, 8vh, 76px); }
  .welcome-panel > p { max-width: 340px; font-size: 13px; }
  .suggestion-grid { grid-template-columns: 1fr; gap: 9px; margin-top: 29px; }
  .suggestion-card { min-height: 68px; }
  .messages { width: calc(100% - 28px); padding-top: 25px; }
  .message { gap: 9px; margin-bottom: 24px; }
  .message-avatar { width: 29px; height: 29px; }
  .message-body { max-width: calc(100% - 38px); font-size: 14px; }
  .message.user .message-body { padding: 9px 13px; }
  .markdown-table { font-size: 12.5px; }
  .markdown-table th, .markdown-table td { padding: 8px 9px; }
  .processing-steps summary { grid-template-columns: 9px auto minmax(0, 1fr) auto 9px; gap: 6px; padding-inline: 9px; }
  .processing-current { font-size: 10.5px; }
  .processing-step-list { padding: 9px 10px 11px; }
  .composer-area { padding: 7px 10px max(8px, env(safe-area-inset-bottom)); }
  .composer { border-radius: 16px; padding: 10px 9px 8px 13px; }
  .composer-hint { display: none; }
  .ai-disclaimer { margin-top: 5px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-modal-card { max-height: calc(100dvh - 18px); }
  .user-row { align-items: flex-start; flex-wrap: wrap; }
  .user-info { min-width: calc(100% - 90px); }
  .user-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-actions button { min-height: 44px; padding-inline: 7px; }
  .modal-actions .primary-button, .modal-actions .secondary-button { flex: 1; }
  .toast-region { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@keyframes model-sheet-in { from { transform: translateY(18px); opacity: .65; } }

@media (max-width: 480px) {
  .login-card { padding: 34px 24px 29px; border-radius: 24px; }
  .login-heading { margin-top: 31px; }
  .welcome-symbol { transform: scale(.9); margin-bottom: 15px; }
  .welcome-panel h1 { font-size: 25px; }
  .suggestion-card:nth-child(n+4) { display: none; }
  .modal-card { padding: 20px; }
  .composer-modes { gap: 8px; }
  .admin-heading { top: -20px; margin: -20px -20px 18px; padding: 20px 20px 14px; }
  .user-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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