:root[data-theme="sky"]{--accent:#426c85;--soft:#e8f1f5;--ink:#304651;--canvas:#eff3f6}
:root[data-theme="peach"]{--accent:#986450;--soft:#f6eae4;--ink:#58463d;--canvas:#f6f0eb}
[hidden]{display:none!important}dialog{width:min(640px,calc(100vw - 32px));max-height:90dvh;overflow:auto;border:1px solid var(--line);border-radius:18px;padding:24px;color:var(--ink);background:#fcfdfb}dialog::backdrop{background:#18362b66}dialog h3{font-size:15px;margin:22px 0 10px}dialog label{display:block;font-size:12px;line-height:1.6;margin:10px 0}dialog input,dialog textarea,dialog select{display:block;width:100%;border:1px solid #bac8bc;border-radius:7px;padding:9px;color:var(--ink);background:white;font:inherit;min-height:44px}dialog form{margin:14px 0}dialog button{margin:4px 4px 4px 0}dialog p{font-size:12px;line-height:1.8;overflow-wrap:anywhere}dialog details{margin:16px 0;font-size:12px}dialog summary{cursor:pointer;padding:10px 0}dialog section{border-top:1px solid var(--line);margin-top:20px}dialog a{color:var(--accent)}.work-shortcuts{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}.work-shortcuts button{font-size:11px;padding:8px 10px}#voice-button[aria-pressed="true"]{color:white;background:#a54141}#source-results button{display:block;width:100%;text-align:left;margin:8px 0}.library-header{gap:12px}.top-meta{gap:10px}#account-button{max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#usage-note{font-size:10px;color:var(--muted)}#auth-status,#settings-status,#google-status,#source-status{color:var(--accent)}#version-list button{display:block;width:100%;text-align:left;margin:6px 0}.draft-tools{gap:6px}.conversation{min-height:0}.composer-area{max-height:70dvh;overflow:auto}.messages{min-height:100px}
@media(max-width:700px){.topbar{padding:0 12px;gap:8px}.top-meta{gap:6px}#account-button{max-width:130px;font-size:10px;padding:7px}.brand-note{display:none}.composer-area{max-height:520px}.conversation{height:850px}.work-shortcuts{gap:4px}dialog{padding:18px}}
main{grid-template-rows:minmax(0,1fr)}.document-space,.paper-scroll{min-height:0}
@media(max-width:700px){.document-space{min-height:900px}}

/* Keep the desktop workspace inside the window; only its contents scroll. */
@media screen and (min-width:701px){
 html,body{height:100%;overflow:hidden}
 body{height:100dvh;display:flex;flex-direction:column}
 .topbar{height:64px;flex:0 0 64px;padding:0 24px}
 main{flex:1 1 0;height:auto;min-height:0;overflow:hidden}
 .conversation,.document-space{overflow:hidden}
 .section-heading{padding:16px 22px 12px;flex-shrink:0}
 .messages{min-height:0;flex:1 1 0;overscroll-behavior:contain}
 .composer-area{flex:0 0 auto;max-height:65%;padding:10px 18px;overscroll-behavior:contain}
 .composer-area .fineprint{margin-top:7px}
 .suggestions{gap:5px;margin-bottom:8px}
 .composer-area .work-shortcuts{margin:6px 0}
 .document-space > :not(.paper-scroll){flex-shrink:0}
 .document-toolbar{padding:16px 22px 12px}
 .draft-tools{padding:4px 0;position:relative}
 .optional-exports{position:static}
 .optional-exports[open]{display:block}
 .extra-document-tools{position:absolute;right:0;top:calc(100% + 6px);z-index:5;display:grid;gap:6px;width:min(340px,calc(100vw - 40px));max-height:55dvh;overflow:auto;padding:12px;border:1px solid var(--line);border-radius:12px;background:#fff;box-shadow:0 6px 24px #263d3026}
 .extra-document-tools button{margin:0;min-height:44px}
 .extra-document-tools label{margin:0}
 .paper-scroll{flex:1 1 0;overscroll-behavior:contain}
 .document-footer{padding:10px 22px}
 .paper-meta{padding-bottom:8px}
 .welcome{padding:12px 0 18px}
 .welcome img{width:72px;height:72px;margin-bottom:8px}
 .welcome p{margin-top:8px}
}
@media screen and (min-width:701px) and (max-height:800px){
 .topbar{height:56px;flex-basis:56px}
 .section-heading,.document-toolbar{padding-top:10px;padding-bottom:8px}
 .eyebrow{margin-bottom:4px}
 .composer-area{max-height:75%}
 #prompt{min-height:48px;height:54px;max-height:100px}
 .suggestions button{min-height:30px;padding:5px 8px}
 .welcome img{width:52px;height:52px}
}
.letter-fields{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.letter-reference{margin:0 0 16px;padding:14px;background:var(--soft,#edf5ef);border:1px solid var(--line);border-radius:12px}.letter-reference strong{font-size:14px}.letter-reference .work-shortcuts{margin-bottom:4px}.letter-reference #letter-reference-name{margin:8px 0;color:var(--accent);overflow-wrap:anywhere}.letter-reference details{margin:8px 0}.letter-reference pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;font:inherit;line-height:1.7;background:white;border-radius:8px;padding:10px}
.letter-checks{margin:0 20px 8px;font-size:11px;border:1px solid var(--line);border-radius:8px;background:#ffffff80}
.letter-checks summary{padding:8px 10px;cursor:pointer}
.letter-check-content{max-height:130px;overflow:auto;padding:0 12px 10px;line-height:1.7;overscroll-behavior:contain}
.letter-check-content p{margin:6px 0}
.letter-check-content ul{padding-left:20px;margin:6px 0}
@media(max-width:500px){.letter-fields{grid-template-columns:1fr}}
.letter-setting-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:end;margin-bottom:12px}
.letter-setting-row label{margin:0;min-width:0}
.letter-setting-row button{margin-bottom:0}
@media(max-width:500px){.letter-setting-row{grid-template-columns:minmax(0,1fr) auto}.letter-setting-row label:first-child{grid-column:1/-1}}
#template-dialog{width:min(850px,calc(100vw - 32px))}
#template-revision{border-bottom:1px solid var(--line);padding:8px 0 16px;margin-bottom:12px}
#template-instruction{width:100%;resize:vertical}
.template-change{border-left:3px solid var(--accent);padding:0 12px;margin:12px 0}
.template-change p{white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0}
.template-field{border-top:1px solid var(--line);margin-top:4px;padding:4px 0}
.template-field > label{margin:6px 0}
.template-field > label:first-child{display:flex;align-items:center;gap:10px;overflow-wrap:anywhere;font-weight:600}
.template-field input[type="checkbox"]{width:20px;min-height:20px;flex-shrink:0}
.work-file-label{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0}
.work-file-label input{max-width:100%}

label.login-remember{display:flex;align-items:center;gap:10px;line-height:1.5}
.login-remember input[type="checkbox"]{width:20px;min-height:20px;flex-shrink:0;margin:0}

/* Google connection shows the next action before administrator-only details. */
#google-dialog{width:min(660px,calc(100vw - 32px));padding:24px}#google-dialog p,#google-dialog label,#google-dialog details{font-size:14px}#google-dialog h2{font-size:21px}#google-dialog .google-intro{color:var(--muted);margin:8px 0 14px}#google-dialog #google-status{background:#eef5ef;border-radius:10px;padding:12px 14px;font-size:15px;margin:12px 0}#google-dialog .google-step{display:flex;align-items:flex-start;gap:14px;border:1px solid var(--line);border-radius:14px;padding:18px;margin:16px 0;background:white}#google-dialog .google-step>div{min-width:0;flex:1}#google-dialog .google-step h3{font-size:18px;margin:0 0 8px}#google-dialog .google-step p{margin:0 0 12px}#google-dialog .google-step-number{display:grid;place-items:center;flex:0 0 30px;height:30px;border-radius:50%;background:#e2efe7;color:var(--accent);font-weight:700}#google-dialog .google-step button{font-size:14px;min-height:44px}#google-dialog .google-privacy{color:var(--muted);font-size:13px;margin:18px 0}#google-dialog>details{border-top:1px solid var(--line);padding-top:6px}#google-dialog summary{font-size:14px;line-height:1.5}#google-dialog li{margin:10px 0;line-height:1.7}#google-dialog code{overflow-wrap:anywhere;font-size:12px}#google-dialog .fineprint{font-size:12px}#google-dialog .work-shortcuts{gap:8px}#google-dialog .google-step button[data-connect="drive"],#google-setup-open{background:var(--accent);color:white}
