/* Contextual conversations are part of the current page's normal document flow. */
:root {--inline-agent-height:clamp(400px,65dvh,640px)}
.module-agent-slot {min-width:0;margin-bottom:24px;scroll-margin-top:20px}
.module>.module-agent-slot {flex:none;margin:20px 25px}
.module.has-inline-agent {height:calc(100dvh + var(--inline-agent-height) + 40px);min-height:calc(500px + var(--inline-agent-height) + 40px)}
#module-agent-root[hidden] {display:none}
.module-agent-panel {position:relative;width:100%;height:var(--inline-agent-height);display:flex;flex-direction:column;overflow:hidden;border:0;border-radius:14px;background:var(--surface-soft);color:var(--text);box-shadow:none}
.module-agent-head {display:flex;align-items:center;gap:10px;padding:16px;background:var(--surface-soft)}
.module-agent-symbol {display:grid;place-items:center;width:32px;height:32px;border-radius:9px;color:var(--text)}
.module-agent-symbol .icon {width:25px;height:25px}
.module-agent-head h2 {font-size:var(--font-body);font-weight:600;letter-spacing:0}
.module-agent-head p {font-size:var(--font-caption);color:var(--muted);margin-top:2px}
.module-agent-feed {padding:18px 16px;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--border) transparent}
.module-agent-welcome {padding:16px 2px 0}
.module-agent-welcome>span {color:var(--muted);display:inline-flex;margin-bottom:12px}
.module-agent-welcome h3 {font-size:var(--font-section);margin-bottom:8px}
.module-agent-welcome>p {font-size:var(--font-body);line-height:1.7;color:var(--muted)}
.module-agent-welcome>small {display:block;font-size:var(--font-caption);color:var(--muted);margin-top:10px}
.module-agent-prompts {display:flex;flex-direction:column;gap:8px;margin-top:22px}
.module-agent-prompts button {display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px;border-radius:9px;background:var(--surface-soft);text-align:left;font-size:var(--font-control)}
.module-agent-prompts button:hover {background:var(--selected)}
.module-agent-prompts .icon {width:15px;height:15px;color:var(--muted)}
.module-agent-message {font-size:var(--font-body);line-height:1.7;margin-bottom:20px;overflow-wrap:anywhere}
.module-agent-message>p {white-space:pre-wrap}
.module-agent-message.is-user {max-width:90%;margin-left:auto;padding:9px 12px;border-radius:12px;background:var(--surface-soft)}
.module-agent-author {display:flex;align-items:center;gap:7px;font-size:var(--font-caption);font-weight:500;color:var(--muted);margin-bottom:8px}
.module-agent-author .icon {width:17px;height:17px}
.module-agent-sources {display:flex;flex-direction:column;gap:7px;margin-top:14px}
.module-agent-source {display:flex;align-items:center;gap:7px;border:1px solid var(--border);border-radius:8px;padding:8px 10px;text-align:left;font-size:var(--font-caption);line-height:1.5}
.module-agent-source:hover {background:var(--hover)}
.module-agent-source>.icon {width:15px;height:15px;color:var(--muted)}
.module-agent-source span {flex:1;min-width:0}
.module-agent-thinking {color:var(--muted);font-size:var(--font-caption);padding:4px 0 12px}
.module-agent-compose {flex-shrink:0;margin:0 12px 12px;padding:12px;border:1px solid var(--control-border);border-radius:12px;background:var(--surface)}
.module-agent-compose:focus-within {border-color:var(--focus-ring);box-shadow:0 0 0 2px var(--shadow-color)}
.module-agent-compose textarea {display:block;width:100%;font-size:var(--font-body);min-height:44px;max-height:110px;resize:none;border:0;padding:0;background:transparent;box-shadow:none;line-height:1.6}
.module-agent-compose textarea:focus {border:0;box-shadow:none}
.module-agent-compose>.row {margin-top:8px;justify-content:space-between}
.module-agent-compose small {display:flex;align-items:center;gap:5px;font-size:var(--font-caption);color:var(--muted)}
.module-agent-compose small .icon {width:14px;height:14px}
.module-agent-send {display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:var(--primary);color:var(--on-primary)}
.module-agent-send .icon {width:17px;height:17px}
.module-agent-send:disabled {background:var(--selected);color:var(--muted);cursor:default}


.module-agent-panel .module-agent-head {padding:14px 20px}
.module-agent-panel .module-agent-head h2 {font-size:var(--font-section)}
.module-agent-panel .module-agent-feed {padding:20px 24px}
.module-agent-panel .module-agent-compose {margin:0 24px 24px;padding:14px 16px}
.module-agent-panel .module-agent-message.is-user {max-width:75%;width:fit-content}
.module-agent-panel .module-agent-sources {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))}
@media(max-width:650px) {
 .module-agent-panel .module-agent-head {padding:14px}
 .module-agent-panel .module-agent-feed {padding:18px 16px}
 .module-agent-panel .module-agent-compose {margin:0 12px 12px;padding:12px}
 .module-agent-panel .module-agent-message.is-user {max-width:90%}
}

/* Contextual agents sit beside the page title and open into a roomy conversation. */
.contextual-page-title,.contextual-module-header {display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
.contextual-title-copy {flex:1;min-width:0}
.contextual-title-row {display:flex;align-items:center;gap:16px;min-width:0}
.contextual-title-row h1 {flex:0 0 auto;white-space:nowrap}
.contextual-page-title>.btn {flex-shrink:0;margin-top:1px}
.module-agent-header-entry {display:flex;align-items:center;gap:8px;width:300px;max-width:100%;flex:0 1 300px;min-width:0;padding:0 10px;height:36px;border:1px solid var(--control-border);border-radius:10px;background:var(--surface);cursor:text}
.module-agent-header-entry:hover {border-color:var(--focus-ring);background:var(--hover)}
.module-agent-header-entry:focus-within {border-color:var(--focus-ring);box-shadow:0 0 0 2px var(--shadow-color)}
.module-agent-header-entry>.icon {width:18px;height:18px;flex-shrink:0;color:var(--muted)}
.module-agent-header-entry>.icon:last-child {width:14px;height:14px}
.module-agent-header-entry input {flex:1;min-width:0;width:100%;height:100%;padding:0;border:0;border-radius:0;background:transparent;color:var(--text);font-size:var(--font-control);line-height:20px;box-shadow:none;text-overflow:ellipsis}
.module-agent-header-entry input:focus {border:0;box-shadow:none}
@media(max-width:650px) {
 .contextual-title-row {gap:12px}
 .module-agent-header-entry {flex:1;width:auto}
}

.contextual-module-header {flex-shrink:0}
.contextual-module-header .contextual-title-copy>p {max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mail-module .contextual-module-header {flex-wrap:wrap}
.mail-module .contextual-module-header>.contextual-title-copy {flex:1 1 380px;width:auto}
@media(max-width:650px) {
 .contextual-page-title,.contextual-module-header {gap:12px}
 .contextual-title-row {flex-wrap:wrap;gap:8px}
 .contextual-title-row .module-agent-header-entry {flex:0 1 300px;width:100%}
}

@media(max-width:650px) {
 :root {--inline-agent-height:clamp(360px,70dvh,560px)}
 .module>.module-agent-slot {margin:20px 16px}
 .module-agent-slot {scroll-margin-top:12px}
}

/* Mini and expanded states are mutually exclusive; the panel remains in page flow. */
.module-agent-header-entry[hidden] {display:none}
.contextual-title-row {min-height:36px}
.module-agent-panel {transform-origin:top left}
.module-agent-head {flex-shrink:0}
.module-agent-head [data-action="module-agent-close"] .icon {width:20px;height:20px}

/* Docs uses the shared title entry and inline conversation, like other modules. */
.docs-module .doc-home-title{margin:24px 0 14px;font-size:var(--font-section);font-weight:600}
