/* =============================================================
   Trendmetrik — Panel V2 shared stylesheet (vanilla CSS)
   Linear / Stripe inspired · light theme
   Used by: pricing.html, soru-cevap.html, buybox.html
   ============================================================= */

:root {
  /* Brand
     PR-D1 token unification (2026-06-19): values that resolve IDENTICALLY in
     BOTH light and dark to a canonical theme-variables.css token are now
     aliases (single source). Literals left here have NO exact dual-mode
     canonical match yet → deferred to PR-D2 (value reconciliation). */
  --primary:        var(--color-primary);        /* #0175E4 → canonical */
  --primary-hover:  var(--color-primary-hover);  /* #0163C2 → canonical */
  --primary-deep:   var(--tm-logo-blue-deep);    /* #014A94 → canonical */
  --primary-soft:   var(--color-primary-soft);   /* #E8F3FF → canonical */
  /* PR-D2b (2026-06-19): brand accent converged ORANGE→BLUE (user decision).
     Now aliased to canonical dark-aware --color-accent* (blue) — single source. */
  --accent:         var(--color-accent);          /* #0175E4 light / #2563EB dark */
  --accent-hover:   var(--color-accent-hover);    /* #0163C2 light / #1D6FD0 dark */
  --accent-soft:    var(--color-accent-soft);     /* #E8F3FF light / rgba blue dark */
  --sky:            var(--color-secondary);      /* #73B7FE → canonical */

  /* Status */
  --success:        var(--tm-success);           /* #16A34A → canonical */
  --success-soft:   #DCFCE7;                      /* deferred */
  --success-ink:    #15803D;                      /* deferred */
  --danger:         var(--tm-error);             /* #DC2626 → canonical */
  --danger-soft:    #FEE2E2;                      /* deferred */
  --danger-ink:     #B91C1C;                      /* deferred */
  --warning:        var(--tm-warning);           /* #F59E0B → canonical */
  --warning-soft:   var(--tmv2-warning-soft);    /* #FEF3C7 → canonical */
  --warning-ink:    #92400E;                      /* deferred */
  --info:           #3B82F6;                      /* deferred */
  --info-soft:      #E0EDFF;                      /* deferred */
  --violet:         #6366F1;                      /* deferred */
  --violet-soft:    #EEF2FF;                      /* deferred */

  /* Neutrals / surface */
  --page:           var(--tmv2-page);            /* #F4F6FA → canonical */
  --surface:        var(--color-surface);        /* #FFFFFF → canonical */
  --surface-2:      #F8FAFC;                      /* deferred */
  --surface-3:      #F1F5F9;                      /* deferred */
  --line:           var(--tmv2-line);            /* #E7EBF1 → canonical */
  --line-2:         #EEF1F6;                      /* deferred */
  --line-strong:    #DBE5EF;                      /* deferred */

  /* Ink */
  --ink:            var(--tmv2-ink);             /* #0F172A → canonical */
  --ink-2:          #1E293B;                      /* deferred */
  --text:           #334155;                      /* deferred */
  --muted:          var(--color-text-muted);     /* #64748B → canonical */
  --muted-2:        var(--tm-text-muted);        /* #94A3B8 → canonical */

  /* Type */
  --ff-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ff-serif: "Instrument Serif", Georgia, serif;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(15,23,42,0.05);
  --sh-2: 0 4px 12px rgba(15,23,42,0.08);
  --sh-3: 0 12px 32px rgba(15,23,42,0.12);
  --sh-primary: 0 4px 14px rgba(1,117,228,0.28);
  --sh-accent: 0 4px 14px rgba(1,117,228,0.28);   /* PR-D2b: accent shadow orange→blue */

  /* Motion */
  --t: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ff-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* faint logo-blue grid under the page, like the real panel */
body.tm-body {
  background-color: var(--page);
  background-image:
    linear-gradient(rgba(1,117,228,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(1,117,228,0.022) 1px, transparent 1px);
  background-size: 32px 32px;
}

a { color: var(--primary-hover); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--primary-deep); }
button { font: inherit; cursor: pointer; color: inherit; }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }

.num, .mono {
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Lucide icon sizing */
[data-lucide] { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }

/* ===== Page shell (content-only) ===== */
.tm-page-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 28px 64px;
}
@media (max-width: 720px) { .tm-page-wrap { padding: 16px 14px 48px; } }

/* Page header (in-page, since no chrome).
   PR-D5b: GLOBAL defined-card visual contract. Every panel page that uses
   `.tm-page-head` now renders the SAME defined card — surface bg + border +
   radius + shadow + padding — so the page-header region is consistent
   site-wide (previously transparent/passive → looked broken/inconsistent).
   The proven pattern shipped first as report-v2.css `.rp-pagehead`; it is
   promoted here to the single source so all consumers inherit it.
   `.rp-pagehead` is reconciled (report-v2.css) to NOT re-declare the surface,
   so report pages keep one border (no double card). Tokens are dark-aware. */
.tm-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 16px 18px;
}
@media (max-width: 720px) {
  .tm-page-head {
    align-items: flex-start;
    padding: 13px 14px;
  }
}
.tm-page-head__titles { min-width: 0; }
/* Right action slot — same position + alignment on every page. When there are
   no actions the left title block fills the band gracefully (flex). */
.tm-page-head__actions {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  /* Mobile: title-area on top, actions wrap below the full width. */
  .tm-page-head__actions { width: 100%; }
}

/* Shared NEUTRAL header button — legible on the light defined card (the legacy
   `.xhead__ghost`/`.xhead__cta` were styled for a DARK gradient band → white
   text, illegible here). Pages migrate their header buttons to these. Dark-mode
   safe via canonical tokens. `.rp-headbtn` (report-v2.css) is the report-page
   alias of the same treatment; kept there for the reports tour contract. */
.tm-headbtn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: var(--r-sm);
  padding: 8px 13px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; box-shadow: var(--sh-1);
  transition: all var(--t);
}
.tm-headbtn:hover { border-color: var(--line-strong); color: var(--ink); box-shadow: var(--sh-2); transform: translateY(-1px); }
.tm-headbtn [data-lucide] { width: 15px; height: 15px; color: var(--muted); }
.tm-headbtn--cta { background: var(--primary); border-color: var(--primary); color: #fff; }
.tm-headbtn--cta:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.tm-headbtn--cta [data-lucide] { color: currentColor; }
.tm-kicker {
  font-family: var(--ff-sans);
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  margin-bottom: 2px;
}
.tm-page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 11px;
}
.tm-page-title__mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  box-shadow: var(--sh-primary);
  flex-shrink: 0;
}
.tm-page-title__mark [data-lucide] { width: 19px; height: 19px; }
.tm-page-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 6px;
  max-width: 70ch;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--t);
  box-shadow: var(--sh-1);
}
.btn:hover { border-color: var(--line-strong); color: var(--ink); box-shadow: var(--sh-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn [data-lucide] { width: 15px; height: 15px; }
.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-color: transparent; color: #fff;
  box-shadow: var(--sh-primary);
}
.btn--primary:hover { box-shadow: 0 6px 20px rgba(1,117,228,0.4); color: #fff; }
.btn--accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-color: transparent; color: #fff;
  box-shadow: var(--sh-accent);
}
.btn--accent:hover { box-shadow: 0 6px 20px rgba(253,117,31,0.42); color: #fff; }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn--sm { padding: 6px 10px; font-size: 12px; }
.btn--icon { padding: 8px; width: 36px; height: 36px; }
/* PR-D6b: variants folded in from the retired `tm-btn` family
   (v2/components/buttons.css) so the ~11 auth/account/dashboard templates keep
   their look after the tm-btn→btn migration. Token-driven; mirror the old
   tm-btn rules. Accent is now blue (PR-D2b), no orange.
   - btn--secondary: tm-btn's first-class neutral/outline CTA. Base `.btn` is
     already an outlined surface button; --secondary just strengthens the
     border + ink text to match tm-btn--secondary's stronger neutral look. */
.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
/* - btn--lg: tm-btn--lg larger size (taller padding + base font). */
.btn--lg { padding: 11px 18px; font-size: 14px; }
/* - btn--block: full-width (tm-btn--block 1:1). */
.btn--block { width: 100%; }
/* - btn--soft-primary: tm-btn--soft-primary tinted CTA. Primary-soft tint bg +
     primary-hover text (#0163C2 on #E8F3FF ≈ 6.3:1 contrast, AA pass). */
.btn--soft-primary { background: var(--primary-soft); border-color: transparent; color: var(--primary-hover); box-shadow: none; }
.btn--soft-primary:hover { background: var(--primary-soft); border-color: transparent; color: var(--primary-deep); box-shadow: var(--sh-1); }
/* PR-D6a: folded in from the retired `xbtn` family (xml-v2.css / xml-panel-v2.css)
   so XML/analysis pages keep their disabled-dim + spin behaviour after the
   xbtn→btn class migration. Token-driven; mirrors the old xbtn rules 1:1. */
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--sh-1); }
.btn .x-spin { animation: tm-spin 0.9s linear infinite; }
/* PR-D6a: status CTA variants migrated from product_delete.html's page-local
   `xbtn--danger/--warnbtn/--success` block. Token-driven gradients (matching the
   existing btn--accent hardcoded-rgba hover-shadow pattern). */
.btn--danger { background: linear-gradient(135deg, var(--danger), #B91C1C); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,.26); }
.btn--danger:hover { color: #fff; box-shadow: 0 6px 20px rgba(220,38,38,.4); }
.btn--warnbtn { background: linear-gradient(135deg, var(--warning), #D97706); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,.26); }
.btn--warnbtn:hover { color: #fff; box-shadow: 0 6px 20px rgba(245,158,11,.4); }
.btn--success { background: linear-gradient(135deg, var(--success), var(--success-ink)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.26); }
.btn--success:hover { color: #fff; box-shadow: 0 6px 20px rgba(22,163,74,.4); }

/* PR-D6c-0 (2026-06-19): CANONICAL btn--* variants the Bootstrap→canonical
   migration (D6c clusters) needs. Token-driven, additive (unused until D6c
   markup migrates to them → zero visual diff now). Distinct from the
   #tmv2App `.btn-outline-*` Bootstrap shim (tm-buttons-v2.css) which only
   rescues legacy Bootstrap markup; these double-dash names are the target.
   Color choices mirror the shim's WCAG-vetted token picks. Accent is blue. */
/* --- SOLID --- */
/* btn--info: informational blue. Filled with the dark-aware --accent blue
   (light on-brand text 4.50:1; dark 5.17:1). Flat --info is too light as a
   white-text fill (3.68:1), so accent is the safe info blue (matches PR-D2b
   blue convergence + shim info=primary semantics). */
.btn--info { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); border-color: transparent; color: var(--tm-fg-on-brand); box-shadow: var(--sh-accent); }
.btn--info:hover { color: var(--tm-fg-on-brand); box-shadow: var(--sh-2); }
/* btn--dark: dark neutral fill (--ink, dark-aware). Light: ink fill + surface
   text 17.85:1. In dark mode --ink resolves to light text, so flip to a light
   surface fill with --ink text to stay a readable "dark" chip. */
.btn--dark { background: var(--ink); border-color: transparent; color: var(--surface); box-shadow: var(--sh-1); }
.btn--dark:hover { color: var(--surface); box-shadow: var(--sh-2); }
html.dark-mode .btn--dark { background: var(--surface-3); color: var(--ink); }
html.dark-mode .btn--dark:hover { background: var(--surface-2); color: var(--ink); }
/* btn--link: transparent, link-colored text, no border/shadow, underline on hover. */
.btn--link { background: transparent; border-color: transparent; color: var(--primary); box-shadow: none; }
.btn--link:hover { background: transparent; border-color: transparent; color: var(--primary-hover); box-shadow: none; transform: none; text-decoration: underline; }
/* --- COLORED OUTLINE FAMILY ---
   Transparent resting bg + 1px token border + token text; token fill + on-brand
   text on hover. Dark-aware text where the resting hue fails AA (success/danger).
   Each text token ≥4.5:1, each border ≥3:1 on the page surface, LIGHT and DARK. */
.btn--outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); box-shadow: none; }
.btn--outline-primary:hover { background: var(--primary); border-color: var(--primary); color: var(--tm-fg-on-brand); box-shadow: none; }
.btn--outline-secondary { background: transparent; border-color: var(--muted); color: var(--ink-2); box-shadow: none; }
.btn--outline-secondary:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); box-shadow: none; }
/* success text: light uses --success-ink (5.02:1; raw --success hue too light
   at 3.30:1); --success-ink resolves light enough in dark for 13.7:1. */
.btn--outline-success { background: transparent; border-color: var(--success); color: var(--success-ink); box-shadow: none; }
.btn--outline-success:hover { background: var(--success); border-color: var(--success); color: var(--tm-fg-on-brand); box-shadow: none; }
/* danger text: light --danger (4.83:1); dark flips to --danger-ink (≈10.1:1,
   raw --danger only 3.98:1 on near-black). */
.btn--outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); box-shadow: none; }
.btn--outline-danger:hover { background: var(--danger); border-color: var(--danger); color: var(--tm-fg-on-brand); box-shadow: none; }
html.dark-mode .btn--outline-danger { border-color: var(--danger-ink); color: var(--danger-ink); }
/* warning: yellow text fails AA → ink/text; border uses warning-ink (darker amber). */
.btn--outline-warning { background: transparent; border-color: var(--warning-ink); color: var(--text); box-shadow: none; }
.btn--outline-warning:hover { background: var(--warning); border-color: var(--warning); color: var(--ink); box-shadow: none; }
html.dark-mode .btn--outline-warning { border-color: var(--warning); }
/* info outline = same blue as solid btn--info (primary blue is dark-safe). */
.btn--outline-info { background: transparent; border-color: var(--primary); color: var(--primary); box-shadow: none; }
.btn--outline-info:hover { background: var(--primary); border-color: var(--primary); color: var(--tm-fg-on-brand); box-shadow: none; }
/* dark outline: --ink text + border (dark-aware ink: deep navy light / light grey dark). */
.btn--outline-dark { background: transparent; border-color: var(--ink); color: var(--ink); box-shadow: none; }
.btn--outline-dark:hover { background: var(--ink); border-color: var(--ink); color: var(--surface); box-shadow: none; }
html.dark-mode .btn--outline-dark { border-color: var(--muted); }
html.dark-mode .btn--outline-dark:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }

/* ===== Card / panel ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 18px 20px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.panel-head h3 {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.panel-head h3 [data-lucide] { width: 17px; height: 17px; color: var(--muted); }
.panel-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ===== Badges / pills / status ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.badge [data-lucide] { width: 12px; height: 12px; }
.badge--primary { background: var(--primary-soft); color: var(--primary-hover); }
.badge--accent  { background: var(--accent-soft); color: var(--accent-hover); }
.badge--success { background: var(--success-soft); color: var(--success-ink); }
.badge--danger  { background: var(--danger-soft); color: var(--danger-ink); }
.badge--warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge--info    { background: var(--info-soft); color: var(--primary-hover); }
.badge--violet  { background: var(--violet-soft); color: #4F46E5; }
.badge--neutral { background: var(--surface-3); color: var(--muted); }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-family: var(--ff-mono);
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.delta [data-lucide] { width: 11px; height: 11px; }
.delta.up { background: var(--success-soft); color: var(--success-ink); }
.delta.down { background: var(--danger-soft); color: var(--danger-ink); }
.delta.flat { background: var(--surface-3); color: var(--muted); }

/* ===== Inputs ===== */
.field-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.field-label [data-lucide] { width: 13px; height: 13px; color: var(--accent); }
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: all var(--t);
}
.input::placeholder { color: var(--muted-2); font-weight: 400; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1,117,228,0.13);
}
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .suffix {
  position: absolute; right: 12px;
  font-family: var(--ff-mono); font-size: 13px; font-weight: 600; color: var(--muted-2);
  pointer-events: none;
}
.search {
  position: relative; display: flex; align-items: center; flex: 1;
}
.search [data-lucide] {
  position: absolute; left: 12px; color: var(--muted-2); width: 16px; height: 16px;
}
.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px 9px 36px;
  font-size: 13.5px;
  transition: all var(--t);
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,117,228,0.12); }

select.input { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}

/* ===== Table ===== */
.tm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tm-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.tm-table th.num, .tm-table td.num { text-align: right; }
.tm-table td {
  padding: 12px; border-bottom: 1px solid var(--line-2);
  color: var(--ink-2); vertical-align: middle;
}
.tm-table td.num { font-family: var(--ff-mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tm-table tbody tr { transition: background var(--t); }
.tm-table tbody tr:hover { background: var(--surface-2); }
.tm-table tbody tr:last-child td { border-bottom: 0; }

/* platform pill */
.plat {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px; color: var(--ink-2);
}
.plat img { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; background: var(--surface-2); padding: 2px; border: 1px solid var(--line-2); }

/* segmented control */
.seg {
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--surface-3); border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.seg button {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: transparent;
  padding: 7px 13px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: all var(--t); white-space: nowrap;
}
.seg button .cnt {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 600;
  background: var(--surface); color: var(--muted);
  padding: 1px 7px; border-radius: var(--r-pill); border: 1px solid var(--line);
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-1);
}
.seg button.active .cnt { background: var(--primary-soft); color: var(--primary-hover); border-color: transparent; }

/* ===== Animations ===== */
@keyframes tm-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tm-pop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes tm-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
  70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
@keyframes tm-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes tm-spin { to { transform: rotate(360deg); } }

/* Base state is the VISIBLE end-state — animation is enhancement only (fill-mode
   none + a small delay), so if the environment pauses/throttles animations the
   content still shows its resting state instead of a stuck opacity:0. */
.tm-anim { animation: tm-fade-up 0.5s cubic-bezier(0.16,1,0.3,1) 0.06s; }
.tm-anim-d1 { animation-delay: 0.05s; }
.tm-anim-d2 { animation-delay: 0.10s; }
.tm-anim-d3 { animation-delay: 0.15s; }
.tm-anim-d4 { animation-delay: 0.20s; }
.tm-anim-d5 { animation-delay: 0.25s; }
.tm-anim-d6 { animation-delay: 0.30s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* live dot */
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.live-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  animation: tm-pulse-ring 1.8s ease-out infinite;
}

/* small inter-page nav strip (mock context only) */
.tm-mocknav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.tm-mocknav__brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); margin-right: 10px; }
.tm-mocknav__brand img { width: 20px; height: 20px; }
.tm-mocknav a {
  padding: 6px 12px; border-radius: var(--r-pill);
  color: var(--muted); font-weight: 600; transition: all var(--t);
}
.tm-mocknav a:hover { background: var(--surface-3); color: var(--ink); }
.tm-mocknav a.active { background: var(--primary-soft); color: var(--primary-hover); }
.tm-mocknav__tag {
  margin-left: auto; font-family: var(--ff-mono); font-size: 11px; color: var(--muted-2);
}

/* ===== V2 fill-width fix (2026-06-18) ===== */
.x-wrap,.rp-wrap,.cm-wrap,.fm-wrap,.pr-wrap,.pa,.tmonb,.hc-wrap,.xa-wrap,.pm-wrap,.bb-wrap,.qa-wrap{max-width:none !important;margin-left:0 !important;margin-right:0 !important;width:auto !important;}
.tmv2-app{max-width:none !important;}
.tmv2-content.main-content,main.tmv2-content{padding-left:24px !important;padding-right:24px !important;}
.tmv2-page-body,.tmv2-page-shell,.tmv2-page-inner{max-width:none !important;width:auto !important;}

/* =============================================================
   Dark-mode bridge (2026-06-19)
   -------------------------------------------------------------
   This stylesheet's :root tokens (--ink, --surface, --page, …) are
   light-only and had NO dark variant, so the 17 pages that load
   tm-v2.css (profit_margin_list, buybox_control, dashboard_live,
   all xml_* pages, …) stayed light / unreadable under dark mode.

   We rebind the local unprefixed tokens to the canonical, dark-aware
   theme-variables.css tokens (--color-* / --tm-*). `html.dark-mode`
   (0,1,1) outranks `:root` (0,1,0) and comes later in the cascade,
   so light defaults above are preserved in light mode and only
   overridden when the dark class is present. No template changes.
   ============================================================= */
html.dark-mode {
  /* PR-D1 (2026-06-19): tokens aliased in :root above already resolve dark-aware
     from their canonical target, so their dark-bridge overrides are now redundant
     and removed here (single source = theme-variables.css). Only deferred tokens
     (no exact dual-mode canonical match) keep an explicit dark literal below. */
  /* Neutrals / surface */
  --surface-2:   var(--color-surface-alt);   /* #10151d — deferred */
  --surface-3:   #151b24;                     /* deferred */
  --line-2:      #1b212b;                     /* deferred */
  --line-strong: #2d3441;                     /* deferred */

  /* Ink / text */
  --ink-2:  #d1d5db;                          /* deferred */
  --text:   #cbd5e1;                          /* deferred */

  /* Status — deferred tokens only (success/danger/warning hue + soft/ink) */
  --success-soft: rgba(34, 197, 94, 0.15);    /* deferred */
  --success-ink:  #86efac;                    /* deferred */
  --danger-soft:  rgba(239, 68, 68, 0.15);    /* deferred */
  --danger-ink:   #fca5a5;                    /* deferred */
  --warning-ink:  #fde68a;                    /* deferred */
  --info:         #4d97f0;
  --info-soft:    rgba(77, 151, 240, 0.15);
  --violet:       #a78bfa;
  --violet-soft:  rgba(167, 139, 250, 0.15);

  /* Shadows — neutral black on dark instead of navy-tinted */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.40);
  --sh-2: 0 4px 12px rgba(0, 0, 0, 0.45);
  --sh-3: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* The faint logo-blue grid is invisible/odd on near-black; drop it in dark. */
html.dark-mode body.tm-body { background-image: none; }
