/* ═══════════════════════════════════════════════════════════
   Neat Layers Tools — shared styles
   ═══════════════════════════════════════════════════════════ */

:root {
  --nl-surface:   rgba(24,24,27,0.6);
  --nl-surface-2: rgba(24,24,27,0.9);
  --nl-line:      rgba(255,255,255,0.10);
  --nl-line-2:    rgba(255,255,255,0.25);
  --nl-text:      #ffffff;
  --nl-muted:     rgba(255,255,255,0.60);
  --nl-faint:     rgba(255,255,255,0.40);
  --nl-accent:    #4ade80;
}
[data-theme="light"] {
  --nl-surface:   #ffffff;
  --nl-surface-2: #f1eee8;
  --nl-line:      rgba(28,25,23,0.14);
  --nl-line-2:    rgba(28,25,23,0.35);
  --nl-text:      #1c1917;
  --nl-muted:     #44403c;
  --nl-faint:     #57534e;
  --nl-accent:    #15803d;
}

/* ── Cards / accordions ─────────────────────────────────── */
.nl-card {
  background: var(--nl-surface);
  border: 1px solid var(--nl-line);
  border-radius: 16px;
  margin-bottom: 16px;
}
.nl-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  color: var(--nl-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nl-card > summary::-webkit-details-marker { display: none; }
.nl-card > summary::after {
  content: '+';
  margin-left: auto;
  font-family: 'Space Mono', monospace;
  color: var(--nl-faint);
}
.nl-card[open] > summary::after { content: '–'; }
.nl-card-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.nl-hint {
  font-family: 'Space Mono', monospace;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
  color: var(--nl-faint);
}

/* ── Fields ──────────────────────────────────────────────── */
.nl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nl-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nl-faint);
}
.nl-input {
  width: 100%;
  background: var(--nl-surface-2);
  color: var(--nl-text);
  border: 1px solid var(--nl-line);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;            /* 16px stops iOS zooming into fields */
  line-height: 1.4;
  transition: border-color .15s ease;
}
.nl-input:focus { outline: none; border-color: var(--nl-line-2); }
.nl-input::placeholder { color: var(--nl-faint); opacity: .6; }
textarea.nl-input { resize: vertical; min-height: 84px; }
select.nl-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--nl-faint) 50%), linear-gradient(135deg, var(--nl-faint) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
[data-theme="light"] .nl-input { background-color: #f7f5f1 !important; color: #1c1917 !important; }

.nl-grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .nl-grid-2 { grid-template-columns: 1fr 1fr; } }

.nl-check { display: flex; align-items: center; gap: 10px; font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--nl-text); cursor: pointer; }
.nl-check input { width: 18px; height: 18px; accent-color: var(--nl-accent); }
.nl-indent { padding-left: 28px; }
.nl-note { font-family: 'Inter', sans-serif; font-size: 0.78rem; line-height: 1.5; color: var(--nl-faint); }
.nl-receipt-fields { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; border-top: 1px dashed var(--nl-line); }

/* ── Buttons ─────────────────────────────────────────────── */
.nl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Space Mono', monospace; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  border-radius: 999px; padding: 12px 20px;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.nl-btn--primary { background: #fff; color: #000; }
.nl-btn--primary:hover { background: rgba(255,255,255,0.85); }
[data-theme="light"] .nl-btn--primary { background: #1c1917; color: #fff; }
.nl-btn--ghost { color: var(--nl-text); border: 1px solid var(--nl-line-2); background: transparent; }
.nl-btn--ghost:hover { border-color: var(--nl-text); }
.nl-btn[disabled] { opacity: .5; pointer-events: none; }

/* File-type + download icons on the download buttons */
.nl-btn--file { gap: 10px; padding: 10px 16px 10px 12px; }
.nl-ico-file { width: 18px; height: 21px; flex-shrink: 0; opacity: .85; }
.nl-ico-dl { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; transition: transform .15s ease, opacity .15s ease; }
.nl-btn--file:hover .nl-ico-dl { transform: translateY(2px); opacity: 1; }
.nl-btn--file[disabled] .nl-ico-dl { animation: nl-bob .8s ease-in-out infinite; }
@keyframes nl-bob { 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .nl-btn--file .nl-ico-dl { transition: none; animation: none !important; } }
@media (max-width: 520px) {
  .nl-btn--file { flex: 1 1 100%; justify-content: flex-start; padding: 13px 18px 13px 14px; }
  .nl-btn--file .nl-ico-dl { margin-left: auto; }
}
.nl-link { font-family: 'Space Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--nl-muted); text-align: left; }
.nl-link:hover { color: var(--nl-text); }
.nl-link--danger:hover { color: #f87171; }

/* Segmented control (document type) */
.nl-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--nl-surface-2); border: 1px solid var(--nl-line); border-radius: 999px; padding: 4px; }
.nl-seg button { font-family: 'Space Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 6px; border-radius: 999px; color: var(--nl-muted); }
.nl-seg button.is-active { background: var(--nl-text); color: var(--nl-surface-2); }
[data-theme="light"] .nl-seg button.is-active { background: #1c1917; color: #fff; }

/* Mobile tabs */
.nl-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; position: sticky; top: 72px; z-index: 20; background: var(--nl-surface-2); border: 1px solid var(--nl-line); border-radius: 999px; padding: 4px; backdrop-filter: blur(10px); }
.nl-tab { font-family: 'Space Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 10px; border-radius: 999px; color: var(--nl-muted); }
.nl-tab.is-active { background: var(--nl-text); color: var(--nl-surface-2); }
@media (max-width: 1023px) {
  .nl-panel:not(.is-visible) { display: none; }
}

/* ── Logo upload ─────────────────────────────────────────── */
.nl-logo-row { display: flex; align-items: center; gap: 16px; }
.nl-logo-box { width: 88px; height: 88px; border-radius: 12px; border: 1px dashed var(--nl-line-2); display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; color: #888; font-family: 'Space Mono', monospace; font-size: 0.65rem; text-transform: uppercase; flex-shrink: 0; }
.nl-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── Items ───────────────────────────────────────────────── */
.nl-item { border: 1px solid var(--nl-line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nl-item .nl-item-desc { grid-column: 1 / -1; }
.nl-item-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-family: 'Space Mono', monospace; font-size: 0.75rem; color: var(--nl-muted); }
.nl-item { grid-template-columns: 100px 1fr; }

/* ── Saved documents ─────────────────────────────────────── */
.nl-saved-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--nl-line); border-radius: 12px; padding: 10px 12px; }
.nl-saved-row .meta { flex: 1; min-width: 0; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--nl-text); }
.nl-saved-row .meta small { display: block; color: var(--nl-faint); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Preview column ──────────────────────────────────────── */
.nl-preview-col { position: relative; }
@media (min-width: 1024px) { .nl-preview-col { position: sticky; top: 88px; } }
.nl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.nl-actions--secondary { gap: 18px; margin-bottom: 8px; }
.nl-status { min-height: 1.2em; font-family: 'Space Mono', monospace; font-size: 0.72rem; color: var(--nl-accent); margin-bottom: 8px; }
.nl-doc-frame { position: relative; width: 100%; overflow: hidden; }

/* ── The document: one or more A4 pages (794 × 1123 px at 96dpi).
   Everything inside is absolutely positioned by invoice.js, so the
   preview matches the PDF exactly. ─────────────────────────── */
.nl-doc { width: 794px; transform-origin: top left; }
.nl-doc .d-page {
  position: relative; width: 794px; height: 1123px; overflow: hidden;
  background: #fff; margin-bottom: 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  font-family: Helvetica, Arial, sans-serif;
}
.nl-doc .d-page:last-child { margin-bottom: 0; }
.nl-doc .d-t { position: absolute; white-space: pre; line-height: 1.117; }
.nl-doc .d-r { position: absolute; box-sizing: border-box; }

/* ── Design picker ───────────────────────────────────────── */
.nl-designs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nl-design { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--nl-line); background: transparent; }
.nl-design.is-active { border-color: var(--nl-text); box-shadow: 0 0 0 1px var(--nl-text); }
.nl-design-name { font-family: 'Space Mono', monospace; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nl-muted); }
.nl-design.is-active .nl-design-name { color: var(--nl-text); }
.nl-thumb { position: relative; width: 100%; max-width: 90px; aspect-ratio: 1 / 1.3; background: #fff; border-radius: 4px; overflow: hidden; display: block; --t: var(--thumb-acc, #1c1917); }
.nl-thumb i, .nl-thumb b, .nl-thumb em { position: absolute; display: block; }
.nl-thumb em { left: 12%; right: 12%; height: 3px; background: #e7e5e4; }
.nl-thumb em:nth-of-type(1) { top: 58%; } .nl-thumb em:nth-of-type(2) { top: 66%; } .nl-thumb em:nth-of-type(3) { top: 74%; }
.nl-thumb--classic i { top: 10%; right: 12%; width: 34%; height: 7%; background: #1c1917; border-radius: 1px; }
.nl-thumb--classic b { top: 46%; left: 12%; right: 12%; height: 6%; background: var(--t); }
.nl-thumb--modern i { top: 0; left: 0; right: 0; height: 24%; background: var(--t); }
.nl-thumb--modern b { top: 46%; left: 12%; right: 12%; height: 6%; background: var(--t); }
.nl-thumb--minimal i { top: 10%; left: 12%; width: 40%; height: 7%; background: var(--t); border-radius: 1px; }
.nl-thumb--minimal b { top: 50%; left: 12%; right: 12%; height: 2px; background: var(--t); }

.nl-thumb u { position: absolute; display: block; }
.nl-thumb--editorial { background: #f4f4f2; }
.nl-thumb--editorial i { top: 9%; right: 10%; width: 44%; height: 14%; background: var(--t); border-radius: 1px; }
.nl-thumb--editorial b { top: 46%; left: 12%; right: 12%; height: 2px; background: #555; }
.nl-thumb--editorial u { bottom: 8%; left: 12%; width: 30%; height: 3px; background: #1c1917; }
.nl-thumb--headline { background: #ecebe6; }
.nl-thumb--headline i { top: 9%; left: 8%; right: 8%; height: 13%; background: var(--t); border-radius: 1px; }
.nl-thumb--headline b { top: 27%; left: 8%; right: 8%; height: 1px; background: #1c1917; box-shadow: 0 7px 0 #1c1917; }
.nl-thumb--headline u { bottom: 7%; left: 8%; width: 18%; height: 12%; background: #1c1917; }
.nl-thumb--sidebar { background: #f3efe8; }
.nl-thumb--sidebar i { top: 0; bottom: 0; left: 26%; width: 1.5px; background: var(--t); }
.nl-thumb--sidebar b { top: 34%; left: 26%; right: 0; height: 1.5px; background: var(--t); }
.nl-thumb--sidebar u { bottom: 6%; left: 7%; width: 12%; height: 42%; background: var(--t); }
.nl-thumb--sidebar em { left: 34%; }

.nl-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.nl-swatch { width: 34px; height: 34px; border-radius: 999px; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--nl-line); }
.nl-swatch.is-active { box-shadow: 0 0 0 2px var(--nl-surface), 0 0 0 4px var(--nl-text); }
.nl-color-input { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }

/* ── Print: only the document pages, at real size ───────── */
@media print {
  @page { size: A4; margin: 0; }
  .nl-panel { display: block !important; }
  body * { visibility: hidden !important; }
  #nl-doc, #nl-doc * { visibility: visible !important; }
  #nl-doc { position: absolute; left: 0; top: 0; transform: none !important; }
  #nl-doc .d-page { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  #nl-doc .d-page:last-child { break-after: auto; page-break-after: auto; }
  .grain::after { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ═══════════════════════════════════════════════════════════
   Portfolio Builder
   ═══════════════════════════════════════════════════════════ */
.nl-doc .d-img { object-fit: contain; display: block; }
.nl-doc .d-img-missing { background: #ece9e4; }
.nl-seg--2 { grid-template-columns: 1fr 1fr; }
.nl-quality { margin-bottom: 10px; max-width: 420px; }
.nl-pagecount { margin: -4px 0 10px; }

/* Design thumbnails (landscape pages) */
.nl-designs--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .nl-designs--4 { grid-template-columns: repeat(4, 1fr); } }
.nl-pthumb { position: relative; width: 100%; max-width: 104px; aspect-ratio: 1.414 / 1; border-radius: 4px; overflow: hidden; display: block; --t: var(--thumb-acc, #d63c2f); }
.nl-pthumb i, .nl-pthumb b, .nl-pthumb em, .nl-pthumb u { position: absolute; display: block; }
.nl-pthumb--grid { background: #ededeb; }
.nl-pthumb--grid i { left: 8%; top: 38%; width: 44%; height: 16%; background: #141414; }
.nl-pthumb--grid b { left: 62%; top: 12%; right: 8%; bottom: 12%; background: #9d9d9d; }
.nl-pthumb--grid em { left: 56%; top: 34%; width: 14%; aspect-ratio: 1; border-radius: 50%; background: var(--t); }
.nl-pthumb--grid u { left: 58%; top: 0; bottom: 0; width: 1px; background: #444; }
.nl-pthumb--bold { background: #e8e4da; }
.nl-pthumb--bold i { right: 6%; top: 8%; bottom: 8%; width: 13%; background: var(--t); border-radius: 2px; }
.nl-pthumb--bold b { left: 44%; top: 18%; width: 26%; bottom: 14%; background: #8a8a8a; }
.nl-pthumb--bold em { left: 64%; top: 12%; width: 12%; aspect-ratio: 1; border-radius: 50%; background: var(--t); }
.nl-pthumb--bold u { left: 8%; top: 58%; width: 26%; height: 8%; background: #1c1917; }
.nl-pthumb--classic { background: #f3eee4; }
.nl-pthumb--classic i { left: 0; top: 0; bottom: 0; width: 5%; background: var(--t); }
.nl-pthumb--classic b { left: 56%; top: 0; right: 6%; height: 52%; background: #8a8a8a; }
.nl-pthumb--classic em { left: 12%; top: 40%; width: 36%; height: 12%; background: var(--t); border-radius: 1px; }
.nl-pthumb--classic u { left: 12%; top: 58%; width: 36%; height: 1px; background: var(--t); }
.nl-pthumb--statement { background: var(--t); }
.nl-pthumb--statement i { left: 8%; right: 8%; top: 36%; height: 30%; background: #fff; }
.nl-pthumb--statement b { left: 38%; top: 48%; width: 26%; bottom: 0; background: #8a8a8a; }
.nl-pthumb--statement em { left: 30%; top: 20%; width: 26%; height: 6%; border-radius: 3px; background: rgba(255,255,255,.75); }
.nl-doc .d-gray { filter: grayscale(1); }
.nl-sub > summary { cursor: pointer; font-family: 'Space Mono', monospace; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nl-faint); }
.nl-sub[open] > summary { margin-bottom: 12px; }
.nl-sub > div + .nl-field { margin-top: 14px; }

/* Checklist */
.nl-checklist { display: flex; flex-direction: column; gap: 8px; font-family: 'Inter', sans-serif; font-size: 0.86rem; color: var(--nl-muted); }
.nl-checklist li { display: flex; gap: 10px; align-items: baseline; line-height: 1.4; }
.nl-checklist li span { width: 1em; flex-shrink: 0; color: var(--nl-faint); font-family: 'Space Mono', monospace; }
.nl-checklist li.is-done { color: var(--nl-faint); }
.nl-checklist li.is-done span { color: var(--nl-text); }

/* Single image slots */
.nl-imgfield { display: flex; flex-direction: column; gap: 8px; }
.nl-imgslot { display: flex; align-items: center; gap: 14px; }
.nl-slot-img { width: 120px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--nl-surface-2); border: 1px solid var(--nl-line); flex-shrink: 0; }
.nl-slot-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nl-imgslot--logo .nl-slot-img { background: #fff; }
.nl-imgslot--logo .nl-slot-img img { object-fit: contain; padding: 6px; }
.nl-slot-acts { display: flex; flex-direction: column; gap: 8px; }
.nl-slot-add, .nl-pimg-add { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--nl-line-2); border-radius: 10px; color: var(--nl-muted); font-family: 'Space Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.nl-slot-add { width: 100%; height: 84px; }
.nl-slot-add:hover, .nl-pimg-add:hover { border-color: var(--nl-text); color: var(--nl-text); }

/* Projects */
.nl-proj { border: 1px solid var(--nl-line); border-radius: 12px; }
.nl-proj.is-hidden .nl-proj-title, .nl-proj.is-hidden .nl-proj-num { opacity: .5; }
.nl-proj-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; }
.nl-proj-num { font-family: 'Space Mono', monospace; font-size: 0.72rem; color: var(--nl-faint); }
.nl-proj-title { flex: 1; min-width: 0; text-align: left; font-family: 'Inter', sans-serif; font-size: 0.92rem; color: var(--nl-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-proj-title small { display: block; font-size: 0.72rem; color: var(--nl-faint); }
.nl-proj-show { display: flex; align-items: center; gap: 6px; font-family: 'Space Mono', monospace; font-size: 0.68rem; text-transform: uppercase; color: var(--nl-muted); cursor: pointer; }
.nl-proj-show input { width: 16px; height: 16px; accent-color: var(--nl-accent); }
.nl-proj-move { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--nl-line); color: var(--nl-muted); flex-shrink: 0; }
.nl-proj-move:hover { border-color: var(--nl-text); color: var(--nl-text); }
.nl-proj-move[disabled] { opacity: .3; pointer-events: none; }
.nl-proj-body { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--nl-line); padding-top: 14px; }
.nl-proj-body[hidden] { display: none; }
.nl-pimgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.nl-pimg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nl-pimg-frame { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--nl-surface-2); }
.nl-pimg-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nl-pimg-badge { position: absolute; left: 6px; top: 6px; font-family: 'Space Mono', monospace; font-size: 0.6rem; text-transform: uppercase; background: rgba(0,0,0,.65); color: #fff; padding: 2px 6px; border-radius: 999px; }
.nl-pimg-acts { display: flex; gap: 4px; }
.nl-pimg-acts button { flex: 1; height: 28px; border-radius: 8px; border: 1px solid var(--nl-line); color: var(--nl-muted); font-size: 0.85rem; }
.nl-pimg-acts button:hover { border-color: var(--nl-text); color: var(--nl-text); }
.nl-pimg-acts button[disabled] { opacity: .3; pointer-events: none; }
.nl-pimg-add { aspect-ratio: 4 / 3; text-align: center; padding: 8px; }
.nl-input--sm { padding: 7px 10px; font-size: 16px; border-radius: 8px; }
@media (min-width: 768px) { .nl-input--sm { font-size: 0.82rem; } }

.nl-testi { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px dashed var(--nl-line); }
.nl-testi:last-child { border-bottom: 0; padding-bottom: 0; }
