/* ── Design tokens ───────────────────────────────────── */
:root {
  --primary:      #38BD6D;
  --primary-dark: #319457;
  --primary-light:#dcf3e1;
  --text-dark:    #111827;
  --text-body:    #374151;
  --text-muted:   #6b7280;
  --bg-page:      #f9fafb;
  --bg-card:      #ffffff;
  --border:       #e5e7eb;
  --success:      #059669;
  --success-bg:   #ecfdf5;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --info:          #1e40af;
  --info-bg:       #dbeafe;
  --info-text:     #1e40af;
  --warning-text:  #92400e;
  --success-text:  #065f46;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --chip-ga4-bg:      #dbeafe;
  --chip-ga4-text:    #1e40af;
  --chip-ads-bg:      #fef9c3;
  --chip-ads-text:    #854d0e;
  --chip-meta-bg:     #ede9fe;
  --chip-meta-text:   #5b21b6;
  --chip-consent-bg:  #dcfce7;
  --chip-consent-text:#166534;
  --chip-other-bg:    #f3f4f6;
  --chip-other-text:  #374151;
}

/* ── Reset + base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header__brand { display: flex; align-items: center; gap: 12px; }
.site-header__title { font-size: 0.95rem; font-weight: 600; color: var(--text-dark); }
.lang-toggle { display: flex; gap: 4px; }
.lang-toggle button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}
.lang-toggle button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Main layout ─────────────────────────────────────── */
.main { max-width: 760px; margin: 0 auto; padding: 32px 24px 64px; }

/* ── Progress bar ────────────────────────────────────── */
.progress-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
}
.progress-bar__step {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transition: background .2s;
}
.progress-bar__step.active  { background: var(--primary); }
.progress-bar__step.done    { background: var(--primary-dark); }

/* ── Card ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.card--selectable { position: relative; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.card--selectable:hover { border-color: var(--primary); }
.card--selectable.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.card--selectable.selected::after {
  content: '✓';
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: check-pop 0.25s ease-out;
}
@keyframes check-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.card__title { font-size: 1rem; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.card__desc  { font-size: 0.875rem; color: var(--text-muted); }

/* ── Form ────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-hint a { color: var(--primary); }
.form-gtm-var {
  display: inline-block;
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--info-text);
  background: var(--info-bg);
  border-radius: 4px;
  padding: 1px 5px;
  margin-bottom: 4px;
}
input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-dark);
  background: var(--bg-card);
  transition: border-color .15s;
}
input[type="text"]::placeholder { color: #c1c8d4; }
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input[type="text"].error { border-color: var(--danger); }
.field-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox-row label { font-size: 0.875rem; color: var(--text-muted); cursor: pointer; }

/* ── Section heading ─────────────────────────────────── */
h2.step-title { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; }
p.step-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 24px; }
h3.group-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin: 24px 0 12px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px;
  border-radius: 6px; font-size: 0.9rem; font-weight: 500;
  /* <button> does not inherit the page font by default — without this, button
     labels fall back to Arial while <a class="btn"> labels use Space Grotesk,
     which also made the two render at different heights. */
  font-family: inherit; line-height: 1.4; text-decoration: none;
  cursor: pointer; transition: background .15s;
  /* Transparent border keeps primary and secondary buttons the same height. */
  border: 1px solid transparent;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--secondary { background: var(--bg-card); color: var(--text-body); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg-page); }
.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
/* Navigation rows: back stays left, the forward action is pushed to the right edge
   (also right-aligns a lone forward button on the first step). */
.btn-row--nav > .btn:last-child { margin-left: auto; }
/* Full-width primary actions (download CTAs), stacked and equal-width. */
.btn-row--stack { flex-direction: column; align-items: stretch; }
.btn-row--stack > .btn { width: 100%; }

/* ── Alert boxes ─────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 6px; font-size: 0.875rem; margin-bottom: 16px;
}
.alert--warning { background: var(--warning-bg); color: var(--warning-text); border-left: 3px solid var(--warning); }
.alert--info    { background: var(--primary-light); color: var(--info-text); border-left: 3px solid var(--primary); }
.alert--success { background: var(--success-bg); color: var(--success-text); border-left: 3px solid var(--success); }

/* ── Summary table ───────────────────────────────────── */
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.summary-table th { text-align: left; padding: 8px 12px; color: var(--text-muted);
  font-weight: 500; border-bottom: 1px solid var(--border); }
.summary-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.summary-table td:last-child { font-family: monospace; color: var(--text-dark); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 500; }
.badge--skip { background: var(--bg-page); color: var(--text-muted); }
.badge--ok   { background: var(--success-bg); color: var(--success); }

/* ── Inspector: flow diagram ─────────────────────────── */
.flow-diagram { overflow-x: auto; margin-bottom: 40px; }
.flow-row {
  display: grid;
  grid-template-columns: 220px 40px 1fr;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.flow-row:last-child { border-bottom: none; }
.flow-event { font-family: monospace; font-size: 0.8rem; color: var(--text-dark); font-weight: 600; }
.flow-arrow { text-align: center; color: var(--text-muted); }
.flow-tags  { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 500;
}
.tag-chip--ga4  { background: var(--chip-ga4-bg); color: var(--chip-ga4-text); }
.tag-chip--ads  { background: var(--chip-ads-bg); color: var(--chip-ads-text); }
.tag-chip--meta { background: var(--chip-meta-bg); color: var(--chip-meta-text); }
.tag-chip--consent { background: var(--chip-consent-bg); color: var(--chip-consent-text); }
.tag-chip--other   { background: var(--chip-other-bg); color: var(--chip-other-text); }
.consent-icon { font-size: 0.65rem; opacity: .7; }

/* ── Inspector: tag cards ────────────────────────────── */
.platform-group { margin-bottom: 32px; }
.platform-group h3 { font-size: 1rem; font-weight: 700; color: var(--text-dark);
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.tag-card { border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); margin-bottom: 8px; overflow: hidden; }
.tag-card__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
}
.tag-card__header:hover { background: var(--bg-page); }
.tag-card__name { font-weight: 600; font-size: 0.9rem; color: var(--text-dark); }
.tag-card__badges { display: flex; gap: 6px; align-items: center; }
.tag-card__body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.tag-card__body.hidden { display: none; }
.tag-card__row { margin-top: 10px; }
.tag-card__row dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 2px; }
.tag-card__row dd { font-size: 0.875rem; color: var(--text-body); }
.tag-card__tech { margin-top: 12px; }
.tag-card__tech summary { font-size: 0.8rem; color: var(--primary); cursor: pointer; }
.tag-card__tech pre { background: var(--bg-page); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px; font-size: 0.75rem; overflow-x: auto;
  margin-top: 8px; }

/* ── Architecture selection cards ───────────────────── */
.arch-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 8px; }
@media (max-width: 720px) { .arch-cards { grid-template-columns: 1fr; } }
/* Cards stretch to equal height in the grid; the CTA is anchored to the bottom
   so all three line up regardless of description length. */
.arch-card {
  position: relative; margin-bottom: 0;
  display: flex; flex-direction: column;
}
/* Fixed-height flex row so the empty badge slot on the middle card keeps the
   titles on the same baseline (a bare min-height loses to the inherited line-box). */
.arch-card__badge-row { display: flex; align-items: center; height: 24px; margin-bottom: 10px; }
.arch-card .card__title-row { margin-top: 0; }
.arch-card__cta { margin-top: 20px; }
.arch-card .card__desc { margin-top: 8px; line-height: 1.7; }
.arch-card .card__desc + .arch-card__cta { margin-top: auto; padding-top: 20px; }
.arch-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
}
.arch-badge--green { background: var(--success-bg); color: var(--success-text); }
.arch-badge--blue  { background: var(--info-bg);    color: var(--info-text); }

/* ── Radio option rows ───────────────────────────────── */
.radio-option {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: 8px; font-size: 0.875rem; color: var(--text-body); line-height: 1.5;
  transition: border-color .15s, background .15s;
}
.radio-option:hover { border-color: var(--primary); background: var(--primary-light); }
.radio-option.selected { border-color: var(--primary); background: var(--primary-light); font-weight: 500; }
.radio-option input[type="radio"] { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }

/* ── Tooltip ─────────────────────────────────────────── */
.tip-wrap {
  position: relative; display: inline-block;
  vertical-align: middle; margin-left: 5px;
}
.tip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  font-size: 0.65rem; font-weight: 700; cursor: help;
  user-select: none; transition: background .15s, color .15s;
}
.tip-icon:hover { background: var(--text-muted); color: #fff; }
.tip-body {
  display: none; position: absolute;
  bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #f9fafb;
  font-size: 0.775rem; font-weight: 400; line-height: 1.55;
  padding: 10px 14px; border-radius: 8px; width: 260px;
  z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  pointer-events: none; white-space: normal;
}
.tip-body::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #1f2937;
}
.tip-wrap:hover .tip-body { display: block; }

/* ── Extras integration blocks ───────────────────────── */
.extras-block {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; background: var(--bg-card);
}
.extras-block .checkbox-row { margin-bottom: 0; }
.extras-block .form-group { margin-top: 14px; margin-bottom: 0; }

/* ── Inspector: event-name overrides ─────────────────── */
.event-overrides { margin-bottom: 40px; }
.event-override-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.event-override-row:last-child { border-bottom: none; }
.event-override-row__label { flex: 1 1 240px; font-size: 0.875rem; font-weight: 500; color: var(--text-dark); }
.event-override-row select {
  font-size: 0.82rem; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg-card); color: var(--text-dark); min-width: 260px;
}
.event-override-row__input {
  font-family: monospace; font-size: 0.82rem; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; min-width: 220px;
}

/* ── Utility classes ─────────────────────────────────── */
.site-header__actions { display: flex; align-items: center; gap: 16px; }
.btn--sm { padding: 6px 14px; font-size: 0.85rem; }
.main--wide { max-width: 900px; }

/* ── Micro-feedback: save flash + download pop ───────── */
.event-override-row__saved {
  font-size: 0.78rem; color: var(--success); font-weight: 600; opacity: 0;
}
.event-override-row__saved.show { animation: save-fade 1.6s ease forwards; }
@keyframes save-fade {
  0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; }
}

@keyframes btn-pop { 0% { transform: scale(1); } 40% { transform: scale(1.05); } 100% { transform: scale(1); } }
.btn--pop { animation: btn-pop 0.3s ease; }

/* ── Product icon badges ─────────────────────────────── */
.product-icon {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; overflow: hidden; flex-shrink: 0;
  vertical-align: middle;
}
.product-icon svg { width: 62%; height: 62%; }
.step-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.step-title-row .step-title { margin-bottom: 0; }
.checkbox-row .product-icon { margin-right: 2px; }
.card__title-row { display: flex; align-items: center; gap: 8px; }
.platform-group h3 { display: flex; align-items: center; gap: 8px; }
.form-where {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 4px;
  display: flex; align-items: baseline; gap: 5px;
}
.form-where::before { content: '📍'; font-size: 0.75rem; }
