/* BAHRTEC AI chat workspace — compact, calm and responsive. */
.session-loading { position: fixed; z-index: 1000; inset: 0; display: grid; place-content: center; justify-items: center; gap: 13px; color: var(--muted); background: var(--panel); }
.brand-symbol-card { display: grid; place-items: center; width: 56px; height: 56px; padding: 10px; overflow: hidden; border: 1px solid #d7e1e7; border-radius: 17px; background: #fff; box-shadow: 0 8px 24px rgba(30,55,72,.1), inset 0 1px rgba(255,255,255,.75); }
.brand-symbol-card img { display: block; width: 100%; height: 100%; filter: saturate(.88) contrast(1.2); transition: filter .18s ease; }
.session-loading .brand-symbol-card { animation: session-pulse 1.15s ease-in-out infinite alternate; }
.session-loading span { font-size: 12px; letter-spacing: .02em; }
@keyframes session-pulse { from { opacity: .58; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.desktop-only { display: inline-grid; place-items: center; }
.app-view .mobile-only { display: none !important; }
.app-view { position: relative; grid-template-columns: 278px minmax(0, 1fr); background: var(--panel); transition: grid-template-columns .2s ease; }
.app-view.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app-view.sidebar-collapsed .sidebar { visibility: hidden; transform: translateX(-100%); }
.app-view.sidebar-collapsed .sidebar-open-button { display: inline-grid; }

.app-view .sidebar { width: 278px; min-width: 0; overflow: hidden; padding: 12px 10px 10px; border-right: 0; background: #f4f4f4; transition: transform .2s ease, visibility .2s; }
.app-view .sidebar-top { min-width: 0; height: 48px; padding: 0 7px 10px; gap: 8px; }
.app-brand { min-width: 0; flex: 1; gap: 8px; text-decoration: none; }
.app-brand .brand-wordmark { max-width: 176px; height: 23px; }
.app-brand .brand-ai-tag { min-width: 25px; height: 21px; border: 0; border-radius: 6px; padding: 0 6px; background: var(--accent); box-shadow: none; font-size: 9px; }
.app-view .icon-button svg,
.app-view .new-chat-button svg,
.app-view .sidebar-action svg,
.app-view .chat-search svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-view .icon-button { flex: 0 0 auto; display: inline-grid; place-items: center; }

.app-view .new-chat-button { min-width: 0; min-height: 42px; justify-content: flex-start; gap: 10px; margin: 2px 0 8px; border: 0; border-radius: 10px; padding: 9px 11px; background: transparent; box-shadow: none; font-size: 14px; font-weight: 650; }
.app-view .new-chat-button:hover { border: 0; background: #e7e7e7; }
.app-view .new-chat-button svg { width: 20px; height: 20px; }

.chat-search { min-width: 0; height: 40px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0 0 11px; border-radius: 10px; padding: 0 10px; color: #6c7278; background: transparent; font-weight: 500; }
.chat-search:focus-within { background: #fff; box-shadow: 0 0 0 1px var(--line); }
.chat-search input { min-width: 0; height: auto; border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; font-size: 13px; }
.chat-search input:focus { border: 0; box-shadow: none; }
.chat-search kbd { border: 1px solid #d6d6d6; border-radius: 5px; padding: 2px 5px; color: #8a8f94; background: #fafafa; font: 10px/1.2 inherit; }

.conversation-scroll { min-width: 0; min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; overscroll-behavior: contain; }
.conversation-scroll::-webkit-scrollbar { display: none; }
.app-view .conversation-list { width: 100%; min-width: 0; overflow: visible; gap: 0; }
.conversation-group { width: 100%; min-width: 0; margin: 0 0 13px; }
.conversation-group-title { margin: 0 9px 5px; color: #8a8f94; font-size: 11px; font-weight: 650; }
.conversation-item { position: relative; width: 100%; min-width: 0; max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: 2px; border-radius: 9px; overflow: hidden; }
.conversation-item.active { background: #e7e7e7; box-shadow: none; }
.conversation-item:hover { background: #ebebeb; }
.conversation-open { min-width: 0; width: 100%; display: flex; align-items: center; gap: 6px; overflow: hidden; padding: 9px 7px 9px 10px; color: #34383c; font-size: 13px; line-height: 1.25; white-space: nowrap; }
.conversation-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-status { flex: 0 0 auto; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #55798f; box-shadow: 0 0 0 3px rgba(85,121,143,.12); }
.conversation-status.working { width: 11px; height: 11px; border: 2px solid rgba(85,121,143,.24); border-top-color: #55798f; background: transparent; box-shadow: none; animation: conversation-spin .78s linear infinite; }
.conversation-status.unread { background: #2f789f; box-shadow: 0 0 0 3px rgba(47,120,159,.13); }
.conversation-status.failed { background: #b95858; box-shadow: 0 0 0 3px rgba(185,88,88,.13); }
.conversation-status.failed.working { border-color: rgba(181,131,48,.28); border-top-color: #b58330; background: transparent; box-shadow: none; }
@keyframes conversation-spin { to { transform: rotate(360deg); } }
.conversation-options { width: 30px; height: 34px; align-self: center; opacity: 0; border: 0; border-radius: 8px; padding: 0; color: #646a70; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.conversation-item:hover .conversation-options,
.conversation-item.active .conversation-options,
.conversation-options[aria-expanded="true"] { opacity: 1; }
.conversation-options:hover { color: var(--ink); background: rgba(255,255,255,.72); }
.conversation-pin { flex: 0 0 auto; color: #78818a; font-size: 10px; }
.conversation-empty { padding: 12px 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.conversation-context-menu { position: fixed; z-index: 300; width: 210px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 5px; color: var(--ink); background: var(--panel); box-shadow: 0 16px 42px rgba(25,31,36,.18); }
.conversation-context-menu button { display: flex; align-items: center; gap: 9px; min-height: 36px; border: 0; border-radius: 8px; padding: 0 10px; background: transparent; text-align: left; font-size: 13px; cursor: pointer; }
.conversation-context-menu button:hover { background: var(--accent-soft); }
.conversation-context-menu button.danger { color: var(--danger); }
.conversation-context-menu .menu-separator { height: 1px; margin: 3px 5px; background: var(--line); }

.app-view .sidebar-footer { min-width: 0; gap: 2px; padding-top: 8px; border-top: 1px solid #dedede; }
.app-view .sidebar-action { width: 100%; min-width: 0; min-height: 38px; display: flex; align-items: center; gap: 10px; border-radius: 9px; padding: 8px 10px; color: #454a4f; font-size: 13px; }
.app-view .sidebar-action:hover { background: #e7e7e7; }
.app-view .sidebar-action svg { flex: 0 0 auto; width: 17px; height: 17px; }
.workspace-note { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 9px 10px 3px; }
.workspace-note > span { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 99px; background: var(--teal); box-shadow: 0 0 0 4px rgba(57,121,101,.1); }
.workspace-note div { min-width: 0; display: grid; gap: 2px; }
.workspace-note strong, .workspace-note small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-note strong { font-size: 11px; font-weight: 650; }
.workspace-note small { color: var(--muted); font-size: 10px; }

.app-view .chat-shell { min-width: 0; position: relative; grid-template-rows: 56px minmax(0, 1fr) auto; background: var(--panel); }
.app-view .chat-header { position: relative; z-index: 30; min-width: 0; min-height: 56px; gap: 10px; border: 0; padding: 0 14px; background: color-mix(in srgb, var(--panel) 93%, transparent); backdrop-filter: blur(14px); }
.app-view .sidebar-open-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid #d5dee4; border-radius: 10px; padding: 0; color: #29495f; background: #edf3f6; }
.app-view .sidebar-open-button:hover { border-color: #b7c8d3; background: #e2ebf0; }
.header-ai-mark { margin: 0 !important; color: inherit !important; font-size: 10px !important; font-weight: 820; letter-spacing: .04em; line-height: 1; }
.app-view .chat-heading { min-width: 0; display: grid; gap: 1px; }
.chat-title-line { min-width: 0; display: flex; align-items: center; gap: 7px; }
.chat-title-line #header-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title-line .conversation-status { width: 9px; height: 9px; }
.chat-title-line .conversation-status.working { width: 12px; height: 12px; }
.app-view .chat-heading strong { max-width: min(42vw, 540px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 620; }
.app-view .chat-heading span { margin: 0; color: var(--muted); font-size: 10px; }
.model-menu-wrap { position: relative; min-width: 0; margin-left: auto; }
.model-selector { min-width: 0; max-width: min(42vw, 330px); height: 36px; display: flex; align-items: center; gap: 7px; border: 0; border-radius: 10px; padding: 0 10px; color: var(--ink); background: transparent; cursor: pointer; }
.model-selector:hover { background: var(--accent-soft); }
.model-selector .status-dot { width: 7px; height: 7px; margin: 0; border-radius: 99px; background: var(--teal); box-shadow: 0 0 0 4px rgba(57,121,101,.1); }
.model-selector b { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.model-selector .model-label { margin: 0 0 0 2px; color: var(--muted); font-size: 10px; }
.model-chevron { color: var(--muted); font-size: 13px; transition: transform .16s ease; }
.model-selector[aria-expanded="true"] .model-chevron { transform: rotate(180deg); }
.model-menu { position: absolute; z-index: 320; top: 43px; right: 0; width: min(390px, calc(100vw - 24px)); display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 15px; padding: 6px; color: var(--ink); background: var(--panel); box-shadow: 0 18px 50px rgba(25,31,36,.2); }
.model-menu::before { content: "Freigegebene Modelle"; padding: 7px 9px 5px; color: var(--muted); font-size: 10px; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; }
.model-menu-item { min-width: 0; display: grid; grid-template-columns: 36px minmax(0,1fr) 20px; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 9px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.model-menu-item:hover, .model-menu-item.active { background: var(--accent-soft); }
.model-kind { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #cfdae1; border-radius: 11px; color: #315f80; background: #edf3f6; font-size: 9px; font-weight: 820; letter-spacing: -.02em; }
.model-kind-ocr { color: #526e39; background: #f0f4eb; }
.model-kind-audio { color: #7a5a31; background: #f6f1e9; }
.model-kind-embedding { color: #66517b; background: #f2eef6; }
.model-menu-copy { min-width: 0; display: grid; gap: 3px; }
.model-menu-copy strong, .model-menu-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-menu-copy strong { font-size: 13px; }
.model-menu-copy small { color: var(--muted); font-size: 10px; }
.model-check { color: var(--accent); font-size: 14px; font-weight: 800; text-align: center; }

.account-menu-wrap { position: relative; flex: 0 0 auto; margin-left: auto; }
.account-menu-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 11px; padding: 0; background: transparent; cursor: pointer; }
.account-menu-button:hover, .account-menu-button[aria-expanded="true"] { background: var(--accent-soft); }
.account-menu-button .avatar { width: 30px; height: 30px; border: 1px solid #c9d5de; border-radius: 10px; color: #23445c; background: #e7eef3; }
.account-menu { position: absolute; z-index: 310; top: 45px; right: 0; width: 280px; max-height: min(520px, calc(100dvh - 76px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #aebbc4 transparent; border: 1px solid var(--line); border-radius: 14px; padding: 6px; color: var(--ink); background: var(--panel); box-shadow: 0 18px 50px rgba(25,31,36,.18); }
.account-menu::-webkit-scrollbar { width: 10px; }
.account-menu::-webkit-scrollbar-track { margin-block: 10px; background: transparent; }
.account-menu::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #aebbc4; background-clip: padding-box; }
.account-menu-identity { min-width: 0; display: flex; gap: 11px; padding: 10px 9px 9px; }
.account-menu-identity .avatar { flex: 0 0 auto; }
.account-menu-identity > div { min-width: 0; display: grid; gap: 2px; }
.account-menu-identity strong, .account-menu-identity span, .account-menu-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-identity strong { font-size: 13px; }
.account-menu-identity span { margin: 0; color: var(--muted); font-size: 11px; }
.account-menu-identity small { color: var(--muted); font-size: 10px; }
.account-menu-separator { height: 1px; margin: 4px 5px; background: var(--line); }
.account-menu-item { width: 100%; min-height: 38px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; padding: 0 10px; color: var(--ink); background: transparent; font-size: 13px; text-align: left; cursor: pointer; }
.account-menu-item:hover { background: var(--accent-soft); }
.theme-menu-item > span:last-child { color: var(--muted); font-size: 11px; }
.theme-menu-item i { font-style: normal; }
.danger-menu-item { color: var(--danger); }
.sidebar-account { width: 100%; margin: 5px 0 0; }
.sidebar-account-button { width: 100%; height: 50px; grid-template-columns: 32px minmax(0, 1fr) 20px; justify-items: start; gap: 10px; border-radius: 12px; padding: 6px 8px; color: var(--ink); text-align: left; }
.sidebar-account-button:hover, .sidebar-account-button[aria-expanded="true"] { background: #e7e7e7; }
.sidebar-account-button .avatar { border-color: #2b4659; color: #fff; background: #2b4659; }
.sidebar-account-copy { min-width: 0; display: grid; gap: 2px; }
.sidebar-account-copy strong, .sidebar-account-copy small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-copy strong { font-size: 12px; font-weight: 680; }
.sidebar-account-copy small { margin: 0; color: var(--muted); font-size: 10px; }
.sidebar-account-chevron { width: 17px !important; height: 17px !important; justify-self: end; transition: transform .16s ease; }
.sidebar-account-button[aria-expanded="true"] .sidebar-account-chevron { transform: rotate(180deg); }
.sidebar-account .account-menu { top: auto; right: auto; bottom: 54px; left: 0; width: 258px; }

.app-view .chat-scroll { min-width: 0; overflow-x: hidden; }
.app-view .welcome-state { width: min(100%, 900px); min-height: 100%; margin: 0 auto; padding: 80px 28px 160px; }
.welcome-logo { width: 58px; height: 58px; margin-bottom: 22px; }
.app-view .welcome-state h1 { font-size: clamp(30px, 3.4vw, 42px); font-weight: 560; letter-spacing: -.045em; }
.app-view .welcome-state > p { margin: 13px 0 30px; color: var(--muted); font-size: 15px; }
.app-view .suggestion-grid { width: min(100%, 820px); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.app-view .suggestion-grid button { min-width: 0; min-height: 118px; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; column-gap: 9px; row-gap: 5px; border-radius: 14px; padding: 15px; background: var(--panel); }
.app-view .suggestion-grid button:hover { border-color: #bccbd5; background: var(--accent-soft); }
.suggestion-icon { grid-row: 1 / 3; align-self: start; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); font-size: 14px; }
.app-view .suggestion-grid b { align-self: end; font-size: 12px; }
.app-view .suggestion-grid button > span:last-child { font-size: 11px; }

.app-view .message-list { width: min(100%, 780px); padding: 34px 24px 184px; }
.app-view .message { grid-template-columns: 30px minmax(0, 1fr); gap: 13px; margin-bottom: 32px; }
.app-view .message.user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.app-view .message.user .message-avatar, .app-view .message.user .message-label { display: none; }
.app-view .message-avatar { width: 28px; height: 28px; border-radius: 9px; overflow: hidden; background: #eaf0f4; }
.app-view .message-avatar img { width: 24px; height: 24px; }
.app-view .message.assistant .assistant-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  overflow: hidden;
  border: 1px solid #c9d5de;
  border-radius: 10px;
  background: #f6fafc;
  box-shadow: 0 1px 3px rgba(30, 55, 72, .08);
}
.app-view .message.assistant .message-avatar-logo {
  width: 25px;
  height: 25px;
  max-width: none;
  flex: 0 0 auto;
  filter: none;
}
html[data-theme="dark"] .app-view .message.assistant .assistant-avatar {
  border-color: #dce9ef;
  background: #dce9ef;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
}
html[data-theme="dark"] .app-view .message.assistant .message-avatar-logo { filter: none; }
.app-view .message-body { width: 100%; min-width: 0; padding-top: 1px; }
.app-view .message.user .message-body { width: fit-content; max-width: min(78%, 600px); display: grid; justify-items: end; }
.app-view .message.assistant .message-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app-view .message-label { margin-bottom: 7px; font-size: 11px; }
.message-time { margin: 0 auto 12px; color: #8a8f94; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 480; }
.app-view .message-content { color: var(--ink); font-size: 14px; line-height: 1.68; white-space: normal; }
.app-view .message.user .message-content { width: fit-content; max-width: 100%; border-radius: 18px; padding: 11px 16px; background: #f1f1f1; white-space: pre-wrap; }
.app-view .message.user .message-content.has-attachments { min-width: min(360px, 72vw); display: grid; gap: 10px; white-space: normal; }
.message-user-copy { white-space: pre-wrap; }
.message-attachments { display: grid; gap: 7px; }
.message-attachment { min-width: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #d2d9de; border-radius: 12px; padding: 8px 10px; color: #263640; background: rgba(255,255,255,.72); }
.message-attachment-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #315f80; background: #e6eef3; }
.message-attachment-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.message-attachment-copy { min-width: 0; display: grid; gap: 2px; }
.message-attachment-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 680; }
.message-attachment-copy small, .message-attachment-size { color: #71808a; font-size: 9px; font-weight: 680; letter-spacing: .05em; text-transform: uppercase; }
.message-content p { margin: 0 0 13px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h2, .message-content h3, .message-content h4 { margin: 22px 0 9px; line-height: 1.32; letter-spacing: -.015em; }
.message-content h2 { font-size: 19px; }.message-content h3 { font-size: 16px; }.message-content h4 { font-size: 14px; }
.message-content ul, .message-content ol { margin: 8px 0 15px; padding-left: 24px; }
.message-content li { margin: 5px 0; padding-left: 2px; }
.message-content code { border-radius: 5px; padding: 2px 5px; background: var(--accent-soft); font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.code-block { position: relative; margin: 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #161b20; color: #eef3f5; }
.code-block-header { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 10px 0 13px; color: #aebac2; background: #20272d; font-size: 10px; }
.code-block-header button { border: 0; color: #dce4e9; background: transparent; font-size: 11px; cursor: pointer; }
.code-block pre { margin: 0; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #667883 transparent; padding: 14px; font: 13px/1.58 ui-monospace, SFMono-Regular, Consolas, monospace; }
.code-block pre::-webkit-scrollbar { height: 10px; }
.code-block pre::-webkit-scrollbar-track { margin-inline: 10px; background: transparent; }
.code-block pre::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #667883; background-clip: padding-box; }
.message-actions { min-height: 30px; display: flex; gap: 2px; margin-top: 8px; opacity: .62; transition: opacity .15s; }
.message:hover .message-actions, .message-actions:focus-within { opacity: 1; }
.message-action { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; padding: 0; color: #737b81; background: transparent; cursor: pointer; }
.message-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.message-action.action-complete { color: #397965; background: rgba(57,121,101,.1); }
.message-action.speech-playing { color: #315f80; background: #e6eef3; }
.message-action.speech-loading svg { animation: conversation-spin .78s linear infinite; }
.message-action:hover { color: var(--ink); background: var(--accent-soft); }

.audio-player-card { width: min(100%, 650px); display: grid; gap: 14px; margin: 16px 0 4px; border: 1px solid #d4dde3; border-radius: 17px; padding: 15px; background: linear-gradient(145deg, #f8fafb, #eef3f6); box-shadow: 0 9px 24px rgba(25,45,58,.08); }
.audio-player-media { display: none; }
.audio-player-header { min-width: 0; display: grid; grid-template-columns: 45px minmax(0,1fr) auto; align-items: center; gap: 11px; }
.audio-player-visual { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; gap: 2px; border-radius: 13px; color: #fff; background: #315f80; }
.audio-player-visual i { width: 2px; border-radius: 9px; background: currentColor; opacity: .9; transition: height .18s ease; }
.audio-player-card.playing .audio-player-visual i:nth-child(odd) { animation: audio-wave 1s ease-in-out infinite alternate; }
.audio-player-card.playing .audio-player-visual i:nth-child(even) { animation: audio-wave .75s ease-in-out .12s infinite alternate-reverse; }
@keyframes audio-wave { to { height: 8px; opacity: .58; } }
.audio-player-heading { min-width: 0; display: grid; gap: 3px; }
.audio-player-heading strong, .audio-player-heading small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-player-heading strong { font-size: 14px; font-weight: 720; }
.audio-player-heading small, .audio-player-validity { color: var(--muted); font-size: 11px; }
.audio-player-validity { white-space: nowrap; }
.audio-player-controls { display: grid; grid-template-columns: 38px 36px minmax(100px,1fr) 40px 34px 34px; align-items: center; gap: 8px; }
.audio-play-button, .audio-secondary-button { display: grid; place-items: center; border: 0; cursor: pointer; }
.audio-play-button { width: 38px; height: 38px; border-radius: 99px; color: #fff; background: #263f51; box-shadow: 0 5px 14px rgba(25,45,58,.16); }
.audio-play-button:hover { background: var(--accent); }
.audio-play-button:disabled { cursor: not-allowed; opacity: .45; }
.audio-secondary-button { width: 34px; height: 34px; border-radius: 10px; color: #536873; background: transparent; }
.audio-secondary-button:hover { color: var(--ink); background: rgba(255,255,255,.76); }
.audio-play-button svg, .audio-secondary-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.audio-play-button svg path[d^="M8 5.5v13l"] { fill: currentColor; stroke: none; }
.audio-time { color: #5f707a; font-variant-numeric: tabular-nums; font-size: 11px; text-align: center; }
.audio-progress { width: 100%; height: 20px; margin: 0; padding: 0; border: 0; box-shadow: none; accent-color: #315f80; cursor: pointer; }
.audio-progress:focus { box-shadow: none; }
.audio-player-card.audio-error { border-color: #dfb4b4; background: #fbf2f2; }

html[data-theme="dark"] .audio-player-card { border-color: #3a4b55; background: linear-gradient(145deg, #1e2a31, #182229); box-shadow: 0 10px 26px rgba(0,0,0,.2); }
html[data-theme="dark"] .audio-player-visual { color: #17232a; background: #d7e4eb; }
html[data-theme="dark"] .audio-play-button { color: #17232a; background: #d7e4eb; }
html[data-theme="dark"] .audio-secondary-button { color: #aebdc6; }
html[data-theme="dark"] .audio-secondary-button:hover { color: #fff; background: #293740; }
html[data-theme="dark"] .audio-time { color: #a8b6bf; }
html[data-theme="dark"] .audio-progress { accent-color: #9fc1d3; }
html[data-theme="dark"] .audio-player-card.audio-error { border-color: #704646; background: #302323; }

.app-view .composer-wrap { z-index: 20; padding: 10px 22px 11px; background: linear-gradient(to top, var(--panel) 78%, color-mix(in srgb, var(--panel) 0%, transparent)); }
.app-view .composer { position: relative; width: min(100%, 820px); border-color: #cfd5da; border-radius: 24px; padding: 13px 12px 9px 17px; box-shadow: 0 7px 26px rgba(25,31,36,.09); }
.drop-hint { position: fixed; z-index: 500; inset: 12px; display: none; place-content: center; gap: 7px; border: 2px dashed var(--accent); border-radius: 22px; color: var(--ink); background: color-mix(in srgb, var(--panel) 88%, transparent); text-align: center; pointer-events: none; backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.drop-hint b { font-size: 22px; letter-spacing: -.02em; }
.drop-hint span { color: var(--muted); font-size: 12px; }
.app-view.drag-active .drop-hint { display: grid; }
.app-view .composer textarea { min-height: 28px; padding: 3px 3px 11px; font-size: 15px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 8px; max-height: 116px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #aebbc4 transparent; }
.attachment-list::-webkit-scrollbar { width: 10px; }
.attachment-list::-webkit-scrollbar-track { margin-block: 7px; background: transparent; }
.attachment-list::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #aebbc4; background-clip: padding-box; }
.attachment-chip { width: fit-content; max-width: min(100%, 360px); display: flex; align-items: center; gap: 8px; border: 1px solid #cbd7df; border-radius: 10px; padding: 6px 7px 6px 10px; color: #344854; background: #edf3f6; font-size: 11px; }
.attachment-chip span { min-width: 0; display: grid; gap: 1px; }
.attachment-chip b { max-width: min(280px, 52vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
.attachment-chip small { color: #748590; font-size: 9px; }
.attachment-chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 7px; color: #687985; background: transparent; cursor: pointer; }
.attachment-chip button:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.attachment-chip-preview { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid rgba(49,95,128,.18); border-radius: 8px; object-fit: cover; background: #fff; }
.app-view .composer-bottom { min-height: 34px; }
.composer-actions, .composer-submit { display: flex; align-items: center; gap: 8px; }
.composer-tool-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 99px; color: #4c5359; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; }
.composer-tool-button:hover, .composer-tool-button[aria-expanded="true"] { background: var(--accent-soft); }
.microphone-button { padding: 7px; }
.microphone-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.microphone-button.recording { border-color: #b93636; color: #fff; background: #c84242; animation: microphone-pulse 1.4s ease-in-out infinite; }
.microphone-button:disabled { cursor: wait; opacity: .6; }
.recording-status { color: #b93636; font-size: 11px; font-weight: 680; }
@keyframes microphone-pulse { 50% { box-shadow: 0 0 0 5px rgba(200,66,66,.13); } }
.composer-model { color: var(--muted); font-size: 11px; }
.composer-submit > span { color: #989da2; font-size: 10px; }
.app-view .send-button { border-radius: 99px; background: #26313a; }
.app-view .send-button:hover { background: var(--accent); }
.composer-menu { position: absolute; z-index: 100; left: 12px; bottom: 52px; width: 230px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 5px; background: var(--panel); box-shadow: 0 14px 38px rgba(25,31,36,.16); }
.composer-menu button { min-height: 36px; border: 0; border-radius: 8px; padding: 0 10px; color: var(--ink); background: transparent; text-align: left; font-size: 12px; cursor: pointer; }
.composer-menu button:hover { background: var(--accent-soft); }

.compact-dialog { width: min(460px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 22px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.compact-dialog::backdrop { background: rgba(22,28,33,.42); backdrop-filter: blur(4px); }
.compact-dialog h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.compact-dialog form { display: grid; gap: 17px; }
.compact-dialog .delete-form { display: block; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-actions .primary-button, .dialog-actions .secondary-button, .dialog-actions .danger-button { min-height: 40px; min-width: 96px; padding: 0 15px; }
.secondary-button, .danger-button { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-weight: 680; cursor: pointer; }
.danger-button { border-color: #d65b5b; color: white; background: #c84242; }
.danger-button:hover { border-color: #b93636; background: #b93636; }
.danger-button:disabled { cursor: wait; opacity: .62; }
.archived-list { display: grid; gap: 7px; }
.archived-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.archived-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.archived-row button { border: 0; border-radius: 8px; padding: 7px 9px; color: var(--accent-strong); background: var(--accent-soft); font-size: 11px; cursor: pointer; }
.archived-row button.danger { color: var(--danger); background: transparent; }

.chat-settings-dialog { width: min(720px, calc(100% - 30px)); overflow: hidden; padding: 0; }
.chat-settings-dialog form { display: grid; gap: 19px; max-height: min(820px, calc(100dvh - 30px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #aebbc4 transparent; padding: 26px; }
.chat-settings-dialog form::-webkit-scrollbar { width: 11px; }
.chat-settings-dialog form::-webkit-scrollbar-track { margin-block: 16px; background: transparent; }
.chat-settings-dialog form::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #aebbc4; background-clip: padding-box; }
.settings-grid, .parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chat-settings-dialog select, .chat-settings-dialog textarea { width: 100%; border: 1px solid #dfe2e8; border-radius: 12px; outline: none; color: var(--ink); background: var(--panel); }
.chat-settings-dialog select { height: 48px; padding: 0 13px; }
.chat-settings-dialog textarea { min-height: 118px; resize: vertical; padding: 12px 14px; line-height: 1.5; }
.chat-settings-dialog select:focus, .chat-settings-dialog textarea:focus { border-color: #6f94ae; box-shadow: 0 0 0 4px rgba(47,95,130,.1); }
.advanced-settings { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--panel-soft); }
.advanced-settings summary { padding: 14px 0; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.advanced-settings > p { margin: -2px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.parameter-grid { padding-bottom: 16px; }
.parameter-grid label { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); }
.parameter-grid output { position: absolute; top: 12px; right: 12px; color: var(--accent-strong); font-size: 12px; }
.parameter-grid input[type="range"] { height: 22px; padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); }

.app-view button:focus-visible, .compact-dialog button:focus-visible { outline: 2px solid #6f94ae; outline-offset: 2px; }

html[data-theme="dark"] .app-view .sidebar { background: #151d22; }
html[data-theme="dark"] .session-loading { background: #11191e; }
html[data-theme="dark"] .brand-symbol-card { border-color: #344955; background: #1c2a33; box-shadow: 0 9px 28px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.04); }
html[data-theme="dark"] .brand-symbol-card img { filter: brightness(0) saturate(100%) invert(80%) sepia(17%) saturate(616%) hue-rotate(158deg) brightness(97%) contrast(91%); }
html[data-theme="dark"] .app-view .new-chat-button:hover,
html[data-theme="dark"] .app-view .sidebar-action:hover,
html[data-theme="dark"] .conversation-item:hover,
html[data-theme="dark"] .conversation-item.active { background: #202a30; }
html[data-theme="dark"] .chat-search:focus-within { background: #1e282e; }
html[data-theme="dark"] .chat-search kbd { border-color: #3a4953; color: #9ba9b4; background: #1c262d; }
html[data-theme="dark"] .conversation-open { color: #d4dce1; }
html[data-theme="dark"] .conversation-status { background: #88b4cc; box-shadow: 0 0 0 3px rgba(136,180,204,.12); }
html[data-theme="dark"] .conversation-status.working { border-color: rgba(136,180,204,.24); border-top-color: #88b4cc; background: transparent; box-shadow: none; }
html[data-theme="dark"] .conversation-status.failed { background: #e28585; box-shadow: 0 0 0 3px rgba(226,133,133,.12); }
html[data-theme="dark"] .app-view .sidebar-footer { border-color: #2b3943; }
html[data-theme="dark"] .app-view .chat-header { background: rgba(17,25,30,.9); }
html[data-theme="dark"] .account-menu,
html[data-theme="dark"] .model-menu,
html[data-theme="dark"] .conversation-context-menu,
html[data-theme="dark"] .composer-menu,
html[data-theme="dark"] .compact-dialog { color: var(--ink); border-color: #34434d; background: #182229; }
html[data-theme="dark"] .app-view .message.user .message-content { background: #253139; }
html[data-theme="dark"] .message-time { color: #8d9ba4; }
html[data-theme="dark"] .message-action { color: #94a2ab; }
html[data-theme="dark"] .message-action.speech-playing { color: #d7e4eb; background: #263945; }
html[data-theme="dark"] .message-attachment { border-color: #42525c; color: #e1e8ec; background: rgba(18,28,34,.72); }
html[data-theme="dark"] .message-attachment-icon { color: #b8d2e1; background: #293b46; }
html[data-theme="dark"] .message-attachment-copy small,
html[data-theme="dark"] .message-attachment-size { color: #9aaab4; }
html[data-theme="dark"] .app-view .composer { background: #172127; }
html[data-theme="dark"] .composer-tool-button { color: #cbd4da; }
html[data-theme="dark"] .app-view .send-button { background: #dce4e9; color: #172027; }
html[data-theme="dark"] .model-kind { border-color: #40535f; color: #b8d2e1; background: #22323c; }
html[data-theme="dark"] .model-kind-ocr { color: #bed0a8; background: #293329; }
html[data-theme="dark"] .model-kind-audio { color: #dcc49f; background: #372f26; }
html[data-theme="dark"] .model-kind-embedding { color: #d1bee2; background: #302939; }
html[data-theme="dark"] .attachment-chip { border-color: #40535f; color: #d7e1e7; background: #22323c; }
html[data-theme="dark"] .attachment-chip-preview { border-color: #4d626e; background: #172128; }
html[data-theme="dark"] .chat-settings-dialog select,
html[data-theme="dark"] .chat-settings-dialog textarea,
html[data-theme="dark"] .parameter-grid label { border-color: #34434d; color: var(--ink); background: #172127; }
html[data-theme="dark"] .app-brand .brand-wordmark { filter: brightness(0) invert(1); opacity: .92; }
html[data-theme="dark"] .account-menu-button .avatar { border-color: #425562; color: #15242e; background: #d7e4eb; }
html[data-theme="dark"] .app-view .sidebar-open-button { border-color: #3d505d; color: #e7f0f5; background: #24343e; }
html[data-theme="dark"] .app-view .sidebar-open-button:hover { border-color: #587181; background: #2b3d48; }
html[data-theme="dark"] .sidebar-account-button:hover,
html[data-theme="dark"] .sidebar-account-button[aria-expanded="true"] { background: #223039; }
html[data-theme="dark"] .sidebar-account-button .avatar { border-color: #dce9ef; color: #15242e; background: #dce9ef; }
html[data-theme="dark"] .account-menu,
html[data-theme="dark"] .chat-settings-dialog form { scrollbar-color: #607682 transparent; }
html[data-theme="dark"] .account-menu::-webkit-scrollbar-thumb,
html[data-theme="dark"] .chat-settings-dialog form::-webkit-scrollbar-thumb,
html[data-theme="dark"] .attachment-list::-webkit-scrollbar-thumb { border-color: transparent; background-color: #607682; }

@media (max-width: 1100px) {
  .app-view .suggestion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-view .suggestion-grid button { min-height: 96px; }
}

@media (max-width: 900px) {
  .desktop-only { display: none !important; }
  .app-view .mobile-only { display: inline-grid !important; }
  .app-view, .app-view.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app-view .sidebar, .app-view.sidebar-collapsed .sidebar { z-index: 260; visibility: visible; transform: translateX(-105%); }
  .sidebar-backdrop { z-index: 250; }
  .app-view .sidebar.open { transform: translateX(0); }
  .sidebar-open-button, .app-view.sidebar-collapsed .sidebar-open-button { display: inline-grid; }
  .model-menu-wrap { margin-left: auto; }
  .model-selector .model-label { display: none; }
  .conversation-options { opacity: .58; }
}

@media (max-width: 600px) {
  .app-view .chat-header { padding: 0 9px; }
  .app-view .chat-heading { display: none; }
  .model-menu-wrap { margin-left: 0; }
  .model-selector { max-width: 55vw; }
  .model-menu { position: fixed; top: 51px; right: 8px; width: min(390px, calc(100vw - 16px)); }
  .sidebar-account { margin-left: 0; }
  .sidebar-account .account-menu { position: absolute; top: auto; right: auto; bottom: 54px; left: 0; width: min(280px, calc(86vw - 20px)); }
  .app-view .welcome-state { padding: 42px 16px 135px; }
  .welcome-logo { width: 45px; height: 45px; }
  .app-view .welcome-state h1 { font-size: 29px; }
  .app-view .suggestion-grid { grid-template-columns: 1fr; width: min(100%, 420px); }
  .app-view .suggestion-grid button:nth-child(n+3) { display: none; }
  .app-view .message-list { padding: 22px 15px 150px; }
  .app-view .message.user .message-body { max-width: 92%; }
  .app-view .composer-wrap { padding: 8px 8px 7px; }
  .app-view .composer { border-radius: 20px; padding-left: 13px; }
  .composer-submit > span { display: none; }
  .archived-row { grid-template-columns: minmax(0, 1fr) auto; }
  .archived-row .danger { grid-column: 2; }
  .settings-grid, .parameter-grid { grid-template-columns: 1fr; }
  .chat-settings-dialog { overflow: hidden; padding: 0; }
  .chat-settings-dialog form { max-height: 100dvh; padding: 22px 18px; }
  .chat-settings-dialog .dialog-actions { flex-wrap: wrap; }
  .chat-settings-dialog .dialog-actions button { flex: 1 1 180px; }
  .audio-player-card { padding: 12px; }
  .audio-player-header { grid-template-columns: 42px minmax(0,1fr); }
  .audio-player-visual { width: 42px; height: 42px; }
  .audio-player-validity { grid-column: 2; }
  .audio-player-controls { grid-template-columns: 38px 34px minmax(80px,1fr) 36px 34px; gap: 5px; }
  .audio-player-controls .audio-total { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .app-view, .app-view .sidebar { transition: none; }
  .session-loading img { animation: none; }
  .audio-player-card.playing .audio-player-visual i { animation: none; }
}
