
:root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; display: flex; overflow: hidden; }
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid #83b5d0; outline-offset: 3px; }
button { color: inherit; }
[hidden] { display: none !important; }
.navigation { width: 268px; flex-shrink: 0; display: flex; flex-direction: column; padding: 22px 18px 18px; background: #edf2f6; border-right: 1px solid var(--line); overflow: hidden; }
.navigation-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; scrollbar-width: thin; padding: 3px; margin: -3px; }
.navigation > .navigation-content { flex-shrink: 1; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 24px; color: inherit; text-decoration: none; font-size: 19px; font-weight: 650; letter-spacing: -.5px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: #304f65; color: white; display: grid; place-items: center; font-size: 22px; letter-spacing: -2px; padding-right: 2px; }
.brand small { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.new-chat { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 15px; border: 1px solid #ccdae5; border-radius: 11px; background: #fff; color: #365c75; font-size: 14px; font-weight: 600; }
.new-chat span { font-size: 0; line-height: 1; width: 22px; }
.new-chat span::before { content: '+'; font-size: 22px; }
.nav-label { color: var(--muted); font-size: 12px; margin: 20px 14px 12px; }
.tool-nav { display: grid; gap: 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; border: 0; border-radius: 12px; background: transparent; font-size: 15px; font-weight: 550; }
.nav-item small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.nav-item:hover, .utility-item:hover { background: #e4ecf2; }
.nav-item.selected { background: #dceaf3; color: #285f82; }
.tool-mark { display: grid; place-items: center; flex: none; width: 37px; height: 37px; border-radius: 11px; font-size: 16px; font-weight: 650; }
.chat-mark { background: #d8e7e7; color: #417876; }
.photo-mark { background: #e5e1f0; color: #78679a; }
.music-mark { background: #eee4dd; color: #a37b60; }
.nav-divider { height: 1px; background: #dce4eb; margin: 23px 10px 14px; }
.utility-item { border: 0; background: transparent; border-radius: 10px; padding: 13px; text-align: left; font-size: 14px; display: flex; gap: 12px; align-items: center; }
.utility-item > span { display: block; flex: none; position: relative; width: 22px; height: 22px; font-size: 0; color: #70899b; }
#history-button > span { width: 18px; height: 18px; margin: 2px; border: 1.5px solid currentColor; border-radius: 50%; }
#history-button > span::before { content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 6px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
#history-button > .history-chevron { width: 7px; height: 7px; margin-left: auto; border: 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; border-radius: 0; transform: rotate(45deg); }
#history-button > .history-chevron::before { content: none; }
#history-button[aria-expanded="true"] > .history-chevron { transform: rotate(225deg); }
.history-panel { flex: none; padding: 3px 5px 10px; }
#history-search { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--surface); color: var(--text); font-size: 13px; }
#history-search::placeholder { color: var(--muted); }
.history-status { font-size: 12px; color: var(--muted); padding: 0 6px; line-height: 1.5; }
.recent-list { max-height: min(290px, 32dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.recent-group { color: var(--muted); font-size: 11px; margin: 13px 9px 5px; }
.recent-chat { width: 100%; min-width: 0; display: block; text-align: left; padding: 9px; border: 0; border-radius: 9px; background: transparent; }
.recent-chat:hover { background: var(--hover); }
.recent-chat[aria-current="true"] { background: var(--selected); color: var(--selection-text); }
.recent-chat b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.recent-chat small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.history-actions { display: flex; gap: 12px; flex-wrap: wrap; padding: 9px 6px 0; }
.history-actions button { border: 0; background: transparent; color: var(--accent-text); font-size: 11px; padding: 4px 0; }
.history-actions button:hover { text-decoration: underline; }
.navigation > * { flex-shrink: 0; }
.utility-item[data-tool="prices"] > span::before { content: 'M'; display: grid; place-items: center; width: 18px; height: 18px; margin: 2px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 10px; }
.navigation-bottom { margin-top: auto; padding-top: 18px; }
.account-row { border: 1px solid #dbe4ec; border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; width: 100%; background: #f7f9fb; text-align: left; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #dce7ef; color: #577d96; }
.avatar { overflow: hidden; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.account-row b { display: block; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.account-row small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.account-balance-amount { color: var(--text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.account-menu { margin-left: auto; font-weight: bold; }
.original-link { display: block; margin-top: 18px; color: #748797; text-align: center; font-size: 12px; text-decoration: none; }
.original-link:hover { text-decoration: underline; }
.workspace { min-width: 0; flex: 1; display: flex; flex-direction: column; background: #fbfcfd; }
.network-status { flex: none; margin: 0; padding: 9px 18px; background: var(--surface); color: var(--muted); border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.network-status[hidden] { display: none; }
.workspace-top { height: 84px; flex: none; display: flex; align-items: center; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--line); background: #fff; }
.workspace-heading h1 { margin: 0; font-size: 17px; font-weight: 600; }
.workspace-heading p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.workspace-heading { min-width: 0; }
.workspace-title-row { display: flex; align-items: center; gap: 8px; }
.heading-logo { width: 20px; height: 20px; object-fit: contain; flex: none; }
.workspace-heading p { max-width: 360px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.preview-label { border: 1px solid #e1e8ed; border-radius: 6px; color: #81909b; padding: 4px 7px; font-size: 11px; }
.conversation { min-height: 0; flex: 1; position: relative; display: flex; overflow: auto; }
.welcome { width: min(650px, 100%); margin: auto; padding: 40px 28px; }
.welcome-mark { width: 56px; height: 56px; border-radius: 19px; color: #4a8198; background: #e5f0f3; display: grid; place-items: center; margin-bottom: 24px; font-size: 32px; letter-spacing: -3px; padding-right: 3px; }
.welcome h2 { margin: 0; font-size: clamp(27px, 3vw, 36px); line-height: 1.2; font-weight: 550; letter-spacing: -1px; }
.welcome-description { max-width: 440px; font-size: 15px; line-height: 1.6; color: #7c8a97; margin: 15px 0 32px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.suggestion { background: #fff; border: 1px solid #e2e8ed; border-radius: 12px; text-align: left; padding: 18px; min-height: 88px; transition: border-color .15s, background .15s; }
.suggestion:hover { border-color: #a8c7da; background: #f5f9fc; }
.suggestion b { display: block; font-size: 14px; font-weight: 550; }
.suggestion small { display: block; font-size: 12px; color: #8a97a3; margin-top: 7px; line-height: 1.4; }
.composer-area { width: min(850px, 100%); flex: none; margin: 0 auto; padding: 0 34px 20px; }
.composer { padding: 17px 18px 13px; background: white; border: 1px solid #d8e2ea; border-radius: 17px; box-shadow: 0 3px 14px #283f5510; }
.composer:focus-within { border-color: #8bb4cd; }
.composer textarea { display: block; width: 100%; padding: 0; min-height: 48px; max-height: 160px; resize: vertical; border: 0; background: transparent; color: #334658; font-size: 15px; line-height: 1.6; outline: none; }
.composer textarea::placeholder { color: #9aa7b3; }
.composer-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.composer-controls > span { color: #8a99a6; font-size: 12px; }
.composer-note { text-align: center; color: #92a0ac; font-size: 11px; margin: 13px 0 0; line-height: 1.5; }
.embedded-tool { width: 100%; height: 100%; }
.embedded-tool iframe { display: block; width: 100%; height: 100%; border: 0; }
.tool-status { position: absolute; inset: 0; display: grid; place-content: center; background: #fbfcfd; color: var(--muted); font-size: 14px; }
.tool-status.tool-preparing { inset: auto 12px 12px auto; display: block; max-width: calc(100% - 24px); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12px; pointer-events: none; z-index: 3; }
.icon-button { border: 0; border-radius: 8px; background: transparent; padding: 8px; font-size: 22px; }
.mobile-menu { display: none; }
.mobile-menu { font-size: 0; width: 30px; height: 36px; padding: 6px; }
.mobile-menu::before { content: ''; display: block; width: 18px; height: 14px; background: linear-gradient(to bottom, #607e94 0 2px, transparent 2px 6px, #607e94 6px 8px, transparent 8px 12px, #607e94 12px 14px); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#preview-login {
    --available: calc(var(--mobile-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    position: fixed;
    inset: calc(var(--mobile-top, 0px) + env(safe-area-inset-top) + var(--available) / 2) env(safe-area-inset-right) auto env(safe-area-inset-left);
    width: min(420px, calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 20px));
    height: min(348px, calc(var(--available) - 16px));
    max-height: none;
    margin: 0 auto;
    transform: translateY(-50%);
    padding: 6px 8px 46px;
    border: 1px solid #d6e1e9;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 20px 90px #233c5033;
}
#preview-login::backdrop { background: #243b5070; }
#preview-login iframe { display: block; border: 0; width: 100%; height: 100%; }
.dialog-close { position: absolute; top: 7px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 8px; color: #637e90; background: #f0f5f8; font-size: 26px; }
#preview-login .dialog-close {
    inset: auto 0 7px;
    margin-inline: auto;
    display: inline-flex;
    align-items: center;
    width: max-content;
    height: 34px;
    padding-inline: 12px;
    color: var(--accent-text);
    background: var(--soft);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
}
.nav-shade { display: none; }
@media (max-width: 1000px) {
    .navigation { width: 236px; padding-left: 13px; padding-right: 13px; }
    .brand { font-size: 17px; gap: 9px; }
    .brand small { font-size: 11px; }
    .workspace-top { padding: 0 22px; }
    .preview-label { margin-left: auto; }
    .support-button { margin-left: 0; }
    .welcome { padding: 30px; }
}
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    .navigation { position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(290px, calc(100vw - 44px)); transform: translateX(-100%); transition: transform .2s ease; }
    body.nav-open .navigation { transform: translateX(0); }
    .nav-shade:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 19; border: 0; background: #23394d66; backdrop-filter: blur(3px); }
    .mobile-menu { display: block; margin-left: -6px; }
    .workspace-top { height: 74px; gap: 12px; padding: 0 18px; }
    .workspace-heading h1 { font-size: 16px; }
    .workspace-heading p { font-size: 11px; }
    .support-button { font-size: 12px; padding-left: 0; margin-left: auto; }
    .preview-label { display: none; }
    .welcome { padding: 28px 22px; }
    .welcome-mark { width: 46px; height: 46px; border-radius: 15px; font-size: 28px; margin-bottom: 20px; }
    .welcome-description { font-size: 14px; margin-bottom: 24px; }
    .suggestion { padding: 14px; min-height: 85px; }
    .suggestion b { font-size: 13px; }
    .suggestion small { font-size: 11px; }
    .composer-area { padding: 10px 16px max(14px, env(safe-area-inset-bottom)); }
    .composer { padding: 14px; border-radius: 15px; }
    .composer textarea { font-size: 16px; }
    .composer-controls > span { font-size: 11px; }
    .composer-note { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

html, body { background: var(--page); color: var(--text); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.composer textarea { text-align: left; }
.navigation { background: var(--rail); border-color: var(--line); }
.brand-mark { background: var(--brand); }
.workspace, .tool-status { background: var(--page); }
.workspace-top, .suggestion, .composer, .new-chat, #preview-login { background: var(--surface); border-color: var(--line); }
.new-chat, .original-link, .dialog-close { color: var(--accent-text); }
.nav-label, .brand small, .nav-item small, .account-row small, .workspace-heading p,
.welcome-description, .suggestion small, .composer-note, .composer-controls > span,
.preview-label, .tool-status { color: var(--muted); }
.composer textarea { color: var(--text); }
.composer textarea::placeholder { color: var(--hint); }
.nav-divider { background: var(--line); }
.nav-item:hover, .utility-item:hover { background: var(--hover); }
.nav-item.selected { background: var(--selected); color: var(--selection-text); }
.nav-item.selected small, .recent-chat[aria-current="true"] small { color: var(--selection-text); }
.account-row, .dialog-close { background: var(--soft); border-color: var(--line); }
.avatar, .welcome-mark { background: var(--selected); color: var(--accent-text); }
.suggestion:hover { background: var(--soft); border-color: var(--input-border); }
.preview-label { border-color: var(--line); }
.theme-toggle { width: 38px; height: 38px; margin-left: auto; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--accent-text); }
.theme-toggle:hover { background: var(--soft); }
.theme-icon { position: relative; display: block; width: 17px; height: 17px; border-radius: 50%; box-shadow: inset -6px -3px 0 0 currentColor; }
[data-theme="dark"] .theme-icon { width: 11px; height: 11px; background: currentColor; box-shadow: 0 -8px 0 -4px currentColor, 0 8px 0 -4px currentColor, 8px 0 0 -4px currentColor, -8px 0 0 -4px currentColor, 6px 6px 0 -4px currentColor, -6px -6px 0 -4px currentColor, -6px 6px 0 -4px currentColor, 6px -6px 0 -4px currentColor; }
[data-theme="dark"] .chat-mark { background: #254447; color: #9bc8c7; }
[data-theme="dark"] .photo-mark { background: #383649; color: #c3b6df; }
[data-theme="dark"] .music-mark { background: #443d38; color: #d7b89f; }
.tool-toolbar { display: flex; gap: 14px; align-items: center; padding: 9px 24px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; font-size: 12px; color: var(--muted); }
.tool-toolbar button { border: 1px solid var(--line); border-radius: 8px; min-height: 32px; padding: 6px 10px; background: var(--soft); color: var(--accent-text); font-size: 13px; }
.tool-toolbar button { flex: none; }
.tool-toolbar span { min-width: 0; line-height: 1.5; }
.brand-mark { padding: 0; background: transparent; }
.brand-mark img { width: 38px; height: 38px; object-fit: contain; border-radius: 11px; }
.tool-mark { padding: 0; overflow: hidden; background: transparent !important; }
.tool-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.welcome-mark { background: transparent; padding: 0; border-radius: 18px; overflow: hidden; }
.welcome-mark img { width: 100%; height: 100%; object-fit: contain; }
.composer { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 7px 8px 7px 12px; border-radius: 22px; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--selected); }
.composer textarea { flex: 1; width: 0; min-height: 26px; max-height: 160px; height: 26px; padding: 8px 6px; resize: none; line-height: 24px; border-radius: 0; }
.composer textarea:focus-visible { outline: none; }
.attachment-button { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: transparent; }
.attachment-button:hover { color: var(--accent-text); background: var(--soft); }
.paperclip-icon { display: block; width: 24px; height: 24px; }
.send-button { flex: none; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 5px solid transparent; border-radius: 50%; background: var(--action) padding-box; color: white; font-weight: 600; }
.send-button:hover:not(:disabled) { filter: brightness(1.12); }
.send-button:disabled { opacity: .55; cursor: default; }
.composer-controls { margin: 9px 12px 0; }
.keyboard-hint { color: var(--muted); font-size: 11px; }
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    .composer { gap: 6px; padding: 7px; border-radius: 23px; }
    .composer textarea { font-size: 16px; }
    .composer-controls { margin: 8px 10px 0; }
    .keyboard-hint { display: none; }
    .composer-note { margin-top: 8px; }
}
.tool-status { text-align: center; gap: 12px; padding: 24px; }
.tool-status button { border: 1px solid var(--input-border); border-radius: 9px; background: var(--surface); color: var(--accent-text); padding: 10px 18px; }
.tool-status[hidden] { display: none; }
.tool-error-card { width: min(420px, 100%); padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--text); }
.tool-error-card h2 { font-size: 20px; line-height: 1.4; font-weight: 550; margin: 0 0 12px; }
.tool-error-card p { font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.tool-error-card .tool-error-hint { color: var(--muted); font-size: 13px; }
.tool-error-card button { min-height: 44px; max-width: 100%; }
.tool-error-card button:disabled { opacity: .55; }
.tool-status:has(.tool-error-card) { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; }
.tool-error-card { flex-shrink: 0; margin: auto 0; }
@media (max-height: 500px) {
    .tool-status:has(.tool-error-card) { padding: 12px; }
    .tool-error-card { padding: 16px; }
    .tool-error-card h2 { font-size: 18px; margin-bottom: 8px; }
    .tool-error-card p { margin-bottom: 10px; }
}
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    .workspace-top { gap: 10px; padding: 0 14px; }
    .workspace-heading { min-width: 0; flex: 1; }
    .workspace-heading p { max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .theme-toggle { width: 34px; height: 34px; }
    .mobile-menu::before { background: linear-gradient(to bottom, var(--accent-text) 0 2px, transparent 2px 6px, var(--accent-text) 6px 8px, transparent 8px 12px, var(--accent-text) 12px 14px); }
    .tool-toolbar { padding: 8px 14px; }
}
.utility-item { width: 100%; }
.utility-item.selected { color: var(--selection-text); background: var(--selected); }
.utility-item.selected .utility-icon { color: inherit; }
.utility-icon { width: 22px; height: 22px; flex: none; color: var(--muted); }
.tool-mark.support-mark { background: var(--soft) !important; color: var(--accent-text); padding: 8px; }
.support-mark svg { width: 100%; height: 100%; }
.unread-badge { margin-left: auto; padding: 3px 7px; border-radius: 20px; background: var(--accent); color: white; font-size: 11px; }
.unread-badge { flex: none; }
.nav-item > span:nth-child(2) { min-width: 0; }
.results-dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); }
.results-dialog::backdrop { background: rgb(0 0 0 / .35); }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.results-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
#results-status { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.results-layout { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 18px; }
#results-list, #result-view { min-width: 0; max-height: 65dvh; overflow: auto; overscroll-behavior: contain; }
.result-row { width: 100%; display: grid; gap: 5px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 7px; padding: 12px 8px; }
.result-row[aria-pressed="true"] { background: var(--selected); }
.result-row strong { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.result-row span, .result-label { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.result-content { display: grid; gap: 12px; padding: 4px; }
.result-content p { margin: 0; }
.result-image { display: block; width: 100%; height: auto; object-fit: contain; background: var(--page); border-radius: 10px; }
.result-preview { aspect-ratio: 1 / 1; background: var(--page); border-radius: 10px; overflow: hidden; }
.result-preview .result-image { width: 100%; height: 100%; object-fit: cover; filter: blur(7px); }
.result-audio { width: 100%; min-width: 0; }
.result-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.result-action { width: fit-content; max-width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--accent-text); background: var(--surface); font-size: 14px; text-decoration: none; }
.result-meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.result-meter span { display: block; height: 100%; background: var(--accent); }
@media (max-width: 540px) {
    .results-dialog { padding: 12px; }
    .results-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    #results-list { max-height: 24dvh; }
    #result-view { max-height: 45dvh; }
    .result-action, .result-row { min-height: 44px; }
}
.library-label { margin-top: 0; }
.recent-row { display: flex; min-width: 0; align-items: center; border-radius: 9px; }
.recent-row .recent-chat { flex: 1; min-width: 0; }
.recent-actions { display: none; flex: none; gap: 2px; }
.history-panel.is-managing .recent-actions { display: flex; }
.recent-actions button { width: 28px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 7px; }
.recent-actions button:hover { color: var(--accent-text); background: var(--hover); }
.recent-actions svg { width: 15px; height: 15px; }
.model-bar { position: relative; z-index: 8; flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 28px; min-height: 50px; border-bottom: 1px solid var(--line); background: var(--surface); }
.model-picker { position: relative; flex: none; }
.model-button, .library-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--accent-text); background: var(--soft); white-space: nowrap; }
.model-button:hover, .library-button:hover, .model-button[aria-expanded="true"], .library-button[aria-expanded="true"] { border-color: var(--accent-text); background: var(--soft); }
.model-button b { font-weight: 550; }
.model-button svg, .library-button svg { flex: none; width: 16px; height: 16px; color: var(--muted); }
.model-caption { color: var(--muted); font-size: 11px; }
.model-menu { position: absolute; top: calc(100% + 8px); left: 0; width: 272px; max-width: calc(100vw - 32px); padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 38px #0c243322; }
.model-option-button { width: 100%; position: relative; padding: 12px 34px 12px 12px; border: 0; border-radius: 9px; text-align: left; background: transparent; color: var(--text); }
.model-option-button:hover, .model-option-button[aria-pressed="true"] { background: var(--soft); }
.model-option-button b { display: block; font-size: 13px; font-weight: 550; }
.model-option-button small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.model-option-button[aria-pressed="true"]::after { content: ''; position: absolute; top: 22px; right: 15px; width: 9px; height: 5px; border-left: 1.8px solid var(--accent-text); border-bottom: 1.8px solid var(--accent-text); transform: rotate(-45deg); }
.model-status { flex: 1; margin: 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.context-link { border: 0; padding: 8px 0; border-radius: 6px; background: transparent; color: var(--accent-text); font-size: 12px; }
.context-link:hover { text-decoration: underline; }
.library-picker { position: relative; flex: none; margin-left: auto; }
.library-chevron { width: 6px; height: 6px; margin: -3px 2px 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.library-button[aria-expanded="true"] .library-chevron { transform: rotate(225deg); margin-top: 3px; }
.chat-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(340px, calc(100vw - 28px)); max-height: min(440px, calc(var(--mobile-height, 100dvh) - 160px)); display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 10px 38px var(--bubble-shadow); }
#chat-menu-search { width: 100%; flex: none; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--text); font-size: 14px; }
.chat-menu-list { display: grid; align-content: start; gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-menu-status { margin: 0; font-size: 13px; padding: 4px; color: var(--muted); line-height: 1.5; }
.chat-menu .recent-chat { min-height: 44px; padding: 10px 11px; border: 1px solid var(--line); border-color: color-mix(in srgb, var(--line) 60%, transparent); background: var(--soft); }
.chat-menu .recent-chat:hover { background: var(--hover); }
.chat-menu .recent-chat:focus-visible { outline-offset: -3px; }
.chat-menu .recent-chat b { white-space: normal; overflow-wrap: anywhere; }
.chat-menu .recent-chat small { font-size: 11px; }
.chat-menu-refresh { flex: none; border: 0; padding: 7px; border-radius: 7px; background: transparent; color: var(--accent-text); font-size: 12px; }
.chat-menu-refresh:hover { background: var(--soft); }
.chat-menu-refresh:disabled { opacity: .5; }
@media (pointer:coarse) {
    .library-button, .chat-menu .recent-chat, .chat-menu-refresh { min-height: 44px; }
    #chat-menu-search { font-size: 16px; }
}
#tool-library, #chat-clear-button { flex: none; }
#chat-clear-button { display: flex; align-items: center; gap: 6px; }
#chat-clear-button svg { width: 17px; height: 17px; }
.calm-dialog { width: min(420px, calc(100vw - 32px)); padding: 30px 24px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 18px 70px #07132033; }
.calm-dialog::backdrop { background: #243b5055; backdrop-filter: blur(5px); }
.calm-dialog h2 { font-size: 20px; font-weight: 550; margin: 0 30px 12px 0; }
.calm-dialog p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.calm-dialog input { width: 100%; padding: 12px; color: var(--text); background: var(--page); border: 1px solid var(--input-border); border-radius: 9px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.primary-button, .secondary-button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 15px; background: var(--soft); color: var(--accent-text); font-size: 13px; }
.primary-button { border-color: transparent; background: var(--accent); color: white; }
.action-error { min-height: 18px; }
.support-view { width: 100%; min-width: 0; height: 100%; display: flex; flex-direction: column; position: relative; }
.support-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px max(18px, calc((100% - 880px) / 2)); scrollbar-width: thin; }
#support-list { display: flex; flex-direction: column; gap: 16px; }
.support-history-actions { text-align: center; margin-bottom: 12px; }
.support-empty { max-width: 360px; margin: 12vh auto 30px; text-align: center; }
.support-empty h2 { font-size: 27px; font-weight: 550; }
.support-empty p { font-size: 14px; color: var(--muted); line-height: 1.65; }
.support-message { display: flex; flex-direction: column; align-items: flex-start; width: min(100%, 860px); margin: 0 auto; }
.support-message.user { align-items: flex-end; }
.support-bubble { max-width: min(85%, 720px); padding: 10px 14px; background: var(--bubble-in); border: 0; color: var(--text); border-radius: 12px 12px 12px 4px; box-shadow: 0 1px 2px var(--bubble-shadow); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.support-message.user .support-bubble { background: var(--bubble-out); color: var(--bubble-out-text); border-radius: 12px 12px 4px 12px; }
.support-message.admin .support-bubble { max-width: min(85%, 720px); }
.support-day { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.support-day::before, .support-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.support-message-actions { display: flex; align-items: center; gap: 8px; min-height: 32px; margin-top: 4px; }
.support-copy { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; opacity: 0; transition: opacity .15s; }
.support-copy svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.support-message:hover .support-copy, .support-message:focus-within .support-copy, .support-copy[data-state="done"], .support-copy[data-state="error"] { opacity: 1; }
.support-copy:hover { color: var(--accent-text); background: var(--selected); }
.support-message-text a { color: var(--accent-text); text-underline-offset: 3px; }
.support-message-text { white-space: pre-wrap; }
.support-time { font-size: 11px; color: var(--muted); margin-top: 5px; }
.support-file-link { display: block; color: var(--accent-text); padding-top: 6px; font-size: 13px; }
.support-media { display: block; max-width: 100%; max-height: 250px; border-radius: 8px; margin: 5px 0; }
.support-quote { display: block; margin: 0 0 8px; padding: 5px 10px; border-left: 2px solid var(--accent); font-size: 12px; color: var(--muted); }
.support-composer { width: min(924px, 100%); padding: 16px 22px; border-top: 1px solid var(--line); }
.support-status { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.support-status:has(#support-status-text:empty):not(:has(button:not([hidden]))) { display: none; }
.support-file { display: flex; align-items: center; gap: 12px; padding: 9px 13px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 9px; font-size: 13px; }
.support-file span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.support-file button { border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.support-jump { position: absolute; right: 20px; bottom: calc(var(--support-composer-height, 105px) + 14px); width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent-text); box-shadow: 0 3px 12px #07132018; }
.support-jump svg { width: 19px; height: 19px; }
button:disabled { cursor: default; }
button, .navigation a, .nav-label, .workspace-heading, .tool-toolbar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
button, a { touch-action: manipulation; }
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    .model-bar { padding: 9px 14px; gap: 10px; flex-wrap: wrap; }
    .model-caption { display: none; }
    .model-status { min-width: 20px; }
    #chat-clear-button span { display: none; }
    #chat-clear-button { width: 24px; height: 32px; justify-content: center; }
    #model-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .support-messages { padding: 15px 12px; }
    .support-bubble { max-width: 95%; padding: 11px 13px; font-size: 15px; }
    .support-composer { padding: 12px; }
    .support-copy { width: 44px; height: 44px; opacity: 1; }
    .support-message-actions { min-height: 44px; }
    .support-composer .composer-note { font-size: 10px; }
}
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    html { overflow: hidden; }
    body { position: fixed; top: var(--mobile-top, 0px); left: 0; width: 100%; height: var(--mobile-height, 100dvh); }
    .navigation { bottom: auto; top: var(--mobile-top, 0px); height: var(--mobile-height, 100dvh); padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); padding-left: max(13px, env(safe-area-inset-left)); }
    .navigation.is-dragging { transition: none; }
    .navigation-content, .recent-list, .conversation, .support-messages { -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
    .workspace-top { height: calc(68px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
    .mobile-menu, .theme-toggle, .attachment-button, .dialog-close, .support-jump, .support-copy { width: 44px; height: 44px; flex: none; }
    .support-copy { opacity: 1; }
    .support-message-actions { min-height: 44px; }
    #history-search, .calm-dialog input { font-size: 16px; }
    .utility-item, .new-chat, .recent-chat, .history-actions button, .context-link, .model-button, .primary-button, .secondary-button { min-height: 44px; }
    .recent-actions button { width: 44px; height: 44px; }
    #chat-clear-button { width: 44px; height: 44px; }
    .workspace-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .workspace-heading p { max-width: 100%; }
    .model-bar { gap: 8px; padding-top: 6px; padding-bottom: 6px; }
    .model-bar, .tool-toolbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
    .conversation { margin-left: env(safe-area-inset-left); margin-right: env(safe-area-inset-right); }
    .model-status:empty { display: none; }
    #tool-library { margin-left: auto; }
    .model-menu { max-height: min(320px, calc(var(--mobile-height, 100dvh) - 145px)); overflow-y: auto; overscroll-behavior: contain; }
    #model-name { max-width: min(170px, calc(100vw - 178px)); }
    .composer-area { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .support-composer { padding-left: 12px; padding-right: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .composer textarea { min-height: 44px; }
    .calm-dialog { max-height: calc(var(--mobile-height, 100dvh) - 24px); overflow-y: auto; }
    .calm-dialog { inset: calc(var(--mobile-top, 0px) + env(safe-area-inset-top) + 12px) 0 auto; margin: 0 auto; max-height: calc(var(--mobile-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px); }
    .dialog-actions { flex-wrap: wrap; }
}
@media (max-height:440px) and (max-width:720px), (max-height:440px) and (pointer:coarse) {
    .workspace-top { height: calc(56px + env(safe-area-inset-top)); }
    .workspace-heading p, .composer-note { display: none; }
    .welcome { padding-top: 18px; padding-bottom: 18px; }
    .tool-toolbar { padding-top: 5px; padding-bottom: 5px; }
    .composer-area { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}

/* Telegram: flat chrome, separate chat background and incoming/outgoing bubbles. */
.workspace, .conversation, .support-view { background: var(--chat-bg); }
.conversation, .support-view { background-image: radial-gradient(circle, var(--chat-dot) .8px, transparent 1px); background-size: 24px 24px; }
.workspace-top { height: 64px; }
.navigation { padding-top: 18px; }
.nav-item { border-radius: 8px; }
.tool-nav { gap: 2px; }
.theme-toggle { border: 0; background: transparent; color: var(--muted); }
.theme-toggle:hover { background: var(--hover); }
.new-chat { background: var(--action); border-color: transparent; color: white; }
.new-chat:hover { filter: brightness(1.08); }
.account-row { border-color: transparent; background: var(--rail); }
.avatar { background: var(--accent); color: white; }
.welcome-description { color: var(--text); }
.suggestion { border: 0; box-shadow: 0 1px 2px var(--bubble-shadow); }
.composer-area { width: 100%; background: var(--surface); border-top: 1px solid var(--line); padding-top: 10px; padding-bottom: 12px; }
.composer { max-width: 880px; margin: 0 auto; border-radius: 12px; box-shadow: none; border-color: transparent; }
.composer:focus-within { border-color: var(--accent); }
.composer-note { margin-top: 6px; }
.support-composer { width: 100%; margin: 0; background: var(--surface); }
.support-file { max-width: 880px; margin-left: auto; margin-right: auto; }
.primary-button { background: var(--action); }
.support-copy:hover { background: var(--soft); }
.support-message.admin .support-bubble { max-width: min(92%, 780px); }
.support-message-actions { padding: 0 8px; }
.nav-item.selected, .utility-item.selected, .recent-chat[aria-current="true"], .result-row[aria-pressed="true"] { background: var(--soft); color: var(--text); box-shadow: inset 3px 0 var(--accent); }
.nav-item.selected small, .recent-chat[aria-current="true"] small { color: var(--muted); }
.chat-menu .recent-chat[aria-current="true"] { border-color: transparent; background: var(--selected); background: color-mix(in srgb, var(--selected) 70%, var(--accent)); color: var(--selection-text); box-shadow: none; }
#history-panel .recent-chat[aria-current="true"] { border-color: transparent; background: var(--selected); background: color-mix(in srgb, var(--selected) 70%, var(--accent)); color: var(--selection-text); box-shadow: none; }
#history-button { background: var(--soft); border: 1px solid var(--line); border-color: color-mix(in srgb, var(--line) 60%, transparent); border-radius: 9px; box-shadow: none; }
html body #navigation .recent-chat[aria-current="true"], html body .chat-menu .recent-chat[aria-current="true"] { background: var(--selected) !important; background: color-mix(in srgb, var(--selected) 70%, var(--accent)) !important; color: var(--selection-text) !important; border-color: transparent !important; box-shadow: none !important; }
html body #navigation #history-button { background: var(--soft) !important; border: 1px solid var(--line); border-color: color-mix(in srgb, var(--line) 60%, transparent); box-shadow: none !important; }
.model-status:empty { display: none; }
#navigation { --menu-width: min(204px, 100%); width: 236px; }
html body #navigation { background: var(--rail) !important; }
@media (max-width: 1000px) {
    #navigation { width: 212px; }
}
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    #navigation { width: min(248px, calc(100vw - 70px)); }
}
#navigation .brand { margin: 0 0 18px; padding-inline: 10px; }
#navigation .navigation-content { padding: 4px; margin: -4px; }
#navigation .navigation-bottom { padding-top: 10px; border-top: 1px solid var(--line); }
#navigation .original-link { margin-top: 10px; }
#navigation .nav-divider { width: var(--menu-width); margin: 9px auto 12px; }
#navigation .avatar { width: 32px; height: 32px; flex: none; }
html body #navigation :is(.tool-nav > .nav-item, .utility-item, .new-chat, .account-row) {
    width: var(--menu-width);
    margin-inline: auto;
    min-height: 44px;
    padding: 6px 10px;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent !important;
    box-shadow: none !important;
}
html body #navigation :is(.nav-item, .utility-item, .account-row):hover {
    background: var(--hover) !important;
}
html body #navigation :is(.nav-item.selected, .utility-item.selected, #history-button[aria-expanded="true"]) {
    background: var(--selected) !important;
    color: var(--selection-text) !important;
}
html body #navigation .new-chat { background: var(--soft) !important; color: var(--accent-text) !important; }
html body #navigation .new-chat:hover { background: var(--hover) !important; }
#navigation .tool-mark { width: 30px; height: 30px; }
#navigation :is(.new-chat > span, .utility-icon) { width: 30px; }
#navigation .utility-icon { height: 20px; }
#navigation .nav-item small, #navigation .account-row small { margin-top: 2px; }
#navigation .nav-label { width: var(--menu-width); margin: 14px auto 4px; padding-inline: 10px; font-weight: 600; }
#navigation .nav-label.library-label { margin-top: 0; }
#navigation .tool-nav { grid-template-columns: minmax(0, 1fr); gap: 2px; }
#navigation .utility-item { margin-top: 2px; }
#navigation .history-panel { max-width: 204px; margin-inline: auto; }
#navigation .history-actions button { min-height: 44px; font-size: 12px; text-align: left; }
.nav-shade:not([hidden]) { backdrop-filter: none; }
html body :is(.model-bar .model-button, .model-bar .library-button, .welcome .suggestion) { background: var(--surface) !important; }
html body :is(.model-bar .model-button, .model-bar .library-button, .welcome .suggestion):hover,
html body .model-bar :is(.model-button, .library-button)[aria-expanded="true"] {
    background: var(--selected) !important;
    color: var(--selection-text) !important;
}
html body .conversation:has(#embedded-tool:not([hidden])) { background: var(--page) !important; }
.suggestion { padding: 14px 16px; min-height: 72px; }
html body .composer-area .composer {
    gap: 5px;
    padding: 4px 6px;
    min-height: 52px;
    border-radius: 18px;
    background: var(--soft) !important;
}
html body .composer-area .composer:focus-within { border-color: var(--accent); }
html body .composer :is(#prompt, #support-input) {
    min-width: 0;
    min-height: 40px;
    line-height: 24px;
    padding: 8px 3px;
    background: transparent !important;
}
.model-button { min-width: 0; }
.model-button svg { flex: none; }
.tool-toolbar { padding-top: 4px; padding-bottom: 4px; }
.tool-toolbar span:empty { display: none; }
@media (forced-colors: active) {
    #navigation :is(.nav-item.selected, .utility-item.selected, #history-button[aria-expanded="true"]):not(:focus-visible) { outline: 1px solid Highlight; outline-offset: -2px; }
    .send-button:not(:focus-visible) { outline: 1px solid ButtonText; outline-offset: -5px; }
}
@media (max-width:720px), (max-height:500px) and (pointer:coarse) {
    .workspace-top { height: calc(60px + env(safe-area-inset-top)); }
    .navigation { padding-top: calc(16px + env(safe-area-inset-top)); }
    .composer-area { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .support-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .model-bar { gap: 6px; padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); }
    .model-picker { flex: 1; min-width: 0; }
    .model-button { width: 100%; gap: 5px; padding-left: 8px; padding-right: 8px; }
    #model-name { flex: 1; min-width: 0; max-width: none; text-align: left; }
    .library-button { padding-left: 9px; padding-right: 9px; gap: 5px; }
    .model-status:not(:empty), #results-button { flex-basis: 100%; }
    .tool-toolbar { padding-left: 12px; padding-right: 12px; }
}
@media (max-height:440px) and (max-width:720px), (max-height:440px) and (pointer:coarse) {
    .workspace-top { height: calc(56px + env(safe-area-inset-top)); }
    .composer-area { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}
