/* HHD Agentes – accessible, bounded overlay. Only the original Rosie.png is used. */
.hhd-agents-dialog .e-dlg-content { padding: 0.75rem 1.25rem 1.25rem; max-height: min(84vh, 900px); overflow: auto; }
.hhd-agents-dialog .e-dlg-header-content { padding: 0.85rem 1.25rem; }
.hhd-agents-dialog .e-dlg-header h2 { margin: 0; font-size: 1.5rem; }
.hhd-agents-workspace { color: var(--hhd-text, #1b3655); }
.hhd-agents-main-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(245px, 1fr); gap: 1rem; }
.hhd-rosie-hero, .hhd-agents-attention, .hhd-agents-system, .hhd-agents-secondary-grid section { border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 16px; background: var(--hhd-surface, #fff); padding: 1rem; }
.hhd-rosie-hero { display: grid; grid-template-columns: minmax(145px, 32%) minmax(0, 1fr); gap: 1rem; background: linear-gradient(125deg, rgba(48, 135, 248, .1), transparent 55%), var(--hhd-surface, #fff); }
.hhd-rosie-avatar { display: block; width: 100%; max-height: 270px; object-fit: contain; object-position: center bottom; }
.hhd-rosie-hero-body h3 { font-size: clamp(1.45rem, 3vw, 2rem); margin: .25rem 0; }
.hhd-agents-kicker { font-size: .8rem; font-weight: 650; color: var(--hhd-accent, #145ec2); }
.hhd-rosie-state { display: inline-block; padding: .35rem .75rem; border-radius: 100px; background: rgba(45, 120, 190, .08); }
.hhd-rosie-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.1rem 0 .2rem; }
.hhd-rosie-actions button, .hhd-agents-workspace button { border: 1px solid var(--hhd-border, #aacaf2); border-radius: 10px; padding: .65rem .9rem; background: var(--hhd-surface, #fff); color: inherit; cursor: pointer; }
.hhd-agents-workspace button:focus-visible { outline: 3px solid var(--hhd-accent, #2b86ee); outline-offset: 3px; }
.hhd-agents-workspace button:disabled { cursor: not-allowed; opacity: .55; }
.hhd-agents-workspace button.hhd-agents-primary { background: var(--hhd-accent, #176bf2); color: white; font-weight: 650; border-color: transparent; }
.hhd-agents-attention h3, .hhd-agents-system h3 { margin: 0 0 .7rem; }
.hhd-agents-attention-list { display: grid; gap: .35rem; }
.hhd-agents-attention-row { min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: .75rem; border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 10px; padding: .65rem .75rem; }
.hhd-agents-attention-row strong, .hhd-agents-attention-row small { display: block; }
.hhd-agents-attention-row strong { font-size: .88rem; }
.hhd-agents-attention-row small { font-size: .77rem; color: var(--hhd-text-muted, #60758d); margin-top: .15rem; }
.hhd-agents-attention .hhd-agents-attention-action { width: 100%; text-align: left; background: var(--hhd-surface, #fff); }
.hhd-agents-unverified { flex: none; color: var(--hhd-text-muted, #60758d); font-weight: 600; }
.hhd-agents-system-rail { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: .7rem; padding: .2rem .1rem .75rem; }
.hhd-agents-system-rail > * { scroll-snap-align: start; flex: 0 0 min(290px, 82vw); }
.hhd-agents-muted { font-size: .83rem; color: var(--hhd-text-muted, #60758d); }
.hhd-rosie-compose small { font-size: .78rem; color: var(--hhd-text-muted, #60758d); }
.hhd-agents-unknown { margin-top: .85rem; font-size: .875rem; color: var(--hhd-text-muted, #60758d); }
.hhd-agents-system { margin: 1rem 0; }
.hhd-rosie-agent-card { display: flex; gap: .8rem; align-items: center; max-width: 320px; border: 1px solid var(--hhd-border, #d5e2f4); padding: .6rem; border-radius: 12px; }
.hhd-rosie-agent-card img { width: 60px; height: 68px; object-fit: contain; }
.hhd-rosie-agent-card p { margin: .25rem 0 0; }
.hhd-agents-secondary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hhd-rosie-message-list { height: min(38vh, 390px); overflow: auto; border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 12px; padding: 1rem; }
.hhd-rosie-message-human, .hhd-rosie-message-agent { max-width: 85%; padding: .8rem; border-radius: 12px; margin: 0 0 .75rem; background: var(--hhd-surface, #f2f7ff); }
.hhd-rosie-message-human { margin-left: auto; border: 1px solid #bcd9fb; }
.hhd-rosie-message-agent { border: 1px solid var(--hhd-border, #d5e2f4); }
.hhd-rosie-compose { display: grid; gap: .5rem; margin-top: 1rem; }
.hhd-rosie-compose textarea, .hhd-rosie-preferences-grid input:not([type=checkbox]), .hhd-rosie-preferences-grid textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--hhd-border, #b9cade); border-radius: 8px; padding: .6rem; background: var(--hhd-surface, #fff); color: inherit; }
.hhd-rosie-preferences-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.hhd-rosie-preferences-grid label { display: grid; gap: .35rem; }
.hhd-rosie-preferences-grid label:first-child { display: flex; align-items: center; }
.hhd-rosie-preferences-grid .hhd-rosie-reason { grid-column: 1 / -1; }
.hhd-rosie-error { margin-bottom: .75rem; padding: .65rem; border: 1px solid #bb5149; border-radius: 10px; }
.hhd-rosie-activity-row { display: block; width: 100%; text-align: left; margin-bottom: .35rem; }
.hhd-rosie-activity-message { margin: .5rem 0; padding: .65rem; border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 10px; }
@media (max-width: 920px) { .hhd-agents-main-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .hhd-agents-secondary-grid, .hhd-rosie-preferences-grid { grid-template-columns: 1fr; } .hhd-rosie-hero { grid-template-columns: 110px minmax(0,1fr); } .hhd-rosie-avatar { max-height: 170px; } .hhd-agents-dialog .e-dlg-content { max-height: 83dvh; } }
@media (max-width: 390px) { .hhd-rosie-hero { grid-template-columns: 1fr; } .hhd-rosie-avatar { max-height: 140px; } }

/* OWNER resource governance stays inside the bounded Agentes modal. */
.hhd-rosie-provider-governance { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--hhd-border, #d5e2f4); }
.hhd-rosie-resource-toolbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.hhd-rosie-resource-toolbar label { display: grid; gap: .3rem; flex: 1 1 230px; }
.hhd-rosie-resource-toolbar select, .hhd-rosie-provider-governance input, .hhd-rosie-provider-governance textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--hhd-border, #b9cade); background: var(--hhd-surface, #fff); color: inherit; padding: .6rem; border-radius: 8px; }
.hhd-rosie-resource-list { display: flex; gap: .4rem; overflow-x: auto; padding: .8rem 0; }
.hhd-rosie-resource-list li { list-style: none; flex: 0 0 auto; }
.hhd-rosie-resource-list button { max-width: min(300px, 80vw); }
.hhd-rosie-resource-editor { border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 12px; padding: 1rem; margin: .6rem 0; }

.hhd-rosie-preferences-switch { display: flex; flex-wrap: wrap; gap: .45rem; margin: .75rem 0; }
.hhd-rosie-preferences-switch button[aria-pressed="true"] { border-color: var(--hhd-accent, #176bf2); font-weight: 700; }
.hhd-rosie-provider-governance .hhd-rosie-preferences-grid label:first-child { display: grid; }

/* ROSIE preferences: one bounded work area; no infrastructure settings. */
.hhd-rosie-preferences { min-width: 0; }
.hhd-rosie-preferences-navigation { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 .75rem; }
.hhd-rosie-preferences-navigation button { min-width: 7.25rem; padding: .5rem .8rem; }
.hhd-rosie-preferences-navigation button[aria-pressed="true"] { border-color: var(--hhd-accent, #176bf2); background: rgba(32, 111, 220, .09); font-weight: 700; }
.hhd-rosie-preferences-panel { min-width: 0; height: clamp(260px, 40vh, 385px); overflow-y: auto; overflow-x: hidden; border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 12px; background: var(--hhd-surface, #fff); }
.hhd-rosie-preferences-section { padding: .95rem; min-width: 0; }
.hhd-rosie-pref-enable { display: flex; align-items: center; gap: .55rem; font-weight: 600; margin-bottom: .85rem; }
.hhd-rosie-pref-instructions { display: grid; gap: .4rem; min-width: 0; }
.hhd-rosie-pref-instructions textarea { width: 100%; min-width: 0; box-sizing: border-box; resize: vertical; max-height: 230px; border: 1px solid var(--hhd-border, #b9cade); border-radius: 8px; padding: .65rem; color: inherit; background: var(--hhd-surface, #fff); }
.hhd-rosie-pref-numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem .75rem; }
.hhd-rosie-pref-numbers label { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: .4rem; min-width: 0; font-size: .9rem; }
.hhd-rosie-pref-numbers input[type="number"] { box-sizing: border-box; width: min(100%, 10.5rem); min-height: 2.3rem; padding: .4rem .5rem; border: 1px solid var(--hhd-border, #b9cade); border-radius: 8px; background: var(--hhd-surface, #fff); color: inherit; font-variant-numeric: tabular-nums; }
.hhd-rosie-advanced-preferences { margin: 1.1rem 0 .2rem; }
.hhd-rosie-advanced-preferences summary { cursor: pointer; font-weight: 650; margin-bottom: .8rem; }
.hhd-rosie-pref-history-heading { display: flex; justify-content: space-between; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.hhd-rosie-pref-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: .8rem; }
.hhd-rosie-pref-comparison > div { min-width: 0; border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 9px; padding: .7rem; }
.hhd-rosie-pref-comparison h4 { margin: .15rem 0 .5rem; }
.hhd-rosie-pref-comparison p { margin: .45rem 0; overflow-wrap: anywhere; }
.hhd-rosie-pref-instruction-preview { white-space: pre-wrap; max-height: 100px; overflow: auto; }
.hhd-rosie-preferences-footer { display: flex; align-items: end; gap: .85rem; padding: .85rem 0 .4rem; flex-wrap: wrap; }
.hhd-rosie-preferences-footer label { flex: 1 1 18rem; max-width: 35rem; display: grid; gap: .35rem; }
.hhd-rosie-preferences-footer input { width: 100%; min-height: 2.4rem; box-sizing: border-box; padding: .4rem .6rem; color: inherit; background: var(--hhd-surface, #fff); border: 1px solid var(--hhd-border, #b9cade); border-radius: 8px; }
.hhd-rosie-preferences :is(button, input, textarea, summary):focus-visible { outline: 3px solid var(--hhd-accent, #176bf2); outline-offset: 2px; }
@media (max-width: 900px) { .hhd-rosie-pref-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .hhd-rosie-preferences-panel { height: clamp(245px, 42dvh, 360px); } .hhd-rosie-pref-comparison { grid-template-columns: 1fr; } .hhd-rosie-preferences-footer { align-items: stretch; } }

/* HHD-CHAT-UI-I01: bounded native Syncfusion conversation display. */
.hhd-agent-chat-surface { height: clamp(260px, 45dvh, 480px); min-height: 0; min-width: 0;
    border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 12px; overflow: hidden;
    background: var(--hhd-surface, #fff); }
.hhd-agent-chat-syncfusion, .hhd-agent-chat-syncfusion .e-chat-content { min-width: 0; }
.hhd-agent-chat-syncfusion .e-message-text { overflow-wrap: anywhere; }
@media (max-width: 620px) {
    .hhd-agent-chat-surface { height: clamp(230px, 40dvh, 385px); }
}

/* HHD-CHAT-UI-I02 — native Syncfusion composition and governed recovery.
   Chat is one bounded work area; no duplicate legacy compose form. */
.hhd-rosie-chat-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
    margin: .2rem 0 .55rem; min-width: 0;
}
.hhd-rosie-chat-toolbar button { padding: .35rem .65rem; }
.hhd-rosie-chat-toolbar [role="status"] { color: var(--hhd-text-muted, #42526b); font-size: .85rem; }
.hhd-agent-chat-surface {
    height: clamp(320px, 53dvh, 660px);
    display: flex; flex-direction: column;
}
.hhd-agent-chat-surface .e-chat-ui { min-height: 0; flex: 1 1 auto; }
.hhd-agent-chat-surface .e-footer { border-top: 1px solid var(--hhd-border, #d5e2f4); }
.hhd-agent-chat-date { font-size: .81rem; color: var(--hhd-text-muted, #42526b); }
.hhd-agent-chat-empty { text-align: center; padding: 2.1rem .9rem; color: var(--hhd-text-muted, #42526b); }
.hhd-rosie-pending-message {
    margin-top: .6rem; padding: .75rem; background: var(--hhd-surface, #fff);
    border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 10px;
}
.hhd-rosie-pending-message p { margin: .3rem 0; }
.hhd-rosie-pending-message blockquote {
    margin: .4rem 0 .7rem; padding: .55rem .7rem;
    border-left: 3px solid var(--hhd-accent, #176bf2);
    white-space: pre-wrap; overflow-wrap: anywhere; max-height: 5rem; overflow-y: auto;
}
.hhd-rosie-pending-message button { margin: .25rem .4rem .25rem 0; }
.hhd-rosie-input-guidance { margin: .4rem 0 .2rem; font-size: .81rem; color: var(--hhd-text-muted, #42526b); }
.hhd-agent-chat-surface :is(button, textarea, input):focus-visible,
.hhd-rosie-chat-toolbar button:focus-visible,
.hhd-rosie-pending-message button:focus-visible {
    outline: 3px solid var(--hhd-accent, #176bf2); outline-offset: 2px;
}
@media (max-width: 620px) {
    .hhd-agent-chat-surface { height: clamp(280px, 52dvh, 525px); }
    .hhd-rosie-chat-toolbar { row-gap: .3rem; }
}

/* HHD-CHAT-UI-I02-FIX01 — contextual navigation in Syncfusion dialog.
   The native close control stays native: OnClose is canceled while in a child
   view and navigates back to Agentes; root close still disposes presentation. */
.hhd-agents-dialog-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem; line-height: 1.3; }
.hhd-agents-dialog-heading-separator { color: var(--hhd-text-muted, #526781); margin: 0 .25rem; }
.hhd-rosie-conversation-history {
    margin: .1rem 0 .75rem; padding: .8rem;
    border: 1px solid var(--hhd-border, #d5e2f4);
    border-radius: 10px; background: var(--hhd-surface, #fff);
}
.hhd-rosie-conversation-history-header {
    display: flex; justify-content: space-between; align-items: center; gap: .65rem; flex-wrap: wrap;
    margin-bottom: .5rem;
}
.hhd-rosie-conversation-history-header button,
.hhd-rosie-conversation-history > button { padding: .3rem .65rem; }
.hhd-rosie-conversation-history-list {
    max-height: min(27dvh, 220px); overflow-y: auto; overscroll-behavior: contain;
    display: grid; gap: .35rem; padding: .15rem;
}
.hhd-rosie-conversation-history-list > div { min-width: 0; }
.hhd-agents-workspace .hhd-rosie-conversation-choice {
    display: block; width: 100%; padding: .55rem .65rem;
    text-align: start; font-size: .875rem; overflow-wrap: anywhere;
}
.hhd-agents-workspace .hhd-rosie-conversation-choice[aria-pressed="true"] {
    font-weight: 650; border-color: var(--hhd-accent, #176bf2);
    background: rgba(32, 111, 220, .08);
}
@media (max-width: 620px) {
    .hhd-agents-dialog .e-dlg-header h2 { font-size: 1.15rem; }
    .hhd-rosie-conversation-history-list { max-height: 22dvh; }
}

.hhd-agents-dialog-header-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-width: 0; }
.hhd-agents-dialog-header-row h2 { min-width: 0; flex: 1 1 auto; }
.hhd-agents-dialog .hhd-agents-dialog-close {
    border: 0; border-radius: 6px; background: transparent; color: var(--hhd-text-muted, #526781);
    cursor: pointer; flex: 0 0 auto; padding: .2rem .45rem; font-size: 1.5rem; line-height: 1.2;
}
.hhd-agents-dialog .hhd-agents-dialog-close:hover { background: rgba(30, 75, 120, .09); }
.hhd-agents-dialog .hhd-agents-dialog-close:focus-visible { outline: 3px solid var(--hhd-accent, #176bf2); outline-offset: 2px; }

/* HHD-CHAT-UI-I03 — governed, bounded conversation workarea.
   Opening the history panel must NEVER increase modal/workarea height. */
.hhd-agents-dialog .e-dlg-content:has(.hhd-rosie-chat-workarea) {
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: min(83dvh, 850px);
    box-sizing: border-box;
}
.hhd-agents-workspace:has(.hhd-rosie-chat-workarea) {
    flex: 1 1 auto; min-height: 0; min-width: 0;
    display: flex; flex-direction: column;
}
.hhd-rosie-chat-workarea {
    position: relative;
    display: flex; flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; min-width: 0;
}
.hhd-rosie-chat-workarea > .hhd-agent-chat-surface {
    flex: 1 1 auto; min-height: 0;
    height: auto;
}
.hhd-rosie-chat-workarea > .hhd-rosie-conversation-history {
    position: absolute;
    inset-inline: 0;
    top: 3.4rem;
    z-index: 20;
    max-height: min(45dvh, 360px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--hhd-surface, #fff);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .15);
}
.hhd-rosie-chat-workarea .hhd-rosie-conversation-history-list {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
}
.hhd-rosie-chat-workarea .hhd-rosie-pending-message { flex: 0 0 auto; }
.hhd-rosie-chat-workarea .hhd-rosie-input-guidance { flex: 0 0 auto; }
.hhd-rosie-chat-workarea .hhd-rosie-diagnostic-details { flex: 0 0 auto; }
.hhd-agent-chat-syncfusion .hhd-agent-rich-code {
    white-space: pre-wrap; overflow-x: auto; overflow-wrap: anywhere;
    max-width: 100%; padding: .55rem;
    background: var(--hhd-surface-muted, #eff4fc);
}
.hhd-agent-chat-syncfusion .hhd-agent-unverified-citation {
    display: inline;
    padding: .08rem .18rem;
    border: 1px dashed var(--hhd-border, #aacaf2);
    border-radius: 3px;
    font-size: .9em;
}
.hhd-agent-chat-syncfusion .e-message-text :is(h4, h5, h6) { margin: .55rem 0 .25rem; }
.hhd-agent-chat-syncfusion .e-message-text :is(p, ul, ol, blockquote) { margin: .25rem 0 .5rem; }
.hhd-agent-chat-syncfusion .e-message-text :is(ul, ol) { padding-inline-start: 1.25rem; }
.hhd-agent-chat-syncfusion .e-message-text blockquote {
    border-inline-start: 3px solid var(--hhd-border, #aacaf2);
    padding-inline-start: .65rem;
}
@media (max-width: 620px) {
    .hhd-agents-dialog .e-dlg-content:has(.hhd-rosie-chat-workarea) { height: min(79dvh, 740px); }
    .hhd-rosie-chat-workarea > .hhd-rosie-conversation-history { max-height: min(40dvh, 310px); top: 5.8rem; }
}

/* I03-FIX02: stable title, secondary last-message date and bounded rename task. */
.hhd-rosie-conversation-history-row {
    display: flex; align-items: stretch; gap: .4rem; min-width: 0;
}
.hhd-rosie-conversation-history-row .hhd-rosie-conversation-choice {
    flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
    gap: .15rem; align-items: flex-start;
}
.hhd-rosie-conversation-choice strong { font-weight: 600; }
.hhd-rosie-conversation-choice small {
    font-weight: 400; font-size: .74rem; color: var(--hhd-text-muted, #526781);
}
.hhd-rosie-conversation-rename-action { flex: 0 0 auto; align-self: center; }
.hhd-rosie-conversation-rename { display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: .35rem; }
.hhd-rosie-conversation-rename input {
    flex: 1 1 13rem; min-width: 0; padding: .45rem .65rem;
    border: 1px solid var(--hhd-border, #d5e2f4); border-radius: 6px;
    color: var(--hhd-text, inherit); background: var(--hhd-surface, #fff);
}
.hhd-rosie-conversation-history-row :focus-visible {
    outline: 2px solid var(--hhd-accent, #176bf2); outline-offset: 2px;
}
@media (max-width: 440px) {
    .hhd-rosie-conversation-rename-action { padding-inline: .35rem; }
}
/* HHD-CHAT-UI-C01: governed Markdown presentation within the existing SfChatUI. */
.hhd-agent-chat-syncfusion .hhd-agent-table-scroll {
    max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain;
    margin-block: .45rem;
}
.hhd-agent-chat-syncfusion .hhd-agent-table-scroll table {
    width: max-content; min-width: min(100%, 22rem);
    border-collapse: collapse; font-size: .94em;
}
.hhd-agent-chat-syncfusion .hhd-agent-table-scroll :is(th, td) {
    padding: .35rem .55rem; border: 1px solid var(--hhd-border, #aacaf2);
    text-align: start; vertical-align: top; overflow-wrap: anywhere;
}
.hhd-agent-chat-syncfusion .hhd-agent-table-scroll th {
    font-weight: 650; background: var(--hhd-surface-muted, #eff4fc);
}
.hhd-agent-chat-syncfusion .e-message-text :is(code, pre, a) {
    overflow-wrap: anywhere;
}
.hhd-agent-chat-syncfusion .e-message-text code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.hhd-agent-chat-syncfusion .e-message-text .hhd-agent-external-link {
    color: var(--hhd-link, var(--hhd-accent, #145eac));
    text-decoration: underline; text-underline-offset: 2px;
}
.hhd-agent-chat-syncfusion .e-message-text .hhd-agent-external-link:focus-visible {
    outline: 2px solid var(--hhd-focus, currentColor); outline-offset: 3px;
}
.hhd-agent-chat-syncfusion .e-message-text hr {
    border: 0; border-top: 1px solid var(--hhd-border, #aacaf2);
    margin: .65rem 0;
}

/* C02: native Syncfusion lazy rendering, truthful persisted message status,
   in-flight agent activity and accessible view-density control. */
.hhd-rosie-chat-toolbar [aria-pressed="true"] {
    background: var(--hhd-surface-muted, #eff4fc);
    border-color: var(--hhd-accent, #176bf2);
}
.hhd-rosie-chat-toolbar [aria-pressed]:focus-visible {
    outline: 2px solid var(--hhd-focus, var(--hhd-accent, #176bf2));
    outline-offset: 2px;
}
.hhd-agent-chat-syncfusion .e-message-status {
    font-size: .75rem;
    color: var(--hhd-text-muted, #526781);
}

/* HHD-FILES-F02-FIX02: Syncfusion moves this dialog to body. Map HHD resolved
   theme tokens INSIDE the dialog; do not rely on parent workspace inheritance. */
html.hhd-theme-dark .hhd-agents-dialog,
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog {
  --hhd-surface: var(--hhd-surface-panel);
  --hhd-text: var(--hhd-text-primary);
  --hhd-text-muted: var(--hhd-text-secondary);
  background:var(--hhd-surface-panel);
  color:var(--hhd-text-primary);
  border-color:var(--hhd-border-strong);
  color-scheme:dark;
}
html.hhd-theme-dark .hhd-agents-dialog :is(.e-dlg-header-content,.e-dlg-content,.e-footer-content),
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog :is(.e-dlg-header-content,.e-dlg-content,.e-footer-content) {
  background:var(--hhd-surface-panel);
  color:var(--hhd-text-primary);
  border-color:var(--hhd-border);
}
html.hhd-theme-dark .hhd-agents-dialog .hhd-agents-workspace,
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog .hhd-agents-workspace { color:var(--hhd-text-primary); }
html.hhd-theme-dark .hhd-agents-dialog .hhd-rosie-hero,
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog .hhd-rosie-hero {
  background:linear-gradient(125deg,rgba(48,135,248,.12),transparent 55%),var(--hhd-surface-panel);
}
html.hhd-theme-dark .hhd-agents-dialog .hhd-agents-workspace button:not(.hhd-agents-primary),
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog .hhd-agents-workspace button:not(.hhd-agents-primary) {
  background:var(--hhd-surface-elevated); color:var(--hhd-text-primary);
}
html.hhd-theme-dark .hhd-agents-dialog .hhd-agents-primary,
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog .hhd-agents-primary {
  background:var(--hhd-action-primary-bg); color:var(--hhd-action-primary-fg);
}
html.hhd-theme-dark .hhd-agents-dialog .hhd-rosie-error,
html[data-hhd-resolved-theme="dark"] .hhd-agents-dialog .hhd-rosie-error {
  background:var(--hhd-status-error-bg);color:var(--hhd-status-error-fg);
  border-color:var(--hhd-status-error-border);
}


/* SA-UI35 — Scottie shares the existing Agentes dialog and Rosie workspace.
   There is no second chat or competing scroll surface on /foundation. */
.hhd-scottie-agents-workspace{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1 1 auto;gap:.4rem}
.hhd-scottie-chat-workarea{height:min(72dvh,680px);min-height:290px}
.hhd-scottie-chat-workarea>.hhd-scottie-draft-section{flex:1 1 auto;display:flex;flex-direction:column;min-height:0;min-width:0;overflow:auto}
.hhd-scottie-chat-workarea .hhd-scottie-direct-chat{flex:1 1 auto;min-height:180px;height:auto}
.hhd-scottie-chat-workarea>.hhd-rosie-conversation-history{top:.4rem;max-height:min(58dvh,510px)}
.hhd-scottie-activity-panel{overflow-y:auto;max-height:68dvh;padding:.35rem}
.hhd-scottie-conversation-empty{display:grid;place-content:center;text-align:center;flex:1 1 auto;min-height:270px;border:1px solid var(--hhd-border,#d5e2f4);border-radius:10px}
.hhd-scottie-gate-reason{font-size:.85rem;margin:.15rem 0;padding:.35rem .6rem;border-inline-start:3px solid var(--hhd-border,#b6cade);background:rgba(120,145,180,.08)}
/* SA-UI39-FIX01 — Reuse Rosie row sizing: the title and Rename control
   must share one horizontal row. The former blanket button width:100%
   squeezed titles into vertical columns and created horizontal overflow.
   Only standalone actions (e.g. Load more) may span the entire list. */
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-list > button {
  width:100%; text-align:start;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-list {
  overflow-x:hidden;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-row {
  min-width:0; width:100%;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-row .hhd-rosie-conversation-choice {
  flex:1 1 0%; width:auto; min-width:0; max-width:100%;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-row .hhd-rosie-conversation-choice strong {
  max-width:100%; overflow-wrap:break-word;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-row .hhd-rosie-conversation-rename-action {
  flex:0 0 auto; width:auto;
}
.hhd-scottie-agents-workspace .hhd-rosie-conversation-history-list small{display:block;opacity:.75}
.hhd-scottie-chat-workarea>.hhd-agent-chat-surface{flex:1 1 auto;min-height:0;height:auto}
@media(max-width:620px){.hhd-scottie-chat-workarea{height:min(70dvh,610px)}.hhd-scottie-chat-workarea>.hhd-rosie-conversation-history{max-height:50dvh}}

/* SA-UI36: system-agent cards select the single featured agent; actions exist
   only in the featured agent's authorised action bar. */
.hhd-agents-system-rail > [role="listitem"] { min-width: 0; display: flex; }
.hhd-agents-workspace .hhd-agent-selection {
    display: flex; gap: .8rem; align-items: center; width: 100%; min-width: 0;
    padding: .6rem; text-align: start; border-radius: 12px;
}
.hhd-agent-selection img { flex: 0 0 auto; width: 60px; height: 68px; object-fit: contain; }
.hhd-agent-selection span { min-width: 0; }
.hhd-agent-selection strong, .hhd-agent-selection small { display: block; overflow-wrap: anywhere; }
.hhd-agent-selection small { font-size: .8rem; margin-top: .25rem; color: var(--hhd-text-muted, #60758d); }
.hhd-agents-workspace .hhd-agent-selection[aria-pressed="true"] {
    border-color: var(--hhd-accent, #176bf2);
    box-shadow: 0 0 0 2px rgba(23,107,242,.16);
    background: var(--hhd-surface-muted, #eff4fc);
}
@media (max-width: 680px) {
    .hhd-agents-main-grid { grid-template-columns: 1fr; }
    .hhd-rosie-hero { grid-template-columns: minmax(90px, 30%) minmax(0, 1fr); }
    .hhd-agents-system-rail > * { flex-basis: min(210px, 80vw); }
}

/* SA-UI37: Scottie preferences live in the same Agentes modal as Rosie.
   There must be no nested dialog or second backdrop on this route. */
.hhd-scottie-agents-workspace .hhd-scottie-inline-preferences { min-width:0; }
.hhd-scottie-agents-workspace .hhd-scottie-inline-preferences .hhd-scottie-settings-body { min-width:0; }
.hhd-scottie-agents-workspace .hhd-scottie-settings-meta { margin-bottom:.3rem; }
.hhd-scottie-agents-workspace .hhd-scottie-gate-evidence { color:var(--hhd-text-muted,#526984);font-size:.76rem;margin:.3rem 0 .65rem; }
.hhd-scottie-agents-workspace .hhd-scottie-gate-evidence code { overflow-wrap:anywhere; }
@media(max-width:620px) { .hhd-scottie-agents-workspace .hhd-scottie-settings-numbers {grid-template-columns:repeat(2,minmax(0,1fr));} }

/* SA-UI42: contextual, reusable agent usage dialog, no operational action. */
.hhd-agent-usage-dialog .e-dlg-content { max-height: min(72vh, 720px); overflow-y: auto; }
.hhd-agent-usage-heading { display:flex; justify-content:space-between; gap:1rem; align-items:center; }
.hhd-agent-usage-heading button { min-width:2rem; min-height:2rem; }
.hhd-agent-usage-content { display:grid; gap:1rem; padding:.25rem; }
.hhd-agent-usage-state { font-weight:600; margin:0; }
.hhd-agent-usage-meter { display:grid; gap:.45rem; padding:.85rem; border:1px solid #d7e0eb; border-radius:.65rem; }
.hhd-agent-usage-meter .hhd-agent-usage-line { display:flex; justify-content:space-between; flex-wrap:wrap; gap:.5rem; }
.hhd-agent-usage-meter progress { width:100%; height:.75rem; accent-color:#3462cc; }
.hhd-agent-usage-meter p { margin:0; }
.hhd-agent-usage-meter small, .hhd-agent-usage-note { color:#455469; }
.hhd-agent-usage-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:.5rem; }
.hhd-agent-usage-actions button { min-height:2.3rem; }
@media(max-width:520px) { .hhd-agent-usage-meter .hhd-agent-usage-line { flex-direction:column; } }
