/* ============================================================
   TAPA — design system  ·  v2 "soft"
   Two crafted themes (Daylight / Dusk), soft depth, warm ink.
   Discipline colour signals area; everything else stays calm.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;450;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

/* ============================================================
   TOKENS  —  Daylight (default / light)
   ============================================================ */
:root {
  color-scheme: light;

  /* warm paper neutrals */
  --bg:          #F7F5F1;
  --bg-2:        #F1EEE8;     /* sidebar / sunken */
  --surface:     #FFFFFF;     /* cards / panels */
  --surface-2:   #F8F6F2;     /* raised / inputs */
  --surface-3:   #EFEBE4;     /* hover / pressed */

  --line:        rgba(46,40,30,.085);
  --line-2:      rgba(46,40,30,.14);
  --line-strong: rgba(46,40,30,.24);

  --text:    #26241F;
  --text-2:  #5E594F;
  --text-3:  #8B857A;
  --text-4:  #ABA597;

  /* discipline accents — tuned to read on light surfaces */
  --c-analytics:        oklch(0.55 0.135 248);
  --c-experimentation:  oklch(0.55 0.155 305);
  --c-seo:              oklch(0.52 0.115 160);

  --c-analytics-tint:        oklch(0.55 0.135 248 / .10);
  --c-experimentation-tint:  oklch(0.55 0.155 305 / .10);
  --c-seo-tint:              oklch(0.52 0.115 160 / .10);

  --c-analytics-soft:        oklch(0.96 0.032 248);
  --c-experimentation-soft:  oklch(0.96 0.034 305);
  --c-seo-soft:              oklch(0.96 0.030 160);

  /* admin (orange) — super-admin tools only */
  --c-admin:        oklch(0.62 0.15 55);
  --c-admin-tint:   oklch(0.62 0.15 55 / .10);
  --c-admin-soft:   oklch(0.96 0.04 65);

  /* semantic */
  --ok:    oklch(0.55 0.12 160);
  --warn:  oklch(0.62 0.13 70);
  --bad:   oklch(0.56 0.17 25);
  --ok-tint:   oklch(0.55 0.12 160 / .12);
  --warn-tint: oklch(0.62 0.13 70 / .14);
  --bad-tint:  oklch(0.56 0.17 25 / .12);

  /* default page accent (overridden per discipline) */
  --accent:      var(--text);
  --accent-tint: rgba(46,40,30,.07);
  --accent-soft: var(--surface-3);
  --on-accent:   #FFFFFF;

  /* soft, layered shadows — the heart of the new feel */
  --shadow-1: 0 1px 2px rgba(40,35,25,.05);
  --shadow-card: 0 1px 2px rgba(40,35,25,.05), 0 6px 16px -10px rgba(40,35,25,.16);
  --shadow-card-hover: 0 2px 6px rgba(40,35,25,.06), 0 18px 40px -16px rgba(40,35,25,.28);
  --shadow-2: 0 8px 24px -6px rgba(40,35,25,.12), 0 24px 60px -20px rgba(40,35,25,.20);
  --shadow-pop: 0 12px 40px -8px rgba(40,35,25,.22);
  --ambient: radial-gradient(110% 70% at 18% -8%, var(--c-analytics-tint), transparent 55%),
             radial-gradient(120% 80% at 88% -12%, var(--c-experimentation-tint), transparent 58%);

  --radius-lg: 20px;
  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --nav-w: 264px;
  --ease: cubic-bezier(.22,.61,.18,1);
  --ease-soft: cubic-bezier(.32,.72,.28,1);

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ============================================================
   TOKENS  —  Dusk (dark)
   ============================================================ */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #16181D;
  --bg-2:        #121419;
  --surface:     #1E2127;
  --surface-2:   #252932;
  --surface-3:   #2E333D;

  --line:        rgba(255,255,255,.07);
  --line-2:      rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);

  --text:    #ECEDF1;
  --text-2:  #B4B8C2;
  --text-3:  #848A96;
  --text-4:  #5C626E;

  --c-analytics:        oklch(0.76 0.10 248);
  --c-experimentation:  oklch(0.76 0.11 305);
  --c-seo:              oklch(0.78 0.095 160);

  --c-analytics-tint:        oklch(0.76 0.10 248 / .16);
  --c-experimentation-tint:  oklch(0.76 0.11 305 / .16);
  --c-seo-tint:              oklch(0.78 0.095 160 / .16);

  --c-analytics-soft:        oklch(0.40 0.07 248 / .35);
  --c-experimentation-soft:  oklch(0.40 0.08 305 / .35);
  --c-seo-soft:              oklch(0.42 0.06 160 / .35);

  --c-admin:        oklch(0.80 0.125 65);
  --c-admin-tint:   oklch(0.80 0.125 65 / .16);
  --c-admin-soft:   oklch(0.42 0.08 60 / .35);

  --ok:    oklch(0.78 0.10 160);
  --warn:  oklch(0.82 0.11 80);
  --bad:   oklch(0.72 0.14 25);
  --ok-tint:   oklch(0.78 0.10 160 / .16);
  --warn-tint: oklch(0.82 0.11 80 / .16);
  --bad-tint:  oklch(0.72 0.14 25 / .16);

  --accent-tint: rgba(255,255,255,.08);
  --accent-soft: var(--surface-3);
  --on-accent:   #14161A;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 10px 24px -14px rgba(0,0,0,.6);
  --shadow-card-hover: 0 2px 6px rgba(0,0,0,.4), 0 22px 48px -20px rgba(0,0,0,.7);
  --shadow-2: 0 14px 40px -10px rgba(0,0,0,.6);
  --shadow-pop: 0 16px 50px -12px rgba(0,0,0,.66);
  --ambient: radial-gradient(110% 70% at 16% -8%, var(--c-analytics-tint), transparent 55%),
             radial-gradient(120% 80% at 90% -12%, var(--c-experimentation-tint), transparent 58%);
}

/* discipline mapping */
body[data-disc="analytics"]       { --accent: var(--c-analytics);       --accent-tint: var(--c-analytics-tint);       --accent-soft: var(--c-analytics-soft); }
body[data-disc="experimentation"] { --accent: var(--c-experimentation); --accent-tint: var(--c-experimentation-tint); --accent-soft: var(--c-experimentation-soft); }
body[data-disc="seo"]             { --accent: var(--c-seo);             --accent-tint: var(--c-seo-tint);             --accent-soft: var(--c-seo-soft); }
body[data-disc="admin"]           { --accent: var(--c-admin);           --accent-tint: var(--c-admin-tint);           --accent-soft: var(--c-admin-soft); }

/* legacy section headings (real pages) — restore breathing room under headers */
.section-heading      { margin: 0 0 16px; font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.subsection-heading   { margin: 26px 0 12px; font-size: 14px; font-weight: 600; color: var(--text); }
.tp-card-form > h2:first-child, .tp-card-form > h3:first-child, .tp-card-form > h4:first-child,
.tp-card-form > .section-heading:first-child, .tp-card-form > .subsection-heading:first-child { margin-top: 0; }
.tp-card-form h4 { margin: 0 0 12px; font-size: 15px; }

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  /* always show the viewport scrollbar: a short view (e.g. the Reddit
     viewer's Categories tab) must not re-centre the page when the bar
     vanishes. On body, not html, so fullscreen scroll-locks that set
     body overflow (results_viewer) still propagate to the viewport;
     scrollbar-gutter is a no-op with Chrome's fluent scrollbars. */
  overflow-y: scroll;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  background: var(--ambient), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

h1, h2, h3, h4, h5 { color: var(--text); font-weight: 600; margin: 0; line-height: 1.18; letter-spacing: -0.018em; }
p { margin: 0 0 1em; }
a { color: var(--text); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-tint); color: var(--text); }

code {
  font-size: .86em; padding: .14em .44em; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); white-space: nowrap;
}
pre {
  font-size: .85rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text-2); overflow-x: auto; margin: 0 0 1rem;
}
pre code { background: none; border: 0; padding: 0; white-space: pre; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

.tp-mono { font-family: var(--mono); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.tp-app { display: flex; min-height: 100vh; }
.tp-main { flex: 1; min-width: 0; margin-left: var(--nav-w); }
.tp-content { max-width: 1140px; margin: 0 auto; padding: 46px 52px 110px; }
.tp-content--wide { max-width: 1340px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.tp-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w);
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  z-index: 50;
}

.tp-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 16px; }
.tp-brand .tp-logo { width: 32px; height: 32px; flex: none; filter: drop-shadow(0 2px 5px rgba(40,35,25,.16)); }
.tp-brand-name { font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.tp-brand-sub { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-4); letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }

.tp-nav { flex: 1; overflow-y: auto; padding: 6px 14px 14px; display: flex; flex-direction: column; gap: 2px; }

/* top-level link (Home) */
.tp-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .18s var(--ease), color .18s;
}
.tp-nav-link .tp-ico { width: 18px; height: 18px; color: var(--text-3); flex: none; transition: color .18s; }
.tp-nav-link:hover { background: var(--surface); color: var(--text); }
.tp-nav-link:hover .tp-ico { color: var(--text-2); }
.tp-nav-link.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.tp-nav-link.is-active .tp-ico { color: var(--accent); }

/* category group */
.tp-nav-group { margin-top: 12px; }
.tp-group-head {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 12px; border: 0; background: none; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: .02em; border-radius: var(--radius-sm); text-align: left; transition: background .18s;
}
.tp-group-head:hover { background: var(--surface); }
.tp-group-head .tp-disc-dot { width: 9px; height: 9px; flex: none; }
.tp-group-head .tp-group-label { flex: 1; min-width: 0; }
.tp-group-head .tp-caret { width: 15px; height: 15px; color: var(--text-4); transition: transform .24s var(--ease); }
.tp-nav-group.is-open .tp-caret { transform: rotate(90deg); }

.tp-group-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.tp-nav-group.is-open .tp-group-items { grid-template-rows: 1fr; }
.tp-group-items > div { overflow: hidden; }

.tp-subgroup-label {
  padding: 12px 12px 5px 16px; font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-4);
}
.tp-nav-tool {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 13.5px; font-weight: 450;
  position: relative; transition: background .16s, color .16s;
}
.tp-nav-tool .tp-ico { width: 17px; height: 17px; flex: none; color: var(--text-4); transition: color .16s; }
.tp-nav-tool:hover { background: var(--surface); color: var(--text); }
.tp-nav-tool:hover .tp-ico { color: var(--text-2); }
.tp-nav-tool.is-active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-1); }
.tp-nav-tool.is-active .tp-ico { color: var(--accent); }

/* original PNG glyph — theme-aware tint (renders reliably everywhere) */
.tp-pico { display: block; object-fit: contain; }
html[data-theme="dark"]  .tp-pico { filter: brightness(0) invert(1); }
html[data-theme="light"] .tp-pico { filter: brightness(0); }
.tp-nav-tool .tp-pico { width: 17px; height: 17px; opacity: .5; transition: opacity .16s; }
.tp-nav-tool:hover .tp-pico { opacity: .82; }
.tp-nav-tool.is-active .tp-pico { opacity: .95; }

/* account footer */
.tp-account { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tp-account-chip {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left; font-family: inherit;
  transition: background .16s, border-color .16s;
}
.tp-account-chip:hover { background: var(--surface); border-color: var(--line); }
.tp-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
  color: var(--on-accent); background: var(--accent);
  background-image: linear-gradient(150deg, color-mix(in oklch, var(--accent) 78%, white) 0%, var(--accent) 100%);
}
html[data-theme="dark"] .tp-avatar { color: var(--text); background: var(--surface-3); background-image: none; border: 1px solid var(--line-2); }
.tp-account-meta { flex: 1; min-width: 0; }
.tp-account-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-account-role { display: block; font-size: 11.5px; color: var(--text-4); }
.tp-account-chip .tp-ico { width: 17px; height: 17px; color: var(--text-4); flex: none; }
.tp-account-chip:hover .tp-ico { color: var(--text-2); }

/* theme toggle (segmented) */
.tp-theme {
  display: flex; gap: 3px; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.tp-theme button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-3);
  background: transparent; transition: color .18s, background .18s, box-shadow .18s;
}
.tp-theme button svg { width: 15px; height: 15px; }
.tp-theme button:hover { color: var(--text); }
.tp-theme button[aria-pressed="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-1); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.tp-header { margin-bottom: 38px; }
.tp-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 650; letter-spacing: .05em;
  color: var(--accent); margin-bottom: 15px;
}
.tp-kicker .tp-disc-dot { width: 8px; height: 8px; }
.tp-title { font-size: 32px; font-weight: 600; letter-spacing: -.025em; color: var(--text); }
.tp-lead { margin: 13px 0 0; max-width: 66ch; font-size: 16px; color: var(--text-2); line-height: 1.62; }
.tp-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.tp-header::after {
  content: ""; display: block; height: 1px; margin-top: 30px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--line) 22%, var(--line) 100%);
  opacity: .5;
}

/* triangle disc marker — brand motif, softened corners */
.tp-disc-dot {
  width: 10px; height: 10px; display: inline-block; flex: none;
  background: var(--accent);
  clip-path: polygon(50% 4%, 96% 92%, 4% 92%);
  border-radius: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.tp-btn, .wave-button, .btn, button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 550; line-height: 1;
  padding: 11px 19px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-1);
  transition: background .18s var(--ease), border-color .18s, box-shadow .2s, transform .12s var(--ease), color .18s;
  white-space: nowrap; text-decoration: none;
}
.tp-btn .tp-ico, .wave-button .tp-ico { width: 17px; height: 17px; }
.tp-btn:hover, .wave-button:hover, .btn:hover, button[type="submit"]:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.tp-btn:active, .wave-button:active, .btn:active, button[type="submit"]:active { transform: translateY(0); box-shadow: var(--shadow-1); }
.tp-btn .wave, .wave-button .wave { display: none !important; }

/* primary = discipline accent (flat — no coloured glow).
   NOTE: the submit-qualified selectors (button[type="submit"].tp-btn--…) are
   required so these modifiers out-specify the base `button[type="submit"]`
   rule above — otherwise type="submit" buttons render as the neutral surface. */
.tp-btn--primary, button[type="submit"].tp-btn--primary, .wave-button.btn-teal-wave, button[type="submit"].btn-primary, .btn-primary {
  background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600;
  background-image: linear-gradient(160deg, color-mix(in oklch, var(--accent) 90%, white) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-1);
}
.tp-btn--primary:hover, button[type="submit"].tp-btn--primary:hover, .wave-button.btn-teal-wave:hover, button[type="submit"].btn-primary:hover, .btn-primary:hover {
  filter: brightness(1.03); box-shadow: var(--shadow-card); color: var(--on-accent);
}

.tp-btn--ghost, button[type="submit"].tp-btn--ghost { background: transparent; border-color: var(--line-2); box-shadow: none; }
.tp-btn--ghost:hover, button[type="submit"].tp-btn--ghost:hover { background: var(--surface); }

/* destructive / outline variants */
.tp-btn--danger, button[type="submit"].tp-btn--danger, .btn-red-wave, .btn-danger, .btn-red-outline {
  background: transparent; border-color: color-mix(in oklch, var(--bad) 42%, var(--line-2)); color: var(--bad); box-shadow: none;
}
.tp-btn--danger:hover, button[type="submit"].tp-btn--danger:hover, .btn-red-wave:hover, .btn-danger:hover, .btn-red-outline:hover {
  background: var(--bad-tint); border-color: var(--bad); color: var(--bad); box-shadow: none; transform: translateY(-1px);
}
.btn-yellow-outline { background: transparent; border-color: color-mix(in oklch, var(--warn) 45%, var(--line-2)); color: var(--warn); box-shadow: none; }
.btn-yellow-outline:hover { background: var(--warn-tint); border-color: var(--warn); }

.tp-btn:disabled, .wave-button:disabled, .btn:disabled, button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.tp-btn--sm, button[type="submit"].tp-btn--sm { padding: 8px 13px; font-size: 13px; }
.tp-btn--lg, button[type="submit"].tp-btn--lg { padding: 14px 28px; font-size: 15px; }

.submit-btn-container, .submit-container, .form-actions, .utm-builder-actions, .form-group.text-center, .tp-actions {
  display: flex; align-items: center; gap: 12px; margin-top: 30px;
}
.tp-actions--center, .submit-btn-container, .submit-container { justify-content: center; }
.add-button-center { display: flex; margin: 18px 0; }

/* ============================================================
   FORMS
   ============================================================ */
.form-section, .tp-section-block { margin-bottom: 30px; }

.form-section h3, .tp-block-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 7px;
}
.form-section h3::before, .tp-block-title::before {
  content: ""; width: 7px; height: 7px; flex: none; border-radius: 2.5px;
  background: var(--accent); clip-path: polygon(50% 6%, 95% 92%, 5% 92%);
}
.form-section > .tool-note, .tp-block-title + .tool-note { margin-top: 2px; }

label, .form-label, .tp-label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 8px; }
.field-hint, .tp-hint, small.field-hint { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }
.field-hint code { font-size: .92em; }

.form-group, .tp-field { margin-bottom: 18px; text-align: left; max-width: 560px; }
.tp-field--wide, .form-group.wide { max-width: 760px; }

/* inputs */
.form-control, .custom-input, .tp-input,
input[type="text"], input[type="email"], input[type="number"], input[type="url"],
input[type="password"], input[type="search"], input[type="date"], input[type="time"],
select, textarea {
  width: 100%;
  font-family: inherit; font-size: 14px; color: var(--text);
  background-color: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 11px 14px;
  transition: border-color .16s, box-shadow .16s, background .16s;
  appearance: none;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.wide-input, .bq-select, .param-input { max-width: 760px; }

input::placeholder, textarea::placeholder { color: var(--text-4); }
.form-control:hover, .custom-input:hover, .tp-input:hover, select:hover, textarea:hover, input:hover { border-color: var(--line-strong); }

.form-control:focus, .custom-input:focus, .tp-input:focus,
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-tint);
  background-color: var(--surface);
}

/* select chevron (light) */
select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B857A' 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 13px center;
}
html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23848A96' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
select option { background: var(--surface); color: var(--text); }

/* GA4 custom-definition entry rows — Custom Definition Wizard + Property Creator.
   Each entry stacks: [Name + Parameter] · Description · compact scope/unit · Remove. */
.dimension-row, .metric-row, .calc-metric-row {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2);
}
.dimension-row:last-child, .metric-row:last-child, .calc-metric-row:last-child {
  border-bottom: 0; margin-bottom: 8px; padding-bottom: 0;
}
/* top row: the two primary text inputs sit side by side */
.def-toprow { display: flex; flex-wrap: wrap; gap: 10px; }
.def-toprow > .custom-input { flex: 1 1 200px; width: auto; min-width: 160px; }
/* compact, left-aligned scope / unit selects */
.def-selrow { display: flex; flex-wrap: wrap; gap: 10px; }
.def-select { width: auto; min-width: 120px; max-width: 200px; }
/* Remove button sits underneath, aligned left */
.dimension-row .remove-btn, .metric-row .remove-btn, .calc-metric-row .remove-btn {
  align-self: flex-start; margin: 2px 0 0;
}

/* ---- custom dropdown (themed, rounded popup) ---- */
.tp-sel { position: relative; display: block; width: 100%; }
.tp-sel > select.tp-sel-native {
  position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0;
  pointer-events: none; margin: 0;
}
.tp-sel-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-family: inherit; font-size: 14px; color: var(--text); text-align: left;
  background-color: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.tp-sel-trigger:hover { border-color: var(--line-strong); }
.tp-sel-trigger .tp-sel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-sel-trigger.is-placeholder .tp-sel-label { color: var(--text-4); }
.tp-sel-trigger .tp-sel-caret { flex: none; width: 16px; height: 16px; color: var(--text-3); transition: transform .2s var(--ease); }
.tp-sel.is-open .tp-sel-trigger { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-tint); background-color: var(--surface); }
.tp-sel.is-open .tp-sel-caret { transform: rotate(180deg); }

.tp-sel-panel {
  position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 280px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-6px) scale(.99); transform-origin: top center;
  pointer-events: none; transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.tp-sel.is-open .tp-sel-panel { opacity: 1; transform: none; pointer-events: auto; }
.tp-sel.drop-up .tp-sel-panel { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; transform: translateY(6px) scale(.99); }
.tp-sel.is-open.drop-up .tp-sel-panel { transform: none; }
/* Full-strength text, not --text-2. Every option in an open menu is a live
   choice, and the muted grey read as "disabled" next to the one dark selected
   row — people were not clicking options they were perfectly able to pick. The
   selection is still marked, by weight and by the tick. */
.tp-sel-opt {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  font-size: 14px; color: var(--text); border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s, color .12s;
}
.tp-sel-opt:hover, .tp-sel-opt.is-active { background: var(--accent-soft); color: var(--text); }
.tp-sel-opt[aria-selected="true"] { color: var(--text); font-weight: 550; }
.tp-sel-opt[aria-selected="true"]::after {
  content: ""; margin-left: auto; flex: none; width: 15px; height: 15px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19 7'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19 7'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tp-sel-opt--placeholder { color: var(--text-4); }

/* checkbox / radio */
input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; flex: none; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  border-radius: 6px; display: inline-grid; place-content: center; vertical-align: -3px;
  transition: background .15s, border-color .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before {
  content: ""; width: 12px; height: 12px; background: var(--on-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19 7'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19 7'/%3E%3C/svg%3E") center/contain no-repeat;
}
input[type="radio"]:checked::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--on-accent); }
.checkbox-row, label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
  display: flex; align-items: center; gap: 10px; font-weight: 450; color: var(--text-2); cursor: pointer;
}

/* file input */
.custom-file { position: relative; max-width: 560px; height: 46px; }
.custom-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.custom-file-label {
  display: flex; align-items: center; height: 100%; padding: 0 120px 0 15px;
  font-size: 14px; color: var(--text-3); background: var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .16s, background .16s;
}
.custom-file:hover .custom-file-label { border-color: var(--accent); background: var(--surface); }
.custom-file-label::after {
  content: "Browse"; position: absolute; right: 0; top: 0; height: 100%;
  display: flex; align-items: center; gap: 6px; padding: 0 16px;
  font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface-3);
  border-left: 1px solid var(--line-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* fieldset */
fieldset, .bq-source-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; margin: 0 0 18px; background: var(--bg-2); }
legend { padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--text); }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.tp-panel, .card, .card-body {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-card);
}
.tp-panel--pad-lg { padding: 30px 32px; }

.tp-card-form {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 30px; margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   NOTES / CALLOUTS
   ============================================================ */
.tool-note {
  font-size: 13.5px; color: var(--text-3); line-height: 1.6;
  padding-left: 15px; border-left: 2px solid var(--line-2); margin: 0 0 22px; max-width: 70ch;
}
.tp-note, .naming-convention-note {
  display: block; position: relative;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 18px 16px 20px; margin: 0 0 18px;
  font-size: 14px; color: var(--text-2); line-height: 1.6;
}
.tp-note::before, .naming-convention-note::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 3px 0 0 3px; background: var(--accent);
}
.tp-note h3, .naming-convention-note h3 { font-size: 14.5px; margin: 0 0 8px; }
.tp-note p:last-child, .naming-convention-note p:last-child { margin-bottom: 0; }
.tp-note--info::before { background: var(--c-analytics); }
.tp-note--warn { background: var(--warn-tint); }
.tp-note--warn::before { background: var(--warn); }
.tp-note--ok { background: var(--ok-tint); }
.tp-note--ok::before { background: var(--ok); }
.tp-note code, .naming-convention-note code { background: var(--surface); }

/* ============================================================
   ACCORDION
   ============================================================ */
details.tp-acc, details.naming-convention-note.accordion-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin: 0 0 12px; padding: 0; overflow: hidden;
  border-left-width: 1px; box-shadow: var(--shadow-1);
}
details.tp-acc > summary, details.accordion-section > summary {
  display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none;
  padding: 17px 20px; font-size: 15px; font-weight: 550; color: var(--text); transition: background .15s;
}
summary::-webkit-details-marker { display: none; }
details.tp-acc > summary:hover, details.accordion-section > summary:hover { background: var(--surface-2); }
details.tp-acc > summary::after, details.accordion-section > summary::after {
  content: ""; margin-left: auto; width: 16px; height: 16px; flex: none;
  background: currentColor; color: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform .22s var(--ease);
}
details[open].tp-acc > summary::after, details[open].accordion-section > summary::after { transform: rotate(180deg); }
details.tp-acc > summary > strong, details.accordion-section > summary > strong { font-weight: 600; }
.tp-acc-body, details.accordion-section > :not(summary) { padding: 4px 20px 20px; font-size: 14px; color: var(--text-2); line-height: 1.65; }
details.accordion-section .how-it-works-list { margin: 4px 0 0; padding: 4px 20px 20px 38px; }

/* ============================================================
   TABLES
   ============================================================ */
.tp-table-wrap, .sync-logs-table-wrapper {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: auto;
  background: var(--surface); box-shadow: var(--shadow-card);
}
table, .sync-logs-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table th, .sync-logs-table th {
  text-align: left; font-weight: 600; color: var(--text-3); font-size: 11px;
  letter-spacing: .07em; text-transform: uppercase;
  padding: 14px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table td, .sync-logs-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
table tbody tr:last-child td { border-bottom: 0; }
table tbody tr { transition: background .12s; }
table tbody tr:hover { background: var(--surface-2); }
.log-ts, .log-users { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); white-space: nowrap; }

/* ============================================================
   BADGES / STATUS / TAGS
   ============================================================ */
.tp-badge, .status-badge, .log-badge, .dest-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.tp-badge::before, .status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dest-tag::before { display: none; }
.status-active, .badge-success, .tp-badge--ok    { color: var(--ok);   border-color: color-mix(in oklch, var(--ok) 35%, var(--line-2));   background: var(--ok-tint); }
.status-disabled, .tp-badge--muted               { color: var(--text-3); }
.badge-failed, .badge-error, .tp-badge--bad       { color: var(--bad);  border-color: color-mix(in oklch, var(--bad) 38%, var(--line-2));  background: var(--bad-tint); }
.badge-running, .badge-pending, .tp-badge--warn   { color: var(--warn); border-color: color-mix(in oklch, var(--warn) 38%, var(--line-2)); background: var(--warn-tint); }
.tp-tag { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:550; padding:4px 10px; border-radius:7px; background:var(--surface-2); border:1px solid var(--line); color:var(--text-2); }

/* ============================================================
   RECORD / SCHEDULE CARDS
   ============================================================ */
.schedule-card, .tp-record {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 16px; box-shadow: var(--shadow-card);
}
.add-schedule-card { border-style: dashed; box-shadow: none; background: var(--bg-2); }
.card-header-row, .tp-record-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-header-row h3, .tp-record-head h3 { font-size: 17px; }
.card-buttons, .tp-record-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.audience-summary-item, .tp-record-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2);
}
.audience-summary-item:first-child { border-top: 0; }
.prop-list, .bq-ref { color: var(--text-3); font-size: 13px; }

/* empty / loading states */
.empty-state, .tp-empty {
  text-align: center; padding: 52px 24px; color: var(--text-3); font-size: 14px;
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2);
}
.clients-loading, .tp-loading-inline { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px; color: var(--text-3); }

/* ============================================================
   LOADERS / OVERLAY / FLASH
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 64%, transparent); backdrop-filter: blur(6px);
}
.loading-content { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.loading-message { margin: 0; font-size: 15px; font-weight: 550; color: var(--text); }
.loader-1, .loader-teal, .tp-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--accent); animation: tp-spin .8s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }

#flash-container { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert { padding: 13px 17px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--line-2); background: var(--surface); box-shadow: var(--shadow-1); }
.alert-danger  { border-left: 3px solid var(--bad);  color: var(--text); }
.alert-success { border-left: 3px solid var(--ok);   color: var(--text); }
.alert-warning { border-left: 3px solid var(--warn); color: var(--text); }
.alert-info    { border-left: 3px solid var(--c-analytics); color: var(--text); }

.validation-message { font-size: 13px; margin: 8px 0 0; }
.validation-message.valid { color: var(--ok); }
.validation-message.invalid { color: var(--bad); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  :root { --nav-w: 0px; }
  .tp-sidebar { transform: translateX(-100%); transition: transform .3s var(--ease); width: 264px; box-shadow: var(--shadow-2); }
  .tp-sidebar.is-open { transform: none; }
  .tp-main { margin-left: 0; }
  .tp-content { padding: 30px 22px 84px; }
  .tp-navbtn { display: inline-grid; }
}
@media (min-width: 921px) { .tp-navbtn, .tp-scrim { display: none; } }

.tp-navbtn {
  position: fixed; top: 16px; left: 16px; z-index: 60; display: none;
  width: 44px; height: 44px; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); cursor: pointer; box-shadow: var(--shadow-card);
}
.tp-scrim { position: fixed; inset: 0; z-index: 49; background: color-mix(in srgb, var(--bg) 30%, rgba(0,0,0,.5)); backdrop-filter: blur(2px); }

/* back-to-Home affordance — free-floating arrow + label, just right of the nav.
   Anchored to the top of the document, not the viewport: as a viewport-fixed
   element it rode the scroll and collided with page furniture underneath it
   (e.g. the Crawler Dashboard's sticky filter bar). It now sits in the top
   gutter and scrolls away with the content, so it can never overlap anything. */
.tp-back {
  position: absolute; top: 24px; left: calc(var(--nav-w) + 24px); z-index: 30;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 550; color: var(--text-3);
  background: none; border: 0; padding: 0; box-shadow: none;
  transition: color .16s, transform .16s var(--ease);
}
.tp-back:hover { color: var(--text); transform: translateX(-3px); }
.tp-back svg { width: 18px; height: 18px; }
@media (max-width: 920px) { .tp-back { left: 72px; } }

/* toast + not-yet-ported affordance */
#tpToast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tp-toast {
  padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 550; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(10px); transition: opacity .24s, transform .24s var(--ease);
}
.tp-toast.show { opacity: 1; transform: none; }
.tp-nav-tool[data-wip] { opacity: .55; }
.tp-nav-tool[data-wip]:hover { opacity: 1; }
.tp-card[data-wip] { opacity: .76; }
.tp-card[data-wip]::after { content: "Soon"; position: absolute; top: 16px; right: 16px; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; }
.tp-card[data-wip]:hover { opacity: 1; }

/* ============================================================
   HOME
   ============================================================ */
.tp-hero { padding: 30px 0 30px; }
.tp-hero-mark { display: flex; gap: 7px; margin-bottom: 26px; }
.tp-hero-mark i {
  width: 0; height: 0; display: block;
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 18px solid var(--line-2);
  filter: drop-shadow(0 3px 6px rgba(40,35,25,.18));
}
.tp-hero-mark i:nth-child(1) { border-bottom-color: var(--c-analytics); }
.tp-hero-mark i:nth-child(2) { border-bottom-color: var(--c-experimentation); }
.tp-hero-mark i:nth-child(3) { border-bottom-color: var(--c-seo); }
.tp-hero h1 { font-size: clamp(32px, 4.6vw, 48px); font-weight: 600; letter-spacing: -.035em; color: var(--text); }
.tp-hero .tp-hero-tag { margin: 16px 0 0; font-size: 18px; color: var(--text-2); max-width: 56ch; }
.tp-hero .tp-hero-tag strong { color: var(--text); font-weight: 600; }

.tp-searchbar { position: relative; max-width: 500px; margin-top: 30px; }
.tp-searchbar .tp-ico { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--text-3); pointer-events: none; }
#tpSearch { padding-left: 46px; height: 52px; font-size: 15px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-card); border-color: var(--line); }
#tpSearch:focus { box-shadow: var(--shadow-card), 0 0 0 3.5px var(--accent-tint); }

.tp-section { margin-top: 56px; }
.tp-section-head { display: flex; align-items: center; gap: 12px; padding-bottom: 15px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.tp-section-head .tp-disc-dot { width: 12px; height: 12px; }
.tp-section-head h2 { font-size: 21px; letter-spacing: -.02em; }
.tp-section-blurb { margin-left: auto; font-size: 13px; color: var(--text-4); }

.tp-subhead { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-4); margin: 28px 0 14px; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }

.tp-card {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 22px 20px; min-height: 158px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: border-color .24s var(--ease), transform .24s var(--ease-soft), box-shadow .24s var(--ease), background .24s;
}
.tp-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklch, var(--accent) 45%, transparent));
  clip-path: inset(0 100% 0 0); transition: clip-path .34s var(--ease);
}
.tp-card:hover { transform: translateY(-4px); border-color: color-mix(in oklch, var(--accent) 28%, var(--line)); box-shadow: var(--shadow-card-hover); }
.tp-card:hover::before { clip-path: inset(0 0 0 0); }
.tp-card-ico {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 16px;
  border-radius: 13px; color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 18%, transparent);
  transition: transform .24s var(--ease-soft), background .24s;
}
.tp-card:hover .tp-card-ico { transform: scale(1.06) rotate(-2deg); }
.tp-card-ico .tp-ico { width: 23px; height: 23px; }
.tp-card-ico .tp-pico { width: 24px; height: 24px; }
.tp-card-name { font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -.012em; }
.tp-card-desc { margin-top: 7px; font-size: 13px; line-height: 1.55; color: var(--text-3); flex: 1; }
.tp-card-launch {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 16px;
  font-size: 12.5px; font-weight: 650; color: var(--accent);
  opacity: 0; transform: translateY(5px); transition: opacity .22s, transform .22s var(--ease);
}
.tp-card-launch .tp-ico { width: 14px; height: 14px; }
.tp-card:hover .tp-card-launch { opacity: 1; transform: none; }
@media (hover: none) { .tp-card-launch { opacity: 1; transform: none; } }

/* gentle entrance for home cards (transform-only — content stays visible if throttled) */
@media (prefers-reduced-motion: no-preference) {
  .tp-section { animation: tp-rise .5s var(--ease-soft) both; }
  @keyframes tp-rise { from { transform: translateY(12px); } to { transform: none; } }
}

/* ============================================================
   GA4 Data Audit — scoped error box
   ============================================================ */
body[data-page="data_audit.html"] .error-box {
  max-width: 760px; margin: 18px 0 0; padding: 13px 16px;
  font-size: 14px; color: var(--text);
  background: var(--bad-tint); border: 1px solid var(--bad);
  border-radius: var(--radius-sm);
}
body[data-page="data_audit.html"] .error-box strong { color: var(--bad); }

/* ============================================================
   BACKGROUND TASKS — the bottom-right popup (shell-owned).
   Follows the user across pages while a crawl, audit or content
   review runs server-side; minimisable to a pill so it never has
   to be closed to see what is behind it.
   ============================================================ */
.tp-jobs { position: fixed; right: 20px; bottom: 20px; z-index: 80; width: 350px; max-width: calc(100vw - 32px); font-family: var(--font); }
.tp-jobs-panel {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden;
}
.tp-jobs-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tp-jobs-title { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.tp-jobs-btn {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border: 0; border-radius: var(--radius-xs); background: none; color: var(--text-3); cursor: pointer;
}
.tp-jobs-btn:hover { background: var(--surface-3); color: var(--text); }
.tp-jobs-body { max-height: 320px; overflow-y: auto; }
.tp-job { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.tp-job:last-child { border-bottom: 0; }
.tp-job-state { flex: none; margin-top: 1px; width: 18px; height: 18px; }
.tp-job-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: tp-spin .8s linear infinite; }
.tp-job-ok, .tp-job-bad { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; }
.tp-job-ok  { background: var(--ok-tint);  color: var(--ok); }
.tp-job-bad { background: var(--bad-tint); color: var(--bad); }
.tp-job-main { flex: 1; min-width: 0; }
.tp-job-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-job-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; }
.tp-job-acts { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: none; }
.tp-job-dl {
  border: 1px solid var(--line-2); border-radius: var(--radius-xs); background: var(--surface-2);
  color: var(--text); font-size: 11px; font-weight: 600; padding: 4px 9px; cursor: pointer;
}
.tp-job-dl:hover { background: var(--surface-3); }
.tp-job-x { border: 0; background: none; color: var(--text-4); font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.tp-job-x:hover { color: var(--text); background: var(--surface-3); }
/* minimised: a pill that says how much is still moving */
.tp-jobs-pill {
  display: inline-flex; align-items: center; gap: 9px; float: right;
  padding: 9px 15px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-card); cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--text); font-family: var(--font);
}
.tp-jobs-pill:hover { box-shadow: var(--shadow-card-hover); }
.tp-jobs-pill .tp-job-spin { width: 14px; height: 14px; }
/* progress: determinate when the task can count itself, a sweep otherwise */
.tp-job-track {
  display: block; margin-top: 7px; height: 3px; border-radius: 2px;
  background: var(--line-2); overflow: hidden;
}
.tp-job-track i {
  display: block; height: 100%; width: 0; border-radius: 2px;
  background: var(--accent); transition: width .5s var(--ease);
}
.tp-job-track--indet i { width: 34%; animation: tp-jobs-sweep 1.4s ease-in-out infinite; }
@keyframes tp-jobs-sweep {
  from { transform: translateX(-110%); }
  to   { transform: translateX(340%); }
}
/* entrance/exit — applied ONLY when the popup appears, minimises, expands or
   closes; ordinary content updates never replay these (the render skips
   unchanged DOM entirely, so the box holds still at rest) */
@media (prefers-reduced-motion: no-preference) {
  .tp-jobs-in  { animation: tp-jobs-in .28s var(--ease-soft) both; }
  .tp-jobs-out { animation: tp-jobs-out .17s ease both; pointer-events: none; }
}
@keyframes tp-jobs-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes tp-jobs-out {
  to { opacity: 0; transform: translateY(10px) scale(.96); }
}
