:root {
  --bg: #f5f2ea;
  --surface: #ffffff;
  --ink: #1a1f1b;
  --ink-soft: #4a5248;
  --muted: #6b6f66;
  --line: #e4e0d5;
  --line-soft: #ece8dc;
  --moss: #2d4a2b;
  --moss-ink: #1a2f1a;
  --moss-deep: #1a2f1a;
  --sage: #8a9a5b;
  --sage-soft: #c3cba6;
  --cream: #faf8f2;
  --warn: #9e5527;
  --danger: #a33a2a;
  --field: #2d4a2b;
  --field-accent: #2d4a2b;
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 500; background: transparent; transition: background .12s, border-color .12s; text-decoration: none; }
.btn-primary { background: var(--moss); color: #fff; }
.btn-primary:hover { background: var(--moss-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--cream); }
.btn-ghost { color: var(--ink-soft); padding: 8px 12px; }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-large { padding: 16px 24px; font-size: 16px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(26,31,27,0.04); }
.card-body { padding: 20px 22px; }
.card-title { font-family: var(--font-display); font-size: 18px; margin: 0 0 4px; font-weight: 400; letter-spacing: -0.01em; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

h1, .view-h1 { font-family: var(--font-display); font-weight: 300; letter-spacing: -0.025em; font-size: 32px; color: var(--ink); margin: 0; line-height: 1.12; }
.eyebrow { font-size: 11px; color: var(--moss); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; display: block; }
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }

.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: var(--surface); }
.input:focus { outline: none; border-color: var(--moss); }
.label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 6px; }

.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill-moss { background: rgba(45,74,43,.1); color: var(--moss); }
.pill-sage { background: rgba(138,154,91,.18); color: #5c6b2e; }
.pill-warn { background: rgba(158,85,39,.14); color: var(--warn); }
.pill-danger { background: rgba(163,58,42,.12); color: var(--danger); }
.pill-muted { background: var(--cream); color: var(--ink-soft); }

.status-pill-draft     { background: var(--cream); color: var(--ink-soft); }
.status-pill-sent      { background: rgba(138,154,91,.18); color: #5c6b2e; }
.status-pill-viewed    { background: rgba(138,154,91,.22); color: #5c6b2e; }
.status-pill-accepted  { background: rgba(45,74,43,.12); color: var(--moss); }
.status-pill-rejected  { background: rgba(163,58,42,.12); color: var(--danger); }
.status-pill-planned   { background: var(--cream); color: var(--ink-soft); }
.status-pill-in_progress { background: rgba(138,154,91,.18); color: #5c6b2e; }
.status-pill-completed { background: rgba(45,74,43,.12); color: var(--moss); }
.status-pill-paused    { background: rgba(158,85,39,.14); color: var(--warn); }
.status-pill-paid      { background: rgba(45,74,43,.12); color: var(--moss); }
.status-pill-overdue   { background: rgba(163,58,42,.12); color: var(--danger); }
.status-pill-open      { background: rgba(138,154,91,.18); color: #5c6b2e; }
.status-pill-waiting_staff    { background: rgba(158,85,39,.14); color: var(--warn); }
.status-pill-waiting_customer { background: var(--cream); color: var(--ink-soft); }
.status-pill-closed    { background: var(--cream); color: var(--ink-soft); }
.status-pill-expired   { background: rgba(158,85,39,.14); color: var(--warn); }
.status-pill-invoiced  { background: rgba(45,74,43,.14); color: var(--moss); }
.status-pill-lead      { background: rgba(138,154,91,.18); color: #5c6b2e; }
.status-pill-active    { background: rgba(45,74,43,.12); color: var(--moss); }
.status-pill-archived  { background: var(--cream); color: var(--muted); }
.status-pill-cancelled { background: rgba(163,58,42,.12); color: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line-soft); }
.table th { color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; background: var(--cream); }
.table tr:hover td { background: var(--cream); }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; z-index: 9999; box-shadow: 0 12px 40px rgba(0,0,0,.2); animation: toastIn .2s ease-out; }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--moss); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.flex { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; } .text-muted { color: var(--muted); }
.text-right { text-align: right; }
.hidden { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-logo { height: 48px; width: auto; max-width: 160px; object-fit: contain; flex-shrink: 0; }
.brand-logo-lg { display: block; height: 72px; max-width: 220px; margin: 0 0 16px; }
.brand-logo[hidden], [data-brand-mark][hidden], [data-brand-fallback][hidden] { display: none !important; }

.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible,
a:focus-visible, button:focus-visible, [role="button"]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .spinner { animation-duration: 1.6s; }
  * { transition-duration: 0ms !important; }
}

@media (max-width: 600px) {
  .input, input, textarea, select {
    font-size: 16px !important;
  }
}

.toggle-track {
  display: inline-block;
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line, #d8d3c4);
  border: 1px solid rgba(0,0,0,.06);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .18s ease;
  vertical-align: middle;
}
.toggle-track.on { background: var(--moss, #2d4a2b); }
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: left .18s ease;
}
.toggle-track.on .toggle-knob { left: 22px; }
.toggle-track:focus-visible {
  outline: 2px solid var(--moss, #2d4a2b);
  outline-offset: 2px;
}

.modal-dlg.lb-dlg { max-width: 1480px; width: 96vw; height: 92vh; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.lb-dlg > .modal-h { padding: 14px 22px; }
.lb-dlg > .modal-b { flex: 1 1 auto; min-height: 0; padding: 0; overflow: hidden; display: flex; }
.lb-dlg > .modal-b > form { flex: 1 1 auto; min-width: 0; display: flex; }
.lb-dlg > .modal-f { padding: 12px 22px; }
.lb-shell { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--cream); }
.lb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.lb-toolbar-gap { flex: 1 1 auto; }
.lb-tb-btn { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.lb-tb-btn svg { flex-shrink: 0; }
.lb-tb-btn:disabled { opacity: .45; cursor: not-allowed; }
.lb-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line-soft); gap: 2px; }
.lb-tab { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.lb-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.lb-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 250px minmax(0,1fr) 340px; }
.lb-col { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.lb-palette { border-right: 1px solid var(--line); background: var(--surface); }
.lb-props { border-left: 1px solid var(--line); background: var(--surface); }
.lb-center { padding: 14px 18px; }
.lb-col-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.lb-hint { margin: 0 0 12px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.lb-mt { margin-top: 18px; }
.lb-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lb-pal-groups { display: flex; flex-direction: column; gap: 14px; }
.lb-pal-group-title { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--moss); margin-bottom: 6px; }
.lb-pal-list { display: flex; flex-direction: column; gap: 6px; }
.lb-pal-card { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: grab; transition: border-color .12s, box-shadow .12s, transform .12s; }
.lb-pal-card:hover { border-color: var(--sage); box-shadow: 0 2px 8px rgba(45,74,43,.12); }
.lb-pal-card:active { cursor: grabbing; transform: scale(.99); }
.lb-pal-ico { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--line-soft); color: var(--moss); }
.lb-pal-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lb-pal-name { font-size: 13px; font-weight: 600; }
.lb-pal-desc { font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.lb-pal-add { flex: 0 0 auto; color: var(--muted); opacity: 0; transition: opacity .12s; }
.lb-pal-card:hover .lb-pal-add, .lb-pal-card:focus-visible .lb-pal-add { opacity: 1; }
.lb-canvas-wrap { max-width: 820px; margin: 0 auto; }
.lb-canvas { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 240px; padding: 10px; border: 2px dashed transparent; border-radius: 12px; transition: border-color .12s, background .12s; }
.lb-canvas.is-drop-target { border-color: var(--sage); background: rgba(138,154,91,.06); }
.lb-drop-line { display: block; position: relative; height: 0; margin: 0; border-top: 3px solid var(--moss); border-radius: 2px; pointer-events: none; }
.lb-drop-line span { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: var(--moss); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; }
.lb-item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; transition: border-color .12s, box-shadow .12s, opacity .12s; }
.lb-item:hover { border-color: var(--sage-soft); }
.lb-item.is-selected { border-color: var(--moss); box-shadow: 0 0 0 2px rgba(45,74,43,.25); }
.lb-item.is-hidden .lb-item-body { opacity: .4; filter: grayscale(.6); }
.lb-item.is-nodata .lb-item-body { opacity: .6; }
.lb-item.is-dragging { opacity: .35; }
.lb-item-bar { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 2px; border-bottom: 1px solid var(--line-soft); background: var(--cream); }
.lb-grip { flex: 0 0 auto; width: 32px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: grab; }
.lb-item-name { flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; flex-wrap: nowrap; overflow: hidden; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.lb-item-num { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--line-soft); color: var(--ink-soft); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.lb-item-name .lb-pal-ico { flex-basis: 26px; width: 26px; height: 26px; }
.lb-item-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.lb-item-hint { flex: 0 1000 auto; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-badge { padding: 1px 8px; border-radius: 999px; background: var(--line-soft); color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.lb-badge-warn { background: #f6e6d8; color: var(--warn); }
.lb-item-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; }
.lb-tool { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.lb-tool:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.lb-tool:disabled { opacity: .3; cursor: default; }
.lb-tool-danger:hover:not(:disabled) { background: #f7e3df; color: var(--danger); }
.lb-item-body { cursor: pointer; background: #fff; }
.lb-item-body > * { pointer-events: none; }
.lb-empty { padding: 36px 18px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; background: var(--surface); }
.lb-empty-title { font-size: 15px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.lb-pdf { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 420px; }
.lb-pdf-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lb-pdf-status { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; border-radius: 8px; font-size: 13px; background: var(--line-soft); color: var(--ink-soft); flex: 1 1 260px; }
.lb-pdf-status.is-ok { background: #e7efe2; color: var(--moss); }
.lb-pdf-status.is-error { background: #f7e3df; color: var(--danger); }
.lb-pdf-status .btn { min-height: 32px; padding: 4px 10px; }
.lb-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(45,74,43,.25); border-top-color: var(--moss); animation: lb-spin .8s linear infinite; flex: 0 0 auto; }
@keyframes lb-spin { to { transform: rotate(360deg); } }
.lb-pdf-card { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 260px; padding: 32px 24px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-soft); text-align: center; }
.lb-pdf-card p { margin: 0; max-width: 420px; font-size: 14px; line-height: 1.5; }
.lb-pdf-open { min-height: 48px; padding: 10px 22px; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.lb-email-frame { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.lb-email-frame-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.lb-email-frame iframe { width: 100%; height: 520px; border: 0; display: block; }
.lb-email-full { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
.lb-check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.lb-props-inner { display: flex; flex-direction: column; gap: 14px; }
.lb-props-inner > .lb-col-title { margin-bottom: -6px; }
.lb-props-head { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.lb-props-title { flex: 1 1 auto; min-width: 0; }
.lb-props-title h4 { margin: 2px 0; font-size: 16px; font-weight: 600; }
.lb-field { display: flex; flex-direction: column; gap: 6px; }
.lb-field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.lb-sub { margin-top: 6px; font-weight: 500; color: var(--muted); }
.lb-input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; box-sizing: border-box; }
textarea.lb-input { min-height: 96px; resize: vertical; line-height: 1.45; }
.lb-input:focus { border-color: var(--moss); outline: none; box-shadow: 0 0 0 3px rgba(45,74,43,.18); }
.lb-mono { font-family: var(--font-mono); font-size: 13px; }
.lb-help { font-size: 12px; line-height: 1.45; color: var(--muted); }
.lb-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: #f6e6d8; color: var(--warn); font-size: 12.5px; line-height: 1.45; }
.lb-note-soft { background: var(--line-soft); color: var(--ink-soft); }
.lb-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lb-chips-title { font-size: 12px; color: var(--muted); }
.lb-chip { min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--cream); color: var(--moss); font-family: var(--font-mono); font-size: 12px; cursor: pointer; }
.lb-chip:hover { border-color: var(--sage); background: #eef2e6; }
.lb-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.lb-switch input { appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto; width: 44px; height: 24px; margin: 0; border-radius: 999px; background: var(--line); border: 1px solid rgba(0,0,0,.08); cursor: pointer; transition: background .15s; }
.lb-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.lb-switch input:checked { background: var(--moss); }
.lb-switch input:checked::after { left: 22px; }
.lb-seg { display: flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 10px; background: var(--line-soft); }
.lb-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.lb-seg label { flex: 1 1 0; min-width: 52px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 8px; border-radius: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; text-align: center; }
.lb-seg input:checked + label { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.lb-seg input:focus-visible + label { outline: 2px solid var(--moss); outline-offset: 1px; }
.lb-color-row { display: flex; align-items: center; gap: 8px; }
.lb-color { flex: 0 0 44px; width: 44px; height: 44px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.lb-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-swatch { width: 32px; height: 32px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.lb-swatch.is-on { box-shadow: 0 0 0 2px var(--ink); }
.lb-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-mini { min-height: 36px; padding: 6px 10px; font-size: 12.5px; }
.lb-danger { color: var(--danger); }
.lb-photo-multi { display: flex; flex-direction: column; gap: 10px; }
.lb-photo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.lb-photo-count { font-size: 13px; font-weight: 600; color: var(--moss); }
.lb-ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.lb-ph-grid-sm { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.lb-ph { position: relative; display: block; width: 100%; aspect-ratio: 1; min-height: 44px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--line-soft); cursor: pointer; }
.lb-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-ph:hover { border-color: var(--sage); }
.lb-ph.is-selected { border-color: var(--moss); box-shadow: 0 0 0 2px rgba(45,74,43,.3); }
.lb-ph.is-hidden img { opacity: .55; }
.lb-ph-badge { position: absolute; top: 4px; left: 4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--moss); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.lb-ph-hidden { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; background: rgba(158,85,39,.9); color: #fff; font-size: 9.5px; line-height: 1.25; text-align: center; }
.lb-ph-flag { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--warn); }
.lb-sel-title { margin-top: 4px; }
.lb-sel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-sel-row { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lb-sel-row.is-over { border-color: var(--moss); box-shadow: 0 -3px 0 var(--moss); }
.lb-sel-row.is-dragging { opacity: .4; }
.lb-sel-row .lb-grip { width: 22px; min-height: 36px; }
.lb-sel-num { flex: 0 0 22px; height: 22px; border-radius: 999px; background: var(--moss); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.lb-sel-thumb { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--line-soft); }
.lb-sel-missing { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.lb-sel-main { flex: 1 1 auto; min-width: 0; }
.lb-sel-main .lb-input { min-height: 40px; padding: 6px 8px; font-size: 13px; }
.lb-sel-tools { flex: 0 0 auto; display: flex; }
.lb-sel-tools .lb-tool { width: 34px; height: 40px; }
.lb-image-picker { display: flex; flex-direction: column; gap: 8px; }
.lb-img-preview { display: flex; align-items: center; justify-content: center; min-height: 72px; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; background: var(--cream); }
.lb-img-preview img { max-width: 100%; max-height: 160px; border-radius: 6px; display: block; }
.lb-ph-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 12.5px; }
.lb-ph-list dt { font-family: var(--font-mono); color: var(--moss); }
.lb-ph-list dd { margin: 0; color: var(--muted); }
.modal-dlg.lb-lib-dlg { max-width: 760px; }
.lb-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.lb-lib-tile { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--cream); }
.lb-lib-pick { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; }
.lb-lib-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.lb-lib-pick span { display: block; padding: 4px 6px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-lib-del { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.92); }
.modal-dlg.lb-tpl-dlg { max-width: 900px; }
.lb-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.lb-tpl-card { display: flex; flex-direction: column; gap: 8px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.lb-tpl-card:hover { border-color: var(--moss); box-shadow: 0 4px 14px rgba(45,74,43,.14); }
.lb-tpl-thumb { display: flex; flex-direction: column; gap: 3px; height: 120px; padding: 10px; border-radius: 8px; background: var(--cream); border: 1px solid var(--line-soft); overflow: hidden; }
.lb-tpl-bar { flex: 0 0 6px; border-radius: 2px; background: var(--line); }
.lb-tpl-hero { flex-basis: 16px; background: var(--moss); }
.lb-tpl-heading { flex-basis: 8px; width: 60%; background: var(--sage); }
.lb-tpl-photo_gallery, .lb-tpl-image, .lb-tpl-image_text { flex-basis: 18px; background: repeating-linear-gradient(90deg, var(--sage-soft) 0 22%, transparent 22% 26%); }
.lb-tpl-line_items, .lb-tpl-time_entries, .lb-tpl-materials { flex-basis: 14px; background: repeating-linear-gradient(180deg, var(--line) 0 3px, transparent 3px 5px); }
.lb-tpl-totals, .lb-tpl-signature { width: 45%; align-self: flex-end; background: var(--ink-soft); }
.lb-tpl-page_break { flex-basis: 0; border-top: 2px dashed var(--sage); background: transparent; }
.lb-tpl-meta { display: flex; flex-direction: column; gap: 2px; }
.lb-tpl-name { font-size: 14px; font-weight: 600; }
.lb-tpl-desc { font-size: 12px; line-height: 1.4; color: var(--muted); }
.lb-shell button:focus-visible, .lb-shell input:focus-visible, .lb-shell select:focus-visible, .lb-shell textarea:focus-visible, .lb-tpl-card:focus-visible, .lb-lib-pick:focus-visible, .lb-lib-del:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.lb-switch input:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
@media (max-width: 1199px) {
  .modal-dlg.lb-dlg { width: 98vw; height: 94vh; max-height: 94vh; }
  .lb-body { grid-template-columns: minmax(0,1fr) 320px; grid-template-rows: auto minmax(0,1fr); }
  .lb-palette { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); max-height: 190px; padding: 10px 14px; }
  .lb-palette .lb-hint { margin-bottom: 8px; }
  .lb-pal-groups { flex-direction: row; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
  .lb-pal-group { flex: 0 0 auto; }
  .lb-pal-list { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 6px; }
  .lb-pal-card { width: 190px; min-height: 48px; }
  .lb-pal-desc { display: none; }
}
@media (max-width: 767px) {
  .modal-dlg.lb-dlg { width: 100%; height: auto; max-height: calc(100vh - 24px); overflow-y: auto; display: block; }
  .lb-dlg > .modal-b { display: block; overflow: visible; }
  .lb-dlg > .modal-b > form { display: block; }
  .lb-shell { display: block; }
  .lb-toolbar { padding: 8px; }
  .lb-tb-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lb-tabs { flex: 1 1 100%; }
  .lb-tab { flex: 1 1 0; }
  .lb-body { display: block; }
  .lb-col { overflow: visible; padding: 12px; }
  .lb-palette { max-height: none; border-bottom: 1px solid var(--line); }
  .lb-pal-groups { flex-direction: column; overflow: visible; }
  .lb-pal-list { display: grid; grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0,1fr)); grid-template-rows: none; }
  .lb-pal-card { width: auto; }
  .lb-props { border-left: 0; border-top: 1px solid var(--line); }
  .lb-canvas { padding: 4px; }
  .lb-item-tools .lb-tool { width: 40px; }
  .lb-item-bar { flex-wrap: wrap; }
  .lb-item-tools { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line-soft); }
}
