/* Kynship app surface, shared by the newest Kynship tools (audit, statics, mediabot) and new tools from
   kynship-framework. On top of kynship-ui v0.3.0 liquid glass (data-theme="glass" on <html>):
   - light and dark, the scheme rendered on the server from the signed-in user's saved choice; the sun/moon
     toggle saves it with a POST. Nothing is kept in the browser.
   - two fixed background images (light on ::before, dark on ::after; only opacity flips, so no flash),
     frosted panels, a floating glass top bar with the wordmark left, sections centred, icons right.
   - Poppins for titles (h1-h3, wordmark), Geist for everything else, both self-hosted (SIL OFL).
   Use: <html data-theme="glass" data-scheme="light|dark" class="st-app">. Keep this file identical across
   tools; put a tool's own components in its app.css. */

/* ── Fonts ───────────────────────────────────────────────────────────── */
@font-face { font-family: "Geist"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/geist-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/poppins-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/poppins-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/poppins-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/poppins-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
.st-app { --font-ui: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1; }
.st-app .font-display { font-family: "Poppins", var(--font-ui); }
.st-app h1 { font-family: "Poppins", var(--font-ui); font-weight: 600; }
.st-app :is(h2, h3) { font-family: "Poppins", var(--font-ui); font-weight: 500; }

/* ── Surface: backgrounds and frosted panels ─────────────────────────── */
.st-app {
  --st-ok: light-dark(#1e7a46, #4ade80);   /* status green ("ok", "synced"); the kit's --grn is the ink/bone accent */
  --st-frost: light-dark(rgb(251 250 247 / 0.42), rgb(22 23 27 / 0.40));
  --st-frost-2: light-dark(rgb(242 239 232 / 0.36), rgb(30 32 37 / 0.36));
  --st-bar: light-dark(rgb(250 248 243 / 0.50), rgb(20 21 25 / 0.48));
  min-height: 100%;
}
/* The backdrop spans the whole document, not one viewport, so long pages keep it to the end. */
.st-app body { background: var(--bg); position: relative; min-height: 100vh; isolation: isolate; }
.st-app body::before, .st-app body::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: center top / cover no-repeat url("img/bg-light.webp");
}
.st-app body::after { background-image: url("img/bg-dark.webp"); opacity: 0; }
.st-app[data-scheme="dark"] body::after { opacity: 1; }

.st-app .panel {
  background: var(--st-frost);
  -webkit-backdrop-filter: blur(26px) saturate(160%); backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-specular), var(--shadow-1);
}
.st-app :is(.panel, .glass) .panel {   /* a panel inside chrome or another panel stays flat */
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  border-color: var(--fill-2); box-shadow: none;
}
.st-app table.tbl thead th { background: var(--st-frost-2); }
.st-app .top-bar.glass { background: var(--st-bar); }

/* ── Top bar: wordmark left, sections centred, icons right ───────────── */
.wordmark { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border-radius: var(--r-md); }
.wordmark-text { font-weight: 600; font-size: 15px; line-height: 1; position: relative; top: 2px; }  /* baseline on the K's foot */
.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-left: auto; }
.bar-center { display: flex; align-items: center; gap: 8px; }
@media (min-width: 641px) {
  .st-app .top-bar:has(> .bar-center) { display: grid; grid-template-columns: 1fr auto 1fr; }
  .st-app .top-bar > .wordmark { justify-self: start; }
}
.nav-link { font-size: 13px; font-weight: 500; color: var(--fg-dim); padding: 5px 10px; border-radius: var(--r-sm);
            transition: color var(--dur-1) ease, background var(--dur-2) var(--ease-out); }
.nav-link:hover { color: var(--fg); background: var(--fill); }
.nav-link.is-current { color: var(--fg); background: var(--fill-2); }
.bar-icon { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
            border-radius: var(--r-md); color: var(--fg-dim); flex-shrink: 0; background: none; border: 0; cursor: pointer;
            transition: color var(--dur-1) ease, background var(--dur-2) var(--ease-out); }
.bar-icon:hover { color: var(--fg); background: var(--fill); }
.bar-icon.is-current { color: var(--fg); background: var(--fill-2); }
.bar-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7;
                stroke-linecap: round; stroke-linejoin: round; }
.scheme-toggle .i-sun, [data-scheme="dark"] .scheme-toggle .i-moon { display: none; }
[data-scheme="dark"] .scheme-toggle .i-sun { display: block; }
.avatar-wrap { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 44px; flex-shrink: 0; }
@media (max-width: 420px) { .avatar-wrap { display: none; } }
@media (max-width: 640px) {
  .wordmark-text { display: none; }
  .st-app .top-bar { flex-wrap: wrap; height: auto; padding-block: 2px; row-gap: 0; }
  .st-app .top-bar > .bar-center { order: 10; width: 100%; justify-content: center; padding: 0 0 6px; overflow-x: auto; }
}

/* ── Common pieces ───────────────────────────────────────────────────── */
.link { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
code { font-size: 0.92em; padding: 1px 5px; border-radius: var(--r-xs); background: var(--fill); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-head { margin: 8px 0 24px; }
.page-head h1 { font-size: clamp(24px, 3vw, 30px); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
.page-lede { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--fg-dim); max-width: 70ch; }
.notice { font-size: 14px; line-height: 1.5; padding: 12px 16px; border-radius: var(--r-md);
          border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line)); background: color-mix(in srgb, var(--amber) 7%, var(--panel)); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }  /* contains sr-only labels too */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--fg-dim); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 14px; border-top: 1px solid var(--fill-2); vertical-align: top; }
.tbl .num { text-align: right; }
.fld-input, .field { font: inherit; font-size: 14px; color: var(--fg); background: var(--field); border: 1px solid var(--line);
             border-radius: var(--r-md); padding: 8px 11px; min-height: 40px; min-width: 0; }
:is(.fld-input, .field):focus-visible { outline: 2px solid var(--grn); outline-offset: 1px; }

/* ── Accessibility fallbacks ─────────────────────────────────────────── */
@media (prefers-reduced-transparency: reduce) {
  .st-app .panel { background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--line); }
  .st-app table.tbl thead th { background: var(--panel-2); }
  .st-app .top-bar.glass { background: var(--glass-tint); }
}
@media (prefers-contrast: more) {
  .st-app .panel { background: var(--panel); border-color: var(--fg-faint); }
  .st-app .top-bar.glass { background: var(--glass-tint); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .st-app .top-bar.glass { background: var(--glass-tint); }
}
@media (prefers-reduced-motion: reduce) { .nav-link, .bar-icon { transition: none; } }
