.ub-agent-header-button {
  display: inline-grid;
  box-sizing: border-box;
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  place-items: center;
  padding: 0;
  border-color: rgba(103, 198, 255, .62);
  border-radius: 8px;
  background: linear-gradient(145deg, #173f68, #10263e);
  color: #dff4ff;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.ub-agent-header-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ub-agent-modal { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; box-sizing: border-box; padding: 1rem; }
.ub-agent-modal[hidden] { display: none; }
.ub-agent-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 7, 15, .78); backdrop-filter: blur(5px); }
.ub-agent-modal-dialog { position: relative; z-index: 1; box-sizing: border-box; width: min(760px, 100%); max-height: min(88vh, 860px); overflow-y: auto; border: 1px solid rgba(106, 167, 220, .52); border-radius: 14px; background: #071b2c; box-shadow: 0 28px 90px rgba(0, 0, 0, .58); }
.ub-agent-modal-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .75rem 1rem; border-bottom: 1px solid rgba(129, 192, 246, .24); background: rgba(7, 27, 44, .98); }
.ub-agent-modal-toolbar h2 { margin: 0; font-size: 1rem; }
.ub-agent-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.ub-agent-ready-state { display: grid; justify-items: center; gap: .55rem; padding: 2rem 1rem 2.25rem; text-align: center; }
.ub-agent-ready-state h3, .ub-agent-ready-state p { margin: 0; }
.ub-agent-ready-state p { max-width: 560px; color: #a8bfd5; line-height: 1.55; }
.ub-agent-ready-icon { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(103, 198, 255, .62); border-radius: 12px; background: linear-gradient(145deg, #173f68, #10263e); color: #dff4ff; font-size: 1rem; font-weight: 900; }
.ub-agent-ready-action { min-height: 44px; border-color: #4ea7f4; background: linear-gradient(135deg, #1683ff, #0a57c9); color: #fff; }

.ub-agent-panel {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid rgba(106, 167, 220, .42);
  border-top: 4px solid #55b9ff;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(145deg, rgba(6, 22, 38, .98), rgba(12, 42, 67, .96));
  box-shadow: 0 18px 45px rgba(0, 0, 0, .24);
}

.ub-agent-header { display: flex; align-items: flex-start; gap: .85rem; }
.ub-agent-avatar-wrap { flex: 0 0 64px; width: 64px; height: 64px; overflow: hidden; border: 1px solid rgba(129, 192, 246, .42); border-radius: 9px; background: #112f4c; }
.ub-agent-avatar { display: block; width: 100%; height: 100%; object-fit: cover; }
.ub-agent-header-content { display: grid; min-width: 0; gap: .25rem; }
.ub-agent-badge { width: fit-content; padding: .2rem .48rem; border: 1px solid rgba(102, 204, 255, .5); border-radius: 999px; background: rgba(22, 131, 255, .2); color: #bfe8ff; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ub-agent-name { overflow-wrap: anywhere; }
.ub-agent-description { margin: 0; color: #bad0e3; line-height: 1.5; overflow-wrap: anywhere; }
.ub-agent-status { color: #a8bfd5; font-size: .78rem; font-weight: 700; text-transform: capitalize; }
.ub-agent-status[data-status="online"] { color: #85e0ae; }
.ub-agent-status[data-status="busy"] { color: #ffd27a; }
.ub-agent-identity { display: grid; gap: .55rem; margin-top: .8rem; padding: .7rem; border: 1px solid rgba(129, 192, 246, .28); border-radius: 9px; background: rgba(5, 24, 41, .58); }
.ub-agent-identity-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem; }
.ub-agent-verification { padding: .2rem .45rem; border: 1px solid rgba(255, 202, 112, .45); border-radius: 999px; color: #ffd27a; font-size: .68rem; font-weight: 800; }
.ub-agent-verification[data-status="attested"] { border-color: rgba(92, 221, 151, .52); color: #85e0ae; }
.ub-agent-identity-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem .55rem; margin: 0; font-size: .76rem; }
.ub-agent-identity-details dt { color: #8dabc5; font-weight: 800; }
.ub-agent-identity-details dd { min-width: 0; margin: 0; color: #d7eaff; overflow-wrap: anywhere; }
.ub-agent-service-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.ub-agent-service-link { padding: .3rem .52rem; border: 1px solid rgba(102, 204, 255, .38); border-radius: 7px; color: #bfe8ff; font-size: .72rem; font-weight: 800; }
.ub-agent-verification-note { margin: 0; color: #9db5ca; font-size: .72rem; line-height: 1.45; }
.ub-agent-capabilities, .ub-agent-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.ub-agent-capability { padding: .25rem .5rem; border: 1px solid rgba(129, 192, 246, .3); border-radius: 999px; background: rgba(20, 76, 123, .22); color: #c8e7ff; font-size: .72rem; }
.ub-agent-suggestion { min-height: 38px; padding: .42rem .62rem; border-radius: 8px; background: rgba(16, 42, 69, .9); text-align: left; white-space: normal; }
.ub-agent-messages { display: grid; gap: .55rem; max-height: 360px; margin-top: .9rem; padding: .75rem; overflow-y: auto; border: 1px solid rgba(123, 173, 214, .22); border-radius: 10px; background: rgba(2, 12, 22, .65); }
.ub-agent-message { width: fit-content; max-width: min(88%, 680px); padding: .55rem .68rem; border-radius: 10px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.ub-agent-message-user { justify-self: end; background: #155c94; color: #fff; }
.ub-agent-message-assistant { justify-self: start; background: #132d46; color: #e8f5ff; }
.ub-agent-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; align-items: end; margin-top: .65rem; }
.ub-agent-input { width: 100%; min-width: 0; max-height: 180px; resize: vertical; }
.ub-agent-send { min-width: 88px; min-height: 44px; border-color: #4ea7f4; background: linear-gradient(135deg, #1683ff, #0a57c9); color: #fff; }
.ub-agent-loading, .ub-agent-connection-note { margin: .65rem 0 0; color: #a8bfd5; }
.ub-agent-error { margin: .65rem 0 0; color: #ffb5c7; overflow-wrap: anywhere; }
.ub-agent-message-owner { margin-top: .65rem; }
.ub-agent-selected-item { outline: 3px solid #55b9ff; outline-offset: 3px; }
.ub-agent-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.ub-agent-settings { display: grid; gap: .75rem; margin-top: .75rem; padding: .85rem; border: 1px solid rgba(95, 183, 242, .34); border-radius: 10px; background: rgba(12, 48, 77, .2); }
.ub-agent-settings-heading { display: grid; gap: .2rem; }
.ub-agent-settings-kicker { margin: 0; color: #8dcbff; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ub-agent-settings-help { margin: 0; color: #a8bfd5; line-height: 1.5; }
.ai-agent-dedicated-note { margin: 0; padding: .7rem .8rem; border: 1px solid rgba(95, 183, 242, .42); border-radius: 8px; color: #d8ecff; background: rgba(23, 91, 139, .22); line-height: 1.5; }
.ai-agent-dedicated-note code { color: #9fd4ff; }
.ai-agent-readiness { display: grid; gap: .65rem; border: 1px solid rgba(92, 211, 192, .28); border-radius: 10px; padding: .8rem; background: rgba(7, 34, 38, .34); }
.ai-agent-readiness-head { display: flex; align-items: end; justify-content: space-between; gap: .75rem; }
.ai-agent-readiness-head > div { display: grid; gap: .15rem; }
.ai-agent-readiness-head > strong { color: #a9d8cf; font-size: .78rem; }
.ai-agent-readiness ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin: 0; padding: 0; list-style: none; }
.ai-agent-readiness li { position: relative; min-width: 0; border: 1px solid rgba(136, 158, 166, .22); border-radius: 7px; padding: .48rem .55rem .48rem 1.75rem; color: #98abb2; font-size: .75rem; }
.ai-agent-readiness li::before { content: ""; position: absolute; left: .6rem; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #74868e; transform: translateY(-50%); }
.ai-agent-readiness li[data-status="ready"] { border-color: rgba(92, 211, 192, .3); color: #c9eee6; background: rgba(36, 126, 116, .12); }
.ai-agent-readiness li[data-status="ready"]::before { background: #5cd3c0; box-shadow: 0 0 0 3px rgba(92, 211, 192, .12); }
.ub-agent-profile-identity-link { width: fit-content; color: #8dcbff; font-size: .82rem; font-weight: 800; text-underline-offset: 3px; }
.ub-agent-profile-identity-link:focus-visible { outline: 2px solid #8dcbff; outline-offset: 3px; border-radius: 3px; }
.ub-agent-standard-settings { display: grid; gap: .65rem; margin: 0; padding: .75rem; border: 1px solid rgba(129, 192, 246, .26); border-radius: 9px; }
.ub-agent-standard-settings legend { padding: 0 .35rem; color: #c8e7ff; font-weight: 800; }
.ub-agent-standard-link { color: #8dcbff; font-weight: 800; text-underline-offset: 3px; }
.ub-agent-erc8004-settings { border-color: rgba(126, 235, 195, .42); background: linear-gradient(145deg, rgba(6, 38, 43, .46), rgba(9, 28, 47, .34)); }
.ub-agent-erc8004-intro { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.ub-agent-erc8004-intro > div { display: grid; gap: .18rem; }
.ub-agent-erc8004-intro h4 { margin: 0; font-size: 1rem; }
.ub-agent-erc8004-draft { flex: 0 0 auto; border: 1px solid rgba(255, 193, 91, .48); border-radius: 999px; padding: .25rem .5rem; background: rgba(127, 77, 10, .24); color: #ffd58d; font-size: .68rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.ub-agent-erc8004-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .1rem 0; padding: 0; list-style: none; counter-reset: erc8004-step; }
.ub-agent-erc8004-flow li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .12rem .48rem; min-width: 0; border: 1px solid rgba(126, 235, 195, .2); border-radius: 8px; padding: .55rem; background: rgba(6, 49, 51, .28); color: #d7f5ec; }
.ub-agent-erc8004-flow li::before { counter-increment: erc8004-step; content: counter(erc8004-step); grid-row: 1 / span 2; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: #177e71; color: #fff; font-size: .72rem; font-weight: 900; }
.ub-agent-erc8004-flow strong { font-size: .78rem; }
.ub-agent-erc8004-flow span { color: #9fc5c0; font-size: .69rem; line-height: 1.35; }
.ub-agent-setting-field small { color: #91aebd; font-size: .7rem; font-weight: 500; line-height: 1.4; }
.ub-agent-erc8004-actions, .ub-agent-erc8004-contract-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ub-agent-erc8004-actions button { flex: 1 1 145px; }
.ub-agent-erc8004-contract-actions button { min-height: 44px; }
.ub-agent-erc8004-contract-actions .primary { border-color: #4fcab2; background: linear-gradient(135deg, #20a990, #14695f); color: #fff; }
.ub-agent-erc8004-contract-actions .ub-agent-standard-link { margin-left: auto; }
.ub-agent-erc8004-settings textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; line-height: 1.45; }
.ub-agent-erc8004-status { margin: 0; border: 1px solid rgba(129, 192, 246, .22); border-radius: 7px; padding: .6rem .7rem; background: rgba(8, 29, 47, .52); color: #b9d1e2; font-size: .76rem; line-height: 1.45; }
.ub-agent-erc8004-status[data-state="pending"] { border-color: rgba(255, 193, 91, .42); color: #ffe0a6; }
.ub-agent-erc8004-status[data-state="success"] { border-color: rgba(98, 222, 166, .48); color: #a8efd0; }
.ub-agent-erc8004-status[data-state="error"] { border-color: rgba(240, 117, 145, .48); color: #ffc0cf; }
.ub-agent-erc8004-import { border-top: 1px solid rgba(129, 192, 246, .16); padding-top: .55rem; color: #a8bfd5; font-size: .76rem; }
.ub-agent-erc8004-import summary { color: #cce6f7; font-weight: 800; cursor: pointer; }
.ub-agent-erc8004-import p { margin: .5rem 0 0; line-height: 1.5; }
.ub-agent-setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.ub-agent-setting-field { display: grid; min-width: 0; gap: .34rem; color: #c9dff1; font-size: .82rem; font-weight: 700; }
.ub-agent-setting-field input, .ub-agent-setting-field textarea, .ub-agent-setting-field select { width: 100%; min-width: 0; }
.ub-agent-setting-toggle { display: inline-flex; align-items: center; gap: .48rem; color: #d7eaff; font-weight: 700; }
.ub-agent-setting-toggle input { width: 1.1rem; height: 1.1rem; }
.ub-agent-action-settings { min-width: 0; margin: .1rem 0 0; padding: .85rem; border: 1px solid rgba(129, 192, 246, .3); border-radius: 9px; background: rgba(7, 25, 41, .34); }
.ub-agent-action-settings legend { padding: 0 .4rem; color: #d7ebfb; font-size: .9rem; font-weight: 800; }
.ub-agent-action-settings-help { margin: 0 0 .7rem; color: #9fb9cf; font-size: .78rem; line-height: 1.5; text-wrap: pretty; }
.ub-agent-action-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.ub-agent-action-option { display: grid; grid-template-columns: 20px minmax(0, 1fr); min-width: 0; min-height: 44px; align-items: center; gap: .6rem; padding: .55rem .65rem; border: 1px solid rgba(129, 192, 246, .2); border-radius: 7px; background: rgba(16, 51, 79, .42); color: #d3e6f5; cursor: pointer; transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out; }
.ub-agent-action-option:hover { border-color: rgba(129, 192, 246, .48); background: rgba(24, 69, 104, .5); }
.ub-agent-action-option:focus-within { border-color: #75bcf7; box-shadow: 0 0 0 2px rgba(117, 188, 247, .22); }
.ub-agent-action-option:has(input:checked) { border-color: rgba(78, 167, 244, .66); background: rgba(27, 92, 143, .4); }
.ub-agent-action-option input { width: 18px; height: 18px; margin: 0; accent-color: #4ea7f4; justify-self: center; }
.ub-agent-action-option span { min-width: 0; font-size: .8rem; font-weight: 700; line-height: 1.3; text-wrap: pretty; }

/* Public AI profile template. It intentionally inherits the existing UBNet card and theme tokens. */
.ai-agent-profile { display: grid; gap: 1rem; }
.ai-agent-profile[hidden] { display: none !important; }
.ai-agent-hero { display: grid; gap: 1rem; border-top-color: #68d7ff; background: linear-gradient(135deg, rgba(5, 18, 32, .98), rgba(11, 45, 73, .94)); }
.ai-agent-hero.has-agent-banner { background: linear-gradient(90deg, rgba(4, 16, 29, .96), rgba(7, 29, 49, .78)), var(--ai-agent-banner) center/cover no-repeat; }
.ai-agent-hero-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: start; }
.ai-agent-profile-avatar { display: grid; width: 96px; height: 96px; place-items: center; overflow: hidden; border: 2px solid rgba(104, 215, 255, .72); border-radius: 18px; background: radial-gradient(circle at 30% 20%, rgba(38, 151, 232, .72), rgba(8, 30, 50, .96)); color: #fff; font-size: 1.45rem; font-weight: 900; letter-spacing: .08em; }
.ai-agent-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ai-agent-hero-copy { display: grid; gap: .5rem; min-width: 0; }
.ai-agent-label-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ai-agent-type-label, .ai-agent-source-label { display: inline-flex; width: fit-content; align-items: center; border: 1px solid rgba(104, 215, 255, .45); border-radius: 999px; padding: .24rem .55rem; background: rgba(22, 131, 255, .18); color: #c8efff; font-size: .7rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.ai-agent-lede { max-width: 72ch; margin: 0; color: #c5d9ea; line-height: 1.55; }
.ai-agent-meta-grid { display: flex; flex-wrap: wrap; gap: .45rem; }
.ai-agent-meta-item { display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; border: 1px solid rgba(129, 192, 246, .24); border-radius: 8px; padding: .35rem .55rem; background: rgba(8, 31, 51, .62); color: #d9ecfb; font-size: .76rem; }
.ai-agent-meta-item strong { color: #8fb5d2; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.ai-agent-primary-actions, .ai-agent-action-grid { display: flex; flex-wrap: wrap; gap: .55rem; }
.ai-agent-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ai-agent-dashboard-grid > .card { margin: 0; }
.ai-agent-card-wide { grid-column: 1 / -1; }
.ai-agent-card { min-width: 0; }
.ai-agent-card-head { display: grid; gap: .2rem; margin-bottom: .8rem; }
.ai-agent-card [data-agent-content] { display: grid; gap: .7rem; }
.ai-agent-empty { margin: 0; border: 1px dashed rgba(129, 192, 246, .34); border-radius: 9px; padding: .8rem; color: #9eb5c8; line-height: 1.5; }
.ai-agent-definition-list { display: grid; gap: .55rem; margin: 0; }
.ai-agent-definition-list > div { display: grid; grid-template-columns: minmax(110px, .34fr) minmax(0, 1fr); gap: .65rem; padding-bottom: .5rem; border-bottom: 1px solid rgba(129, 192, 246, .15); }
.ai-agent-definition-list > div:last-child { padding-bottom: 0; border-bottom: 0; }
.ai-agent-definition-list dt { color: #91abc0; font-size: .75rem; font-weight: 800; }
.ai-agent-definition-list dd { min-width: 0; margin: 0; color: #e1eef8; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-agent-chip-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.ai-agent-chip { display: inline-flex; align-items: center; min-height: 32px; border: 1px solid rgba(104, 215, 255, .32); border-radius: 999px; padding: .35rem .62rem; background: rgba(20, 76, 123, .22); color: #d4efff; font-size: .76rem; font-weight: 700; }
.ai-agent-service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; }
.ai-agent-service-card, .ai-agent-source-card, .ai-agent-tool-card, .ai-agent-permission-group { display: grid; gap: .55rem; min-width: 0; border: 1px solid rgba(129, 192, 246, .2); border-radius: 10px; padding: .8rem; background: rgba(8, 29, 47, .62); }
.ai-agent-service-card h3, .ai-agent-source-card h3, .ai-agent-tool-card h3 { overflow-wrap: anywhere; }
.ai-agent-service-card p, .ai-agent-source-card p, .ai-agent-tool-card p { margin: 0; color: #adc3d6; line-height: 1.45; overflow-wrap: anywhere; }
.ai-agent-service-facts, .ai-agent-tool-flags { display: flex; flex-wrap: wrap; gap: .35rem; }
.ai-agent-service-facts span, .ai-agent-tool-flags span { border-radius: 6px; padding: .22rem .42rem; background: rgba(61, 124, 176, .18); color: #bcd9ed; font-size: .7rem; }
.ai-agent-tool-flags span[data-state="true"] { color: #8fe2b4; }
.ai-agent-tool-flags span[data-state="false"] { color: #9eb0bf; }
.ai-agent-permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.ai-agent-permission-group h3 { font-size: .9rem; }
.ai-agent-permission-group[data-risk="high"] { border-color: rgba(255, 183, 77, .48); background: rgba(89, 55, 9, .22); }
.ai-agent-warning-card { border-top-color: #f1b453; }
.ai-agent-warning { margin: 0; border: 1px solid rgba(255, 183, 77, .42); border-radius: 8px; padding: .65rem; background: rgba(101, 63, 11, .22); color: #ffe2a9; line-height: 1.5; }
.ai-agent-owner-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7rem; align-items: center; }
.ai-agent-owner-avatar { display: grid; width: 56px; height: 56px; place-items: center; overflow: hidden; border: 1px solid rgba(104, 215, 255, .4); border-radius: 12px; background: #112f4c; font-weight: 900; }
.ai-agent-owner-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ai-agent-owner-copy { display: grid; gap: .18rem; min-width: 0; }
.ai-agent-owner-copy span { color: #9fb7ca; font-size: .76rem; overflow-wrap: anywhere; }
.ai-agent-verified { color: #8fe2b4 !important; font-weight: 800; }
.ai-agent-unverified { color: #ffd27a !important; font-weight: 800; }
.ai-agent-status-badge { display: inline-flex; width: fit-content; align-items: center; gap: .38rem; border: 1px solid rgba(154, 172, 188, .42); border-radius: 999px; padding: .28rem .58rem; color: #c3cfda; font-size: .72rem; font-weight: 900; }
.ai-agent-status-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ai-agent-status-badge[data-status="online"] { border-color: rgba(77, 211, 139, .5); color: #85e0ae; }
.ai-agent-status-badge[data-status="busy"], .ai-agent-status-badge[data-status="limited"] { border-color: rgba(255, 202, 112, .5); color: #ffd27a; }
.ai-agent-status-badge[data-status="maintenance"], .ai-agent-status-badge[data-status="paused"], .ai-agent-status-badge[data-status="owner-disabled"], .ai-agent-status-badge[data-status="endpoint-unavailable"] { border-color: rgba(229, 126, 147, .5); color: #ffb5c7; }
.ai-agent-reputation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.ai-agent-reputation-metric { display: grid; gap: .18rem; border: 1px solid rgba(129, 192, 246, .18); border-radius: 8px; padding: .65rem; background: rgba(8, 29, 47, .48); }
.ai-agent-reputation-metric strong { font-size: 1.05rem; }
.ai-agent-reputation-metric span { color: #92aabe; font-size: .7rem; text-transform: uppercase; }
.ai-agent-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; color: #9fb7ca; font-size: .78rem; line-height: 1.5; }
.ai-agent-footer strong { color: #d8ebfa; }
.ai-agent-setup-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; counter-reset: agent-setup; }
.ai-agent-setup-flow li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .42rem; align-items: center; min-width: 0; border: 1px solid rgba(129, 192, 246, .22); border-radius: 8px; padding: .55rem; background: rgba(7, 25, 41, .38); color: #c9dff1; font-size: .74rem; line-height: 1.3; }
.ai-agent-setup-flow li::before { counter-increment: agent-setup; content: counter(agent-setup); display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #175b92; color: #fff; font-size: .7rem; font-weight: 900; }
.ai-agent-public-settings textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .76rem; }

/* Service-first public experience: the agent is a provider, while wallet/profile UI is supporting infrastructure. */
.page.app-profile { display: flex; width: min(1180px, calc(100% - 2rem)); flex-direction: column; }
.app-profile > #ub-agent-modal { order: 0; }
.app-profile > #aiAgentProfile { order: 1; }
.app-profile > #profileCard { order: 2; }
.app-profile > .profile-content-grid { order: 3; }
.ai-agent-profile { gap: 1.25rem; }
.ai-agent-hero { gap: 1.15rem; padding: 1.25rem; border-top: 0; border-color: rgba(92, 211, 192, .32); background: linear-gradient(125deg, rgba(5, 18, 29, .99), rgba(10, 42, 58, .96) 68%, rgba(29, 51, 45, .96)); box-shadow: 0 24px 70px rgba(0, 0, 0, .34); }
.ai-agent-hero.has-agent-banner { background: linear-gradient(90deg, rgba(4, 16, 25, .98), rgba(6, 31, 42, .9) 58%, rgba(19, 43, 38, .88)), var(--ai-agent-banner) center/cover no-repeat; }
.ai-agent-hero-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 1.25rem; align-items: stretch; }
.ai-agent-hero-content { display: flex; min-width: 0; flex-direction: column; justify-content: space-between; gap: 1.25rem; padding: .35rem; }
.ai-agent-hero-copy h1 { max-width: 18ch; font-size: clamp(2rem, 4.5vw, 3.6rem); line-height: .98; letter-spacing: -.035em; text-wrap: balance; }
.ai-agent-profile-avatar { width: 112px; height: 112px; border-color: rgba(92, 211, 192, .75); border-radius: 16px; background: radial-gradient(circle at 30% 20%, rgba(40, 177, 182, .76), rgba(8, 30, 42, .98)); box-shadow: 0 14px 32px rgba(0, 0, 0, .3); }
.ai-agent-type-label { border-color: rgba(92, 211, 192, .46); background: rgba(33, 139, 128, .2); color: #c9fff3; }
.ai-agent-request-console { display: grid; align-content: start; gap: .8rem; min-width: 0; border: 1px solid rgba(244, 185, 86, .38); border-radius: 12px; padding: 1rem; background: linear-gradient(160deg, rgba(13, 21, 27, .96), rgba(29, 29, 25, .93)); box-shadow: inset 0 1px rgba(255, 255, 255, .04); }
.ai-agent-request-heading { display: grid; gap: .2rem; }
.ai-agent-request-console > p { margin: 0; color: #bdc9cf; font-size: .86rem; line-height: 1.55; }
.ai-agent-quick-request-form { display: grid; gap: .65rem; }
.ai-agent-quick-request-form textarea { width: 100%; min-height: 116px; resize: vertical; border-color: rgba(244, 185, 86, .34); background: rgba(4, 10, 14, .82); line-height: 1.5; }
.ai-agent-quick-request-form textarea:focus { outline: 2px solid rgba(244, 185, 86, .5); outline-offset: 2px; }
.ai-agent-quick-request-form .primary { min-height: 46px; border-color: #d99c38; background: linear-gradient(135deg, #e6a43a, #b56d19); color: #111; font-weight: 900; }
.ai-agent-quick-prompts { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-agent-quick-prompts button { max-width: 100%; padding: .38rem .55rem; border-color: rgba(188, 202, 210, .22); background: rgba(255, 255, 255, .045); color: #c8d3d8; font-size: .72rem; text-align: left; }
.ai-agent-request-note { padding-top: .7rem; border-top: 1px solid rgba(255, 255, 255, .08); color: #91a1a8 !important; font-size: .72rem !important; }
.ai-agent-service-nav { display: flex; gap: .35rem; overflow-x: auto; border-top: 1px solid rgba(144, 192, 198, .16); padding-top: .85rem; scrollbar-width: thin; }
.ai-agent-service-nav a { flex: 0 0 auto; border-radius: 7px; padding: .45rem .65rem; color: #b7ced3; font-size: .75rem; font-weight: 800; }
.ai-agent-service-nav a:hover, .ai-agent-service-nav a:focus-visible { background: rgba(92, 211, 192, .1); color: #e5fff9; }
.ai-agent-services-primary { border-top-color: #5cd3c0; background: linear-gradient(135deg, rgba(5, 22, 31, .98), rgba(11, 42, 49, .92)); }
.ai-agent-card-head > p:not(.eyebrow) { max-width: 68ch; margin: .2rem 0 0; color: #a8bdc5; line-height: 1.5; }
.ai-agent-services-primary .ai-agent-service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-agent-services-primary .ai-agent-service-card { align-content: start; min-height: 190px; border-color: rgba(92, 211, 192, .24); background: rgba(4, 22, 29, .72); }
.ai-agent-services-primary .ai-agent-service-card h3 { font-size: 1.08rem; }
.ai-agent-services-primary .ai-agent-service-card button { align-self: end; margin-top: auto; }
.ai-agent-offers { border-top-color: #e2a446; background: linear-gradient(135deg, rgba(20, 18, 13, .98), rgba(43, 32, 17, .9)); }
.ai-agent-offer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .75rem; }
.ai-agent-offer-card { display: grid; align-content: start; gap: .65rem; min-width: 0; border: 1px solid rgba(226, 164, 70, .3); border-radius: 10px; padding: .9rem; background: rgba(18, 17, 14, .76); }
.ai-agent-offer-card p { margin: 0; color: #c6bda9; line-height: 1.5; }
.ai-agent-offer-card button { align-self: end; margin-top: auto; }
.ai-agent-offer-heading { display: grid; gap: .35rem; }
.ai-agent-offer-label { width: fit-content; border-radius: 5px; padding: .2rem .4rem; background: rgba(226, 164, 70, .16); color: #f6c97d; font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.ai-agent-conversation { border: 1px solid rgba(92, 211, 192, .4); border-top: 4px solid #5cd3c0; background: linear-gradient(135deg, rgba(4, 18, 25, .99), rgba(8, 34, 42, .96)); box-shadow: 0 20px 55px rgba(0, 0, 0, .28); }
.ai-agent-conversation-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.ai-agent-conversation-header > div:first-child { display: grid; gap: .25rem; }
.ai-agent-conversation-header p:not(.eyebrow) { max-width: 70ch; margin: 0; color: #a9bdc4; line-height: 1.5; }
.ai-agent-conversation-controls { display: flex; flex: 0 0 auto; align-items: center; gap: .5rem; }
.ai-agent-live-status { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid rgba(151, 169, 177, .35); border-radius: 999px; padding: .32rem .55rem; color: #b7c5ca; font-size: .7rem; font-weight: 900; }
.ai-agent-live-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ai-agent-live-status[data-status="online"] { border-color: rgba(92, 211, 192, .45); color: #83e5cf; }
.ai-agent-live-status[data-status="offline"] { color: #f0b5a7; }
.ai-agent-live-messages { display: grid; align-content: start; gap: .65rem; min-height: 180px; max-height: 420px; overflow-y: auto; border: 1px solid rgba(129, 192, 246, .2); border-radius: 10px; padding: .85rem; background: rgba(2, 11, 16, .76); scrollbar-width: thin; }
.ai-agent-live-messages .ub-agent-message { max-width: min(78%, 720px); margin: 0; }
.ai-agent-live-messages .ub-agent-message-assistant { justify-self: start; border-color: rgba(92, 211, 192, .25); background: rgba(22, 72, 74, .42); }
.ai-agent-live-messages .ub-agent-message-user { justify-self: end; }
.ai-agent-live-prompts { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.ai-agent-live-prompts button { max-width: 100%; text-align: left; }
.ai-agent-live-form { display: grid; grid-template-columns: minmax(170px, .34fr) minmax(0, 1fr) auto; gap: .6rem; align-items: end; margin-top: .8rem; }
.ai-agent-live-form label { display: grid; gap: .3rem; min-width: 0; color: #a9bdc4; font-size: .72rem; font-weight: 800; }
.ai-agent-live-form select, .ai-agent-live-form textarea { width: 100%; min-width: 0; }
.ai-agent-live-form select { min-height: 48px; }
.ai-agent-live-form textarea { min-height: 82px; resize: vertical; line-height: 1.45; }
.ai-agent-live-form button { min-height: 48px; }
.ai-agent-live-loading { margin-top: .65rem; color: #83e5cf; font-size: .78rem; }
.ai-agent-live-error { margin: .65rem 0 0; border: 1px solid rgba(229, 126, 147, .42); border-radius: 8px; padding: .65rem; background: rgba(92, 26, 43, .28); color: #ffc1d0; }
.ai-agent-live-note { margin: .7rem 0 0; color: #879ba3; font-size: .7rem; line-height: 1.45; }
.ai-agent-faq-list { display: grid; gap: .55rem; }
.ai-agent-faq-item { border: 1px solid rgba(129, 192, 246, .22); border-radius: 9px; background: rgba(5, 22, 31, .55); }
.ai-agent-faq-item summary { padding: .75rem .85rem; color: #e0edf1; font-weight: 800; cursor: pointer; }
.ai-agent-faq-answer { display: grid; gap: .65rem; padding: 0 .85rem .85rem; }
.ai-agent-faq-answer p { margin: 0; color: #aebfc6; line-height: 1.55; }
.ai-agent-faq-answer button { width: fit-content; }
.ai-agent-process { border-top-color: #e2a446; }
.ai-agent-process-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: 0; padding: 0; list-style: none; counter-reset: service-step; }
.ai-agent-process-steps li { position: relative; display: grid; gap: .35rem; min-width: 0; border-left: 2px solid rgba(226, 164, 70, .5); padding: .15rem .5rem .15rem 2.45rem; counter-increment: service-step; }
.ai-agent-process-steps li::before { content: counter(service-step); position: absolute; left: .55rem; top: .05rem; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 6px; background: #7b561f; color: #ffe3b4; font-size: .72rem; font-weight: 900; }
.ai-agent-process-steps strong { color: #f1f6f7; }
.ai-agent-process-steps span { color: #9fb2b9; font-size: .78rem; line-height: 1.45; }
.ai-agent-section-heading { display: grid; gap: .25rem; margin: .7rem 0 -.2rem; padding: .3rem .1rem; }
.ai-agent-section-heading h2 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
.ai-agent-section-heading > p:last-child { max-width: 72ch; margin: 0; color: #9fb4bd; line-height: 1.5; }
#profileCard { padding: .75rem 1rem; border-top-width: 1px; background: rgba(7, 20, 29, .74); box-shadow: none; }
#profileCard .profile-header, #profileCard #profileBio, #profileCard #profileLocation, #profileCard .profile-stats, #profileCard #profileActionRow { display: none !important; }
#profileCard:not(:has(#ownerActionRow:not([hidden]))):not(:has(#profileViewRow:not([hidden]))):not(:has(#pageStatus:not([hidden]))) { display: none; }
#profileCard #ownerActionRow, #profileCard #profileViewRow { margin: 0; }
.app-profile > .profile-content-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 1.5rem; }
.profile-content-grid .profile-main-column { order: 1; }
.profile-content-grid .profile-side-panel { order: 2; }
.agent-resources-section { border-top-color: #6e8792; background: linear-gradient(135deg, rgba(6, 17, 24, .96), rgba(12, 28, 38, .92)); }
.agent-resources-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.agent-resources-heading > div { display: grid; gap: .2rem; }
.agent-resources-heading > p { max-width: 58ch; margin: 0; color: #91a8b2; font-size: .78rem; line-height: 1.45; text-align: right; }
.profile-side-panel .block-features-card { border-top-color: #6e8792; box-shadow: none; }

@media (max-width: 780px) {
  .ub-agent-header-button { flex-basis: 40px; width: 40px; min-width: 40px; max-width: 40px; height: 40px; min-height: 40px; max-height: 40px; }
  .ub-agent-modal { padding: 0; align-items: end; }
  .ub-agent-modal-dialog { width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .ub-agent-modal-toolbar { padding: .65rem .75rem; }
  .ub-agent-panel { margin: 0; padding: .8rem; border-radius: 0; }
  .ub-agent-header { gap: .65rem; }
  .ub-agent-avatar-wrap { flex-basis: 52px; width: 52px; height: 52px; }
  .ub-agent-messages { max-height: 42vh; }
  .ub-agent-form { grid-template-columns: minmax(0, 1fr); }
  .ub-agent-send { width: 100%; }
  .ub-agent-setting-grid, .ub-agent-action-settings-grid, .ub-agent-erc8004-flow { grid-template-columns: minmax(0, 1fr); }
  .ub-agent-erc8004-intro { display: grid; }
  .ub-agent-erc8004-draft { width: fit-content; }
  .ub-agent-erc8004-contract-actions > * { flex: 1 1 100%; margin-left: 0 !important; text-align: center; }
  .ai-agent-hero-main { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-profile-avatar { width: 76px; height: 76px; }
  .ai-agent-dashboard-grid, .ai-agent-permission-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-card-wide { grid-column: auto; }
  .ai-agent-primary-actions > *, .ai-agent-action-grid > * { flex: 1 1 145px; }
  .ai-agent-definition-list > div { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .ai-agent-setup-flow { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-readiness ul { grid-template-columns: minmax(0, 1fr); }
  .page.app-profile { width: min(100% - 1rem, 1180px); }
  .ai-agent-hero { padding: .9rem; }
  .ai-agent-hero-layout { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-hero-main { grid-template-columns: auto minmax(0, 1fr); }
  .ai-agent-hero-copy h1 { font-size: clamp(1.8rem, 10vw, 2.7rem); }
  .ai-agent-profile-avatar { width: 72px; height: 72px; }
  .ai-agent-meta-grid { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
  .ai-agent-meta-item { flex: 0 0 auto; }
  .ai-agent-meta-item:nth-child(n+4) { display: none; }
  .ai-agent-hero-content > .ai-agent-primary-actions { display: none; }
  .ai-agent-services-primary .ai-agent-service-grid, .ai-agent-process-steps { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-services-primary .ai-agent-service-card { min-height: 0; }
  .ai-agent-offer-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-conversation-header { display: grid; }
  .ai-agent-conversation-controls { justify-content: space-between; }
  .ai-agent-live-form { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-live-form button { width: 100%; }
  .ai-agent-live-messages .ub-agent-message { max-width: 92%; }
  .agent-resources-heading { display: grid; }
  .agent-resources-heading > p { text-align: left; }
}

@media (min-width: 781px) and (max-width: 1020px) {
  .ai-agent-hero-layout { grid-template-columns: minmax(0, 1fr); }
  .ai-agent-services-primary .ai-agent-service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .ub-agent-selected-item { scroll-behavior: auto; }
}
