/* A single viewport, comfortable controls, and optional balance details. */
:root{--tw-control:48px;--tw-gap:10px;--tw-control-glass:rgba(245,255,252,.78)}
:root[data-theme=dark]{--tw-control-glass:rgba(27,65,62,.72)}
:root body:not(.welcome-open) .app-shell{gap:8px!important}
:root body .app-shell .topbar{gap:8px;justify-content:space-between;flex-shrink:0}
:root body .topbar .brand{width:clamp(44px,calc(100vw - 276px),104px)!important;min-width:44px;flex:0 0 auto;height:48px!important}
:root body .header-actions{display:flex;align-items:center;gap:4px;flex:0 0 auto;min-width:0}
:root body .header-actions #connection,:root body .header-actions .account-header-label{display:none!important}
:root body .header-actions :is(#account-button,#settings-button,#usage-button,#offline-open,#theme-toggle){display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:0;width:44px!important;min-width:44px!important;max-width:44px;height:48px!important;min-height:48px;padding:3px 0!important;border:1px solid var(--tw-glass-line);border-radius:16px;background:var(--tw-control-glass);color:var(--ink);box-shadow:0 3px 12px rgba(5,80,70,.06);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
:root body .header-actions :is(#account-button,#settings-button)>svg,:root body .header-actions svg{width:24px;height:24px;flex-shrink:0}
:root body .header-actions :is(#theme-toggle,#offline-open,#usage-button)>span{font-size:12px!important;font-weight:600;line-height:1.4!important;white-space:nowrap!important;letter-spacing:0}
:root body #account-button{order:0}:root body #settings-button{order:4}:root body #usage-button{order:2}:root body #offline-open{order:3}:root body #theme-toggle{order:1}
:root body .app-shell main{scroll-padding-block:12px}
:root body .bottom-nav{gap:4px!important;padding-inline:5px!important}
:root body .bottom-nav>button{padding:6px 2px!important;min-height:60px!important;border-radius:16px;line-height:1.45!important}
/* Balance retains its original live account bindings and plan actions. */
:root body #usage-modal{width:min(440px,calc(100vw - 28px));max-height:calc(var(--app-height,100dvh) - 32px);box-sizing:border-box;padding:0;border:1px solid var(--tw-glass-line);border-radius:24px;background:var(--surface);color:var(--ink);overflow:auto;box-shadow:0 24px 70px rgba(0,55,44,.2)}
#usage-modal::backdrop{background:rgba(5,28,25,.42);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
:root body #usage-modal .modal-heading{padding:18px 16px 8px;gap:12px;align-items:center}
:root body #usage-modal h2{font-size:19px;line-height:1.5;margin:0}
:root body #usage-close{flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px}
.usage-body{padding:0 16px 18px}.usage-body>p{font-size:14px;line-height:1.7;color:var(--tw-secondary-ink)}
:root body #usage-modal #quota-bar{display:grid!important;grid-template-columns:1fr;gap:10px;padding:0;border:0;background:transparent;box-shadow:none;min-height:0}
:root body #usage-modal #quota-bar [data-quota]{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:60px;padding:12px 14px;border:1px solid var(--tw-glass-line);border-radius:16px;background:var(--tw-control-glass);font-size:15px!important}
:root body #usage-modal #quota-bar strong{font-size:17px!important}
:root body #usage-modal #quota-upgrade{width:100%;min-height:48px;font-size:15px!important;border-radius:16px;background:var(--tiffany-gradient);color:var(--action-ink);margin-top:4px}
/* Matching heights and breathing room within each action group. */
:root body :is(.clear-action,#writing-phrases,#writing-submit,#writing-listen,#writing-copy,#documents-attach,.documents-result-heading>button,.photo-actions>button,.photo-result-heading>button){min-height:var(--tw-control)!important;height:auto!important;padding:10px 12px!important;line-height:1.5!important;border-radius:16px!important;white-space:normal!important;overflow-wrap:normal;word-break:normal}
:root body :is(.clear-action,#writing-phrases,#writing-copy,.documents-result-heading>button:not(#documents-listen),.photo-result-heading>button){background:var(--tw-control-glass);border:1px solid var(--tw-glass-line)!important;color:var(--ink);box-shadow:0 3px 12px rgba(5,80,70,.06);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
:root body .translator-card .conversation-actions{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;margin-block:8px!important}
:root body .translator-card .conversation-actions :is(#conversation-send,#clear-conversation){min-height:48px!important;padding:10px!important;font-size:14px!important}
:root body .translator-card .mic-controls,:root body .playback-controls .voice-main-actions{gap:10px!important}
:root body .translator-card .mic-button,:root body .playback-controls .voice-main-actions>button{min-height:52px!important;padding:10px!important}
:root body .playback-controls .voice-options :is(#voice-open,.speed-control,#stop-playback){min-height:44px!important;height:44px!important}
:root body #writing .writing-card{padding:12px;gap:8px}
:root body #writing .writing-card #text-form{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:minmax(128px,1fr) auto auto;gap:10px}
:root body #writing-clear{grid-column:1;grid-row:2}:root body #writing-phrases{grid-column:2;grid-row:2}:root body #writing-submit{grid-column:3;grid-row:2}
:root body #writing-count{grid-column:1/-1;grid-row:3;text-align:end}
:root body .writing-result-heading{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;flex:0 0 auto!important;height:auto!important}
:root body .writing-result-heading h3{grid-column:1/-1;margin:0 0 4px}
:root body .writing-result-heading>button{width:100%;margin:0}
:root body .documents-file-bar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;height:auto!important;flex:0 0 auto}
:root body #documents-file-state{grid-column:1/-1}
:root body .documents-result-heading{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:10px!important;flex:0 0 auto!important}
:root body .documents-result-heading h3{grid-column:1/-1;margin:0 0 2px}
:root body .documents-result-heading>button{width:100%;margin:0}
:root body .photo-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px!important;height:auto!important}
:root body .photo-toolbar{gap:10px;padding-block:6px}
/* Chat uses the available screen. Only its transcript scrolls. */
:root body[data-view=assistant]:not(.welcome-open) .app-shell main{flex:1 1 0!important;min-height:0!important;height:auto!important;overflow:hidden!important;padding:0!important}
:root body[data-view=assistant] .workspace{display:flex!important;flex-direction:column;flex:1 1 0!important;min-height:0!important;height:100%!important;overflow:hidden!important}
:root body #assistant.active{display:flex!important;flex-direction:column;flex:1 1 0!important;width:100%;min-height:0!important;height:100%!important;max-height:100%;padding:12px!important;gap:8px;overflow:hidden!important;box-sizing:border-box}
:root body .assistant-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) 76px;gap:8px 12px;flex:0 0 auto!important;min-height:0;padding:0 0 8px;align-items:center}
:root body .assistant-brand{grid-column:1;grid-row:1;gap:8px;min-width:0}
:root body #assistant-clear{grid-column:2;grid-row:1;min-width:0!important;width:100%;min-height:48px!important}
:root body .assistant-toolbar>label{grid-column:1/-1;grid-row:2;display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;min-width:0}
:root body .assistant-toolbar>label>span{white-space:nowrap}
:root body .assistant-toolbar .language-picker-button{width:100%;min-height:48px!important;margin:0}
:root body #assistant-language-help{margin:0!important;padding:0 2px!important;flex:0 0 auto;max-height:none!important;font-size:14px!important;line-height:1.5!important}
:root body #assistant-messages{flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;overflow-x:hidden;overflow-y:auto!important;padding:8px 2px!important;gap:10px;scroll-padding-block:10px;overscroll-behavior:contain}
:root body .assistant-empty{flex:0 0 auto;margin:auto;padding:8px 4px;gap:8px}
:root body .assistant-empty>img{width:52px;height:52px;margin:0}
:root body .assistant-empty h3{font-size:20px;line-height:1.5}
:root body .assistant-empty>p{font-size:14px;line-height:1.6;margin:0}
:root body .assistant-examples{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:6px}
:root body .assistant-examples>button{height:auto;min-height:48px;padding:10px;text-align:center;line-height:1.5}
:root body #assistant-status{max-height:48px!important;margin:0!important;padding:0!important;flex:0 0 auto}
:root body #assistant-status.is-idle{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;min-height:0!important}
:root body #assistant-form{display:grid!important;grid-template-columns:48px 48px minmax(0,1fr) 48px;grid-template-rows:minmax(56px,auto) 48px;gap:8px;flex:0 0 auto!important;min-height:0!important;height:auto!important;padding:10px 0 0!important;margin:0!important;border-top:1px solid var(--line)}
:root body #assistant-input{grid-column:1/-1;grid-row:1;height:56px!important;min-height:56px!important;max-height:112px;padding:12px 14px!important;line-height:1.65!important}
:root body #assistant-form :is(#assistant-attach,#assistant-mic,#assistant-send){width:48px!important;height:48px!important;min-width:48px!important;min-height:48px!important;padding:10px!important;margin:0!important;border-radius:16px;box-sizing:border-box}
:root body #assistant-attach{grid-column:1;grid-row:2}:root body #assistant-mic{grid-column:2;grid-row:2}:root body #assistant-send{grid-column:4;grid-row:2}
:root body .assistant-composer-hint{grid-column:3;grid-row:2;font-size:13px!important;line-height:1.5!important;text-align:center}
/* Currency controls fit normally and scroll as a whole on very short screens. */
:root body #currency.active{display:flex;flex-direction:column;flex:1 0 auto;min-height:100%!important;height:auto!important;overflow:visible}
:root body[data-view=currency] .calculator-card{display:flex;flex-direction:column;flex:1 0 auto!important;min-height:0!important;height:auto!important;overflow:visible!important;gap:8px!important;padding:12px!important}
:root body[data-view=currency] .currency-row{display:flex;flex:0 0 auto!important;min-height:64px!important;height:auto!important;padding:4px!important;gap:12px}
:root body[data-view=currency] .amount-block{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px!important;flex:1;min-width:0}
:root body[data-view=currency] .amount-block>small:first-child{grid-column:1/-1;grid-row:1}
:root body[data-view=currency] .amount-block>.amount{grid-column:1;grid-row:2;font-size:28px!important;line-height:1.2!important;min-width:0;overflow-wrap:anywhere}
:root body[data-view=currency] .amount-block>small:last-child{display:block!important;position:static!important;grid-column:2;grid-row:2;align-self:end;font-size:13px!important;line-height:1.5!important}
:root body[data-view=currency] .row-divider{flex:0 0 8px!important;min-height:8px;height:8px;margin:0}
:root body[data-view=currency] .keypad{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(5,minmax(44px,1fr));flex:1 0 252px!important;min-height:252px!important;gap:8px!important;margin:0}
:root body[data-view=currency] .keypad>button{width:100%;min-width:0;min-height:44px!important;height:auto!important;padding:8px!important;border-radius:16px;font-size:24px!important}
:root body .rate-footer{display:grid!important;grid-template-columns:44px minmax(0,1fr) 6px;align-items:center;gap:10px;flex:0 0 auto;min-height:52px;height:auto!important;padding:8px 0 0!important;margin:0!important}
:root body .rate-footer>div{display:flex;flex-direction:column;gap:4px;min-width:0;text-align:center;line-height:1.5}
:root body #rate-label,:root body #rate-status{position:static!important;white-space:normal!important;overflow-wrap:anywhere;line-height:1.5!important;max-height:none!important}
:root body .rate-footer #refresh-rates{width:44px;height:44px;min-width:44px;min-height:44px;position:static;margin:0}
/* Keep a usable composer when Safari's keyboard shrinks the viewport. */
:root[data-viewport-keyboard=true] #assistant.active{padding:8px!important;gap:6px}
:root[data-viewport-keyboard=true] .assistant-toolbar{display:none!important}
:root[data-viewport-keyboard=true] #assistant-language-help,:root[data-viewport-keyboard=true] .assistant-empty>img{display:none!important}
@media(min-width:900px){:root body .header-actions{gap:8px}:root body .documents-result-heading{grid-template-columns:repeat(4,minmax(0,1fr))}}
/* Preserve a chat transcript in landscape and compact-height windows. */
@media(max-height:500px){
 :root body .assistant-toolbar{grid-template-columns:minmax(0,1fr) 76px;gap:8px;padding-bottom:4px}
 :root body .assistant-brand{display:none}
 :root body .assistant-toolbar>label{grid-column:1;grid-row:1}
 :root body .assistant-toolbar>label>span,:root body #assistant-language-help,:root body .assistant-empty>img{display:none!important}
 :root body #assistant.active{padding:8px!important;gap:6px}
}
@media(max-height:500px) and (min-width:600px){
 :root body #assistant-form{grid-template-columns:minmax(0,1fr) repeat(3,48px);grid-template-rows:56px;padding-top:6px!important}
 :root body #assistant-input{grid-column:1;grid-row:1}
 :root body #assistant-attach{grid-column:2;grid-row:1}:root body #assistant-mic{grid-column:3;grid-row:1}:root body #assistant-send{grid-column:4;grid-row:1}
 :root body .assistant-composer-hint{display:none}
}
:root body[data-view=currency] .calculator-card{gap:6px!important;padding:10px!important}
:root body[data-view=currency] .keypad{flex-basis:244px!important;min-height:244px!important;gap:6px!important}
:root body[data-view=currency] .row-divider{height:4px!important;min-height:4px!important;flex-basis:4px!important}
/* Adapt to the actual tool area after browser chrome and native safe areas. */
:root body[data-view=assistant] .app-shell main{container-type:size;container-name:assistant-space}
@container assistant-space (max-height:440px){
 :root body .assistant-toolbar{grid-template-columns:minmax(0,1fr) 76px;gap:8px;padding-bottom:4px}
 :root body .assistant-brand{display:none}
 :root body .assistant-toolbar>label{grid-column:1;grid-row:1;display:flex!important;flex-direction:column;align-items:stretch;gap:4px}
 :root body .assistant-toolbar>label>span{display:block!important;font-size:14px!important}
 :root body #assistant-clear{grid-column:2;grid-row:1;align-self:end}
 :root body #assistant-language-help{display:none!important}
 :root body .assistant-empty>img{display:none!important}
}
/* Put both currency summaries beside each other when vertical space is limited. */
:root body[data-view=currency] .app-shell main{container-type:size;container-name:currency-space}
@container currency-space (max-height:520px){
 :root body[data-view=currency] .calculator-card{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:auto minmax(244px,1fr) auto;gap:8px!important}
 :root body[data-view=currency] .currency-row{grid-column:1;grid-row:1;min-width:0;gap:6px;padding:6px!important;border:1px solid var(--tw-glass-line);border-radius:16px;background:var(--tw-control-glass)}
 :root body[data-view=currency] .currency-row.converted{grid-column:2}
 :root body[data-view=currency] .currency-choice{width:44px;min-width:44px;padding:4px;gap:2px}
 :root body[data-view=currency] .amount-block{display:flex!important;flex-direction:column;gap:2px!important}
 :root body[data-view=currency] .amount-block>.amount{font-size:24px!important}
 :root body[data-view=currency] .amount-block>small:last-child{align-self:auto;font-size:13px!important}
 :root body[data-view=currency] .row-divider{display:none}
 :root body[data-view=currency] .keypad{grid-column:1/-1;grid-row:2}
 :root body[data-view=currency] .rate-footer{grid-column:1/-1;grid-row:3}
}
