/* Singit Ops Hub — shared interaction & accessibility layer for every hosted view.
   Loaded AFTER each page's own <style>, so it only tightens what the pages already do:
   focus rings, touch targets, reduced motion, screen-reader helpers, skeletons, table polish.
   Colours stay per page (each tool keeps its accent); the neutrals and behaviour are shared. */

/* Focus: every interactive element gets a visible ring, keyboard only (no ring on mouse click). */
:where(button, [role="tab"], [role="button"], a, input, select, textarea, summary, .chip, .tab, .btn, .term, .node):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(109, 93, 252, .25)), 0 0 0 5px var(--accent, #6d5dfc);
  border-radius: 8px;
}
:where(a):focus-visible { border-radius: 4px; }

/* Touch targets: 36 px minimum on desktop-first controls, 44 px on touch devices. */
.chip, .tab, .btn, .bar select, .bar input[type="date"], .filters .chip { min-height: 36px; }
@media (pointer: coarse) {
  .chip, .tab, .btn, .bar select, .bar input[type="date"], .filters .chip, .legend summary { min-height: 44px; }
  .chip, .btn { padding-left: 14px; padding-right: 14px; }
  td, th { padding-top: 9px; padding-bottom: 9px; }
}
.chip, .btn, .tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; }
.btn:hover:not([disabled]) { filter: brightness(.96); }
.btn:active:not([disabled]) { transform: translateY(0); filter: brightness(.92); }
.btn[disabled], .chip[disabled] { opacity: .5; cursor: not-allowed; }
.tab:hover { background: var(--bg-soft); }

/* Motion: honour the OS setting everywhere. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Skeleton: reserve the space while a feed loads, instead of a jumping page. */
.skel { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--chip) 25%, var(--line-soft) 50%, var(--chip) 75%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
.skel.lg { height: 22px; width: 60%; margin-top: 6px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Tables: readable headers, quiet hover, consistent numerals. */
th { font-size: 11px; }
tbody tr:hover > td { background: var(--bg-soft); }
td.r, th.r { font-variant-numeric: tabular-nums; }
.muted { font-size: 12px; }

/* Status text never relies on colour alone: tags always carry a word, and get an icon-like leading dot. */
.tag.ok::before, .tag.bad::before, .tag.warn::before, .tag.missing::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }

/* Hub rows: vector icons replace emoji. */
.row .icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.row .icon { color: var(--text-2); }

/* Details/summary: the legend is a control, make it look like one on hover. */
.legend summary:hover { color: var(--text); }

/* Small screens: gutters and no horizontal scroll on the filter bars. */
@media (max-width: 640px) {
  .bar { row-gap: 8px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
