/* UTU Engine: component-level Dark surfaces and aligned Investigation rows.
   Scoped to the dark theme so Light retains its intended white-on-dark contrast.
   Loaded after utu-polish.css; never changes status semantics or form behavior. */
:root[data-theme="dark"]{
  --utu-deep:#090f17;
  --utu-field:#101e2d;
  --utu-panel:#0d1722;
  --utu-panel-soft:#122334;
  --utu-panel-hover:#1a3044;
  --utu-text:#edf5fb;
  --utu-subtext:#a7b4c6;
  --utu-dim:#8fa5b9;
  --utu-stroke:#223647;
  --utu-stroke-soft:#1e3041;
  --utu-highlight:#43d1dd;
}

/* APPLICATIONS: the old white forms were *inside* dark top-level panels. */
:root[data-theme="dark"] :is(
  .application-tab-panel>.grid, .application-create-panel>.grid,
  #application-llm-panel .llm-settings-panel,
  #application-llm-panel .llm-policy-grid label,
  #application-llm-panel .llm-primary-grid,
  #application-llm-panel .manual-policy-note,
  .connection-detail>.grid, .connection-detail>#conn-provider-fields,
  .connection-detail>#conn-secrets,
  .application-tab-panel .subpanel, .application-tab-panel .dep-row,
  .connection-detail .subpanel, .connection-detail .dep-row
){
  background:var(--utu-panel-soft)!important;
  background-image:none!important;
  border-color:var(--utu-stroke)!important;
  box-shadow:none!important;
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] :is(
  .application-detail, .connection-detail, .application-tab-panel,
  #application-llm-panel, #application-security-panel, #application-topology-panel,
  .tool-modal-dialog, #app-tools, #settings-view
) label{
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] :is(
  .application-detail, .connection-detail, #application-llm-panel,
  #application-security-panel, #application-topology-panel,
  #app-tools, #settings-view
) :is(.hint,.field-help,.meta,.form-hint,.form-description,.help-text,small){
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] :is(
  .application-detail, .connection-detail, #application-llm-panel,
  #application-security-panel, #application-topology-panel,
  #app-tools, #settings-view
) :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select){
  background:var(--utu-field)!important;
  border:1px solid #4d6b7f!important;
  color:var(--utu-text)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] :is(.application-detail,.connection-detail,#settings-view)
:is(input,textarea,select):focus{
  background:#16283a!important;
  border-color:var(--utu-highlight)!important;
  outline:2px solid rgba(69,212,221,.22);
}
:root[data-theme="dark"] :is(.application-detail,.connection-detail,#settings-view)
:is(input,textarea)::placeholder{color:#a4bbcc!important;opacity:1}
:root[data-theme="dark"] :is(#application-llm-panel,.connection-detail)
:is(.llm-policy-grid label,.llm-primary-grid,.llm-settings-panel,.grid,.subpanel){
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] :is(.application-detail,.connection-detail)
:is(.switch,.switch>span,.manual-policy-note,.manual-policy-note span){
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] .application-tab-panel>.grid :is(label,.switch),
:root[data-theme="dark"] .connection-detail>.grid :is(label,.switch) {
  color:var(--utu-text)!important;
}

/* Security: built-in classifications, action rows and preview descriptions. */
:root[data-theme="dark"] :is(
  .security-invariant-note, .sensitive-policy-item, .sensitive-rule-row,
  .sensitive-field-explainer span, .sensitive-empty-state,
  .sanitizer-test-meta, .sensitive-settings-card,
  .application-sanitizer-test, .application-security-intro,
  .sensitive-rule-header
){
  background:var(--utu-panel,#0d1722)!important;
  border-color:var(--utu-stroke)!important;
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] :is(
  .sensitive-policy-item>span,.sensitive-field-explainer strong,
  .sensitive-rule-row label, .sensitive-settings-card :is(h2,h3,strong),
  .security-invariant-note strong
){color:var(--utu-text)!important}
:root[data-theme="dark"] :is(.sensitive-rule-header,.sensitive-settings-card p,
.sensitive-field-explainer span,.application-security-intro p){color:var(--utu-subtext)!important}
:root[data-theme="dark"] .sanitizer-test-output{background:#0d2233!important;color:#d8eff9!important}

/* Topology: remove the white legend/control strips and white canvas.
   Preserve node type icon colors (service/database/queue/...) and links. */
:root[data-theme="dark"] :is(
  .topology-legend,.topology-connect-bar,.topology-type-help,
  .topology-node-editor,.topology-empty,.topology-settings-grid,
  .topology-node-editor .grid,.topology-editor-content
){
  background:var(--utu-panel-soft)!important;
  border-color:var(--utu-stroke)!important;
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] .topology-legend-item{
  background:var(--utu-panel-hover)!important;color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] .topology-visual{
  background-color:#102739!important;
  background-image:radial-gradient(circle,#345870 1px,transparent 1px)!important;
  background-size:22px 22px!important;
  border:1px solid var(--utu-stroke)!important;
}
:root[data-theme="dark"] .topology-canvas{background:transparent!important}
:root[data-theme="dark"] .topology-node-card{background:#1b3b51!important;border-color:#53758a!important;color:var(--utu-text)!important}
:root[data-theme="dark"] .topology-node-body :is(strong,span){color:var(--utu-text)!important}
:root[data-theme="dark"] .topology-legend .topology-legend-item{border:1px solid var(--utu-stroke-soft)}

/* CONNECTIONS: inventory, discovery and nested provider tests. */
:root[data-theme="dark"] :is(
  .prom-inventory-panel,.prom-connect-result,.prom-target-card,
  .prom-target-picker,.prom-binding-card,.prom-target-group,
  .prom-group-title span,.prom-scope-line code,
  .prom-label-chips span,.prom-metric-preview span,
  .prom-binding-context,.prom-full-catalog,.prom-sync-warning,
  .es-log-field-discovery,.es-field-picker-menu,
  .es-field-option:hover,.argocd-resource-list,.argocd-app:hover
){
  background:var(--utu-panel-soft)!important;
  background-image:none!important;
  border-color:var(--utu-stroke)!important;
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] :is(.prom-target-card,.prom-binding-card,.es-log-field-discovery)
:is(h2,h3,h4,strong,summary,label,b){color:var(--utu-text)!important}
:root[data-theme="dark"] :is(.prom-target-card,.prom-binding-card,.prom-inventory-panel)
:is(.prom-source-line,.prom-scope-line,small,.hint,p){color:var(--utu-subtext)!important}

/* Journey strips are reused in Triggers and Notifications and were white. */
:root[data-theme="dark"] :is(
  .setup-step,.setup-outcome-strip,.topology-purpose-strip span,
  .topology-type-help span,.topology-edge-row,.topology-edge-relation,
  .topology-alias-box,.topology-merge-box,.topology-merge-box code,
  .trigger-api-endpoint>span,.trigger-rule-editor-grid section,
  .notification-rule-editor-grid section
){
  background:var(--utu-panel-soft)!important;
  background-image:none!important;
  border-color:var(--utu-stroke)!important;
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] :is(
  .setup-step strong,.topology-purpose-strip strong,.topology-type-help strong,
  .topology-alias-box>strong,.topology-merge-box strong,
  .topology-edge-row strong
){color:var(--utu-text)!important}
:root[data-theme="dark"] .setup-step-number{
  background:#244a61!important;color:var(--utu-highlight)!important;
}
:root[data-theme="dark"] .setup-outcome-strip b{color:var(--utu-highlight)!important}
:root[data-theme="dark"] :is(.topology-edge-relation,.topology-type-help span){
  border:1px solid var(--utu-stroke-soft)!important;
}
/* SETTINGS: previous themes only recolored the containing .panel.
   Specifically recolor each nested guide, policy, account, rule and channel. */
:root[data-theme="dark"] :is(
  .notification-channel-card,.notification-rule-card,.notification-empty,
  .notification-content-section,.notification-check,
  .notification-rule-summary,.notification-rule-editor-grid,
  .trigger-source-card,.trigger-account-card,.trigger-source-meta span,
  .trigger-endpoint-line,.trigger-editor-section,.trigger-rule-row,
  .trigger-api-endpoint,.trigger-policy-strip span,.trigger-empty,
  .trigger-settings-card,.notification-settings-card,
  .trigger-source-icon,.notification-channel-icon,
  .trigger-wizard-step,.notification-guide-step,
  .trigger-policy-guide,.trigger-generated-secret
){
  background:var(--utu-panel-soft)!important;
  background-image:none!important;
  color:var(--utu-subtext)!important;
  border-color:var(--utu-stroke)!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] :is(
  .notification-card-title-row h3,.notification-rule-summary strong,
  .notification-channel-main strong,.notification-content-section h3,
  .trigger-source-title h3,.trigger-source-meta strong,
  .trigger-card-title-row h3,.trigger-endpoint-line code,
  .trigger-source-card strong,.trigger-account-card strong,
  .notification-channel-card strong,.notification-rule-card strong
){color:var(--utu-text)!important}
:root[data-theme="dark"] :is(
  .notification-channel-card p,.notification-secret-state,
  .notification-rule-summary span,.notification-check small,
  .notification-rule-editor-grid p,.trigger-source-card>p,
  .trigger-account-detail,.trigger-section-title p,.trigger-source-meta span,
  .trigger-auth-guide,.trigger-history-reason,.notification-delivery-error
){color:var(--utu-subtext)!important}
:root[data-theme="dark"] :is(
  .trigger-source-card,.trigger-account-card,.notification-channel-card,
  .notification-rule-card
) .actions button:not(.primary):not(.danger){
  background:var(--utu-panel-soft)!important;color:var(--utu-text)!important;border-color:var(--utu-stroke)!important;
}
:root[data-theme="dark"] :is(.notification-delivery-table,.trigger-history-table)
:is(td,th){color:var(--utu-subtext)!important;border-color:var(--utu-stroke)!important}
:root[data-theme="dark"] :is(.notification-modal,.trigger-source-editor,.trigger-credential-dialog)
:is(input,select,textarea){
  background:var(--utu-field)!important;color:var(--utu-text)!important;
  border-color:#4d6b7f!important;
}
:root[data-theme="dark"] :is(.notification-modal,.trigger-source-editor,.trigger-credential-dialog)
:is(label,legend,h2,h3){color:var(--utu-text)!important}
:root[data-theme="dark"] .notification-modal .modal-dialog{
  background:var(--utu-panel)!important;
  color:var(--utu-text)!important;border-color:var(--utu-stroke)!important;
}
:root[data-theme="dark"] :is(.notification-check-list,.trigger-check-list)
:is(label,span){color:var(--utu-subtext)!important}
:root[data-theme="dark"] :is(.notification-channel-icon,.trigger-source-icon) {
  color:var(--utu-highlight)!important;
}
:root[data-theme="dark"] :is(.trigger-compact-toggle input:checked+span){
  background:#0796a7!important;
}

/* INVESTIGATIONS: true paired horizontal rows; no disconnected short sidebar.
   Layout aligns Findings/Details and subsequent verification/
   actions and evidence/reasoning. Children keep their original event handlers. */
#investigation-detail .investigation-detail-header{
  border-radius:18px!important;
  padding:22px 24px!important;
  overflow:visible;
  margin:0 0 12px!important;
}
#investigation-detail .investigation-detail-header .investigation-topline{margin:0 0 16px!important}
#investigation-detail .investigation-title-block h1{
  margin:5px 0 9px!important;
  max-width:100ch;
  font-size:clamp(19px,1.55vw,25px)!important;
  line-height:1.42!important;
  letter-spacing:-.012em;
  overflow-wrap:anywhere;
}
#investigation-detail .investigation-title-block .eyebrow{color:var(--utu-highlight)!important}
#investigation-detail .investigation-meta-strip{
  display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;
}
#investigation-detail .investigation-meta-item{min-width:0;white-space:normal}
#investigation-detail .rca-conclusion-card{
  border-radius:18px!important;
  padding:20px 23px!important;
  overflow:hidden;
}
#investigation-detail .rca-conclusion-title{width:100%;align-items:flex-start;gap:12px}
#investigation-detail .rca-conclusion-title>div{flex:1;min-width:0}
#investigation-detail .rca-conclusion-card h2{
  max-width:none!important;
  font-size:clamp(14px,1.08vw,17px)!important;
  line-height:1.6!important;
  font-weight:570!important;
  margin:4px 0 0!important;
  color:var(--utu-text)!important;
  overflow-wrap:anywhere;
}
#investigation-detail .utu-investigation-columns,
.utu-cross-app-columns{
  display:flex!important;
  flex-direction:column!important;
  gap:12px!important;
  width:100%!important;
}
#investigation-detail .utu-investigation-row,
.utu-cross-app-columns .utu-investigation-row{
  display:grid;
  grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);
  gap:12px;
  width:100%;
  min-width:0;
  align-items:start;
}
#investigation-detail .utu-investigation-row-wide,
.utu-cross-app-columns .utu-investigation-row-wide{
  grid-template-columns:minmax(0,1fr);
}
#investigation-detail .utu-investigation-main,
#investigation-detail .utu-investigation-aside,
.utu-cross-app-columns .utu-investigation-main,
.utu-cross-app-columns .utu-investigation-aside{
  width:100%;min-width:0;display:flex;flex-direction:column;gap:0;
}
#investigation-detail .utu-investigation-main>*,#investigation-detail .utu-investigation-aside>*,
.utu-cross-app-columns .utu-investigation-main>*,.utu-cross-app-columns .utu-investigation-aside>*{
  width:100%;max-width:none;min-width:0;box-sizing:border-box;
}
#investigation-detail .rca-conclusion-card + .utu-investigation-columns{margin-top:0}
#investigation-detail .rca-panel,
#investigation-detail .execution-timeline-shell,#investigation-detail .utu-investigation-details,
#investigation-detail .manual-verification-section,#investigation-detail .rca-response-section,
#investigation-detail .rca-why-shell,#investigation-detail .rca-evidence-gap {
  border-radius:15px!important;box-shadow:none!important;
}
#investigation-detail .rca-panel{min-height:0!important}
#investigation-detail .rca-section-kicker{min-height:25px!important}
#investigation-detail .execution-timeline-shell>summary{
  padding:13px 15px!important;min-height:49px;
}
#investigation-detail .utu-investigation-details{padding:17px 18px!important}
#investigation-detail .utu-investigation-details dl{gap:8px!important}
#investigation-detail .utu-investigation-details dl>div{
  grid-template-columns:minmax(75px,.8fr) minmax(0,1.2fr);
}
#investigation-detail .manual-verification-section{margin:0!important}
#investigation-detail .rca-section.rca-response-section{margin:0!important}
#investigation-detail .rca-evidence-gap{align-items:flex-start}
:root[data-theme="light"] #investigation-detail .rca-conclusion-card h2{
  color:#20394b!important;
}
@media(max-width:900px){
  #investigation-detail .utu-investigation-row,
  .utu-cross-app-columns .utu-investigation-row{
    grid-template-columns:minmax(0,1fr);
  }
  #investigation-detail .investigation-detail-header{padding:17px 18px!important}
  #investigation-detail .rca-conclusion-card{padding:16px 18px!important}
}


/* Final audited nested surfaces: Application creation, Tool Git scope,
   Dependencies, and User forms. These live outside the general editor cards. */
:root[data-theme="dark"] :is(
  .application-create-panel,
  .application-create-panel>.grid,
  #user-editor>.grid,
  #user-editor #user-application-scope,
  .tool-modal-dialog .git-repository,
  .tool-modal-dialog .git-scope-family,
  .tool-modal-dialog .git-resource-choices label,
  .cross-app-dependency-row,
  .cross-app-dependency-form,
  .application-tab-panel[data-app-tab="dependencies"] .empty-state
){
  background:var(--utu-panel-soft)!important;
  background-image:none!important;
  border:1px solid var(--utu-stroke)!important;
  box-shadow:none!important;
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] .application-create-panel{
  background:var(--utu-panel)!important;
  border-radius:20px;
  padding:26px!important;
}
:root[data-theme="dark"] .application-create-panel>.grid{
  border:0!important;
  background:transparent!important;
  padding:0!important;
}
:root[data-theme="dark"] .application-create-panel>.actions{
  border-color:var(--utu-stroke)!important;
}
:root[data-theme="dark"] :is(
  .application-create-panel .application-create-intro h2,
  .application-create-panel label,
  #user-editor>.grid label,
  #user-editor #user-application-scope :is(label,strong),
  .cross-app-dependency-row strong,
  .tool-modal-dialog .git-repository :is(strong,label)
){
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] :is(
  .application-create-panel .application-create-intro p,
  .application-create-panel .hint,
  #user-editor .hint,
  #user-editor .field-help,
  .cross-app-dependency-row :is(p,.meta,small),
  .tool-modal-dialog .git-repository :is(small,.hint,p)
){
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] .tool-modal-dialog .git-repository{
  padding:13px 15px!important;
  border-radius:12px;
}
:root[data-theme="dark"] .tool-modal-dialog .git-repository-list{
  gap:10px;
}
:root[data-theme="dark"] .tool-modal-dialog .git-repo-header{
  align-items:center;gap:11px;
}
:root .tool-modal-dialog .git-repo-header input[type="checkbox"],
:root .tool-modal-dialog .git-resource-choices input[type="checkbox"]{
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  min-height:16px!important;
  margin:0!important;
  padding:0!important;
  flex:0 0 16px!important;
  accent-color:#0eaec1;
}
:root[data-theme="dark"] .tool-modal-dialog .git-repo-scope{
  grid-template-columns:minmax(155px,.85fr) minmax(180px,1.4fr) auto;
  align-items:end;
  gap:12px;
}
:root[data-theme="dark"] .tool-modal-dialog .git-repo-scope input,
:root[data-theme="dark"] .tool-modal-dialog .git-repo-scope select{
  background:var(--utu-field)!important;
  color:var(--utu-text)!important;
  border:1px solid #527084!important;
}
:root[data-theme="dark"] .tool-modal-dialog .git-scope-family{
  border-radius:9px;
}
:root[data-theme="dark"] .tool-modal-dialog .git-resource-choices label{
  display:inline-flex;
  flex-direction:row;
  align-items:center;
  gap:7px;
  border-radius:8px;
}
:root[data-theme="dark"] .cross-app-dependency-row{
  padding:17px 19px;
  border-radius:14px!important;
}
:root[data-theme="dark"] .cross-app-dependency-row .badge.ok{
  background:#154638!important;color:#9af4ce!important;
  border-color:#347a62!important;
}
:root[data-theme="dark"] #user-editor>.grid{
  padding:20px!important;
  border-radius:16px!important;
}
:root[data-theme="dark"] #user-editor #user-application-scope{
  background:var(--utu-panel)!important;
  border-radius:16px!important;
}
:root[data-theme="dark"] #user-editor :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea),
:root[data-theme="dark"] .application-create-panel :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select){
  background:var(--utu-field)!important;
  border:1px solid #527084!important;
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] #user-editor #user-application-options label{
  color:var(--utu-subtext)!important;
}
:root[data-theme="dark"] #user-editor .switch>span,
:root[data-theme="dark"] .application-create-panel .switch>span{
  color:var(--utu-text)!important;
}

/* Both Investigation detail variants: one full-width card per step, top-to-bottom.
   No masonry, no non-matching card heights, no large empty columns. */
#investigation-detail .utu-investigation-stack,
.utu-cross-app-stack{
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:12px!important;
  width:100%!important;
  min-width:0;
  margin:0!important;
}
#investigation-detail .utu-investigation-stack>*,
.utu-cross-app-stack>*{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  box-sizing:border-box;
}
#investigation-detail .utu-investigation-stack>.rca-section{
  padding:17px 19px!important;
  background:var(--utu-panel)!important;
  border:1px solid var(--utu-stroke)!important;
  border-radius:16px!important;
  box-shadow:none!important;
}
#investigation-detail .utu-investigation-stack>.rca-findings-section .rca-insight-grid,
#investigation-detail .utu-investigation-stack>.rca-response-section .rca-insight-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:12px;
}
#investigation-detail .utu-investigation-stack>.rca-why-shell,
#investigation-detail .utu-investigation-stack>.execution-timeline-shell,
#investigation-detail .utu-investigation-stack>.utu-investigation-details,
.utu-cross-app-stack>.utu-investigation-details{
  border-radius:16px!important;
}
#investigation-detail .utu-investigation-stack>.manual-verification-section{
  padding:19px!important;
}
.utu-cross-app-stack>.cross-app-summary-card,
.utu-cross-app-stack>.cross-app-manual-verification{
  width:100%!important;
  border:1px solid var(--utu-stroke)!important;
  border-radius:16px!important;
  box-shadow:none!important;
}
:root[data-theme="dark"] .utu-cross-app-stack>.cross-app-summary-card,
:root[data-theme="dark"] .utu-cross-app-stack>.cross-app-manual-verification{
  background:var(--utu-panel)!important;color:var(--utu-text)!important;
}
@media(max-width:760px){
  #investigation-detail .utu-investigation-stack>.rca-findings-section .rca-insight-grid,
  #investigation-detail .utu-investigation-stack>.rca-response-section .rca-insight-grid{
    grid-template-columns:minmax(0,1fr);
  }
  :root .tool-modal-dialog .git-repo-scope{
    grid-template-columns:minmax(0,1fr)!important;
  }
  #investigation-detail .utu-investigation-stack>.rca-section{padding:14px!important}
}

/* LIGHT: Prometheus Application target cards reuse Connection target inventory.
 * Keep application-only scope controls readable without changing PromQL semantics. */
#application-tool-modal .prom-target-picker .prom-target-list.prom-binding-list{
  grid-template-columns:repeat(2,minmax(0,1fr));
  margin-top:10px;
}
#application-tool-modal .prom-target-picker .prom-binding-card{
  min-width:0;
}
#application-tool-modal .prom-target-picker .prom-binding-card .prom-binding-select{
  min-width:0;align-items:center;
}
#application-tool-modal .prom-target-picker .prom-binding-card .prom-component-editor{
  margin-top:13px;
}
#application-tool-modal .prom-target-picker .prom-binding-card .prom-component-editor label{
  display:block;font-size:12px;font-weight:650;
}
#application-tool-modal .prom-target-picker .prom-binding-card .prom-component-editor input{
  box-sizing:border-box;width:100%;margin-top:6px;
}
#application-tool-modal .prom-target-picker .prom-tool-advanced{
  margin-top:12px;padding:10px 12px;
  border:1px solid var(--utu-stroke,#305872);border-radius:10px;
  background:transparent;
}
#application-tool-modal .prom-target-picker .prom-tool-advanced>summary{
  cursor:pointer;font-size:12px;font-weight:650;
}
#application-tool-modal .prom-target-picker .prom-tool-advanced .prom-binding-details{
  margin-top:10px;
}
:root[data-theme="dark"] #application-tool-modal .prom-target-picker .prom-binding-card
:is(.prom-component-editor label,.prom-tool-advanced summary,.prom-binding-details label){
  color:var(--utu-text)!important;
}
:root[data-theme="dark"] #application-tool-modal .prom-target-picker .prom-binding-card
:is(.prom-component-editor input,.prom-binding-details input,.prom-source-override-details input){
  color:var(--utu-text)!important;
  background:var(--utu-panel-soft)!important;
  border-color:var(--utu-stroke)!important;
}
@media(max-width:1000px){
  #application-tool-modal .prom-target-picker .prom-target-list.prom-binding-list{
    grid-template-columns:1fr;
  }
}

/* LIGHT: Prometheus Tool target list matches the compact Connection table.
 * Existing binding inputs remain in hidden form fields; PromQL policy stays unchanged. */
#application-tool-modal .prom-target-picker .prom-tool-table-wrap{
  width:100%;max-width:100%;overflow-x:auto;
  margin-top:12px;border:1px solid var(--utu-stroke,#31536a);
  border-radius:13px;background:transparent;
}
#application-tool-modal .prom-tool-target-table{
  display:table;width:100%;min-width:1460px;border-collapse:collapse;
  background:transparent;table-layout:fixed;
}
#application-tool-modal .prom-tool-target-table thead{display:table-header-group}
#application-tool-modal .prom-tool-target-table tbody.prom-binding-list{
  display:table-row-group!important;
}
#application-tool-modal .prom-tool-target-table tr.prom-binding-card{
  display:table-row!important;opacity:1!important;
  background:transparent!important;border:0!important;
  border-bottom:1px solid var(--utu-stroke,#31536a)!important;
  box-shadow:none!important;transition:background .15s ease;
}
#application-tool-modal .prom-tool-target-table tr.prom-binding-card.selected{
  background:rgba(15,126,174,.055)!important;
}
#application-tool-modal .prom-tool-target-table th,
#application-tool-modal .prom-tool-target-table td{
  border:0;padding:11px 10px;text-align:left;vertical-align:top;
  font-size:12px;line-height:1.5;color:var(--utu-text,#dceefa);
}
#application-tool-modal .prom-tool-target-table thead th{
  background:var(--utu-panel-soft,#132c3f);font-size:11px;
  color:var(--utu-subtext,#a9c3d4);font-weight:750;
  white-space:nowrap;border-bottom:1px solid var(--utu-stroke,#31536a);
}
/* Explicit widths: percentage sum plus the checkbox column used to
 * overrun the Health column and paint into Exporter. Keep horizontal scroll. */
#application-tool-modal .prom-tool-target-table th:first-child,
#application-tool-modal .prom-tool-target-table td.prom-table-select{
  width:48px;padding-left:13px;
}
#application-tool-modal .prom-tool-target-table th:nth-child(2){width:205px}
#application-tool-modal .prom-tool-target-table th:nth-child(3){width:170px}
#application-tool-modal .prom-tool-target-table th:nth-child(4){width:220px}
#application-tool-modal .prom-tool-target-table th:nth-child(5){width:325px}
#application-tool-modal .prom-tool-target-table th:nth-child(6){width:90px}
#application-tool-modal .prom-tool-target-table th:nth-child(7){width:180px}
#application-tool-modal .prom-tool-target-table th:nth-child(8){width:220px}
#application-tool-modal .prom-tool-target-table td{overflow-wrap:anywhere}
#application-tool-modal .prom-tool-target-table .prom-target-select{
  width:16px;height:16px;min-width:16px;margin:3px 0 0;
  accent-color:var(--utu-highlight,#10bcd3);
}
#application-tool-modal .prom-tool-target-table .prom-table-target{
  display:block;font-size:12px;color:var(--utu-text,#e8f4ff);
}
#application-tool-modal .prom-tool-target-table .prom-table-job{
  display:block;color:var(--utu-subtext,#a9c3d4);margin-top:3px;
  font-size:11px;
}
#application-tool-modal .prom-tool-target-table .prom-table-health{
  display:inline-flex;gap:7px;align-items:center;flex-wrap:wrap;
  white-space:normal;max-width:100%;overflow-wrap:anywhere;
  color:var(--utu-subtext,#a9c3d4);
}
#application-tool-modal .prom-tool-target-table .prom-table-exporter{
  max-width:100%;overflow-wrap:anywhere;word-break:break-word;
}
#application-tool-modal .prom-tool-target-table .prom-table-health.up{color:#27d5a3}
#application-tool-modal .prom-tool-target-table .prom-table-health i{
  width:8px;height:8px;border-radius:50%;background:currentColor;flex-shrink:0;
}
#application-tool-modal .prom-tool-target-table .prom-table-scope code,
#application-tool-modal .prom-tool-target-table .prom-table-series-scope{
  display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;font-size:11px;color:var(--utu-text,#e8f4ff);
}
#application-tool-modal .prom-tool-target-table .prom-table-series-scope{
  color:var(--utu-subtext,#a9c3d4);margin-top:4px;
}
#application-tool-modal .prom-tool-target-table .prom-label-chips{
  display:flex;flex-wrap:wrap;gap:4px;margin-top:7px;
}
#application-tool-modal .prom-tool-target-table .prom-label-chips span{
  font-size:10px;max-width:100%;background:transparent!important;
  color:var(--utu-subtext,#a9c3d4)!important;border-color:var(--utu-stroke,#31536a)!important;
}
#application-tool-modal .prom-tool-target-table .prom-table-error{
  color:var(--utu-subtext,#a9c3d4);max-width:165px;
}
#application-tool-modal .prom-tool-target-table .prom-table-component input.prom-component-name{
  box-sizing:border-box;width:100%;min-width:110px;max-width:100%;
  padding:8px;border:1px solid var(--utu-stroke,#31536a)!important;
  background:var(--utu-panel-soft,#16334a)!important;
  color:var(--utu-text,#e8f4ff)!important;border-radius:8px;font-size:11.5px;
}

/* Trace Core Field discovery: responsive automatic/custom mappings. */
#application-tool-modal .utu-trace-core-row .utu-trace-core-controls{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:8px 14px;min-width:0;width:100%;align-items:center;
}
#application-tool-modal .utu-trace-core-controls .hint{
  grid-column:1 / -1;margin:0 0 2px;overflow-wrap:anywhere;
  color:var(--utu-subtext,#a9c3d4);
}
#application-tool-modal .utu-trace-core-controls label{
  display:flex;align-items:center;gap:7px;min-width:0;
  font-size:12px;font-weight:600;color:var(--utu-text,#e8f4ff);
}
#application-tool-modal .utu-trace-core-controls input:not([type=radio]){
  grid-column:1 / -1;width:100%;box-sizing:border-box;
  border:1px solid var(--utu-stroke,#31536a)!important;
  background:var(--utu-panel-soft,#16334a)!important;
  color:var(--utu-text,#e8f4ff)!important;border-radius:8px;
  padding:10px 12px;min-width:0;
}
#application-tool-modal .utu-trace-core-controls input[disabled]{
  opacity:.86;cursor:not-allowed;
  color:var(--utu-text,#e8f4ff);
}
#application-tool-modal .utu-trace-core-row{
  align-items:center;
}
#application-tool-modal .utu-trace-core-controls label{
  margin:0;
  white-space:nowrap;
}
#application-tool-modal .utu-trace-core-controls input[type=radio]{
  accent-color:var(--utu-highlight,#10bcd3);
}
@media(max-width:720px){
  #application-tool-modal .utu-trace-core-row .utu-trace-core-controls{
    grid-template-columns:minmax(0,1fr);
  }
  #application-tool-modal .utu-trace-core-controls .hint,
  #application-tool-modal .utu-trace-core-controls input:not([type=radio]){
    grid-column:1;
  }
}

/* Prometheus shared Target authorization chooser — accessible above Tool editor. */
.prom-scope-backdrop{position:fixed;inset:0;z-index:2400;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(2,10,24,.78);backdrop-filter:blur(6px)}
.prom-scope-dialog{width:min(660px,100%);max-height:min(780px,94vh);overflow:auto;padding:24px;border:1px solid var(--utu-stroke,#334e68);border-radius:18px;background:var(--utu-panel,#10253b);color:var(--utu-text,#eef5fa);box-shadow:0 32px 70px rgba(0,0,0,.4)}
.prom-scope-dialog header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.prom-scope-dialog h3{margin:4px 0;font-size:20px}
.prom-scope-dialog p,.prom-scope-dialog small{color:var(--utu-subtext,#a9bed0)}
.prom-scope-dialog button,.prom-scope-dialog select{border:1px solid var(--utu-stroke,#334e68);border-radius:9px;padding:8px 10px;background:var(--utu-panel-soft,#182f47);color:var(--utu-text,#eef5fa)}
.prom-scope-dialog button:hover{border-color:#72a9d7}
.prom-scope-dialog .prom-scope-mode{display:flex;gap:10px;align-items:flex-start;padding:14px;margin:8px 0;border:1px solid var(--utu-stroke,#334e68);border-radius:11px;cursor:pointer;background:var(--utu-panel-soft,#182f47)}
.prom-scope-mode span{display:grid;gap:4px}.prom-scope-mode small{display:block;font-size:12px}
.prom-scope-shared{padding:12px;margin-top:12px;border:1px solid var(--utu-stroke,#334e68);border-radius:12px}
.prom-scope-rule{padding:11px 0;border-bottom:1px solid var(--utu-stroke,#334e68)}
.prom-scope-rule>div:first-child{display:flex;justify-content:space-between;align-items:center;gap:8px}
.prom-scope-values{display:flex;flex-wrap:wrap;gap:8px;padding:10px 0;max-height:168px;overflow-y:auto}
.prom-scope-values label{display:flex;gap:6px;align-items:center;padding:5px 8px;border:1px solid var(--utu-stroke,#334e68);border-radius:8px;background:var(--utu-panel-soft,#182f47);font-size:12px;word-break:break-all}
.prom-scope-values input{flex:none}
.prom-scope-warning{color:#ffbd80;font-size:12px;display:block;margin:4px 0}
.prom-scope-add{display:flex;gap:8px;margin:12px 0}.prom-scope-add select{flex:1;min-width:0}
.prom-scope-dialog footer{display:flex;gap:12px;justify-content:flex-end;margin-top:20px}
.prom-scope-apply{background:#205c95!important;color:#fff!important}
.prom-edit-access{display:inline-block;margin-top:6px;font-size:11px;padding:4px 8px;border:1px solid var(--utu-stroke,#334e68);border-radius:8px;background:var(--utu-panel-soft,#182f47);color:var(--utu-text,#eef5fa)}
.prom-scope-dialog .hidden,.prom-edit-access.hidden{display:none!important}

/* Compact dedicated/shared controls, with text to the RIGHT of the radio. */
.prom-scope-dialog .prom-scope-mode{
  display:flex!important;flex-direction:row!important;align-items:center!important;
  justify-content:flex-start!important;gap:12px!important;
  padding:11px 14px!important;min-height:62px!important;
}
.prom-scope-dialog .prom-scope-mode input[type="radio"]{
  flex:0 0 16px!important;display:block!important;
  appearance:radio!important;-webkit-appearance:radio!important;
  width:16px!important;height:16px!important;min-width:16px!important;
  min-height:16px!important;max-width:16px!important;max-height:16px!important;
  margin:0!important;padding:0!important;border-radius:50%!important;
  accent-color:#14cce8!important;box-shadow:none!important;
}
.prom-scope-dialog .prom-scope-mode>span{
  flex:1!important;min-width:0!important;display:flex!important;
  flex-direction:column!important;align-items:flex-start!important;gap:4px!important;
}
.prom-scope-dialog .prom-scope-mode strong{color:var(--utu-text,#eef5fa);line-height:1.3}
.prom-scope-dialog .prom-scope-mode small{color:var(--utu-subtext,#a9bed0);line-height:1.3}
/* Each label: permitted LEFT, discovered/available RIGHT; click an arrow to move. */
.prom-scope-dialog .prom-scope-transfer{
  display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:12px;margin:12px 0;
}
.prom-scope-dialog .prom-scope-transfer-panel{
  min-width:0;padding:10px;border:1px solid var(--utu-stroke,#334e68);
  border-radius:11px;background:rgba(10,25,43,.5);
}
.prom-scope-dialog .prom-scope-transfer-panel>strong{
  display:block;font-size:12px;line-height:1.35;margin-bottom:8px;
}
.prom-scope-dialog .prom-scope-transfer-list{
  display:flex;flex-direction:column;gap:5px;max-height:205px;min-height:54px;
  overflow:auto;scrollbar-width:thin;
}
.prom-scope-dialog .prom-scope-move{
  display:flex!important;align-items:center;justify-content:space-between;
  gap:8px;width:100%;text-align:left;font-size:12px;padding:7px 9px!important;
  color:var(--utu-text,#eef5fa)!important;cursor:pointer;
}
.prom-scope-dialog .prom-scope-move span:not(.prom-scope-arrow){
  overflow-wrap:anywhere;min-width:0;
}
.prom-scope-dialog .prom-scope-arrow{flex:0 0 auto;color:#15cce8;font-size:16px;line-height:1}
.prom-scope-coverage-warning,.prom-scope-coverage-ok{
  margin:12px 0;padding:11px;border-radius:11px;font-size:12px;
  border:1px solid #a37a3e;color:#ffdab0;background:rgba(137,91,30,.15);
}
.prom-scope-coverage-warning p{margin:6px 0;color:#ffdab0}
.prom-scope-coverage-ok{border-color:#397b72;color:#b1e7dc;background:rgba(24,104,94,.13)}
@media(max-width:540px){
  .prom-scope-dialog .prom-scope-transfer{grid-template-columns:minmax(0,1fr)}
}

/* Metrics parity / VM05: one component table, not a second Selected cards list. */
#application-tool-modal .vm-tool-target-table,
#app-tools .vm-tool-target-table{
  display:table;width:100%;min-width:1090px;table-layout:fixed;
  border-collapse:collapse;background:transparent;
}
#application-tool-modal .vm-tool-target-table th:first-child{width:52px}
#application-tool-modal .vm-tool-target-table th:nth-child(2){width:225px}
#application-tool-modal .vm-tool-target-table th:nth-child(3){width:280px}
#application-tool-modal .vm-tool-target-table th:nth-child(4){width:300px}
#application-tool-modal .vm-tool-target-table th:nth-child(5){width:230px}
#application-tool-modal .vm-tool-target-table .vm-component-row.selected{
  background:rgba(15,126,174,.06)!important;
}
#application-tool-modal .vm-tool-target-table .vm-component-stale{
  opacity:.78;
}
#application-tool-modal .vm-tool-target-table .vm-row-access-status{
  display:block;overflow-wrap:anywhere;margin-bottom:6px;
  color:var(--utu-subtext,#a9c3d4);
}
#application-tool-modal .vm-tool-target-table input.vm-row-component-name,
#app-tools .vm-tool-target-table input.vm-row-component-name{
  box-sizing:border-box;width:100%;min-width:0;
  padding:8px 10px;border:1px solid var(--utu-stroke,#31536a);
  background:var(--utu-panel-soft,#16334a);color:var(--utu-text,#e8f4ff);
  border-radius:8px;
}
#application-tool-modal .vm-tool-target-table input.vm-row-component-name:disabled{
  opacity:.55;
}
