@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

/* ==========================================
   VARIABLES — LIGHT MODE
   ========================================== */
:root {
  --bg: #EDE7DE;
  --surface: #FFFFFF;
  --surface-raised: #F7F3EE;
  --text: #241F1A;
  --muted: #6E6258;
  --border: #DDD5CA;
  --border-light: #EDE7DE;
  --accent: #FF6B57;
  --accent-hover: #E85A48;
  --support: #C1EB36;
  --support-hover: #B2D830;

  --sidebar-bg: #1C1612;
  --sidebar-text: #F0EBE4;
  --sidebar-muted: #9C9188;
  --sidebar-border: #2E2419;
  --sidebar-hover: #261E18;
  --sidebar-active: #312620;

  /* Typography custom properties */
  --typo-title-font: Manrope, system-ui, sans-serif;
  --typo-body-font: Inter, system-ui, sans-serif;
  --typo-h2-size: 24px;
  --typo-h3-size: 16px;
  --typo-body-size: 13px;
  --typo-line-height: 1.85;
}

/* ==========================================
   DARK MODE
   ========================================== */
html.dark {
  --bg: #15120F;
  --surface: #211B17;
  --surface-raised: #2A221C;
  --text: #F5F1EC;
  --muted: #B8AFA6;
  --border: #332920;
  --border-light: #2A221C;
  --accent: #FF6B57;
  --accent-hover: #E85A48;
  --support: #C1EB36;
  --support-hover: #B2D830;
}

/* ==========================================
   RESET
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================
   APP SHELL
   ========================================== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: 216px;
  min-width: 216px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.sidebar-brand {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.brand-eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  margin-bottom: 3px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-text);
  line-height: 1.2;
}

.brand-version {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 3px;
  letter-spacing: 0.05em;
}

.sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  margin-bottom: 8px;
}

.insert-buttons {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tool-btn {
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  width: 100%;
  font-family: inherit;
}

.tool-btn:hover {
  background: var(--sidebar-hover);
  border-color: #3E3028;
}

.upload-btn {
  display: block;
  background: transparent;
  border: 1px dashed var(--sidebar-border);
  color: var(--sidebar-muted);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, color 0.12s;
  margin-bottom: 8px;
  font-family: inherit;
}

.upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-btn input[type="file"] {
  display: none;
}

.image-gallery {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--sidebar-active);
  border-radius: 5px;
  padding: 5px 7px;
}
.gallery-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
}
.gallery-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gallery-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.gallery-item-name {
  flex: 1;
  font-size: 10px;
  color: var(--sidebar-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.gallery-insert-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  font-family: inherit;
}

.gallery-insert-btn:hover {
  background: var(--accent-hover);
}

.select-input {
  width: 100%;
  background: var(--sidebar-active);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

.select-input:focus {
  border-color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 10px;
  color: var(--sidebar-muted);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ==========================================
   SIDEBAR OVERLAY (mobile)
   ========================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

/* ==========================================
   MAIN AREA
   ========================================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ==========================================
   TOPBAR
   ========================================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.project-title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.project-title-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.project-title-input:focus {
  background: var(--surface-raised);
  border-radius: 5px;
  padding: 4px 8px;
  margin: 0 -8px;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  border: none;
  border-radius: 5px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s, opacity 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--support);
  color: #1A1A1A;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--support-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--text);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 7px 13px;
  font-size: 11px;
}

.icon-btn {
  padding: 6px 8px;
}

/* ==========================================
   CONTENT GRID
   ========================================== */
.content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  overflow: hidden;
  min-height: 0;
}

/* ==========================================
   EDITOR PANEL
   ========================================== */
.editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.panel-header {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  flex-shrink: 0;
  min-height: 38px;
}

.panel-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.subtitle-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.subtitle-input:focus {
  color: var(--text);
}

.syntax-bar {
  padding: 5px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex-shrink: 0;
  background: var(--surface-raised);
  overflow-x: auto;
  scrollbar-width: none;
}
.syntax-bar::-webkit-scrollbar { display: none; }

.syntax-tag {
  font-size: 10px;
  color: var(--muted);
}

.syntax-tag code {
  background: var(--border-light);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: 'Courier New', Courier, monospace;
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
}

.editor-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  padding: 14px;
  font-size: 12.5px;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.75;
  resize: none;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ==========================================
   PREVIEW PANEL
   ========================================== */
.preview-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.page-info {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 32px;
  display: flex;
  justify-content: center;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.preview-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 660px;
}

/* ==========================================
   A4 PAGE
   ========================================== */
.a4-page {
  background: var(--doc-bg, #FFFFFF);
  width: 100%;
  min-height: 920px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  position: relative;
}

.page-header {
  padding: 12px 36px;
  border-bottom: 1px solid #E7DCCF;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9C8F84;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.page-body {
  flex: 1;
  padding: 28px 36px 24px;
  font-family: var(--doc-font, var(--typo-body-font, inherit));
  color: var(--doc-text, #241F1A);
}

.page-footer {
  padding: 11px 36px;
  border-top: 1px solid #E7DCCF;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9C8F84;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* ==========================================
   COVER PAGE
   ========================================== */
.cover-page .page-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px;
  min-height: 400px;
}

.cover-brand {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9C8F84;
  margin-bottom: 52px;
}

.cover-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #FF6B57;
  margin-bottom: 14px;
}

.cover-title {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.1;
  color: #241F1A;
  margin-bottom: 8px;
  max-width: 520px;
}

.cover-rule {
  width: 44px;
  height: 3px;
  background: #FF6B57;
  margin: 20px 0 20px;
}

.cover-subtitle {
  font-size: 15px;
  color: #6E6258;
  line-height: 1.65;
  max-width: 440px;
  margin-bottom: 60px;
}

.cover-colophon {
  font-size: 9px;
  color: #B0A59C;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ==========================================
   INDEX PAGE
   ========================================== */
.index-heading {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9C8F84;
  padding-bottom: 12px;
  border-bottom: 1px solid #E7DCCF;
  margin-bottom: 8px;
}

.index-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid #F2EDE6;
  font-size: 13px;
  color: #241F1A;
  gap: 12px;
}

.index-item-title {
  flex: 1;
}

.index-dots {
  flex: 1;
  border-bottom: 1px dotted #C4BAB2;
  margin: 0 8px 3px;
  min-width: 20px;
}

.index-item-pg {
  font-size: 11px;
  color: #9C8F84;
  font-weight: 600;
  flex-shrink: 0;
}

/* ==========================================
   DOCUMENT CONTENT BLOCKS
   ========================================== */
.doc-chapter {
  font-size: var(--typo-h2-size, 24px);
  font-family: var(--doc-font, var(--typo-title-font, inherit));
  font-weight: 800;
  line-height: 1.15;
  color: var(--doc-text, var(--typo-h2-color, #241F1A));
  margin: 0 0 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid #FF6B57;
}

.doc-subchapter {
  font-size: var(--typo-h3-size, 16px);
  font-family: var(--doc-font, var(--typo-title-font, inherit));
  font-weight: 700;
  color: var(--doc-text, var(--typo-h3-color, #241F1A));
  margin: 22px 0 8px;
  line-height: 1.3;
}

.doc-paragraph {
  font-size: var(--typo-body-size, 13px);
  line-height: var(--typo-line-height, 1.85);
  color: var(--doc-text, var(--typo-body-color, #241F1A));
  margin: 0 0 12px;
}

/* Checklist */
.doc-checklist {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid #E7DCCF;
  border-radius: 6px;
}

.doc-checklist-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 5px 0;
  font-size: var(--typo-body-size, 13px);
  line-height: 1.6;
  color: var(--doc-text, #241F1A);
}

.doc-check {
  width: 15px;
  height: 15px;
  border: 1.5px solid #241F1A;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 3px;
}

.doc-list-marker {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  margin-top: 0;
  font-size: 14px;
  line-height: 1.6;
}

.doc-list-bullet { color: var(--doc-text, #241F1A); }
.doc-list-arrow  { color: var(--accent, #FF6B57); }
.doc-list-dash   { color: var(--doc-text, #241F1A); font-weight: 700; }

/* Caixa prática */
.doc-callout {
  background: #FFF3F0;
  border-left: 3px solid #FF6B57;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--doc-text, #241F1A);
  border-radius: 0 5px 5px 0;
}

/* Block label shared */
.doc-block-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9C8F84;
  margin-bottom: 8px;
}

.doc-block-text {
  font-size: var(--typo-body-size, 13px);
  line-height: var(--typo-line-height, 1.85);
  color: var(--doc-text, #241F1A);
}

/* Exercise */
.doc-exercise {
  background: #F8FFD8;
  border: 1px solid #D5E989;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 14px 0;
}

.doc-exercise .doc-block-label {
  color: #5A7A00;
}

/* Decisão */
.doc-decisao {
  background: #FFF8EE;
  border: 1.5px solid #FF6B57;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 14px 0;
}

.doc-decisao .doc-block-label {
  color: #CC4433;
}

/* Próximo Passo */
.doc-passo {
  background: #F5FFF0;
  border: 1px solid #C1EB36;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 14px 0;
}

.doc-passo .doc-block-label {
  color: #5A7A00;
}

/* Alerta */
.doc-alerta {
  background: #FFF8EE;
  border-left: 3px solid #E8A020;
  padding: 14px 16px;
  margin: 14px 0;
  border-radius: 0 5px 5px 0;
}

.doc-alerta .doc-block-label {
  color: #A06000;
}

/* Table */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 12px;
}

.doc-table th {
  background: #241F1A;
  color: #FFFFFF;
  padding: 8px 12px;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.doc-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #E7DCCF;
  color: var(--doc-text, #241F1A);
  line-height: 1.5;
}

.doc-table tr:nth-child(even) td {
  background: #FAF7F3;
}

/* Image */
.doc-image-wrapper {
  margin: 14px 0;
  overflow: hidden;
  position: relative;
  max-width: 100%;
}

.doc-image-wrapper.full  { width: 100%; }
.doc-image-wrapper.medium { width: 68%; margin-left: auto; margin-right: auto; }
.doc-image-wrapper.left  { float: left; width: 42%; margin: 4px 14px 8px 0; }
.doc-image-wrapper.right { float: right; width: 42%; margin: 4px 0 8px 14px; }

.doc-image-wrapper img {
  width: 100%;
  display: block;
  border-radius: 5px;
}

.doc-image-caption {
  font-size: 10px;
  color: #9C8F84;
  margin-top: 5px;
  text-align: center;
  font-style: italic;
}

.doc-clearfix::after {
  content: '';
  display: table;
  clear: both;
}

/* IMGBOX placeholder */
.doc-imgbox {
  background: #F2EDE6;
  border: 1.5px dashed #C4BAB2;
  border-radius: 6px;
  padding: 28px 20px;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.doc-imgbox-icon {
  font-size: 22px;
  opacity: 0.45;
}

.doc-imgbox-text {
  font-size: 11px;
  color: #9C8F84;
  text-align: center;
  font-style: italic;
}

/* ==========================================
   SIDEBAR DESIGN CONTROLS
   ========================================== */
.design-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.design-label {
  font-size: 10px;
  color: var(--sidebar-muted);
  width: 36px;
  flex-shrink: 0;
}

.color-input {
  width: 32px;
  height: 24px;
  border: 1px solid var(--sidebar-border);
  border-radius: 4px;
  padding: 1px;
  background: var(--sidebar-active);
  cursor: pointer;
  flex-shrink: 0;
}

.select-small {
  padding: 4px 6px;
  font-size: 10px;
}

.design-note {
  font-size: 9px;
  color: var(--sidebar-muted);
  line-height: 1.5;
  margin-top: 6px;
  opacity: 0.7;
}

/* ==========================================
   FILLABLE FIELDS
   ========================================== */
.doc-field-wrapper {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.doc-field-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9C8F84;
}

.doc-field-input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid #241F1A;
  padding: 6px 0;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: #241F1A;
  outline: none;
}

.doc-field-input:focus {
  border-bottom-color: #FF6B57;
}

.doc-field-textarea {
  width: 100%;
  border: 1.5px solid #241F1A;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: #241F1A;
  outline: none;
  resize: vertical;
  line-height: 1.75;
  min-height: 56px;
}

.doc-field-textarea:focus {
  border-color: #FF6B57;
}

.doc-checkfield-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 14px;
  border: 1px solid #E7DCCF;
  border-radius: 5px;
  background: #FAF7F3;
}

.doc-checkfield-input {
  width: 16px;
  height: 16px;
  accent-color: #FF6B57;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.doc-checkfield-label {
  font-size: 13px;
  line-height: 1.6;
  color: var(--doc-text, #241F1A);
  cursor: pointer;
}

/* ==========================================
   IMAGE RESIZE HANDLE
   ========================================== */
.resize-handle {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 3px;
  cursor: nwse-resize;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.doc-image-wrapper:hover .resize-handle {
  display: flex;
}

.resize-handle::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid #FFFFFF;
  border-bottom: 2px solid #FFFFFF;
}

/* ==========================================
   INLINE FORMATTING TOOLBAR
   ========================================== */
.color-toolbar {
  display: none;
  padding: 4px 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.color-toolbar.visible {
  display: flex;
}

.toolbar-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 7px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.4;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s;
}

.toolbar-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.toolbar-btn-i em  { font-style: italic; }
.toolbar-btn-u u   { text-decoration: underline; }

.toolbar-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}

.toolbar-label {
  font-size: 9px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.toolbar-size-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  outline: none;
}

.toolbar-size-select:focus {
  border-color: var(--accent);
}

#inlineColorPicker,
#inlineHighlightPicker {
  width: 26px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================
   PAGE STRIP
   ========================================== */
.design-target-row {
  margin-bottom: 5px;
}

.design-target-label {
  font-size: 9px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.page-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  min-height: 10px;
}

.page-chip {
  min-width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1.5px solid var(--sidebar-border);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6E6258;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: #FFFFFF;
  padding: 0 5px;
}

.page-chip:hover {
  border-color: var(--accent);
}

.page-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 87, 0.25);
  color: var(--accent);
}

.page-chip.all-chip {
  background: transparent;
  color: var(--sidebar-muted);
  border-style: dashed;
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ==========================================
   TEMPLATE GALLERY
   ========================================== */
.template-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.template-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid var(--sidebar-border);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.template-card:hover {
  background: var(--sidebar-hover);
  border-color: #3E3028;
}

.template-card.active {
  background: var(--sidebar-active);
  border-color: var(--accent);
}

.tpl-icon {
  font-size: 15px;
  flex-shrink: 0;
  line-height: 1;
}

.tpl-info {
  min-width: 0;
  flex: 1;
}

.tpl-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-desc {
  font-size: 9px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   TEMPLATE VISUAL OVERRIDES
   ========================================== */

/* Quick Guide — navy blue */
.tpl-guide .doc-chapter {
  color: var(--doc-text, #1A3A8F);
  border-bottom-color: #1A3A8F;
}
.tpl-guide .doc-callout {
  border-left-color: #1A3A8F;
  background: #F0F4FF;
}
.tpl-guide .cover-type { color: #1A3A8F; }
.tpl-guide .cover-rule { background: #1A3A8F; }

/* Checklist Pack — forest green */
.tpl-checklist .doc-chapter {
  color: var(--doc-text, #1A6B3A);
  border-bottom-color: #1A6B3A;
  font-size: 20px;
}
.tpl-checklist .doc-checklist { border-color: #C8E6C9; }
.tpl-checklist .doc-decisao { border-color: #1A6B3A; background: #F0FFF4; }
.tpl-checklist .doc-decisao .doc-block-label { color: #1A6B3A; }
.tpl-checklist .cover-type { color: #1A6B3A; }
.tpl-checklist .cover-rule { background: #1A6B3A; }

/* 7-Day Planner — warm orange */
.tpl-planner .doc-chapter {
  color: var(--doc-text, #C05A00);
  border-bottom-color: #C05A00;
}
.tpl-planner .doc-field-input { border-bottom-color: #C05A00; }
.tpl-planner .doc-field-input:focus { border-bottom-color: #FF8C42; }
.tpl-planner .doc-field-textarea { border-color: #C05A00; }
.tpl-planner .cover-type { color: #C05A00; }
.tpl-planner .cover-rule { background: #C05A00; }

/* Mini Ebook Premium — editorial */
.tpl-miniebook .doc-chapter {
  font-size: 28px;
  letter-spacing: -0.02em;
  border-bottom-width: 1px;
}
.tpl-miniebook .doc-paragraph {
  font-size: 14px;
  line-height: 2;
}
.tpl-miniebook .doc-subchapter { font-size: 18px; }
.tpl-miniebook .cover-title { font-size: 42px; }

/* Tutorial Manual — technical */
.tpl-tutorial .doc-chapter {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 900;
}
.tpl-tutorial .doc-passo {
  border-color: #241F1A;
  background: #F5F5F5;
}
.tpl-tutorial .doc-passo .doc-block-label { color: #241F1A; }
.tpl-tutorial .doc-table th { background: #1A1A2E; }

/* Lead Magnet — bold, high-contrast */
.tpl-leadmagnet .doc-chapter {
  color: var(--doc-text, #FF6B57);
  border-bottom-color: #FF6B57;
  font-size: 26px;
}
.tpl-leadmagnet .doc-callout {
  background: #241F1A;
  color: #F5F1EC;
  border-left-color: #FF6B57;
}
.tpl-leadmagnet .doc-alerta {
  background: #FFF0EE;
  border-left-color: #FF6B57;
}

/* ==========================================
   COVER / HEADER / FOOTER SIDEBAR CONTROLS
   ========================================== */
.text-input-sidebar {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--sidebar-border);
  border-radius: 4px;
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  font-size: 11px;
  font-family: inherit;
  box-sizing: border-box;
  margin-bottom: 4px;
  outline: none;
}
.text-input-sidebar:focus {
  border-color: var(--accent);
}
.text-input-sidebar::placeholder {
  color: var(--sidebar-muted);
  opacity: 0.7;
}

.sidebar-field-label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  margin: 5px 0 2px;
  text-transform: uppercase;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--sidebar-text);
}
.check-row input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.vars-hint {
  font-size: 9px;
  color: var(--sidebar-muted);
  margin-top: 4px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.typo-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.typo-col {
  flex: 1;
  min-width: 60px;
}

/* Collapsible sidebar sections */
.sidebar-section-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toggle-arrow {
  font-size: 8px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.sidebar-section-toggle.collapsed .toggle-arrow {
  transform: rotate(-90deg);
}
.sidebar-collapsible {
  overflow: hidden;
}
.sidebar-collapsible.collapsed {
  display: none;
}

/* New cover elements */
.cover-kit {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--doc-text, #9C8F84);
  margin-bottom: 12px;
}
.cover-promise {
  font-size: 14px;
  color: var(--doc-text, #6E6258);
  font-style: italic;
  margin-top: 16px;
  margin-bottom: 16px;
}

/* 3-column page header/footer layout */
.page-header span:nth-child(2),
.page-footer span:nth-child(2) {
  flex: 1;
  text-align: center;
}

/* Click-to-locate highlight */
.preview-block-active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ==========================================
   PRINT / PDF NÍTIDO
   @page must be at top-level, not inside @media.
   ========================================== */
@page {
  size: A4;
  margin: 0;
}

@media print {
  /* Exact colour reproduction — no browser colour-washing */
  * {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  /* Hide every UI element except the preview */
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .editor-panel,
  .panel-header,
  .color-toolbar,
  .syntax-bar,
  .resize-handle,
  .quick-blocks-bar,
  .preview-hint,
  .mobile-tabs,
  #onboardingOverlay,
  .project-status {
    display: none !important;
  }

  .preview-block-active {
    outline: none !important;
  }

  /* Un-clip the layout so every page renders */
  html, body {
    overflow: visible !important;
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .app {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    width: 100% !important;
  }

  .content {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    grid-template-columns: unset !important;
  }

  .preview-panel {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .preview-scroll {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    height: auto !important;
  }

  .preview-container {
    display: block !important;
    gap: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Each .a4-page = one printed A4 page */
  .a4-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 0 !important;
    max-height: 297mm !important;
    overflow: hidden !important;
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  /* Last page — let the browser end the document naturally (avoid creates a blank page on some engines) */
  .a4-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }
}

/* ==========================================
   PDF EXPORT MODE
   ========================================== */
.pdf-export-mode * {
  transition: none !important;
  animation: none !important;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1100px) {
  .content {
    grid-template-columns: 1fr;
    grid-template-rows: 50vh 50vh;
  }

  .editor-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .content {
    grid-template-rows: auto auto;
    height: auto;
    overflow: visible;
  }

  .editor-panel,
  .preview-panel {
    overflow: visible;
    height: auto;
  }

  .editor-textarea {
    min-height: 280px;
    overflow: visible;
    height: auto;
    resize: vertical;
  }

  .preview-scroll {
    height: auto;
    overflow: visible;
    padding: 16px 10px 24px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .project-title-input {
    font-size: 13px;
  }

  .a4-page {
    min-height: auto;
  }
}

/* ==========================================
   V4 — SIMPLE / ADVANCED MODE
   ========================================== */
.advanced-only {
  display: none;
}

body.advanced-mode .advanced-only {
  display: block;
}

/* ==========================================
   V4 — MODE TOGGLE
   ========================================== */
.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.mode-btn {
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.mode-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ==========================================
   V4 — ADVANCED SECTION STYLES
   ========================================== */
.adv-section-wrapper {
  padding-bottom: 6px;
}

.adv-section-heading {
  margin-bottom: 6px;
}

.adv-group {
  margin-bottom: 2px;
}

.adv-toggle {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--sidebar-text);
  padding: 5px 0;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.adv-toggle:hover {
  color: var(--accent);
}

.adv-group .sidebar-collapsible {
  padding-top: 6px;
  padding-bottom: 4px;
}

.adv-extra-btns {
  margin-top: 4px;
  border-top: 1px dashed var(--sidebar-border);
  padding-top: 4px;
}

/* ==========================================
   V4 — EXPORT SECTION
   ========================================== */
.sidebar-export-section {
  background: transparent;
}

.export-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==========================================
   V4 — QUICK BLOCKS BAR
   ========================================== */
.quick-blocks-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.quick-blocks-bar::-webkit-scrollbar {
  display: none;
}

.qb-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 2px;
}

.qb-btn {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
}

.qb-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-raised);
}

/* ==========================================
   V4 — PROJECT STATUS BAR
   ========================================== */
.project-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.status-dot {
  font-size: 10px;
}

.status-dot.status-saved {
  color: var(--muted);
}

.status-dot.status-unsaved {
  color: var(--accent);
  font-weight: 600;
}

.status-sep {
  color: var(--border);
  font-size: 11px;
}

/* ==========================================
   V4 — ONBOARDING OVERLAY
   ========================================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-overlay.hidden {
  display: none;
}

.onboarding-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 40px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.onboarding-brand {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.onboarding-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 6px;
}

.onboarding-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.onboarding-steps {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.onboarding-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.onboarding-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  margin: 0 auto 8px;
}

.onboarding-step-text strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 2px;
}

.onboarding-actions {
  display: flex;
  gap: 8px;
}

.onboarding-actions .btn {
  flex: 1;
  justify-content: center;
}

/* ==========================================
   V4 — MOBILE TABS
   ========================================== */
.mobile-tabs {
  display: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.mobile-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  font-family: inherit;
}

.mobile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.mobile-tab:hover:not(.active) {
  color: var(--text);
}

@media (max-width: 768px) {
  .mobile-tabs {
    display: flex;
  }

  .editor-panel.mobile-hidden,
  .preview-panel.mobile-hidden {
    display: none !important;
  }
}

/* ==========================================
   V4 — PREVIEW HINT
   ========================================== */
.preview-hint {
  padding: 5px 20px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.preview-hint-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-hint-tip {
  font-size: 9px;
  color: var(--muted);
  opacity: 0.7;
  font-style: italic;
}

/* ==========================================
   V5 — SIDEBAR FOOTER (override for nested structure)
   ========================================== */
.sidebar-footer { padding: 0; font-size: inherit; color: inherit; }

/* ==========================================
   V5 — SYNTAX BAR (hidden in simple mode)
   ========================================== */
.syntax-bar { display: none; }
body.advanced-mode .syntax-bar { display: flex; }

/* ==========================================
   V5 — EDITOR HINT
   ========================================== */
.editor-hint {
  padding: 4px 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-light);
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  flex-shrink: 0;
}
.editor-hint-adv { display: none; }
body.advanced-mode .editor-hint-simple { display: none; }
body.advanced-mode .editor-hint-adv    { display: inline; }

/* ==========================================
   V5 — PRESET DESCRIPTION
   ========================================== */
.preset-desc {
  font-size: 9px;
  color: var(--sidebar-muted);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.5;
  min-height: 22px;
}

/* ==========================================
   V5 — PRIVACY NOTE
   ========================================== */
.sidebar-privacy-note {
  font-size: 8.5px;
  color: var(--sidebar-muted);
  line-height: 1.6;
  padding: 6px 14px 2px;
  opacity: 0.75;
}
.sidebar-footer-brand {
  font-size: 9px;
  color: var(--sidebar-muted);
  padding: 2px 14px 8px;
}

/* ==========================================
   V5 — PREVIEW ZOOM
   ========================================== */
.preview-zoom-select {
  font-size: 9px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  outline: none;
}
.preview-zoom-select:focus { border-color: var(--accent); }

/* ==========================================
   V5 — EXPORT DIVIDER
   ========================================== */
.export-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 3px 0;
}

/* ==========================================
   V5 — THEME CLASSES
   Base accent vars used by chapter/box styles
   ========================================== */
.theme-bbd         { --cs-accent:#FF6B57; --cs-box-bg:#FFF3F1; --bs-fill:#FFF3F1; }
.theme-cleanebook  { --cs-accent:#1a1a1a; --cs-box-bg:#f0f0f0; --bs-fill:#f5f5f5; --bs-border:#c0c0c0; }
.theme-workboompremium { --cs-accent:#1A1A3E; --cs-box-bg:#eeeefc; --bs-fill:#eeeef8; --bs-border:#2D2D6E; }
.theme-techpro     { --cs-accent:#1E3A5F; --cs-box-bg:#eaf0f8; --bs-fill:#eaf0f8; --bs-border:#2B5180; }
.theme-planner     { --cs-accent:#5B4FCF; --cs-box-bg:#f0eeff; --bs-fill:#f0eeff; --bs-border:#7B6FEF; }
.theme-recipe      { --cs-accent:#5c3317; --cs-box-bg:#fbf4ee; --bs-fill:#fbf4ee; --bs-border:#c8a882; }
.theme-fitness     { --cs-accent:#cc0000; --cs-box-bg:#fff0f0; --bs-fill:#fff0f0; --bs-border:#e53935; }
.theme-magazine    { --cs-accent:#0d0d0d; --cs-box-bg:#f5f5f5; --bs-fill:#f5f5f5; --bs-border:#1a1a1a; }
.theme-softfem     { --cs-accent:#8B4A62; --cs-box-bg:#fdf2f6; --bs-fill:#fdf0f5; --bs-border:#d4a0b0; }
.theme-boldmodern  { --cs-accent:#0057FF; --cs-box-bg:#eaf0ff; --bs-fill:#eaf0ff; --bs-border:#1A6AFF; }

/* ---- Clean Ebook ---- */
.theme-cleanebook .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #1a1a1a));
  border-bottom: 1px solid #d0d0d0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.theme-cleanebook .doc-subchapter { color: var(--doc-text, var(--typo-h3-color, #333)); font-weight: 600; }
.theme-cleanebook .doc-exercise   { background:#f7f7f7; border-left:3px solid #999; border-radius:0; }
.theme-cleanebook .doc-exercise .doc-block-label { color:#555; }
.theme-cleanebook .doc-callout    { background:#f0f0f0; border-left:3px solid #888; }
.theme-cleanebook .doc-alerta     { background:#fafafa; border-left:3px solid #aaa; }
.theme-cleanebook .doc-decisao    { background:#f5f5f5; border-color:#777; }
.theme-cleanebook .doc-decisao .doc-block-label { color:#444; }
.theme-cleanebook .doc-passo      { background:#f0f0f0; border-color:#999; }
.theme-cleanebook .cover-type     { color:#1a1a1a; }
.theme-cleanebook .cover-rule     { background:#1a1a1a; }

/* ---- Workbook Premium ---- */
.theme-workboompremium .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #1A1A3E));
  border-bottom: 3px solid #1A1A3E;
}
.theme-workboompremium .doc-subchapter { color: var(--doc-text, var(--typo-h3-color, #2D2D6E)); }
.theme-workboompremium .doc-exercise   { background:#eeeef8; border-left:4px solid #1A1A3E; }
.theme-workboompremium .doc-exercise .doc-block-label { color:#1A1A3E; }
.theme-workboompremium .doc-callout    { background:#1A1A3E; color:#F5F1EC; border-left:4px solid #C9AA71; }
.theme-workboompremium .doc-callout *  { color:#F5F1EC; }
.theme-workboompremium .doc-alerta     { background:#fff8e1; border-left:4px solid #F5A623; }
.theme-workboompremium .doc-decisao    { background:#eeeef8; border-color:#1A1A3E; }
.theme-workboompremium .doc-decisao .doc-block-label { color:#1A1A3E; }
.theme-workboompremium .doc-passo      { background:#f5f5ff; border-color:#1A1A3E; }
.theme-workboompremium .doc-passo .doc-block-label { color:#1A1A3E; }
.theme-workboompremium .cover-type     { color:#1A1A3E; }
.theme-workboompremium .cover-rule     { background:#C9AA71; }

/* ---- Manual Técnico Pro ---- */
.theme-techpro .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #1E3A5F));
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  border-bottom: 2px solid #1E3A5F;
}
.theme-techpro .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #2B5180)); font-size:13px; font-weight:700; }
.theme-techpro .doc-exercise   { background:#eaf0f8; border-left:4px solid #1E3A5F; border-radius:0; }
.theme-techpro .doc-exercise .doc-block-label { color:#1E3A5F; }
.theme-techpro .doc-callout    { background:#f0f5fb; border-left:3px solid #2B5180; }
.theme-techpro .doc-alerta     { background:#fff0e0; border-left:4px solid #c07020; }
.theme-techpro .doc-decisao    { background:#eaf0f8; border-color:#1E3A5F; }
.theme-techpro .doc-decisao .doc-block-label { color:#1E3A5F; }
.theme-techpro .doc-passo      { background:#f5f9ff; border-color:#2B5180; }
.theme-techpro .cover-type     { color:#1E3A5F; }
.theme-techpro .cover-rule     { background:#1E3A5F; }

/* ---- Planner Amigável ---- */
.theme-planner .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #5B4FCF));
  border-bottom: 2px solid #5B4FCF;
  font-weight: 700;
}
.theme-planner .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #7B6FEF)); }
.theme-planner .doc-exercise   { background:#f0eeff; border-left:4px solid #5B4FCF; border-radius:8px; }
.theme-planner .doc-exercise .doc-block-label { color:#5B4FCF; }
.theme-planner .doc-callout    { background:#f7f5ff; border-left:3px solid #7B6FEF; border-radius:6px; }
.theme-planner .doc-alerta     { background:#fff5f0; border-left:3px solid #ff8c42; border-radius:6px; }
.theme-planner .doc-decisao    { background:#f5f0ff; border-color:#5B4FCF; border-radius:6px; }
.theme-planner .doc-decisao .doc-block-label { color:#5B4FCF; }
.theme-planner .doc-checklist  { border-color:#c8b8ff; border-radius:8px; }
.theme-planner .cover-type     { color:#5B4FCF; }
.theme-planner .cover-rule     { background:#5B4FCF; }

/* ---- Receita / Lifestyle ---- */
.theme-recipe .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #5c3317));
  border-bottom: 1px solid #c8a882;
  font-family: Georgia, serif;
  font-style: italic;
  letter-spacing: 0.01em;
}
.theme-recipe .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #7a4422)); font-family:Georgia,serif; font-style:italic; }
.theme-recipe .doc-paragraph  { color:var(--doc-text, var(--typo-body-color, #2d1f0e)); font-family:Georgia,serif; }
.theme-recipe .doc-exercise   { background:#fbf4ee; border-left:3px solid #c8a882; border-radius:4px; }
.theme-recipe .doc-exercise .doc-block-label { color:#5c3317; }
.theme-recipe .doc-callout    { background:#fdf7f0; border-left:3px solid #c8a882; }
.theme-recipe .doc-alerta     { background:#fff8f0; border-left:3px solid #d4884a; }
.theme-recipe .doc-decisao    { background:#fbf4ee; border-color:#c8a882; }
.theme-recipe .doc-decisao .doc-block-label { color:#5c3317; }
.theme-recipe .doc-checklist  { border-color:#e8d5be; }
.theme-recipe .cover-type     { color:#5c3317; }
.theme-recipe .cover-rule     { background:#c8a882; }
.theme-recipe .cover-title    { font-family:Georgia,serif; font-style:italic; }

/* ---- Fitness / Energia ---- */
.theme-fitness .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #cc0000));
  border-bottom: 3px solid #cc0000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 900;
}
.theme-fitness .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #e53935)); font-weight:700; }
.theme-fitness .doc-exercise   { background:#fff0f0; border-left:4px solid #cc0000; }
.theme-fitness .doc-exercise .doc-block-label { color:#cc0000; font-weight:800; }
.theme-fitness .doc-callout    { background:#1a1a1a; color:#F5F1EC; border-left:4px solid #cc0000; }
.theme-fitness .doc-callout *  { color:#F5F1EC; }
.theme-fitness .doc-alerta     { background:#fff0f0; border-left:4px solid #e53935; }
.theme-fitness .doc-decisao    { background:#fff0f0; border-color:#cc0000; }
.theme-fitness .doc-decisao .doc-block-label { color:#cc0000; font-weight:800; }
.theme-fitness .doc-passo      { background:#fff5f5; border-color:#e53935; }
.theme-fitness .cover-type     { color:#cc0000; }
.theme-fitness .cover-rule     { background:#cc0000; }

/* ---- Magazine / Editorial Wow ---- */
.theme-magazine .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #0d0d0d));
  border-bottom: 2px solid #0d0d0d;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.theme-magazine .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #1a1a1a)); font-family:Georgia,serif; font-size:17px; font-weight:400; font-style:italic; }
.theme-magazine .doc-exercise   { background:#f5f5f5; border:1px solid #1a1a1a; border-radius:0; }
.theme-magazine .doc-exercise .doc-block-label { color:#0d0d0d; font-size:9px; letter-spacing:0.18em; text-transform:uppercase; }
.theme-magazine .doc-callout    { background:#0d0d0d; color:#F5F1EC; border-left:none; font-family:Georgia,serif; font-style:italic; }
.theme-magazine .doc-callout *  { color:#F5F1EC; }
.theme-magazine .doc-alerta     { background:#f8f8f8; border-left:2px solid #888; }
.theme-magazine .doc-decisao    { background:#f5f5f5; border-color:#0d0d0d; }
.theme-magazine .doc-decisao .doc-block-label { letter-spacing:0.12em; text-transform:uppercase; font-size:9px; }
.theme-magazine .cover-type     { color:#0d0d0d; font-family:Georgia,serif; font-style:italic; }
.theme-magazine .cover-rule     { background:#0d0d0d; }
.theme-magazine .cover-title    { font-family:Georgia,serif; }

/* ---- Soft Feminine Guide ---- */
.theme-softfem .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #8B4A62));
  border-bottom: 1px solid #d4a0b0;
  font-family: Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.theme-softfem .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #A65E78)); font-family:Georgia,serif; font-style:italic; }
.theme-softfem .doc-exercise   { background:#fdf0f5; border-left:3px solid #d4a0b0; border-radius:6px; }
.theme-softfem .doc-exercise .doc-block-label { color:#8B4A62; }
.theme-softfem .doc-callout    { background:#fdf7fa; border-left:3px solid #d4a0b0; border-radius:6px; }
.theme-softfem .doc-alerta     { background:#fff5f8; border-left:3px solid #c98ea0; border-radius:6px; }
.theme-softfem .doc-decisao    { background:#fdf0f5; border-color:#d4a0b0; border-radius:6px; }
.theme-softfem .doc-decisao .doc-block-label { color:#8B4A62; }
.theme-softfem .doc-checklist  { border-color:#eecddb; border-radius:8px; }
.theme-softfem .cover-type     { color:#8B4A62; }
.theme-softfem .cover-rule     { background:#d4a0b0; }

/* ---- Bold Modern Course ---- */
.theme-boldmodern .doc-chapter {
  color: var(--doc-text, var(--typo-h2-color, #0057FF));
  border-bottom: 3px solid #0057FF;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.theme-boldmodern .doc-subchapter { color:var(--doc-text, var(--typo-h3-color, #1A6AFF)); font-weight:700; }
.theme-boldmodern .doc-exercise   { background:#eaf0ff; border-left:4px solid #0057FF; }
.theme-boldmodern .doc-exercise .doc-block-label { color:#0057FF; font-weight:800; }
.theme-boldmodern .doc-callout    { background:#001a66; color:#fff; border-left:4px solid #0057FF; }
.theme-boldmodern .doc-callout *  { color:#fff; }
.theme-boldmodern .doc-alerta     { background:#fff8e0; border-left:4px solid #ff9900; }
.theme-boldmodern .doc-decisao    { background:#eaf0ff; border-color:#0057FF; }
.theme-boldmodern .doc-decisao .doc-block-label { color:#0057FF; font-weight:800; }
.theme-boldmodern .doc-passo      { background:#f0f5ff; border-color:#0057FF; }
.theme-boldmodern .doc-passo .doc-block-label { color:#0057FF; }
.theme-boldmodern .cover-type     { color:#0057FF; }
.theme-boldmodern .cover-rule     { background:#0057FF; }

/* ==========================================
   V5 — CHAPTER STYLES (data attribute)
   ========================================== */
[data-chapter-style="minimal"] .doc-chapter {
  border-bottom: none !important;
  padding-bottom: 2px;
}
[data-chapter-style="boldline"] .doc-chapter {
  border-bottom: none !important;
  border-left: 5px solid var(--cs-accent, var(--accent, #FF6B57));
  padding-left: 14px;
  padding-bottom: 4px;
}
[data-chapter-style="centered"] .doc-chapter {
  text-align: center;
  border-bottom: none !important;
  padding-bottom: 6px;
}
[data-chapter-style="box"] .doc-chapter {
  border-bottom: none !important;
  border-left: 4px solid var(--cs-accent, var(--accent, #FF6B57));
  background: var(--cs-box-bg, #FFF3F1);
  padding: 8px 14px;
  border-radius: 0 4px 4px 0;
}

/* ==========================================
   V5 — BOX STYLES (data attribute)
   ========================================== */
[data-box-style="bordered"] .doc-exercise,
[data-box-style="bordered"] .doc-callout,
[data-box-style="bordered"] .doc-alerta,
[data-box-style="bordered"] .doc-decisao,
[data-box-style="bordered"] .doc-passo {
  border: 1.5px solid var(--cs-accent, var(--border, #DDD5CA));
  border-left-width: 1.5px;
  background: transparent;
  border-radius: 4px;
}
[data-box-style="filled"] .doc-exercise,
[data-box-style="filled"] .doc-callout,
[data-box-style="filled"] .doc-alerta,
[data-box-style="filled"] .doc-decisao,
[data-box-style="filled"] .doc-passo {
  background: var(--bs-fill, #F5F5F5);
}
[data-box-style="premium"] .doc-exercise,
[data-box-style="premium"] .doc-callout,
[data-box-style="premium"] .doc-alerta,
[data-box-style="premium"] .doc-decisao,
[data-box-style="premium"] .doc-passo {
  box-shadow: 0 2px 14px rgba(0,0,0,0.09);
  border-radius: 10px;
  border-left-width: 4px;
}

/* ==========================================
   V5 — PRINT: hide new UI elements
   ========================================== */
@media print {
  .editor-hint,
  .preset-desc,
  .sidebar-privacy-note,
  .preview-zoom-select,
  #newProjectBtn,
  #exportJsonBtn,
  .export-divider {
    display: none !important;
  }
  /* Ensure preview zoom doesn't affect print */
  #previewContainer { zoom: 1 !important; transform: none !important; }
}

/* ==========================================
   V6 — NO-PRINT UTILITY
   ========================================== */
@media print {
  .no-print,
  #v6Shell,
  #v6BottomNav,
  #topbarDashBtn,
  #topbarExportBtn {
    display: none !important;
  }
  #editorView {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* ==========================================
   V6 — EDITOR VIEW WRAPPER
   ========================================== */
#editorView {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#editorView .app {
  flex: 1;
  min-height: 0;
}

/* ==========================================
   V6 — TOPBAR NAV BUTTONS (editor topbar)
   ========================================== */
.topbar-nav-btn {
  font-size: 11px;
  padding: 4px 10px;
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--muted);
}

.topbar-export-btn {
  font-size: 11px;
  padding: 5px 12px;
  flex-shrink: 0;
}

/* ==========================================
   V6 — TOP NAV (dashboard + export views)
   ========================================== */
.v6-top-nav {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.v6-nav-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.v6-nav-eye {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.v6-nav-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.v6-nav-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 107, 87, 0.12);
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

.v6-nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.v6-tab {
  background: transparent;
  border: none;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.v6-tab:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.v6-tab.active {
  background: var(--surface-raised);
  color: var(--accent);
}

.v6-nav-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ==========================================
   V6 — WELCOME VIEW
   ========================================== */
.welcome-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #1C1612 0%, #2A1F18 40%, #1A1A3E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.welcome-wrap {
  width: 100%;
  max-width: 520px;
}

.welcome-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 48px 40px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
}

.welcome-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.welcome-brand-eye {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.welcome-brand-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.welcome-brand-v {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 107, 87, 0.12);
  padding: 2px 7px;
  border-radius: 20px;
}

.welcome-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 14px;
  font-family: Manrope, system-ui, sans-serif;
}

.welcome-sub {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 28px;
}

.welcome-benefits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 32px;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.benefit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-welcome-primary {
  width: 100%;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, transform 0.1s;
  letter-spacing: 0.02em;
}

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

.btn-welcome-ghost {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.btn-welcome-ghost:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.welcome-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  opacity: 0.65;
  line-height: 1.5;
}

/* ==========================================
   V6 — DASHBOARD VIEW
   ========================================== */
.dashboard-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-topbar-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-dash-primary {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, transform 0.1s;
}

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

.btn-dash-ghost {
  padding: 10px 18px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.btn-dash-ghost:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.dash-section {
  margin-bottom: 48px;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: Manrope, system-ui, sans-serif;
}

/* Project cards grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  cursor: pointer;
}

.project-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card-thumb {
  height: 72px;
  background: linear-gradient(135deg, var(--surface-raised), var(--border-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.project-card-body {
  flex: 1;
  min-width: 0;
}

.project-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.project-card-status {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--surface-raised);
  color: var(--muted);
}

.project-card-status.status-draft {
  background: rgba(255, 107, 87, 0.1);
  color: var(--accent);
}

.project-card-status.status-exported {
  background: rgba(193, 235, 54, 0.15);
  color: #5A7A00;
}

.project-card-footer {
  display: flex;
  gap: 8px;
  align-items: center;
}

.project-card-open {
  flex: 1;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}

.project-card-open:hover { background: var(--accent-hover); }

.project-card-menu {
  display: flex;
  gap: 4px;
}

.project-card-menu-btn {
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.project-card-menu-btn:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.project-card-menu-btn.danger:hover {
  background: rgba(255, 60, 60, 0.1);
  color: #cc3333;
  border-color: #cc3333;
}

/* Empty state */
.projects-empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.empty-illustration {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  font-family: Manrope, system-ui, sans-serif;
}

.empty-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Dashboard templates grid */
.dash-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.dash-tpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.12s, border-color 0.12s;
  cursor: pointer;
}

.dash-tpl-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.dash-tpl-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

.dash-tpl-info {
  flex: 1;
  min-width: 0;
}

.dash-tpl-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-tpl-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-tpl-btn {
  padding: 5px 11px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.dash-tpl-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ==========================================
   V6 — EXPORT VIEW
   ========================================== */
.export-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.export-header-block {
  margin-bottom: 40px;
}

.btn-export-back {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s;
}

.btn-export-back:hover { color: var(--text); }

.export-title-block { margin-top: 8px; }

.export-main-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  font-family: Manrope, system-ui, sans-serif;
  line-height: 1.15;
}

.export-main-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.export-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.export-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: box-shadow 0.12s, border-color 0.12s;
}

.export-card:hover:not(.export-card-disabled) {
  border-color: var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.export-card-disabled {
  opacity: 0.45;
}

.export-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.export-card-icon {
  font-size: 26px;
  flex-shrink: 0;
  line-height: 1;
}

.export-card-info {
  flex: 1;
  min-width: 0;
}

.export-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.export-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.btn-export-primary {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.12s;
  white-space: nowrap;
}

.btn-export-primary:hover { background: var(--accent-hover); }

.btn-export-ghost {
  padding: 10px 20px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.btn-export-ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--text);
}

.btn-export-ghost:disabled { cursor: not-allowed; opacity: 0.5; }

/* ==========================================
   V6 — MOBILE BOTTOM NAV
   ========================================== */
.v6-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 769px) {
  .v6-bottom-nav { display: none !important; }
}

.v6-bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  transition: color 0.12s;
}

.v6-bottom-tab.active { color: var(--accent); }
.v6-bottom-tab:hover { color: var(--text); }

.v6-bottom-icon {
  font-size: 18px;
  line-height: 1;
}

.v6-bottom-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ==========================================
   V6 — RESPONSIVE ADJUSTMENTS
   ========================================== */
@media (max-width: 768px) {
  .welcome-card {
    padding: 32px 24px 28px;
  }
  .welcome-title { font-size: 22px; }
  .welcome-benefits { grid-template-columns: 1fr; gap: 8px; }

  .dashboard-wrap { padding: 20px 16px 80px; }
  .dash-topbar { margin-bottom: 20px; }
  .projects-grid { grid-template-columns: 1fr; }
  .dash-templates-grid { grid-template-columns: 1fr 1fr; }
  .dash-section-title { font-size: 14px; }

  .export-wrap { padding: 28px 16px 80px; }
  .export-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .export-main-title { font-size: 22px; }

  .v6-top-nav { padding: 0 14px; gap: 10px; }
  .v6-nav-eye { display: none; }
  .v6-nav-tabs { gap: 0; }
  .v6-tab { padding: 7px 11px; font-size: 11px; }
}

@media (max-width: 480px) {
  .dash-templates-grid { grid-template-columns: 1fr; }
  .welcome-card { border-radius: 14px; }
  .export-card { padding: 18px; }
}

/* ==========================================
   V6.1 — EDITOR STEPS BAR
   ========================================== */
.editor-steps-bar {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 2px;
}

.step-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.step-btn:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.step-btn.step-active {
  color: var(--accent);
}

.step-sep {
  font-size: 11px;
  color: var(--border);
  padding: 0 2px;
  user-select: none;
}

/* ==========================================
   V6.1 — TOPBAR SAVE BUTTON
   ========================================== */
.topbar-save-btn {
  font-size: 11px;
  padding: 5px 12px;
  flex-shrink: 0;
}

/* ==========================================
   V6.1 — QUICK BLOCKS IMPROVEMENTS
   ========================================== */
.qb-btn {
  font-size: 11px;
  padding: 4px 10px;
}

.qb-more-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
  margin-left: 4px;
}

.qb-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-raised);
}

#qbMoreGroup {
  display: none;
  gap: 4px;
  align-items: center;
}

body:not(.advanced-mode) #qbMoreGroup {
  display: none !important;
}

body.advanced-mode #qbMoreGroup.open {
  display: flex;
}

/* ==========================================
   V6.1 — EDITOR EMPTY STATE
   ========================================== */
.editor-empty-state {
  margin: 12px 14px 0;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(255, 107, 87, 0.04), rgba(193, 235, 54, 0.06));
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.empty-state-inner {
  flex: 1;
}

.empty-state-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-family: Manrope, system-ui, sans-serif;
}

.empty-state-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.empty-state-btn {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}

.empty-state-btn:hover {
  background: var(--accent-hover);
}

/* ==========================================
   V6.1 — PREVIEW HEADER
   ========================================== */
.page-info {
  font-weight: 600;
  color: var(--text);
  font-size: 11px;
  flex: 1;
  margin-left: 8px;
}

/* ==========================================
   V6.1 — PRINT SAFETY
   ========================================== */
@media print {
  #editorStepsBar,
  .editor-empty-state {
    display: none !important;
  }
}

/* ==========================================
   V6.1 — MOBILE ADJUSTMENTS
   ========================================== */
@media (max-width: 768px) {
  .editor-steps-bar {
    padding: 0 10px;
  }
  .step-btn {
    padding: 3px 7px;
    font-size: 10px;
  }
  .topbar-save-btn {
    display: none;
  }
  .quick-blocks-bar {
    padding: 5px 8px;
    gap: 3px;
  }
}

/* ==========================================
   V6.2 — EDITOR UX POLISH
   ========================================== */

/* ---- CSS-only tooltips ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 20, 16, 0.92);
  color: #F0EBE4;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }
@media print { [data-tooltip]::after { display: none !important; } }

/* ---- Sidebar section titles ---- */
.sidebar-section-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(240, 235, 228, 0.5);
  margin-bottom: 10px;
}

/* ---- Template cards ---- */
.template-card {
  border-radius: 7px;
  padding: 8px 9px;
  border: 1px solid transparent;
}
.template-card:hover {
  border-color: var(--sidebar-border);
}
.template-card.active {
  background: rgba(255, 107, 87, 0.12);
  border-color: rgba(255, 107, 87, 0.4);
}
.tpl-name { font-size: 11px; }
.tpl-desc { font-size: 9.5px; }

/* ---- Sidebar insert buttons ---- */
.tool-btn {
  padding: 7px 10px;
  font-size: 11.5px;
  border-radius: 6px;
  letter-spacing: -0.01em;
}
.tool-btn:hover {
  background: var(--sidebar-active);
  border-color: rgba(255, 107, 87, 0.25);
  color: var(--sidebar-text);
}
.insert-buttons { gap: 4px; }

/* ---- Format description ---- */
.format-desc {
  font-size: 10px;
  color: var(--sidebar-muted);
  line-height: 1.5;
  margin-top: 6px;
  min-height: 14px;
  font-style: italic;
}
.format-blocks-hint {
  font-size: 9px;
  color: rgba(193, 235, 54, 0.65);
  line-height: 1.4;
  margin-top: 3px;
  letter-spacing: 0.01em;
}

/* ---- Quick blocks recommended ---- */
.qb-btn.qb-recommended {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  background: rgba(255, 107, 87, 0.06);
}

/* ---- Mode toggle pill ---- */
.mode-toggle {
  flex-direction: row;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 2px;
  gap: 1px;
}
.mode-btn {
  border: none;
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 9.5px;
}
.mode-btn.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 4px rgba(255, 107, 87, 0.3);
}

/* ---- Select input ---- */
.select-input {
  border-radius: 6px;
  font-size: 11.5px;
}

/* ---- Sidebar export buttons ---- */
#saveBtn {
  background: var(--support);
  color: #1A1A1A;
  border: none;
  font-weight: 700;
}
#saveBtn:hover:not(:disabled) {
  background: var(--support-hover);
}
#exportBtn {
  font-size: 12px;
  padding: 8px 14px;
  letter-spacing: 0.01em;
}

/* ---- Topbar save btn (green) ---- */
.topbar-save-btn {
  background: var(--support);
  color: #1A1A1A;
  border: none;
  font-weight: 700;
}
.topbar-save-btn:hover:not(:disabled) {
  background: var(--support-hover);
  transform: translateY(-1px);
}

/* ---- Sidebar field label ---- */
.sidebar-field-label {
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* ---- Steps bar refined ---- */
.editor-steps-bar {
  background: var(--surface-raised);
  border-bottom-color: var(--border-light);
}
.step-btn.step-active {
  font-weight: 700;
  background: rgba(255, 107, 87, 0.08);
  border-radius: 4px;
}

/* ---- Mobile: hide tooltip on touch ---- */
@media (max-width: 768px) {
  [data-tooltip]::after { display: none; }
}

/* ==========================================
   V6.3 — STEPS BAR PILL REFINEMENTS
   ========================================== */
.editor-steps-bar {
  background: var(--surface);
  border-bottom-color: var(--border-light);
  padding: 0 16px;
  gap: 2px;
  height: 40px;
}
.step-sep {
  color: var(--border);
  font-size: 11px;
  padding: 0 2px;
  user-select: none;
}
.step-btn {
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}
.step-btn:hover:not(.step-active) {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
}
.step-btn.step-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 107, 87, 0.25);
}
@media (max-width: 768px) {
  .step-btn { padding: 4px 10px; font-size: 10px; }
  .editor-steps-bar { height: 36px; }
}

/* ==========================================
   V6.3 — THEME: LUXE DARK EDITORIAL
   ========================================== */
.theme-luxedark { --cs-accent: #FF6B57; --cs-box-bg: #1C1820; --bs-fill: #1C1820; --bs-border: #FF6B57; }
.theme-luxedark .doc-chapter {
  color: #F6F0E8;
  border-bottom: 1px solid rgba(255, 107, 87, 0.35);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.theme-luxedark .doc-subchapter { color: #D4C8BC; font-weight: 600; }
.theme-luxedark .doc-paragraph  { color: #C8BFBA; }
.theme-luxedark .doc-exercise   { background: #1C1820; border-left: 3px solid #FF6B57; border-radius: 4px; }
.theme-luxedark .doc-exercise .doc-block-label { color: #FF6B57; font-weight: 700; }
.theme-luxedark .doc-callout    { background: #1A1820; border-left: 4px solid #C1EB36; color: #F6F0E8; }
.theme-luxedark .doc-callout *  { color: #F6F0E8; }
.theme-luxedark .doc-alerta     { background: #1a0f10; border-left: 3px solid #FF6B57; }
.theme-luxedark .doc-alerta .doc-block-label { color: #FF6B57; }
.theme-luxedark .doc-decisao    { background: #1C1820; border-color: rgba(255, 107, 87, 0.4); }
.theme-luxedark .doc-decisao .doc-block-label { color: #FF6B57; }
.theme-luxedark .doc-passo      { background: #0f1820; border-color: #C1EB36; }
.theme-luxedark .doc-passo .doc-block-label { color: #C1EB36; }
.theme-luxedark .cover-type     { color: #FF6B57; }
.theme-luxedark .cover-rule     { background: #FF6B57; }
.theme-luxedark .cover-title    { color: #F6F0E8; }
.theme-luxedark .cover-subtitle { color: #C8BFBA; }
.theme-luxedark .cover-promise  { color: rgba(246, 240, 232, 0.6); }

/* ==========================================
   V6.3 — THEME: WARM RECIPE BOOK
   ========================================== */
.theme-warmrecipe { --cs-accent: #A55233; --cs-box-bg: #FFF0D4; --bs-fill: #FFF0D4; --bs-border: #C87840; }
.theme-warmrecipe .doc-chapter {
  color: #4A2A18;
  border-bottom: 2px solid #C87840;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.theme-warmrecipe .doc-subchapter { color: #A55233; font-family: Georgia, serif; font-weight: 600; }
.theme-warmrecipe .doc-paragraph  { color: #3D2010; font-family: Georgia, serif; }
.theme-warmrecipe .doc-exercise   { background: #FFF0D4; border-left: 3px solid #C87840; border-radius: 4px; }
.theme-warmrecipe .doc-exercise .doc-block-label { color: #4A2A18; font-family: Georgia, serif; }
.theme-warmrecipe .doc-callout    { background: #FFF8EC; border-left: 4px solid #A55233; }
.theme-warmrecipe .doc-alerta     { background: #FFF4E0; border-left: 3px solid #C87840; }
.theme-warmrecipe .doc-decisao    { background: #FFF0D4; border-color: #C87840; }
.theme-warmrecipe .doc-decisao .doc-block-label { color: #4A2A18; }
.theme-warmrecipe .doc-passo      { background: #FFF8EC; border-color: #A55233; }
.theme-warmrecipe .doc-passo .doc-block-label  { color: #A55233; }
.theme-warmrecipe .cover-type     { color: #A55233; font-family: Georgia, serif; }
.theme-warmrecipe .cover-rule     { background: #C87840; }
.theme-warmrecipe .cover-title    { font-family: Georgia, serif; }

.theme-warmrecipe {
  --recipe-cream: #FFF4E6;
  --recipe-cream-soft: #FFF8F1;
  --recipe-text: #4A2A18;
  --recipe-terra: #A55233;
  --recipe-coral: #FF6B57;
  --recipe-border: #D9B89B;
  --recipe-support: #C1EB36;
  --cs-accent: #A55233;
  --cs-box-bg: #FFF8F1;
  --bs-fill: #FFF8F1;
  --bs-border: #D9B89B;
}

.theme-warmrecipe .a4-page {
  background: var(--doc-bg, var(--recipe-cream));
  color: var(--doc-text, var(--recipe-text));
}

.theme-warmrecipe .page-header,
.theme-warmrecipe .page-footer {
  border-color: rgba(217, 184, 155, 0.65);
  color: rgba(74, 42, 24, 0.58);
  letter-spacing: 0.13em;
}

.theme-warmrecipe .cover-page {
  background:
    linear-gradient(180deg, rgba(255, 248, 241, 0.92), rgba(255, 244, 230, 0.98)),
    var(--recipe-cream);
}

.theme-warmrecipe .cover-brand,
.theme-warmrecipe .cover-colophon {
  color: rgba(74, 42, 24, 0.48);
}

.theme-warmrecipe .cover-type {
  color: var(--recipe-terra);
  font-family: Inter, system-ui, sans-serif;
  letter-spacing: 0.16em;
}

.theme-warmrecipe .cover-title {
  color: var(--recipe-text);
  font-family: Georgia, serif;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0;
}

.theme-warmrecipe .cover-rule {
  width: 68px;
  height: 2px;
  background: linear-gradient(90deg, var(--recipe-terra), var(--recipe-coral));
}

.theme-warmrecipe .cover-subtitle,
.theme-warmrecipe .cover-promise {
  color: rgba(74, 42, 24, 0.74);
  font-family: Inter, system-ui, sans-serif;
}

.theme-warmrecipe .doc-chapter {
  color: var(--doc-text, var(--recipe-text));
  font-family: Georgia, serif;
  font-size: var(--typo-h2-size, 30px);
  font-style: normal;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(165, 82, 51, 0.42);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.theme-warmrecipe .doc-chapter::after {
  content: "";
  display: block;
  width: 44px;
  height: 2px;
  margin-top: 10px;
  background: var(--recipe-coral);
}

.theme-warmrecipe .doc-subchapter {
  color: var(--recipe-terra);
  font-family: Georgia, serif;
  font-size: var(--typo-h3-size, 18px);
  font-weight: 700;
  margin-top: 24px;
}

.theme-warmrecipe .doc-paragraph,
.theme-warmrecipe .doc-checklist-item,
.theme-warmrecipe .doc-block-text {
  color: var(--doc-text, var(--recipe-text));
  font-family: var(--typo-body-font, Inter, system-ui, sans-serif);
}

.theme-warmrecipe .doc-callout,
.theme-warmrecipe .doc-exercise,
.theme-warmrecipe .doc-alerta,
.theme-warmrecipe .doc-decisao,
.theme-warmrecipe .doc-passo {
  background: var(--recipe-cream-soft);
  border: 1px solid rgba(217, 184, 155, 0.72);
  border-left: 4px solid var(--recipe-terra);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(74, 42, 24, 0.06);
}

.theme-warmrecipe .doc-callout {
  border-left-color: var(--recipe-coral);
  font-family: Georgia, serif;
  font-size: 14px;
  color: var(--recipe-text);
}

.theme-warmrecipe .doc-exercise .doc-block-label,
.theme-warmrecipe .doc-decisao .doc-block-label,
.theme-warmrecipe .doc-passo .doc-block-label,
.theme-warmrecipe .doc-alerta .doc-block-label {
  color: var(--recipe-terra);
  font-family: Inter, system-ui, sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.theme-warmrecipe .doc-alerta .doc-block-label {
  font-size: 0;
}

.theme-warmrecipe .doc-alerta .doc-block-label::after {
  content: "Dica do chef";
  font-size: 9px;
}

.theme-warmrecipe .doc-passo {
  border-left-color: var(--recipe-support);
}

.theme-warmrecipe .doc-checklist {
  background: rgba(255, 248, 241, 0.62);
  border-color: rgba(217, 184, 155, 0.72);
  border-radius: 8px;
  padding: 16px 18px;
}

.theme-warmrecipe .doc-checklist-item {
  padding: 6px 0;
  line-height: 1.75;
}

.theme-warmrecipe .doc-check {
  border-color: var(--recipe-terra);
  background: rgba(255, 255, 255, 0.45);
}

.theme-warmrecipe .doc-list-bullet,
.theme-warmrecipe .doc-list-dash,
.theme-warmrecipe .doc-list-arrow {
  color: var(--recipe-terra);
}

.theme-warmrecipe .doc-table {
  border-color: rgba(217, 184, 155, 0.72);
  border-radius: 8px;
  overflow: hidden;
  background: var(--recipe-cream-soft);
}

.theme-warmrecipe .doc-table th {
  background: var(--recipe-terra);
  color: #FFF8F1;
  font-family: Inter, system-ui, sans-serif;
}

.theme-warmrecipe .doc-table td {
  border-color: rgba(217, 184, 155, 0.55);
  color: var(--recipe-text);
}

.theme-warmrecipe .doc-table tr:nth-child(even) td {
  background: rgba(255, 248, 241, 0.76);
}

.theme-warmrecipe .doc-image-wrapper img,
.theme-warmrecipe .doc-imgbox {
  border-radius: 10px;
  border-color: rgba(217, 184, 155, 0.72);
  box-shadow: 0 10px 24px rgba(74, 42, 24, 0.12);
}

.theme-warmrecipe .doc-image-caption {
  color: rgba(74, 42, 24, 0.62);
  font-family: Inter, system-ui, sans-serif;
}

.theme-warmrecipe .cover-fullpage-overlay {
  background: rgba(74, 42, 24, 0.52);
}

.theme-warmrecipe .cover-fullpage-overlay .cover-title,
.theme-warmrecipe .cover-fullpage-overlay .cover-subtitle,
.theme-warmrecipe .cover-fullpage-overlay .cover-brand,
.theme-warmrecipe .cover-fullpage-overlay .cover-type {
  color: #FFF8F1;
}

.tpl-recipebook .index-heading {
  color: var(--recipe-terra, #A55233);
  border-bottom-color: rgba(217, 184, 155, 0.8);
}

.tpl-recipebook .index-item {
  border-bottom-color: rgba(217, 184, 155, 0.46);
}

/* ==========================================
   V6.3 — VISUAL SECTION SIDEBAR MICRO-COPY
   ========================================== */
.visual-section-intro {
  font-size: 10px;
  color: var(--sidebar-muted);
  line-height: 1.5;
  margin-bottom: 10px;
  font-style: italic;
}
.preset-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--support);
  background: rgba(193, 235, 54, 0.1);
  border: 1px solid rgba(193, 235, 54, 0.2);
  border-radius: 4px;
  padding: 3px 8px;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ==========================================
   V6.3 — BETA LANDING PAGE
   ========================================== */
#welcomeView {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.landing-bg {
  min-height: 100%;
  background: #FFF8EE;
  color: #241F1A;
}

/* Hero */
.landing-hero {
  background: linear-gradient(150deg, #1C1612 0%, #241A14 55%, #1a1a30 100%);
  padding: 64px 24px 80px;
  display: flex;
  justify-content: center;
}
.landing-hero-inner { max-width: 720px; width: 100%; }
.landing-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.landing-brand-eye {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240, 235, 228, 0.45);
}
.landing-brand-sep { color: rgba(240, 235, 228, 0.25); font-size: 12px; }
.landing-brand-name { font-size: 13px; font-weight: 700; color: rgba(240, 235, 228, 0.8); }
.landing-beta-pill {
  font-size: 9px;
  font-weight: 700;
  color: #FF6B57;
  background: rgba(255, 107, 87, 0.15);
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.landing-headline {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.15;
  color: #F6F0E8;
  margin-bottom: 18px;
  font-family: Manrope, system-ui, sans-serif;
  letter-spacing: -0.025em;
}
.landing-subheadline {
  font-size: 15px;
  line-height: 1.75;
  color: rgba(240, 235, 228, 0.65);
  margin-bottom: 36px;
  max-width: 580px;
}
.landing-cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.btn-landing-primary {
  background: #FF6B57;
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: -0.01em;
  font-family: inherit;
}
.btn-landing-primary:hover {
  background: #E85A48;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 107, 87, 0.3);
}
.btn-landing-primary.btn-landing-xl {
  padding: 16px 40px;
  font-size: 16px;
  border-radius: 12px;
}
.btn-landing-ghost {
  background: transparent;
  color: rgba(240, 235, 228, 0.75);
  border: 1.5px solid rgba(240, 235, 228, 0.2);
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-landing-ghost:hover {
  background: rgba(240, 235, 228, 0.08);
  border-color: rgba(240, 235, 228, 0.4);
  color: #F6F0E8;
}
.landing-micro {
  font-size: 11px;
  color: rgba(240, 235, 228, 0.38);
  letter-spacing: 0.03em;
}

/* Sections */
.landing-section {
  padding: 64px 24px;
  display: flex;
  justify-content: center;
}
.landing-alt { background: #FFF2E0; }
.landing-section-inner { max-width: 720px; width: 100%; }
.landing-section-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9C9188;
  margin-bottom: 28px;
}

/* Types grid */
.landing-types-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.landing-type-card {
  background: #fff;
  border: 1.5px solid #E7DCCF;
  border-radius: 10px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #241F1A;
  text-align: center;
  transition: all 0.15s;
}
.landing-type-card:hover {
  border-color: #FF6B57;
  background: rgba(255, 107, 87, 0.03);
  transform: translateY(-1px);
}
.ltc-icon { font-size: 22px; }

/* How it works */
.landing-how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.landing-how-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.lhs-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #FF6B57;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.lhs-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #241F1A;
  display: block;
  margin-bottom: 4px;
}
.lhs-text p {
  font-size: 12px;
  color: #6E6258;
  line-height: 1.55;
  margin: 0;
}

/* Beta warning */
.landing-beta-box {
  background: rgba(255, 107, 87, 0.06);
  border: 1.5px solid rgba(255, 107, 87, 0.2);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.landing-beta-icon { font-size: 18px; flex-shrink: 0; padding-top: 1px; }
.landing-beta-text { font-size: 13px; line-height: 1.65; color: #241F1A; margin: 0; }
.landing-privacy { font-size: 11px; color: #9C9188; line-height: 1.5; }

/* Final CTA */
.landing-cta-final {
  background: linear-gradient(150deg, #1C1612 0%, #241A14 100%);
  padding: 80px 24px;
  display: flex;
  justify-content: center;
  text-align: center;
}
.landing-cta-final-inner { max-width: 600px; width: 100%; }
.landing-cta-final-heading {
  font-size: 28px;
  font-weight: 800;
  color: #F6F0E8;
  margin-bottom: 32px;
  font-family: Manrope, system-ui, sans-serif;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.landing-micro-dark {
  color: rgba(240, 235, 228, 0.35) !important;
  margin-top: 16px;
  display: block;
}

/* Footer */
.landing-footer {
  background: #15120F;
  padding: 20px 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 10px;
  color: rgba(240, 235, 228, 0.3);
  letter-spacing: 0.05em;
}
.landing-footer-sep { opacity: 0.3; }

/* Print: never show landing */
@media print {
  #welcomeView { display: none !important; }
}

/* Mobile */
@media (max-width: 768px) {
  .landing-headline { font-size: 26px; }
  .landing-subheadline { font-size: 14px; }
  .landing-types-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-how-grid { grid-template-columns: 1fr; gap: 20px; }
  .landing-cta-row { flex-direction: column; align-items: stretch; }
  .btn-landing-primary, .btn-landing-ghost { text-align: center; width: 100%; }
  .landing-section { padding: 48px 20px; }
  .landing-hero { padding: 48px 20px 60px; }
  .landing-cta-final { padding: 60px 20px; }
  .landing-cta-final-heading { font-size: 22px; }
}
@media (max-width: 480px) {
  .landing-headline { font-size: 22px; }
  .landing-types-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .landing-type-card { padding: 14px 8px; font-size: 11px; }
}

/* ==========================================
   V6.4 — PAGE MARKERS
   ========================================== */
.editor-page-markers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  min-height: 34px;
}
.epm-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.12s;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-family: inherit;
  line-height: 1.4;
}
.epm-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 107, 87, 0.05);
}
.epm-pill.epm-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.epm-pill.epm-cover { border-color: rgba(255, 107, 87, 0.3); color: var(--accent); }
.epm-pill.epm-index { border-color: var(--border); color: var(--text); }
.epm-pill.epm-fullpage { border-color: rgba(193, 235, 54, 0.4); color: var(--support); }

/* Preview page highlight (on click from marker) */
.preview-page-highlight {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  transition: outline 0.2s;
}

/* ==========================================
   V6.4 — EDITOR COVER CARD
   ========================================== */
.editor-cover-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.editor-cover-off {
  background: rgba(0, 0, 0, 0.04);
}
.ecc-body { flex: 1; min-width: 0; }
.ecc-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}
.ecc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.ecc-meta {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 1px;
}
.ecc-sep { opacity: 0.4; }
.ecc-btn {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(255, 107, 87, 0.3);
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  font-family: inherit;
  flex-shrink: 0;
}
.ecc-btn:hover { background: rgba(255, 107, 87, 0.08); border-color: var(--accent); }
.ecc-off-text { font-size: 11px; color: var(--muted); font-style: italic; }

/* ==========================================
   V6.4 — FULLPAGE IMAGE PAGES
   ========================================== */
.fullpage-image-page {
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}
.fullpage-image-page .page-header,
.fullpage-image-page .page-footer { display: none !important; }
.fullpage-image-page .page-body { display: none !important; }
.fullpage-image {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  object-position: center;
}
.fullpage-image.containpage { object-fit: contain; background: #fff; }
.cover-fullpage-image-page {
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}
.cover-fullpage-image-page .page-header,
.cover-fullpage-image-page .page-footer { display: none !important; }
.cover-fullpage-image-page .page-body { display: none !important; }
.cover-fullpage-image {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  object-fit: cover;
  object-position: center;
}
.cover-fullpage-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 40px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  color: #fff;
}
.cover-fullpage-overlay .cover-brand { font-size: 9px; letter-spacing: 0.18em; opacity: 0.7; margin-bottom: 8px; }
.cover-fullpage-overlay .cover-type  { font-size: 10px; letter-spacing: 0.1em; opacity: 0.8; margin-bottom: 10px; }
.cover-fullpage-overlay .cover-title { font-size: 28px; font-weight: 800; line-height: 1.15; margin-bottom: 8px; }
.cover-fullpage-overlay .cover-subtitle { font-size: 14px; opacity: 0.75; }

/* Gallery insert fullpage button */
.gallery-insert-fp {
  font-size: 9px;
  padding: 2px 6px;
  opacity: 0.7;
}
.gallery-insert-fp:hover { opacity: 1; }

/* Gallery set-as-cover button */
.gallery-insert-cover {
  font-size: 9px;
  padding: 2px 6px;
  color: var(--accent);
  border-color: rgba(255, 107, 87, 0.35);
  opacity: 0.8;
}
.gallery-insert-cover:hover { opacity: 1; border-color: var(--accent); background: rgba(255,107,87,0.06); }

/* Sidebar range input */
.sidebar-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 2px 0 0;
  display: block;
}

/* Print safety */
@media print {
  .editor-cover-card,
  .editor-cover-off,
  .editor-page-markers,
  .epm-pill { display: none !important; }
}
@media (max-width: 768px) {
  .editor-cover-card { padding: 6px 10px; }
  .ecc-title { max-width: 160px; }
  .editor-page-markers { padding: 4px 8px; gap: 3px; }
  .epm-pill { font-size: 8.5px; padding: 2px 7px; }
}

/* Mobile preview needs its own scroll container because showView('editor')
   locks html/body scrolling while the editor shell is open. */
@media (max-width: 768px) {
  body.mobile-preview-active #editorView {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body.mobile-preview-active #editorView .app,
  body.mobile-preview-active #editorView .main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-preview-active #editorView .content {
    flex: 1;
    grid-template-rows: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-preview-active #editorView .preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-preview-active #editorView .preview-scroll {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 10px calc(96px + env(safe-area-inset-bottom, 0px));
  }

  body.mobile-preview-active #editorView .preview-container {
    width: 100%;
    max-width: 100%;
    align-items: center;
  }

  body.mobile-preview-active #editorView .a4-page {
    width: 100%;
    max-width: calc(100vw - 20px);
  }
}

/* ==========================================
   EDITOR TOOLBAR UX
   ========================================== */
.quick-blocks-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--surface-raised) 88%, var(--surface) 12%);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}

.quick-blocks-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-blocks-row::-webkit-scrollbar,
.quick-blocks-bar::-webkit-scrollbar {
  display: none;
}

.quick-blocks-primary {
  padding-bottom: 1px;
}

.quick-blocks-secondary {
  padding-top: 1px;
}

.qb-btn,
.qb-more-btn {
  border-radius: 999px;
  min-height: 28px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(36, 31, 26, 0.04);
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.1s;
}

.qb-btn:hover,
.qb-more-btn:hover {
  border-color: rgba(255, 107, 87, 0.45);
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 84%, var(--accent) 16%);
}

.qb-btn:active,
.qb-more-btn:active {
  transform: translateY(1px);
}

.qb-btn-primary {
  border-color: rgba(255, 107, 87, 0.28);
  background: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
}

.qb-btn-page {
  border-color: rgba(193, 235, 54, 0.55);
  background: color-mix(in srgb, var(--surface) 86%, var(--support) 14%);
}

.qb-btn.qb-recommended {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 82%, var(--accent) 18%);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 87, 0.18);
}

#qbMoreGroup {
  flex-shrink: 0;
  gap: 6px;
}

.toolbar-scroll-hint {
  display: none;
}

.btn-danger-soft {
  color: #9F2B20;
  background: rgba(255, 107, 87, 0.08);
  border: 1px solid rgba(255, 107, 87, 0.28);
}

.btn-danger-soft:hover:not(:disabled) {
  color: #7E1F17;
  background: rgba(255, 107, 87, 0.14);
  border-color: rgba(255, 107, 87, 0.45);
}

html.dark .btn-danger-soft {
  color: #FFB2A8;
  background: rgba(255, 107, 87, 0.12);
}

@media (min-width: 769px) {
  .quick-blocks-row {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (max-width: 768px) {
  .quick-blocks-bar {
    padding: 8px 10px;
    gap: 7px;
  }

  .quick-blocks-row {
    padding: 0 4px 2px;
  }

  .qb-btn,
  .qb-more-btn {
    min-height: 34px;
    padding: 8px 13px;
    font-size: 12px;
  }
}

/* ==========================================
   V6.5 — MOBILE-FIRST EDITOR ACTIONS
   ========================================== */
.quick-blocks-bar {
  position: relative;
  gap: 5px;
  padding: 7px 12px;
  overflow: visible;
}

.quick-blocks-primary {
  gap: 5px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.qb-btn,
.qb-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  min-height: 30px;
  padding: 6px 11px;
  font-size: 11px;
  line-height: 1;
}

.qb-btn-primary {
  color: var(--accent);
  border-color: rgba(255, 107, 87, 0.34);
  background: rgba(255, 107, 87, 0.09);
}

.more-actions-btn {
  color: var(--muted);
  background: var(--surface);
}

#qbMoreGroup.more-actions-menu,
body:not(.advanced-mode) #qbMoreGroup.more-actions-menu {
  display: none !important;
}

#qbMoreGroup.more-actions-menu.open,
body:not(.advanced-mode) #qbMoreGroup.more-actions-menu.open,
body.advanced-mode #qbMoreGroup.more-actions-menu.open {
  display: grid !important;
}

.more-actions-menu {
  position: absolute;
  top: calc(100% - 4px);
  left: 12px;
  right: 12px;
  z-index: 60;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(36, 31, 26, 0.18);
}

.more-actions-menu .qb-btn {
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.more-actions-advanced {
  display: contents;
}

body:not(.advanced-mode) .more-actions-advanced {
  display: none !important;
}

.qb-btn-danger {
  color: #9F2B20;
  border-color: rgba(255, 107, 87, 0.28);
  background: rgba(255, 107, 87, 0.07);
}

.qb-btn-danger:hover {
  color: #7E1F17;
  border-color: rgba(255, 107, 87, 0.45);
  background: rgba(255, 107, 87, 0.13);
}

.editor-hint {
  padding-top: 6px;
  padding-bottom: 6px;
}

@media (min-width: 769px) {
  .quick-blocks-bar {
    overflow: visible;
  }

  .quick-blocks-primary {
    flex-wrap: nowrap;
  }

  .more-actions-menu {
    left: auto;
    right: 14px;
    width: min(560px, calc(100vw - 280px));
  }
}

@media (max-width: 768px) {
  .quick-blocks-bar {
    padding: 6px 8px;
  }

  .toolbar-mobile-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .toolbar-mobile-grid .qb-btn,
  .toolbar-mobile-grid .qb-more-btn {
    width: 100%;
    min-width: 0;
    min-height: 31px;
    padding: 7px 4px;
    font-size: 10.5px;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .more-actions-menu {
    left: 8px;
    right: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(46vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 390px) {
  .toolbar-mobile-grid .qb-btn,
  .toolbar-mobile-grid .qb-more-btn {
    font-size: 10px;
    padding-left: 3px;
    padding-right: 3px;
  }
}
