/* Controls and inline components. */

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel);
  color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--line-2); color: var(--text); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--focus); border-color: var(--focus); color: var(--accent-ink); }
.btn-on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft); color: var(--text); }
.btn-select .caret { color: var(--text-3); margin-right: -3px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--text-2);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }

.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.seg-btn {
  height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.seg-btn:hover { color: var(--text); background: var(--hover); }
.seg-btn[aria-pressed="true"], .seg-btn.seg-on { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.seg .btn-select { border: 0; height: 28px; }
.seg-sm .seg-btn { height: 24px; padding: 0 8px; font-size: 12px; }

.input { height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--text); }
.input:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-sm { height: 28px; width: 76px; font-size: 13px; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }

.chain { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chain-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chain); flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--chain) 22%, transparent); }
.chain-compact .chain-name { color: var(--text-2); font-size: 13px; }

.cat { --tint: var(--g-none); display: inline-flex; align-items: center; gap: 5px; max-width: 100%; color: var(--text); font-size: 13px; min-width: 0; }
.cat .icon { color: var(--tint); flex: none; }
.cat-label { flex: 0 1 auto; min-width: 5ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-details { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); font-size: 12px; white-space: nowrap; }
[data-group="exec"] { --tint: var(--g-exec); }
[data-group="detector"] { --tint: var(--g-detector); }
[data-group="data"] { --tint: var(--g-data); }
[data-group="coverage"] { --tint: var(--g-coverage); }
[data-group="notspread"] { --tint: var(--g-notspread); }
[data-group="scope"] { --tint: var(--g-scope); }
[data-group="none"] { --tint: var(--g-none); }

.hex {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px; margin: -1px -4px;
  border: 0; border-radius: 4px; background: transparent; font-family: var(--mono); font-size: 12.5px; color: var(--text);
}
.hex:hover { background: var(--hover); }
.hex-copy { color: var(--text-3); opacity: 0; transition: opacity 0.12s; }
.hex:hover .hex-copy, .hex:focus-visible .hex-copy { opacity: 1; }
.hex-wrap { display: inline-flex; align-items: center; gap: 6px; }
.ext { color: var(--text-3); display: inline-grid; place-items: center; }
.ext-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.ext-link .icon { color: var(--text-3); }
.bot-link { color: var(--text-2); font-size: 12.5px; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); font-size: 12px; border: 1px solid var(--line); }
.tag-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); gap: 4px; }
.resolved { margin-left: 6px; height: 20px; padding: 0 6px; }
.tag-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); margin-left: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12px; }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); }
.chip-x:hover { background: var(--hover); }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-crit { color: var(--crit); }
.status-muted { color: var(--text-3); }

.popover {
  position: absolute; z-index: 60; min-width: 220px; max-height: min(70vh, 460px); overflow: auto;
  padding: 6px; border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow);
  animation: pop 0.14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.checklist { display: grid; gap: 1px; }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.check:hover { background: var(--hover); }
.check input { accent-color: var(--accent); margin: 0; }
.check-label { display: inline-flex; align-items: center; gap: 7px; }
.check-label .icon { color: var(--tint); }
.check-count { margin-left: auto; color: var(--text-3); }
.checklist-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.range-form { display: grid; gap: 10px; padding: 8px; width: 260px; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.field input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--text); }
.field-hint { color: var(--text-3); font-size: 12px; }
.field-error { color: var(--neg); font-size: 12px; min-height: 0; }
.field-error:empty { display: none; }

.panel { padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.panel-note { color: var(--text-3); font-size: 12px; flex-basis: 100%; }

.kv { display: grid; gap: 6px; }
.kv-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.kv-row dt { color: var(--text-3); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.fact dt { color: var(--text-3); font-size: 12px; }
.fact dd { font-variant-numeric: tabular-nums; font-size: 14px; }

.state { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; text-align: center; }
.state-title { font-size: 16px; font-weight: 600; }
.state-text { color: var(--text-2); max-width: 52ch; }
.state-error { color: var(--warn); }
.state-error .state-text { color: var(--text-2); }

.skel-group { display: grid; gap: 10px; }
.skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.skel-line { height: 14px; }
.skel-line:nth-child(3n) { width: 70%; }
.skel-hero { height: 150px; border-radius: var(--r-lg); }
.skel-kpi-group { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.skel-kpi { height: 74px; }
.skel-chart { height: 260px; border-radius: var(--r-lg); }
.skel-row { height: 36px; }
.busy { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 90; display: grid; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); animation: pop 0.16s var(--ease); transition: opacity 0.3s; }
.toast-warn .icon { color: var(--warn); }
.toast-out { opacity: 0; }

.tip { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; opacity: 0; transition: opacity 0.08s; }
.tip-on { opacity: 1; }
.tip-body { min-width: 170px; max-width: 280px; padding: 9px 11px; border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow); font-size: 12.5px; }
.tip-title { font-weight: 600; margin-bottom: 6px; }
.tip-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; line-height: 1.7; }
.tip-swatch { width: 10px; height: 10px; border-radius: 3px; }
.tip-swatch-none { background: transparent; }
.tip-label { color: var(--text-2); }
.tip-value { font-variant-numeric: tabular-nums; }
.tip-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--text-3); }

.help { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.help::backdrop { background: var(--scrim); }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; }
.help-head h2 { font-size: 16px; }
.help-list { display: grid; padding: 6px 20px 18px; }
.help-row { display: grid; grid-template-columns: 110px 1fr; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.help-row:last-child { border-bottom: 0; }
.help-row dd { color: var(--text-2); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--tint); flex: none; }
.note-warn { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); }
.note-warn .icon { color: var(--warn); margin-top: 3px; flex: none; }
