/* Adapt the supplied relay layout to the existing admin shell and theme. */
.adm .relay-channels{width:100%;min-width:0;font-family:var(--ds-font-sans);font-size:14px;line-height:1.55}
.adm .relay-channels .channels-layout{display:grid!important;grid-template-columns:minmax(0,1fr) 320px!important;gap:12px!important;align-items:start!important}
.adm .relay-channels .channels-layout>.card{margin:0!important;min-width:0!important}
.adm .relay-channels #channel-editor{position:sticky!important;inset:auto!important;top:12px!important;align-self:start;display:flex!important;flex-direction:column;padding:14px!important;height:calc(100dvh - var(--channel-editor-top,100px) - 16px)!important;max-height:calc(100dvh - 28px)!important;overflow:auto!important;border-radius:12px!important}
.relay-channels #channel-editor>.card-head{flex:none;gap:6px}
.relay-channels .relay-draft-state{display:none}
.relay-channels #channel-form{display:flex!important;flex-direction:column;gap:14px!important;flex:1 0 auto;min-height:0}
.relay-channels #channel-form>*{flex-shrink:0}
.relay-channels #channel-form label{display:block;font-size:11px;font-weight:600;line-height:1.5}
.relay-channels #channel-form .form-section-body{display:grid;gap:10px}
.relay-channels #channel-form input{margin-top:7px}
.relay-channels #channel-form .switch-line{display:flex!important}
.relay-channels #channel-form .switch-line input{margin:0}
.relay-channels #channel-form .channel-editor-save-dock{position:sticky!important;bottom:0!important;margin-top:auto!important;z-index:5;flex-shrink:0}
.relay-channels .channel-list-card{padding:0 10px 12px!important}
.relay-channels .channel-list-head{display:flex!important;align-items:center!important;gap:16px!important}
.relay-channels .channel-list-head>div:first-child{min-width:150px;flex:1}
.relay-channels .channel-list-head h2{font-size:17px!important;font-weight:650!important;line-height:1.4!important}
.relay-channels .channel-list-head p{font-size:11px!important;line-height:1.6;max-width:42ch}
.relay-channels .channel-list-actions{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.relay-channels .channel-search{display:flex;align-items:center;gap:8px;min-width:0;flex:1;white-space:nowrap;font-size:11px;color:var(--ds-text-3)}
.relay-channels .channel-search input{width:100%;min-width:80px;margin:0;padding:10px 12px;border-radius:9px}
.relay-channels .channel-count{flex:none!important;white-space:nowrap;font-size:11px;padding:5px 8px!important}
.relay-channels #add-channel{flex:none;white-space:nowrap}
.relay-channels .channel-main-line{display:flex!important;align-items:center;gap:7px;min-width:0}
.relay-channels .channel-main-line .channel-name-text{border:0;background:transparent;padding:0;font:inherit;font-size:12px;font-weight:600;color:var(--ds-text-1);max-width:160px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.relay-channels .channel-main-line .channel-base-url{display:block;font-size:10px;flex:1 1 100px;min-width:30px;overflow:hidden;text-overflow:ellipsis;margin-left:8px}
.relay-channels .channel-category-trigger{display:inline-flex;align-items:center;gap:4px;padding:4px 6px;max-width:115px;border:1px solid color-mix(in srgb,var(--ds-brand) 22%,var(--ds-border));border-radius:7px;background:var(--ds-brand-soft);color:var(--ds-brand);font-size:10px;flex-shrink:0}
.relay-channels .channel-category-trigger .identity-image{width:14px;height:14px;flex:0 0 14px;font-size:9px;border-radius:4px}
.relay-channels .channel-category-trigger>span:not(.identity-image){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.relay-channels .channel-category-divider-title{display:inline-flex;align-items:center;gap:8px}
.relay-channels .channel-category-divider-title .identity-image{width:22px;height:22px}
.relay-channels .channel-category-group-actions{display:flex;gap:4px}
.relay-channels .channel-category-divider-title small{white-space:nowrap}
.relay-channels .channel-id{flex:0 0 auto;max-width:66px;overflow:hidden;text-overflow:ellipsis;font-size:10px}
.relay-channels .channel-drag-handle{flex:0 0 24px;display:grid;place-items:center;padding:0;touch-action:none;cursor:grab}
.relay-channels .channel-table .channel-compact-row{height:56px}
.relay-channels .channel-table .channel-compact-row>td{padding:7px 10px}
.relay-channels .channel-table th:first-child{width:44%!important}
.relay-channels .channel-table th:nth-child(2){width:50px!important}
.relay-channels .channel-table th:nth-child(3){width:150px!important}
.relay-channels .channel-table th:nth-child(4){width:74px!important}
.relay-channels .channel-table th:nth-child(5){width:84px!important}
.relay-channels .channel-table th:nth-child(6){width:160px!important}
.relay-channels .channel-status-toggle{display:inline-flex;gap:4px;cursor:pointer;white-space:nowrap}
.relay-channels .channel-status-toggle input{position:absolute;width:1px;height:1px;opacity:0}
.relay-channels .channel-status-toggle:focus-within{outline:2px solid var(--ds-brand);outline-offset:2px}
.relay-channels .channel-actions-inner{display:flex;align-items:center;gap:3px}
.relay-channels .channel-actions-inner button{white-space:nowrap;font-size:10px;padding:5px 6px;border-radius:6px}
.relay-channels .channel-table .route-quick-editor{gap:5px}
.relay-channels .route-quick-editor label{margin:0!important}
.relay-channels .route-quick-editor input{margin:0!important;-moz-appearance:textfield;appearance:textfield}
.relay-channels .route-quick-editor input::-webkit-inner-spin-button{appearance:none}
.relay-channels .route-value-shell{width:40px!important;min-width:40px!important}
.relay-channels .channel-column-settings summary{list-style:none}.relay-channels .channel-column-settings summary::-webkit-details-marker{display:none}
.relay-channels .channel-column-settings:not([open])>.channel-column-settings-menu{display:none}
.relay-channels .channel-column-settings[open]>.channel-column-settings-menu{display:grid;z-index:20}
.relay-channels .model-picker-selected{display:flex!important;flex-wrap:wrap;gap:4px!important;max-height:160px;overflow:auto;align-content:flex-start}
.relay-channels .model-picker-chip{display:inline-flex;align-items:center}
.relay-channels .model-picker-chip-copy{padding:3px 5px;border:0;background:transparent;font-size:11px!important;line-height:16px;cursor:copy;color:inherit}
.relay-channels .model-picker-chip-remove{display:grid;place-items:center;border:0;background:transparent;padding:0;color:var(--ds-text-3)}
.relay-channels .relay-model-disclosure{border:0!important;padding:0!important;margin:0!important;background:transparent!important}
.relay-channels .relay-model-disclosure:not([open])>.model-picker-dropdown{display:none!important}
.relay-channels .model-picker-dropdown{z-index:15;position:relative!important;top:auto!important;left:auto!important;right:auto!important;max-height:320px;overflow:auto}
.relay-channels .model-discovery-actions{display:flex;flex-wrap:wrap;gap:8px;padding:8px;align-items:center}
.relay-channels .model-discovery-batch{display:flex;gap:4px}
.relay-channels .model-picker-option{display:flex;width:100%;align-items:center;justify-content:space-between;gap:10px;text-align:left;border:0;background:transparent;padding:8px 10px;font-size:11px}
.relay-channels .model-picker-option.is-selected{background:var(--ds-brand-soft);color:var(--ds-brand)}
.relay-channels .model-picker-option small{display:block;color:var(--ds-text-3);font-size:10px}
/* Pending and saved redirects share one grid and save with the channel. */
.relay-channels #channel-form .model-redirects{--redirect-columns:minmax(0,1fr) 12px minmax(0,1fr) 24px;padding:12px;gap:8px}
.relay-channels #channel-form .channel-redirect-add{display:block;margin:0;padding:0;min-width:0}
.relay-channels #channel-form :is(.model-redirect-row,.model-redirect-labels){display:grid!important;grid-template-columns:var(--redirect-columns)!important;gap:6px!important;align-items:center;padding:0!important;min-width:0;background:transparent!important;border:0!important;border-radius:0}
.relay-channels #channel-form .model-redirect-labels{font-size:10px;font-weight:500;line-height:1.5;color:var(--ds-text-3)}
.relay-channels #channel-form .model-redirect-field{display:block;min-width:0;margin:0!important;padding:0}
.relay-channels #channel-form .model-redirect-row input{box-sizing:border-box;width:100%!important;min-width:0!important;height:36px!important;min-height:36px!important;margin:0!important;padding:0 7px!important;border:1px solid var(--ds-border)!important;border-radius:7px!important;background:var(--ds-surface-1)!important;color:var(--ds-text-1)!important;font-family:var(--ds-font-sans);font-size:11px!important;font-weight:400!important;line-height:normal!important;letter-spacing:0;box-shadow:none!important}
.relay-channels #channel-form .model-redirect-row input:focus-visible{outline:2px solid var(--ds-brand);outline-offset:2px}
.relay-channels #channel-form .model-redirect-arrow{display:grid;place-items:center;grid-column:2;grid-row:1;width:12px;height:36px;background:transparent!important;color:var(--ds-text-3);transform:none;border-radius:0}
.relay-channels #channel-form .model-redirect-row .model-redirect-remove{display:grid;place-items:center;grid-column:4;grid-row:1;box-sizing:border-box;width:24px!important;min-width:24px;height:36px!important;min-height:36px;padding:0!important;margin:0!important;border:0!important;border-radius:6px;background:transparent!important;color:var(--ds-text-3);line-height:1;transform:none}
.relay-channels #channel-form .model-redirect-row .model-redirect-remove:hover{background:var(--ds-danger-soft)!important;color:var(--ds-danger)}
.relay-channels #channel-form .model-redirects-head{gap:8px}
.relay-channels #channel-form .model-redirect-add{min-height:30px;padding:5px 9px;font-size:11px}
@media(max-width:640px){.relay-channels #channel-form .model-redirect-row input{height:40px!important;min-height:40px!important;font-size:12px!important}.relay-channels #channel-form .model-redirect-row .model-redirect-remove{height:40px!important}.relay-channels #channel-form .model-redirects-head{flex-direction:row;align-items:center}.relay-channels #channel-form .model-redirect-add{width:auto;white-space:nowrap}}
.relay-channels .is-drop-target{outline:2px solid var(--ds-brand);outline-offset:-2px}
body.admin-mode dialog.relay-channel-modal{margin:auto;min-height:0;background:var(--ds-surface-1)!important;color:var(--ds-text-1);border:0;box-shadow:var(--ds-shadow-modal);border-radius:16px;padding:0}
body.admin-mode dialog.relay-category-dialog{width:min(960px,calc(100vw - 32px));max-width:960px;max-height:min(850px,calc(100dvh - 40px));overflow:hidden}
dialog.relay-category-dialog>.dialog-head{margin:0;padding:12px 20px;position:absolute;right:0;top:0;z-index:10}dialog.relay-category-dialog>.dialog-head h2{display:none}
.relay-category-dialog .category-workspace{display:flex;flex-direction:column;width:100%!important;max-height:min(850px,calc(100dvh - 40px))!important;min-height:0;border:0;box-shadow:none}
.relay-category-dialog .category-workspace-body{overflow:auto;min-height:0}
.relay-category-dialog .relay-modal-head{padding:22px 24px 16px}
.relay-category-dialog .category-workspace-footer{flex-shrink:0}
.relay-channel-modal .relay-health-detail{padding:24px}.relay-channel-modal .relay-health-detail article{padding:12px;border-radius:8px;margin-bottom:8px}.relay-channel-modal .is-good{background:var(--ds-success-soft);color:var(--ds-success)}.relay-channel-modal .is-bad{background:var(--ds-danger-soft);color:var(--ds-danger)}
html[data-theme=dark] :is(.relay-channels,.relay-channel-modal,.relay-channel-floating){--ds-bg:#111;--ds-bg-subtle:#151515;--ds-surface-1:#191919;--ds-surface-2:#202020;--ds-surface-3:#292929;--ds-surface-floating:#242424;--ds-border:#303030;--ds-divider:#292929;--ds-border-strong:#424242;--ds-text-1:#f1f1f1;--ds-text-2:#c1c1c1;--ds-text-3:#999}
@media(max-width:1360px){.adm .relay-channels .channels-layout{grid-template-columns:minmax(0,1fr)!important}.adm .relay-channels #channel-editor{position:relative!important;top:0!important;height:auto!important;max-height:none!important}.relay-channels #channel-form{min-height:0}.relay-channels #channel-form .channel-editor-save-dock{position:sticky!important;bottom:8px!important}.relay-channels .channel-table{min-width:920px!important}}
@media(max-width:640px){.relay-channels .channel-list-head{align-items:stretch!important;flex-direction:column!important;gap:12px!important}.relay-channels .channel-list-actions{width:100%;flex-wrap:wrap}.relay-channels .channel-search{flex:1 1 100%}.relay-channels .channel-category-toolbar{display:flex!important;gap:8px!important}.relay-channels .channel-category-toolbar-main{display:flex!important;flex:1;flex-wrap:wrap}.relay-channels .channel-toolbar-secondary-actions{margin-left:0!important}.relay-channels .category-select-trigger{min-width:130px}.relay-channels .channel-list-head>div:first-child p{max-width:none}.relay-category-dialog .category-settings-main{display:grid;grid-template-columns:28px minmax(0,1fr)}.relay-category-dialog .category-settings-actions{flex-wrap:wrap}.relay-category-dialog .category-create-form{grid-template-columns:1fr}.relay-category-dialog .category-workspace-footer{flex-wrap:wrap}.relay-channels .channel-category-group-actions{display:none}}

/* Keep the editor controls clear of the pinned action area. */
.adm .relay-channels #channel-editor{overflow:hidden!important}
.relay-channels #channel-form{flex:1 1 auto!important;overflow-y:auto!important;min-height:0!important;padding-bottom:108px!important;scroll-padding-bottom:108px}
.relay-channels #channel-form .channel-editor-save-dock{position:absolute!important;left:14px;right:14px;bottom:14px!important;background:var(--ds-surface-1);padding-top:7px;box-shadow:0 -8px 18px var(--ds-surface-1)}
.relay-channels .channel-table-wrap{overflow-x:auto!important}
.relay-channels .channel-table{min-width:1200px!important}
.relay-channels .channel-drag-handle svg{width:14px;height:14px;stroke:currentColor!important;fill:none!important;stroke-width:2;stroke-linecap:round}
.relay-channels .channel-actions-inner{position:sticky;right:0;background:var(--ds-surface-1)}
.relay-channels .channel-compact-row.is-selected .channel-actions-inner{background:var(--ds-brand-soft)}
body.admin-mode dialog.relay-test-dialog{width:min(1000px,calc(100vw - 32px));max-width:1000px;max-height:calc(100dvh - 40px);padding:0!important;overflow:hidden}
.relay-test-dialog>.dialog-head{position:absolute;top:12px;right:12px;z-index:3;padding:0;background:none;box-shadow:none;border:0}.relay-test-dialog>.dialog-head h2{display:none}
.relay-test-dialog .relay-modal-head{padding:22px 28px 14px}.relay-test-dialog .relay-modal-head h2{font-size:20px;margin:0 0 6px}.relay-test-dialog .relay-modal-head p{font-size:12px;color:var(--ds-text-3)}
.relay-test-dialog .channel-test-scroll-body{padding:0 28px 16px;max-height:calc(100dvh - 220px);overflow:auto}
.relay-test-dialog .channel-test-model-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.relay-test-dialog .channel-test-model-head>div{display:flex;align-items:center;gap:8px}
.relay-test-dialog .channel-test-toolbar{display:grid;grid-template-columns:190px minmax(0,1fr);gap:14px}.relay-test-dialog .channel-test-toolbar label{display:grid;gap:6px;font-size:12px}
.relay-test-dialog .channel-test-model{display:flex;align-items:center;gap:10px;padding:12px}.relay-test-dialog .channel-test-model>span{flex:1;min-width:0}.relay-test-dialog .channel-test-model strong{display:block;overflow-wrap:anywhere}.relay-test-dialog .channel-test-model small{font-size:11px;color:var(--ds-text-3)}
.relay-test-dialog .channel-test-result-list{display:grid;gap:8px;margin-top:12px}.relay-test-dialog .channel-test-result{display:flex;justify-content:space-between;gap:14px;border-radius:10px;padding:12px;font-size:12px}.relay-test-dialog .channel-test-result div{min-width:0}.relay-test-dialog .channel-test-result small{display:block;overflow-wrap:anywhere;white-space:pre-wrap}.relay-test-dialog .channel-test-result>span{flex:none}
.relay-test-dialog .channel-test-result.ok{background:var(--ds-success-soft);color:var(--ds-success)}.relay-test-dialog .channel-test-result.bad{background:var(--ds-danger-soft);color:var(--ds-danger)}.relay-test-dialog .channel-test-result.warn,.relay-test-dialog .channel-test-result.pending{background:var(--ds-surface-2)}
.relay-test-dialog .channel-probe-summary{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:16px}.relay-test-dialog .channel-probe-summary>div{flex:1;display:grid;gap:4px}.relay-test-dialog #test-counts{font-size:11px;color:var(--ds-text-3)}
.relay-test-dialog .channel-test-footer-actions{display:flex;gap:8px;justify-content:flex-end;padding:14px 28px;background:var(--ds-surface-1)}
@media(max-width:1360px){.adm .relay-channels #channel-editor{height:min(900px,calc(100dvh - 32px))!important;max-height:min(900px,calc(100dvh - 32px))!important}.relay-channels #channel-form .channel-editor-save-dock{position:absolute!important;bottom:14px!important}}
@media(max-width:640px){.relay-test-dialog .channel-test-toolbar{grid-template-columns:1fr}.relay-test-dialog .channel-test-model-head{align-items:flex-start;flex-direction:column}.relay-test-dialog .channel-test-model-head>div{flex-wrap:wrap}.relay-test-dialog .channel-test-scroll-body{padding:0 14px 12px}.relay-test-dialog .channel-test-result{flex-direction:column}.relay-test-dialog .relay-modal-head{padding:18px 20px}.relay-test-dialog .channel-test-footer-actions{padding:14px;flex-wrap:wrap}}

.adm .relay-channels{background:transparent!important}
.adm .relay-channels #channel-form input:not([type=checkbox]),.adm .relay-channels #channel-form textarea{background:var(--ds-surface-1)!important;color:var(--ds-text-1)!important;border:1px solid var(--ds-border-strong)!important;box-shadow:none!important}
.adm .relay-channels .channel-tag{position:static!important;display:inline-flex!important;padding:2px 4px!important;border:0!important;border-radius:6px!important;background:var(--ds-surface-2)!important;color:var(--ds-text-1)!important}
.adm .relay-channels .channel-tag button{position:static!important;inset:auto!important;border:0!important;background:transparent!important;border-radius:4px!important;width:auto!important;height:auto!important}
.adm .relay-channels .channel-tag .model-picker-chip-remove{width:16px!important;height:20px!important;color:var(--ds-text-3)!important}
.adm .relay-channels .channel-name-text{color:var(--ds-text-1)!important}
@media(max-width:1360px){.adm .relay-channels #channel-editor{height:auto!important;max-height:none!important;overflow:visible!important}.adm .relay-channels #channel-form{overflow:visible!important;padding-bottom:0!important;flex:1 0 auto!important}.adm .relay-channels #channel-form .channel-editor-save-dock{position:sticky!important;inset:auto!important;bottom:12px!important;box-shadow:0 -8px 18px var(--ds-surface-1)}}
.relay-channels .channel-status-toggle{position:relative}
.relay-channels .channel-status-toggle input{position:absolute!important;left:0!important;top:0!important;width:1px!important;height:1px!important;margin:0!important}

:is(.relay-channels,.relay-channel-modal,.relay-channel-chat) [hidden]{display:none!important}
.relay-test-dialog .relay-modal-head{display:block!important}.relay-test-dialog .relay-modal-head>div{display:block}.relay-test-dialog .relay-modal-head p{margin-top:6px;padding-right:20px}

/* Fixed action column follows the original list; using it never scrolls the channel identity away. */
.adm .relay-channels .channel-table th[data-channel-column=actions],.adm .relay-channels .channel-table td[data-channel-column=actions]{position:sticky;right:0;z-index:3;background:var(--ds-surface-1)!important;box-shadow:-8px 0 12px -10px rgba(0,0,0,.22)}
.adm .relay-channels .channel-table tr.is-selected td[data-channel-column=actions]{background:linear-gradient(var(--ds-brand-soft),var(--ds-brand-soft)),linear-gradient(var(--ds-surface-1),var(--ds-surface-1))!important}
.adm .relay-channels #channel-form .model-picker{z-index:1!important}
.adm .relay-channels #channel-form .channel-editor-save-dock{z-index:10!important}

.relay-history-dialog{width:min(980px,calc(100vw - 32px))!important}.relay-history-dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;max-height:460px;overflow:auto}.relay-history-dialog .relay-health-detail{max-height:calc(100dvh - 140px);overflow:auto}

/* Bound the intrinsic table width; long names and URLs cannot enlarge columns. */
.adm .relay-channels .channel-table{table-layout:fixed!important;width:100%!important;min-width:1200px!important}
.adm .relay-channels .channel-table th:first-child,.adm .relay-channels .channel-table .channel-main-cell{width:auto!important;min-width:0!important;max-width:none!important}
.adm .relay-channels .channel-table :is(th,td)[data-channel-column=model]{width:48px!important;min-width:0!important}
.adm .relay-channels .channel-table :is(th,td)[data-channel-column=route]{width:142px!important;min-width:0!important}
.adm .relay-channels .channel-table :is(th,td)[data-channel-column=health]{width:100px!important;min-width:0!important}
.adm .relay-channels .channel-table :is(th,td)[data-channel-column=status]{width:100px!important;min-width:0!important}
.adm .relay-channels .channel-table :is(th,td)[data-channel-column=actions]{width:184px!important;min-width:0!important}
.adm .relay-channels .channel-main-line{display:grid!important;grid-template-columns:26px minmax(260px,1.7fr) max-content minmax(100px,1fr);align-items:center;gap:8px;min-width:0!important;overflow:hidden}
.adm .relay-channels .channel-main-line:has([data-channel-subcolumn="address"][hidden]){grid-template-columns:26px minmax(260px,1fr) max-content}
.adm .relay-channels .channel-main-line .channel-category-trigger{min-width:0;max-width:124px}
.adm .relay-channels .channel-main-line .channel-category-trigger>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.adm .relay-channels .channel-main-line .channel-name-text{width:100%;min-width:0!important;max-width:none;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.adm .relay-channels .channel-main-line .channel-base-url{min-width:0!important;margin-left:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.relay-category-dialog .category-create-form .image-field{min-width:0;margin:0}
.relay-category-dialog .category-create-form .image-field-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

.relay-category-picker{position:fixed!important;inset:auto;margin:0;padding:6px;border:1px solid var(--ds-border);border-radius:12px;background:var(--ds-surface-floating);color:var(--ds-text-1);box-shadow:0 12px 36px rgba(0,0,0,.16);overflow:auto;z-index:1000}
.relay-category-picker .category-select-option{display:flex;width:100%;align-items:center;gap:10px;padding:10px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;cursor:pointer}
.relay-category-picker .category-select-option:hover,.relay-category-picker [aria-selected=true]{background:var(--ds-brand-soft);color:var(--ds-brand)}
.relay-category-picker .category-select-option-copy{flex:1;display:grid;gap:3px}.relay-category-picker strong{font-size:13px}.relay-category-picker small{color:var(--ds-text-3);font-size:11px}
.relay-category-picker .identity-image{width:28px;height:28px;flex:0 0 28px}.relay-category-picker .category-select-manage{display:block;width:100%;padding:10px;border:0;background:transparent;color:var(--ds-brand);text-align:left;cursor:pointer}

.adm .relay-channels .channel-table :is(th,td)[data-channel-column=actions]{position:sticky!important;right:0!important}
.adm .relay-channels .channel-table .channel-actions-inner{position:static!important}

.adm .relay-channels .channel-table :is(th,td)[data-channel-column=actions]{width:232px!important;min-width:232px!important;padding:7px 10px!important}
.adm .relay-channels .channel-actions-inner{justify-content:flex-start!important}
.relay-channels .category-select-current{display:flex!important;align-items:center;gap:8px;min-width:0}
.relay-channels .category-select-current>.identity-image{width:24px!important;height:24px!important;flex:0 0 24px!important;border-radius:6px}
.relay-channels .category-select-option-copy{display:grid;gap:2px;min-width:0;text-align:left}
.relay-channels .category-select-option-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.relay-channels .category-select-option-copy small{font-size:10px}
.relay-category-dialog .category-settings-main>.identity-image{width:28px!important;height:28px!important;flex:0 0 28px!important;border-radius:7px}
@media(max-width:640px){.adm .relay-channels .channel-table :is(th,td)[data-channel-column=actions]{width:132px!important;min-width:132px!important}.adm .relay-channels .channel-actions-inner{display:grid!important;grid-template-columns:1fr 1fr;gap:3px!important}.adm .relay-channels .channel-actions-inner>button{padding:0 5px!important;font-size:10px!important}}

/* Inline routing values: one visible numeral source, centered in a soft field. */
.adm .relay-channels .channel-table .channel-route-cell{position:relative;z-index:0}
.adm .relay-channels .channel-table .route-quick-editor{display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;min-width:0!important;width:100%!important}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part]{
 --route-ink:var(--ds-brand);--route-ch:var(--prio-ch,3);
 display:block!important;flex:0 0 auto!important;box-sizing:border-box!important;
 width:max(54px,calc(var(--route-ch) * 1ch + 16px))!important;min-width:54px!important;max-width:none!important;height:32px!important;
 margin:0!important;padding:0!important;border:0!important;border-radius:9px!important;overflow:hidden!important;
 background:color-mix(in srgb,var(--route-ink) 7%,var(--ds-surface-1))!important;box-shadow:none!important;
 font:600 12px/1 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace!important;
}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part=weight]{--route-ink:var(--ds-info);--route-ch:var(--weight-ch,2)}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part]:hover{background:color-mix(in srgb,var(--route-ink) 12%,var(--ds-surface-1))!important}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part]:focus-within{background:color-mix(in srgb,var(--route-ink) 12%,var(--ds-surface-1))!important;box-shadow:none!important}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part]:has(input:focus-visible){outline:2px solid var(--route-ink);outline-offset:2px}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part]>span:first-child{display:none!important}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part] .route-value-shell{
 position:relative!important;display:block!important;width:100%!important;min-width:0!important;max-width:none!important;height:100%!important;
 margin:0!important;padding:0!important;border:0!important;background:transparent!important;
}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part] .route-value-shell>input[data-route-channel][data-route-key]{
 position:static!important;display:block!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:none!important;height:32px!important;min-height:0!important;
 margin:0!important;padding:0!important;border:0!important;border-radius:inherit!important;background:transparent!important;box-shadow:none!important;outline:0!important;
 color:var(--route-ink)!important;-webkit-text-fill-color:var(--route-ink)!important;caret-color:var(--route-ink)!important;
 font:inherit!important;font-variant-numeric:tabular-nums lining-nums!important;line-height:32px!important;text-align:center!important;text-align-last:center!important;text-indent:0!important;letter-spacing:0!important;
 appearance:textfield!important;-moz-appearance:textfield!important;opacity:1!important;
}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part] .route-value-shell>input[data-route-channel][data-route-key]:disabled{opacity:.55!important;cursor:progress}
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part] .route-value-shell>b[data-route-priority-mirror],
.adm .relay-channels .channel-table .route-quick-editor label[data-channel-route-part] .route-value-shell>b[data-route-weight-mirror]{display:none!important}
.adm .relay-channels .channel-table .route-value-shell input::-webkit-inner-spin-button,.adm .relay-channels .channel-table .route-value-shell input::-webkit-outer-spin-button{appearance:none!important;margin:0!important}
.adm .relay-channels .channel-table .route-quick-editor>i:empty{display:none!important}

/* Endpoint support belongs to the channel, while the operation selects the API. */
.relay-channels .channel-interface-summary{display:grid;gap:8px;min-width:0}
.relay-channels .channel-interface-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px}
.relay-channels .channel-interface-heading>span{color:var(--accent);font-weight:600}
.relay-channels .channel-interface-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.relay-channels .channel-interface-list>span{padding:7px 9px;border-radius:7px;background:var(--hover);color:var(--ink);font-size:11px;line-height:1.5;overflow-wrap:anywhere}
.relay-channels .channel-interface-summary>small{font-size:11px;line-height:1.6;color:var(--muted)}

/* Keep category creation, the scroll body and footer inside one native dialog. */
.relay-category-dialog .category-workspace>.relay-modal-head{padding-right:64px!important}
.relay-category-dialog .category-workspace-body{flex:1 1 auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.relay-category-dialog .category-create-form{grid-template-columns:minmax(0,1fr) auto!important;align-items:end}
.relay-category-dialog .category-create-form>.image-field{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px;align-items:end}
.relay-category-dialog .category-create-form .image-field>label{margin:0}
.relay-category-dialog .category-create-form .image-field-controls{align-self:end;min-height:40px;flex-wrap:nowrap}
.relay-category-dialog .category-create-form .image-field-preview{width:40px;height:40px}
.relay-category-dialog .category-create-form .image-field>small{margin:0;line-height:1.5}
.relay-category-dialog .category-create-form input{width:100%}
.relay-category-dialog .category-settings-main>label input{width:100%}
.relay-category-dialog .category-workspace-footer{gap:12px}
.relay-category-dialog #relay-cat-error:empty{display:none}
.relay-category-dialog #relay-cat-error:not(:empty){margin:0;padding:10px 24px;flex-shrink:0}
.relay-category-dialog .category-settings-actions .category-delete{margin-left:16px;color:var(--ds-danger)!important}
@media(max-width:640px){
 body.admin-mode dialog.relay-category-dialog{width:calc(100vw - 20px);max-height:calc(100dvh - 24px)}
 .relay-category-dialog .category-workspace{max-height:calc(100dvh - 24px)!important}
 .relay-category-dialog .category-create-form>.image-field{grid-template-columns:minmax(0,1fr)}
 .relay-category-dialog .category-create-form .image-field-controls{justify-content:flex-start}
 .relay-category-dialog .category-create-form>.btn{width:auto;min-height:40px}
 .relay-category-dialog .category-settings-name,.relay-category-dialog .category-settings-icon{grid-column:2;flex-direction:column!important;align-items:stretch!important;gap:5px!important}
 .relay-category-dialog .category-settings-actions{justify-content:flex-start;gap:8px}
 .relay-category-dialog .category-settings-actions .category-delete{margin-left:auto}
 .relay-category-dialog .category-settings-actions>.btn{min-height:40px}
 .relay-category-dialog .category-workspace-footer>span{flex:1 1 100%}
}

/* Upstream discovery stays below its trigger; only the results scroll. */
.relay-channels #binding-pool-disclosure{min-width:0;width:100%}
.relay-channels #binding-pool-disclosure[open]{margin-top:12px!important}
.relay-channels #binding-pool-disclosure .model-picker-dropdown{position:static!important;max-height:none;overflow:visible;padding:12px;border:0;border-radius:14px;background:var(--ds-surface-2);box-shadow:0 6px 20px #00000008}
.relay-channels #binding-pool-disclosure .model-discovery-actions{display:flex;flex-wrap:wrap;gap:6px 12px;padding:0 0 10px;align-items:center;background:transparent;border:0}
.relay-channels #binding-source{font-size:12px;font-weight:650;color:var(--ds-text-1)}
.relay-channels #binding-selection-count{margin-left:auto;font-size:11px;color:var(--ds-text-3);white-space:nowrap}
.relay-channels #binding-pool-disclosure .model-discovery-batch{display:flex;align-items:center;gap:6px;flex-basis:100%}
.relay-channels #binding-pool-disclosure .model-discovery-batch-btn{display:inline-flex;align-items:center;justify-content:center;min-height:32px;margin:0;padding:6px 10px;border:0;border-radius:8px;background:var(--ds-surface-floating);color:var(--ds-text-2);font:inherit;font-size:11px;font-weight:550;line-height:20px;white-space:nowrap;cursor:pointer;box-shadow:none}
.relay-channels #binding-pool-disclosure #binding-confirm{margin-left:auto;background:var(--ds-brand);color:#fff}
.relay-channels #binding-pool-disclosure .model-discovery-batch-btn:hover:not(:disabled){filter:brightness(.95)}
.relay-channels #binding-pool-disclosure .model-discovery-batch-btn:disabled{opacity:.42;cursor:default}
.relay-channels #binding-options{max-height:280px;overflow-y:auto;display:flex;flex-direction:column;gap:6px;padding:0;scrollbar-width:thin;scrollbar-color:var(--ds-border) transparent;overscroll-behavior:contain}
.relay-channels #binding-options .model-picker-option{min-height:54px;width:100%;margin:0;padding:10px 12px;gap:12px;border:0;border-radius:10px;background:var(--ds-surface-floating);color:var(--ds-text-1);box-shadow:none;cursor:pointer}
.relay-channels #binding-options .model-picker-option:hover{background:color-mix(in srgb,var(--ds-brand) 5%,var(--ds-surface-floating))}
.relay-channels #binding-options .model-picker-option.is-selected{background:var(--ds-brand-soft);color:var(--ds-brand)}
.relay-channels #binding-options .model-discovery-copy{display:grid;gap:3px;min-width:0;flex:1}
.relay-channels #binding-options .model-discovery-copy strong{font-size:12px;font-weight:600;line-height:1.5;overflow-wrap:anywhere}
.relay-channels #binding-options .model-discovery-copy small{margin:0;padding:0;display:block;width:auto;background:transparent;color:var(--ds-text-3);font-size:10px;line-height:1.4}
.relay-channels #binding-options .model-discovery-check{display:grid;place-items:center;flex:0 0 20px;width:20px;height:20px;border:1px solid var(--ds-border);border-radius:6px;color:var(--ds-brand);background:transparent}
.relay-channels #binding-options .is-selected .model-discovery-check{border-color:var(--ds-brand);background:var(--ds-brand);color:#fff}
.relay-channels #binding-pool-disclosure :is(button):focus-visible{outline:2px solid var(--ds-brand);outline-offset:2px}
.relay-channels #binding-options .model-discovery-empty{margin:0;padding:20px 10px;text-align:center;font-size:12px;color:var(--ds-text-3);line-height:1.7}

.relay-channels #binding-options .model-picker-option{min-height:56px!important;padding:10px 12px!important;border-radius:10px!important}
.relay-channels #binding-options .model-discovery-copy{white-space:normal!important;overflow:visible!important}
.relay-channels #binding-options .model-discovery-copy strong{white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.relay-channels #binding-options .model-discovery-copy small{padding:0!important;background:transparent!important;color:var(--ds-text-3)!important;border-radius:0!important;white-space:normal!important}
.relay-channels #binding-pool-disclosure .model-discovery-batch-btn{font-size:12px}

html[data-theme="dark"] .relay-channels #binding-pool-disclosure .model-discovery-actions{background:transparent;border:0;color:var(--ds-text-1)}
html[data-theme="dark"] .relay-channels #binding-source{color:var(--ds-text-1)}
html[data-theme="dark"] .relay-channels #binding-selection-count{color:var(--ds-text-3)}
html[data-theme="dark"] .relay-channels #binding-pool-disclosure .model-discovery-batch{background:transparent;border:0;box-shadow:none}
html[data-theme="dark"] .relay-channels #binding-pool-disclosure .model-discovery-batch-btn{background:var(--ds-surface-floating);border:0;color:var(--ds-text-2)}
html[data-theme="dark"] .relay-channels #binding-pool-disclosure .model-discovery-batch-btn:hover{background:var(--ds-surface-floating);color:var(--ds-text-1)}
html[data-theme="dark"] .relay-channels #binding-pool-disclosure #binding-confirm{background:var(--ds-brand);color:#fff}
@media(max-width:640px){.relay-channels #binding-options{max-height:min(280px,32dvh)}}

/* Search remains above the independently scrolling upstream results. */
.relay-channels #binding-pool-disclosure .model-discovery-search{display:flex;align-items:center;gap:8px;min-width:0;margin:0 0 10px;padding:0 10px;border:0;border-radius:10px;background:var(--ds-surface-floating);color:var(--ds-text-3)}
.relay-channels #binding-pool-disclosure .model-discovery-search>span{display:flex;flex:none;align-items:center}
.relay-channels #binding-pool-disclosure #binding-discovery-search{flex:1;min-width:0;width:100%;height:38px;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;outline:none;font:inherit;font-size:12px;color:var(--ds-text-1)}
.relay-channels #binding-discovery-search::placeholder{color:var(--ds-text-3);opacity:1}
.relay-channels #binding-discovery-search::-webkit-search-cancel-button{display:none}
.relay-channels #binding-pool-disclosure .model-discovery-search:focus-within{outline:2px solid var(--ds-brand);outline-offset:2px}
.relay-channels #binding-pool-disclosure #binding-discovery-clear{display:grid;place-items:center;flex:none;width:28px;height:28px;min-height:0;margin:0;padding:0;border:0;border-radius:7px;background:transparent;color:var(--ds-text-3);box-shadow:none;cursor:pointer}
.relay-channels #binding-pool-disclosure #binding-discovery-clear[hidden]{display:none}
.relay-channels #binding-pool-disclosure #binding-discovery-clear:hover{background:var(--ds-surface-2);color:var(--ds-text-1)}
@media(max-width:640px){.relay-channels #binding-pool-disclosure #binding-discovery-search{height:42px;font-size:16px}}

/* Category creation is one compact action row, not two full-width forms. */
.relay-category-dialog #relay-category-create{
 grid-template-columns:minmax(160px,200px) minmax(0,1fr) auto!important;
 align-items:center;gap:12px;padding:14px 16px;
}
.relay-category-dialog #relay-category-create>.category-create-name{margin:0;min-width:0}
.relay-category-dialog #relay-category-create>.image-field{
 grid-column:auto;display:grid;grid-template-columns:minmax(120px,1fr) auto;
 align-items:center;gap:8px;margin:0;min-width:0;
}
.relay-category-dialog #relay-category-create .image-field>label{min-width:0;gap:0;margin:0}
.relay-category-dialog #relay-category-create .image-field>label>span,
.relay-category-dialog #relay-category-create .image-field>small{
 position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
 clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
.relay-category-dialog #relay-category-create input[type=text],
.relay-category-dialog #relay-category-create input[name=name]{height:40px;min-height:40px;font-size:13px}
.relay-category-dialog #relay-category-create .image-field-controls{align-self:center;min-height:40px;gap:8px;flex-wrap:nowrap}
.relay-category-dialog #relay-category-create .image-field-preview{width:36px;height:36px;flex:0 0 36px}
.relay-category-dialog #relay-category-create .image-field-controls button{min-height:40px;font-size:12px;white-space:nowrap}
.relay-category-dialog #relay-category-create [data-upload-icon]{padding:0 12px}
.relay-category-dialog #relay-category-create [data-clear-icon]{padding:0 4px;color:var(--ds-text-2)}
.relay-category-dialog #relay-category-create>button{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:auto;min-height:40px;white-space:nowrap;padding:0 16px;font-size:13px}
@media(max-width:720px){
 .relay-category-dialog #relay-category-create{grid-template-columns:minmax(0,1fr) auto!important;gap:10px;padding:12px}
 .relay-category-dialog #relay-category-create>.category-create-name{grid-column:1;grid-row:1}
 .relay-category-dialog #relay-category-create>button{grid-column:2;grid-row:1;padding:0 12px}
 .relay-category-dialog #relay-category-create>.image-field{grid-column:1/-1;grid-row:2}
}

.relay-category-dialog #relay-category-create .image-field:has(.image-field-preview:is([data-preview-state="invalid"],[data-preview-state="error"]))>.image-preview-status{
 position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto;white-space:normal;grid-column:1/-1;color:var(--ds-danger);
}

/* Show both the carried category and its exact insertion slot. */
.relay-category-dialog.is-category-sorting .category-workspace-body{overflow-anchor:none}
.relay-category-dialog .category-settings-list{position:relative}
.relay-category-dialog .category-sort-placeholder{
 display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
 min-height:80px;border:2px solid var(--ds-brand);border-radius:13px;
 background:var(--ds-brand-soft);box-shadow:none;color:var(--ds-brand);
}
.relay-category-dialog .category-sort-placeholder strong{font-size:14px;font-weight:650;line-height:1.5}
.relay-category-dialog .category-sort-placeholder>span{max-width:90%;font-size:12px;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.relay-category-dialog .category-sort-placeholder.is-outside{opacity:.4}
.relay-category-dialog .category-sort-ghost{
 position:fixed;inset:0 auto auto 0;z-index:10;display:flex;flex-direction:column;align-items:flex-start;
 box-sizing:border-box;width:220px;max-width:calc(100vw - 16px);height:62px;padding:10px 14px;gap:3px;
 background:var(--ds-surface-floating);border:1px solid var(--ds-brand);border-radius:12px;
 color:var(--ds-text-1);box-shadow:0 10px 28px #00000026;pointer-events:none;will-change:transform;
}
.relay-category-dialog .category-sort-ghost>strong{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650}
.relay-category-dialog .category-sort-ghost>small{font-size:11px;color:var(--ds-text-2)}
.relay-category-dialog .category-sort-ghost.is-outside{opacity:.55}
.relay-category-dialog .category-workspace-note[data-sort-state=moving],
.relay-category-dialog .category-workspace-note[data-sort-state=saving],
.relay-category-dialog .category-workspace-note[data-sort-state=saved]{color:var(--ds-brand);font-weight:600}
.relay-category-dialog .category-workspace-note[data-sort-state=error]{color:var(--ds-danger)}
.relay-category-dialog .category-settings-list[aria-busy=true]{opacity:.75}
.relay-category-dialog .category-settings-list[aria-busy=true] .category-drag-handle{cursor:wait}

/* Compact chip actions still have a complete square hit area. */
.adm .relay-channels [data-channel-editor-panel] [data-model-picker-selected] .model-picker-chip-remove{
 box-sizing:border-box;flex:0 0 24px;width:24px!important;min-width:24px!important;height:24px!important;min-height:24px!important;
 display:grid;place-items:center;padding:0!important;border-radius:7px!important;
}
@media(max-width:640px){
 .adm .relay-channels [data-channel-editor-panel] [data-model-picker-selected] .model-picker-chip-remove{flex-basis:32px;width:32px!important;min-width:32px!important;height:32px!important;min-height:32px!important}
}
