/* Stack page. Colours come from the wireframe tokens (tokens.css: dark default, html.light, html.bzz) when the host
   loads them; the fallbacks keep the page usable alone. Host-specific changes go in overlay/stack-overlay.css, never here. */
:root {
  --stack-bg: var(--bg, #ffffff); --stack-panel: var(--bg-panel, #f6f7f9); --stack-text: var(--text, #1b1f24);
  --stack-dim: var(--text-muted, #57606a); --stack-border: var(--border, #d0d7de); --stack-accent: var(--primary, #0a64c8);
  --stack-warn: var(--warning, #9a6700); --stack-good: var(--success, #1a7f37); --stack-bad: var(--danger, #cf222e);
  --stack-head: var(--text-head, var(--stack-text)); --stack-focus: var(--focus-ring, var(--stack-accent));
  --stack-border-strong: var(--border-strong, var(--stack-border)); --stack-hover: var(--bg-hover, var(--stack-panel));
}
@media (prefers-color-scheme: dark) {
  :root:not(.light):not(.bzz):not([data-theme="light"]) {
    --stack-bg: var(--bg, #0f1419); --stack-panel: var(--bg-panel, #161b22); --stack-text: var(--text, #e6edf3);
    --stack-dim: var(--text-muted, #9da7b3); --stack-border: var(--border, #30363d); --stack-accent: var(--primary, #58a6ff);
    --stack-warn: var(--warning, #d29922); --stack-good: var(--success, #3fb950); --stack-bad: var(--danger, #f85149);
  }
}
/* Standalone page only: an app that embeds the markup inline leaves its own body alone. */
body.stack-page { margin: 0; background: var(--stack-bg); color: var(--stack-text); font: 15px/1.45 system-ui, sans-serif; }
.stack-main { color: var(--stack-text); font: 15px/1.45 system-ui, sans-serif; }
/* Width and padding apply to the standalone page only: embedded in an app's own page, the app's layout sets them. */
body.stack-page .stack-main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.stack-main h1 { margin: 0 0 4px; font-size: 1.5rem; }
.stack-sub { margin: 0 0 12px; color: var(--stack-dim); }
/* Underline tab menu, the look of wireframe's tabs.css (contract 1.9): a rail, the active tab bold with a 2px accent underline. */
.stack-tabs { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: .8rem 0 .9rem; border-bottom: 1px solid var(--stack-border); }
.stack-tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  margin-bottom: -1px; padding: .55rem .15rem; font: inherit; color: var(--stack-dim); cursor: pointer;
}
.stack-tabs button:hover { color: var(--stack-head); }
.stack-tabs button:focus-visible { outline: 2px solid var(--stack-focus); outline-offset: 2px; }
.stack-tabs button[aria-selected="true"] { color: var(--stack-head); font-weight: 600; border-bottom-color: var(--stack-accent); }
.stack-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.stack-filters input, .stack-filters select {
  background: var(--stack-panel); color: var(--stack-text); border: 1px solid var(--stack-border);
  border-radius: 6px; padding: 6px 8px; font: inherit; min-width: 0;
}
.stack-scroll { overflow-x: auto; border: 1px solid var(--stack-border); border-radius: 8px; }
.stack-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.stack-table th, .stack-table td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--stack-border); }
.stack-table th { background: var(--stack-panel); white-space: nowrap; }
.stack-table th button { all: unset; cursor: pointer; font-weight: 600; }
.stack-table th button:focus-visible { outline: 2px solid var(--stack-accent); outline-offset: 2px; }
.stack-table .detail { color: var(--stack-dim); font-size: 13px; }
.stack-table a { color: var(--stack-accent); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.pill.behind { color: var(--stack-warn); } .pill.current { color: var(--stack-good); }
.pill.ahead { color: var(--stack-accent); } .pill.unknown { color: var(--stack-dim); }
/* Pager, the look of wireframe's pager.css (contract 1.9.1): a footer row with a top rule, the count left in muted type,
   "Rows per page", a small select and two small square buttons right. A button that cannot be used is dimmed, never hidden. */
.stack-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem;
  padding: .75rem .25rem 0; margin-top: .75rem; border-top: 1px solid var(--stack-border); color: var(--stack-dim); font-size: .8125rem; }
.stack-pager-range { white-space: nowrap; }
.stack-pager-controls { display: flex; align-items: center; gap: .5rem; }
.stack-pager-size-label { margin-right: .1rem; }
.stack-pager-size { height: 1.75rem; padding: 0 .5rem; font: inherit; font-size: .8125rem; min-width: 0;
  background: var(--stack-panel); color: var(--stack-text); border: 1px solid var(--stack-border); border-radius: 6px; }
.stack-pager-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem;
  padding: 0; border: 1px solid var(--stack-border); border-radius: 6px; background: var(--stack-panel); color: var(--stack-text);
  font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.stack-pager-btn:hover:not(:disabled) { color: var(--stack-head); border-color: var(--stack-border-strong); background: var(--stack-hover); }
.stack-pager-btn:focus-visible, .stack-pager-size:focus-visible { outline: 2px solid var(--stack-focus); outline-offset: 2px; }
.stack-pager-btn:disabled { opacity: .45; cursor: default; }
.stack-error { color: var(--stack-bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* footer badge (stack-badge.js) */
.stack-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--stack-warn, #d29922); margin-left: 4px; vertical-align: middle; }
@media (max-width: 600px) { .stack-table th, .stack-table td { padding: 6px; } }
