/* Shared chrome: reset, app bar, view transitions, controls (buttons, segmented, checks, tooltips),
   status chips, tables, cards, footer and toast. Layout: slim app bar with view tabs → one view at a time. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font-body); }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.spacer { flex: 1; }

/* App bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--panel); }
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--panel); border-bottom: 1px solid var(--rule); }
.bar .wrap { display: flex; align-items: stretch; gap: 24px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); white-space: nowrap;
  font: 700 1.15rem/1 var(--font-head); letter-spacing: 0.01em; }
.brand svg { flex: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { display: flex; align-items: center; padding: 0 14px; text-decoration: none; color: var(--sub);
  font: 600 0.95rem var(--font-head); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--fast), border-color var(--fast); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--navy); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 10px;
  background: transparent; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink); text-decoration: none; cursor: pointer; font-size: 0.9rem; }
.tool-btn:hover { border-color: var(--rule-strong); background: var(--well); }
@media (max-width: 720px) {
  .bar .wrap { flex-wrap: wrap; height: auto; gap: 0 12px; }
  .brand { height: 52px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; border-top: 1px solid var(--rule); }
  .tabs a { height: 44px; flex: none; }
  .gh-label { display: none; }
}

/* Theme button: show the icon of the mode you would switch to. */
.i-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (max-width: 900px) { .theme-label { display: none; } }

/* Views fade in when switched, so tab changes don't feel like a hard cut. */
.view { padding-block: 24px 48px; animation: view-in 180ms var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }
.page-title { font: 600 1.6rem/1.3 var(--font-head); margin: 0 0 4px; }
.page-lead { color: var(--sub); margin: 0 0 20px; max-width: 75ch; }
.narrow { max-width: 760px; }
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 20px; }

/* Buttons */
.btn { height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--rule-strong); background: var(--panel); cursor: pointer;
  font-size: 0.9rem; font-weight: 500; white-space: nowrap; transition: background var(--fast), filter var(--fast), transform var(--fast); }
.btn:hover { background: var(--well); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.main { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); font-weight: 600; }
.btn.main:hover { filter: brightness(1.1); }
.btn.small { height: 30px; padding: 0 10px; font-size: 0.85rem; }
.btn.icon { width: 34px; padding: 0; font-size: 1.1rem; line-height: 1; }

/* Segmented radio group */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 6px 12px; font-size: 0.9rem; cursor: pointer; border-right: 1px solid var(--rule); background: var(--panel); white-space: nowrap;
  transition: background var(--fast), color var(--fast); }
.seg label:last-of-type { border-right: 0; }
.seg label:hover { background: var(--well); }
.seg input:checked + label { background: var(--navy); color: var(--navy-ink); font-weight: 600; }
.seg input:checked + label[data-case="valid"] { background: var(--green); color: var(--panel); }
.seg input:checked + label[data-case="invalid"] { background: var(--red); color: var(--panel); }
.seg input:focus-visible + label { outline: 2px solid var(--navy); outline-offset: -2px; }

.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.92rem; cursor: pointer; white-space: nowrap; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--navy); cursor: pointer; }
.opt { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--sub); }

/* Info tooltips: hover or focus on desktop, tap on touch screens (toggles .open). */
.info { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 4px; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--panel); color: var(--sub);
  font: italic 600 0.68rem/1 Georgia, "Times New Roman", serif; cursor: help; vertical-align: middle; flex: none; }
.info:hover, .info.open { color: var(--navy); border-color: var(--navy); }
.info::after { content: attr(data-tip); position: absolute; z-index: 25; box-sizing: border-box; top: calc(100% + 8px); left: var(--tip-x, -8px); width: max-content; max-width: min(280px, calc(100vw - 32px));
  padding: 8px 10px; border-radius: 6px; background: var(--ink); color: var(--paper);
  font: normal 400 0.82rem/1.5 var(--font-body); letter-spacing: 0; text-transform: none; white-space: normal; text-align: left;
  display: none; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.info:hover::after, .info:focus-visible::after, .info.open::after { display: block; }

/* Valid / invalid chips */
.st { font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.st:empty { display: none; }
.st.ok { color: var(--green); background: var(--green-tint); }
.st.bad { color: var(--red); background: var(--red-tint); }
.filter-error { color: var(--red); font-size: 0.82rem; }
.filter-error:empty { display: none; }
.result-empty { margin: 0; padding: 28px 20px; text-align: center; color: var(--sub); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font: 600 0.78rem var(--font-head); letter-spacing: 0.04em; color: var(--sub); background: var(--well); }
th:first-child, td:first-child { width: 44px; text-align: right; color: var(--sub); font: 0.78rem var(--font-mono); border-right: 1px solid var(--rule); background: var(--well); }
td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

footer { border-top: 1px solid var(--rule); color: var(--sub); font-size: 0.85rem; padding-block: 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
footer p { margin: 0; max-width: 70ch; }
footer .legal { display: flex; flex-direction: column; gap: 6px; }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 6px);
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
