.agent-console {
    width: min(1120px, calc(100vw - 32px));
    height: min(760px, calc(100vh - 32px));
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface-1);
    color: var(--ink-1);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
    overflow: hidden;
}

.agent-console::backdrop { background: rgba(15, 23, 42, 0.62); backdrop-filter: blur(3px); }
.agent-console__shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
.agent-console__header, .agent-console__tabs { display: flex; align-items: center; border-bottom: 1px solid var(--line-1); }
.agent-console__header { justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); }
.agent-console__title { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.agent-console__title h2 { margin: 0; font-size: var(--text-xl); letter-spacing: 0; }
.agent-console__title p { margin: 2px 0 0; color: var(--ink-2); font-size: var(--text-sm); }
.agent-console__mode { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--flat) 38%, var(--line-1)); border-radius: 6px; color: var(--flat); font: 700 var(--text-xs)/1 var(--font-mono); white-space: nowrap; }
.agent-console__close, .agent-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-1); border-radius: 6px; background: var(--surface-1); color: var(--ink-2); cursor: pointer; }
.agent-console__close:hover, .agent-icon-btn:hover { background: var(--surface-2); color: var(--ink-1); }
.agent-console__close:focus-visible, .agent-icon-btn:focus-visible, .agent-tab:focus-visible, .agent-btn:focus-visible, .agent-list__item:focus-visible, .agent-field input:focus-visible, .agent-field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-console__tabs { gap: var(--sp-1); padding: 0 var(--sp-6); overflow-x: auto; }
.agent-tab { min-height: 44px; padding: 0 var(--sp-3); border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-2); font: 700 var(--text-sm)/1 var(--font-sans); cursor: pointer; white-space: nowrap; }
.agent-tab:hover { color: var(--ink-1); }
.agent-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.agent-console__body { min-height: 0; overflow: hidden; }
.agent-panel { display: none; height: 100%; }
.agent-panel.is-active { display: block; }
.agent-workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; }
.agent-list { min-width: 0; border-right: 1px solid var(--line-1); background: var(--surface-0); overflow-y: auto; }
.agent-list__toolbar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3); border-bottom: 1px solid var(--line-1); background: var(--surface-0); z-index: 1; }
.agent-list__toolbar strong { font-size: var(--text-sm); }
.agent-list__items { padding: var(--sp-2); }
.agent-list__item { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-2); padding: 11px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-1); text-align: left; cursor: pointer; }
.agent-list__item:hover { background: var(--surface-2); }
.agent-list__item.is-selected { border-color: color-mix(in srgb, var(--accent) 38%, var(--line-1)); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); }
.agent-list__name { overflow: hidden; text-overflow: ellipsis; font-weight: 750; white-space: nowrap; }
.agent-list__model { color: var(--ink-2); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-status { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: var(--text-xs); }
.agent-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.agent-status[data-status="active"]::before { background: var(--up); }
.agent-status[data-status="paused"]::before { background: var(--flat); }
.agent-status[data-status="revoked"]::before { background: var(--down); }
.agent-detail, .agent-table-wrap, .agent-protocol { min-width: 0; height: 100%; overflow-y: auto; padding: var(--sp-6); }
.agent-detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.agent-detail__head h3 { margin: 0 0 4px; font-size: var(--text-lg); }
.agent-detail__head p { margin: 0; color: var(--ink-2); font: var(--text-sm)/1.5 var(--font-mono); }
.agent-metrics { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); border: 1px solid var(--line-1); border-radius: 8px; margin-bottom: var(--sp-6); overflow: hidden; }
.agent-metric { padding: var(--sp-3); border-right: 1px solid var(--line-1); }
.agent-metric:last-child { border-right: 0; }
.agent-metric span { display: block; color: var(--ink-2); font-size: var(--text-xs); margin-bottom: 5px; }
.agent-metric strong { font: 750 var(--text-md)/1.2 var(--font-mono); }
.agent-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.agent-form__section-title { grid-column: 1 / -1; padding-top: var(--sp-4); border-top: 1px solid var(--line-1); font-size: var(--text-sm); font-weight: 800; }
.agent-checkbox { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--text-sm); }
.agent-checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.agent-checkbox--warning { padding: var(--sp-3); border: 1px solid color-mix(in srgb, var(--down) 32%, var(--line-1)); border-radius: 6px; background: color-mix(in srgb, var(--down) 5%, var(--surface-1)); }
.agent-field { display: grid; gap: 6px; min-width: 0; }
.agent-field--wide { grid-column: 1 / -1; }
.agent-field label { color: var(--ink-2); font-size: var(--text-sm); font-weight: 650; }
.agent-field input, .agent-field textarea, .agent-field select { width: 100%; box-sizing: border-box; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-0); color: var(--ink-1); padding: 10px 11px; font: var(--text-md)/1.4 var(--font-sans); }
.agent-field textarea { min-height: 82px; resize: vertical; }
.agent-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-6); }
.agent-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-1); color: var(--ink-1); font: 700 var(--text-sm)/1 var(--font-sans); cursor: pointer; }
.agent-btn:hover { background: var(--surface-2); }
.agent-btn--primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.agent-btn--primary:hover { filter: brightness(.94); }
.agent-btn--danger { color: var(--down); }
.agent-btn:disabled { cursor: not-allowed; opacity: .5; }
.agent-empty, .agent-loading { display: grid; place-items: center; min-height: 240px; padding: var(--sp-8); color: var(--ink-2); text-align: center; }
.agent-empty svg { width: 34px; height: 34px; margin-bottom: var(--sp-3); color: var(--ink-3); }
.agent-empty p { max-width: 50ch; margin: 0 0 var(--sp-4); line-height: 1.6; }
.agent-key-reveal { margin-bottom: var(--sp-6); padding: var(--sp-4); border: 1px solid color-mix(in srgb, var(--flat) 40%, var(--line-1)); border-radius: 8px; background: color-mix(in srgb, var(--flat) 7%, var(--surface-1)); }
.agent-key-reveal strong { display: block; margin-bottom: var(--sp-2); }
.agent-key-reveal p { margin: 0 0 var(--sp-3); color: var(--ink-2); font-size: var(--text-sm); }
.agent-key-row { display: flex; gap: var(--sp-2); }
.agent-key-row input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-0); color: var(--ink-1); font-family: var(--font-mono); }
.agent-real-wallet { margin-top: var(--sp-6); padding: var(--sp-4); border: 1px solid var(--line-1); border-radius: 8px; background: var(--surface-0); }
.agent-real-wallet__head { display: flex; justify-content: space-between; gap: var(--sp-3); }
.agent-real-wallet__head span { color: var(--accent); font-family: var(--font-mono); font-weight: 800; }
.agent-real-wallet p { margin: var(--sp-2) 0 var(--sp-3); color: var(--ink-2); font-size: var(--text-sm); line-height: 1.5; }
.agent-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.agent-table caption { text-align: left; margin-bottom: var(--sp-4); color: var(--ink-2); }
.agent-table th, .agent-table td { padding: 12px 10px; border-bottom: 1px solid var(--line-1); text-align: left; white-space: nowrap; }
.agent-table th { position: sticky; top: 0; background: var(--surface-1); color: var(--ink-2); font-weight: 700; z-index: 1; }
.agent-table td:nth-child(n+3), .agent-table th:nth-child(n+3) { text-align: right; font-family: var(--font-mono); }
.agent-rank { width: 42px; color: var(--ink-2); }
.agent-protocol { max-width: 820px; }
.agent-protocol h3 { margin: 0 0 var(--sp-2); font-size: var(--text-lg); }
.agent-protocol > p { margin: 0 0 var(--sp-6); color: var(--ink-2); line-height: 1.6; max-width: 68ch; }
.agent-endpoint { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: 12px 0; border-bottom: 1px solid var(--line-1); }
.agent-endpoint code { overflow: hidden; color: var(--ink-1); font-family: var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.agent-method { color: var(--accent); font: 800 var(--text-xs)/1 var(--font-mono); }

@media (max-width: 760px) {
    .agent-console { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
    .agent-console__header { padding: var(--sp-3) var(--sp-4); }
    .agent-console__title p, .agent-console__mode { display: none; }
    .agent-console__tabs { padding: 0 var(--sp-3); }
    .agent-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .agent-list { border-right: 0; border-bottom: 1px solid var(--line-1); max-height: 190px; }
    .agent-list__items { display: flex; gap: var(--sp-2); overflow-x: auto; }
    .agent-list__item { min-width: 210px; }
    .agent-list .agent-empty, .agent-list .agent-loading { min-height: 104px; padding: var(--sp-4); }
    .agent-list .agent-empty p { margin: 0; }
    .agent-detail, .agent-table-wrap, .agent-protocol { padding: var(--sp-4); }
    .agent-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .agent-metric:nth-child(2) { border-right: 0; }
    .agent-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line-1); }
    .agent-form { grid-template-columns: 1fr; }
    .agent-form__section-title, .agent-checkbox { grid-column: auto; }
    .agent-field--wide { grid-column: auto; }
    .agent-table-wrap { overflow: auto; }
    .agent-endpoint { grid-template-columns: 64px minmax(0, 1fr); }
    .agent-endpoint .agent-icon-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .agent-console *, .agent-console *::before, .agent-console *::after { transition: none !important; }
}
