/* ComputeHub 3.1 UX layer — ADDITIVE ONLY. Loaded after style.css.
   The visual identity (palette, typography, backgrounds, borders, buttons, header, light/dark tokens) comes entirely from style.css exactly as in 3.0.7.
   This file only styles components that did not exist in 3.0.7 (tab panels, item cards, key/value lists, notices, feedback/documentation pages)
   using the SAME tokens, so they follow whichever theme is active (html[data-theme="dark|light"], set by /theme.js). */

.tabpanel[hidden], [data-tabpanel][hidden] { display: none !important; }
.tabbar[role="tablist"] { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.tabbar a, .tabbar button { white-space: nowrap; }
.tabbar button { appearance: none; background: transparent; padding: 9px 14px; font: 700 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; cursor: pointer; border-radius: 0; }
.tabbar button:hover { color: var(--text); }
.tabbar button[aria-selected="true"], .tabbar button.active { color: var(--text); background: var(--panel); border-color: var(--border-strong); border-bottom: 1px solid var(--panel); }
.tabbar .tab-count { margin-left: 6px; color: var(--accent); }
.tabbar button:focus-visible, .tabbar a:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }

/* item cards: one object = one card (title, badges, short facts, actions) */
.ux-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 0 0 var(--space-4, 16px); }
.ux-card { background: var(--panel); border: 1px solid var(--border-strong); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ux-card.is-accent { border-color: var(--accent); }
.ux-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ux-card-title { font: 700 14px var(--mono); letter-spacing: .02em; overflow-wrap: anywhere; margin: 0; }
.ux-card-sub { color: var(--muted); font-size: 12px; margin: 0; overflow-wrap: anywhere; }
.ux-card-text { margin: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ux-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.ux-card-actions .btn { margin: 0; padding: 6px 10px; font-size: 11px; }

/* key / value facts */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }

/* a short lead paragraph under a heading + "details" toggles */
.lead { color: var(--muted); font-size: 13px; line-height: 1.55; max-width: 78ch; margin: 0 0 14px; }
details.more { border-top: 1px solid var(--border); margin: 12px 0 0; padding: 8px 0 0; }
details.more > summary { cursor: pointer; font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸ '; color: var(--accent); }
details.more[open] > summary::before { content: '▾ '; }
details.more > :not(summary) { margin-top: 10px; }

/* grouped settings: a titled block of fields */
.field-group { border: 1px solid var(--border); background: var(--panel); margin: 0 0 14px; }
.field-group > .field-group-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; display: flex; justify-content: space-between; gap: 10px; }
.field-group > .field-group-head span { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.field-group > .field-group-body { padding: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--border-strong); z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* statistic tiles wrap instead of overflowing on narrow screens (3.0.7 .stats never wrapped) */
.stats { flex-wrap: wrap; }
.stats > .stat { flex: 1 1 150px; min-width: 0; }
.stat-value { overflow-wrap: anywhere; }

/* notices, badges, empty/error states used by the 3.1 pages */
.notice { border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); background: var(--panel); padding: 10px 14px; font-size: 13px; line-height: 1.5; }
.notice.warn { border-left-color: var(--amber); }
.notice.error, .notice.danger { border-left-color: var(--red); }
.notice.ok { border-left-color: var(--green); }
.badge.draft, .badge.warn { color: var(--amber); }
.badge.ok, .badge.resolved { color: var(--green); }
.badge.new { color: var(--accent); }
.badge.in_progress { color: var(--text); }
.badge.reviewed { color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--panel-raised), var(--panel), var(--panel-raised)); background-size: 200% 100%; min-height: 1em; }
.state-box { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--border-strong); font-size: 13px; }
.state-box.error { color: var(--red); border-color: var(--red); }

/* hover underline on ordinary header links (as in 2.7) is kept by style.css; nothing to add here */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* responsive "table -> cards" for tables with long cells (opt-in: class="stack-table"; labels come from the header row, see ux.js) */
@media (max-width: 760px) {
  .app-page .table-shell table.stack-table, table.stack-table { min-width: 0; border: 0; background: transparent; }
  .stack-table thead { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { border: 1px solid var(--border-strong); background: var(--panel); margin: 0 0 10px; padding: 6px 12px; }
  .stack-table td { display: flex; gap: 14px; justify-content: space-between; align-items: baseline; border: 0; padding: 5px 0; text-align: right; overflow-wrap: anywhere; }
  .stack-table td[data-label]::before { content: attr(data-label); flex: 0 0 34%; color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
  .stack-table td.span-all, .stack-table td.empty { display: block; text-align: left; }
}

.cell-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46ch; }
.cell-desc:hover { -webkit-line-clamp: unset; }

/* the dot-matrix hero title is wider than a 360px screen (also true in 3.0.7): scale it down on phones instead of scrolling sideways */
@media (max-width: 480px) { .reference-title, .reference-subtitle { font-size: clamp(1.4rem, 8.4vw, 3rem); } .reference-title { word-spacing: -0.12em; } }
