/* TraceMend shared base (2026-11-19 night, D1): the typeface, the 56px header of every app page, buttons, links, segmented
   controls, tabs, tables and form controls in the token colours. Read after tokens.css and before a page's own file.
   Component classes start with tm- so the pages' own rules keep working; element defaults use :where() so a page can override
   them with any selector. Shadows only on the open menu (plan 2.5). No style attributes or inline scripts (CSP style-src 'self'). */

@font-face { font-family: "Wanted Sans"; src: url("/static/fonts/WantedSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Wanted Sans"; src: url("/static/fonts/WantedSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Wanted Sans"; src: url("/static/fonts/WantedSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-synthesis: none; }
:where(button, select, input, textarea) { font: inherit; color: inherit; }
:where(select, input[type="text"], input[type="number"], input[type="search"], input[type="datetime-local"], textarea) {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-btn);
}
:where(select:hover, input[type="text"]:hover, input[type="number"]:hover, input[type="datetime-local"]:hover) { border-color: var(--line-strong); }
:where(input)::placeholder { color: var(--muted); }
:where(input[type="file"])::file-selector-button {
  font: inherit; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: var(--r-btn); cursor: pointer;
}
:where(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tm-num { font-variant-numeric: tabular-nums; }
.tm-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ---------- the header: one row of 56px on every app page ---------- */
.tm-top {
  position: relative; z-index: 20; flex: none; height: var(--top-h); display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4); background: var(--bg); color: var(--text); border-bottom: 1px solid var(--line);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.4; white-space: nowrap;
}
.tm-brand { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); text-decoration: none; flex: none; }
.tm-page { font-size: 15px; color: var(--muted); flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* a long page name (English) shortens, the header never widens the page */
.tm-mid { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-3); overflow: hidden; }
.tm-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; flex: none; }
.tm-mid + .tm-nav { margin-left: 0; }
.tm-nav a { color: var(--text); text-decoration: none; font-size: var(--fs-body); padding: 17px 0 15px; border-bottom: 2px solid transparent; }
.tm-nav a:hover { border-bottom-color: var(--line-strong); }
.tm-nav a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--text); }
.tm-tools { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.tm-icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex: none; padding: 0; min-height: 0;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: var(--r-btn); cursor: pointer;
}
.tm-icon-btn:hover { border-color: var(--line-strong); }
.tm-lang {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 40px; padding: 0 10px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-btn); color: var(--text); text-decoration: none; font-size: var(--fs-aux); font-weight: 600; letter-spacing: 0.02em;
}
.tm-lang:hover { border-color: var(--line-strong); }
.tm-ico-sun { display: none; }
:root[data-theme="dark"] .tm-ico-sun { display: block; }
:root[data-theme="dark"] .tm-ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tm-ico-sun { display: block; }
  :root:not([data-theme="light"]) .tm-ico-moon { display: none; }
}
.tm-menu { display: none; }
.tm-menu .tm-ico-close { display: none; }
.tm-menu[aria-expanded="true"] .tm-ico-close { display: block; }
.tm-menu[aria-expanded="true"] .tm-ico-menu { display: none; }

/* narrow screens: the page links fold under a menu button; the review and comparison screens say they need a wide screen */
.tm-narrow { display: none; }
@media (max-width: 767px) {
  .tm-top { gap: var(--sp-3); }
  .tm-top .tm-mid { display: none; }
  .tm-tools { margin-left: auto; }
  .tm-menu { display: inline-grid; }
  .js .tm-nav {
    display: none; position: absolute; top: calc(var(--top-h) - 1px); left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: var(--sp-2) var(--sp-4) var(--sp-3);
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 8px 20px rgb(0 0 0 / 0.08);
  }
  .js .tm-nav.is-open { display: flex; }
  .js .tm-nav a { padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
  .js .tm-nav a:last-child { border-bottom: 0; }
  .js .tm-nav a[aria-current="page"] { border-bottom-color: var(--line); }
  html:not(.js) .tm-top { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: var(--sp-2) var(--sp-4); }
  html:not(.js) .tm-nav { margin-left: 0; flex-wrap: wrap; }
  .tm-narrow {
    display: block; flex: 1; padding: var(--sp-6) var(--sp-4); font-size: var(--fs-body); line-height: 1.6; color: var(--text);
    background: var(--bg); overflow-y: auto;
  }
  .tm-narrow h1 { font-size: var(--fs-section); font-weight: 600; margin: 0 0 var(--sp-2); }
  .tm-narrow p { margin: 0 0 var(--sp-4); color: var(--muted); }
  .tm-narrow ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
  .tm-narrow li { border-bottom: 1px solid var(--line); }
  .tm-narrow li a { display: block; padding: var(--sp-3) 0; color: var(--accent); text-underline-offset: 3px; }
  .tm-wide-only { display: none !important; }
}

/* ---------- buttons and links (plan 2.6) ---------- */
.tm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: var(--btn-h); padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--bg); color: var(--text);
  font-size: var(--fs-body); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tm-btn:hover { border-color: var(--line-strong); }
.tm-btn-main { background: var(--text); color: var(--bg); border-color: var(--text); }
.tm-btn-main:hover { border-color: var(--text); opacity: 0.88; }
.tm-btn-sm { height: var(--btn-h-sm); }
.tm-link { color: var(--accent); text-underline-offset: 3px; }

/* segmented choice, tabs and tables in the token colours */
.tm-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-btn); padding: 2px; }
.tm-seg > button { border: 1px solid transparent; background: transparent; border-radius: 6px; height: 28px; padding: 0 10px; color: var(--muted); cursor: pointer; }
.tm-seg > button[aria-pressed="true"], .tm-seg > button.on { border-color: var(--text); color: var(--text); font-weight: 600; }
.tm-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.tm-tabs > button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 0; color: var(--muted); cursor: pointer; }
.tm-tabs > button[aria-selected="true"], .tm-tabs > button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tm-tbl { border-collapse: collapse; font-size: var(--fs-body); font-variant-numeric: tabular-nums; }
.tm-tbl th { text-align: left; font-weight: 500; font-size: var(--fs-aux); color: var(--muted); border-bottom: 1px solid var(--muted); padding: 10px 16px 10px 0; }
.tm-tbl td { border-bottom: 1px solid var(--line); padding: 10px 16px 10px 0; }

@media (prefers-reduced-motion: reduce) {
  .tm-top *, .tm-nav { transition: none !important; }
}
