/* Тот же kit и палитра; переписка занимает доступную высоту экрана. */
[hidden]{display:none!important}
#chat-form{display:flex!important}
#chat-status{display:block!important;min-height:0;margin:0}
#chat-status:empty{display:none!important}
#chat .screen-content{min-height:0}
#chat .heading{margin-bottom:8px}
#chat .heading h1{font-size:24px}
#chat .role-button{min-height:64px;padding-top:6px;padding-bottom:6px}
#chat .role-button img{width:48px;height:48px}
#chat .chat-tools{min-height:44px;justify-content:space-between}
#chat .conversation{padding:4px 0 12px}
#chat .composer{gap:8px;min-height:56px}
#chat .composer input{min-width:0;min-height:44px;font-size:16px}
#chat .send-button{min-width:48px;min-height:48px;font-size:25px}
#chat .suggestions{margin-bottom:12px}
.assistant-welcome{font-size:14px;line-height:22px;color:var(--muted);padding:12px 6px}
.demo-quota{display:block;font-size:11px;line-height:17px;color:var(--muted);padding:3px 2px 0}
.thinking .chat-message{color:var(--muted)}
.thinking{animation:thinking 1.4s ease-in-out infinite alternate}
@keyframes thinking{to{opacity:.55}}
.test-label{font-size:12px!important;font-weight:650;color:#805329;background:#fff3d9;border-radius:8px;padding:4px 8px;width:max-content;max-width:100%;margin:0 0 8px}
.file-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.file-actions button{min-width:44px;min-height:48px;margin:0;font-size:14px}
dialog.assistant-document{position:fixed;inset:0;margin:0 auto;width:100%;max-width:480px;height:100dvh;max-height:100dvh;border-radius:0;border:0;padding:20px 20px max(20px,env(safe-area-inset-bottom));overflow:auto}
.assistant-document .sheet-head{position:sticky;top:-20px;background:var(--ground);z-index:1;padding:8px 0}
.assistant-document .sheet-head h2{font-size:20px}
.assistant-document .icon-button{min-width:48px;min-height:48px;font-size:26px}
.assistant-document .document-name{font-size:21px;line-height:28px;margin:16px 0 8px;overflow-wrap:anywhere}
.document-draft{font-size:12px;color:var(--accent);font-weight:650}
.document-lines{display:flex;flex-direction:column;gap:10px;margin:20px 0}
.document-line{display:grid;grid-template-columns:1fr;gap:6px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow-wrap:anywhere}
.document-line>strong{font-size:14px;line-height:20px}
.document-line>span{font-size:13px;color:var(--muted)}
.document-line .document-amount{text-align:right;font-size:16px}
.document-total{display:flex;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding:16px 0;font-size:18px}
.document-notes{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:20px;margin:8px 0}
.assistant-document .status-text{line-height:20px;margin:12px 0 20px}
.assistant-document>.primary{min-height:48px}
@media(prefers-reduced-motion:reduce){.thinking{animation:none}}
@media(max-height:700px){#chat .heading{display:none}#chat .role-button{min-height:52px}#chat .role-button img{width:40px;height:40px}}
/* Высота visualViewport учитывает экранную клавиатуру Safari и Chrome. */
html,body{min-width:0;width:100%;height:100%;overflow:hidden}
.tape{position:fixed;top:var(--app-top,0px);left:0;right:0;height:var(--app-height,100dvh)}
.screen{width:100%;min-width:0;min-height:0;height:var(--app-height,100dvh);grid-template-rows:calc(56px + env(safe-area-inset-top)) minmax(0,1fr) calc(68px + env(safe-area-inset-bottom))}
.topbar{padding-top:env(safe-area-inset-top)}
.screen-content{min-width:0;padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
.screen-content>*{min-width:0}
.bottomnav{padding-bottom:max(6px,env(safe-area-inset-bottom))}
button,a,input{touch-action:manipulation}
button,a,.line-copy,.detail-pair>*{min-width:0;overflow-wrap:anywhere}
.line-copy{flex:1}.line-sum{flex-shrink:0;white-space:nowrap}
#chat .composer{padding:4px;gap:8px}
#chat .composer input{width:100%;flex:1;padding:8px 0}
#attach{flex:0 0 44px;min-width:44px;min-height:48px;font-size:22px;border:0;background:transparent;border-radius:12px}
.attachment-status{font-size:12px;line-height:18px;margin:0;color:var(--accent);overflow-wrap:anywhere}
.attachment-pending{display:flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface);max-height:160px;overflow:auto}
.attachment-pending .incoming-file{flex:1;display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:8px;min-width:0}
.attachment-pending .incoming-file:not(:has(img)){display:flex;flex-direction:column}
.attachment-pending .incoming-photo{width:52px;height:60px;grid-row:span 2;object-fit:cover;margin:0}
.incoming-file{display:flex;flex-direction:column;gap:8px;min-width:0;margin-top:8px}
.incoming-name{font-size:14px;overflow-wrap:anywhere}
.incoming-file small{font-size:12px;line-height:18px;color:var(--muted);overflow-wrap:anywhere}
.incoming-photo{display:block;width:100%;max-height:220px;object-fit:contain;border-radius:12px;background:var(--ground)}
.attachment-pending>.icon-button,.attachment-picker .icon-button{min-width:44px;min-height:44px;flex-shrink:0;font-size:24px}
.attachment-picker[open]{display:flex;flex-direction:column;gap:12px;padding-bottom:max(20px,env(safe-area-inset-bottom))}
.attachment-picker .sheet-head{margin:0}.attachment-picker .secondary{width:100%;min-height:48px}
.attachment-picker .subline{line-height:21px;margin:0}
html[data-keyboard=true] #chat{grid-template-rows:minmax(0,1fr)}
html[data-keyboard=true] #chat>.topbar,html[data-keyboard=true] #chat>.bottomnav,html[data-keyboard=true] #chat .heading,html[data-keyboard=true] #chat .role-button,html[data-keyboard=true] #chat .chat-tools,html[data-keyboard=true] #demo-quota{display:none}
@media(max-height:500px){#chat{grid-template-rows:minmax(0,1fr)}#chat>.topbar,#chat>.bottomnav,#chat .role-button,#chat .chat-tools,#chat .heading,#demo-quota{display:none}#chat .screen-content{padding-top:8px;padding-bottom:max(8px,env(safe-area-inset-bottom))}#chat .attachment-status{display:none}}
dialog{max-height:calc(var(--app-height,100dvh) - 16px);overflow-wrap:anywhere}
dialog.assistant-document{height:var(--app-height,100dvh);max-height:var(--app-height,100dvh);padding-top:max(12px,env(safe-area-inset-top))}

#attach{display:grid;place-items:center}
