.workspace:has(#agentDialog:not([hidden])) { padding: 0; overflow: hidden; }
#workspacePages:has(> #agentDialog:not([hidden])) { overflow: hidden; }
#workspacePages > #agentDialog { display: flex; min-height: 0; }
#agentDialog .ag-surface {
  --ag-bg: #0a0a0a;
  --ag-panel: #191919;
  --ag-border: #343434;
  --ag-text: #f2f2f2;
  --ag-muted: #aaa;
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr) auto;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  color: var(--ag-text);
  background: var(--ag-bg);
}
#agentDialog svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
#agentDialog .ag-head {
  display: flex; align-items: center; gap: 7px; padding-inline: 18px; min-width: 0;
  border-bottom: 1px solid var(--ag-border); background: var(--ag-panel);
}
#agentDialog .ag-head h2 { min-width: 0; overflow: hidden; margin: 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
#agentDialog .ag-head h2[tabindex="-1"]:focus { outline: none; }
#agentDialog .ag-new { margin-left: auto; }
#agentDialog .ag-icon, #agentDialog .ag-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex-shrink: 0;
  min-height: 36px; color: var(--text); border: 1px solid transparent; background: transparent; border-radius: 10px;
}
#agentDialog .ag-icon { width: 36px; padding: 0; color: #c5c5c5; }
#agentDialog .ag-button { padding: 0 12px; background: #121212; border-color: #343434; }
#agentDialog .ag-icon:disabled, #agentDialog .ag-button:disabled { opacity: .48; }
#agentDialog .ag-button svg { width: 14px; height: 14px; }
#agentDialog .ag-timeline { display: flex; align-items: stretch; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px; }
#agentDialog .ag-welcome { width: min(100%, 680px); margin: auto; padding: 16px 0; text-align: center; }
#agentDialog .ag-welcome-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: #f4f4f4; color: #151515; }
#agentDialog .ag-welcome-icon svg { width: 19px; height: 19px; }
#agentDialog .ag-welcome h3 { margin: 16px 0 13px; font-size: 26px; letter-spacing: -.025em; }
#agentDialog .ag-welcome p { max-width: 530px; margin: 0 auto; color: var(--ag-muted); line-height: 1.6; }
#agentDialog .ag-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 27px 0 28px; }
#agentDialog .ag-quick-card {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 70px; padding: 12px 15px;
  border: 1px solid var(--ag-border); border-radius: 14px; background: var(--ag-panel); text-align: left;
}
#agentDialog .ag-quick-card > svg { color: var(--ag-muted); width: 19px; height: 19px; }
#agentDialog .ag-quick-caption { display: grid; min-width: 0; gap: 4px; }
#agentDialog .ag-quick-caption span { min-width: 0; overflow: hidden; color: var(--ag-muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
#agentDialog .ag-explore {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 2px 20px;
  border: 2px solid transparent; border-radius: 999px; background: linear-gradient(#fff,#fff) padding-box, linear-gradient(100deg,#7546f3,#bb6298) border-box;
  color: #16131c; font-weight: 620;
}
#agentDialog .ag-explore svg { color: #7546f3; }
#agentDialog .ag-footer { width: min(100%, 960px); margin: 0 auto; padding: 4px 20px 18px; }
#agentDialog .ag-composer { display: grid; gap: 4px; padding: 12px 14px; background: var(--ag-panel); border: 1px solid var(--ag-border); border-radius: 18px; }
#agentDialog .ag-composer textarea {
  display: block; width: 100%; min-height: 55px; max-height: min(23vh, 180px); resize: vertical;
  padding: 5px 2px; color: var(--ag-text); background: none; border: 0; outline-offset: 2px; line-height: 1.5;
}
#agentDialog .ag-composer textarea::placeholder { color: var(--ag-muted); }
#agentDialog .ag-composer-bar { display: flex; align-items: center; min-width: 0; flex-wrap: wrap; gap: 8px; }
#agentDialog .ag-attach { border: 1px solid var(--ag-border); border-radius: 50%; }
#agentDialog .ag-send { margin-left: auto; border-radius: 50%; background: #f4f4f4; color: #121212; }
#agentDialog .ag-model-note { color: var(--ag-muted); font-size: 11px; margin-right: auto; }
#agentDialog .ag-notices { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
#agentDialog .ag-notices:not(:has(> :not([hidden]))) { display: none; }
#agentDialog .ag-notices > * { margin-bottom: 7px; }
#agentDialog .ag-status { color: var(--ag-muted); overflow-wrap: anywhere; }
#agentDialog .ag-error { color: #ffd8d2; }
#agentDialog .ag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#agentDialog .ag-chips:empty { display: none; }
#agentDialog .ag-chip { display: flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--ag-border); padding: 0 2px 0 7px; border-radius: 8px; }
#agentDialog .ag-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#agentDialog .ag-chip-remove { display: grid; place-items: center; width: 26px; height: 26px; border: 0; background: none; border-radius: 5px; padding: 0; }
#agentDialog .ag-chip svg { width: 14px; height: 14px; color: var(--ag-muted); }
#agentDialog .ag-transcript { display: grid; align-content: start; gap: 14px; width: min(100%, 920px); margin: 0 auto; padding: 6px 0; }
#agentDialog .ag-turn { display: grid; justify-items: start; gap: 6px; padding: 11px 14px; min-width: 0; border-radius: 13px; }
#agentDialog .ag-turn-user { justify-self: end; max-width: min(100%, 700px); border: 1px solid var(--ag-border); background: var(--ag-panel); }
#agentDialog .ag-turn-assistant { justify-self: start; width: 100%; border-bottom: 1px solid var(--ag-border); border-radius: 0; }
#agentDialog .ag-turn p, #agentDialog .ag-preview { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#agentDialog .ag-turn-asset, #agentDialog .ag-muted { color: var(--muted); }
#agentDialog .ag-history {
  position: absolute; z-index: 2; top: 68px; left: 12px; width: min(290px, calc(100% - 24px)); max-height: calc(100% - 85px);
  overflow: auto; padding: 12px; border: 1px solid var(--ag-border); border-radius: 12px; background: var(--ag-panel); box-shadow: 0 14px 30px #000a;
}
#agentDialog .ag-history h3 { margin-bottom: 7px; font-size: 14px; }
#agentDialog .ag-history-item { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding-inline: 6px; margin: 2px 0; text-align: left; border: 1px solid transparent; border-radius: 7px; background: transparent; overflow-wrap: anywhere; }
#agentDialog .ag-history-item[aria-current] { background: #272727; border-color: var(--ag-border); }
#agentDialog .ag-modal {
  position: fixed; margin: auto; width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  overflow: auto; padding: 18px; color: var(--text); border: 1px solid #444; border-radius: 14px; background: #191919;
}
#agentDialog .ag-modal::backdrop { background: #0009; }
#agentDialog .ag-modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
#agentDialog .ag-modal-heading h3 { font-size: 16px; }
#agentDialog .ag-modal > p { margin-bottom: 12px; }
#agentDialog .ag-modal > button + button { margin-left: 8px; }
#agentDialog .ag-field { display: grid; gap: 5px; margin-bottom: 12px; }
#agentDialog .ag-field select { min-width: 0; min-height: 36px; border: 1px solid #444; border-radius: 7px; padding: 4px 8px; background: #111; }
#agentDialog .ag-preview, #agentDialog .ag-asset-list { max-height: 240px; overflow: auto; padding: 9px; margin-bottom: 12px; border: 1px solid #343434; border-radius: 7px; }
#agentDialog .ag-asset { display: flex; align-items: center; gap: 7px; min-height: 34px; overflow-wrap: anywhere; }
#agentDialog .ag-primary { color: #151515; background: #f4f4f4; }
#agentDialog button { transition: transform 150ms ease, opacity 150ms ease; }
#agentDialog button:not(:disabled):active { transform: scale(.98); }
#agentDialog :is(button,textarea,select,a):focus-visible { outline: 2px solid #bddbff; outline-offset: 2px; }
@media (hover:hover) {
  #agentDialog button:not(:disabled):hover { opacity: .83; }
}
@media (max-width:760px) {
  #agentDialog .ag-head { padding-inline: 8px; }
  #agentDialog .ag-timeline { padding-inline: 9px; }
  #agentDialog .ag-footer { padding-inline: 9px; padding-bottom: 9px; }
  #agentDialog .ag-composer { padding: 8px; }
  #agentDialog :is(.ag-composer textarea,.ag-field select) { font-size: 16px; }
  #agentDialog :is(.ag-button,.ag-icon,.ag-chip-remove,.ag-history-item,.ag-asset) { min-height: 44px; }
  #agentDialog :is(.ag-icon,.ag-chip-remove) { min-width: 44px; }
}
@media (max-width:560px) {
  #agentDialog .ag-welcome { padding: 7px 0; }
  #agentDialog .ag-welcome h3 { font-size: 21px; }
  #agentDialog .ag-welcome-icon { height: 44px; width: 44px; border-radius: 13px; }
  #agentDialog .ag-quick { grid-template-columns: minmax(0, 1fr); gap: 7px; margin: 12px 0; }
  #agentDialog .ag-quick-card { min-height: 51px; padding: 6px 9px; }
  #agentDialog .ag-model-note { order: 1; width: 100%; }
}
@media (prefers-reduced-motion:reduce) {
  #agentDialog button { transition: none; }
}
