:root {
  --ink: #14162b; --ink-soft: #565973; --ink-faint: #8b8ea8;
  --bg: #faf9fc; --surface: #ffffff; --surface-sunken: #f2f1f7; --border: #e5e3ef;
  --accent: #ff7921; --accent-ink: #a3480d; --accent-tint: #fff1e6; --accent-tint-2: #ffddbd;
  --on-accent: #ffffff;
  --success: #147a52; --success-tint: #e2f5ec;
  --amber: #8a6510; --amber-tint: #fdf3da;
  --danger: #b3261e; --danger-tint: #fbe7e6;
  --gold: #fdd265;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3, .brand-word {
  font-family: "Bricolage Grotesque", "Public Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .logo { font-size: 20px; color: var(--ink); }
.topbar .logo span { color: var(--accent); }
.topbar nav a { margin-left: 20px; color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.topbar .cta {
  background: var(--accent); color: var(--on-accent); padding: 10px 18px;
  border-radius: 999px; font-weight: 700; font-size: 14px;
}
.topbar .cta:hover { text-decoration: none; opacity: 0.92; }

.container { max-width: 960px; margin: 0 auto; padding: 40px 24px; }
.container.narrow { max-width: 460px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px;
}

.flash {
  background: var(--accent-tint); border: 1px solid var(--accent-tint-2); color: var(--accent-ink);
  padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; font-weight: 600;
}
.flash.error { background: var(--danger-tint); border-color: #f3c8c5; color: var(--danger); }

label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: var(--surface-sunken);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }

button, .btn {
  display: inline-block; background: var(--accent); color: var(--on-accent); border: none;
  padding: 13px 20px; border-radius: 999px; font-weight: 700; font-size: 15px; cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { opacity: 0.92; text-decoration: none; }
.btn.secondary { background: var(--surface-sunken); color: var(--ink); border: 1px solid var(--border); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.danger { background: var(--danger); }

.muted { color: var(--ink-soft); font-size: 14px; }
.small { font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge.trial { background: var(--accent-tint); color: var(--accent-ink); }
.badge.active { background: var(--success-tint); color: var(--success); }
.badge.expired { background: var(--danger-tint); color: var(--danger); }
.badge.canceled { background: var(--amber-tint); color: var(--amber); }
.badge.none { background: var(--surface-sunken); color: var(--ink-faint); }

.trial-banner {
  background: var(--ink); color: #fff; padding: 14px 24px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; font-size: 14px;
}
.trial-banner strong { color: var(--gold); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 720px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; background: var(--surface); }
.plan-card.featured { border: 2px solid var(--accent); position: relative; }
.plan-card .price { font-size: 32px; font-weight: 800; font-family: "Bricolage Grotesque", sans-serif; margin: 8px 0; }
.plan-card .price small { font-size: 14px; font-weight: 500; color: var(--ink-soft); }

footer.site-footer {
  border-top: 1px solid var(--border); padding: 24px 32px; text-align: center;
  color: var(--ink-faint); font-size: 13px;
}
footer.site-footer a { color: var(--ink-soft); margin: 0 8px; }

/* --- Design-panel chip pickers (error-correction level, shape/border/center
   style, logo, frame) — shared across the free-tool generator, the
   homepage builder, and the edit page's Style card so they all look and
   behave the same way. See qr-styling-feature-scope.md's redesign notes. */
.chip-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-family: inherit; min-width: 68px;
  transition: border-color .15s, background .15s;
}
.chip-btn:hover { border-color: var(--ink-faint); }
.chip-btn.active { border-color: var(--accent); background: var(--accent-tint); }
.chip-btn.active .chip-name, .chip-btn.active .chip-pct { color: var(--accent-ink); }
.chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chip-btn:disabled:hover { border-color: var(--border); }
.chip-name { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.chip-pct { font-size: 0.72rem; color: var(--ink-faint); }
.chip-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.chip-icon svg { width: 100%; height: 100%; }
.chip-label-sm { font-size: 0.7rem; color: var(--ink-soft); margin-top: 1px; }

/* Same picker, laid out as an icon-only grid (Shape/Border/Center/Logo tiles). */
.icon-chip-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.icon-chip-btn {
  width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; padding: 0; transition: border-color .15s, background .15s;
}
.icon-chip-btn:hover { border-color: var(--ink-faint); }
.icon-chip-btn.active { border-color: var(--accent); background: var(--accent-tint); }
.icon-chip-btn svg { width: 26px; height: 26px; }
.icon-chip-btn img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }

/* Tabs used by the redesigned Design panel and the tidied-up edit page. */
.tab-strip { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; padding: 10px 16px; font-weight: 600; font-size: 14px;
  color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; border-radius: 0;
}
.tab-btn:hover { color: var(--ink); background: none; opacity: 1; }
.tab-btn.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tab-btn:disabled:hover { color: var(--ink-soft); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Compact numbered-step builder card (free QR generator + homepage
   builder) — a content-type strip, then a 1/2/3 "complete → design →
   download" layout with the preview pinned in a side panel. Matches the
   reference-tool layout Taj asked to copy 2026-08-24. See
   qr-styling-feature-scope.md's "compact builder layout" notes. */
.qb-type-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.qb-type-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink-soft);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.qb-type-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.qb-type-btn.active { border-color: var(--accent-ink); background: var(--accent-tint); color: var(--accent-ink); }
.qb-type-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.qb-type-soon {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--surface-sunken); color: var(--ink-faint); border-radius: 999px; padding: 1px 6px;
}

.qb-body { display: grid; grid-template-columns: 1.5fr 1fr; }
.qb-main { padding: 28px 32px; }
.qb-side { padding: 28px; background: var(--surface-sunken); border-left: 1px solid var(--border); }
@media (max-width: 860px) {
  .qb-body { grid-template-columns: 1fr; }
  .qb-side { border-left: none; border-top: 1px solid var(--border); }
}

.qb-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qb-step-badge {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff;
  font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.qb-step-head h3 { font-size: 1.02rem; font-weight: 700; margin: 0; }
.qb-step + .qb-step { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }

.qb-preview-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(20,22,43,.04);
}

/* --- Analytics page --------------------------------------------------- */
.an-filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 28px; }
.an-filters .field { min-width: 190px; }
.an-filters label { margin: 0 0 6px; }
.an-filters select { margin: 0; }

.an-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
@media (max-width: 760px) { .an-stats { grid-template-columns: repeat(2, 1fr); } }
.an-stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
}
.an-stat-icon {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint); color: var(--accent-ink); flex-shrink: 0;
}
.an-stat-icon svg { width: 16px; height: 16px; }
.an-stat-icon.an-icon-danger { background: var(--danger-tint); color: var(--danger); }
.an-stat-num { font-family: "Bricolage Grotesque", sans-serif; font-size: 30px; font-weight: 800; line-height: 1.05; }
.an-stat-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.an-stat-sub { font-size: 12px; color: var(--ink-faint); }

.an-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.an-chart-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.an-chart-icon {
  width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-sunken); color: var(--ink-soft); flex-shrink: 0; margin-top: 1px;
}
.an-chart-icon svg { width: 14px; height: 14px; }
.an-chart-card h3 { margin: 0; font-size: 1rem; }
.an-chart-card .muted { margin: 2px 0 0; font-size: 13px; }

.an-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; position: relative; padding-top: 22px; border-bottom: 1px solid var(--border); }
.an-bars.an-bars-dow { gap: 10px; }
.an-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.an-bar {
  width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; position: relative;
  background: var(--an-bar-color, var(--accent-tint-2));
  transition: filter .12s;
}
.an-bar-col:hover .an-bar, .an-bar-col:focus-visible .an-bar { filter: brightness(0.92); }
.an-bar-col:focus-visible { outline: none; }
.an-bar-tooltip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-6px);
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4;
  padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .1s; z-index: 5;
}
.an-bar-tooltip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--ink);
}
.an-bar-col:hover .an-bar-tooltip, .an-bar-col:focus-visible .an-bar-tooltip { opacity: 1; }
.an-bar-label { font-size: 10px; color: var(--ink-faint); margin-top: 8px; }
.an-table-toggle { margin-top: 14px; }
.an-table-toggle summary {
  font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.an-table-toggle summary::-webkit-details-marker { display: none; }
.an-table-toggle summary svg { width: 11px; height: 11px; transition: transform .12s; }
.an-table-toggle[open] summary svg { transform: rotate(90deg); }
.an-table-toggle table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.an-table-toggle th, .an-table-toggle td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.an-table-toggle th { color: var(--ink-soft); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.an-table-toggle td:last-child, .an-table-toggle th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.an-device-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.an-device-row:last-child { margin-bottom: 0; }
.an-device-icon { width: 22px; height: 22px; color: var(--ink-faint); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.an-device-icon svg { width: 17px; height: 17px; }
.an-device-name { width: 62px; font-size: 13px; color: var(--ink-soft); flex-shrink: 0; }
.an-device-track { flex: 1; background: var(--accent-tint); border-radius: 6px; height: 12px; overflow: hidden; }
.an-device-fill { background: var(--accent); height: 100%; border-radius: 6px; min-width: 3px; transition: width .2s; }
.an-device-count { width: 36px; text-align: right; font-size: 13px; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }

#an-heatmap { width: 100%; height: 380px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-sunken); }
.an-locations { list-style: none; margin: 0; padding: 0; }
.an-locations li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.an-locations li:last-child { border-bottom: none; }
.an-loc-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 5px; gap: 10px; }
.an-loc-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-loc-name svg { width: 13px; height: 13px; color: var(--ink-faint); flex-shrink: 0; }
.an-loc-count { color: var(--ink); font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.an-loc-track { background: var(--accent-tint); border-radius: 4px; height: 5px; overflow: hidden; }
.an-loc-fill { background: var(--accent); height: 100%; border-radius: 4px; min-width: 3px; }
.an-geo-note { font-size: 12px; color: var(--ink-faint); margin-top: 10px; }
