/* ================================================================
   KDPEasy PDF Assembler — styles
   Base copied from KDPEasy Margin Fixer's styles.css (same :root tokens
   and components, so the two tools feel like one product). Assembler-only
   additions are at the bottom of the file.
   System fonts only. No @font-face, no remote assets.
   ================================================================ */

:root {
  --bg:            #f8fafc;   /* slate-50    */
  --surface:       #ffffff;
  --surface-2:     #f1f5f9;   /* slate-100   */
  --border:        #e2e8f0;   /* slate-200   */
  --border-strong: #cbd5e1;   /* slate-300   */
  --text:          #0f172a;   /* slate-900   */
  --text-muted:    #64748b;   /* slate-500   */
  --accent:        #ea580c;   /* orange-600  */
  --accent-hover:  #c2410c;   /* orange-700  */
  --accent-soft:   #fff7ed;   /* orange-50   */
  --ok:            #059669;   /* emerald-600 */
  --warn:          #d97706;   /* amber-600   */
  --danger:        #dc2626;   /* red-600     */
  --radius:        10px;
  --shadow:        0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
}

* { box-sizing: border-box; }

/* Several elements below set an explicit `display`, which would otherwise beat
   the UA rule for [hidden]. Keep [hidden] authoritative. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------- header ---------------------------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.wordmark { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.wm-1 { color: var(--text); }
.wm-2 { color: var(--accent); }

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.privacy-pill svg { flex: none; color: var(--text-muted); }

.intro {
  margin: 0;
  padding: 12px 24px 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------------------------- layout ---------------------------- */

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 16px 24px 32px;
  max-width: 1500px;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.content { min-width: 0; }

/* ---------------------------- banners --------------------------- */

.banner-host:empty { display: none; }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
}
.banner p { margin: 0; }
.banner .banner-body { flex: 1 1 auto; min-width: 0; }
.banner .banner-x {
  flex: none;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
}
.banner .banner-x:hover { color: var(--text); }

/* ---------------------------- steps ----------------------------- */

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: opacity .25s ease;
}

.step.locked {
  opacity: .5;
  pointer-events: none;
}

.step-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.badge {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.step-label label { cursor: pointer; }

.help-btn {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.help-btn:hover { border-color: var(--accent); color: var(--accent); }

.popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
}

.step-body { display: block; }

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

.field { margin-top: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* ---------------------------- controls -------------------------- */

.control {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.control:hover { border-color: var(--text-muted); }

select.control {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.custom-row .control { width: 120px; }
.custom-row .unit { font-size: 13px; color: var(--text-muted); }

.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  flex: 1 1 0;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.seg.seg-sm { padding: 2px; }
.seg.seg-sm .seg-btn { min-height: 30px; padding: 4px 14px; font-size: 12px; flex: none; }

.note-warn {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.chip {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.chip .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  margin-left: 4px;
  vertical-align: -1px;
}

.info-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.info-panel summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius);
}
.info-panel summary:hover { color: var(--text); }
.info-panel p {
  margin: 0;
  padding: 0 12px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* file info line */
.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-word;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); }

/* ---------------------------- buttons --------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-secondary {
  width: 100%;
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--text-muted); }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  margin-top: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-swatch:hover { border-color: var(--text-muted); }

.swatch-lg {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.solid-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.solid-color-row .link-btn { margin-top: 8px; }

/* Solid bar so cards scrolling underneath never show through the button. */
.sidebar-foot {
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 12px 0 4px;
  background: var(--bg);
  box-shadow: 0 -10px 10px -6px var(--bg);
}

.spinner {
  width: 14px; height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------- toolbar --------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 2px 10px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 30px;
}
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------------------------- stage ----------------------------- */

.stage {
  position: relative;
  height: min(70vh, 640px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage.dragover .empty { border-color: var(--accent); background: var(--accent-soft); }

.empty {
  position: absolute;
  inset: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
}
.empty svg { color: var(--border-strong); margin-bottom: 8px; }
.empty-head { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.empty-sub { margin: 0; font-size: 13px; }
.empty-muted { margin: 6px 0 0; font-size: 12px; color: #94a3b8; }

.empty-privacy {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ------------------------ compare slider ------------------------ */

.compare { position: absolute; inset: 0; }

.layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.layer-before canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

.sheet {
  position: relative;
  display: block;
  background: #fff;
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 16px rgba(15,23,42,.14);
}
.sheet canvas { display: block; width: 100%; height: 100%; }
.sheet .overlay { position: absolute; inset: 0; pointer-events: none; }

.cmp-label {
  position: absolute;
  top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: rgba(248,250,252,.8);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}
.cmp-left { left: 10px; }
.cmp-right { right: 10px; }

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  z-index: 5;
}

.handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px; height: 34px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: ew-resize;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(15,23,42,.18);
  user-select: none;
}

/* ---------------------------- toast ----------------------------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  font-size: 13px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-left: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toast strong { font-weight: 600; }

/* ---------------------------- readout --------------------------- */

.readout {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.readout-main { margin: 0; font-size: 14px; font-weight: 600; }
.readout-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }

.quality { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.q-title { margin: 0; font-size: 13px; font-weight: 600; }
.q-copy { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.q-ok    .q-title { color: var(--ok); }
.q-warn  .q-title { color: var(--warn); }
.q-bad   .q-title { color: var(--danger); }
.q-copy a { color: var(--accent); }

/* ---------------------------- footer ---------------------------- */

.app-footer {
  padding: 20px 24px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.app-footer p { margin: 0 0 4px; font-size: 12px; color: var(--text-muted); }

/* ---------------------------- responsive ------------------------ */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 16px 96px;
  }
  .sidebar { position: static; }
  .sidebar-foot {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    padding: 10px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: none;
  }
  .seg.seg-sm .seg-btn { min-height: 40px; }
  .app-header { padding: 12px 16px; }
  .intro { padding: 12px 16px 0; }
  .app-footer { padding-bottom: 88px; }
  .stage { height: min(60vh, 520px); }
}

@media (max-width: 420px) {
  .privacy-pill { font-size: 11px; }
  .layout { padding-left: 12px; padding-right: 12px; }
}

/* Desktop: keep the preview (toolbar + stage) pinned in view while the
   sidebar scrolls, so the whole image stays visible next to the controls
   (e.g. when picking a color from it). */
@media (min-width: 981px) {
  .layout { align-items: stretch; }
  .sidebar { align-self: start; }
  .preview-pin { position: sticky; top: 16px; z-index: 5; }
}


/* "Save as" (PNG / JPG) card above the Download button */
.format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.format-row .field-label { margin: 0; }
#stepFormat .hint { margin: 8px 0 0; }


/* ================================================================
   PDF Assembler additions
   ================================================================ */

/* ---------------------------- misc controls --------------------- */

.control-num { width: 120px; }
.control-sm { min-height: 36px; padding: 6px 30px 6px 10px; font-size: 13px; }

.check-top { align-items: flex-start; color: var(--text); }
.check-top input { margin-top: 2px; flex: none; }
.check-top strong { display: block; font-size: 13px; font-weight: 600; }
.check-sub { display: block; font-size: 12px; color: var(--accent); font-weight: 500; }

.info-body { padding: 0 12px 12px; }
.info-body .hint { margin-top: 6px; }

.note-ok {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.summary p { margin: 0; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------------------------- size meter ------------------------ */

.size-meter {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.size-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.size-label { font-weight: 600; }
.size-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.size-bar {
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.size-fill { height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width .25s ease; }
.size-copy { margin: 6px 0 0; font-size: 11px; color: var(--text-muted); }
.size-meter.is-warn .size-fill { background: var(--warn); }
.size-meter.is-warn .size-val  { color: var(--warn); }
.size-meter.is-bad  { border-color: #fecaca; background: #fef2f2; }
.size-meter.is-bad  .size-fill { background: var(--danger); }
.size-meter.is-bad  .size-val  { color: var(--danger); }
.size-meter.is-bad  .size-copy { color: #991b1b; }

/* ---------------------------- panels ---------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-title { margin: 0; font-size: 14px; font-weight: 600; }
.panel-title .count { color: var(--text-muted); font-weight: 500; }
.panel-hint { margin: 0; font-size: 12px; color: var(--text-muted); }

/* The drop zone lives in normal flow here (Margin Fixer's is absolutely
   positioned inside its stage). */
.pages-panel .empty {
  position: static;
  min-height: 260px;
}
.pages-panel.dragover .empty,
.pages-panel.dragover .page-grid { border-color: var(--accent); background: var(--accent-soft); }

/* ---------------------------- page grid ------------------------- */

.page-grid {
  list-style: none;
  margin: 0;
  padding: 4px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  max-height: 440px;
  overflow-y: auto;
  border: 2px dashed transparent;
  border-radius: var(--radius);
}

.page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}
.page-card:hover { border-color: var(--border-strong); }
.page-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.page-card.is-dragging { opacity: .35; }
.page-card.drop-before::before,
.page-card.drop-after::after {
  content: "";
  position: absolute;
  top: 4px; bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.page-card.drop-before::before { left: -8px; }
.page-card.drop-after::after  { right: -8px; }

.card-top {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.card-num { flex: 1 1 auto; font-weight: 600; color: var(--text); white-space: nowrap; }
.card-side { font-weight: 400; color: var(--text-muted); }
.card-handle { flex: none; cursor: grab; color: #94a3b8; font-size: 12px; line-height: 1; padding: 0 2px; }
.card-x {
  flex: none;
  width: 20px; height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.card-x:hover { background: #fee2e2; color: var(--danger); }

.card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 128px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.card-thumb canvas { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 1px 3px rgba(15,23,42,.18); }

.card-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-dims { font-size: 11px; color: var(--text-muted); }

.status {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}
.status-ok      { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.status-resize  { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.status-low     { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.status-loading { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }
.status-error   { color: #991b1b; background: #fef2f2; border-color: #fecaca; }

.card-flags { display: flex; gap: 4px; flex-wrap: wrap; }
.card-flags:empty { display: none; }
.flag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  color: #334155;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.flag-crop { color: #92400e; background: #fffbeb; border-color: #fde68a; }

.page-card.is-error .card-thumb { background: #fef2f2; color: var(--danger); font-size: 24px; }

/* ---------------------------- preview --------------------------- */

.preview-panel .stage { height: min(64vh, 620px); }

.toolbar-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  min-width: 0;
}

/* A page used as-is has no "before" — show it alone. */
.compare.single .layer-before,
.compare.single .divider,
.compare.single .cmp-label { display: none; }
.compare.single .layer-after { clip-path: none !important; -webkit-clip-path: none !important; }

.stage-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(241,245,249,.75);
  z-index: 6;
}
.spinner-dark { border-color: rgba(100,116,139,.3); border-top-color: var(--text-muted); }

.override-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.override-row .field-label { margin: 0; flex: none; }
.override-row .control { width: auto; min-width: 220px; }

/* ---------------------------- responsive ------------------------ */

@media (max-width: 980px) {
  /* the fixed bottom bar now also holds the size meter */
  .layout { padding-bottom: 160px; }
  .app-footer { padding-bottom: 150px; }
  .sidebar-foot .size-meter { margin-bottom: 8px; padding: 6px 10px; }
  .size-copy { display: none; }
  .size-meter.is-bad .size-copy { display: block; }
  .page-grid { max-height: none; }
  .override-row { flex-wrap: wrap; }
  .override-row .control { min-width: 0; width: 100%; }
}

@media (max-width: 420px) {
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
