/* hnaconsole/components.css — the shared components of every HNA console (Unity, config), 2026-10-10.
   Spec: DESIGN.md §Components. Visuals live here; each console builds the behaviour (keyboard, data) in its own stack
   against the same class names. Load after theme-light.css, theme-dark.css and scale.css. Uses only theme variables. */

/* 10 · focus — one ring everywhere; inputs get an accent border + soft halo; clipped containers use .focus-inset */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.focus-inset:focus-visible, .focus-inset :focus-visible { outline-offset: -2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
main:focus { outline: none; }

/* 8 · keyboard hints */
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .3125rem; font-family: var(--mono); font-size: var(--fs-caption); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--hairline-strong); border-bottom-width: 2px; border-radius: var(--r-sm); line-height: 1; }
.kbd + .kbd { margin-left: .25rem; }

/* 3 · status pills — the glyph SHAPE carries the state as well as the colour (works in greyscale) */
.pill { --pill: var(--ink-3); display: inline-flex; align-items: center; gap: .375rem; height: 1.375rem; padding: 0 .5rem 0 .4375rem; font-size: var(--fs-caption); font-weight: 600; line-height: 1; white-space: nowrap; color: var(--pill); background: color-mix(in srgb, var(--pill) 13%, transparent); border: 1px solid color-mix(in srgb, var(--pill) 28%, transparent); border-radius: var(--r-sm); }
.pill.good { --pill: var(--good-ink); } .pill.warn { --pill: var(--warn); } .pill.bad { --pill: var(--critical); } .pill.info { --pill: var(--accent-ink); } .pill.neutral { --pill: var(--ink-3); }
.pill::before { content: ""; flex: none; width: .5rem; height: .5rem; border-radius: 50%; box-sizing: border-box; }
.pill[data-shape="dot"]::before { background: currentColor; }
.pill[data-shape="ring"]::before { border: 2px solid currentColor; }
.pill[data-shape="half"]::before { border: 2px solid currentColor; border-right-color: transparent; border-bottom-color: transparent; transform: rotate(-45deg); }
.pill[data-shape="dashed"]::before { border: 2px dashed currentColor; }
.pill[data-shape="slashed"] { position: relative; }
.pill[data-shape="slashed"]::before { border: 2px solid currentColor; }
.pill[data-shape="slashed"]::after { content: ""; position: absolute; left: .4375rem; top: 50%; width: .5rem; height: 2px; background: currentColor; transform: translateY(-50%) rotate(-45deg); }

/* 4 · skeletons and refresh — first load with no layout yet: the HNA mark (hna-mark.css); a known layout: skeleton rows;
   a refresh: keep the old content, dim it only after 150ms (the console adds .is-refreshing after that delay) */
.skel { display: block; height: .875rem; margin: .625rem 0; background: var(--surface-2); border-radius: var(--r-sm); animation: skel-pulse 1.4s ease-in-out infinite; }
.skel:nth-child(3n+1) { width: 92%; } .skel:nth-child(3n+2) { width: 78%; } .skel:nth-child(3n) { width: 64%; }
.skel-rows { padding: .5rem 1.125rem; }
@keyframes skel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.is-refreshing { opacity: .45; pointer-events: none; transition: opacity 120ms; }

/* 5 · filter bar — a set filter is visibly set; "N of M"; a quiet reset */
.is-set { border-color: var(--accent) !important; color: var(--accent-ink) !important; }
.count-of { font-size: var(--fs-small); color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.count-of b { color: var(--ink); font-weight: 600; }
.reset-link { font-size: var(--fs-small); color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.reset-link:hover { color: var(--ink); }

/* 6 · rail footer — help, environment, build */
.rail-foot { display: flex; flex-direction: column; gap: .375rem; padding: .75rem .5rem 0; margin-top: .5rem; border-top: 1px solid var(--hairline); font-size: var(--fs-small); color: var(--ink-3); }
.rail-foot a { color: var(--ink-2); text-decoration: none; display: flex; align-items: center; gap: .5rem; padding: .25rem .375rem; border-radius: var(--r-sm); }
.rail-foot a:hover { background: var(--surface-2); color: var(--ink); }
.rail-foot .meta { display: flex; align-items: center; gap: .5rem; padding: 0 .375rem; }
.env-badge { display: inline-flex; align-items: center; height: 1.25rem; padding: 0 .4375rem; font-size: var(--fs-caption); font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: var(--r-sm); }
.build { font-family: var(--mono); font-size: var(--fs-caption); color: var(--ink-3); }

/* 7 · tables */
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.num, .tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable::after { content: "↕"; margin-left: .25rem; opacity: 0; color: var(--ink-3); }
.sortable:hover::after, .sortable:focus-visible::after { opacity: .55; }
.sortable[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--accent); }
.sortable[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--accent); }
.fade-trunc { display: block; overflow: hidden; white-space: nowrap; }
.fade-trunc.is-over { -webkit-mask-image: linear-gradient(to right, black calc(100% - 1.75rem), transparent); mask-image: linear-gradient(to right, black calc(100% - 1.75rem), transparent); }
a.row-link { color: inherit; text-decoration: none; }

/* 1 · command palette */
.palette-scrim { position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem; animation: fade-in 120ms ease-out; }
.palette { width: min(40rem, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.palette input { width: 100%; box-sizing: border-box; height: 3.25rem; padding: 0 1.125rem; font-size: var(--fs-body-lg); color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--hairline); outline: none; box-shadow: none; }
.palette .results { overflow-y: auto; padding: .375rem; }
.palette .grp { padding: .5rem .75rem .25rem; font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.palette .opt { display: flex; align-items: center; gap: .625rem; padding: .5rem .75rem; border-radius: var(--r); font-size: var(--fs-body); color: var(--ink); cursor: pointer; }
.palette .opt .meta { margin-left: auto; font-family: var(--mono); font-size: var(--fs-caption); color: var(--ink-3); }
.palette .opt[aria-selected="true"] { background: var(--surface-2); }
.palette .empty-row { padding: 1rem .75rem; font-size: var(--fs-small); color: var(--ink-3); }
.palette .foot { display: flex; gap: 1rem; padding: .5rem .875rem; border-top: 1px solid var(--hairline); font-size: var(--fs-caption); color: var(--ink-3); }
.search-pill { display: flex; align-items: center; gap: .5rem; width: 100%; height: 2rem; padding: 0 .5rem 0 .625rem; margin: 0 0 .75rem; font-size: var(--fs-small); color: var(--ink-3); background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--r); cursor: pointer; }
.search-pill:hover { color: var(--ink-2); border-color: var(--ink-3); }
.search-pill .kbd { margin-left: auto; }
.search-pill svg { width: .875rem; height: .875rem; flex: none; }

/* 2 · home / overview */
.greeting { margin: 0 0 1rem; font-size: var(--fs-page); font-weight: 600; letter-spacing: -.015em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.stat-card { display: flex; flex-direction: column; gap: .375rem; padding: 1rem 1.125rem; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.stat-card .label { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.stat-card .value { font-size: var(--fs-page); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.2; }
.stat-card .foot { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-small); color: var(--ink-2); }
.stat-card .foot .btn { margin-left: auto; }

/* 9 · toast with undo */
.toast-host { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; }
.toast { pointer-events: auto; display: inline-flex; align-items: center; gap: .75rem; padding: .5rem .625rem .5rem 1rem; font-size: var(--fs-small); color: var(--on-ink); background: var(--ink); border-radius: 999px; box-shadow: var(--shadow-pop); animation: fade-in 120ms ease-out; }
.toast .undo { padding: .25rem .625rem; font: inherit; font-weight: 600; color: var(--on-ink); background: color-mix(in srgb, var(--on-ink) 14%, transparent); border: 0; border-radius: 999px; cursor: pointer; }
.toast .undo:hover { background: color-mix(in srgb, var(--on-ink) 26%, transparent); }

/* 8 · shortcuts sheet (?) */
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; padding: 1rem 1.125rem; font-size: var(--fs-small); color: var(--ink-2); }

@keyframes fade-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .skel, .palette-scrim, .toast { animation: none; }
  .is-refreshing { transition: none; }
}
