/* =====================================================================
   App stylesheet — no framework, ~20 KB. Mobile-first, light + dark.
   ===================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #06b6d4;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-alt: #0f1422;
  --surface: #131a2a;
  --surface-2: #1b2336;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #253049;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: #1e2142;
  --success: #34d399;
  --success-soft: #0c2a22;
  --warning: #fbbf24;
  --warning-soft: #2b2110;
  --danger: #f87171;
  --danger-soft: #2c1414;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
h2, .h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 750; }
h3, .h3 { font-size: 1.2rem; font-weight: 700; }
.h4 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; margin-left: auto; margin-right: auto; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.link { color: var(--primary); font-weight: 500; }
.link:hover { text-decoration: underline; }
.mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.grow { flex: 1; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grad-text { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }

/* Theme toggle icons */
.show-dark { display: none; }
[data-theme="dark"] .show-dark { display: inline-flex; }
[data-theme="dark"] .show-light { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0b0f19; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-light { background: #fff; color: #312e81; }
.btn-light:hover { background: #eef2ff; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.input {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--text-muted); cursor: pointer; }
.hint { font-size: .8rem; color: var(--text-muted); margin: 6px 0 0; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.checkbox input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox a { color: var(--primary); }
.color-input { width: 48px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: .85rem; margin: 18px 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Cards, badges, alerts ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
@media (min-width: 768px) { .card { padding: 24px; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.alert { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.flash-stack { position: fixed; top: 76px; right: 16px; left: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 460px; margin-left: auto; }
.flash-stack .alert { box-shadow: var(--shadow-lg); }

.announcement { text-align: center; padding: 8px 16px; font-size: .9rem; font-weight: 500; }
.announcement-info { background: var(--primary); color: #fff; }
.announcement-warning { background: #f59e0b; color: #1f1300; }
.announcement-success { background: #059669; color: #fff; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.table tbody tr:hover { background: var(--bg-alt); }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-mark { display: inline-flex; width: 34px; height: 34px; flex: none; }
.brand-mark img, .brand-mark svg { width: 100%; height: 100%; display: block; border-radius: 9px; }
.brand-mark .icon { width: 20px; height: 20px; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 4px; padding: 12px 16px 18px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.nav-links.open { display: flex; }
.nav-links > a { padding: 10px 8px; font-weight: 500; color: var(--text-muted); border-radius: 8px; }
.nav-links > a:hover { color: var(--text); background: var(--surface-2); }
.nav-auth { display: flex; gap: 8px; margin-top: 8px; }
.nav-auth .btn { flex: 1; }
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav-links { display: flex; position: static; flex-direction: row; align-items: center; padding: 0; background: none; border: 0; box-shadow: none; gap: 2px; margin-left: auto; }
  .nav-links > a { padding: 8px 12px; font-size: .95rem; }
  .nav-auth { margin: 0 0 0 10px; }
  .nav-auth .btn { flex: none; }
}

/* ---------- Hero + demo generator ---------- */
.hero { padding: 40px 0 56px; background:
  radial-gradient(800px 400px at 15% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
  radial-gradient(700px 400px at 100% 10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.hero-grid { display: grid; gap: 36px; align-items: center; }
@media (min-width: 1000px) { .hero { padding: 72px 0 88px; } .hero-grid { grid-template-columns: 1fr 1.05fr; gap: 56px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); margin-bottom: 18px; }
.lead { font-size: 1.12rem; color: var(--text-muted); max-width: 560px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 22px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--text-muted); font-size: .92rem; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .icon { color: var(--success); width: 18px; height: 18px; }

.demo { padding: 0; overflow: hidden; scroll-margin-top: 80px; box-shadow: var(--shadow-lg); }
.demo-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--border); overflow-x: auto; background: var(--bg-alt); }
.demo-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.demo-tabs button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.demo-body { display: grid; gap: 20px; padding: 20px; }
@media (min-width: 640px) { .demo-body { grid-template-columns: 1fr 240px; padding: 24px; } }
.demo-form { display: flex; flex-direction: column; gap: 14px; }
.demo-style { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.demo-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-frame { width: 220px; height: 220px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; border: 1px solid var(--border); padding: 6px; }
.qr-frame canvas, .qr-frame svg { width: 100% !important; height: 100% !important; }
.demo-downloads { display: flex; gap: 8px; }
.contrast-warning { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .85rem; color: var(--warning); background: var(--warning-soft); padding: 8px 10px; border-radius: 8px; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
@media (min-width: 768px) { .section { padding: 84px 0; } }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 36px; }

.feature-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature h3 { margin-top: 14px; }
.feature p { margin: 0; }
.feature-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.feature-icon .icon { width: 24px; height: 24px; }

.type-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .type-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .type-grid { grid-template-columns: repeat(3, 1fr); } }
.type-tile { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); transition: border-color .15s, transform .15s; }
a.type-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.type-tile strong { display: block; font-size: .95rem; }
.type-tile .muted { display: block; line-height: 1.4; }
.type-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { text-align: center; padding: 10px; }
.step-num { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; margin-bottom: 12px; }

/* ---------- Pricing ---------- */
.billing-toggle { display: flex; width: max-content; margin: 0 auto 28px; padding: 4px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.billing-toggle button { border: 0; background: transparent; color: var(--text-muted); padding: 8px 16px; border-radius: 99px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.billing-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pricing-grid { display: grid; gap: 18px; grid-template-columns: 1fr; max-width: 1040px; margin: 0 auto; }
@media (min-width: 900px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); align-items: stretch; } }
.price-card { position: relative; display: flex; flex-direction: column; }
.price-card.featured { border: 2px solid var(--primary); }
.ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
[data-theme="dark"] .ribbon { color: #0b0f19; }
.price { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 2px; }
.price .amount { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.price .per { color: var(--text-muted); }
.check-list { list-style: none; padding: 0; margin: 14px 0 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.check-list li { display: flex; gap: 10px; font-size: .93rem; }
.check-list .icon { color: var(--success); width: 18px; height: 18px; margin-top: 3px; }
.compare .table td:not(:first-child), .compare .table th:not(:first-child) { text-align: center; }

/* ---------- Testimonials, FAQ, CTA ---------- */
.testimonial-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .testimonial-grid { grid-template-columns: repeat(3, 1fr); } }
.testimonial { margin: 0; }
.testimonial blockquote { margin: 0 0 14px; font-size: 1rem; }
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 0 18px; }
.faq-item summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--text-muted); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { color: var(--text-muted); padding-bottom: 6px; }
.cta-band { background: linear-gradient(135deg, #4f46e5, #0891b2); color: #fff; }
.cta-inner { text-align: center; }
.cta-inner p { opacity: .9; margin-bottom: 22px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 24px; background: var(--bg-alt); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr 1fr; }
.footer-grid > div:first-child { grid-column: 1 / -1; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-grid > div:first-child { grid-column: auto; } }
.footer-grid h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.footer-grid a:not(.brand) { display: block; color: var(--text-muted); font-size: .92rem; padding: 3px 0; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-muted); }

.cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70; max-width: 520px; display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: .9rem; }
.cookie-notice p { margin: 0; }
.cookie-notice a { color: var(--primary); }

/* ---------- Legal / prose ---------- */
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.prose h2 { font-size: 1.3rem; margin-top: 2em; }
.prose h3 { font-size: 1.05rem; margin-top: 1.4em; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose a { color: var(--primary); text-decoration: underline; }

/* ---------- Auth pages ---------- */
.auth-body { background: var(--bg-alt); min-height: 100vh; }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 24px 16px 40px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.auth-card { padding: 28px 24px; }
.auth-card h1 { margin-bottom: .3em; }
.auth-legal { text-align: center; margin-top: 18px; }
.auth-legal a:hover { text-decoration: underline; }
.auth-wrap .flash-stack { position: static; max-width: none; margin-bottom: 14px; }
.google-btn svg { width: 18px; height: 18px; }
.error-page { margin-top: 40px; }
.error-code { font-size: 4rem; font-weight: 800; line-height: 1; background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px; }
.debug { text-align: left; font-size: .75rem; background: var(--surface-2); padding: 12px; border-radius: 8px; overflow: auto; max-height: 320px; white-space: pre-wrap; }

/* ---------- Dashboard ---------- */
.dash-body { background: var(--bg-alt); }
.dash { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 80; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .2s ease; }
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .4); }
.sidebar.open ~ .sidebar-backdrop, body:has(.sidebar.open) .sidebar-backdrop { display: block; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; height: 64px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--text-muted); font-weight: 500; font-size: .95rem; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.sidebar-logout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: .95rem; border-radius: 9px; cursor: pointer; }
.sidebar-logout:hover { background: var(--surface-2); color: var(--text); }
.plan-pill { font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 99px; text-align: center; background: var(--surface-2); color: var(--text-muted); }
.plan-pill.plan-pro { background: var(--primary-soft); color: var(--primary); }
.plan-pill.plan-business { background: linear-gradient(90deg, var(--primary), var(--accent)); color: #fff; }
.dash-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-top { position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.dash-title { font-weight: 700; flex: 1; }
.dash-top-actions { display: flex; align-items: center; gap: 8px; }
.avatar { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.dash-content { padding: 20px 16px 48px; width: 100%; max-width: 1200px; margin: 0 auto; }
@media (min-width: 1024px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; }
  .sidebar-close, .nav-toggle-dash { display: none; }
  .sidebar-backdrop { display: none !important; }
  .dash-content { padding: 28px 32px 56px; }
}
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.stat-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (min-width: 1000px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.stat-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.empty { text-align: center; padding: 32px 10px; }
.upsell { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.upsell h3 { margin-bottom: 4px; }
.upsell p { margin: 0; }
.settings-grid { display: grid; gap: 18px; }
@media (min-width: 1100px) { .settings-grid { grid-template-columns: 1fr 1fr; } .settings-grid #profile, .settings-grid #danger { grid-column: 1 / -1; } }
.settings-grid .card { scroll-margin-top: 80px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .sidebar, .dash-top, .cookie-notice { display: none !important; } }

/* =====================================================================
   Phase 2: generator, QR list, templates
   ===================================================================== */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ml-auto { margin-left: auto; }
.span-2 { grid-column: 1 / -1; }
.text-danger { color: var(--danger) !important; }
.soon { font-style: normal; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 5px 10px; font-size: .78rem; font-weight: 600; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.chip:hover, .chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chip-sm { padding: 2px 8px; font-size: .72rem; }
.details summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--primary); }

/* Generator layout: form left, sticky preview right */
.gen { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.gen-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 1024px) {
  .gen { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .gen-preview { position: sticky; top: 76px; }
}
@media (max-width: 1023px) {
  .gen-preview { order: -1; }
  .preview-stage { max-width: 230px; min-height: 0; margin: 0 auto; padding: 10px; }
  .preview-card { padding: 14px; }
}
.download-box .grid-2 { grid-template-columns: 1fr 1fr; }
.gen-step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; flex: none; }

.type-picker { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .type-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .type-picker { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.type-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-align: center; position: relative; }
.type-chip:hover:not(:disabled) { border-color: var(--primary); }
.type-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.type-chip:disabled { opacity: .55; cursor: not-allowed; }
.type-chip .soon { position: absolute; top: 4px; right: 4px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; padding: 3px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; font: inherit; font-size: .8rem; font-weight: 600; padding: 5px 12px; border-radius: 99px; color: var(--text-muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button:disabled { cursor: not-allowed; }

details.panel { border-top: 1px solid var(--border); }
details.panel:first-child { border-top: 0; }
details.panel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 0; font-weight: 600; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; }
details.panel[open] > summary::after { transform: rotate(-135deg); }
.panel-body { padding: 0 0 18px; }

.option-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; }
.option-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.option-grid button:hover { border-color: var(--primary); }
.option-grid button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }

/* Tiny CSS illustrations of each option */
.dot-sample { width: 26px; height: 26px; background-size: 9px 9px; }
.dot-sample.dot-square { background-image: linear-gradient(currentColor, currentColor); background-size: 100% 100%; }
.dot-sample.dot-dots { background-image: radial-gradient(circle, currentColor 45%, transparent 50%); }
.dot-sample.dot-rounded { background-image: radial-gradient(circle, currentColor 62%, transparent 66%); }
.dot-sample.dot-extra-rounded { background-image: radial-gradient(circle, currentColor 70%, transparent 72%); background-size: 13px 13px; }
.dot-sample.dot-classy { background-image: linear-gradient(135deg, currentColor 70%, transparent 70%); }
.dot-sample.dot-classy-rounded { background-image: radial-gradient(circle at 0 100%, currentColor 85%, transparent 88%); }
.corner-sample { width: 24px; height: 24px; display: inline-block; position: relative; }
.cs-square, .cs-extra-rounded, .cs-dot { border: 4px solid currentColor; }
.cs-extra-rounded { border-radius: 8px; }
.cs-dot { border-radius: 50%; }
.cd-square::before, .cd-dot::before { content: ""; position: absolute; inset: 6px; background: currentColor; }
.cd-dot::before { border-radius: 50%; }
.frame-sample { width: 26px; height: 30px; display: inline-block; position: relative; border-radius: 4px; }
.frame-sample::before { content: ""; position: absolute; left: 4px; right: 4px; top: 3px; height: 18px; background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px); opacity: .5; }
.fr-box { background: color-mix(in srgb, currentColor 18%, transparent); border: 2px solid currentColor; }
.fr-banner-bottom::after, .fr-banner-top::after, .fr-pill::after, .fr-text::after { content: ""; position: absolute; left: 3px; right: 3px; height: 6px; background: currentColor; border-radius: 2px; bottom: 1px; }
.fr-banner-top::before { top: 10px; }
.fr-banner-top::after { top: 1px; bottom: auto; }
.fr-pill::after { border-radius: 99px; left: 6px; right: 6px; }
.fr-text::after { height: 3px; opacity: .7; }

.color-field { display: flex; gap: 8px; }
.color-field input[type="color"] { width: 46px; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; flex: none; }
.color-field .input { font-family: var(--mono); text-transform: lowercase; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

.preset-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 640px) { .preset-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.preset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; font: inherit; color: var(--text); position: relative; }
.preset:hover { border-color: var(--primary); }
.preset.locked { opacity: .75; }
.preset-thumb { width: 100%; aspect-ratio: 1 / 1.1; display: flex; align-items: center; justify-content: center; }
.preset-thumb .qr-canvas, .tpl-thumb .qr-canvas, .qr-thumb .qr-canvas { width: 100%; height: 100%; display: block; }
.preset-name { font-size: .72rem; font-weight: 600; text-align: center; }
.preset .soon { position: absolute; top: 4px; right: 4px; }

.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-thumb { width: 72px; height: 72px; flex: none; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .7rem; color: var(--text-muted); background: var(--surface-2); overflow: hidden; }
.logo-thumb img { max-width: 100%; max-height: 100%; }
.file-btn { cursor: pointer; }

.preview-stage { position: relative; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); padding: 14px;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; min-height: 220px; }
.preview-stage .qr-canvas { width: 100%; height: auto; display: block; max-height: 70vh; }
.preview-stage.is-sample .qr-canvas { opacity: .18; filter: grayscale(1); }
.preview-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; font-weight: 600; color: var(--text-muted); }
.preview-placeholder[hidden] { display: none; }
.dl-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dl-buttons .btn { padding-left: 6px; padding-right: 6px; justify-content: center; }

/* QR list */
.qr-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .qr-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } }
.qr-main { min-width: 0; }
.folder-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.folder-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 4px 8px 8px; }
.folder-nav > a { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; font-size: .9rem; color: var(--text); }
.folder-nav > a span:not(.folder-dot) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-nav > a em { font-style: normal; font-size: .75rem; color: var(--text-muted); }
.folder-nav > a:hover { background: var(--surface-2); }
.folder-nav > a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.folder-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: none; margin: 0 3px; }
.folder-new { padding: 8px; font-size: .85rem; }
.folder-new summary { cursor: pointer; color: var(--primary); font-weight: 600; display: flex; gap: 6px; align-items: center; list-style: none; }
.folder-new summary::-webkit-details-marker { display: none; }
@media (max-width: 899px) {
  .folder-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .folder-nav > a { padding: 6px 10px; border: 1px solid var(--border); border-radius: 99px; }
  .folder-nav > a span:not(.folder-dot) { flex: none; }
  .folder-title { width: 100%; padding-bottom: 4px; }
  .folder-new { width: 100%; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
@media (min-width: 768px) { .toolbar { padding: 12px; } }
.toolbar select.input { width: auto; flex: 1 1 140px; }
.search-field { position: relative; flex: 1 1 220px; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field .input { padding-left: 36px; }

.qr-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.qr-card { display: flex; flex-direction: column; padding: 0 !important; overflow: visible; }
.qr-thumb { display: flex; align-items: center; justify-content: center; height: 210px; padding: 16px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; font-size: .8rem; color: var(--text-muted); }

.qr-card-body { padding: 14px 16px 6px; flex: 1; min-width: 0; }
.qr-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-name a:hover { color: var(--primary); }
.qr-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.qr-dest { margin: 8px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-actions { display: flex; gap: 6px; align-items: center; padding: 10px 16px 14px; }
.qr-actions .menu { margin-left: auto; }

details.menu { position: relative; }
details.menu > summary { list-style: none; width: 34px; height: 34px; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; font: inherit; font-size: .88rem; color: var(--text); cursor: pointer; text-align: left; }
.menu-pop button:hover { background: var(--surface-2); }
.menu-move { padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 2px 0; }
.menu-move .input { padding: 6px 8px; font-size: .85rem; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; }

/* Templates */
.tpl-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tpl-card { display: flex; flex-direction: column; gap: 8px; }
.tpl-card p { margin: 0; }
.tpl-thumb { aspect-ratio: 1 / 1.1; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }

/* =====================================================================
   Phase 3: dynamic codes, analytics, domains
   ===================================================================== */
:root { --series-1: #2a78d6; --series-2: #eb6834; --info: #1d4ed8; --info-soft: #eff6ff; }
[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --info: #93c5fd; --info-soft: rgba(59, 130, 246, .12); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.mb-4 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

.dynamic-panel { border-top: 1px solid var(--border); padding-top: 16px; }
.short-link code { display: block; padding: 9px 12px; font-size: .9rem; }
.seg button:disabled { opacity: .45; }
.menu-pop .menu-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: .88rem; color: var(--text); }
.menu-pop .menu-item:hover { background: var(--surface-2); }
a.badge:hover { color: var(--primary); }

/* Analytics */
.seg-link { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.seg-link:hover { color: var(--text); }
.seg-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-link.locked { opacity: .6; }
.stat-value-sm { font-size: 1.15rem; line-height: 1.3; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { height: 200px; }
.analytics-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .analytics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bar-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--series-1); }

/* =====================================================================
   Phase 4: hosted page forms, uploads, more link types
   ===================================================================== */
.more-types > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--primary); }
.upload-row { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.upload-thumb { position: relative; width: 72px; height: 72px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted); overflow: hidden; }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb.has-image > svg { display: none; }
.upload-field.is-uploading .upload-thumb::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.upload-field.is-uploading .upload-thumb::before { content: ""; position: absolute; z-index: 1; width: 22px; height: 22px; border: 3px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-mini { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.upload-mini .upload-thumb { width: 60px; height: 60px; cursor: pointer; }
.upload-doc .upload-thumb { color: var(--primary); }

.repeater { display: flex; flex-direction: column; gap: 10px; }
.repeater-rows { display: flex; flex-direction: column; gap: 10px; }
.repeater-rows:empty { display: none; }
.repeater-row { display: flex; gap: 8px; align-items: center; }
.repeater-row > .icon-btn { width: 34px; height: 34px; flex: none; font-weight: 700; }
.repeater-row select.input { width: auto; flex: 0 0 130px; }
.menu-cat { flex-direction: column; align-items: stretch; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.menu-cat-name { font-weight: 700; }
.menu-item { align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.menu-item-fields { gap: 8px; min-width: 0; }
.price-input { width: 96px; flex: none; }
.chip-check { gap: 6px; cursor: pointer; }
.chip-check input { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); }
.chip-check:has(input:checked) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
#page-form[hidden] { display: none; }
@media (max-width: 560px) {
  .repeater-row select.input { flex-basis: 110px; }
  .menu-item { flex-wrap: wrap; }
  .menu-item .menu-item-fields { flex-basis: calc(100% - 110px); }
}

/* =====================================================================
   Phase 5: billing
   ===================================================================== */
.billing-top { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .billing-top { grid-template-columns: 3fr 2fr; } }
.current-plan { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.plan-name { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.meters { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; font-weight: 600; }
.progress.is-full > span { background: var(--warning); }
.cancel-box > summary { list-style: none; width: max-content; }
.cancel-box > summary::-webkit-details-marker { display: none; }
.cancel-box[open] > summary { margin-bottom: 4px; }
.cancel-box form { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); max-width: 520px; }
.price-card form.mt-auto, .price-card p.mt-auto { margin-top: auto; padding-top: 16px; }
.mt-8 { margin-top: 2.5rem; }
a.plan-pill { display: block; text-decoration: none; }
.grace-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 24px; background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); font-size: .92rem; font-weight: 600; }
.grace-banner span { flex: 1 1 240px; }
.receipt { max-width: 680px; margin: 0 auto; }
.receipt-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.receipt .table td, .receipt .table th { white-space: normal; }
.receipt tfoot th { font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--text); }
@media print { .no-print { display: none !important; } .receipt { box-shadow: none; border: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* =====================================================================
   Phase 6: admin, teams, bulk, SEO pages
   ===================================================================== */
.admin-tabs { display: flex; gap: 4px; flex-wrap: nowrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a { padding: 9px 14px; font-weight: 600; font-size: .9rem; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-bar .input[type="search"] { flex: 1 1 260px; }
.filter-bar select.input { width: auto; flex: 0 0 auto; }
@media (min-width: 900px) { .stat-grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .admin-split { grid-template-columns: 1fr 1fr; align-items: start; gap: 18px; } }
.activity { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; }
.plain-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }
a.seg-link, .seg > a { display: inline-flex; padding: 5px 14px; border-radius: 99px; font-size: .85rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.seg > a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.report-details { white-space: pre-line; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.ml-2 { margin-left: .5rem; }
.break { word-break: break-all; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input-sm { padding: 6px 10px; font-size: .85rem; min-height: 0; }
.menu-inline { display: inline-block; position: relative; }
.menu-inline > summary { list-style: none; }
.menu-inline > summary::-webkit-details-marker { display: none; }
.inline-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; gap: 8px; padding: 10px; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg, var(--shadow)); }
.inline-pop .input { flex: 1; }
.table td.wrap-cell, .table .wrap-cell { white-space: normal; min-width: 180px; }
.plan-table th[scope="row"] { font-size: .85rem; text-transform: none; letter-spacing: 0; color: var(--text); white-space: nowrap; }
.plan-table td { min-width: 130px; vertical-align: top; }
.plan-table .chip { margin: 0 4px 4px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.admin-user-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.admin-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.ws-switch { padding: 0 14px 12px; }
.ws-switch .label { margin-bottom: 4px; }
.ws-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 24px; background: var(--primary-soft); color: var(--primary); font-size: .9rem; border-bottom: 1px solid var(--border); }
.ws-banner span { flex: 1 1 220px; }
.invite-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.invite-form .grow { flex: 1 1 240px; }
.invite-form .field { display: flex; flex-direction: column; }

.bulk-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .bulk-grid { grid-template-columns: 3fr 2fr; align-items: start; } }
.table-compact td, .table-compact th { padding: 8px 10px; white-space: normal; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius); text-align: center; cursor: pointer; color: var(--text-muted); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.dropzone .icon { width: 28px; height: 28px; color: var(--primary); }
.bulk-preview { display: flex; justify-content: center; min-height: 120px; }
.bulk-preview .qr-canvas { width: 160px; height: auto; }

.seo-hero { padding-top: 64px; }
.seo-hero h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); letter-spacing: -.03em; line-height: 1.1; }
.crumbs { color: var(--text-muted); display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.crumbs a { color: var(--primary); }
.hero-ctas.center { justify-content: center; }
.seo-grid { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .seo-grid { grid-template-columns: 1fr 1fr; } }
a.type-tile { color: inherit; text-decoration: none; }
a.type-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.promise-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .promise-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .promise-grid { grid-template-columns: repeat(4, 1fr); } }
.promise-grid h3 { margin-top: 12px; font-size: 1.05rem; }
.promise-mini { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius); background: var(--success-soft); color: var(--text); }
.promise-mini .icon { color: var(--success); flex: none; margin-top: 2px; }
.promise-mini p { margin: 0; }
/* Keep absolutely positioned bits (e.g. .sr-only labels) inside scrolling tables, and let grid columns shrink. */
.table-wrap { position: relative; }
.grid-2 > *, .grid-3 > *, .admin-split > *, .bulk-grid > *, .billing-top > * { min-width: 0; }
/* Feedback & system */
.sidebar-feedback { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .88rem; font-weight: 600; text-decoration: none; }
.sidebar-feedback:hover { background: var(--surface-2); color: var(--text); }
.feedback-card { max-width: 640px; }
.status-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.status-list li { display: flex; gap: 12px; align-items: flex-start; }
.status-list .badge { flex: none; min-width: 74px; justify-content: center; margin-top: 2px; }
.error-table td { vertical-align: top; }
.error-table td.mono { word-break: break-word; }

/* Events & tickets (Phase 7) */
.tt-rows { display: flex; flex-direction: column; gap: 12px; }
.tt-row { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tt-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.tt-grid .tt-name, .tt-grid .tt-desc { grid-column: 1 / -1; }
@media (min-width: 900px) { .tt-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .tt-grid .tt-name { grid-column: auto; } .tt-grid .tt-desc { grid-column: span 3; } }
.tt-grid > * { min-width: 0; }
.tt-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; min-height: 30px; }
.event-cover-thumb { width: 100%; max-height: 140px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 8px; }
.event-share { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.event-qr { width: 160px; height: 160px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.event-qr canvas, .event-qr svg { width: 100% !important; height: 100% !important; display: block; }
.guest-form { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .guest-form { grid-template-columns: 2fr 2fr 1.4fr 80px auto; } }
.guest-form > * { min-width: 0; }

.scanner { max-width: 560px; margin: 0 auto; }
.scanner-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.scanner-count { margin: 4px 0 0; font-size: 1.1rem; }
.scanner-count strong { font-size: 1.6rem; }
.scanner-view { position: relative; aspect-ratio: 1 / 1; background: #0b0d12; border-radius: var(--radius); overflow: hidden; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s; pointer-events: none; }
.scanning .scanner-frame { opacity: 1; }
.scanner-start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #e5e7eb; }
.scanner-start[hidden] { display: none; }
.scan-result { margin-top: 12px; padding: 18px; border-radius: var(--radius); color: #fff; text-align: center; }
.scan-result[hidden] { display: none; }
.scan-ok { background: #15803d; }
.scan-bad { background: #b91c1c; }
.scan-result-title { margin: 0; font-size: 1.5rem; font-weight: 800; }
.scan-result-detail { margin: 6px 0 0; font-size: 1.05rem; }
.scan-result .btn { margin-top: 10px; color: #fff; border-color: rgba(255, 255, 255, .6); }
.scanner-manual { margin-top: 16px; }
.crumbs-left { justify-content: flex-start; margin-bottom: 4px; }
/* Scannability meter (Phase 8) */
.scan-meter { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.scan-meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.scan-meter-head .label { margin: 0; }
.scan-bar { height: 8px; margin-top: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.scan-bar span { display: block; height: 100%; width: 4%; border-radius: 999px; background: var(--text-muted); transition: width .3s; }
.scan-good .scan-bar span { background: var(--success); }
.scan-warn .scan-bar span { background: #d97706; }
.scan-bad .scan-bar span { background: var(--danger); }
.scan-tests { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: .8rem; color: var(--text-muted); }
.scan-tests .ok { color: var(--text); }
.scan-tests .scan-tip { grid-column: 1 / -1; margin-top: 6px; color: var(--text); }
/* AI art panel (Phase 8) */
.ai-styles .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ai-grid:empty { display: none; }
.ai-card { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.ai-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.ai-wait { aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: .85rem; color: var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-2); padding: 10px; }
.ai-failed { color: var(--danger); }
.ai-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: ai-spin 1s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spin { animation-duration: 3s; } }
.ai-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.ai-badge.ok { background: var(--success-soft); color: var(--success); }
.ai-badge.warn { background: #fef3c7; color: #92400e; }
.ai-badge.bad { background: var(--danger-soft); color: var(--danger); }
.ai-tip { margin: 0; color: var(--text-muted); }
.ai-tip:empty { display: none; }
.ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Map pin picker */
.map-picker { display: flex; flex-direction: column; gap: 8px; }
.mp-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mp-bar [hidden] { display: none; }
.mp-body { display: flex; flex-direction: column; gap: 8px; }
.mp-body[hidden] { display: none; }
.mp-map { height: 300px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: relative; z-index: 0; isolation: isolate; background: var(--surface-2); }
.mp-results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.mp-results[hidden] { display: none; }
.mp-results li + li { border-top: 1px solid var(--border); }
.mp-results button { width: 100%; text-align: left; padding: 10px 12px; background: var(--surface); color: var(--text); border: 0; font: inherit; font-size: .88rem; cursor: pointer; }
.mp-results button:hover, .mp-results button:focus-visible { background: var(--primary-soft); }
.mp-status { margin: 0; }

/* Logo wordmark: "iScan" deep blue, "QRcode" blue-to-green, like the logo */
.brand-name { color: #1d4f86; }
.brand-name span { background: linear-gradient(90deg, #2b6cb0, #2a9184 55%, #4caf7d); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="dark"] .brand-name { color: #8fb8e8; }
[data-theme="dark"] .brand-name span { background-image: linear-gradient(90deg, #7fb0ea, #5cc5b5 55%, #7dd3a0); }
.auth-logo img { display: block; width: 220px; height: auto; border-radius: 14px; }
[data-theme="dark"] .auth-logo img { background: #fff; border-radius: 16px; padding: 6px 10px; }
/* Homepage live counters: one slim line under the hero buttons (Admin > Settings switches them on) */
.stats-band.in-hero { margin: 18px 0 4px; }
.in-hero .stats-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 0; max-width: 560px; }
.in-hero .stats-row li { display: flex; flex-direction: column; min-width: 0; padding: 0 14px; border-left: 1px solid var(--border); }
.in-hero .stats-row li:nth-child(3n+1) { padding-left: 0; border-left: 0; }
.in-hero .stats-row strong { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
.in-hero .stats-row .stats-word { font-size: clamp(.95rem, 1.6vw, 1.05rem); line-height: 1.5; }
.in-hero .stats-row li > span { font-size: .76rem; line-height: 1.3; color: var(--text-muted); }
.in-hero .stats-note { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: .78rem; color: var(--text-muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
@media (max-width: 520px) { .in-hero .stats-row li { padding: 0 10px; } }
