/* =========================================================
   คิวอาร์ สตูดิโอ — Modern AI UI 2026
   จิตวิทยาสี:
   · Indigo/Violet  → เทคโนโลยี ความฉลาด ความน่าเชื่อถือ
   · Cyan           → นวัตกรรม ความชัดเจน พลังบวก
   · Coral/Magenta  → กระตุ้น CTA อยากกด อยากลอง
   · Soft slate bg  → ลดภาระสายตา ดูพรีเมียม
   ========================================================= */

:root {
  /* Core psychology palette */
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #64748b;
  --paper: #f4f6fb;
  --paper-2: #e8ecf6;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;

  --primary: #4f46e5;       /* Indigo — trust + tech */
  --primary-2: #7c3aed;     /* Violet — AI premium */
  --primary-deep: #312e81;
  --accent: #06b6d4;        /* Cyan — innovation */
  --cta: #f43f5e;           /* Rose — action urgency */
  --cta-2: #ec4899;         /* Pink-magenta */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  --grad-brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
  --grad-cta: linear-gradient(135deg, #f43f5e 0%, #ec4899 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(6, 182, 212, 0.1));
  --grad-hero-text: linear-gradient(120deg, #4f46e5 0%, #7c3aed 40%, #06b6d4 100%);

  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --glow: 0 0 0 1px rgba(124, 58, 237, 0.08), 0 20px 50px -20px rgba(79, 70, 229, 0.35);
  --shadow: 0 16px 48px -12px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-cta: 0 10px 28px -6px rgba(244, 63, 94, 0.45);

  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --font: "Noto Sans Thai", "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Noto Sans Thai", system-ui, sans-serif;
  --header-h: 70px;
  --max: 1140px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  background: var(--paper);
  overflow-x: hidden;
}

/* Ambient mesh — modern AI atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(124, 58, 237, 0.18), transparent 55%),
    radial-gradient(700px 480px at 95% 5%, rgba(6, 182, 212, 0.16), transparent 50%),
    radial-gradient(600px 400px at 50% 100%, rgba(244, 63, 94, 0.08), transparent 55%),
    linear-gradient(180deg, #eef1fb 0%, #f7f8fc 40%, #f0f4ff 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(79, 70, 229, 0.07) 1px, transparent 0);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  position: relative;
  z-index: 2;
}

/* ---------- Header (glass) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.25s var(--ease);
}
.brand:hover { transform: translateY(-1px); }

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 7px;
  background: var(--grad-brand);
  border-radius: 12px;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.55);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.35), transparent 50%);
  pointer-events: none;
}
.brand-mark span {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 2px;
}
.brand-mark span:nth-child(4) {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-hero-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.main-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  transition: 0.2s var(--ease);
}

.main-nav a:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
}

.main-nav a.is-active {
  color: var(--primary-deep);
  background: rgba(79, 70, 229, 0.1);
  font-weight: 600;
}

.main-nav a.nav-cta {
  background: var(--grad-cta);
  color: #fff !important;
  margin-left: 0.4rem;
  box-shadow: var(--shadow-cta);
  font-weight: 600;
}
.main-nav a.nav-cta:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px -8px rgba(244, 63, 94, 0.5);
}
.main-nav a.nav-cta.outline {
  background: transparent;
  color: var(--primary) !important;
  border: 1.5px solid rgba(79, 70, 229, 0.35);
  box-shadow: none;
}
.main-nav a.nav-cta.outline:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: var(--primary);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card-solid);
  cursor: pointer;
  padding: 11px;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: 0.2s;
}

/* ---------- Main / Hero ---------- */
.site-main {
  position: relative;
  z-index: 2;
  padding: 1.85rem 0 4rem;
  min-height: calc(100vh - 220px);
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: end;
  margin-bottom: 2.1rem;
  animation: fadeUp 0.55s var(--ease) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(79, 70, 229, 0.18);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.95rem;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.04);
}
.hero-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0.08); }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.95rem, 4.2vw, 2.85rem);
  line-height: 1.22;
  margin: 0 0 0.85rem;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--ink);
}

.hero h1 span {
  background: var(--grad-hero-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}

.hero p.lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 38ch;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.hero-stat {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 0.95rem 1.15rem;
  min-width: 118px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}
.hero-stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-brand);
  opacity: 0.85;
}
.hero-stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow);
}
.hero-stat b {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad-hero-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.hero-stat span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.45rem;
  position: relative;
  animation: fadeUp 0.5s var(--ease) both;
  animation-delay: 0.06s;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.4rem;
  right: 1.4rem;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: var(--grad-brand);
  opacity: 0.9;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0 0 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 1.4rem;
  align-items: start;
}

.sticky-preview {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

/* ---------- Forms ---------- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.form-group {
  margin-bottom: 0.95rem;
}

.form-group label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.38rem;
}

.form-group .hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 0.72rem 0.95rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(79, 70, 229, 0.35);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
  background: #fff;
}

textarea { min-height: 96px; resize: vertical; }

input[type="color"] {
  width: 100%;
  height: 46px;
  padding: 4px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

/* Type tabs */
.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
  padding: 0.35rem;
  background: rgba(79, 70, 229, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(79, 70, 229, 0.08);
}

.type-tabs button {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: 0.18s var(--ease);
}

.type-tabs button:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.7);
}

.type-tabs button.is-active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.5);
}

.type-panel { display: none; }
.type-panel.is-active { display: block; animation: fadeUp 0.3s var(--ease); }

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.option-block {
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.04), rgba(6, 182, 212, 0.04));
  border: 1px solid rgba(79, 70, 229, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
}

.option-block h4 {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-deep);
}

.style-picks {
  display: flex;
  gap: 0.5rem;
}
.style-picks label {
  flex: 1;
  text-align: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.55rem 0.35rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  background: #fff;
  transition: 0.15s;
}
.style-picks input { display: none; }
.style-picks label:has(input:checked) {
  border-color: transparent;
  background: var(--grad-soft);
  box-shadow: 0 0 0 1.5px var(--primary);
  font-weight: 700;
  color: var(--primary-deep);
}

/* Logo dropzone */
.dropzone {
  border: 2px dashed rgba(79, 70, 229, 0.28);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  text-align: center;
  background: linear-gradient(160deg, rgba(255,255,255,0.9), rgba(79, 70, 229, 0.04));
  cursor: pointer;
  transition: 0.2s var(--ease);
  position: relative;
}
.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.06);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-preview {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0.5rem auto 0;
  display: none;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
}
.dropzone.has-file .dropzone-preview { display: block; }
.dropzone.has-file .dropzone-text { display: none; }

/* ---------- Buttons (CTA psychology) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.78rem 1.4rem;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s var(--ease);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}

/* Primary = indigo trust — main productive action */
.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 10px 28px -8px rgba(79, 70, 229, 0.55);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -8px rgba(79, 70, 229, 0.6);
}

/* Secondary = coral CTA — download / high attention */
.btn-secondary {
  background: var(--grad-cta);
  color: #fff;
  box-shadow: var(--shadow-cta);
}
.btn-secondary:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary-deep);
  border: 1.5px solid rgba(79, 70, 229, 0.22);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.06);
}

.btn-sm {
  padding: 0.48rem 0.95rem;
  font-size: 0.86rem;
}
.btn-block { width: 100%; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.05rem;
}

/* ---------- Preview panel ---------- */
.preview-shell {
  background:
    radial-gradient(500px 280px at 20% 0%, rgba(124, 58, 237, 0.35), transparent 55%),
    radial-gradient(400px 240px at 100% 80%, rgba(6, 182, 212, 0.28), transparent 50%),
    linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #0f172a 100%);
  color: #eef2ff;
  border-radius: calc(var(--radius) + 4px);
  padding: 1.4rem;
  box-shadow:
    var(--glow),
    0 24px 60px -20px rgba(49, 46, 129, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.55s var(--ease) both;
  animation-delay: 0.1s;
}

.preview-shell::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  filter: blur(40px);
  top: -40px;
  right: -30px;
  pointer-events: none;
}

.preview-shell .card-title {
  color: #f8fafc;
  position: relative;
}
.preview-shell .card-title small {
  font-weight: 500;
  opacity: 0.65;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.qr-frame {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.04),
      rgba(255,255,255,0.04) 8px,
      transparent 8px,
      transparent 16px
    );
  border-radius: 18px;
  padding: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#qrCanvas,
#qrPreviewImg {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.2),
    0 16px 40px rgba(0, 0, 0, 0.35);
}

.qr-placeholder {
  text-align: center;
  color: rgba(238, 242, 255, 0.7);
  font-size: 0.95rem;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.preview-meta {
  margin-top: 1rem;
  font-size: 0.84rem;
  opacity: 0.9;
  display: grid;
  gap: 0.4rem;
  position: relative;
}
.preview-meta code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.76rem;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.preview-meta a {
  color: #67e8f9;
  font-weight: 600;
}

/* Alerts */
.alert {
  margin: 1rem auto 0;
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  font-weight: 550;
  border: 1px solid transparent;
  width: min(100% - 2rem, var(--max));
  position: relative;
  z-index: 3;
  backdrop-filter: blur(8px);
}
.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
  color: #047857;
}
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}

/* Auth */
.auth-wrap {
  max-width: 440px;
  margin: 1.25rem auto 2rem;
}
.auth-wrap .card {
  padding: 1.85rem;
  background: rgba(255, 255, 255, 0.88);
}
.auth-wrap h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
  background: var(--grad-hero-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-wrap .sub {
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  font-size: 0.95rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.3rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.auth-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* Dashboard */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.55rem;
  animation: fadeUp 0.45s var(--ease) both;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.page-head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: fadeUp 0.45s var(--ease) both;
}
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

.stat-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.18), transparent 70%);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow);
}
.stat-card .label {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}
.stat-card .value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 0.25rem;
  background: var(--grad-hero-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat-card.accent .value {
  background: var(--grad-cta);
  -webkit-background-clip: text;
  background-clip: text;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-box {
  position: relative;
  height: 260px;
}

/* Toolbar / list */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}
.toolbar select,
.toolbar input {
  max-width: 220px;
}

.qr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.qr-item {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.qr-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow);
}
.qr-item-thumb {
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.12), transparent 50%),
    linear-gradient(145deg, #eef2ff, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.qr-item-thumb img {
  max-width: 70%;
  max-height: 70%;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.qr-item-body {
  padding: 0.95rem 1rem 1.1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.qr-item-body h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary-deep);
  width: fit-content;
}
.badge.dynamic {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.12), rgba(236, 72, 153, 0.12));
  color: #be123c;
}
.qr-item-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.qr-item-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty-state h3 {
  color: var(--ink);
  margin: 0 0 0.5rem;
  font-weight: 800;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th,
table.data td {
  padding: 0.8rem 0.95rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.data th {
  background: rgba(79, 70, 229, 0.06);
  font-weight: 700;
  color: var(--primary-deep);
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(79, 70, 229, 0.03); }

/* Pagination */
.pagination {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  justify-content: center;
}
.pagination a,
.pagination span {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  background: var(--card-solid);
  transition: 0.15s;
}
.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pagination .is-current {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.45);
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  background:
    radial-gradient(600px 300px at 10% 0%, rgba(124, 58, 237, 0.25), transparent 55%),
    linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
  color: rgba(238, 242, 255, 0.88);
  padding: 2.75rem 0 1.35rem;
  margin-top: auto;
}
.site-footer a {
  color: #a5b4fc;
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: #67e8f9; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.brand-footer .brand-text strong {
  background: linear-gradient(120deg, #c7d2fe, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-footer .brand-text em { color: rgba(199, 210, 254, 0.7); }
.footer-tag {
  margin: 0.85rem 0 0;
  max-width: 30ch;
  opacity: 0.8;
  font-size: 0.95rem;
}
.site-footer h4 {
  margin: 0 0 0.8rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #67e8f9;
  font-weight: 700;
}
.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links li { margin-bottom: 0.45rem; }
.footer-meta {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.8;
  line-height: 1.75;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Detail */
.detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Switch */
.switch-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.06), rgba(236, 72, 153, 0.05));
  border: 1px solid rgba(79, 70, 229, 0.1);
}
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.22s var(--ease);
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.22s var(--ease);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .slider {
  background: var(--grad-brand);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Toast */
.toast-host {
  position: fixed;
  bottom: 1.35rem;
  right: 1.35rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: min(360px, calc(100vw - 2rem));
}
.toast {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #eef2ff;
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  box-shadow: var(--glow);
  font-size: 0.92rem;
  font-weight: 550;
  animation: toastIn 0.3s var(--ease);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #67e8f9;
}
.toast.error {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  border-left-color: #fda4af;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Loading */
.btn.is-loading { pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 0.35rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Turnstile spacing */
.cf-turnstile { margin: 0.25rem 0 0.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero,
  .studio-grid,
  .panel-grid,
  .detail-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .sticky-preview {
    position: static;
  }
  .preview-shell {
    order: -1;
  }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: calc(var(--header-h) - 2px);
    left: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a {
    padding: 0.8rem 1rem;
    border-radius: 12px;
  }
  .main-nav a.nav-cta {
    margin: 0.4rem 0 0;
    text-align: center;
  }

  .form-row,
  .options-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats { width: 100%; }
  .hero-stat { flex: 1; min-width: calc(50% - 0.5rem); }

  .site-main { padding-top: 1.2rem; }

  .type-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .type-tabs::-webkit-scrollbar { display: none; }
  .type-tabs button { flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .container { width: min(100% - 1.2rem, var(--max)); }
  .hero-stat { min-width: 100%; }
}

/* Utility */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Skip link + SEO/AEO blocks */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 0 0 10px 0;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

.seo-aeo {
  margin-top: 1.5rem;
}
.seo-aeo-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
}
.seo-aeo h3 {
  font-size: 1.05rem;
  color: var(--primary-deep);
  margin: 1rem 0 0.5rem;
}
.seo-aeo p {
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
  line-height: 1.75;
}
.seo-aeo a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.seo-aeo a:hover { text-decoration: underline; }
.seo-feature-list,
.seo-steps {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  line-height: 1.85;
}
.faq-list {
  display: grid;
  gap: 0.65rem;
}
.faq-item {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.15rem 0.9rem;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  padding: 0.85rem 0;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 1.25rem;
  color: var(--primary);
  font-weight: 800;
}
.faq-item[open] summary::before { content: "–"; }
.faq-item p {
  margin: 0 0 0.95rem;
  color: var(--ink-soft);
  line-height: 1.7;
  padding-left: 1.25rem;
}

@media (max-width: 900px) {
  .seo-aeo-grid { grid-template-columns: 1fr; }
}

/* ---------- Admin panel ---------- */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.35rem;
  align-items: start;
  padding-bottom: 2rem;
}

.admin-side {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem;
  overflow: hidden;
}
.admin-side::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-cta);
}
.admin-side-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.admin-side-head strong {
  font-size: 1rem;
  color: var(--ink);
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  transition: 0.15s var(--ease);
}
.admin-nav a:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
}
.admin-nav a.is-active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.45);
}
.admin-nav-icon {
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}
.admin-side-foot {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.admin-main { min-width: 0; }

.admin-stats .stat-card small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.admin-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.35rem;
}

.admin-filters .form-row {
  align-items: end;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-width: 280px;
}
.inline-form {
  display: inline;
  margin: 0;
}

.admin-bulk-bar {
  margin-bottom: 0.65rem;
}

.status-ok {
  color: var(--success);
  font-weight: 700;
  font-size: 0.88rem;
}
.status-bad {
  color: var(--error);
  font-weight: 700;
  font-size: 0.88rem;
}
.danger-text {
  color: var(--error) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
.danger-text:hover {
  background: rgba(239, 68, 68, 0.08) !important;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-side {
    position: static;
  }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .admin-nav a {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.84rem;
    padding: 0.55rem 0.7rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
