:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --background: #f0f4f8;
  --text-main: #1e293b;
  --text-sub: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  --font-family: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  padding: 1rem 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand-logo img {
  height: 40px;
  width: auto;
}

.badge {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-link {
  color: var(--text-sub);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  /* Reduced padding for mobile */
  width: 100%;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 3rem;
  width: 100%;
  max-width: 1000px;
  /* Increased max-width */
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.hero-section {
  text-align: center;
  margin-bottom: 3rem;
}

/* Generator Grid */
.generator-container {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.controls-section {
  flex: 2;
  /* Takes up 2/3 space */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-section {
  flex: 1;
  /* Takes up 1/3 space */
  min-width: 300px;
  position: relative;
}

.sticky-preview {
  position: sticky;
  top: 2rem;
  background: white;
  padding: 2rem;
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .generator-container {
    flex-direction: column-reverse;
    /* Preview on top for mobile */
  }

  .preview-section {
    width: 100%;
    min-width: 0;
  }

  .controls-section {
    width: 100%;
  }

  .sticky-preview {
    position: static;
  }
}

/* Tabs */
.tabs-container {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 500;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

/* Forms */
.input-container,
.customization-section {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.customization-section {
  margin-top: 0;
}

.customization-section h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text-main);
}

.form-group {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-input {
  width: 100%;
  background: white;
  border: 1px solid #cbd5e1;
  padding: 1rem;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: var(--font-family);
  margin-top: 0.5rem;
}

.main-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.mt-4 {
  margin-top: 1.5rem;
}

/* Customization Accordion */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.accordion-item {
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  overflow: hidden;
}

.accordion-header {
  padding: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-header::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-sub);
}

.accordion-item.open .accordion-header::after {
  content: '-';
}

.accordion-body {
  padding: 1rem;
  display: none;
}

.accordion-item.open .accordion-body {
  display: block;
}


/* Color Pickers */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

.color-picker-wrapper input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  padding: 0;
  border-radius: 6px;
  background: none;
}

/* File Upload */
.file-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.file-upload-btn:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.file-upload-btn input {
  display: none;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 0.5rem;
  text-align: center;
}

.text-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  width: 100%;
  text-align: center;
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* QR Preview Specifics */
.qr-preview-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#qrcode {
  width: 100%;
  max-width: 350px;
  height: auto;
  aspect-ratio: 1/1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  background: white;
  /* Ensure bg is white for transparent QRs to look right */
  padding: 1rem;
  /* White frame */
}

#qrcode img,
#qrcode canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.download-actions {
  width: 100%;
}

.action-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--font-family);
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.action-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.checkbox-wrapper label {
  margin-bottom: 0;
}

/* content Container */
.content-container {
  width: 100%;
  max-width: 1000px;
  margin-top: 4rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* Features Stripe */
.features-stripe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.stripe-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.icon-box {
  background: #eff6ff;
  color: var(--primary);
  padding: 0.75rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stripe-text h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.stripe-text p {
  font-size: 0.9rem;
  color: var(--text-sub);
  line-height: 1.4;
}


/* Info Articles & Headings */
.info-article h2,
.seo-col h2,
.faq-section h2 {
  font-size: 2rem;
  color: var(--text-main);
  margin-bottom: 2rem;
  text-align: center;
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.step-card {
  background: rgba(255, 255, 255, 0.6);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 1);
  position: relative;
  transition: transform 0.2s;
}

.step-card:hover {
  transform: translateY(-5px);
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.step-number {
  position: absolute;
  top: -15px;
  left: 20px;
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.step-card h3 {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.step-card p {
  font-size: 0.95rem;
  color: var(--text-sub);
}

/* SEO Columns */
.seo-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

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

.seo-col h2 {
  text-align: left;
  margin-bottom: 1.5rem;
}

.seo-col p {
  margin-bottom: 1rem;
  color: var(--text-sub);
}

.seo-col ul {
  padding-left: 1.5rem;
  color: var(--text-sub);
  margin-bottom: 1rem;
}

.seo-col li {
  margin-bottom: 0.5rem;
}


/* Use Cases */
.use-cases-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.use-case {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.use-case h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.use-case p {
  font-size: 0.9rem;
  margin-bottom: 0;
}


.scan-me-label {
  margin-top: 2.5rem;
  /* Increased from 1.5rem */
  font-size: 0.875rem;
  color: var(--text-sub);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* SEO Content */
.seo-content {
  width: 100%;
  max-width: 1000px;
  /* Match glass-panel */
  margin-top: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }

  .glass-panel {
    padding: 1.5rem;
  }

  .generator-container {
    flex-direction: column;
    /* Stack vertically */
    gap: 2rem;
  }

  .input-section,
  .preview-section {
    width: 100%;
    min-width: 0;
    /* Allow shrinking */
  }

  .hero-section h1 {
    font-size: 2rem;
  }
}

/* FAQ */
.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media(max-width: 768px) {
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

.faq-item {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.faq-item h4 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.faq-item p {
  color: var(--text-sub);
  font-size: 0.95rem;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-sub);
  font-size: 0.875rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: white;
  margin-top: 4rem;
  /* Consolidated top margin */
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}
/* ===== Dynamic QR Tool additions ===== */
.brand-text span { font-weight: 700; font-size: 1.2rem; color: var(--text-main); }
.brand-text img { height: 36px; width: 36px; border-radius: 8px; }
.nav-links { display: flex; gap: 1.5rem; }
.muted { color: var(--text-sub); }
.center { text-align: center; }
.text-btn { color: var(--primary); text-decoration: none; width: auto; display: inline-block; }
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: #dc2626; }
.action-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.secondary-btn { background: #0f172a; box-shadow: none; }
.secondary-btn:hover { background: #1e293b; }
.download-actions { display: flex; gap: 0.75rem; }
.input-container label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
.type-hint { background: #eff6ff; border: 1px solid #dbeafe; border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin-bottom: 1rem; color: #1e3a8a; }
.form-error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 0.6rem 0.8rem; margin-top: 0.75rem; font-size: 0.9rem; }
.form-error.ok { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.form-error.hidden { display: none; }
.created-box { margin-top: 1rem; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 14px; padding: 1rem 1.1rem; }
.created-title { font-weight: 700; color: #166534; margin-bottom: 0.25rem; }
.created-short { margin-bottom: 0.75rem; }
.created-actions { display: flex; justify-content: space-between; margin-top: 0.5rem; }
.copy-row { display: flex; gap: 0.5rem; align-items: center; }
.copy-row .main-input { flex: 1; font-size: 0.85rem; }
.copy-row .text-btn { margin: 0; white-space: nowrap; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
#qr-canvas { width: 100%; max-width: 320px; height: auto; aspect-ratio: 1/1; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); transition: filter .2s, opacity .2s; }
#qr-canvas.is-preview { opacity: 0.35; filter: blur(1.5px); }
.qr-preview-card { position: relative; }
.preview-badge { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #0f172a; color: #fff; padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.preview-badge.hidden { display: none; }
.preview-note { font-size: 0.85rem; color: var(--text-sub); text-align: center; }
.preview-note.hidden { display: none; }
.breadcrumbs { width: 100%; max-width: 1000px; font-size: 0.85rem; color: var(--text-sub); margin-bottom: 0.75rem; }
.breadcrumbs a { color: var(--text-sub); }
.info-article { margin-bottom: 2.5rem; }
.info-article h2 { margin-bottom: 1rem; }
.info-article p { margin-bottom: 0.9rem; }
.uc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.uc-card { display: flex; flex-direction: column; gap: 0.35rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s; }
.uc-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.uc-label { font-weight: 600; color: var(--primary); }
.uc-lead { font-size: 0.88rem; color: var(--text-sub); line-height: 1.45; }
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.why-item { background: #fff; border-radius: 14px; padding: 1.1rem; border: 1px solid #e2e8f0; }
.why-item h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.step-list { padding-left: 1.4rem; display: grid; gap: 0.7rem; }
.check-list { padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.seo-col h3 { font-size: 1.02rem; margin: 1rem 0 0.25rem; }
.example-box { background: #fff; border-left: 4px solid var(--primary); border-radius: 12px; padding: 1.4rem 1.6rem; }
.engage-box { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: #e2e8f0; border-radius: 20px; padding: 2rem; margin-bottom: 2.5rem; }
.engage-box h2 { color: #fff; margin-bottom: 0.75rem; }
.engage-box p { margin-bottom: 1.25rem; }
.engage-box .action-btn { width: auto; display: inline-flex; padding: 0.8rem 1.6rem; text-decoration: none; }
.faq-item h3 { font-size: 1.02rem; margin-bottom: 0.4rem; }
.more-links { margin-top: 1rem; font-size: 0.9rem; line-height: 1.9; }
.page-panel .hero-section { margin-bottom: 1.5rem; }
.prose h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.prose p { margin-bottom: 0.8rem; }
.prose code { background: #f1f5f9; padding: 0.1rem 0.35rem; border-radius: 6px; word-break: break-all; }
.report-form label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
.manage-grid { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; margin-bottom: 2rem; }
.manage-qr { display: flex; flex-direction: column; gap: 0.75rem; }
.manage-form label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
.manage-actions { display: flex; gap: 1.5rem; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0 1.5rem; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem; display: flex; flex-direction: column; color: var(--text-sub); font-size: 0.85rem; }
.stat-num { font-size: 1.6rem; font-weight: 700; color: var(--text-main); }
.scan-chart { width: 100%; height: auto; background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; }
.scan-chart rect { fill: var(--primary); }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-sub); margin-top: 0.25rem; }
.stat-list { list-style: none; padding: 0; }
.stat-list li { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid #e2e8f0; }
.stat-list small { color: var(--text-sub); margin-left: 0.35rem; }
.table-wrap { overflow-x: auto; }
.codes-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.codes-table th, .codes-table td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid #e2e8f0; vertical-align: top; font-size: 0.9rem; }
.codes-table th { background: #f8fafc; font-weight: 600; }
.dest-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; text-transform: capitalize; }
.status-active { background: #dcfce7; color: #166534; }
.status-paused { background: #fef9c3; color: #854d0e; }
.status-blocked { background: #fee2e2; color: #991b1b; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem; margin-bottom: 0.75rem; }
.footer-links a { color: var(--text-sub); text-decoration: none; font-size: 0.9rem; }
@media (max-width: 768px) {
  .why-grid, .manage-grid, .options-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .nav-links { gap: 0.9rem; font-size: 0.9rem; }
  .brand-text span { font-size: 1rem; }
}

/* ---- design controls ---- */
.chip-group { border: 0; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-group legend { font-weight: 500; margin-bottom: 0.4rem; font-size: 0.95rem; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.8rem; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; cursor: pointer; font-size: 0.88rem; color: var(--text-main); }
.chip svg:not([fill="none"]) { fill: currentColor; }
.chip input:checked + span { border-color: var(--primary); background: #eff6ff; color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.frame-options { margin-top: 0.9rem; }
.frame-options label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
#qr-canvas { aspect-ratio: auto; }
.design-details { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 0.9rem 1.1rem; margin-bottom: 2rem; }
.design-details summary { cursor: pointer; font-weight: 600; }
.design-details .customization-section { background: none; box-shadow: none; padding: 0.5rem 0 0; border: 0; }
.small { font-size: 0.82rem; }

/* ---- analytics ---- */
:root { --series-1: #2a78d6; --series-2: #eb6834; --grid: #e5e7eb; --ink-2: #52514e; }
.an-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.5rem; }
.an-tools { display: flex; align-items: center; gap: 1rem; }
.an-tools .text-btn { margin: 0; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 0.4rem 0.75rem; border-radius: 8px; font: inherit; font-size: 0.85rem; color: var(--text-sub); cursor: pointer; }
.seg button.active { background: #fff; color: var(--text-main); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.stat-cards-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card { gap: 0.15rem; }
.stat-sm { font-size: 1.05rem; padding: 0.35rem 0; }
.delta { font-size: 0.8rem; font-weight: 600; }
.delta.up { color: #15803d; } .delta.down { color: #b91c1c; } .delta.flat { color: var(--text-sub); }
.an-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.an-card h3, .bd-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.legend { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 0.25rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; }
.sw-scans { background: var(--series-1); }
.sw-uniques { background: var(--series-2); border-radius: 50%; }
.trend { width: 100%; height: auto; display: block; }
.trend .grid { stroke: var(--grid); stroke-width: 1; }
.trend .axis { fill: var(--ink-2); font-size: 11px; font-family: var(--font-family); }
.trend .bar { fill: var(--series-1); }
.trend .uline { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; }
.trend .udot { fill: var(--series-2); stroke: #fff; stroke-width: 2; }
.trend .xhair { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.trend .hit { fill: transparent; cursor: crosshair; }
.heatmap { display: grid; gap: 3px; overflow-x: auto; }
.hm-row { display: grid; grid-template-columns: 34px repeat(24, minmax(10px, 1fr)); gap: 3px; align-items: center; }
.hm-day { font-size: 0.75rem; color: var(--ink-2); }
.hm-cell { height: 18px; border-radius: 3px; cursor: default; }
.hm-cell:hover { outline: 2px solid #0f172a; outline-offset: -1px; }
.hm-hours span { font-size: 0.7rem; color: var(--ink-2); }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 0.6rem; font-size: 0.78rem; flex-wrap: wrap; }
.hm-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.hm-tz { margin-left: auto; }
.bd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.bd-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem 1.1rem; }
.bd-list { list-style: none; padding: 0; display: grid; gap: 0.45rem; }
.bd-list li { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 0.6rem; align-items: center; font-size: 0.86rem; cursor: default; }
.bd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-bar { height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.bd-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.bd-val { text-align: right; white-space: nowrap; }
.bd-val small { color: var(--text-sub); margin-left: 0.2rem; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: #0f172a; color: #f8fafc; font-size: 0.8rem; line-height: 1.5; padding: 0.45rem 0.65rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.viz-tip .sw { border: 1px solid rgba(255,255,255,.6); }
@media (max-width: 900px) { .bd-grid { grid-template-columns: 1fr 1fr; } .stat-cards-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .bd-grid { grid-template-columns: 1fr; } }

/* ---- account ---- */
.nav-links { align-items: center; }
.nav-account { display: inline-flex; align-items: center; gap: 0.75rem; }
.nav-login { background: var(--primary); color: #fff !important; padding: 0.4rem 0.9rem; border-radius: 999px; }
.nav-user { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-main); }
.nav-user img, .nav-user .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.nav-user .avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 600; font-size: 0.8rem; }
.nav-logout { background: none; border: 0; color: var(--text-sub); cursor: pointer; font: inherit; font-size: 0.85rem; padding: 0; }
.nav-logout:hover { color: var(--primary); }
.auth-box { max-width: 420px; margin: 0 auto; }
.auth-box label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; border: 1px solid #cbd5e1; background: #fff; border-radius: 12px; padding: 0.85rem; margin-top: 1.25rem; text-decoration: none; color: var(--text-main); font-weight: 600; }
.google-btn:hover { border-color: var(--primary); }
.or { display: flex; align-items: center; gap: 0.75rem; color: var(--text-sub); font-size: 0.85rem; margin: 1.25rem 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.account-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.92rem; }
.account-banner .action-btn { width: auto; padding: 0.55rem 1rem; text-decoration: none; }
@media (max-width: 600px) { .nav-user .nav-email { display: none; } }

/* ---- blog ---- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.post-card { display: flex; flex-direction: column; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; transition: transform .2s, border-color .2s; }
.post-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.post-card img, .post-card-ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: linear-gradient(135deg, #dbeafe, #e0e7ff); }
.post-card-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem 1rem; }
.post-card-title { font-weight: 600; line-height: 1.35; }
.post-card-desc { font-size: 0.86rem; color: var(--text-sub); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-date { font-size: 0.78rem; color: var(--text-sub); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; }
.post { max-width: 820px; }
.post-head h1 { font-size: 2.1rem; line-height: 1.2; margin-bottom: 0.5rem; }
.post-meta { color: var(--text-sub); font-size: 0.9rem; margin-bottom: 1.5rem; }
.post-cover { width: 100%; height: auto; border-radius: 14px; margin-bottom: 1.75rem; }
.post-content { font-size: 1.05rem; line-height: 1.75; color: #1e293b; }
.post-content h2 { font-size: 1.45rem; margin: 2rem 0 0.75rem; line-height: 1.3; }
.post-content h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.post-content h4 { font-size: 1.02rem; margin: 1.25rem 0 0.4rem; }
.post-content p { margin-bottom: 1rem; }
.post-content ul, .post-content ol { margin: 0 0 1rem 1.4rem; display: grid; gap: 0.4rem; }
.post-content a { color: var(--primary); }
.post-content img { max-width: 100%; height: auto; border-radius: 12px; margin: 0.5rem 0 1.25rem; border: 1px solid #e2e8f0; }
.post-content blockquote { border-left: 4px solid var(--primary); background: #eff6ff; padding: 0.9rem 1.2rem; border-radius: 0 12px 12px 0; margin: 1.25rem 0; }
.post-content table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.25rem; font-size: 0.95rem; display: block; overflow-x: auto; }
.post-content th, .post-content td { border: 1px solid #e2e8f0; padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; }
.post-content th { background: #f8fafc; }
.post-cta { margin-top: 2.5rem; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: #e2e8f0; border-radius: 18px; padding: 1.75rem; }
.post-cta h2 { color: #fff; font-size: 1.3rem; margin-bottom: 0.5rem; }
.post-cta p { margin-bottom: 1.1rem; }
.post-cta .action-btn { width: auto; display: inline-flex; padding: 0.8rem 1.5rem; text-decoration: none; }
@media (max-width: 600px) { .post-head h1 { font-size: 1.6rem; } }

/* Layout fix: let the controls column shrink so the preview card stays inside the panel;
   type tabs wrap instead of forcing the column wider. */
.controls-section { min-width: 0; }
.tabs-container { flex-wrap: wrap; overflow-x: visible; }
.tab-btn { padding: 0.6rem 0.95rem; }
