:root {
    --ink: #1a1a1a; --paper: #faf7f2; --paper-2: #f3ede2;
    --accent: #b8390f; --accent-soft: #f4d9cd; --accent-yellow: #f4c430;
    --green: #1e4a2e; --green-soft: #d9e7df; --blue: #1e3a6f; --blue-soft: #d5dfec;
    --muted: #5a5750; --line: #d9d3c7;
    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Inter Tight', system-ui, sans-serif;
    --focus: #0066cc;
  }

  /* v20.2: Explicit placeholder contrast for WCAG AA compliance */
  ::placeholder { color: #6b6860; opacity: 1; }
  html.dark-mode ::placeholder { color: #8a8680; opacity: 1; }

  /* DARK MODE */
  html.dark-mode {
    --ink: #f0ede5; --paper: #1a1a1a; --paper-2: #252220;
    --accent: #ffaa7a; --accent-soft: #4a2418; --accent-yellow: #ffe066;
    --green: #6dba80; --green-soft: #1f3a2a; --blue: #7fa3d9; --blue-soft: #1d2d4a;
    --muted: #b5b0a6; --line: #3a3631;
    --focus: #66b3ff;
  }
  html.dark-mode body { background: var(--paper); color: var(--ink); }
  html.dark-mode header { background: rgba(26,26,26,0.92); border-bottom-color: var(--line); }
  html.dark-mode .cat-card, html.dark-mode .why-item, html.dark-mode .trust-claim,
  html.dark-mode .faq-item, html.dark-mode .faq-question,
  html.dark-mode .template-card, html.dark-mode .doc-paper-preview,
  html.dark-mode .editor-form, html.dark-mode .modal, html.dark-mode .quiz-option,
  html.dark-mode .upload-box, html.dark-mode .upload-preview img {
    background: var(--paper-2); color: var(--ink);
  }
  html.dark-mode .field input, html.dark-mode .field select, html.dark-mode .field textarea {
    background: var(--paper); color: var(--ink); border-color: var(--muted);
  }
  html.dark-mode .clear-data-btn { color: var(--muted); border-color: var(--muted); }
  html.dark-mode .editor-preview { background: var(--paper); }
  /* In dark mode, keep document preview ALWAYS light (so PDFs print correctly) */
  html.dark-mode .doc-paper-preview {
    background: white !important;
    color: #1a1a1a !important;
  }
  html.dark-mode .doc-paper-preview * { color: inherit; }
  /* Force ALL backgrounds inside the preview to use LIGHT colors regardless of dark mode */
  html.dark-mode .doc-paper-preview {
    --ink: #1a1a1a;
    --paper: #ffffff;
    --paper-2: #f3ede2;
    --accent: #b8390f;
    --accent-soft: #f4d9cd;
    --accent-yellow: #f4c430;
    --green: #1e4a2e;
    --green-soft: #d9e7df;
    --blue: #1e3a6f;
    --blue-soft: #d5dfec;
    --muted: #5a5750;
    --line: #d9d3c7;
  }
  /* Make sure skill chips and card backgrounds stay visible */
  html.dark-mode .doc-paper-preview .doc-skills span,
  html.dark-mode .doc-paper-preview.tpl-bold .doc-job,
  html.dark-mode .doc-paper-preview .skill-chip {
    background: #f3ede2 !important;
    color: #1a1a1a !important;
  }
  html.dark-mode body::before { background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px); }

  /* Feedback button in dark mode — needs visible border and text */
  html.dark-mode .btn-feedback {
    border-color: var(--ink);
    color: var(--ink);
    background: transparent;
  }

  /* Hero badge stays readable in dark mode */
  html.dark-mode .hero-badge {
    background: linear-gradient(135deg, #ffe066 0%, #ffd700 100%);
    color: #1a1a1a;
    border-color: #1a1a1a;
    box-shadow: 4px 4px 0 #1a1a1a;
  }
  html.dark-mode .hero-badge .badge-icon {
    background: #1a1a1a;
    color: #ffe066;
  }
  html.dark-mode .hero-badge .badge-separator { background: #1a1a1a; }
  html.dark-mode .btn-feedback:hover {
    background: var(--ink);
    color: var(--paper);
  }
  /* Dark mode toggle button */
  html.dark-mode .dark-toggle {
    border-color: var(--ink);
    color: var(--ink);
  }
  html.dark-mode .dark-toggle:hover {
    background: var(--ink);
    color: var(--paper);
  }
  /* Nav buttons in dark mode */
  html.dark-mode .nav-btn { color: var(--ink); }
  html.dark-mode .nav-btn:hover { color: #ff8a5b; }

  /* Dark mode toggle button */
  .dark-toggle {
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
  }
  .dark-toggle:hover { background: var(--ink); color: var(--paper); }

  /* WCAG: visible focus indicators on all interactive elements */
  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
  [tabindex]:focus-visible, [role="button"]:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* WCAG: Skip to main content link */
  .skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--ink);
    color: var(--paper);
    padding: 12px 20px;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 6px 0;
    transition: top 0.2s ease;
  }
  .skip-link:focus {
    top: 0;
    outline: 3px solid var(--accent-yellow);
    outline-offset: -3px;
  }

  /* WCAG: Screen reader only - visually hidden but readable */
  .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;
  }

  /* Field tips for form fields */
  .field-tip {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    font-style: italic;
    line-height: 1.4;
    display: flex;
    gap: 4px;
    align-items: flex-start;
  }
  .field-tip::before {
    content: '💡';
    font-style: normal;
    flex-shrink: 0;
  }

  /* Photo position toggle */
  .position-toggle {
    display: flex;
    gap: 4px;
    margin-top: 10px;
  }
  .position-toggle button {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--muted);
    background: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    font-family: inherit;
    color: var(--ink);
  }
  .position-toggle button.active {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
  }

  /* Resume with Photo template */
  .doc-paper-preview.tpl-photo { padding: 0; min-height: 930px; }
  .doc-paper-preview.tpl-photo .photo-header {
    display: flex; align-items: center; gap: 24px;
    padding: 48px 56px;
    background: linear-gradient(to right, var(--paper-2) 0%, white 60%);
    border-bottom: 1px solid var(--line);
  }
  .doc-paper-preview.tpl-photo .photo-header.pos-left { flex-direction: row; }
  .doc-paper-preview.tpl-photo .photo-header.pos-center { flex-direction: column; text-align: center; }
  .doc-paper-preview.tpl-photo .photo-header.pos-right { flex-direction: row-reverse; }
  .doc-paper-preview.tpl-photo .photo-frame {
    width: 140px; height: 140px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    border: 4px solid white;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-yellow));
    display: flex; align-items: center; justify-content: center;
  }
  .doc-paper-preview.tpl-photo .photo-frame img {
    width: 100%; height: 100%; object-fit: cover;
  }
  .doc-paper-preview.tpl-photo .photo-frame .placeholder-icon {
    font-size: 64px;
    color: rgba(0,0,0,0.4);
  }
  .doc-paper-preview.tpl-photo .photo-info { flex: 1; }
  .doc-paper-preview.tpl-photo .doc-name {
    font-family: var(--serif); font-size: 36px; font-weight: 600;
    letter-spacing: -0.02em; margin-bottom: 4px;
  }
  .doc-paper-preview.tpl-photo .doc-role {
    color: var(--accent); font-size: 16px; font-weight: 600; margin-bottom: 10px;
  }
  .doc-paper-preview.tpl-photo .doc-contact {
    font-size: 12px; color: var(--muted); line-height: 1.6;
  }
  .doc-paper-preview.tpl-photo .photo-body { padding: 32px 56px 48px; }
  .doc-paper-preview.tpl-photo .doc-section h2 {
    font-family: var(--sans); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.15em;
    margin-bottom: 12px; color: var(--accent);
  }

  /* Mini preview for photo template card */
  .mini.r-photo { padding: 12px; }
  .mini.r-photo .top { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
  .mini.r-photo .photo-circle {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-yellow));
    flex-shrink: 0;
    border: 2px solid var(--ink);
  }
  .mini.r-photo h5 { font-size: 12px; }
  .mini.r-photo .role { font-size: 7px; }

  /* New template badge */
  .template-tag.new {
    background: var(--accent-yellow);
    color: var(--ink);
    font-weight: 700;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; /* v22.1.1: kill 5px residual mobile overflow */ }
  a { color: inherit; }
  body::before {
    content: ''; position: fixed; inset: 0;
    background-image: radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px);
    background-size: 3px 3px; pointer-events: none; z-index: 1;
  }
  header { position: sticky; top: 0; z-index: 100; background: rgba(250,247,242,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .nav { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; }
  .logo { font-family: var(--serif); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; cursor: pointer; display: flex; align-items: center; gap: 10px; }
  .logo-mark { width: 28px; height: 32px; background: var(--ink); position: relative; clip-path: polygon(0 0, 75% 0, 100% 25%, 100% 100%, 0 100%); }
  .logo-mark::after { content: ''; position: absolute; top: 0; right: 0; width: 25%; height: 25%; background: var(--accent); }
  .logo em { font-style: italic; font-weight: 400; color: var(--muted); }
  .nav-links { display: flex; gap: 24px; align-items: center; font-size: 14px; font-weight: 500; }
  .nav-links a { text-decoration: none; color: var(--ink); cursor: pointer; }
  .nav-links a:hover { color: var(--accent); }
  .nav-btn { background: none; border: none; color: var(--ink); cursor: pointer; font-family: var(--sans); font-weight: 500; font-size: 14px; padding: 4px 0; text-decoration: none; display: inline-block; }
  .nav-btn:hover { color: var(--accent); }
  .nav-btn:hover { color: var(--accent); }
  .btn-feedback { padding: 10px 18px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; font-family: var(--sans); font-weight: 600; font-size: 13px; cursor: pointer; }
  .btn-feedback:hover { background: var(--ink); color: var(--paper); }
  main { position: relative; z-index: 2; }
  .hero { max-width: 1280px; margin: 0 auto; padding: 60px 32px 60px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 60px; align-items: center; }

  .hero-badge {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 12px 22px;
    background: linear-gradient(135deg, var(--accent-yellow) 0%, #ffd966 100%);
    border: 2px solid var(--ink);
    border-radius: 999px;
    font-size: 14px; font-weight: 800; color: var(--ink);
    margin-bottom: 28px;
    text-transform: uppercase; letter-spacing: 0.12em;
    box-shadow: 4px 4px 0 var(--ink);
    transform: rotate(-1.5deg);
    transition: transform 0.2s;
    animation: wiggle 3s ease-in-out infinite;
  }
  .hero-badge:hover { animation: none; transform: rotate(0deg) scale(1.05); }
  .hero-badge .badge-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--accent-yellow); font-size: 14px; font-weight: 900; }
  .hero-badge .badge-separator { width: 4px; height: 4px; background: var(--ink); border-radius: 50%; }
  @keyframes wiggle { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

  .hero h1, .hero .hero-title { font-family: var(--serif); font-weight: 500; font-size: clamp(44px,6vw,76px); line-height: 1.02; letter-spacing: -0.03em; margin-bottom: 24px; }
  .hero h1 em, .hero .hero-title em { font-style: italic; color: var(--accent); font-weight: 400; }
  .hero p { font-size: 19px; line-height: 1.55; color: var(--muted); max-width: 520px; margin-bottom: 36px; }
  .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
  .btn-primary { padding: 16px 28px; background: var(--ink); color: var(--paper); border: none; border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: transform 0.15s; }
  .btn-primary:hover { transform: translateY(-2px); }
  .btn-secondary { padding: 16px 28px; background: transparent; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: 15px; cursor: pointer; }
  .btn-secondary:hover { background: var(--ink); color: var(--paper); }
  /* How-it-works 3-step visual */
  .how-it-works { display: flex; align-items: center; gap: 12px; margin-top: 36px; padding: 20px 24px; background: var(--paper-2); border-radius: 16px; border: 1px solid var(--line); max-width: 560px; flex-wrap: wrap; }
  .how-step { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 140px; }
  .how-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-yellow); color: #1a1a1a; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .how-step-icon { font-size: 22px; line-height: 1; }
  .how-step-text { font-size: 14px; line-height: 1.3; color: #1a1a1a; }
  .how-step-text strong { font-weight: 700; color: #1a1a1a; display: block; }
  .how-step-text span { color: #5a5750; font-size: 13px; }
  .how-step-arrow { color: #1a1a1a; font-size: 20px; font-weight: 600; flex-shrink: 0; }
  /* Dark mode: keep card LIGHT for high contrast against dark page (card design pattern) */
  html.dark-mode .how-it-works { background: #faf7f2; border-color: #d9d3c7; }
  html.dark-mode .how-step-num { background: #1a1a1a; color: #ffe066; }
  html.dark-mode .how-step-text { color: #1a1a1a; }
  html.dark-mode .how-step-text strong { color: #1a1a1a; }
  html.dark-mode .how-step-text span { color: #5a5750; }
  html.dark-mode .how-step-arrow { color: #1a1a1a; }
  /* v17: Trust badges - subtle, no-fluff trust signals */
  .trust-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; max-width: 560px; }
  .trust-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--ink); background: transparent; border: 1px solid var(--line); letter-spacing: 0.01em; }
  html.dark-mode .trust-badge { color: #f0ede5; border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.03); }
  @media (max-width: 480px) {
    .trust-badges { gap: 6px; }
    .trust-badge { font-size: 11px; padding: 5px 10px; }
  }
  .hero-art { position: relative; height: 480px; display: flex; align-items: center; justify-content: center; }
  .paper-stack { position: relative; width: 320px; height: 420px; }
  .doc-paper { position: absolute; width: 280px; height: 360px; background: white; border: 1px solid var(--line); box-shadow: 0 20px 40px -20px rgba(0,0,0,0.15); padding: 28px 24px; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
  .doc-paper:nth-child(1) { transform: rotate(-6deg) translate(-20px,30px); background: var(--paper-2); }
  .doc-paper:nth-child(2) { transform: rotate(3deg) translate(20px,10px); }
  .doc-paper:nth-child(3) { transform: rotate(-2deg); background: white; z-index: 2; }
  .doc-paper .line { height: 6px; background: var(--paper-2); margin-bottom: 10px; border-radius: 3px; }
  .doc-paper .line.short { width: 60%; }
  .doc-paper .line.title { height: 12px; background: var(--ink); width: 50%; margin-bottom: 18px; }
  .doc-paper .line.accent { background: var(--accent); width: 30%; height: 4px; }

  .quiz-promo { max-width: 1280px; margin: 0 auto 60px; padding: 0 32px; }
  .quiz-card { background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%); color: #faf7f2; padding: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; position: relative; overflow: hidden; }
  .quiz-card::before { content: '✨'; position: absolute; top: -20px; right: 40px; font-size: 120px; opacity: 0.1; transform: rotate(15deg); pointer-events: none; }
  .quiz-card-text h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin-bottom: 8px; color: #faf7f2; }
  .quiz-card-text h2 em { color: #ffe066; font-style: italic; }
  .quiz-card-text p { opacity: 0.92; font-size: 15px; max-width: 460px; color: #faf7f2; }
  .quiz-card-btn { padding: 16px 28px; background: #ffe066; color: #1a1a1a; border: none; border-radius: 999px; font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: transform 0.15s; }
  .quiz-card-btn:hover { transform: translateY(-2px); }
  /* v18: Quiz card uses HARDCODED dark colors (not CSS vars) so dark mode doesn't flip them and break contrast */
  html.dark-mode .quiz-card { background: linear-gradient(135deg, #2a2926 0%, #3a3835 100%); color: #faf7f2; }
  html.dark-mode .quiz-card-text h2 { color: #faf7f2; }
  html.dark-mode .quiz-card-text h2 em { color: #ffe066; }
  html.dark-mode .quiz-card-text p { color: #faf7f2; }
  html.dark-mode .quiz-card-btn { color: #1a1a1a; background: #ffe066; }

  .section-head { max-width: 1280px; margin: 0 auto; padding: 60px 32px 32px; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
  .section-head h2 { font-family: var(--serif); font-weight: 500; font-size: 44px; letter-spacing: -0.02em; line-height: 1.05; }
  .section-head h2 em { font-style: italic; }
  .section-head p { color: var(--muted); max-width: 320px; font-size: 15px; }
  .categories { max-width: 1280px; margin: 0 auto; padding: 0 32px 80px; display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
  .cat-card { background: white; border: 1px solid var(--line); padding: 28px; cursor: pointer; transition: all .25s; display: flex; flex-direction: column; min-height: 220px; font-family: inherit; text-align: left; width: 100%; color: var(--ink); }
  .cat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px -16px rgba(0,0,0,0.15); border-color: var(--ink); }
  .cat-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
  .cat-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 20px; }
  .cat-card[data-cat="budget"] .cat-icon { background: var(--green-soft); color: var(--green); }
  .cat-card[data-cat="invoice"] .cat-icon { background: var(--blue-soft); color: var(--blue); }
  .cat-card[data-cat="letter"] .cat-icon { background: #ede1d0; color: #8a5a1a; }
  .cat-card h3 { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin-bottom: 8px; }
  .cat-card p { color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
  .cat-arrow { margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--ink); }
  .cat-card:hover .cat-arrow { color: var(--accent); }

  .why { max-width: 1280px; margin: 0 auto; padding: 60px 32px; }
  .why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 32px; }
  .why-item { padding: 32px; background: white; border: 1px solid var(--line); border-radius: 16px; }
  .why-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 20px; }
  .why-item:nth-child(1) .why-icon { background: var(--accent-soft); }
  .why-item:nth-child(2) .why-icon { background: var(--green-soft); }
  .why-item:nth-child(3) .why-icon { background: var(--blue-soft); }
  .why-item h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 10px; }
  .why-item p { color: var(--muted); font-size: 14px; line-height: 1.6; }

  /* v21: Trust section — verifiable claims replace fabricated testimonials */
  .trust-section { background: var(--paper-2); padding: 80px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .trust-section-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
  .trust-section h2 { font-family: var(--serif); font-weight: 500; font-size: 44px; letter-spacing: -0.02em; margin-bottom: 16px; max-width: 600px; }
  .trust-section h2 em { font-style: italic; }
  .trust-section-lead { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 720px; margin-bottom: 40px; }
  .trust-claims-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
  .trust-claim { background: white; padding: 28px; border-radius: 16px; border: 1px solid var(--line); transition: border-color 0.2s, transform 0.2s; }
  .trust-claim:hover { border-color: var(--ink); transform: translateY(-2px); }
  html.dark-mode .trust-claim { background: var(--paper-2); }
  .trust-claim-icon { font-size: 28px; margin-bottom: 12px; line-height: 1; }
  .trust-claim h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 10px; line-height: 1.25; }
  .trust-claim p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
  .founder-note { background: white; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 24px 28px; max-width: 880px; }
  html.dark-mode .founder-note { background: var(--paper-2); }
  .founder-note p { font-size: 15px; line-height: 1.7; color: var(--ink); margin: 0; }
  .founder-note strong { color: var(--accent); font-weight: 700; }

  .how { padding: 80px 0; }
  .how-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
  .how h2 { font-family: var(--serif); font-weight: 500; font-size: 44px; letter-spacing: -0.02em; margin-bottom: 48px; max-width: 600px; }
  .how h2 em { font-style: italic; }
  .steps { display: grid; grid-template-columns: repeat(4,1fr); gap: 32px; }
  .step-num { font-family: var(--serif); font-style: italic; font-size: 52px; color: var(--accent); line-height: 1; margin-bottom: 16px; }
  .step h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
  .step p { color: var(--muted); font-size: 14px; line-height: 1.55; }

  .faq { background: var(--paper-2); padding: 80px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .faq-inner { max-width: 800px; margin: 0 auto; padding: 0 32px; }
  .faq h2 { font-family: var(--serif); font-weight: 500; font-size: 44px; letter-spacing: -0.02em; margin-bottom: 48px; text-align: center; }
  .faq h2 em { font-style: italic; }
  .faq-item { background: white; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
  .faq-question { padding: 20px 24px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 15px; user-select: none; width: 100%; text-align: left; background: white; border: none; font-family: inherit; color: var(--ink); }
  .faq-question:hover { background: var(--paper); }
  .faq-question:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; background: var(--paper); }
  .faq-toggle { font-size: 24px; font-weight: 300; transition: transform 0.2s; color: var(--accent); }
  .faq-item.open .faq-toggle { transform: rotate(45deg); }
  .faq-answer { padding: 0 24px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; color: var(--muted); font-size: 14px; line-height: 1.6; }
  .faq-item.open .faq-answer { padding: 0 24px 20px; max-height: 400px; }

  /* NEW COMPREHENSIVE FOOTER */
  /* FOOTER - uses fixed colors regardless of light/dark mode for consistency */
  .site-footer { background: #1a1a1a; color: #faf7f2; padding: 60px 32px 30px; }
  .footer-inner { max-width: 1280px; margin: 0 auto; }
  .footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 30px; }
  .footer-brand h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 12px; color: #faf7f2; }
  .footer-brand h3 em { font-style: italic; color: #ffd54a; }
  .footer-brand p { font-size: 14px; color: rgba(250, 247, 242, 0.85); line-height: 1.6; max-width: 360px; }
  .footer-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px; color: #ffd54a; font-weight: 700; }
  .footer-col ul { list-style: none; }
  .footer-col li { margin-bottom: 10px; }
  .footer-col a, .footer-col button { color: #faf7f2; opacity: 0.9; text-decoration: none; font-size: 14px; cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; text-align: left; }
  .footer-col a:hover, .footer-col button:hover { opacity: 1; color: #ffd54a; }
  .footer-col span { color: rgba(250, 247, 242, 0.85); font-size: 13px; }
  .footer-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: rgba(250, 247, 242, 0.85); flex-wrap: wrap; gap: 12px; }
  .footer-bottom .badge-mini { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(255,213,74,0.2); color: #ffd54a; border-radius: 999px; font-size: 11px; font-weight: 600; }

  .page { display: none; }
  .page.active { display: block; }
  .breadcrumb { max-width: 1280px; margin: 0 auto; padding: 32px 32px 0; font-size: 13px; color: var(--muted); }
  .breadcrumb a { color: var(--accent); cursor: pointer; text-decoration: none; }
  .breadcrumb a:hover { text-decoration: underline; }
  /* v22.1.1: cat-title is now H2 — preserve original H1 visual styling */
  .templates-head-heading { font-family: var(--serif); font-weight: 500; font-size: 44px; letter-spacing: -0.02em; margin: 0 0 12px; line-height: 1.1; }
  .templates-head-heading em { font-style: italic; }
  @media (max-width: 600px) { .templates-head-heading { font-size: 32px; } }

  /* Sticky Undo/Redo bar - always visible at top of editor */
  .editor-top-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1280px; margin: 0 auto; padding-right: 32px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 73px; z-index: 50; }
  html.dark-mode .editor-top-bar { background: var(--paper); border-bottom-color: var(--line); }
  .sticky-actions { display: flex; gap: 8px; padding: 8px 0; }
  .sticky-btn {
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  html.dark-mode .sticky-btn { background: var(--paper-2); border-color: var(--line); color: var(--ink); }
  .sticky-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .sticky-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .sticky-btn:disabled:hover { background: white; color: var(--ink); border-color: var(--line); }
  html.dark-mode .sticky-btn:disabled:hover { background: var(--paper-2); }

  /* Resume Score button - dynamic color based on score */
  .score-btn {
    padding: 8px 14px;
    background: white;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    transition: all 0.2s;
  }
  .score-btn .score-label { font-weight: 500; }
  .score-btn .score-value { font-size: 14px; font-weight: 800; }
  html.dark-mode .score-btn { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
  .score-btn:hover { transform: scale(1.05); }
  .score-btn.score-low { border-color: #b8390f; color: #b8390f; }
  html.dark-mode .score-btn.score-low { color: #ff8a5b; border-color: #ff8a5b; }
  .score-btn.score-mid { border-color: #c89400; color: #c89400; }
  html.dark-mode .score-btn.score-mid { color: #ffd700; border-color: #ffd700; }
  .score-btn.score-high { border-color: #1e4a2e; color: #1e4a2e; }
  html.dark-mode .score-btn.score-high { color: #6dba80; border-color: #6dba80; }
  .score-btn.score-perfect { background: linear-gradient(135deg, #ffe066 0%, #ffd700 100%); color: #1a1a1a; border-color: #1a1a1a; }
  html.dark-mode .score-btn.score-perfect { background: linear-gradient(135deg, #ffe066 0%, #ffd700 100%); color: #1a1a1a; border-color: #1a1a1a; }
  .templates-head { max-width: 1280px; margin: 0 auto; padding: 24px 32px 32px; }
  .templates-head h1 { font-family: var(--serif); font-weight: 500; font-size: 56px; letter-spacing: -0.02em; margin-bottom: 12px; }
  .templates-head h1 em { font-style: italic; color: var(--accent); }
  .templates-head p { color: var(--muted); font-size: 17px; max-width: 560px; }
  .template-grid { max-width: 1280px; margin: 0 auto; padding: 0 32px 80px; display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
  .template-card { background: white; border: 1px solid var(--line); cursor: pointer; transition: all .25s; overflow: hidden; border-radius: 8px; }
  .template-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px -16px rgba(0,0,0,0.15); }
  .template-preview { aspect-ratio: 8.5/11; background: var(--paper-2); padding: 24px; overflow: hidden; border-bottom: 1px solid var(--line); }
  .template-meta { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
  .template-meta h4 { font-family: var(--serif); font-size: 18px; font-weight: 600; }
  .template-tag { padding: 3px 10px; background: var(--paper-2); border-radius: 999px; font-size: 11px; font-weight: 500; color: var(--muted); }
  .template-tag.popular { background: #ffe066; color: #1a1a1a; font-weight: 700; }
  html.dark-mode .template-tag.popular { background: #ffe066; color: #1a1a1a; }

  /* v20: SHOWROOM — "See what you can build" featured templates */
  .showroom { padding: 24px 0 0; max-width: 1100px; margin: 0 auto; }
  .showroom-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
  /* v22.1: Mobile hamburger styles */
  .mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; padding: 8px; width: 44px; height: 44px; flex-direction: column; justify-content: center; gap: 4px; align-items: center; }
  .mobile-menu-btn:hover { opacity: 0.7; }
  .mobile-menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
  .hamburger-bar { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 1px; transition: transform 0.2s, opacity 0.2s; }
  .mobile-menu { position: fixed; inset: 0; z-index: 9000; background: rgba(0, 0, 0, 0.5); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; display: flex; align-items: flex-start; justify-content: flex-end; }
  .mobile-menu.active { opacity: 1; visibility: visible; }
  .mobile-menu-inner { background: var(--paper); width: min(320px, 85vw); height: 100%; padding: 16px; box-shadow: -8px 0 32px rgba(0,0,0,0.2); transform: translateX(20px); transition: transform 0.2s; display: flex; flex-direction: column; }
  .mobile-menu.active .mobile-menu-inner { transform: translateX(0); }
  .mobile-menu-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
  .mobile-menu-title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
  .mobile-menu-close { background: none; border: none; cursor: pointer; width: 36px; height: 36px; font-size: 18px; color: var(--ink); border-radius: 6px; }
  .mobile-menu-close:hover { background: var(--paper-2); }
  .mobile-menu-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .mobile-menu-nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
  .mobile-menu-link { display: block; padding: 12px 14px; font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--ink); background: none; border: none; text-align: left; text-decoration: none; border-radius: 8px; cursor: pointer; width: 100%; }
  .mobile-menu-link:hover { background: var(--paper-2); color: var(--accent); }
  .mobile-menu-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--paper-2); }
  .mobile-menu-action { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; border-radius: 0; }
  html.dark-mode .mobile-menu-inner { background: var(--paper-2); }
  html.dark-mode .hamburger-bar { background: var(--ink); }
  @media (max-width: 900px) and (min-width: 769px) { .showroom-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
  /* v20.2: Mobile scroll-snap carousel — prevents 6-card vertical scroll fatigue on phones */
  @media (max-width: 768px) {
    /* v26.1: clip the full-bleed carousel at the section edge so the -20px margin
       doesn't extend body.scrollWidth. The grid still scrolls horizontally inside. */
    .showroom { overflow-x: clip; }
    .showroom-grid {
      display: flex;
      grid-template-columns: none;
      overflow-x: auto;
      overflow-y: hidden;
      scroll-snap-type: x mandatory;
      gap: 14px;
      padding: 4px 20px 16px;
      margin: 0 -20px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .showroom-grid::-webkit-scrollbar { height: 6px; }
    .showroom-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
    .showroom-card { flex: 0 0 82%; max-width: 320px; scroll-snap-align: start; }
    .showroom-preview { aspect-ratio: 8.5/11; }
  }
  .showroom-card { background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; text-align: left; font-family: inherit; padding: 0; color: var(--ink); display: flex; flex-direction: column; width: 100%; }
  .showroom-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px -16px rgba(0,0,0,0.15); border-color: var(--ink); }
  .showroom-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  html.dark-mode .showroom-card { background: var(--paper-2); border-color: var(--line); }
  html.dark-mode .showroom-card:hover { border-color: var(--paper); }
  .showroom-preview { aspect-ratio: 8.5/11; background: white; padding: 18px; overflow: hidden; border-bottom: 1px solid var(--line); }
  html.dark-mode .showroom-preview { background: #faf7f2; }
  .showroom-meta { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
  .showroom-meta h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
  .showroom-meta p { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; flex: 1; }
  .showroom-meta .use-this { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 4px; }
  .showroom-card:hover .use-this { text-decoration: underline; }
  .showroom-cta-row { text-align: center; margin-top: 36px; }
  .showroom-cta-row .btn-secondary { display: inline-flex; }

  .mini { background: white; padding: 14px; height: 100%; font-size: 7px; line-height: 1.4; overflow: hidden; color: var(--ink); }
  .mini h5 { font-family: var(--serif); font-size: 14px; margin-bottom: 2px; letter-spacing: -0.02em; font-weight: 600; }
  .mini .role { color: var(--muted); font-size: 8px; margin-bottom: 8px; }
  .mini hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
  .mini .sec { font-weight: 700; font-size: 7px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; color: var(--ink); }
  .mini .line { height: 3px; background: var(--paper-2); margin-bottom: 3px; border-radius: 2px; }
  .mini .line.s { width: 70%; }
  .mini .line.xs { width: 40%; }
  .mini .line.accent { background: var(--accent); width: 30%; height: 3px; }
  .mini.r-classic .topline { height: 2px; background: var(--ink); width: 100%; margin: 6px 0 8px; }
  .mini.r-sidebar { padding: 0; display: grid; grid-template-columns: 70px 1fr; height: 100%; }
  .mini.r-sidebar .side { background: var(--ink); padding: 14px 10px; color: white; }
  .mini.r-sidebar .side h5 { color: white; font-size: 11px; }
  .mini.r-sidebar .side .role { color: rgba(255,255,255,0.92); font-size: 7px; }
  .mini.r-sidebar .side .sec { color: rgba(255,255,255,0.85); }
  .mini.r-sidebar .side .line { background: rgba(255,255,255,0.2); }
  .mini.r-sidebar .main { padding: 14px; }
  .mini.r-minimal h5 { font-family: var(--sans); font-weight: 800; font-size: 16px; text-align: center; }
  .mini.r-minimal .role { text-align: center; font-style: italic; }
  .mini.r-minimal .sec { text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 6px; }
  .mini.r-cards { background: var(--paper); }
  .mini.r-cards h5 { font-size: 13px; }
  .mini.r-cards .card { background: white; border: 1px solid var(--line); border-radius: 4px; padding: 6px; margin-bottom: 4px; border-left: 2px solid var(--accent); }
  .mini.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; background: linear-gradient(135deg, white 60%, var(--accent-soft)); }
  .mini.r-grid .full { grid-column: 1 / -1; }
  .mini.r-grid h5 { font-size: 13px; font-style: italic; color: var(--accent); }
  .mini.r-executive { font-family: var(--serif); padding: 16px 14px; }
  .mini.r-executive h5 { text-align: center; font-size: 14px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
  .mini.r-executive .role { text-align: center; font-style: italic; }
  .mini.r-executive .divider { width: 30px; height: 2px; background: var(--accent); margin: 6px auto; }
  .mini.r-compact { padding: 10px; }
  .mini.r-compact h5 { font-size: 12px; display: inline; }
  .mini.r-compact .role { display: inline; margin-left: 4px; }
  .mini.r-compact .compact-row { display: flex; justify-content: space-between; font-size: 7px; margin-bottom: 2px; }
  .mini.r-academic h5 { color: var(--blue); }
  .mini.r-academic .sec { color: var(--blue); border-left: 2px solid var(--blue); padding-left: 4px; }
  .mini.r-startup { background: linear-gradient(135deg, #fff 0%, var(--accent-soft) 100%); }
  .mini.r-startup h5 { color: var(--accent); font-size: 14px; font-weight: 800; }
  .mini.r-startup .sec { color: var(--accent); }
  .mini.inv h5 { font-size: 13px; }
  .mini.inv .inv-head { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: flex-start; }
  .mini.inv .inv-head .logo-box { width: 16px; height: 16px; background: var(--accent); border-radius: 3px; }
  .mini.inv .inv-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid var(--paper-2); font-size: 7px; }
  .mini.inv .inv-total { display: flex; justify-content: space-between; font-weight: 700; margin-top: 4px; padding-top: 3px; border-top: 2px solid var(--ink); font-size: 8px; }
  .mini.inv-modern { background: linear-gradient(180deg, var(--paper-2) 0%, white 30%); }
  .mini.inv-modern h5 { color: var(--accent); }
  .mini.inv-blue h5 { color: var(--blue); }
  .mini.inv-blue .inv-head { border-bottom: 3px solid var(--blue); padding-bottom: 4px; }
  .mini.inv-corp { padding: 0; }
  .mini.inv-corp .header-strip { background: var(--ink); color: white; padding: 8px 14px; }
  .mini.inv-corp .header-strip h5 { color: white; }
  .mini.inv-corp .body { padding: 10px 14px; }
  .mini.inv-minimal h5 { font-family: var(--sans); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
  .mini.bud .b-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid var(--paper-2); font-size: 7px; }
  .mini.bud-cards { padding: 10px; }
  .mini.bud-cards .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 6px; }
  .mini.bud-cards .grid div { background: var(--paper-2); padding: 4px; border-radius: 3px; font-size: 7px; }
  .mini.bud-cards .grid div strong { display: block; font-size: 9px; }
  .mini.bud-business { padding: 10px; }
  .mini.bud-business .pl { background: var(--green); color: white; padding: 4px 8px; border-radius: 3px; font-size: 8px; font-weight: 700; margin-top: 6px; }
  .mini.bud-monthly h5 { color: var(--green); }
  .mini.bud-summary .big-num { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--green); }
  .mini.let { padding: 14px; font-family: var(--serif); font-size: 7px; line-height: 1.5; }
  .mini.let .l-date { text-align: right; color: var(--muted); margin-bottom: 6px; font-size: 6px; }
  .mini.let p { font-size: 7px; line-height: 1.5; margin-bottom: 4px; }
  .mini.let-modern { padding: 0; }
  .mini.let-modern .let-header { background: var(--ink); color: white; padding: 10px 14px; font-family: var(--sans); }
  .mini.let-modern .let-header h5 { color: white; font-family: var(--sans); }
  .mini.let-modern .let-body { padding: 10px 14px; }
  .mini.let-creative .let-header { background: var(--accent-yellow); padding: 8px 14px; border-bottom: 3px solid var(--ink); }
  .mini.let-creative .let-header h5 { font-style: italic; }
  .mini.let-creative .let-body { padding: 8px 14px; }
  .mini.let-minimal { font-family: var(--sans); }
  .mini.let-executive { text-align: center; }
  .mini.let-executive .let-monogram { font-family: var(--serif); font-size: 14px; font-weight: 700; border: 2px solid var(--ink); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; }

  .editor-layout { display: grid; grid-template-columns: 380px 1fr; min-height: calc(100vh - 73px); }
  .editor-form { background: white; border-right: 1px solid var(--line); padding: 32px 28px; overflow-y: auto; max-height: calc(100vh - 73px); scroll-behavior: smooth; }
  .editor-form h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin-bottom: 6px; letter-spacing: -0.01em; }
  .editor-form > p.subtitle { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
  .save-indicator { font-size: 11px; color: var(--green); margin-bottom: 20px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
  .save-indicator::before { content: '●'; font-size: 8px; }
  .form-section { margin-bottom: 28px; }
  .form-section h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .field { margin-bottom: 14px; }
  .field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
  .field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 6px; font-family: var(--sans); font-size: 13px; background: white; color: var(--ink); scroll-margin-top: 100px; scroll-margin-bottom: 100px; }
  .field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
  .field textarea { resize: vertical; min-height: 70px; transition: height 0.1s ease; }

  /* Clear data button */
  .clear-data-btn {
    background: transparent;
    border: 1px solid var(--muted);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 16px;
  }
  .clear-data-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* AI Rewrite button */
  .ai-rewrite-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--accent-yellow) 0%, #ffd966 100%);
    color: #1a1a1a;
    border: 1.5px solid #1a1a1a;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s;
  }
  .ai-rewrite-btn:hover {
    transform: translateY(-1px);
  }
  .ai-rewrite-btn:active {
    transform: translateY(0);
  }
  html.dark-mode .ai-rewrite-btn {
    color: #1a1a1a;
    border-color: #1a1a1a;
    background: linear-gradient(135deg, #ffe066 0%, #ffd700 100%);
  }
  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .phone-group { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
  .date-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
  .date-row .field { margin-bottom: 0; }
  .date-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 6px; cursor: pointer; }
  .date-checkbox input { width: auto; }
  .add-row-btn { width: 100%; padding: 10px; background: var(--paper-2); border: 1px dashed var(--line); border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
  .add-row-btn:hover { color: var(--ink); border-color: var(--ink); }
  .remove-btn { background: transparent; border: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 4px 0; font-weight: 500; }
  .remove-btn:hover { color: var(--accent); }

  /* NEW: Logo upload box */
  .upload-box { width: 100%; padding: 16px; border: 2px dashed var(--line); border-radius: 8px; text-align: center; cursor: pointer; background: var(--paper); transition: all 0.2s; display: block; }
  .upload-box:hover, .upload-box.dragover { border-color: var(--accent); background: var(--accent-soft); }
  .upload-box input[type=file] { display: none; }
  .upload-box .upload-icon { font-size: 24px; margin-bottom: 6px; }
  .upload-box .upload-text { font-size: 12px; font-weight: 600; color: var(--ink); }
  .upload-box .upload-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
  .upload-preview { position: relative; margin-top: 10px; }
  .upload-preview img { width: 100%; max-height: 140px; object-fit: contain; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); padding: 8px; }
  .upload-preview .remove-img { position: absolute; top: 6px; right: 6px; background: var(--accent); color: white; border: none; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; cursor: pointer; font-weight: 700; line-height: 1; }

  .editor-preview { background: var(--paper-2); padding: 40px; overflow-y: auto; max-height: calc(100vh - 73px); display: flex; flex-direction: column; align-items: center; }
  .preview-toolbar { width: 100%; max-width: 720px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
  .preview-toolbar .left, .preview-toolbar .right { display: flex; gap: 8px; flex-wrap: wrap; }
  .tool-btn { padding: 10px 16px; background: white; border: 1px solid var(--line); border-radius: 999px; font-family: var(--sans); font-weight: 500; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
  .tool-btn:hover { border-color: var(--ink); }
  .tool-btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .tool-btn.primary:hover { background: var(--accent); border-color: var(--accent); }

  /* Download split button */
  .download-split { position: relative; display: inline-flex; gap: 0; }
  .download-split .download-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .download-split .download-arrow { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 10px 10px; border-left: 1px solid rgba(255,255,255,0.2); }
  .download-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 50;
    padding: 6px;
  }
  html.dark-mode .download-menu { background: var(--paper-2); border-color: var(--line); }
  .download-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    color: var(--ink);
  }
  .download-menu button:hover { background: var(--paper-2); }
  html.dark-mode .download-menu button:hover { background: var(--paper); }

  /* Actions dropdown menu */
  .actions-menu-wrap { position: relative; display: inline-block; }
  .actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 50;
    padding: 6px;
    overflow: hidden;
  }
  html.dark-mode .actions-menu { background: var(--paper-2); border-color: var(--line); }
  .actions-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    color: var(--ink);
  }
  .actions-menu button:hover { background: var(--paper-2); }
  html.dark-mode .actions-menu button:hover { background: var(--paper); }
  .actions-menu button:focus-visible { outline: 3px solid var(--focus); outline-offset: -2px; }

  /* Smart suggestion popup */
  .suggestion-popup {
    position: absolute;
    background: var(--ink);
    color: var(--paper);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 100;
    display: none;
  }
  .suggestion-popup.active { display: block; }
  .suggestion-popup .title {
    font-weight: 700;
    color: var(--accent-yellow);
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }
  .suggestion-popup .verbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .suggestion-popup .verb-chip {
    background: rgba(255,255,255,0.15);
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
  }
  .suggestion-popup .verb-chip:hover { background: var(--accent); }
  .suggestion-popup .close-tip {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: var(--paper);
    opacity: 0.6;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
  }
  .suggestion-popup .close-tip:hover { opacity: 1; }

  /* Print styles */
  .mobile-pdf-hint { width: 100%; margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; line-height: 1.4; }
  @media print {
    /* v26.3: isolation + height collapse. visibility:hidden removes chrome visually but keeps
       it in layout flow — the tall .editor-form was still occupying ~4 pages, creating blank
       trailing pages. So we ALSO display:none the tall SIBLING containers (never .editor-preview,
       which is #doc-preview's ancestor) to collapse the flow to just the document. */
    body * { visibility: hidden !important; }
    .editor-form, .editor-top-bar, .preview-toolbar, header, footer,
    .nav, #cookie-notice, .skip-link, .mobile-menu, .pdf-spinner,
    .modal, .modal-bg, .quiz-modal, .suggestion-popup, .actions-menu { display: none !important; }
    #doc-preview, #doc-preview * { visibility: visible !important; }
    #doc-preview {
      position: absolute !important;
      left: 0 !important;
      top: 0 !important;
      width: 8.5in !important;
      max-width: none !important;
      height: auto !important;
      min-height: 0 !important;
      margin: 0 !important;
      padding: 0.5in !important;
      box-shadow: none !important;
      transform: none !important;
      overflow: visible !important;
      background: #fff !important;
      color: #1a1a1a !important;
    }
    html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
    @page { size: letter; margin: 0; }
  }
  .doc-paper-preview { width: 100%; max-width: 720px; min-height: 930px; background: white; box-shadow: 0 30px 60px -30px rgba(0,0,0,0.25); font-size: 13px; line-height: 1.55; color: var(--ink); position: relative; overflow: hidden; }

  .doc-paper-preview.tpl-classic { padding: 56px 64px; }
  .doc-paper-preview.tpl-classic .doc-name { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-classic .doc-role { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
  .doc-paper-preview.tpl-classic .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
  .doc-paper-preview.tpl-classic .doc-section h2 { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px; }

  .doc-paper-preview.tpl-modern { display: grid; grid-template-columns: 220px 1fr; padding: 0; min-height: 930px; }
  .doc-paper-preview.tpl-modern .sidebar { background: var(--ink); color: var(--paper); padding: 48px 28px; }
  .doc-paper-preview.tpl-modern .sidebar .doc-name { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--paper); margin-bottom: 6px; line-height: 1.1; }
  .doc-paper-preview.tpl-modern .sidebar .doc-role { color: var(--accent-yellow); font-size: 13px; margin-bottom: 24px; font-style: italic; }
  .doc-paper-preview.tpl-modern .sidebar .contact-item { font-size: 11px; margin-bottom: 8px; opacity: 0.85; word-break: break-word; }
  .doc-paper-preview.tpl-modern .sidebar h2 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--accent-yellow); margin: 24px 0 10px; }
  .doc-paper-preview.tpl-modern .sidebar .doc-skills span { display: inline-block; padding: 3px 8px; background: rgba(255,255,255,0.1); border-radius: 4px; font-size: 10px; margin: 0 4px 4px 0; }
  .doc-paper-preview.tpl-modern .main { padding: 48px 36px; }
  .doc-paper-preview.tpl-modern .main h2 { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 6px; }

  .doc-paper-preview.tpl-minimal { padding: 72px 80px; text-align: center; }
  .doc-paper-preview.tpl-minimal .doc-name { font-family: var(--sans); font-size: 32px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
  .doc-paper-preview.tpl-minimal .doc-role { color: var(--muted); font-size: 14px; font-style: italic; margin-bottom: 12px; letter-spacing: 0.1em; }
  .doc-paper-preview.tpl-minimal .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 32px; }
  .doc-paper-preview.tpl-minimal .doc-section { margin-bottom: 28px; text-align: left; }
  .doc-paper-preview.tpl-minimal .doc-section h2 { font-size: 12px; text-align: center; font-weight: 600; letter-spacing: 0.25em; text-transform: uppercase; margin-bottom: 18px; }
  .doc-paper-preview.tpl-minimal .doc-section h2::after { content: ''; display: block; width: 30px; height: 1px; background: var(--ink); margin: 6px auto 0; }

  .doc-paper-preview.tpl-executive { padding: 64px 72px; font-family: var(--serif); }
  .doc-paper-preview.tpl-executive .doc-name { font-family: var(--serif); font-size: 38px; font-weight: 500; text-align: center; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px; }
  .doc-paper-preview.tpl-executive .doc-role { text-align: center; font-style: italic; color: var(--muted); font-size: 15px; margin-bottom: 8px; }
  .doc-paper-preview.tpl-executive .divider { width: 60px; height: 2px; background: var(--accent); margin: 12px auto 16px; }
  .doc-paper-preview.tpl-executive .doc-contact { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 28px; font-family: var(--sans); }
  .doc-paper-preview.tpl-executive .doc-section h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 16px; font-style: italic; color: var(--accent); }

  .doc-paper-preview.tpl-bold { padding: 56px 56px; }
  .doc-paper-preview.tpl-bold .doc-name { font-family: var(--sans); font-size: 42px; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 4px; background: var(--ink); color: var(--accent-yellow); padding: 12px 20px; display: inline-block; margin-left: -20px; }
  .doc-paper-preview.tpl-bold .doc-role { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--accent); }
  .doc-paper-preview.tpl-bold .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 28px; padding-bottom: 16px; border-bottom: 3px solid var(--ink); }
  .doc-paper-preview.tpl-bold .doc-section h2 { font-family: var(--sans); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 14px; }
  .doc-paper-preview.tpl-bold .doc-job { background: var(--paper-2); padding: 16px; border-radius: 8px; margin-bottom: 12px; border-left: 4px solid var(--accent); }

  .doc-paper-preview.tpl-creative { padding: 56px 56px; background: linear-gradient(135deg, white 60%, var(--accent-soft) 200%); }
  .doc-paper-preview.tpl-creative .doc-name { font-family: var(--serif); font-size: 42px; font-weight: 500; font-style: italic; color: var(--accent); margin-bottom: 4px; }
  .doc-paper-preview.tpl-creative .doc-role { font-size: 14px; margin-bottom: 8px; }
  .doc-paper-preview.tpl-creative .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 28px; }
  .doc-paper-preview.tpl-creative .doc-section h2 { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--accent); margin-bottom: 14px; font-weight: 500; }

  .doc-paper-preview.tpl-compact { padding: 40px 56px; font-size: 12px; line-height: 1.45; }
  .doc-paper-preview.tpl-compact .doc-name { font-family: var(--sans); font-size: 24px; font-weight: 700; display: inline; }
  .doc-paper-preview.tpl-compact .doc-role { display: inline; margin-left: 8px; color: var(--accent); font-weight: 500; font-size: 14px; }
  .doc-paper-preview.tpl-compact .doc-contact { font-size: 11px; color: var(--muted); margin-top: 6px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .doc-paper-preview.tpl-compact .doc-section { margin-bottom: 14px; }
  .doc-paper-preview.tpl-compact .doc-section h2 { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; color: var(--accent); }
  .doc-paper-preview.tpl-compact .doc-job { margin-bottom: 8px; }

  .doc-paper-preview.tpl-academic { padding: 56px 64px; }
  .doc-paper-preview.tpl-academic .doc-name { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--blue); margin-bottom: 4px; }
  .doc-paper-preview.tpl-academic .doc-role { color: var(--muted); font-size: 14px; margin-bottom: 12px; font-style: italic; }
  .doc-paper-preview.tpl-academic .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--blue); }
  .doc-paper-preview.tpl-academic .doc-section h2 { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--blue); margin-bottom: 12px; padding-left: 10px; border-left: 3px solid var(--blue); }

  .doc-paper-preview.tpl-startup { padding: 56px 56px; }
  .doc-paper-preview.tpl-startup .doc-name { font-family: var(--sans); font-size: 38px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-startup .doc-role { font-size: 16px; color: var(--ink); font-weight: 500; margin-bottom: 12px; }
  .doc-paper-preview.tpl-startup .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 24px; }
  .doc-paper-preview.tpl-startup .doc-section h2 { font-family: var(--sans); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 14px; color: var(--accent); }

  /* NEW: Two Column Resume */
  .doc-paper-preview.tpl-two-column { padding: 0; display: grid; grid-template-columns: 1fr 1fr; min-height: 930px; }
  .doc-paper-preview.tpl-two-column .col-left { padding: 48px 32px; border-right: 2px solid var(--ink); }
  .doc-paper-preview.tpl-two-column .col-right { padding: 48px 32px; background: var(--paper-2); }
  .doc-paper-preview.tpl-two-column .doc-name { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-two-column .doc-role { color: var(--accent); font-size: 14px; margin-bottom: 16px; font-weight: 600; }
  .doc-paper-preview.tpl-two-column .doc-contact { font-size: 11px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
  .doc-paper-preview.tpl-two-column .doc-section h2 { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 4px; }

  /* NEW: Timeline Resume */
  .doc-paper-preview.tpl-timeline { padding: 56px 64px; }
  .doc-paper-preview.tpl-timeline .doc-name { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-timeline .doc-role { color: var(--muted); font-size: 15px; margin-bottom: 12px; font-style: italic; }
  .doc-paper-preview.tpl-timeline .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 28px; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
  .doc-paper-preview.tpl-timeline .doc-section h2 { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 16px; color: var(--accent); }
  .doc-paper-preview.tpl-timeline .doc-job { position: relative; padding-left: 24px; margin-bottom: 18px; border-left: 2px solid var(--line); padding-bottom: 4px; }
  .doc-paper-preview.tpl-timeline .doc-job::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; background: var(--accent); border-radius: 50%; border: 2px solid white; }

  /* NEW: Elegant Resume */
  .doc-paper-preview.tpl-elegant { padding: 64px 72px; font-family: var(--serif); }
  .doc-paper-preview.tpl-elegant .doc-name { font-family: var(--serif); font-size: 40px; font-weight: 400; font-style: italic; text-align: center; margin-bottom: 4px; letter-spacing: -0.01em; }
  .doc-paper-preview.tpl-elegant .doc-role { text-align: center; font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
  .doc-paper-preview.tpl-elegant .elegant-divider { width: 80px; height: 1px; background: var(--ink); margin: 16px auto 12px; position: relative; }
  .doc-paper-preview.tpl-elegant .elegant-divider::before { content: '♦'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: white; padding: 0 8px; font-size: 10px; color: var(--accent); }
  .doc-paper-preview.tpl-elegant .doc-contact { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 24px; font-family: var(--sans); }
  .doc-paper-preview.tpl-elegant .doc-section h2 { font-family: var(--serif); font-style: italic; font-size: 20px; text-align: center; margin-bottom: 16px; color: var(--ink); font-weight: 500; }

  /* v21: Hybrid Skills Resume — skills by category at top, then chronological experience */
  .doc-paper-preview.tpl-hybrid { padding: 52px 60px; }
  .doc-paper-preview.tpl-hybrid .doc-name { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-hybrid .doc-role { color: var(--accent); font-size: 15px; font-weight: 600; margin-bottom: 8px; }
  .doc-paper-preview.tpl-hybrid .doc-contact { font-size: 12px; color: var(--muted); margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .doc-paper-preview.tpl-hybrid .doc-section h2 { font-family: var(--sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px; color: var(--ink); border-left: 3px solid var(--accent); padding-left: 10px; }
  .doc-paper-preview.tpl-hybrid .skill-category { margin-bottom: 14px; }
  .doc-paper-preview.tpl-hybrid .skill-category-name { font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
  .doc-paper-preview.tpl-hybrid .skill-category-items { font-size: 13px; line-height: 1.55; color: var(--ink); }
  .doc-paper-preview.tpl-hybrid .doc-job { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .doc-paper-preview.tpl-hybrid .doc-job:last-child { border-bottom: none; }

  /* NEW: Gradient Invoice */
  .doc-paper-preview.tpl-inv-gradient { padding: 0; }
  .doc-paper-preview.tpl-inv-gradient .grad-header {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-yellow) 100%);
    padding: 40px 56px;
    color: white;
  }
  .doc-paper-preview.tpl-inv-gradient .grad-header .doc-name { color: white; font-size: 36px; font-family: var(--serif); font-weight: 600; }
  .doc-paper-preview.tpl-inv-gradient .grad-body { padding: 32px 56px; }

  /* NEW: Boxed Invoice */
  .doc-paper-preview.tpl-inv-boxed { padding: 40px; }
  .doc-paper-preview.tpl-inv-boxed > div { border: 2px solid var(--ink); padding: 32px; }
  .doc-paper-preview.tpl-inv-boxed .doc-name { font-family: var(--sans); font-size: 28px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }

  /* NEW: Pie Chart Budget */
  .doc-paper-preview.tpl-bud-pie { padding: 48px 56px; }
  .doc-paper-preview.tpl-bud-pie .doc-name { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
  .pie-chart-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 32px; margin-bottom: 24px; align-items: center; }
  .pie-svg { width: 200px; height: 200px; }
  .pie-legend { font-size: 13px; }
  .pie-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .pie-legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

  /* NEW: Bar Comparison Budget */
  .doc-paper-preview.tpl-bud-comparison { padding: 48px 56px; }
  .doc-paper-preview.tpl-bud-comparison .doc-name { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
  .bar-row { display: grid; grid-template-columns: 140px 1fr 80px; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 13px; }
  .bar-track { background: var(--paper-2); height: 24px; border-radius: 4px; overflow: hidden; position: relative; }
  .bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
  .bar-fill.income { background: var(--green); }

  /* NEW: Modern Block Letter */
  .doc-paper-preview.tpl-let-block { padding: 56px 64px; font-family: var(--sans); }
  .doc-paper-preview.tpl-let-block .block-header {
    background: var(--ink);
    color: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  .doc-paper-preview.tpl-let-block .block-header .doc-name { color: white; font-size: 22px; font-family: var(--sans); font-weight: 700; }

  /* NEW: Two-Tone Letter */
  .doc-paper-preview.tpl-let-twotone { padding: 0; display: grid; grid-template-columns: 220px 1fr; min-height: 930px; }
  .doc-paper-preview.tpl-let-twotone .twotone-sidebar {
    background: var(--ink);
    color: white;
    padding: 48px 28px;
  }
  .doc-paper-preview.tpl-let-twotone .twotone-sidebar .doc-name { color: white; font-size: 22px; font-family: var(--serif); font-weight: 600; margin-bottom: 8px; }
  .doc-paper-preview.tpl-let-twotone .twotone-main {
    padding: 48px 36px;
  }

  .doc-paper-preview .doc-section { margin-bottom: 22px; }
  .doc-paper-preview .doc-section p { font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
  .doc-paper-preview .doc-job { margin-bottom: 14px; }
  .doc-paper-preview .doc-job-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: 12px; }
  .doc-paper-preview .doc-job-title { font-weight: 600; font-size: 13.5px; }
  .doc-paper-preview .doc-job-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .doc-paper-preview .doc-job-company { font-style: italic; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
  .doc-paper-preview .doc-job-desc { font-size: 12.5px; white-space: pre-wrap; }
  .doc-paper-preview .doc-skills { display: flex; flex-wrap: wrap; gap: 6px; }
  .doc-paper-preview .doc-skills span { padding: 4px 10px; background: var(--paper-2); border-radius: 4px; font-size: 11.5px; font-weight: 500; }

  .doc-paper-preview.tpl-inv-classic, .doc-paper-preview.tpl-inv-modern, .doc-paper-preview.tpl-inv-blue,
  .doc-paper-preview.tpl-inv-minimal, .doc-paper-preview.tpl-inv-detailed { padding: 56px 64px; }
  .doc-paper-preview.tpl-inv-minimal { padding: 72px 80px; }
  .doc-paper-preview.tpl-inv-modern .doc-name { color: var(--accent); }
  .doc-paper-preview.tpl-inv-blue .doc-name { color: var(--blue); }
  .doc-paper-preview.tpl-inv-blue .inv-top { border-bottom-color: var(--blue) !important; border-bottom-width: 3px; }
  .doc-paper-preview.tpl-inv-corp { padding: 0; }
  .doc-paper-preview.tpl-inv-corp .corp-header { background: var(--ink); color: white; padding: 36px 56px; }
  .doc-paper-preview.tpl-inv-corp .corp-header .doc-name { color: white; font-size: 36px; font-family: var(--sans); font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
  .doc-paper-preview.tpl-inv-corp .corp-body { padding: 32px 56px; }
  .doc-paper-preview.tpl-inv-minimal .doc-name { font-family: var(--sans); font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; font-size: 28px; }

  .inv-top { display: flex; justify-content: space-between; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); gap: 20px; }
  .inv-top .left-side { display: flex; gap: 16px; align-items: flex-start; flex: 1; }
  .invoice-logo { max-width: 100px; max-height: 100px; object-fit: contain; }
  .inv-top .right { text-align: right; }
  .inv-top h1 { font-size: 32px; font-family: var(--serif); }
  .inv-top .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
  .inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px; }
  .inv-table { width: 100%; margin-bottom: 20px; border-collapse: collapse; }
  .inv-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; padding: 10px 0; border-bottom: 2px solid var(--ink); }
  .inv-table th.right, .inv-table td.right { text-align: right; }
  .inv-table td { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
  .inv-totals { margin-left: auto; width: 280px; }
  .inv-totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
  .inv-totals .row.total { font-size: 16px; font-weight: 700; padding-top: 10px; border-top: 2px solid var(--ink); margin-top: 6px; }

  .doc-paper-preview.tpl-bud-rows, .doc-paper-preview.tpl-bud-cards, .doc-paper-preview.tpl-bud-summary,
  .doc-paper-preview.tpl-bud-business, .doc-paper-preview.tpl-bud-monthly, .doc-paper-preview.tpl-bud-quarterly { padding: 48px 56px; }
  .doc-paper-preview.tpl-bud-rows .doc-name, .doc-paper-preview.tpl-bud-cards .doc-name, .doc-paper-preview.tpl-bud-summary .doc-name,
  .doc-paper-preview.tpl-bud-business .doc-name, .doc-paper-preview.tpl-bud-monthly .doc-name, .doc-paper-preview.tpl-bud-quarterly .doc-name { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
  .doc-paper-preview.tpl-bud-business .doc-name, .doc-paper-preview.tpl-bud-monthly .doc-name { color: var(--green); }
  .budget-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
  .budget-summary .card { background: var(--paper-2); padding: 16px; border-radius: 8px; }
  .budget-summary .card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; font-weight: 700; }
  .budget-summary .card .amount { font-family: var(--serif); font-size: 22px; font-weight: 600; }
  .budget-summary .card.income .amount { color: var(--green); }
  .budget-summary .card.expense .amount { color: var(--accent); }
  .budget-table { width: 100%; border-collapse: collapse; }
  .budget-table th { text-align: left; padding: 10px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 2px solid var(--ink); }
  .budget-table th.right, .budget-table td.right { text-align: right; }
  .budget-table td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
  .pl-summary { background: var(--paper-2); padding: 24px; border-radius: 12px; margin: 24px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .pl-summary .item { text-align: center; }
  .pl-summary .item .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
  .pl-summary .item .val { font-family: var(--serif); font-size: 24px; font-weight: 600; }
  .pl-summary .item.profit .val { color: var(--green); }
  .pl-summary .item.loss .val { color: var(--accent); }

  .doc-paper-preview.tpl-let-classic { padding: 72px 80px; font-family: var(--serif); }
  .doc-paper-preview.tpl-let-modern { padding: 0; }
  .doc-paper-preview.tpl-let-modern .header { background: var(--ink); color: white; padding: 40px 56px; }
  .doc-paper-preview.tpl-let-modern .body { padding: 40px 56px; font-family: var(--sans); font-size: 14px; line-height: 1.7; }
  .doc-paper-preview.tpl-let-creative { padding: 0; }
  .doc-paper-preview.tpl-let-creative .header { background: var(--accent-yellow); padding: 32px 56px; border-bottom: 4px solid var(--ink); }
  .doc-paper-preview.tpl-let-creative .header .doc-name { font-family: var(--serif); font-style: italic; font-size: 32px; }
  .doc-paper-preview.tpl-let-creative .body { padding: 32px 56px; }
  .doc-paper-preview.tpl-let-minimal { padding: 80px 80px; font-family: var(--sans); }
  .doc-paper-preview.tpl-let-executive { padding: 64px 72px; font-family: var(--serif); text-align: center; }
  .doc-paper-preview.tpl-let-executive .monogram { width: 60px; height: 60px; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; margin: 0 auto 24px; }
  .doc-paper-preview.tpl-let-executive .letter-content { text-align: left; }
  .letter-content { font-size: 14px; line-height: 1.7; }
  .letter-content .date { text-align: right; margin-bottom: 24px; color: var(--muted); }
  .letter-content .recipient { margin-bottom: 24px; }
  .letter-content p { margin-bottom: 14px; white-space: pre-wrap; }
  .letter-content .closing { margin-top: 24px; }

  .modal-bg { display: none; position: fixed; inset: 0; background: rgba(26,26,26,0.6); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
  .modal-bg.active { display: flex; }
  .modal { background: var(--paper); padding: 36px; border-radius: 16px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
  .modal h3 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }
  .modal p.intro { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
  .modal-close { float: right; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; margin-top: -10px; background: none; border: none; padding: 4px; }
  .modal-close:hover { color: var(--ink); }
  .modal .field input, .modal .field textarea { background: white; }
  .modal-success { text-align: center; padding: 20px 0; }
  .modal-success .check { width: 60px; height: 60px; border-radius: 50%; background: var(--green); color: white; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; }

  .quiz-progress { display: flex; gap: 6px; margin-bottom: 28px; }
  .quiz-progress .dot { flex: 1; height: 4px; background: var(--line); border-radius: 2px; transition: background 0.3s; }
  .quiz-progress .dot.active { background: var(--ink); }
  .quiz-question { font-family: var(--serif); font-size: 26px; font-weight: 500; margin-bottom: 8px; letter-spacing: -0.01em; line-height: 1.2; }
  .quiz-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
  .quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
  .quiz-option { padding: 16px 20px; border: 1.5px solid var(--muted); border-radius: 12px; background: white; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 14px; font-weight: 500; font-size: 15px; text-align: left; font-family: var(--sans); color: var(--ink); width: 100%; }
  .quiz-option:hover { border-color: var(--ink); transform: translateX(2px); background: var(--paper); }
  .quiz-option:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--ink); background: var(--paper); }
  .quiz-option .opt-icon { font-size: 24px; }
  .quiz-result { text-align: center; padding: 20px 0; }
  .quiz-result .star { width: 70px; height: 70px; border-radius: 50%; background: var(--accent-yellow); display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto 16px; }
  .quiz-result h3 { font-family: var(--serif); font-size: 26px; margin-bottom: 8px; }
  .quiz-result > p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
  .quiz-result .recommended { background: white; padding: 20px; border-radius: 12px; border: 2px solid var(--accent-yellow); margin-bottom: 20px; text-align: left; }
  .quiz-result .recommended h4 { font-family: var(--serif); font-size: 20px; margin-bottom: 4px; }
  .quiz-result .recommended .why { color: var(--muted); font-size: 13px; line-height: 1.5; }

  @media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 40px 24px; }
    .hero-art { height: 320px; }
    .categories { grid-template-columns: repeat(2,1fr); }
    .steps { grid-template-columns: repeat(2,1fr); }
    .template-grid { grid-template-columns: repeat(2,1fr); }
    .editor-layout { grid-template-columns: 320px 1fr; }
    .editor-form { padding: 24px 20px; }
    .nav-links a:not(.btn-feedback), .nav-links .nav-btn:not(.btn-feedback) { display: none; }
    .dark-toggle { padding: 6px 10px; font-size: 11px; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
    .inv-parties, .budget-summary, .why-grid, .footer-top { grid-template-columns: 1fr; }
    .trust-claims-grid { grid-template-columns: repeat(2, 1fr); }
    .doc-paper-preview.tpl-modern { grid-template-columns: 1fr; }
    .doc-paper-preview.tpl-photo .photo-header { flex-direction: column !important; text-align: center; }
    .quiz-card { flex-direction: column; text-align: center; }
    .how-it-works { padding: 16px; gap: 8px; }
    .how-step { min-width: 100%; }
    .how-step-arrow { display: none; }
  }
  @media (max-width: 700px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-form, .editor-preview { max-height: none; }
    .editor-form { padding: 20px 16px; border-right: none; border-bottom: 1px solid var(--line); }
    .editor-preview { padding: 20px 16px; }
    .preview-toolbar { position: sticky; top: 0; background: var(--paper-2); padding: 12px; margin: -20px -16px 16px; z-index: 10; border-bottom: 1px solid var(--line); }
    .preview-toolbar .left, .preview-toolbar .right { flex: 1; }
    .preview-toolbar .right { justify-content: flex-end; }
    .tool-btn { padding: 8px 12px; font-size: 12px; }
    .doc-paper-preview { min-height: auto; transform: scale(0.85); transform-origin: top center; margin-bottom: -80px; }
    .form-section { margin-bottom: 20px; }
    .form-section h3 { font-size: 12px; }
  }
  /* v22.1.1: hamburger at ≤900px (full tablet+mobile range) */
  @media (max-width: 900px) {
    .nav-links { display: none !important; }
    .mobile-menu-btn { display: flex !important; }
    .nav { padding: 14px 18px; }
    .logo { font-size: 16px; }
  }
  @media (max-width: 600px) {
    .categories, .steps, .template-grid { grid-template-columns: 1fr; }
    .trust-claims-grid { grid-template-columns: 1fr; }
    /* v21: hide select showroom cards on mobile to reduce vertical scroll (4 cards instead of 6) */
    .showroom-card.mobile-hide { display: none; }
    .doc-paper-preview { font-size: 12px; min-height: auto; }
    .doc-paper-preview.tpl-classic, .doc-paper-preview.tpl-bold, .doc-paper-preview.tpl-creative,
    .doc-paper-preview.tpl-academic, .doc-paper-preview.tpl-startup { padding: 32px 28px; }
    .doc-paper-preview.tpl-classic .doc-name { font-size: 26px; }
    .editor-preview { padding: 20px; }
    .phone-group { grid-template-columns: 100px 1fr; }
    .hero-badge { font-size: 12px; padding: 10px 16px; }
  }

  /* v15: Maxlength counter (only shows when at/near limit) */
  .char-counter { display: none; font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 4px; text-align: right; font-family: var(--sans); }
  .char-counter.show { display: block; }
  .char-counter.warn { color: #c47800; }
  .char-counter.max { color: var(--accent); }

  /* v15: PDF generation spinner overlay */
  .pdf-spinner-overlay { position: fixed; inset: 0; background: rgba(26,26,26,0.6); z-index: 9999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
  .pdf-spinner-overlay.show { display: flex; }
  .pdf-spinner-box { background: var(--paper); padding: 32px 40px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 320px; text-align: center; }
  .pdf-spinner-circle { width: 48px; height: 48px; border: 4px solid var(--paper-2); border-top-color: var(--accent); border-radius: 50%; animation: pdfSpin 0.9s linear infinite; }
  .pdf-spinner-text { font-family: var(--sans); font-weight: 600; color: var(--ink); font-size: 16px; }
  .pdf-spinner-sub { font-family: var(--sans); font-size: 13px; color: var(--muted); }
  @keyframes pdfSpin { to { transform: rotate(360deg); } }

  /* v15: Template search bar */
  .template-search { margin: 0 0 24px; max-width: 480px; position: relative; }
  .template-search input { width: 100%; padding: 14px 20px 14px 48px; font-family: var(--sans); font-size: 15px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
  .template-search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(26,26,26,0.1); }
  .template-search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
  .template-search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: var(--paper-2); border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; display: none; align-items: center; justify-content: center; color: var(--muted); font-size: 16px; line-height: 1; }
  .template-search-clear.show { display: flex; }
  .template-search-clear:hover { background: var(--line); color: var(--ink); }
  .template-no-results { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 15px; }
  html.dark-mode .template-search input { background: #1f1d1b; border-color: rgba(255,255,255,0.28); color: var(--ink); }
  html.dark-mode .template-search input::placeholder { color: #8b8680; }
  html.dark-mode .template-search input:focus { border-color: var(--accent-yellow); box-shadow: 0 0 0 3px rgba(244,196,48,0.2); }

  /* v15: Post-download feedback modal */
  .pdfb-overlay { position: fixed; inset: 0; background: rgba(26,26,26,0.6); z-index: 10000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
  .pdfb-overlay.show { display: flex; animation: pdfbFadeIn 0.2s ease; }
  @keyframes pdfbFadeIn { from { opacity: 0; } to { opacity: 1; } }
  .pdfb-box { background: var(--paper); border-radius: 20px; padding: 32px; max-width: 480px; width: 100%; box-shadow: 0 24px 80px rgba(0,0,0,0.4); max-height: 90vh; overflow-y: auto; }
  .pdfb-title { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); margin: 0 0 8px; line-height: 1.2; }
  .pdfb-subtitle { font-family: var(--sans); font-size: 15px; color: var(--muted); line-height: 1.55; margin: 0 0 24px; }
  .pdfb-field { margin-bottom: 16px; }
  .pdfb-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; font-family: var(--sans); }
  .pdfb-field label .opt { font-weight: 400; color: var(--muted); }
  .pdfb-field input, .pdfb-field textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 8px; font-family: var(--sans); font-size: 14px; background: var(--paper); color: var(--ink); }
  .pdfb-field textarea { min-height: 100px; resize: vertical; font-family: var(--sans); line-height: 1.5; }
  .pdfb-field input:focus, .pdfb-field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(26,26,26,0.08); }
  .pdfb-permission { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: var(--paper-2); border-radius: 10px; margin: 16px 0 24px; cursor: pointer; }
  .pdfb-permission input { margin-top: 2px; cursor: pointer; flex-shrink: 0; }
  .pdfb-permission span { font-size: 13px; color: var(--ink); font-family: var(--sans); line-height: 1.5; }
  .pdfb-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
  .pdfb-btn-skip { padding: 10px 18px; background: transparent; color: var(--muted); border: none; font-family: var(--sans); font-weight: 500; font-size: 14px; cursor: pointer; border-radius: 8px; }
  .pdfb-btn-skip:hover { background: var(--paper-2); color: var(--ink); }
  .pdfb-btn-send { padding: 10px 22px; background: var(--ink); color: var(--paper); border: none; border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: 14px; cursor: pointer; }
  .pdfb-btn-send:hover { background: var(--accent); }
  /* v18: Fixed dark mode contrast - text colors must be var(--ink) (light in dark mode), not var(--paper) which is dark */
  html.dark-mode .pdfb-box { background: #2a2926; border: 1px solid rgba(255,255,255,0.1); }
  html.dark-mode .pdfb-title { color: var(--ink); }
  html.dark-mode .pdfb-subtitle { color: #c8c3b8; }
  html.dark-mode .pdfb-field label { color: var(--ink); }
  html.dark-mode .pdfb-field label .opt { color: #a8a39a; }
  html.dark-mode .pdfb-field input, html.dark-mode .pdfb-field textarea { background: #1f1d1b; border-color: rgba(255,255,255,0.28); color: var(--ink); }
  html.dark-mode .pdfb-field input::placeholder, html.dark-mode .pdfb-field textarea::placeholder { color: #8b8680; }
  html.dark-mode .pdfb-field input:focus, html.dark-mode .pdfb-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,138,91,0.18); }
  html.dark-mode .pdfb-permission { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
  html.dark-mode .pdfb-permission span { color: var(--ink); }
  html.dark-mode .pdfb-btn-skip { color: #c8c3b8; }
  html.dark-mode .pdfb-btn-skip:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
  @media (max-width: 600px) {
    .pdfb-box { padding: 24px 20px; border-radius: 16px; }
    .pdfb-title { font-size: 22px; }
    .pdfb-actions { flex-direction: column-reverse; }
    .pdfb-actions button { width: 100%; }
  }

  /* v15: Utility classes (replaces some repeated inline styles) */
  .u-hidden { display: none !important; }
  .u-pre-text { margin-bottom: 14px; line-height: 1.7; white-space: pre-wrap; }
  .u-tip-text { font-size: 12px; color: var(--muted); }
  .u-mb-10 { margin-bottom: 10px; }
  .u-mb-12 { margin-bottom: 12px; }
  .u-mt-12 { margin-top: 12px; }
  .u-section-divider { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }

  /* v15: Mobile audit improvements */
  /* iOS safe area support (notch / home indicator) */
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  /* PWA standalone mode: extra top padding for status bar */
  @media all and (display-mode: standalone) {
    nav, header { padding-top: max(20px, env(safe-area-inset-top)); }
  }
  /* Touch-friendly tap targets — WCAG 2.5.5 minimum 44x44px on touch devices */
  @media (hover: none) and (pointer: coarse) {
    button, .nav-btn, .btn-primary, .btn-secondary, .sticky-btn, .tool-btn,
    .template-card, .nav-links a, .footer-col button, .footer-col a {
      min-height: 44px;
    }
    /* Larger checkbox/radio for fingers */
    input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
    /* Bigger close buttons on modals */
    .close-tip, .remove-img { min-width: 44px; min-height: 44px; }
    /* Prevent iOS from zooming inputs (must be >=16px font) */
    input, textarea, select { font-size: 16px !important; }
  }
  /* Smooth iOS momentum scrolling */
  .editor-form, .editor-preview, .modal-content, .pdfb-box { -webkit-overflow-scrolling: touch; }
  /* Prevent text size adjustment on iOS rotation */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* Better mobile typography */
  @media (max-width: 480px) {
    .hero h1, .hero .hero-title { font-size: 38px; line-height: 1.05; }
    .hero p { font-size: 16px; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions button { width: 100%; justify-content: center; }
    .templates-head h1 { font-size: 32px; }
    .template-search input { font-size: 16px; padding: 14px 20px 14px 44px; }
    .how-it-works { padding: 14px; }
    .how-step { gap: 10px; }
    .how-step-text strong { font-size: 14px; }
    .how-step-text span { font-size: 12px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    /* Sticky toolbar more compact on small phones */
    .sticky-actions { gap: 6px; flex-wrap: wrap; }
    .sticky-btn { padding: 8px 10px; font-size: 12px; }
  }
  /* Landscape mode on small phones - keep usable */
  @media (max-height: 480px) and (orientation: landscape) {
    .hero { padding: 24px 32px; }
    .hero h1, .hero .hero-title { font-size: 32px; }
    .hero-art { display: none; }
  }

  /* v24 mobile hardening: prevent layout breakage at ultra-narrow widths (<340px)
     and replace any fixed 320px assumptions with responsive constraints */
  @media (max-width: 600px) {
    .hero-content, .hero > div { width: 100%; max-width: 100%; }
    .hero-badge { max-width: calc(100vw - 48px); white-space: normal; }
    .btn-primary, .btn-secondary { max-width: calc(100vw - 48px); box-sizing: border-box; }
    /* Showroom carousel: prevent it forcing page-level horizontal scroll */
    .showroom-grid { max-width: 100vw; }
    .showroom-card { max-width: min(82vw, 320px); }
  }
  @media (max-width: 340px) {
    /* v24.0.1: viewport-based widths (calc(100vw - 32px)) instead of 100% — deterministic at any narrow width,
       does not rely on overflow-x:hidden to hide clipping. Goal: scrollWidth <= clientWidth at 320px. */
    .hero h1, .hero .hero-title { font-size: 30px; line-height: 1.1; word-break: break-word; }
    .hero { padding-left: 16px; padding-right: 16px; }
    .hero-content, .hero > div { max-width: calc(100vw - 32px); box-sizing: border-box; }
    .btn-primary, .btn-secondary { width: 100%; max-width: calc(100vw - 32px); box-sizing: border-box; }
    .hero-badge { max-width: calc(100vw - 32px); box-sizing: border-box; white-space: normal; }
    .cookie-notice, .cookie-banner { max-width: 100vw; box-sizing: border-box; }
    .mobile-menu-inner { width: min(300px, calc(100vw - 20px)); }
    .nav { padding: 12px 14px; }
    .logo { font-size: 15px; }
    /* Showroom carousel cards must not exceed viewport */
    .showroom-card { max-width: calc(100vw - 40px); }
  }

/* v27: defer below-the-fold layout work without changing the visual design. */
.quiz-promo,
#categories-section,
.categories,
#showroom-section,
.popular-templates,
.showroom,
.why,
.trust-section,
.how {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

/* v27: the homepage title remains an accessible heading during client navigation,
   but is not a second HTML h1 in pre-rendered template pages. */
.hero .hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.hero .hero-title em { font-style: italic; color: var(--accent); font-weight: 400; }

/* v27: true quarterly worksheet. */
.doc-paper-preview.tpl-bud-quarterly {
  width: min(100%, 930px);
  min-height: 610px;
  padding: 36px 42px;
}
.quarterly-budget-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.quarterly-budget-table th,
.quarterly-budget-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); text-align: right; }
.quarterly-budget-table th:first-child,
.quarterly-budget-table td:first-child { text-align: left; width: 30%; }
.quarterly-budget-table thead th { background: var(--paper-2); font-weight: 700; }
.quarterly-budget-table .quarter-group th {
  padding-top: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.quarterly-budget-table .quarter-total td { font-weight: 700; border-top: 2px solid var(--ink); }
.quarterly-budget-table .quarter-net td { font-weight: 700; background: var(--green-soft); }
.quarter-row-card { border: 1px solid var(--line); padding: 12px; margin-bottom: 12px; background: var(--paper); }
.quarter-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

@media (max-width: 480px) {
  .hero .hero-title { font-size: 38px; line-height: 1.05; }
  .editor-top-bar { display: block; padding: 0 14px; top: 64px; }
  .editor-top-bar > .breadcrumb { padding: 9px 0 !important; overflow-x: auto; white-space: nowrap; }
  .sticky-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px 0 10px; }
  .sticky-btn,
  .score-btn { min-width: 0; padding: 8px 2px; justify-content: center; gap: 2px; font-size: 10px; white-space: nowrap; }
  .score-btn .score-value { font-size: 11px; }
  .quarter-values { grid-template-columns: 1fr; }
}

@media (max-width: 340px) {
  .hero .hero-title { font-size: 30px; line-height: 1.1; word-break: break-word; }
  .score-btn .score-label { font-size: 0; }
  .score-btn .score-label::after { content: "📊"; font-size: 12px; }
}

@media print {
  body.print-quarterly #doc-preview {
    width: 11in !important;
    min-height: 8.5in !important;
    padding: 0.35in !important;
  }
}

/* v28: links are real navigation targets in both static HTML and the live grid. */
.template-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.template-meta h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

/* Keep the PDF guidance readable without adding another panel to the toolbar. */
.pdf-mode-note {
  max-width: 390px;
}

@media print {
  /* The SEO intro and editor containers still occupied page height while invisible,
     producing a blank trailing page after the document. */
  .seo-intro-banner { display: none !important; }
  main,
  #page-editor,
  .editor-layout,
  .editor-preview {
    display: block !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
}

/* v29: WCAG contrast correction for the mid-range document score. */
.score-btn.score-mid {
  border-color: #735600;
  color: #735600;
}

/* Keep the working document near the start of the quarterly landing page. */
#score-btn[hidden] { display: none; }
.quarter-intro .seo-intro-inner { max-width: 1200px; padding: 16px 24px; }
.quarter-intro .seo-h1 { font-size: 30px; margin: 8px 0; letter-spacing: 0; }
.quarter-intro p { margin: 8px 0; max-width: 85ch; }
.quarter-actions, .quarter-samples { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0; }
.quarter-actions a, .quarter-samples a, .quarter-guide-link a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.quarter-samples { font-size: 14px; }
.quarter-guide-link { padding: 12px 24px; }
.quarter-intro a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) {
  .quarter-intro .seo-intro-inner { padding: 12px 16px; }
  .quarter-intro .seo-h1 { font-size: 25px; }
  .quarter-actions, .quarter-samples { gap: 10px 16px; }
}

/* Match the existing editor, with a compact opening and help below the tool. */
.seo-intro-banner.hybrid-intro { padding: 18px 24px; }
.hybrid-intro .seo-intro-inner { max-width: 1200px; }
.hybrid-intro .seo-h1 { font-size: 30px; letter-spacing: 0; margin: 8px 0; }
.hybrid-intro .seo-breadcrumb { margin-bottom: 8px; }
.hybrid-intro p { max-width: 78ch; margin: 8px 0; line-height: 1.5; }
.hybrid-actions { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; }
.hybrid-actions a { display: inline-flex; align-items: center; min-height: 44px; }
.hybrid-actions a, .hybrid-help a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.hybrid-actions a:focus-visible, .hybrid-help a:focus-visible, .hybrid-help:focus { outline: 3px solid var(--accent); outline-offset: 3px; }
.hybrid-help { border-top: 1px solid var(--line); padding: 32px 24px; scroll-margin-top: 90px; }
.hybrid-help-inner { max-width: 1200px; margin: auto; }
.hybrid-help h2 { font-size: 24px; letter-spacing: 0; margin: 0 0 12px; }
.hybrid-help h3 { font-size: 18px; letter-spacing: 0; margin: 12px 0; }
.hybrid-help p, .hybrid-help li, .hybrid-help dd { line-height: 1.6; }
.hybrid-help p { margin: 12px 0; }
.hybrid-help-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.hybrid-help dt { font-weight: 700; margin-top: 12px; }
.hybrid-help dd { margin: 4px 0 12px; }
.hybrid-help ul { padding-left: 20px; }
@media (max-width: 700px) {
  .hybrid-help-columns { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .seo-intro-banner.hybrid-intro { padding: 12px 16px; }
  .hybrid-intro .seo-h1 { font-size: 25px; }
  .hybrid-actions { gap: 4px 16px; }
  .hybrid-help { padding: 24px 16px; }
}
@media print { .hybrid-help { display: none !important; } }

.invoice-preview-shortcut{display:inline-flex;align-items:center;min-height:44px;padding:8px 4px;font-weight:600}
