/* One scrolling conversation, with a persistent composer and optional tool dialogs. */
#workspace[data-view="mate-assistant"] #main-content{overflow:hidden;display:flex;flex-direction:column;background:#faf9fc}
#mate-assistant{flex:1;min-height:0;min-width:0;width:100%;max-width:none;margin:0;display:flex;flex-direction:column}
.ma-heading{flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}
.ma-heading h1{font-size:23px;margin:0 0 4px}.ma-heading p{margin:0;color:var(--secondary);font-size:13px;line-height:1.6}
.ma-heading-actions{display:flex;gap:8px}.ma-heading .button{display:inline-flex;align-items:center;gap:7px;white-space:nowrap;font-size:12px;min-height:36px}
#mate-assistant svg{width:18px;height:18px;flex:none}.ma-heading .ma-history-toggle{display:none}
.ma-layout{flex:1;min-height:0;min-width:0;display:grid;grid-template-columns:230px minmax(0,1fr);gap:18px;position:relative}
.ma-main{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden;margin:0;background:#fff;border-radius:14px}
.ma-conversation{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#d6d3de transparent;scrollbar-gutter:stable;padding:22px 24px}
.ma-conversation:focus-visible{outline:2px solid #b5a3db;outline-offset:-2px}
.ma-messages{max-width:960px;margin:0 auto;min-width:0}
.ma-message{max-width:94%;margin:0 0 22px;min-width:0;overflow-wrap:anywhere}
.ma-message-author{display:block;font-size:12px;font-weight:600;color:var(--secondary);margin-bottom:7px}
.ma-message>p{white-space:pre-wrap;line-height:1.8;margin:0;font-size:14px}
.ma-message.is-user{max-width:85%;margin-left:auto;background:#f1edfb;border-radius:14px 14px 4px 14px;padding:12px 16px}
.ma-message.is-error{padding:12px 16px;border:1px solid #efd1d1;border-radius:12px;background:#fffafa}
.ma-welcome{padding:45px 12px;text-align:center;color:var(--secondary)}.ma-welcome h2{font-size:23px;color:var(--ink);margin:0 0 10px}.ma-welcome p{font-size:13px;line-height:1.8}.ma-welcome>div{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:22px}.ma-welcome .button{font-size:12px}
.ma-preview{border:1px solid var(--line);border-radius:12px;padding:16px;background:#fcfbfe;line-height:1.7;min-width:0;overflow-wrap:anywhere}
.ma-result-heading{display:flex;align-items:flex-start;gap:10px}.ma-result-heading>div{min-width:0}.ma-result-heading h3{font-size:14px;color:var(--ink);font-weight:600;line-height:1.65;margin:3px 0 0}
.ma-result-icon{display:grid;place-items:center;width:30px;height:30px;flex:none;border-radius:9px;background:#eee9fa;color:var(--blue)}
.ma-result-state{font-size:11px;color:var(--blue);font-weight:500}.ma-preview.is-applied{background:#fafdfb;border-color:#dce9df}.is-applied .ma-result-icon{background:#e8f3eb;color:#398258}.is-applied .ma-result-state{color:#398258}
.ma-result-target{display:flex;align-items:baseline;gap:6px 10px;flex-wrap:wrap;background:#fff;border:1px solid var(--line);border-radius:8px;padding:10px 12px;margin-top:13px}.ma-result-target>span,.ma-result-target small{font-size:11px;color:var(--secondary)}.ma-result-target>strong{font-size:13px;font-weight:500;flex:1;min-width:100px}
.ma-preview :is(p,li){font-size:12px;line-height:1.8}.ma-preview p{margin:7px 0}.ma-result-note{color:var(--secondary)}.ma-preview details{margin-top:9px}.ma-preview summary{font-size:12px;color:var(--secondary);cursor:pointer;width:fit-content;max-width:100%;padding:3px 0}
.ma-preview pre{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:12px/1.8 var(--font-body);padding:12px;background:#f4f3f7;border-radius:8px;margin:8px 0;max-height:none;overflow:visible}
.ma-entry{border-top:1px solid var(--line);padding-top:12px;margin-top:12px}.ma-entry>div{display:flex;align-items:center;gap:8px}.ma-entry strong{font-size:13px}.ma-entry .badge{font-size:10px}
.ma-result-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid #e4ece5;margin-top:12px;padding-top:9px;font-size:11px;color:var(--secondary)}.ma-result-footer .button{min-height:30px;padding:3px 6px;font-size:12px}
.ma-candidate{display:grid;gap:7px;margin-top:12px;font-size:12px}.ma-candidate small{color:var(--secondary);font-size:11px}
.ma-composer{flex:none;min-width:0;background:#fff;border-top:1px solid var(--line);padding:12px 16px 10px}
.ma-composer fieldset{border:0;padding:0;margin:0;min-width:0}
.ma-input-box{border:1px solid #dfdce8;border-radius:14px;padding:8px 10px 7px;transition:border-color .15s,box-shadow .15s;background:#fff}
.ma-input-box #ma-prompt{display:block;width:100%;min-width:0;max-width:100%;height:62px;min-height:62px;max-height:120px;border:0;background:transparent;box-shadow:none;outline:none;resize:none;padding:5px 4px;color:var(--ink);font:14px/1.7 var(--font-body)}
.ma-compose-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:10px}.ma-compose-tools{min-width:0;display:flex;align-items:center;gap:4px;flex-wrap:wrap}.ma-compose-tools .icon-button{flex:none;width:34px;height:34px;border-radius:8px;color:var(--secondary)}
.ma-compose-tools label{margin:0;min-width:0;max-width:100%}.ma-compose-tools select{width:auto;max-width:230px;min-width:0;min-height:34px;border:0;border-radius:8px;background-color:transparent;padding:5px 28px 5px 8px;color:var(--secondary);font-size:12px;line-height:1.6;text-overflow:ellipsis;box-shadow:none}.ma-compose-tools select:hover{background-color:#f5f3fa}
.ma-send{flex:none;width:36px;height:36px;border:0;border-radius:50%;background:var(--blue);color:#fff;display:grid;place-items:center}.ma-send:hover:not(:disabled){background:var(--blue-dark)}.ma-send .spinner{border-color:#ffffff55;border-top-color:#fff}
.ma-composer-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:7px;min-height:24px;font-size:10px;color:var(--muted)}.ma-composer-foot>span:last-child{white-space:nowrap}.ma-model-toggle{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:55%;border:0;background:transparent;color:var(--secondary);font:11px/1.6 var(--font-body);padding:2px 4px;text-align:left}.ma-model-toggle span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ma-model-toggle svg{width:14px!important;height:14px!important}
.ma-source-chips{display:flex;gap:6px;flex-wrap:wrap;min-width:0;margin-bottom:8px}.ma-source-chips button{display:flex;align-items:center;gap:5px;min-width:0;max-width:40%;border:1px solid var(--line);border-radius:7px;background:#faf9fc;font-size:11px;color:var(--secondary);padding:4px 7px}.ma-source-chips button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ma-source-chips svg{width:13px!important;height:13px!important}
.ma-composer-status{display:flex;align-items:center;gap:8px;background:#f4f0fc;color:#6b4db0;border-radius:9px;padding:9px 11px;margin-bottom:9px;font-size:12px;line-height:1.6}.ma-composer-status strong{font-weight:500}.ma-composer-status>span:last-child{margin-left:auto;color:var(--secondary);font-size:11px}.ma-compose-error{margin:0 0 8px;font-size:12px;overflow-wrap:anywhere}
.ma-composer-status .ma-stop{margin-left:auto;flex:none;min-height:36px;padding:5px 12px;font-size:12px}
.ma-confirm{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;padding:9px 11px;border-radius:9px;background:#f8f6fc}.ma-confirm>span{font-size:12px;line-height:1.6;color:var(--secondary);min-width:0;overflow-wrap:anywhere}.ma-confirm .button{flex:none;min-height:34px;padding:6px 12px;font-size:12px}
/* History is independent of the main conversation; on phones it opens as a drawer. */
.ma-history{min-width:0;min-height:0;display:flex;flex-direction:column;gap:12px}.ma-history-actions{display:flex;gap:6px;flex:none}.ma-history .ma-new{flex:1;min-width:0;min-height:40px;display:flex;align-items:center;justify-content:center;gap:8px}.ma-history-close,.ma-history-shade{display:none}
.ma-history-panel{flex:1;display:flex;flex-direction:column;min-height:0;padding:16px 8px 8px;min-width:0;margin:0;background:#fff}.ma-history-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 8px 12px;flex:none}.ma-history-heading h2{font-size:13px;margin:0;line-height:1.5}.ma-history-heading>span{font-size:11px;color:var(--secondary);white-space:nowrap}
.ma-history-list{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-gutter:stable}.ma-history-row{display:grid;grid-template-columns:minmax(0,1fr) 36px;align-items:center;border:1px solid transparent;border-radius:9px;margin-bottom:4px}.ma-history-row:hover{background:#faf9fc}.ma-history-row.is-current{background:#f1edfa;border-color:#d8cdec}
.ma-history-row{grid-template-columns:minmax(0,1fr) repeat(3,32px)}.ma-history-row.is-renaming{grid-template-columns:minmax(0,1fr) repeat(2,32px)}.ma-history-heading>div{display:flex;align-items:center;gap:8px;min-width:0}.ma-history-heading>div>span{font-size:11px;color:var(--secondary);white-space:nowrap}.ma-history-heading button{border:0;background:transparent;color:var(--blue);font:inherit;font-size:11px;cursor:pointer;white-space:nowrap;padding:4px}.ma-history-action{display:grid;place-items:center;width:32px;min-height:36px;border:0;border-radius:8px;background:transparent;color:var(--secondary);cursor:pointer}.ma-history-action svg{width:17px;height:17px}.ma-history-action:hover:not(:disabled){background:var(--blue-soft);color:var(--blue)}.ma-history-action:disabled{opacity:.35;cursor:default}.ma-history-title-input{min-width:0;width:100%;padding:7px;border:1px solid var(--blue);border-radius:7px;background:#fff;font:inherit;font-size:12px}
.ma-history-open{border:0;background:transparent;text-align:left;color:var(--ink);font:inherit;min-width:0;width:100%;padding:10px;cursor:pointer;border-radius:8px}.ma-history-title{display:block;font-size:12px;font-weight:550;line-height:1.6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ma-history-open small{display:flex;align-items:center;gap:6px;font-size:10px;line-height:1.6;color:var(--secondary);margin-top:3px}.ma-history-delete{display:grid;place-items:center;width:32px;min-height:36px;border:0;border-radius:8px;background:transparent;color:var(--secondary);cursor:pointer}.ma-history-delete:hover:not(:disabled){background:#fcecec;color:var(--red)}.ma-history-delete:disabled{opacity:.35;cursor:default}.ma-history :is(button):focus-visible{outline:2px solid var(--blue);outline-offset:-2px}
.ma-history-empty{padding:12px 10px 14px;font-size:13px;line-height:1.7}.ma-history-empty p{font-size:12px;color:var(--secondary);margin:5px 0 0}.ma-delete-confirm{grid-column:1/-1;padding:8px 10px 10px;border-top:1px solid var(--line);font-size:12px;line-height:1.6}.ma-delete-confirm>div{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.ma-delete-confirm .button{font-size:12px;min-height:36px;padding:6px 12px}.ma-history-error{font-size:12px;line-height:1.7;margin:8px;overflow-wrap:anywhere}.ma-working-dot{width:6px;height:6px;border-radius:50%;background:var(--blue)}
/* Only an opened tool dialog scrolls; long documents expand in the conversation. */
.ma-tool-dialog{padding:0;width:min(560px,calc(100vw - 28px));max-height:calc(100dvh - 40px);border:1px solid var(--line);border-radius:16px;box-shadow:0 20px 80px #251c4033;color:var(--ink);background:#fff;overflow:hidden}
.ma-tool-dialog[open]{display:flex;flex-direction:column}.ma-tool-dialog::backdrop{background:#201a364d;backdrop-filter:blur(2px)}
.ma-tool-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 20px 12px;flex:none}.ma-tool-head h2{font-size:17px;margin:0}.ma-tool-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 20px 18px;scrollbar-width:thin}.ma-tool-body>label,.ma-path label{display:block;font-size:12px;color:var(--secondary);margin:14px 0 7px}
.ma-tool-body :is(input,textarea,select),.ma-candidate select{font:13px/1.7 var(--font-body);color:var(--ink);width:100%;max-width:100%;min-width:0;box-sizing:border-box;border:1px solid var(--line);border-radius:9px;background:#fff;padding:9px 12px}.ma-tool-body select{padding-right:36px}.ma-tool-body textarea{resize:vertical}.ma-tool-body .field-hint{font-size:11px;line-height:1.8;margin-top:8px}.ma-upload-action{width:100%;border-style:dashed;min-height:48px;gap:8px}
.ma-path,.ma-source-help{margin-top:16px;border-top:1px solid var(--line);padding-top:12px}.ma-path summary,.ma-source-help summary{cursor:pointer;font-size:12px;color:var(--secondary)}.ma-path button{margin-top:10px}.ma-source-help p{font-size:11px;line-height:1.8;color:var(--secondary);margin-top:8px}.ma-files{font-size:12px;line-height:1.8;overflow-wrap:anywhere;padding-left:18px;margin:12px 0 0}.ma-tool-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid var(--line);flex:none}.ma-tool-foot .button{min-height:36px;font-size:12px}
.ma-model-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 10px}.ma-model-heading label{font-size:12px;color:var(--secondary);margin:0}.ma-model-heading button{flex:none;font-size:11px;min-height:32px;padding:4px 8px}
@media(max-width:850px){
  #workspace[data-view="mate-assistant"] #main-content{padding:12px}
  .ma-heading{margin-bottom:12px;gap:8px}.ma-heading h1{font-size:20px;margin:0}.ma-heading p{display:none}.ma-heading .button{min-height:36px;padding:6px 9px}.ma-heading .ma-history-toggle{display:inline-flex}
  .ma-layout{grid-template-columns:minmax(0,1fr);gap:0}.ma-main{border-radius:12px}
  .ma-history{display:none;position:absolute;inset:0 auto 0 0;z-index:8;width:min(330px,calc(100vw - 16px));height:100%;padding:12px;background:#faf9fc;border:1px solid var(--line);border-radius:12px;box-shadow:8px 0 24px #251c4014}.ma-history.is-open{display:flex}.ma-history-close{display:grid;flex:none}.ma-history-shade{display:block;position:absolute;inset:0;z-index:7;border:0;background:#201a3633;border-radius:12px}.ma-history-row{grid-template-columns:minmax(0,1fr) 44px}.ma-history-delete{width:44px;min-height:44px}.ma-history-title{font-size:13px}
  .ma-conversation{padding:16px 12px;scrollbar-gutter:auto}.ma-message{max-width:100%;margin-bottom:18px}.ma-message.is-user{max-width:92%;padding:10px 12px}.ma-message>p{font-size:14px}.ma-welcome{padding:24px 0}.ma-welcome h2{font-size:20px}.ma-welcome>div{gap:7px}.ma-welcome .button{font-size:12px;min-height:40px}
  .ma-preview{padding:12px}.ma-result-target{padding:8px 10px}.ma-result-heading h3{font-size:13px}
  .ma-composer{padding:10px 10px 7px}.ma-input-box{padding:7px 8px}.ma-input-box #ma-prompt{font-size:16px;height:58px;min-height:58px}.ma-compose-tools{flex:1}.ma-compose-tools .icon-button{width:36px;height:40px}.ma-compose-tools select{max-width:185px;min-height:40px;padding-right:25px}.ma-send{width:40px;height:40px}.ma-composer-foot{gap:5px;font-size:9px;flex-wrap:wrap}.ma-model-toggle{max-width:100%;min-height:28px}.ma-composer-foot>span:last-child{margin-left:auto}
  .ma-confirm{gap:8px;padding:8px}.ma-confirm>span{font-size:11px}.ma-confirm .button{min-height:44px;padding:6px 10px}.ma-composer-status{font-size:12px;flex-wrap:wrap;padding:8px}.ma-composer-status .ma-stop{min-height:44px}.ma-composer-status>span:last-child{display:none}.ma-result-footer .button{min-height:44px}.ma-source-chips button{max-width:65%;min-height:30px}
  .ma-tool-dialog{max-height:calc(100dvh - 24px);width:calc(100vw - 24px)}.ma-tool-head{padding:14px 16px 10px}.ma-tool-body{padding:0 16px 14px}.ma-tool-foot{padding:10px 16px}.ma-tool-body :is(input,textarea,select){font-size:16px}.ma-tool-foot .button,.ma-tool-dialog .icon-button{min-height:42px}
}
@media(max-width:360px){.ma-heading .ma-preferences span{display:none}.ma-heading .ma-preferences{width:36px;justify-content:center}.ma-compose-tools select{max-width:156px;font-size:11px}.ma-model-toggle{font-size:10px}}
@media(max-width:850px){.ma-history-row{grid-template-columns:minmax(0,1fr) repeat(3,44px)}.ma-history-row.is-renaming{grid-template-columns:minmax(0,1fr) repeat(2,44px)}.ma-history-action,.ma-history-delete{width:44px;min-height:44px}}
/* Memory preferences retain their existing editor and save behavior. */
.preference-heading{margin-bottom:22px}.preference-heading h1{font-size:25px;margin:0 0 10px}.preference-heading p{color:var(--secondary);line-height:1.8;margin:0}.preference-tabs{display:flex;gap:8px;margin-bottom:20px;overflow:auto}.preference-tabs button{white-space:nowrap}.preference-tabs [aria-selected=true]{background:var(--primary,#7354c7);color:#fff;border-color:var(--primary,#7354c7)}.preference-section{padding:24px;max-width:1100px}.preference-section pre{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.8;font:inherit}.preference-section .memory-panel{border:0;box-shadow:none;padding:0;margin:0}.preference-section .preference-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:20px}
.preference-section:has(.automation-editor){isolation:isolate}.preference-section .automation-editor{display:flex;flex-direction:column;max-height:min(760px,calc(100dvh - 160px));min-height:320px;scroll-margin-top:20px;overflow:hidden}.preference-section .automation-editor-head{flex:none;margin-bottom:16px}.preference-section .automation-editor-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:2px 6px 18px 2px;scrollbar-gutter:stable}.preference-section .automation-editor-footer{position:relative;inset:auto;flex:none;background:var(--panel,#fff);padding:16px 0 0;margin-top:0;z-index:1;box-shadow:0 -8px 12px var(--panel,#fff)}
@media(max-width:850px){.preference-section{padding:18px}.preference-tabs{gap:6px}.preference-tabs .button{font-size:13px;padding:10px 12px}.preference-section .automation-editor{max-height:calc(100dvh - 165px);scroll-margin-top:70px}.preference-section .automation-editor-footer{position:relative;bottom:auto;padding:12px 0 0;gap:8px}.preference-section .automation-editor-footer>div{align-self:stretch;display:flex}.preference-section .automation-editor-footer>div .button{flex:1}}
.ma-notice{margin:0 0 9px;padding:8px 10px;border-radius:8px;background:#eef7f0;color:#3e7853;font-size:12px;line-height:1.7;overflow-wrap:anywhere}

/* Read-only answers are conversation results; only mutations use review cards. */
.ma-answer{display:grid;gap:var(--space-3);min-width:0}.ma-answer-summary{font-size:14px;line-height:1.8;color:var(--ink);margin:0}.ma-answer-counts{display:flex;flex-wrap:wrap;gap:var(--space-2)}.ma-answer-counts>span{padding:4px 8px;border-radius:6px;background:var(--bg);font-size:12px;color:var(--secondary)}.ma-answer-counts strong{color:var(--ink);margin-left:4px}.ma-answer-list{margin:0;padding-left:24px;display:grid;gap:var(--space-2);min-width:0}.ma-answer-list li{padding-left:4px;font-size:13px;color:var(--secondary)}.ma-answer-list button{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);width:100%;min-width:0;min-height:44px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:8px 12px;font:inherit;color:var(--ink);cursor:pointer}.ma-answer-list button:hover{background:var(--blue-soft)}.ma-answer-list button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}.ma-answer-list button>span{min-width:0;overflow-wrap:anywhere}.ma-answer-list small{flex:none;font-size:11px;color:var(--secondary)}.ma-answer-note{font-size:11px;line-height:1.7;color:var(--muted);margin:0}.ma-answer-note>span{display:block;margin-top:4px}@media(max-width:600px){.ma-answer-list button{flex-direction:column;align-items:flex-start;gap:4px}.ma-answer-list{padding-left:20px}}
.ma-answer-content,.ma-answer pre{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;max-width:100%;min-width:0;font:inherit;line-height:1.7;margin:0}.ma-answer .ma-result-details{min-width:0}.ma-answer .ma-result-details summary{overflow-wrap:anywhere;min-height:44px;padding:var(--space-2) 0}.ma-answer .ma-result-details pre{margin-top:var(--space-2)}

[data-ma-model-picker]>label{display:block;font-size:12px;color:var(--secondary);margin:0 0 var(--space-2)}
[data-ma-model-picker]>#ma-media-provider{margin-bottom:var(--space-4);min-height:40px}
@media(max-width:650px){[data-ma-model-picker] select{min-height:44px}}
