/* The assistant's visual layer is isolated from the map and drafting controls. */
#buddy-actions.assistant-designed {width:min(384px,calc(100% - 24px));font:13px var(--ui);color:#edf1f2;z-index:1200;}
#buddy-actions.assistant-designed:not([open]) {width:270px;max-width:calc(100% - 24px);}
#map:has(#buddy-actions.assistant-designed[open]) #gc-workflow-card {visibility:hidden;}
#buddy-actions.assistant-designed[open] {height:min(600px,calc(100% - 24px));max-height:calc(100% - 24px);overflow:hidden;display:flex;flex-direction:column;background:#171b1d;border:1px solid #485154;border-radius:8px;box-shadow:0 12px 30px #0005;}
#buddy-actions.assistant-designed > summary {flex:0 0 auto;list-style:none;position:relative;top:auto;padding:12px;background:#1c2224;border:1px solid #485154;border-radius:8px;box-sizing:border-box;}
#buddy-actions.assistant-designed[open] > summary {height:78px;}
#buddy-actions.assistant-designed > summary::-webkit-details-marker {display:none;}
#buddy-actions.assistant-designed[open] > summary {border:0;border-bottom:1px solid #3a4549;border-radius:0;}
#buddy-actions.assistant-designed > summary:focus-visible {outline:2px solid #69d9ca;outline-offset:-3px;}
#buddy-actions.assistant-designed .assistant-identity {position:static;background:none;display:grid;grid-template-columns:52px minmax(0,1fr) 18px;gap:10px;min-height:52px;}
#buddy-actions.assistant-designed:not([open]) .assistant-identity {grid-template-columns:38px minmax(0,1fr) 16px;min-height:38px;gap:9px;}
#buddy-actions.assistant-designed .assistant-avatar {width:52px;height:52px;display:grid;place-items:center;flex:none;border:0;background:none;}
#buddy-actions.assistant-designed:not([open]) .assistant-avatar {width:38px;height:38px;}
#buddy-actions .agent-identity-copy {display:grid;gap:6px;align-self:center;min-width:0;}
#buddy-actions .agent-identity-copy strong {font-size:14px;font-weight:600;color:#f1f5f5;line-height:1.2;overflow-wrap:anywhere;}
#buddy-actions .agent-presence {display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:10px;line-height:1.2;}
#buddy-actions .assistant-state {margin:0;color:#b3c1c4;font-size:10px;}
#buddy-actions .agent-network {color:#829397;border-left:1px solid #4c595d;padding-left:8px;}
#buddy-actions[data-agent-connected=true] .agent-network {color:#8bdbbf;}
#buddy-actions .agent-chevron {display:grid;align-self:center;color:#a9b9bd;transition:transform .18s ease;}
#buddy-actions:not([open]) .agent-chevron {transform:rotate(180deg);}
#buddy-actions svg {width:15px;height:15px;flex:0 0 15px;}
#buddy-actions.assistant-designed .buddy-body {position:absolute;inset:78px 0 0;padding:0;display:flex;flex-direction:column;gap:0;min-height:0;overflow:hidden;}
#buddy-actions.assistant-designed #site-plan-assistant-chat {display:flex;flex-direction:column;gap:0;flex:1 1 auto;min-height:0;overflow:hidden;background:#171b1d;}
#buddy-actions .agent-conversation {display:flex;flex:1 1 auto;flex-direction:column;min-height:70px;overflow:hidden;}
#buddy-actions.assistant-designed [role=log] {max-height:none;min-height:0;flex:1 1 auto;gap:14px;padding:16px 12px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#58676a transparent;}
#buddy-actions.assistant-designed [role=log] .assistant-message {padding:0;margin:0;display:flex;align-items:flex-start;gap:8px;max-width:100%;background:none;border:0;line-height:1.55;font-size:13px;}
#buddy-actions.assistant-designed .assistant-message-assistant .agent-message-text {padding:0 4px 0 0;}
#buddy-actions.assistant-designed [role=log] .assistant-message-user {max-width:88%;align-self:flex-end;}
#buddy-actions .assistant-message-user .agent-message-text {padding:9px 11px;background:#283337;border:1px solid #43565b;border-radius:7px 7px 2px 7px;color:#f1f5f5;}
#buddy-actions .agent-message-text {min-width:0;overflow-wrap:anywhere;white-space:pre-wrap;}
#buddy-actions .agent-message-enter {animation:agent-message-in .2s ease-out both;}
#buddy-actions .agent-composer {flex:0 0 auto;padding:8px 12px 10px;border-top:1px solid #354144;display:grid;gap:7px;background:#1c2224;}
#buddy-actions .agent-primary-actions {display:flex;align-items:center;gap:6px;}
#buddy-actions button {transition:background .12s ease,border-color .12s ease;}
#buddy-actions button:disabled {opacity:.5;cursor:default;}
#buddy-actions button:focus-visible,#buddy-actions textarea:focus-visible,#buddy-actions select:focus-visible {outline:2px solid #69d9ca;outline-offset:2px;}
#buddy-actions .agent-primary-actions button,#buddy-actions .agent-edit-tools button {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:28px;font-size:11px;}
#buddy-actions .agent-primary-actions button:first-child {background:none;border-color:transparent;padding-left:0;color:#b7e6dc;}
#buddy-actions .agent-primary-actions button:last-child:not(:first-child) {margin-left:auto;color:#ffd08b;}
#buddy-actions .agent-input-row {display:flex;align-items:flex-end;gap:7px;padding:8px;border:1px solid #5b7176;border-radius:7px;background:#121719;}
#buddy-actions .agent-input-row:focus-within {border-color:#71cbbb;box-shadow:0 0 0 1px #71cbbb;}
#buddy-actions .agent-message-label {flex:1;min-width:0;display:block;}
#buddy-actions.assistant-designed textarea {height:58px;min-height:58px;max-height:100px;margin:0;padding:1px 0;resize:vertical;border:0;border-radius:0;background:none;color:#f2f5f5;box-shadow:none;font:13px/1.45 var(--ui);}
#buddy-actions.assistant-designed textarea:focus-visible {outline:none;}
#buddy-actions textarea::placeholder {color:#94a5a9;opacity:1;}
#buddy-actions.assistant-designed button[type=submit] {display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;padding:0;background:#f8b334;color:#171b1d;border-color:#f8b334;border-radius:6px;}
#buddy-actions button[type=submit]:hover:not(:disabled) {background:#ffc65d;}
#buddy-actions.assistant-designed .assistant-vision {font-size:10px;line-height:1.4;gap:6px;color:#b9c7ca;}
#buddy-actions .assistant-vision svg {margin-left:auto;width:13px;height:13px;color:#8dabae;}
#buddy-actions.assistant-designed input[type=checkbox] {accent-color:#63cbb6;}
#buddy-actions.assistant-designed [role=status] {margin:0;max-height:64px;overflow:auto;font-size:11px;line-height:1.4;color:#b8c7ca;overflow-wrap:anywhere;}
#buddy-actions.assistant-designed [role=status]:empty {display:none;}
#buddy-actions[data-agent-state=error] [role=status] {color:#ffcc96;}
#buddy-actions .agent-options {flex:0 0 auto;border-top:1px solid #354144;background:#171b1d;max-height:42%;overflow:auto;scrollbar-width:thin;}
#buddy-actions.assistant-designed .agent-options > summary {position:static;display:flex;align-items:center;gap:7px;border:0;border-radius:0;padding:8px 12px;font-size:11px;color:#acbec2;background:none;}
#buddy-actions .agent-options > summary svg:last-child {margin-left:auto;width:12px;}
#buddy-actions .agent-options[open] > summary svg:last-child {transform:rotate(180deg);}
#buddy-actions .agent-options-body {display:grid;gap:10px;padding:2px 12px 12px;}
#buddy-actions .agent-edit-tools {display:flex;gap:6px;flex-wrap:wrap;}
#buddy-actions.assistant-designed .assistant-feedback button {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:28px;min-width:28px;}
#buddy-actions .agent-options .assistant-connection {font-size:9px;line-height:1.5;color:#85989d;}
#buddy-actions .agent-options .assistant-connection::after {content:' / Visual build 1';}
#buddy-actions.assistant-designed .assistant-proposal {flex:0 1 auto;max-height:200px;overflow:auto;margin:0 12px 10px;padding:8px 10px;background:#202a2b;border:1px solid #4c8d7c;border-radius:6px;font-size:12px;scrollbar-width:thin;}
#buddy-actions .assistant-proposal .assistant-steps {margin:0 0 8px;padding-left:16px;line-height:1.5;}
#buddy-actions .assistant-proposal button {font-size:11px;min-height:30px;}
#buddy-actions .assistant-proposal .agent-approve {background:#a7dfc9;color:#12271f;border-color:#a7dfc9;margin-right:6px;font-weight:600;}
#buddy-actions .assistant-proposal .assistant-conflicts {font-size:11px;line-height:1.45;}
#buddy-actions.assistant-designed .assistant-point-context {padding:5px 7px;background:#233331;border:0;border-radius:4px;font-size:10px;color:#c3e9de;}
#buddy-actions .assistant-point-context button {border:0;background:none;padding:2px;display:grid;place-items:center;}
#buddy-actions.assistant-designed .assistant-manual {flex:0 0 auto;max-height:40%;overflow:auto;border-top:1px solid #354144;}
#buddy-actions.assistant-designed .assistant-manual > summary {position:static;padding:7px 12px;border:0;background:none;font-size:10px;color:#8fa4a9;}
#buddy-actions.assistant-designed .buddy-manual-body {padding:8px 12px;}
#buddy-actions .agent-activity {display:none;align-items:center;gap:8px;padding:4px 14px 12px;color:#a7c3c1;font-size:11px;min-height:24px;box-sizing:border-box;}
#buddy-actions[data-agent-state=thinking] .agent-activity,#buddy-actions[data-agent-state=working] .agent-activity {display:flex;}
#buddy-actions .agent-activity-bars {display:flex;align-items:center;gap:3px;height:12px;}
#buddy-actions .agent-activity-bars span {display:block;width:3px;height:8px;background:#71cbbb;animation:agent-meter 1s ease-in-out infinite;}
#buddy-actions .agent-activity-bars span:nth-child(2) {animation-delay:.15s;}
#buddy-actions .agent-activity-bars span:nth-child(3) {animation-delay:.3s;}
#buddy-actions .agent-sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}

/* The geometric character stays crisp at launcher, header and message sizes. */
#buddy-actions .agent-character {position:relative;display:block;width:50px;height:50px;flex:0 0 50px;}
#buddy-actions .agent-head {position:absolute;inset:5px 3px 3px;border-radius:13px 13px 10px 10px;background:#dce9e5;border:1px solid #f7fffc;box-shadow:inset 0 -4px 0 #9ebbb4;transform-origin:50% 75%;animation:agent-breathe 4.6s ease-in-out infinite;}
#buddy-actions .agent-corner {position:absolute;right:0;top:-3px;width:9px;height:7px;background:#f8b334;border:1px solid #ffd790;border-radius:2px 3px 0 1px;transform:rotate(12deg);}
#buddy-actions .agent-visor {position:absolute;left:5px;right:5px;top:8px;height:20px;background:#152427;border:1px solid #334e50;border-radius:6px;overflow:hidden;}
#buddy-actions .agent-eyes {position:absolute;inset:5px 6px;display:flex;justify-content:space-between;align-items:center;}
#buddy-actions .agent-eye {display:block;width:5px;height:7px;border-radius:2px;background:#91f0d3;transform-origin:center;animation:agent-blink 6.8s linear infinite;}
#buddy-actions .agent-mouth {position:absolute;width:7px;height:2px;left:calc(50% - 3.5px);bottom:2px;border-radius:0 0 3px 3px;background:#91f0d3;opacity:.55;}
#buddy-actions .agent-rule {position:absolute;left:13px;bottom:6px;width:16px;height:3px;background:repeating-linear-gradient(90deg,#5a7d73 0 1px,transparent 1px 4px);border-bottom:1px solid #5a7d73;}
#buddy-actions .agent-scan {position:absolute;left:0;right:0;top:0;height:1px;background:#b2ffe8;opacity:0;}
#buddy-actions:not([open]) .agent-character--main {transform:scale(.76);transform-origin:center;}
#buddy-actions .agent-character--message {width:24px;height:24px;flex:0 0 24px;margin-top:0;overflow:visible;}
#buddy-actions .agent-character--message .agent-head {width:44px;height:40px;inset:0;transform:scale(.5);transform-origin:0 0;animation:none;}
#buddy-actions .agent-character--message .agent-eye {animation:none;}
#buddy-actions[data-agent-state=thinking] .agent-character--main .agent-head {animation:agent-consider 2.2s ease-in-out infinite;}
#buddy-actions[data-agent-state=thinking] .agent-character--main .agent-eyes {animation:agent-look 2.2s ease-in-out infinite;}
#buddy-actions[data-agent-state=thinking] .agent-character--main .agent-scan {opacity:.35;animation:agent-scan 1.8s ease-in-out infinite;}
#buddy-actions[data-agent-state=working] .agent-character--main .agent-head {animation:agent-working .9s ease-in-out infinite;}
#buddy-actions[data-agent-state=working] .agent-character--main .agent-eye {background:#ffcf79;height:4px;}
#buddy-actions[data-agent-state=review] .agent-character--main .agent-head {animation:agent-review .5s ease-out 1,agent-breathe 4.6s .5s ease-in-out infinite;}
#buddy-actions[data-agent-state=review] .assistant-state {color:#a7dfc9;}
#buddy-actions[data-agent-state=error] .agent-character--main .agent-head {animation:none;transform:rotate(-6deg);}
#buddy-actions[data-agent-state=error] .agent-character--main .agent-eye {background:#ffcc96;height:4px;animation:none;}
#buddy-actions[data-agent-state=error] .assistant-state {color:#ffcc96;}
#buddy-actions.agent-completed .agent-character--main .agent-mouth {height:4px;background:none;border-bottom:2px solid #91f0d3;opacity:1;}
#buddy-actions[data-page-hidden=true] .agent-head,#buddy-actions[data-page-hidden=true] .agent-eye,#buddy-actions[data-page-hidden=true] .agent-eyes,#buddy-actions[data-page-hidden=true] .agent-scan,#buddy-actions[data-page-hidden=true] .agent-activity-bars span {animation-play-state:paused;}
@keyframes agent-breathe {0%,100%{transform:translateY(0) rotate(0)}50%{transform:translateY(-1.6px) rotate(1deg)}}
@keyframes agent-blink {0%,43%,46%,76%,79%,100%{transform:scaleY(1)}44.5%,77.5%{transform:scaleY(.12)}}
@keyframes agent-consider {0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-1px) rotate(3deg)}}
@keyframes agent-look {0%,100%{transform:translateX(-2px)}50%{transform:translateX(2px)}}
@keyframes agent-working {0%,100%{transform:translateY(0) rotate(2deg)}50%{transform:translateY(1px) rotate(-2deg)}}
@keyframes agent-review {0%{transform:translateY(0)}50%{transform:translateY(2px)}100%{transform:translateY(0)}}
@keyframes agent-scan {0%,100%{transform:translateY(1px)}50%{transform:translateY(17px)}}
@keyframes agent-meter {0%,100%{transform:scaleY(.5);opacity:.5}50%{transform:scaleY(1.2);opacity:1}}
@keyframes agent-message-in {from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:680px){
  #buddy-actions.assistant-designed[open] {top:8px;bottom:auto;height:min(580px,calc(100% - 16px));max-height:calc(100% - 16px);}
  #buddy-actions.assistant-designed .assistant-identity {grid-template-columns:44px minmax(0,1fr) 16px;gap:8px;min-height:44px;}
  #buddy-actions.assistant-designed .assistant-avatar {width:44px;height:44px;}
  #buddy-actions .agent-character--main {transform:scale(.88);}
  #buddy-actions .agent-identity-copy strong {font-size:13px;}
  #buddy-actions.assistant-designed > summary {padding:9px 10px;}
  #buddy-actions.assistant-designed[open] > summary {height:64px;}
  #buddy-actions.assistant-designed .buddy-body {top:64px;}
  #buddy-actions .agent-composer {padding:7px 10px 9px;}
  #buddy-actions.assistant-designed [role=log] {padding:12px 10px;gap:12px;}
  #buddy-actions.assistant-designed textarea {height:49px;min-height:49px;font-size:13px;}
  #buddy-actions .agent-options {max-height:35%;}
}
@media(prefers-reduced-motion:reduce){
  #buddy-actions.assistant-designed *,#buddy-actions.assistant-designed *::before,#buddy-actions.assistant-designed *::after {animation:none!important;transition:none!important;scroll-behavior:auto!important;}
}

/* Human drafter identity and chat-first presentation. The six poses share one transparent sprite. */
#buddy-actions.agent-human .assistant-identity {grid-template-columns:64px minmax(0,1fr) 48px;min-height:64px;gap:10px;}
#buddy-actions.agent-human[open] > summary {height:90px;}
#buddy-actions.agent-human .buddy-body {top:90px;}
#buddy-actions.agent-human .assistant-avatar {width:64px;height:64px;}
#buddy-actions.agent-human .agent-character--main {width:64px;height:64px;flex-basis:64px;transform:none;}
#buddy-actions.agent-human .agent-head {inset:0;width:100%;height:100%;border:0;border-radius:0;background:none;box-shadow:none;}
#buddy-actions.agent-human .agent-portrait,#buddy-actions.agent-human .agent-portrait-blink {position:absolute;inset:0;display:block;background-image:url('../../assets/assistant/site-plan-drafter-v1.webp');background-size:300% 200%;background-position:0 0;background-repeat:no-repeat;}
#buddy-actions.agent-human .agent-portrait-blink {background-position:50% 0;opacity:0;animation:agent-human-blink 7.2s steps(1,end) infinite;}
#buddy-actions.agent-human .agent-character--message {width:32px;height:32px;flex:0 0 32px;}
#buddy-actions.agent-human .agent-character--message .agent-head {width:32px;height:32px;transform:none;animation:none;}
#buddy-actions.agent-human .agent-character--message .agent-portrait-blink {display:none;}
#buddy-actions.agent-human[data-agent-state=thinking] .agent-character--main .agent-portrait {background-position:100% 0;}
#buddy-actions.agent-human[data-agent-state=working] .agent-character--main .agent-portrait {background-position:0 100%;}
#buddy-actions.agent-human[data-agent-state=review] .agent-character--main .agent-portrait {background-position:50% 100%;}
#buddy-actions.agent-human[data-agent-state=error] .agent-character--main .agent-portrait {background-position:100% 100%;}
#buddy-actions.agent-human:not([data-agent-state=ready]) .agent-character--main .agent-portrait-blink {display:none;}
#buddy-actions.agent-human.agent-completed .agent-character--main .agent-portrait {background-position:50% 100%;}
#buddy-actions.agent-human.agent-completed .agent-character--main .agent-portrait-blink {display:none;}
#buddy-actions.agent-human .agent-identity-copy {gap:4px;}
#buddy-actions.agent-human .agent-role {font-size:10px;line-height:1.3;font-weight:400;color:#c4b79d;}
#buddy-actions.agent-human .agent-network {display:none;}
#buddy-actions.agent-human .agent-header-tools {display:flex;align-items:center;justify-content:flex-end;gap:6px;}
#buddy-actions.agent-human .agent-options-toggle {display:grid;place-items:center;width:26px;height:28px;padding:0;border:0;background:none;color:#b6c2c4;}
#buddy-actions.agent-human .agent-options-toggle[aria-expanded=true] {color:#ffc45d;background:#353027;}
#buddy-actions.agent-human .agent-chevron {width:16px;}
#buddy-actions.agent-human:not([open]) {width:280px;}
#buddy-actions.agent-human:not([open]) .assistant-identity {grid-template-columns:44px minmax(0,1fr) 16px;min-height:44px;gap:8px;}
#buddy-actions.agent-human:not([open]) .assistant-avatar,#buddy-actions.agent-human:not([open]) .agent-character--main {width:44px;height:44px;transform:none;}
#buddy-actions.agent-human:not([open]) .agent-options-toggle {display:none;}
#buddy-actions.agent-human:not([open]) .agent-identity-copy strong {font-size:12px;}
#buddy-actions.agent-human:not([open]) .agent-presence {display:none;}
#buddy-actions.agent-human .agent-conversation {position:relative;}
#buddy-actions.agent-human .agent-primary-actions {flex:0 0 auto;padding:4px 12px 8px;}
#buddy-actions.agent-human:has(.agent-starters:not([hidden])) [role=log] {flex:0 0 auto;}
#buddy-actions.agent-human:has(.agent-starters:not([hidden])) .agent-primary-actions {display:none;}
#buddy-actions.agent-human .agent-starters {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:0 12px 12px;flex:0 0 auto;}
#buddy-actions.agent-human .agent-starters button {display:flex;align-items:center;gap:6px;text-align:left;min-height:36px;font-size:11px;line-height:1.3;padding:7px 8px;background:#252b2d;border-color:#414b4e;color:#e3e9e9;overflow-wrap:anywhere;}
#buddy-actions.agent-human .agent-starters button svg {color:#f4bd5c;width:14px;height:14px;flex:0 0 14px;}
#buddy-actions.agent-human .agent-starters button:hover {border-color:#ba914b;background:#353027;}
#buddy-actions.agent-human .agent-starters[hidden] {display:none;}
#buddy-actions.agent-human .agent-composer {gap:6px;padding:10px 12px 12px;}
#buddy-actions.agent-human textarea {height:44px;min-height:44px;}
#buddy-actions.agent-human .agent-sharing {font-size:10px;color:#e9c78b;}
#buddy-actions.agent-human .agent-options {position:absolute;inset:0;z-index:5;max-height:none;overflow:auto;flex:none;border:0;background:#1b2022;}
#buddy-actions.agent-human .agent-options:not([open]) {display:none;}
#buddy-actions.agent-human .agent-options > summary {position:sticky;top:0;z-index:1;padding:12px;background:#232a2d;min-height:40px;box-sizing:border-box;font-size:12px;color:#f3ca7c;}
#buddy-actions.agent-human .agent-options-body {padding:12px;gap:14px;}
#buddy-actions.agent-human .agent-options .assistant-manual {max-height:none;overflow:visible;border:0;}
#buddy-actions.agent-human .agent-options .assistant-manual > summary {padding:8px 0;font-size:11px;color:#a7b8bd;}
#buddy-actions.agent-human .agent-options .buddy-manual-body {padding:6px 0;}
#buddy-actions.agent-human .agent-diagnostics {font-size:10px;color:#8c9da2;}
#buddy-actions.agent-human .agent-diagnostics > summary {padding:5px 0;position:static;background:none;border:0;font-size:10px;}
#buddy-actions.agent-human .assistant-connection::after {content:' / Visual build 2';}
#buddy-actions.agent-human .assistant-proposal .agent-approve {background:#f8b334;border-color:#f8b334;color:#211b10;}
#buddy-actions.agent-human .agent-activity {margin-top:auto;color:#d1bb93;}
#buddy-actions.agent-human .agent-activity-bars span {background:#e8ae45;}
#buddy-actions.agent-human[data-page-hidden=true] .agent-portrait-blink {animation-play-state:paused;}
@keyframes agent-human-blink {0%,43%,46%,80%,83%,100%{opacity:0}44%,45%,81%,82%{opacity:1}}
@media(max-width:680px){
  #buddy-actions.agent-human .assistant-identity {grid-template-columns:54px minmax(0,1fr) 46px;min-height:54px;gap:8px;}
  #buddy-actions.agent-human .assistant-avatar,#buddy-actions.agent-human .agent-character--main {width:54px;height:54px;transform:none;}
  #buddy-actions.agent-human[open] > summary {height:78px;}
  #buddy-actions.agent-human .buddy-body {top:78px;}
  #buddy-actions.agent-human .agent-role {font-size:9px;}
  #buddy-actions.agent-human .agent-identity-copy strong {font-size:12px;}
  #buddy-actions.agent-human .agent-starters {gap:5px;padding:0 10px 10px;}
  #buddy-actions.agent-human .agent-starters button {font-size:10px;min-height:34px;}
}
