/* ── Newsletter Creator Styles ──────────────────────────── */

.nl-container {
  max-width: 1200px;
}

/* Full-width editor mode */
.nl-container.nl-editing {
  max-width: none;
  padding: 0 12px;
}
.nl-container.nl-editing .tool-hero {
  display: none;
}

/* ── Menu Bar ──────────────────────────────────────────── */
.nl-menubar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 8px;
  background: var(--card, #fff);
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 10px 10px 0 0;
  position: sticky;
  top: 0;
  z-index: 10001;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.nl-menu {
  position: relative;
}

.nl-menu-btn {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}
.nl-menu-btn:hover,
.nl-menu-btn.open {
  background: var(--bg, #faf8f5);
}

.nl-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--card, #fff);
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px 0;
  z-index: 10002;
}
.nl-menu-dropdown.open {
  display: block;
}

.nl-menu-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.nl-menu-item:hover {
  background: var(--bg, #faf8f5);
}

.nl-menu-del {
  color: #dc2626;
}

.nl-menu-toggle.active {
  font-weight: 600;
}
.nl-menu-toggle.active::before {
  content: '\2713 ';
}

.nl-menu-sep {
  height: 1px;
  background: var(--bdr, #e5e0db);
  margin: 4px 12px;
}

.nl-menu-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--fg, #3d3529);
}

.nl-menu-label {
  font-size: 12px;
  color: var(--mute, #9c8e7c);
  white-space: nowrap;
}

.nl-menu-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 5px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
}

.nl-menu-num {
  width: 48px;
  padding: 4px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 5px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 12px;
  font-family: inherit;
  text-align: center;
}

/* Pages section in menu bar */
.nl-menu-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nl-menu-pages .nl-pn-tabs {
  display: flex;
  gap: 3px;
}
.nl-menu-pages .nl-pn-tab {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
}
.nl-menu-dropdown-right {
  right: 0;
  left: auto;
}

.nl-menu-select {
  padding: 4px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 5px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 12px;
  font-family: inherit;
}

/* ── Toolbar ───────────────────────────────────────────── */
.nl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--card, #fff);
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 12px;
  margin-bottom: 16px;
  position: sticky;
  top: 36px;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-radius: 0 0 10px 10px;
  border-top: none;
}

.nl-tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nl-tb-divider {
  width: 1px;
  height: 28px;
  background: var(--bdr, #e5e0db);
  margin: 0 4px;
}

.nl-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nl-tb-btn:hover {
  background: var(--bdr, #e5e0db);
}
.nl-tb-btn.active {
  background: var(--accent, #ea580c);
  color: #fff;
  border-color: var(--accent, #ea580c);
}

.nl-tb-fmt {
  min-width: 32px;
  font-size: 14px;
}

.nl-tb-sz {
  min-width: 26px;
  padding: 4px 6px;
  font-size: 14px;
  font-weight: 600;
}

.nl-tb-sz-val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 4px 2px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--fg, #3d3529);
  user-select: none;
}

.nl-tb-del {
  color: #dc2626;
  border-color: #fecaca;
}
.nl-tb-del:hover {
  background: #fee2e2;
}

.nl-tb-save {
  background: var(--accent, #ea580c);
  color: #fff;
  border-color: var(--accent, #ea580c);
  font-weight: 600;
}
.nl-tb-save:hover {
  opacity: 0.9;
}

.nl-tb-num {
  width: 52px;
  padding: 5px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}

.nl-tb-label {
  font-size: 11px;
  color: var(--mute, #9c8e7c);
}

#nl-font-family, #nl-page-size {
  padding: 5px 8px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

/* Color pickers */
.nl-tb-color-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
}
.nl-tb-color-wrap input[type="color"] {
  width: 22px;
  height: 22px;
  border: none;
  padding: 0;
  cursor: pointer;
  background: transparent;
}
.nl-tb-color-label {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.nl-bg-label {
  font-size: 14px;
}

/* ── Page Navigation ───────────────────────────────────── */
/* page nav bar removed — page tabs now in menu bar */

.nl-pn-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.nl-pn-tab {
  padding: 6px 16px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.nl-pn-tab:hover {
  border-color: var(--accent, #ea580c);
}
.nl-pn-tab.active {
  background: var(--accent, #ea580c);
  color: #fff;
  border-color: var(--accent, #ea580c);
  font-weight: 600;
}

.nl-pn-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.nl-pn-btn {
  padding: 6px 12px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.nl-pn-btn:hover {
  background: var(--bdr, #e5e0db);
}
.nl-pn-del {
  color: #dc2626;
  border-color: #fecaca;
}
.nl-pn-del:hover {
  background: #fee2e2;
}
.nl-pn-del:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nl-pn-divider {
  width: 1px;
  height: 20px;
  background: var(--bdr, #e5e0db);
  margin: 0 2px;
}

.nl-pn-zoom-label {
  font-size: 12px;
  color: var(--fg, #3d3529);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#btn-view-single.active,
#btn-view-sidebyside.active {
  background: var(--accent, #ea580c);
  color: #fff;
  border-color: var(--accent, #ea580c);
}

/* Side-by-side view */
#nl-page-container {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
  align-items: flex-start;
  transform-origin: top center;
}

/* Zoom */
.nl-editor-wrap {
  overflow: auto;
}

/* ── Editor Wrap ───────────────────────────────────────── */
.nl-editor-wrap {
  display: flex;
  justify-content: center;
  padding: 24px;
  background: var(--mute, #9c8e7c);
  border-radius: 12px;
  min-height: 600px;
  overflow: auto;
  position: relative;
  z-index: 1;
  isolation: isolate;
}
.nl-container.nl-editing .nl-editor-wrap {
  border-radius: 8px;
  min-height: calc(100vh - 160px);
  padding: 32px;
}

/* ── Page ──────────────────────────────────────────────── */
.nl-page {
  position: relative;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  overflow: hidden;
  flex-shrink: 0;
}
.nl-page.letter {
  width: 816px;   /* 8.5in * 96dpi */
  min-height: 1056px; /* 11in * 96dpi */
}
.nl-page.a4 {
  width: 794px;   /* 210mm */
  min-height: 1123px; /* 297mm */
}

/* ── Newsletter Elements (shared) ──────────────────────── */
.nl-el {
  position: absolute;
  cursor: move;
  min-width: 40px;
  min-height: 30px;
  box-sizing: border-box;
  outline: 2px solid transparent;
  transition: outline-color 0.1s;
}
.nl-el:hover {
  outline-color: rgba(59, 130, 246, 0.3);
}
.nl-el.selected {
  outline-color: #3b82f6;
  outline-offset: 0;
}
.nl-el.selected.nl-multi-hint {
  outline-style: dashed;
}
.nl-el.nl-move-mode {
  outline-color: #f97316 !important;
  outline-style: solid !important;
  outline-width: 2px !important;
}

/* ── Resize Handles ────────────────────────────────────── */
.nl-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #3b82f6;
  border: 2px solid #fff;
  border-radius: 2px;
  z-index: 10;
  display: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.nl-el.selected .nl-handle {
  display: block;
}

.nl-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.nl-handle-n  { top: -5px; left: 50%; margin-left: -5px; cursor: n-resize; }
.nl-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.nl-handle-e  { top: 50%; margin-top: -5px; right: -5px; cursor: e-resize; }
.nl-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.nl-handle-s  { bottom: -5px; left: 50%; margin-left: -5px; cursor: s-resize; }
.nl-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.nl-handle-w  { top: 50%; margin-top: -5px; left: -5px; cursor: w-resize; }

/* ── Text Block ────────────────────────────────────────── */
.nl-text {
  padding: 2px 4px;
  font-family: Inter, sans-serif;
  font-size: 16px;
  color: #000;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
  box-sizing: border-box;
}
.nl-text-content {
  outline: none;
  min-height: 1em;
  width: 100%;
  height: 100%;
  cursor: default;
  box-sizing: border-box;
}
/* Only show text cursor when actively editing */
.nl-text-content:focus {
  cursor: text;
}
/* In move mode, block text interaction so clicks pass to the element for dragging */
.nl-move-mode .nl-text-content,
.nl-el.selected:not(:focus-within) .nl-text-content {
  pointer-events: none;
}
/* When focused (editing), re-enable text interaction */
.nl-el .nl-text-content:focus {
  pointer-events: auto;
}

/* Drag handle for text */
.nl-drag-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: transparent;
  cursor: move;
  z-index: 5;
  border-radius: 2px 2px 0 0;
  transition: background 0.15s;
}
.nl-el.selected .nl-drag-bar {
  background: rgba(59, 130, 246, 0.3);
}

/* ── Image Element ─────────────────────────────────────── */
.nl-img-el img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Status ────────────────────────────────────────────── */
.nl-status {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--mute, #9c8e7c);
  min-height: 20px;
}
.nl-status.success {
  color: #16a34a;
  font-weight: 600;
}
.nl-status.error {
  color: #dc2626;
  font-weight: 600;
}

/* ── Template Picker ───────────────────────────────────── */
.nl-templates {
  text-align: center;
  padding: 32px 0 24px;
}

.nl-tpl-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--fg, #3d3529);
  margin-bottom: 24px;
}

.nl-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}

.nl-tpl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 14px;
  border: 2px solid var(--bdr, #e5e0db);
  border-radius: 12px;
  background: var(--card, #fff);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  font-family: inherit;
  color: var(--fg, #3d3529);
}
.nl-tpl-card:hover {
  border-color: var(--accent, #ea580c);
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.12);
  transform: translateY(-2px);
}

.nl-tpl-preview {
  width: 140px;
  height: 180px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nl-tpl-blank {
  background: #fafafa;
}
.nl-tpl-blank span {
  font-size: 40px;
  color: #d1d5db;
  font-weight: 300;
  line-height: 1;
}

.nl-tpl-mini {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.nl-tpl-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.nl-tpl-desc {
  font-size: 12px;
  color: var(--mute, #9c8e7c);
}

/* Back to templates button (shown when editor is active) */
.nl-tb-back {
  border-color: var(--mute, #9c8e7c);
  color: var(--mute, #9c8e7c);
  font-size: 12px;
}
.nl-tb-back:hover {
  color: var(--fg, #3d3529);
  border-color: var(--fg, #3d3529);
}

/* ── Save/Load UI ──────────────────────────────────────── */
.nl-tb-name {
  width: 160px;
  padding: 5px 8px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
}
.nl-tb-name:focus {
  outline: none;
  border-color: var(--accent, #ea580c);
}

.nl-tb-save-proj {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
  font-weight: 600;
}
.nl-tb-save-proj:hover {
  opacity: 0.9;
  background: #15803d;
}

.nl-tb-open-proj {
  border-color: var(--bdr, #e5e0db);
}

/* ── Open Project Section (template picker screen) ─────── */
.nl-open-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--bdr, #e5e0db);
  text-align: center;
}

.nl-open-hint {
  font-size: 14px;
  color: var(--mute, #9c8e7c);
  margin-bottom: 12px;
}

.nl-open-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.nl-open-file-btn {
  padding: 10px 24px;
  font-size: 14px;
}

/* Custom templates section */
.nl-custom-tpl-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--bdr, #e5e0db);
  display: none; /* shown via JS when templates exist */
}
.nl-custom-tpl-section.has-items {
  display: block;
}

.nl-tpl-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.nl-tpl-card .nl-tpl-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
}
.nl-tpl-card:hover .nl-tpl-del {
  display: flex;
}

.nl-tpl-custom-label {
  font-size: 10px;
  color: var(--accent, #ea580c);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Save as template button */
.nl-tb-tpl-save {
  color: var(--accent, #ea580c);
  border-color: var(--accent, #ea580c);
  font-weight: 600;
}
.nl-tb-tpl-save:hover {
  background: var(--accent, #ea580c);
  color: #fff;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .nl-editor-wrap {
    padding: 12px;
  }
  .nl-page.letter,
  .nl-page.a4 {
    transform-origin: top center;
    transform: scale(0.6);
    margin-bottom: -40%;
  }
  .nl-toolbar {
    gap: 4px;
    padding: 8px 10px;
  }
  .nl-tb-divider {
    display: none;
  }
}

@media (max-width: 600px) {
  .nl-page.letter,
  .nl-page.a4 {
    transform: scale(0.4);
    margin-bottom: -60%;
  }
}

/* ── Image border options ──────────────────────────────── */
.nl-tb-img-opts {
  transition: opacity 0.15s;
}

.nl-tb-select-sm {
  padding: 5px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ── Shape Elements ────────────────────────────────────── */
.nl-shape {
  min-width: 10px !important;
  min-height: 2px !important;
  overflow: visible;
}
.nl-shape svg {
  pointer-events: none;
  overflow: visible;
}

/* Shape options toolbar group */
.nl-tb-shape-opts {
  transition: opacity 0.15s;
}

/* ── Header & Footer ───────────────────────────────────── */
.nl-hf-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nl-hf-panel {
  background: var(--card, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.nl-hf-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg, #3d3529);
}
.nl-hf-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--mute, #9c8e7c);
  padding: 0 4px;
}
.nl-hf-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bdr, #e5e0db);
}
.nl-hf-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg, #3d3529);
}
.nl-hf-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--fg, #3d3529);
}
.nl-hf-fields {
  padding-left: 4px;
  margin-top: 6px;
}
.nl-hf-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--fg, #3d3529);
}
.nl-hf-row label {
  min-width: 52px;
  text-align: right;
  color: var(--mute, #9c8e7c);
  font-size: 12px;
}
.nl-hf-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 5px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 13px;
  font-family: inherit;
}
.nl-hf-num {
  width: 48px;
  padding: 4px 6px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 5px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 12px;
  font-family: inherit;
  text-align: center;
}
.nl-hf-hint {
  font-size: 11px;
  color: var(--mute, #9c8e7c);
  margin-bottom: 8px;
}
.nl-hf-hint code {
  background: var(--bg, #faf8f5);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.nl-hf-per-page {
  margin-top: 8px;
}
.nl-hf-per-page label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--fg, #3d3529);
}
.nl-hf-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Header/Footer rendered on pages */
.nl-page-header,
.nl-page-footer {
  position: absolute;
  left: 48px;
  right: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: Inter, sans-serif;
  pointer-events: none;
  z-index: 5;
}
.nl-page-header {
  top: 16px;
  padding-bottom: 6px;
}
.nl-page-header.nl-hf-line {
  border-bottom: 1px solid currentColor;
}
.nl-page-footer {
  bottom: 16px;
  padding-top: 6px;
}
.nl-page-footer.nl-hf-line {
  border-top: 1px solid currentColor;
}
.nl-hf-left, .nl-hf-center, .nl-hf-right {
  flex: 1;
}
.nl-hf-left { text-align: left; }
.nl-hf-center { text-align: center; }
.nl-hf-right { text-align: right; }

/* Hide header/footer in export — they're rendered into the page so they DO show */

/* ── Marquee Selection ─────────────────────────────────── */
.nl-marquee {
  position: absolute;
  border: 1px dashed #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  pointer-events: none;
  z-index: 99999;
}

/* ── Print Safe Zones ──────────────────────────────────── */
.nl-page.nl-safezone::before {
  content: '';
  position: absolute;
  top: 48px;
  left: 48px;
  right: 48px;
  bottom: 48px;
  border: 1px dashed rgba(220, 38, 38, 0.4);
  pointer-events: none;
  z-index: 9999;
}
.nl-page.nl-safezone::after {
  content: 'Safe Zone (0.5")';
  position: absolute;
  top: 32px;
  right: 50px;
  font-size: 9px;
  color: rgba(220, 38, 38, 0.5);
  pointer-events: none;
  z-index: 9999;
  font-family: Inter, sans-serif;
}
.nl-page.nl-safezone .nl-bleed-guide {
  display: block;
}
.nl-bleed-guide {
  display: none;
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  bottom: 24px;
  border: 1px dotted rgba(59, 130, 246, 0.3);
  pointer-events: none;
  z-index: 9998;
}

/* ── Grid Overlay ──────────────────────────────────────── */
.nl-page.nl-grid {
  --grid-size: 20px;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* ── Print / PDF Export (hide UI) ──────────────────────── */
.nl-page.exporting .nl-handle,
.nl-page.exporting .nl-drag-bar {
  display: none !important;
}
.nl-page.exporting .nl-el {
  outline: none !important;
}
.nl-page.exporting.nl-grid {
  background-image: none !important;
}
.nl-page.exporting.nl-safezone::before,
.nl-page.exporting.nl-safezone::after,
.nl-page.exporting .nl-bleed-guide {
  display: none !important;
}

/* ── Auth UI ──────────────────────────────────────────── */
.nl-auth-status {
  margin-left: 8px;
  flex-shrink: 0;
}
.nl-auth-user {
  position: relative;
}
.nl-auth-user-btn {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px !important;
}
.nl-auth-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--card, #fff);
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20001;
  padding: 4px 0;
}
.nl-auth-dropdown-email {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--mute, #9c8e7c);
  border-bottom: 1px solid var(--bdr, #e5e0db);
}

/* Auth Modal Overlay */
.nl-auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nl-auth-panel {
  background: var(--card, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 380px;
  max-width: 95vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.nl-auth-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}
[data-theme="dark"] .nl-auth-error {
  background: #451a1a;
  color: #fca5a5;
}
.nl-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nl-auth-input {
  padding: 10px 12px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 6px;
  background: var(--bg, #faf8f5);
  color: var(--fg, #3d3529);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.nl-auth-input:focus {
  border-color: var(--accent, #ea580c);
}
.nl-auth-btn {
  padding: 10px 16px;
  background: var(--accent, #ea580c);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.nl-auth-btn:hover {
  opacity: 0.9;
}
.nl-auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.nl-auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--mute, #9c8e7c);
  margin: 4px 0 0;
}
.nl-auth-switch a {
  color: var(--accent, #ea580c);
  text-decoration: none;
  font-weight: 500;
}
.nl-auth-success {
  text-align: center;
  padding: 8px 0 12px;
  color: var(--fg, #3d3529);
  font-size: 14px;
  line-height: 1.6;
}
.nl-auth-success-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.nl-auth-email-highlight {
  font-weight: 600;
  color: var(--accent, #ea580c);
  margin: 4px 0 8px;
}
.nl-auth-btn-secondary {
  background: var(--card, #fff);
  color: var(--fg, #3d3529);
  border: 1px solid var(--bdr, #e5e0db);
}
.nl-auth-btn-secondary:hover {
  background: var(--bg, #faf8f5);
}

/* ── Cloud / My Newsletters Panel ─────────────────────── */
.nl-cloud-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nl-cloud-panel {
  background: var(--card, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 520px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.nl-cloud-list {
  margin-top: 8px;
}
.nl-cloud-loading,
.nl-cloud-empty {
  text-align: center;
  color: var(--mute, #9c8e7c);
  font-size: 13px;
  padding: 24px 0;
}
.nl-cloud-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--bdr, #e5e0db);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.1s;
}
.nl-cloud-item:hover {
  background: var(--bg, #faf8f5);
}
.nl-cloud-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg, #3d3529);
}
.nl-cloud-item-date {
  font-size: 11px;
  color: var(--mute, #9c8e7c);
  margin-top: 2px;
}
.nl-cloud-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.nl-cloud-load-btn {
  font-size: 12px !important;
}
.nl-cloud-del-btn {
  font-size: 12px !important;
  opacity: 0.5;
}
.nl-cloud-del-btn:hover {
  opacity: 1;
  color: #dc2626;
}
