:root {
  color-scheme: light;
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --border: #E3DED4;
  --border-strong: #CCC5B8;
  --ink: #1A1917;
  --soft: #3D3A35;
  --muted: #6E695F;
  --accent: #1F5143;
  --accent-hover: #173F34;
  --accent-soft: #EBF3F0;
  --danger: #B3261E;
  --danger-soft: #FCECEB;
  --shadow: 0 2px 10px rgba(26, 25, 23, 0.06);
  --paper-shadow: 0 12px 32px rgba(26, 25, 23, 0.14);
  --radius: 10px;
  --print-accent: #1F5143;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.church-pill, .sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.church-pill:hover, .sync-pill:hover {
  border-color: var(--border-strong);
  background: #F1EDE5;
}

.pill-sep, .pill-muted { color: var(--muted); font-weight: 400; }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.sync-dot.synced { background: #1E8E5A; }
.sync-dot.pending { background: #D9822B; }
.sync-dot.error { background: var(--danger); }

/* ---------- Buttons & Inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-accent-soft {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(31, 81, 67, 0.25);
}
.btn-accent-soft:hover { background: #DFECE7; }

.btn-ghost {
  background: transparent;
  color: var(--soft);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.25);
}

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.segmented-sm .seg-btn { padding: 3px 8px; font-size: 12px; }

.input, .textarea, .date-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}
.input:focus, .textarea:focus, .date-input:focus {
  outline: 2px solid rgba(31, 81, 67, 0.22);
  border-color: var(--accent);
}
.textarea { resize: vertical; }
.input[readonly] { background: var(--surface-2); color: var(--muted); }

/* ---------- Workspace Layout ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 500px) 1fr;
  flex: 1;
  min-height: 0;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.week-nav, .week-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-input {
  width: auto;
  padding: 4px 8px;
  font-size: 12.5px;
}

.week-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-left: 4px;
}

.autofill-banner {
  padding: 7px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border-bottom: 1px solid rgba(31, 81, 67, 0.18);
  font-size: 12.5px;
  font-weight: 500;
}

.editor-tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  padding: 10px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg);
}

.tab-panel { display: none; flex-direction: column; gap: 12px; }
.tab-panel.active { display: flex; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-heading {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--soft);
}

.section-head-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
}

.input-title { font-weight: 700; letter-spacing: 0.02em; }
.input-time { text-align: center; font-weight: 600; }

.prog-editor-list, .ann-editor-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.prog-editor-row {
  display: grid;
  grid-template-columns: 118px 1fr 112px auto;
  gap: 5px;
  align-items: center;
}

.prog-editor-row .input {
  padding: 6px 7px;
  font-size: 12.5px;
}

.row-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mini-btn {
  height: 26px;
  min-width: 24px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.mini-btn:hover { background: #EDE9DF; color: var(--ink); }
.mini-btn.del:hover { background: var(--danger-soft); color: var(--danger); border-color: rgba(179, 38, 30, 0.3); }
.mini-btn.auto { color: var(--accent); background: var(--accent-soft); border-color: rgba(31, 81, 67, 0.2); }

.add-row-btn { align-self: flex-start; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.inline-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--soft);
  cursor: pointer;
}
.toggle-inline input { accent-color: var(--accent); }

.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recurring-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
}
.recurring-item input { margin-top: 3px; accent-color: var(--accent); }
.recurring-item-title { font-weight: 700; font-size: 12.5px; }
.recurring-item-body { font-size: 12px; color: var(--muted); }

.ann-item-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.ann-item-top {
  display: flex;
  gap: 6px;
  align-items: center;
}

.info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.archive-row.current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.archive-date { font-weight: 700; font-size: 13px; }
.archive-sub { font-size: 12px; color: var(--muted); }
.archive-actions { display: flex; gap: 5px; }

.muted-text { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ---------- Preview Pane ---------- */
.preview-pane {
  display: flex;
  flex-direction: column;
  background: #EAE6DD;
  min-width: 0;
  min-height: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-meta, .preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-title { font-weight: 700; font-size: 13px; }
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.preview-viewport {
  flex: 1;
  overflow: auto;
  padding: 22px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.sheets-scale-wrap {
  transform-origin: top center;
}

.sheets-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ================================================================
   PRINT SHEET SPECIFICATION (Exact 11in x 8.5in Half-Fold Landscape)
   ================================================================ */
.sheet {
  width: 11in;
  height: 8.5in;
  background: #FFFFFF;
  color: #000000;
  display: grid;
  grid-template-columns: 5.5in 5.5in;
  position: relative;
  box-shadow: var(--paper-shadow);
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.sheets-stack.show-fold .sheet::after {
  content: '';
  position: absolute;
  top: 0.25in;
  bottom: 0.25in;
  left: 5.5in;
  border-left: 1px dashed rgba(31, 81, 67, 0.3);
  pointer-events: none;
}

.panel {
  width: 5.5in;
  height: 8.5in;
  padding: 0.5in;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Font Presets */
.sheets-stack[data-font="ola-classic"] {
  --font-display: 'Satisfy', cursive;
  --font-body: 'Montserrat', sans-serif;
}
.sheets-stack[data-font="timeless-serif"] {
  --font-display: 'Playfair Display', serif;
  --font-body: 'Source Serif 4', serif;
}
.sheets-stack[data-font="clean-modern"] {
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* Inside Left: Welcome + Order of Service + Sunset */
.inside-left {
  font-family: var(--font-body);
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 22pt;
  line-height: 1.15;
  text-align: center;
  margin: 0 0 3pt 0;
  font-weight: 400;
  color: #000000;
}

.sheets-stack[data-font="clean-modern"] .welcome-title {
  font-size: 18pt;
  font-weight: 800;
}

.welcome-date {
  font-family: var(--font-body);
  font-size: 12pt;
  text-align: center;
  margin: 0 0 12pt 0;
  color: #111111;
}

.service-block {
  margin-bottom: 10pt;
}

.service-header {
  text-align: center;
  margin: 4pt 0 9pt 0;
}

.service-heading {
  font-size: 14pt;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  margin: 0;
}

.service-time {
  font-size: 10pt;
  font-weight: 400;
  margin-top: 1pt;
}
.service-time .ampm {
  font-size: 8pt;
}

.prog-list {
  display: flex;
  flex-direction: column;
  gap: 5.5pt;
}

/* Unbreakable dead-center 3-column grid: left/right mirror tracks keep center dead on 2.25" */
.prog-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  column-gap: 6pt;
  line-height: 1.22;
}

.prog-left {
  justify-self: start;
  text-align: left;
  font-size: 10pt;
  font-weight: 700;
}

.prog-mid {
  justify-self: center;
  text-align: center;
  font-size: 9pt;
  font-style: italic;
  font-weight: 400;
}

.prog-right {
  justify-self: end;
  text-align: right;
  font-size: 10pt;
  font-weight: 700;
  white-space: nowrap;
}

.sunset-footer {
  margin-top: auto;
  padding-top: 8pt;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10.5pt;
  font-weight: 700;
}

/* Inside Right: Announcements + Quote + Pastor Footer */
.inside-right {
  font-family: var(--font-body);
}

.ann-heading {
  font-size: 20pt;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  margin: 0 0 12pt 0;
}

.ann-list {
  margin: 0;
  padding-left: 16pt;
  list-style: disc;
}

.ann-list li {
  font-size: 10.25pt;
  line-height: 1.38;
  margin-bottom: 10pt;
}

.ann-item-head {
  font-weight: 700;
}

.quote-block {
  margin: auto 0 12pt 0;
  padding: 10pt 4pt 4pt 4pt;
  text-align: center;
}

.quote-text {
  font-family: var(--font-display);
  font-size: 14.5pt;
  line-height: 1.35;
  margin: 0 0 8pt 0;
  color: #111111;
}

.sheets-stack[data-font="clean-modern"] .quote-text {
  font-size: 11.5pt;
  font-style: italic;
}

.quote-source {
  font-family: var(--font-body);
  font-size: 11pt;
  font-weight: 400;
  margin: 0;
}

.inside-contact-footer {
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 8.2pt;
  color: #222222;
  padding-top: 4pt;
}

/* Front Cover (Page 1 Right) */
.front-cover {
  font-family: var(--font-body);
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.cover-frame {
  width: 100%;
  height: 100%;
  border: 1.5pt solid var(--print-accent);
  padding: 0.42in 0.35in;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.cover-frame::before {
  content: '';
  position: absolute;
  inset: 4pt;
  border: 0.5pt solid rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.cover-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8pt;
  margin-top: 10pt;
}

.cover-emblem {
  width: 42pt;
  height: 42pt;
  color: var(--print-accent);
}

.cover-church-name {
  font-family: var(--font-display);
  font-size: 25pt;
  line-height: 1.15;
  margin: 0;
  color: var(--print-accent);
}

.sheets-stack[data-font="clean-modern"] .cover-church-name {
  font-size: 20pt;
  font-weight: 800;
}

.cover-subtitle {
  font-size: 10pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #444444;
  font-weight: 600;
}

.cover-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8pt;
  padding: 0 12pt;
}

.cover-rule {
  width: 1.1in;
  height: 1.5pt;
  background: var(--print-accent);
}

.cover-date {
  font-size: 11.5pt;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cover-sermon-label {
  font-size: 8.5pt;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #555555;
  margin-top: 6pt;
}

.cover-sermon-title {
  font-size: 15pt;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.cover-speaker {
  font-size: 10.5pt;
  font-weight: 600;
  color: #333333;
}

.cover-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5pt;
  margin-bottom: 6pt;
  padding: 0 10pt;
}

.cover-verse {
  font-size: 9.5pt;
  font-style: italic;
  line-height: 1.4;
  color: #333333;
  margin: 0;
}

.cover-verse-ref {
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--print-accent);
}

.cover-loc {
  font-size: 8.5pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555555;
  margin-top: 6pt;
}

/* Back Cover (Page 1 Left) */
.back-cover {
  font-family: var(--font-body);
  justify-content: space-between;
}

.back-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.15in 0.1in;
}

.back-section {
  margin-bottom: 14pt;
}

.back-title {
  font-size: 10.5pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--print-accent);
  border-bottom: 1pt solid var(--print-accent);
  padding-bottom: 4pt;
  margin: 0 0 8pt 0;
}

.back-times-row {
  display: flex;
  justify-content: space-between;
  font-size: 9.5pt;
  padding: 3pt 0;
  border-bottom: 0.5pt dotted #CCCCCC;
}

.back-note {
  font-size: 9.5pt;
  line-height: 1.48;
  color: #222222;
  margin: 0;
}

.back-footer {
  border-top: 1pt solid #DDDDDD;
  padding-top: 10pt;
  text-align: center;
  font-size: 9pt;
  line-height: 1.5;
  color: #333333;
}

/* ---------- Autocomplete Dropdown & Modals ---------- */
.autocomplete-menu {
  position: fixed;
  z-index: 900;
  min-width: 260px;
  max-width: 340px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 25, 23, 0.16);
  padding: 4px;
}

.ac-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.ac-item:hover, .ac-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.ac-num {
  font-weight: 700;
  min-width: 34px;
}
.ac-title { flex: 1; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(26, 25, 23, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(26, 25, 23, 0.22);
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-lg { max-width: 680px; }
.modal-sm { max-width: 440px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }

.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.mtab-btn {
  padding: 9px 11px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.mtab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mtab-panel { display: none; flex-direction: column; gap: 12px; }
.mtab-panel.active { display: flex; }

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
}

.divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.geo-results {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.geo-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
}
.geo-option:hover { border-color: var(--accent); background: var(--accent-soft); }

.swatch-row, .chip-list, .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.active {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.chip-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.chip-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}

.quote-filter-bar { display: flex; flex-direction: column; gap: 8px; }
.quote-picker-list { display: flex; flex-direction: column; gap: 8px; }
.quote-pick-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.quote-pick-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.quote-pick-text { font-size: 13px; line-height: 1.45; margin-bottom: 5px; color: var(--ink); }
.quote-pick-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; }

.error-msg {
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

@media (max-width: 980px) {
  .app-shell { height: auto; overflow: visible; }
  .workspace { grid-template-columns: 1fr; }
  .editor-pane { border-right: none; border-bottom: 1px solid var(--border); }
  .preview-viewport { min-height: 520px; }
}

/* ================================================================
   PRINT STYLES (11in x 8.5in Landscape Half-Fold PDF / Printer)
   ================================================================ */
@media print {
  @page {
    size: 11in 8.5in landscape;
    margin: 0;
  }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
    height: auto !important;
    overflow: visible !important;
  }
  .no-print { display: none !important; }
  .app-shell, .workspace, .preview-pane, .preview-viewport, .sheets-scale-wrap {
    display: block !important;
    height: auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    transform: none !important;
  }
  .sheets-stack { gap: 0 !important; }
  .sheets-stack.show-fold .sheet::after { display: none !important; }
  .sheet {
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
  }
  .sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}
