/* Shared stage for in-browser tools (templates/partials/local_tool_stage.html) */
.local-tool {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
}
/* `hidden` must win over layout classes such as .control-row { display: flex } (data-lt-show, per-format controls). */
.local-tool [hidden] { display: none !important; }
.lt-drop { cursor: pointer; }
.lt-drop.is-disabled { opacity: 0.5; pointer-events: none; }
.lt-stays {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
  color: var(--ok);
  font-size: 0.88rem;
  font-weight: 600;
}
.lt-file {
  display: grid;
  gap: 0.3rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
}
.lt-file-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
}
.lt-file-name { font-weight: 600; overflow-wrap: anywhere; }
.lt-file-size { color: var(--muted); }
.lt-output { margin: 0; color: var(--muted); font-size: 0.88rem; }
.lt-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.lt-options:empty { display: none; }
/* Studio editors (full-width children only) stack in a grid. They switch layout by their own width through
   [data-wide], set by local-tool.js (data-wide-min) — not CSS container queries: with size containment on the editor
   root, Chromium-based browsers intermittently built no layout boxes for its children on load under CPU load
   (≈25% of loads at 6× CPU; 0 of 18 without containment). */
.lt-options:has(> .ps, > .pp, > .dpi) { display: grid; gap: 0.75rem; }
.lt-options .control-row { margin: 0; }
/* Rows and their fields may shrink to the card: a long option or hint must not push them past a phone screen. */
.lt-options > * { min-width: 0; max-width: 100%; }
.lt-options .control-row > input[type="number"],
.lt-options .control-row > input[type="text"] {
  min-height: 40px;
  min-width: 0;
  max-width: 100%;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* under 16px, iOS zooms the page on focus */
}
/* flex (not width) so rows laid out as grids (photo studio panels) keep their full-width fields */
.lt-options .control-row > input[type="number"] { flex: 0 0 7.5rem; }
@media (pointer: coarse) {
  .lt-options .control-row > input[type="number"],
  .lt-options .control-row > input[type="text"] { min-height: 44px; }
}
.lt-options:disabled { opacity: 0.6; }
.lt-audio { width: 100%; }
.lt-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.lt-actions [data-lt-run]:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.lt-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}
.lt-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.lt-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
/* The fill scales instead of resizing: a transform animates on the compositor, so the bar keeps moving smoothly while
   the main thread is busy encoding (low-end phones). */
.lt-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.2s ease;
}
.lt-track.is-indeterminate .lt-fill {
  width: 35%;
  transform: none;
  transition: none;
  animation: progress-slide 1.2s ease-in-out infinite;
}
.lt-msg {
  margin: 0;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.92rem;
}
.lt-msg.is-error, .lt-msg.svc-error { border-color: rgba(248, 113, 113, 0.55); color: #f87171; }
.lt-msg.is-info { color: var(--muted); }
.lt-result { display: grid; gap: 0.75rem; }
.lt-preview {
  width: 100%;
  max-height: 360px;
  border-radius: 12px;
  background: #000;
}
.lt-note { margin: 0; color: var(--ok); font-weight: 600; }
.lt-notes { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.9rem; }
.lt-result-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.lt-estimate { margin: 0; color: var(--muted); font-size: 0.88rem; }
.lt-wide { flex-basis: 100%; }
.lt-hint { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.82rem; }
.lt-hint.lt-error-text { color: #f87171; }
.lt-hint.lt-error-text:empty { display: none; }
.lt-radios { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; border: 0; padding: 0; }
.lt-radios legend { width: 100%; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.9rem; }
.lt-radios label, .lt-check label { display: inline-flex; gap: 0.4rem; align-items: center; min-height: 2.25rem; cursor: pointer; }
.lt-stats { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.lt-stats:empty { display: none; }
.lt-stats th, .lt-stats td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; }
.lt-stats thead th { color: var(--muted); font-weight: 600; }

/* Extra file inputs (e.g. the audio file of Add Audio) */
.lt-slot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.lt-slot.has-file { border-style: solid; }
.lt-slot-label { font-weight: 600; }
.lt-slot-input { max-width: 100%; }
.lt-slot-name { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }

/* Crop editor */
.lt-crop { display: grid; gap: 0.5rem; }
.lt-crop-stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.lt-crop-video { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.lt-crop.is-numeric-only .lt-crop-video { visibility: hidden; }
.lt-crop.is-numeric-only .lt-crop-scrub { display: none; }
.lt-crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  touch-action: none;
  outline: none;
}
.lt-crop-box:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), 0 0 0 3px var(--brand); }
.lt-crop-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #fff;
  touch-action: none;
}
.lt-crop-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.lt-crop-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.lt-crop-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.lt-crop-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.lt-crop-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.lt-crop-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.lt-crop-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.lt-crop-handle--w { left: 0; top: 50%; cursor: ew-resize; }
.lt-crop-scrub { display: flex; gap: 0.6rem; align-items: center; font-size: 0.88rem; color: var(--muted); }
.lt-crop-scrub input { flex: 1; }
.lt-crop-fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.lt-crop-fields input { width: 7rem; }
/* Merge clip list */
.lt-clips { display: grid; gap: 0.5rem; margin: 0.5rem 0; padding: 0; list-style: none; }
.lt-clip {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card, transparent);
}
.lt-clip.is-dragging { opacity: 0.6; }
.lt-clip.is-target { border-color: var(--brand); box-shadow: 0 -3px 0 var(--brand); }
.lt-clip-grip {
  flex: none;
  padding: 0.5rem 0.35rem;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
  letter-spacing: -2px;
}
.lt-clip-body { display: grid; gap: 0.15rem; flex: 1; min-width: 0; }
.lt-clip-name { overflow-wrap: anywhere; font-size: 0.92rem; }
.lt-clip-info { color: var(--muted); font-size: 0.82rem; }
.lt-clip-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.lt-clip-btn { min-width: 2.5rem; min-height: 2.5rem; padding: 0.3rem 0.6rem; }
.lt-clip-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.lt-clip-player { display: grid; gap: 0.5rem; justify-items: start; }
.lt-clip-video, .lt-aa-video { width: 100%; max-height: 300px; border-radius: 12px; background: #000; }
.lt-aa-preview { display: grid; gap: 0.4rem; justify-items: start; }

.lt-clip-status { font-size: 0.82rem; font-weight: 600; overflow-wrap: anywhere; }
.lt-clip-status.is-ok { color: var(--ok); }
.lt-clip-status.is-error { color: #f87171; }
.lt-batch-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Image tools */
label.lt-check { display: inline-flex; gap: 0.45rem; align-items: center; min-height: 2.25rem; cursor: pointer; }
label.lt-check.lt-inline { margin-right: 0.9rem; }
.lt-check.lt-warn { color: #fbbf24; }
.lt-subset { display: flex; flex-wrap: wrap; gap: 0 0.5rem; border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.8rem 0.6rem; }
.lt-subset legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.9rem; }
.lt-disclaimer {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.08);
  font-size: 0.9rem;
}
.lt-image { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; border-radius: 10px; background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.lt-outputs { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.lt-output-item { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 10px; }
.lt-output-item.is-error { border-color: rgba(248, 113, 113, 0.55); }
.lt-output-name { flex: 1; min-width: 10rem; font-weight: 600; overflow-wrap: anywhere; }
.lt-output-info { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.lt-copy-box { display: grid; gap: 0.5rem; justify-items: start; }
.lt-copy-box textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 0.8rem; }

.lt-cropper .lt-crop-stage { width: fit-content; max-width: 100%; line-height: 0; }
.lt-crop-img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; pointer-events: none; }
.lt-crop-box.is-round { border-radius: 50%; }
.lt-crop-box.is-round .lt-crop-h { border-radius: 50%; }
.lt-crop-h {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #fff;
  touch-action: none;
}
.lt-crop-h--nw { left: 0; top: 0; cursor: nwse-resize; }
.lt-crop-h--n { left: 50%; top: 0; cursor: ns-resize; }
.lt-crop-h--ne { left: 100%; top: 0; cursor: nesw-resize; }
.lt-crop-h--e { left: 100%; top: 50%; cursor: ew-resize; }
.lt-crop-h--se { left: 100%; top: 100%; cursor: nwse-resize; }
.lt-crop-h--s { left: 50%; top: 100%; cursor: ns-resize; }
.lt-crop-h--sw { left: 0; top: 100%; cursor: nesw-resize; }
.lt-crop-h--w { left: 0; top: 50%; cursor: ew-resize; }
.lt-crop-guide { position: absolute; inset: 0; pointer-events: none; }
/* Head guide for passport photos: an oval for the face, a line for the eyes. */
.lt-crop-guide--head::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 10%;
  bottom: 22%;
  border: 2px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
}
.lt-crop-guide--head::after { content: ""; position: absolute; left: 15%; right: 15%; top: 42%; border-top: 1px dashed rgba(255, 255, 255, 0.6); }
.lt-rotate-preview { display: grid; justify-items: center; gap: 0.3rem; }
.lt-rotate-preview canvas { max-width: 100%; max-height: 320px; border-radius: 8px; }

.lt-profile-layout { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.lt-profile-layout > [data-crop-host] { flex: 1 1 320px; min-width: 0; }
.lt-profile-preview { display: grid; justify-items: center; gap: 0.35rem; margin: 0; color: var(--muted); font-size: 0.85rem; }
.lt-profile-preview canvas { width: 160px; height: 160px; background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 16px 16px; border-radius: 8px; }

.lt-meta-wrap, .lt-meta { display: grid; gap: 0.75rem; }
.lt-meta-alert {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(248, 113, 113, 0.55);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  font-weight: 600;
}
.lt-meta-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lt-meta-table caption { text-align: left; font-weight: 700; padding: 0.2rem 0; }
.lt-meta-table th, .lt-meta-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.lt-meta-table tbody th { width: 40%; color: var(--muted); font-weight: 600; }
.lt-meta-table.is-sensitive, .lt-meta-table tr.is-sensitive td { color: #fca5a5; }
.lt-meta-compare td.is-present { color: #fca5a5; }
.lt-meta-compare td.is-absent { color: var(--ok); }
.lt-meta-raw summary { cursor: pointer; font-weight: 600; min-height: 2.25rem; display: flex; align-items: center; }
.lt-badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; vertical-align: middle; }
.lt-badge--warn { background: rgba(248, 113, 113, 0.18); color: #f87171; }
.lt-badge:not(.lt-badge--warn) { background: rgba(148, 163, 184, 0.18); }

pre.lt-copy-box { display: block; margin: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(0, 0, 0, 0.18); font: 0.85rem/1.45 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; }
.lt-copy { min-height: 2.25rem; }
.lt-qr-preview { display: grid; justify-items: center; gap: 0.35rem; margin: 0; color: var(--muted); font-size: 0.85rem; }
.lt-qr-preview canvas { width: 220px; height: 220px; image-rendering: pixelated; border-radius: 6px; background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.lt-qr-payloads { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.lt-qr-payload { display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px; }
.lt-qr-payload-head, .lt-qr-payload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.lt-qr-wifi { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.75rem; margin: 0; font-size: 0.88rem; }
.lt-qr-wifi dt { color: var(--muted); }
.lt-qr-wifi dd { margin: 0; overflow-wrap: anywhere; }
.lt-palette { display: grid; gap: 1rem; }
.lt-swatches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.75rem; }
.lt-swatch { display: grid; gap: 0.4rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 10px; }
.lt-swatch-chip { display: flex; align-items: flex-end; justify-content: flex-end; height: 64px; padding: 0.35rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 700; }
.lt-swatch-codes { display: grid; gap: 0.25rem; }
.lt-swatch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-size: 0.82rem; }
.lt-swatch-row code { overflow-wrap: anywhere; }
.lt-swatch-row .lt-copy { min-height: 2rem; padding: 0.15rem 0.55rem; font-size: 0.78rem; }
.lt-palette-css { display: grid; gap: 0.5rem; justify-items: start; }
.lt-palette-css h3 { margin: 0; font-size: 0.95rem; }
.lt-palette-css pre { width: 100%; }

/* PDF tools */
.lt-pdf-pw { display: grid; gap: 0.35rem; flex-basis: 100%; padding: 0.75rem; border: 1px solid rgba(251, 191, 36, 0.5); border-radius: 12px; }
.lt-pw-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.lt-pw-row input { flex: 1 1 14rem; min-width: 0; }
.pdf-files { margin: 0; }
.pdf-file-thumb { flex: none; display: grid; place-items: center; width: 44px; height: 56px; overflow: hidden; border-radius: 4px; background: rgba(148, 163, 184, 0.12); }
.pdf-file-thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 0 0 1px var(--border); }
.lt-clip.is-warn { border-color: rgba(251, 191, 36, 0.6); }
.pdf-file-extra { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; align-items: center; margin-top: 0.2rem; font-size: 0.82rem; }
.pdf-file-extra input { min-height: 2.1rem; padding: 0.2rem 0.5rem; font-size: 0.85rem; max-width: 12rem; }

.pg { display: grid; gap: 0.6rem; flex-basis: 100%; min-width: 0; }
.pg-bar, .pe-bar { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.pg-bar .btn-ghost, .pe-bar .btn-ghost { min-height: 2.4rem; padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.pg-bar .btn-ghost:disabled, .pe-bar .btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.7rem; margin: 0; padding: 0.2rem; list-style: none; max-height: 70vh; overflow: auto; }
.pg-tile { position: relative; display: grid; gap: 0.25rem; justify-items: center; padding: 0.45rem 0.35rem 0.35rem; border: 2px solid transparent; border-radius: 10px; background: rgba(148, 163, 184, 0.08); cursor: pointer; user-select: none; outline: none; }
.pg-tile:focus-visible { border-color: var(--brand); }
.pg-tile.is-selected { border-color: var(--brand); background: rgba(99, 102, 241, 0.16); }
.pg-tile.is-selected::after { content: "✓"; position: absolute; top: 4px; left: 6px; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.8rem; line-height: 1.3rem; text-align: center; }
.pg-tile.is-dragging { opacity: 0.4; }
.pg-tile.is-drop-before { box-shadow: -5px 0 0 -1px var(--brand); }
.pg-tile.is-drop-after { box-shadow: 5px 0 0 -1px var(--brand); }
.pg-thumb { display: grid; place-items: center; width: 100px; height: 130px; }
.pg-thumb canvas { max-width: 100px; max-height: 130px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); transition: transform 0.15s ease; }
.pg-thumb[data-rotate="90"] canvas { transform: rotate(90deg); max-width: 130px; max-height: 100px; }
.pg-thumb[data-rotate="180"] canvas { transform: rotate(180deg); }
.pg-thumb[data-rotate="270"] canvas { transform: rotate(270deg); max-width: 130px; max-height: 100px; }
.pg-num { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-grip { position: absolute; top: 2px; right: 4px; padding: 0.15rem 0.3rem; color: var(--muted); cursor: grab; touch-action: none; letter-spacing: -2px; font-size: 0.85rem; }
.pg-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.15rem; }
.pg-tool { min-width: 1.9rem; min-height: 1.9rem; padding: 0.1rem 0.25rem; font-size: 0.8rem; line-height: 1; }
.pg-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (hover: hover) and (pointer: fine) {
  .pg-tile .pg-tools { opacity: 0; transition: opacity 0.12s; }
  .pg-tile:hover .pg-tools, .pg-tile:focus-within .pg-tools, .pg-tile.is-selected .pg-tools { opacity: 1; }
}

.pe { display: grid; gap: 0.5rem; flex-basis: 100%; min-width: 0; }
.pe-page-select { min-height: 2.4rem; max-width: 12rem; }
.pe-stage { max-height: 75vh; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(148, 163, 184, 0.12); }
.pe-page { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.pe-canvas, .pe-layer { position: absolute; inset: 0; }
.pe-canvas canvas { display: block; }
.pe-layer { outline: none; touch-action: pan-x pan-y; }
.pe-layer:focus-visible { box-shadow: 0 0 0 3px var(--brand); }
.pe-layer[data-mode="draw"], .pe-layer[data-mode="rect"] { cursor: crosshair; touch-action: none; }
.pe-item { position: absolute; box-sizing: border-box; cursor: move; touch-action: none; }
.pe-item.is-selected { outline: 2px dashed var(--brand); outline-offset: 2px; }
.pe-text { white-space: pre; padding: 0; }
.pe-image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.pe-highlight { mix-blend-mode: multiply; opacity: 0.9; }
.pe-whiteout { box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6); }
.pe-redact { background: #000; }
.pe-redact.is-selected { outline-color: #f87171; }
.pe-draft-rect { border: 1px dashed var(--brand); background: rgba(99, 102, 241, 0.15); }
.pe-draft-rect.pe-redact { background: rgba(0, 0, 0, 0.7); }
.pe-draft { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pe-path svg { display: block; overflow: visible; }
.pe-handle { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; cursor: nwse-resize; display: none; }
.pe-item.is-selected .pe-handle { display: block; }
.pdf-tools-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; flex-basis: 100%; }
.pdf-tools-row .btn-ghost[aria-pressed="true"] { border-color: var(--brand); background: rgba(99, 102, 241, 0.2); }
/* The label is the button; its native "Choose file" control stays focusable but out of sight. */
.pdf-file-btn { position: relative; cursor: pointer; }
.pdf-file-btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.pdf-file-btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.pdf-panel { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: flex-end; flex-basis: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 12px; }
.pdf-panel textarea { min-height: 4.5rem; width: min(100%, 26rem); }
.sig-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; flex-basis: 100%; }
.sig-pad { height: 170px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; }
.sig-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-typed { padding: 0.4rem 0.8rem; min-height: 3.5rem; border-radius: 10px; background: #fff; color: #1e3a8a; font-size: 2rem; line-height: 1.4; overflow-wrap: anywhere; }
.pdf-text-out { width: 100%; min-height: 14rem; font-family: ui-monospace, monospace; font-size: 0.82rem; }
.pdf-summary { display: grid; gap: 0.25rem; margin: 0; flex-basis: 100%; font-size: 0.88rem; color: var(--muted); }

@media (max-width: 560px) {
  .lt-clip { flex-wrap: wrap; }
  .lt-clip-actions { width: 100%; justify-content: flex-end; }
  .pg-list { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .pg-thumb { width: 86px; height: 112px; }
  .pg-thumb canvas { max-width: 86px; max-height: 112px; }
  .pe-handle { width: 26px; height: 26px; right: -13px; bottom: -13px; }
  .lt-crop-img { max-height: 50vh; }
  .lt-crop-h { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
}
@media (prefers-reduced-motion: reduce) {
  .lt-fill { transition: none; }
  .lt-track.is-indeterminate .lt-fill { animation: none; width: 100%; transform: none; opacity: 0.5; }
}

/* ── Photo Studio (Step 1A): shared bits ──────────────────────────────────────────────────────────── */
.lt-privacy-claim {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: -0.25rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--ok) 38%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ok) 9%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}
.lt-privacy-claim svg { flex: none; margin-top: 0.1rem; color: var(--ok); }
/* Real processing steps (ctx.steps): marked only when the tool reports that stage. */
.lt-steps { display: grid; gap: 0.35rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.88rem; }
.lt-step { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); }
.lt-step-dot {
  flex: none;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.lt-step.is-active { color: var(--text); font-weight: 600; }
.lt-step.is-active .lt-step-dot { border-color: var(--brand); background: var(--brand); transform: scale(1.15); animation: lt-step-pulse 1.4s ease-in-out infinite; }
.lt-step.is-done { color: var(--text); }
.lt-step.is-done .lt-step-dot { border-color: var(--ok); background: var(--ok); }
@keyframes lt-step-pulse { 50% { opacity: 0.55; } }
/* Editor tools: the drop zone gives way to the editor once a photo is open (Change photo stays in the toolbar). */
.local-tool[data-collapse-drop].lt-has-file .lt-drop { display: none; }
@media (max-width: 768px) {
  .local-tool[data-collapse-drop].lt-has-file .lt-actions {
    position: sticky;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    margin: 0 -0.5rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  }
  .local-tool[data-collapse-drop].lt-has-file .lt-actions [data-lt-run] { flex: 1; }
}

/* ── Passport Photo Maker Pro ─────────────────────────────────────────────────────────────────────── */
.pp {
  --pp-aspect: 0.7778;
  --pp-accent: var(--brand);
  --pp-radius: 18px;
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.pp-appbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-height: 52px;
  padding: 0.45rem 0.15rem;
  position: sticky;
  top: 0;
  z-index: 12;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.pp-appbar-text { flex: 1 1 auto; min-width: 0; }
.pp-appbar-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pp-accent);
}
.pp-appbar-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.pp-appbar .pp-mode {
  flex: 0 0 auto;
  min-width: min(100%, 14rem);
  padding: 0.3rem;
  border-radius: 999px;
}
.pp-appbar .pp-mode-btn {
  min-height: 44px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.pp-landing {
  display: grid;
  place-items: stretch;
  width: 100%;
  padding: 0.15rem 0 0.35rem;
  animation: pp-rise 0.38s ease both;
}
.pp.has-photo .pp-landing { display: none; }
/* Quick empty = landing only. Pro empty = landing + real settings (Pro must not be a dead toggle). */
.pp:not(.has-photo) .pp-editor { display: none; }
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-editor { display: grid; }
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-view,
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-flow,
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-toolbar,
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-readout,
.pp:not(.has-photo)[data-pp-mode="pro"] #lt-pp-help { display: none !important; }
.pp:not(.has-photo)[data-pp-mode="pro"] .pp-landing { margin-bottom: 0.35rem; }
.pp-landing-card {
  width: 100%;
  max-width: none;
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  text-align: center;
  padding: clamp(1.5rem, 3.5vw, 2.4rem) clamp(1.15rem, 4vw, 2.5rem);
  border-radius: calc(var(--pp-radius) + 6px);
  border: 1px solid color-mix(in srgb, var(--pp-accent) 28%, var(--border));
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--pp-accent) 16%, transparent), transparent 55%),
    var(--surface-solid, var(--surface));
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),
    0 22px 48px rgba(0, 0, 0, 0.22);
}
.pp-landing-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 38%, transparent);
}
.pp-landing-title { margin: 0; font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 750; letter-spacing: -0.02em; }
.pp-landing-lead { margin: 0; max-width: 40rem; color: var(--muted); font-size: 1.02rem; line-height: 1.55; }
.pp-landing-cta {
  min-height: 54px;
  width: min(100%, 28rem);
  margin-top: 0.35rem;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 36%, transparent);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.pp-landing-cta:hover { filter: brightness(1.05); transform: translateY(-1px); }
.pp-landing-cta:active { transform: scale(0.98); }
.pp-landing.is-drag .pp-landing-card {
  border-color: var(--pp-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pp-accent) 35%, transparent), 0 22px 48px rgba(0, 0, 0, 0.22);
}
.pp-landing-formats { margin: 0; color: var(--muted); font-size: 0.82rem; }
.pp-landing-points {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  max-width: 44rem;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  text-align: start;
  font-size: 0.95rem;
}
@media (min-width: 720px) {
  .pp-landing-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    max-width: none;
  }
  .pp-landing-points li {
    min-height: 100%;
    align-content: start;
  }
}
.pp-landing-points li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.pp-landing-points li::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}
.pp-editor { display: grid; gap: 1rem; min-width: 0; animation: pp-rise 0.34s ease both; }
@keyframes pp-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.pp-flow { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.pp-flow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.pp-flow-step span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: 0.75rem;
}
.pp-flow-step.is-current { color: var(--text); border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.pp-flow-step.is-current span { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
.pp-flow-step.is-done span { background: var(--ok); color: #fff; }
.pp-grid { display: grid; gap: 1.1rem; min-width: 0; }
.pp-view { display: grid; gap: 0.6rem; justify-items: center; min-width: 0; }
.pp-stage-wrap { display: grid; justify-items: center; gap: 0.5rem; width: 100%; }
.pp-stage {
  --pp-max-h: min(52svh, 520px);
  position: relative;
  width: min(100%, calc(var(--pp-max-h) * var(--pp-aspect)));
  aspect-ratio: var(--pp-aspect);
  border-radius: var(--pp-radius);
  overflow: hidden;
  background:
    repeating-conic-gradient(rgba(127, 127, 127, 0.16) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px,
    var(--surface-solid);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--border) 90%, transparent),
    0 1px 0 color-mix(in srgb, var(--text) 8%, transparent) inset,
    0 22px 50px rgba(0, 0, 0, 0.28);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.pp-stage:focus-visible { box-shadow: 0 0 0 3px var(--brand), 0 18px 50px rgba(0, 0, 0, 0.32); }
.pp.is-dragging .pp-stage { cursor: grabbing; }
.pp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: scale(0.985); transition: opacity 0.28s ease, transform 0.28s ease; }
.pp.has-photo .pp-canvas { opacity: 1; transform: none; }
.pp-guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pp-g-band { fill: rgba(56, 189, 248, 0.16); }
.pp-g-crown { fill: rgba(56, 189, 248, 0.18); }
.pp-g-chin { fill: rgba(167, 139, 250, 0.18); }
.pp-g-eyes { fill: rgba(52, 211, 153, 0.16); }
.pp-g-oval { fill: none; stroke: rgba(255, 255, 255, 0.92); stroke-width: 1.5px; stroke-dasharray: 5 4; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.75)); }
.pp-g-center { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1px; stroke-dasharray: 3 4; }
.pp-loading { position: absolute; inset: 0; display: none; overflow: hidden; pointer-events: none; }
.pp.is-loading .pp-loading { display: block; }
.pp-loading span {
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  animation: pp-sheen 1.1s ease-in-out infinite;
}
@keyframes pp-sheen { to { transform: translateX(270%); } }
/* Crown / chin helper markers (positioned in % of the frame by the script). */
.pp-mark {
  --x: 50%;
  position: absolute;
  left: 0;
  right: 0;
  display: none;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 2px solid #38bdf8;
  background: none;
  color: inherit;
  font: inherit;
  cursor: ns-resize;
  touch-action: none;
}
.pp-mark--chin { border-top-color: #a78bfa; }
.pp.is-aligning .pp-mark { display: block; }
.pp-mark span {
  position: absolute;
  left: var(--x);
  top: -1.05rem;
  transform: translateX(-50%);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #0b1220;
  color: #e2f3ff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.pp-mark::after { content: ""; position: absolute; inset: -14px 0 -14px 0; }
.pp-mark:focus-visible { outline: none; border-top-width: 3px; }
.pp-mark:focus-visible span { box-shadow: 0 0 0 2px var(--brand); }
.pp-chip { margin: 0; padding: 0.45rem 0.75rem; border-radius: 12px; font-size: 0.82rem; line-height: 1.45; max-width: 34rem; }
.pp-chip--warn { border: 1px solid rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.12); color: var(--text); }
.pp-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; }
.pp-tool {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.pp-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pp-tool:hover { border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.pp-tool:active { transform: scale(0.95); }
.pp-tool:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pp-tool--text { font-size: 0.84rem; font-weight: 600; }
.pp-readout { display: grid; gap: 0.25rem; margin: 0; width: 100%; max-width: 34rem; font-size: 0.82rem; }
.pp-readout div { display: flex; gap: 0.5rem; }
.pp-readout dt { flex: none; min-width: 4.5rem; color: var(--muted); }
.pp-readout dd { margin: 0; font-variant-numeric: tabular-nums; }
.pp-readout dd.is-warn { color: #f59e0b; font-weight: 600; }
.pp-panels { display: grid; gap: 0.9rem; min-width: 0; align-content: start; }
.pp-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.pp-tab {
  min-height: 42px;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.pp-tab[aria-selected="true"] { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
.pp-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pp-panel { display: grid; gap: 0.75rem; min-width: 0; padding: 0.95rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.pp-panel .control-row { display: grid; gap: 0.3rem; margin: 0; }
.pp-panel .control-row label { font-size: 0.86rem; font-weight: 600; }
.pp-panel .control-row select, .pp-panel .control-row input[type="number"], .pp-panel .control-row input[type="range"] { width: 100%; }
.pp-panel-title { display: none; margin: 0; font-size: 1rem; }
.pp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 0.6rem; }
.pp-align { display: grid; gap: 0.4rem; padding: 0.7rem; border: 1px dashed var(--border); border-radius: 12px; }
.pp-align-actions, .pp-adjust-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pp-align-actions .btn-ghost[aria-pressed="true"], .pp-adjust-actions .btn-ghost[aria-pressed="true"] { border-color: var(--brand); color: var(--text); }
.pp-sheet { display: grid; justify-items: center; gap: 0.4rem; margin: 0; padding: 0.7rem; border-radius: 12px; background: rgba(127, 127, 127, 0.1); }
.pp-sheet-canvas { display: block; max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28); background: #fff; }
/* Narrow editors (phones, tablets, laptops with the sidebar): one panel at a time under the tabs, and the photo
   stays in view while the panel below scrolls. The layout follows the editor's own width, not the window's. */
.pp[data-pp-panel="size"] .pp-panel:not([data-pp-section="size"]),
.pp[data-pp-panel="bg"] .pp-panel:not([data-pp-section="bg"]),
.pp[data-pp-panel="adjust"] .pp-panel:not([data-pp-section="adjust"]),
.pp[data-pp-panel="print"] .pp-panel:not([data-pp-section="print"]) { display: none; }
/* Narrow editor (< 720px, the default until local-tool.js measures it). */
.pp:not([data-wide]) .pp-view { position: sticky; top: 60px; z-index: 4; gap: 0.45rem; padding: 0.45rem 0 0.4rem; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); }
.pp:not([data-wide]) .pp-stage { --pp-max-h: 36svh; }
.pp:not([data-wide]) .pp-view .lt-hint { display: none; }
.pp:not([data-wide]) .pp-tool { min-width: 40px; height: 40px; }
/* Only the low-resolution warning needs to stay visible next to the photo. */
.pp:not([data-wide]) .pp-readout:not(:has(.is-warn)) { display: none; }
.pp:not([data-wide]) .pp-readout div:first-child { display: none; }

/* Passport: use in-editor landing instead of the generic drop card (avoids toy double-UI). */
.local-tool[data-tool-id="image-passport"] .lt-drop { display: none !important; }
.local-tool[data-tool-id="image-passport"] {
  gap: 1rem;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: clamp(1rem, 2.4vw, 1.75rem);
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
}
/* Fill the tool-main / homepage container — never a slim centered toy column. */
body.tool-app-shell .local-tool,
body.tool-app-shell .local-tool[data-tool-id="image-passport"] {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
.local-tool[data-tool-id="image-passport"] .pp-export-hint {
  display: none;
  margin: 0.35rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--ok, #16a34a) 40%, var(--border));
  background: color-mix(in srgb, var(--ok, #16a34a) 10%, var(--surface));
  font-size: 0.86rem;
  line-height: 1.4;
}
.local-tool[data-tool-id="image-passport"] .pp[data-pp-prepared] .pp-export-hint { display: block; }

/* ── M3A2: Passport phone = native app shell ─────────────────────────────── */
@media (max-width: 768px) {
  .local-tool[data-tool-id="image-passport"] {
    --pp-dock-h: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: 0.7rem 0.7rem calc(0.55rem + var(--pp-dock-h));
    margin-inline: -0.15rem;
    border-radius: 18px;
  }
  .local-tool[data-tool-id="image-passport"] .lt-disclaimer {
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0 0 0.45rem;
    color: var(--muted);
  }
  .local-tool[data-tool-id="image-passport"] .pp-appbar {
    top: env(safe-area-inset-top, 0px);
    margin: 0 -0.15rem;
    padding: 0.35rem 0.15rem 0.55rem;
  }
  .local-tool[data-tool-id="image-passport"] .pp-appbar-title { font-size: 1.05rem; }
  .local-tool[data-tool-id="image-passport"] .pp-mode {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }
  .local-tool[data-tool-id="image-passport"] .pp-landing-card {
    width: 100%;
    padding: 1.35rem 1rem 1.2rem;
    border-radius: 20px;
  }
  .local-tool[data-tool-id="image-passport"] .pp-landing-cta { width: 100%; }
  .local-tool[data-tool-id="image-passport"] .pp-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
    margin: 0 0 0.55rem;
  }
  .local-tool[data-tool-id="image-passport"] .pp-flow-step {
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.4rem 0.15rem;
    border-radius: 14px;
    text-align: center;
    font-size: 0.66rem;
    line-height: 1.15;
    min-width: 0;
  }
  .local-tool[data-tool-id="image-passport"] .pp-flow-step span { margin: 0 auto; }
  .local-tool[data-tool-id="image-passport"] .pp:not([data-wide]) .pp-view {
    top: calc(56px + env(safe-area-inset-top, 0px));
    gap: 0.35rem;
    padding: 0.3rem 0 0.35rem;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  }
  .local-tool[data-tool-id="image-passport"] .pp:not([data-wide]) .pp-stage {
    --pp-max-h: min(54svh, 440px);
    width: min(100%, calc(var(--pp-max-h) * var(--pp-aspect)));
  }
  .local-tool[data-tool-id="image-passport"] .pp-toolbar {
    gap: 0.3rem;
    padding: 0.2rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border);
  }
  .local-tool[data-tool-id="image-passport"].lt-has-file .lt-actions {
    bottom: env(safe-area-inset-bottom, 0px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 0.7rem 0.85rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.32);
  }
  .local-tool[data-tool-id="image-passport"]:has(.pp[data-pp-prepared]) .lt-actions [data-lt-run] {
    box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 45%, transparent);
  }
  html.pp-app-open .site-footer,
  html.pp-app-open .tool-related,
  html.pp-app-open .tool-faq,
  html.pp-app-open .tool-intro,
  html.pp-app-open .howto-block,
  html.pp-app-open .adsbygoogle,
  html.pp-app-open [data-ad-slot],
  html.pp-focus .howto-block,
  html.pp-focus .tool-features,
  html.pp-focus .tool-formats,
  html.pp-focus .tool-troubleshooting,
  html.pp-focus .tool-related,
  html.pp-focus .site-footer,
  html.pp-focus .adsbygoogle,
  html.pp-focus [data-ad-slot] {
    display: none !important;
  }
  html.pp-focus .page-hero .lead,
  html.pp-focus .page-hero .tool-tags { display: none; }
  html.pp-focus .page-hero { padding-bottom: 0.6rem; }
  html.pp-focus .page-hero .tool-h1 { font-size: 1.25rem; margin-bottom: 0.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pp-landing, .pp-editor, .pp-landing-cta, .pp-canvas { animation: none !important; transition: none !important; }
}
/* Wide editor (≥ 720px) — desktop / large monitor weight like Surprise create flow. */
.pp[data-wide] .pp-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1.35rem;
  align-items: start;
}
.pp[data-wide] .pp-view { position: sticky; top: 72px; }
.pp[data-wide] .pp-stage { --pp-max-h: min(72vh, 720px); }
.pp[data-wide] .pp-tabs { display: none; }
.pp[data-wide] .pp-panel-title { display: block; }
.pp[data-wide] .pp-panel { display: grid !important; }
.pp[data-wide] .pp-landing-card { width: 100%; padding: 2.35rem 2.4rem; }
.pp[data-wide] .pp-appbar {
  padding: 0.65rem 0.15rem 0.85rem;
  margin-bottom: 0.25rem;
}
.pp[data-wide] .pp-appbar-title { font-size: 1.45rem; }
@media (min-width: 1280px) {
  .pp[data-wide] .pp-grid { grid-template-columns: minmax(0, 1.3fr) minmax(380px, 0.7fr); gap: 1.75rem; }
  .pp[data-wide] .pp-stage { --pp-max-h: min(74vh, 780px); }
}
@media (min-width: 1600px) {
  .pp[data-wide] .pp-stage { --pp-max-h: min(76vh, 860px); }
}
@media (prefers-reduced-motion: reduce) {
  .pp-canvas, .pp-flow-step, .pp-tool, .lt-step-dot { transition: none; }
  .pp-loading span, .lt-step.is-active .lt-step-dot { animation: none; }
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Photo Print Sheet Maker ──────────────────────────────────────────────────────────────────────── */
.ps { display: grid; gap: 1rem; min-width: 0; }
.ps-grid { display: grid; gap: 1rem; min-width: 0; }
.ps-col { display: grid; gap: 0.75rem; align-content: start; min-width: 0; padding: 0.95rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.ps-col .control-row { display: grid; gap: 0.3rem; margin: 0; }
.ps-col .control-row label { font-size: 0.86rem; font-weight: 600; }
.ps-col .control-row select, .ps-col .control-row input { width: 100%; }
.ps-col-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ps-col-title { margin: 0; font-size: 1rem; }
.ps-list { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.ps-item { display: grid; gap: 0.55rem; padding: 0.65rem; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-solid) 60%, transparent); }
.ps-item.is-error { border-color: rgba(239, 68, 68, 0.5); }
.ps-head { display: flex; gap: 0.65rem; align-items: center; min-width: 0; }
.ps-thumb { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: rgba(127, 127, 127, 0.15); }
.ps-thumb canvas { max-width: 100%; max-height: 100%; }
.ps-title { min-width: 0; }
.ps-name { display: flex; gap: 0.35rem; margin: 0; font-size: 0.88rem; font-weight: 600; }
.ps-num { color: var(--muted); }
.ps-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-info { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.ps-info.is-warn { color: #f59e0b; font-weight: 600; }
.ps-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.5rem; }
.ps-field { display: grid; gap: 0.25rem; font-size: 0.78rem; color: var(--muted); }
.ps-field select, .ps-field input { width: 100%; }
.ps-custom { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.ps-custom input { width: 5rem; }
.ps-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ps-btn { min-height: 40px; min-width: 40px; padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.ps-btn[aria-pressed="true"] { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.ps-btn--danger:hover { border-color: rgba(239, 68, 68, 0.6); }
.ps-all { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; font-size: 0.85rem; }
.ps-all select { flex: 1 1 10rem; }
.ps-pages { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; }
.ps-page-fig { display: grid; justify-items: center; gap: 0.3rem; margin: 0; color: var(--muted); font-size: 0.78rem; }
.ps-page { display: block; height: auto; max-width: 100%; border-radius: 3px; background: #fff; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28); }
.ps[data-wide] .ps-grid { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr); }
.ps[data-wide] .ps-photos { grid-row: span 2; }

/* ── Photo Size & DPI Calculator ──────────────────────────────────────────────────────────────────── */
.dpi { display: grid; gap: 1rem; min-width: 0; }
.dpi-top { display: grid; gap: 0.3rem; max-width: 26rem; }
.dpi-top .control-row { display: grid; gap: 0.3rem; margin: 0; }
.dpi-top input { width: 100%; }
.dpi-error { margin: 0; color: #ef4444; font-weight: 600; font-size: 0.9rem; }
.dpi-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.dpi-card h3 { margin: 0; font-size: 1rem; }
.dpi-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.6rem; }
.dpi-inputs .control-row { display: grid; gap: 0.3rem; margin: 0; }
.dpi-inputs .control-row label { font-size: 0.84rem; font-weight: 600; }
.dpi-inputs input, .dpi-inputs select { width: 100%; }
.dpi-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.5rem; margin: 0; }
.dpi-results--wide { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.dpi-results div { padding: 0.55rem 0.7rem; border-radius: 12px; background: color-mix(in srgb, var(--brand) 7%, transparent); }
.dpi-results dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dpi-results dd { margin: 0.15rem 0 0; font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dpi-formula { margin: 0; color: var(--muted); font: 0.8rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.dpi-formula:empty { display: none; }
.dpi-verdict { margin: 0; font-weight: 600; }
.dpi-verdict:empty { display: none; }
.dpi-verdict.is-ok { color: var(--ok); }
.dpi-verdict.is-warn { color: #f59e0b; }
.dpi-verdict.is-bad { color: #ef4444; }
.dpi-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.dpi-presets .btn-ghost { min-height: 40px; padding: 0.3rem 0.75rem; font-size: 0.84rem; }
.dpi-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.6rem 0.75rem; }
.dpi-slot-btn { position: relative; display: inline-flex; align-items: center; min-height: 40px; cursor: pointer; }
.dpi-slot-btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
/* (The container query this replaces could not style .dpi itself, so the calculator keeps its single column.) */
.dpi[data-wide] .dpi-top { grid-column: 1 / -1; }

/* ── Service Centre (Step 1B): scanning editor ──────────────────────────────────────────────────────── */
.sc-editor { position: relative; border-radius: 12px; overflow: hidden; background: #0d1117; line-height: 0; }
.sc-view { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; }
.sc-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sc-shade { fill: rgba(6, 10, 18, 0.42); }
.sc-outline { fill: none; stroke: #38bdf8; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sc-handle { cursor: grab; touch-action: none; outline: none; }
.sc-handle .sc-hit { fill: transparent; }
.sc-handle .sc-dot { fill: #ffffff; stroke: #0ea5e9; stroke-width: 3px; vector-effect: non-scaling-stroke; transition: r 0.12s ease; }
.sc-handle.is-active { cursor: grabbing; }
.sc-handle.is-active .sc-dot, .sc-handle:focus-visible .sc-dot { fill: #0ea5e9; stroke: #ffffff; }
.sc-handle:focus-visible .sc-hit { fill: rgba(14, 165, 233, 0.22); }
.sc-loupe { position: absolute; width: 112px; height: 112px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); pointer-events: none; z-index: 3; background: #000; }
/* Release F2: corner tools under the photo (undo/redo, zoom), zoomed photo and overlay move together. */
.sc-view, .sc-overlay { transform-origin: 0 0; }
.sc-editor.is-zoomed .sc-overlay { cursor: grab; touch-action: none; }
.sc-editor.is-panning .sc-overlay { cursor: grabbing; }
.sc-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; margin-top: 0.45rem; }
.sc-editor[hidden] + .sc-tools { display: none; }
.sc-tool { min-width: 44px; min-height: 44px; padding: 0 0.6rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.sc-tool:hover:not(:disabled) { border-color: var(--accent, #0ea5e9); }
.sc-tool:focus-visible { outline: 3px solid var(--accent, #0ea5e9); outline-offset: 2px; }
.sc-tool:disabled { opacity: 0.45; cursor: default; }
/* While edge detection runs: one scan line sweeps the photo (transform only, so it stays smooth). */
.sc-editor::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22%; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0), rgba(56, 189, 248, 0.32) 80%, rgba(125, 211, 252, 0.9));
  transform: translateY(-100%); }
.is-detecting .sc-editor::after { opacity: 1; animation: sc-sweep 1.4s cubic-bezier(0.45, 0, 0.35, 1) infinite; }
@keyframes sc-sweep { to { transform: translateY(460%); } }

.nid { display: grid; gap: 1rem; min-width: 0; }
.nid-grid, .nid-sides, .nid-panel { display: grid; gap: 1rem; min-width: 0; }
.nid[data-wide] .nid-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr); align-items: start; }
.nid[data-wide] .nid-panel { position: sticky; top: 84px; }
.nid-side .ps-col-head { align-items: baseline; }
.nid-status { font-size: 0.82rem; color: var(--muted); }
.nid-status[data-kind="ok"] { color: var(--ok, #16a34a); }
.nid-status[data-kind="warn"] { color: #d97706; }
.nid-status[data-kind="error"] { color: #dc2626; }
.nid-status[data-kind="busy"]::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.4rem; border-radius: 50%;
  background: #38bdf8; vertical-align: 0.05em; animation: lt-step-pulse 1.1s ease-in-out infinite; }
.nid-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.nid-pick { position: relative; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.nid-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.nid-camera { min-height: 44px; }
.nid-side.has-photo .nid-empty { display: none; }
.nid-side:not(.has-photo) .nid-help { display: none; }
.nid-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nid-tools .btn-ghost { min-height: 40px; padding: 0.3rem 0.75rem; font-size: 0.84rem; }
.nid-result { margin: 0; display: grid; gap: 0.4rem; justify-items: center; }
.nid-result canvas { width: 100%; max-width: 440px; height: auto; border-radius: 10px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22); background: #fff; }
.nid-readout.is-warn, [data-nid-readout].is-warn { color: #d97706; }
.nid-sheet { display: grid; gap: 0.4rem; justify-items: center; }
.nid-sheet canvas, .svc-doc-preview canvas { width: 100%; max-width: 380px; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25); }
.svc-doc-preview { margin: 0.5rem 0 0; display: grid; justify-items: center; }

/* ── Service Centre: shop documents ─────────────────────────────────────────────────────────────────── */
.calc, .svc-form { display: grid; gap: 1rem; min-width: 0; }
.calc-grid, .calc-main, .calc-side { display: grid; gap: 1rem; min-width: 0; align-content: start; }
.calc[data-wide] .calc-grid, .svc-form[data-wide] .calc-grid { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); align-items: start; }
.calc-lines { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
/* The calculator adds its first job line after the first paint: hold its space so nothing below jumps (CLS). */
.calc-lines[data-calc-lines]:empty { min-height: 179px; }
@media (max-width: 420px) { .calc-lines[data-calc-lines]:empty { min-height: 272px; } }
@media (max-width: 380px) { .calc-lines[data-calc-lines]:empty { min-height: 328px; } }
.calc-line { display: grid; gap: 0.45rem; padding: 0.6rem; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface-solid) 60%, transparent); }
.calc-line input, .calc-line select { width: 100%; min-height: 40px; }
.calc-line-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.calc-line-qty { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; }
.calc-line-qty label { display: grid; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.calc-num { width: 6.5rem !important; }
.calc-del { min-height: 40px; min-width: 40px; margin-left: auto; }
.calc-sub-head { margin-top: 0.4rem; }
.calc-sub-title { margin: 0; font-size: 0.92rem; }
.calc-summary { display: grid; gap: 0.5rem; padding: 0.95rem; border-radius: 16px; }
.calc-totals { display: grid; gap: 0.3rem; margin: 0; }
.calc-totals div { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.calc-totals dt { color: var(--muted); }
.calc-totals dd { margin: 0; font-weight: 600; }
.calc-total { padding: 0.35rem 0; border-block: 1px solid var(--border); font-size: 1.12rem; }
.calc-total dd { color: var(--text); font-weight: 800; }
.calc-totals .is-neg { color: #dc2626; }
.calc-rates summary { cursor: pointer; }
.calc-rate-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.calc-rate-table th, .calc-rate-table td { padding: 0.25rem; text-align: left; }
.calc-rate-table input { width: 100%; min-height: 38px; }
.calc-forget { justify-self: start; min-height: 40px; }
@media (max-width: 420px) { .calc-line-opts { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  .is-detecting .sc-editor::after { animation: none; opacity: 0.6; transform: none; }
  .nid-status[data-kind="busy"]::before { animation: none; }
}
/* Document Scanner: page strip (scrolls sideways on phones), editor and result */
.ds { display: grid; gap: 0.9rem; min-width: 0; }
.ds-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.ds-actions .btn-primary, .ds-actions .btn-ghost { min-height: 44px; }
/* P13D — corner drag must not scroll the page; handoff strip stays tappable on phones. */
.ds-editor-box .sc-editor { touch-action: none; overscroll-behavior: none; }
.ds-compare { min-height: 44px; width: 100%; max-width: 28rem; }
.ds-handoff .ds-handoff-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ds-handoff .ds-handoff-tools .btn-ghost { min-height: 44px; }
@media (max-width: 430px) {
  .ds-thumb { width: 84px; height: 112px; }
  .ds-page-tools .btn-ghost { min-width: 36px; min-height: 36px; }
  .ds-result canvas { max-width: 100%; }
}
.ds-list { display: flex; gap: 0.6rem; margin: 0; padding: 0.2rem 0.1rem 0.5rem; list-style: none; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.ds-page { flex: 0 0 auto; display: grid; gap: 0.3rem; justify-items: center; scroll-snap-align: start; }
.ds-thumb { position: relative; display: grid; place-items: center; width: 96px; height: 128px; padding: 4px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.ds-thumb canvas { max-width: 100%; max-height: 100%; border-radius: 3px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); background: #fff; }
.ds-thumb-wait { color: var(--muted); font-size: 1.4rem; }
.ds-page.is-active .ds-thumb { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25); }
.ds-page.is-manual .ds-thumb { border-color: #d97706; }
.ds-page.is-error .ds-thumb { border-color: #dc2626; }
.ds-page-n { position: absolute; left: 4px; top: 4px; min-width: 1.4rem; padding: 0 0.3rem; border-radius: 999px; background: rgba(15, 23, 42, 0.78); color: #fff; font-size: 0.72rem; line-height: 1.4rem; text-align: center; }
.ds-page-tools { display: flex; gap: 0.25rem; }
.ds-page-tools .btn-ghost { min-width: 32px; min-height: 32px; padding: 0 0.4rem; font-size: 0.85rem; }
.ds-page-err { max-width: 110px; margin: 0; color: #dc2626; font-size: 0.72rem; text-align: center; }
.ds-list.is-detecting::after { content: ""; align-self: center; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #38bdf8; animation: lt-step-pulse 1.1s ease-in-out infinite; }
.ds[data-wide] .ds-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr); align-items: start; }
.ds-result canvas { max-width: 520px; }
.jc-no-password { color: #b45309; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .ds-list.is-detecting::after { animation: none; } }

/* ── Education & School (Release D) ─────────────────────────────────────────────────────────────────── */
.edu [hidden] { display: none !important; }
.edu textarea { width: 100%; min-height: 44px; resize: vertical; font: inherit; line-height: 1.45; }
.edu input[type="text"], .edu input[type="date"], .edu select { min-height: 42px; }
.edu-modebar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.edu-mode-btn { min-height: 42px; min-width: 5.5rem; font-weight: 600; }
.edu-mode-btn[aria-pressed="true"] { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.edu-mode-hint { flex: 1 1 14rem; margin: 0; }
.edu-secs { display: grid; gap: 0.9rem; min-width: 0; }
.edu-sec { display: grid; gap: 0.6rem; min-width: 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-solid) 55%, transparent); }
.edu-sec-head, .edu-q-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-width: 0; }
.edu-sec-title { margin: 0; font-size: 0.98rem; }
.edu-sec-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.5rem; }
.edu-field { display: grid; gap: 0.25rem; min-width: 0; font-size: 0.8rem; color: var(--muted); }
.edu-field input, .edu-field select { width: 100%; color: var(--text); }
.edu-q-tools { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.edu-icon-btn { min-width: 40px; min-height: 40px; padding: 0 0.5rem; font-size: 0.95rem; line-height: 1; }
.edu-del:hover, .edu-del:focus-visible { border-color: rgba(239, 68, 68, 0.6); color: #dc2626; }
.edu-qs { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.edu-q { display: grid; gap: 0.4rem; min-width: 0; padding: 0.55rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.edu-q-num { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.edu-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 0.4rem; }
.edu-opt { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.edu-opt input[type="text"] { flex: 1 1 auto; min-width: 0; width: 100%; }
.edu-opt input[type="radio"] { flex: none; width: 22px; height: 22px; accent-color: var(--brand); }
.edu-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.edu-mini input, .edu-mini select { width: auto; min-width: 5rem; max-width: 100%; flex: 1 1 6rem; color: var(--text); }
.edu-parts { display: grid; gap: 0.35rem; margin: 0; padding: 0 0 0 1.2rem; }
.edu-part { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.edu-part input:first-child { flex: 1 1 auto; min-width: 0; }
.edu-pm { flex: none; width: 4.2rem !important; }
.edu-add-part, .edu-text-btn, .edu-wide-btn { min-height: 40px; padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.edu-add-part { justify-self: start; }
.edu-sec-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.edu-paste { display: grid; gap: 0.4rem; }
.edu-paste .lt-hint { margin: 0; }
.edu-wide-btn { justify-self: start; }
.edu-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.edu-add-label { width: 100%; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.edu-add .btn-ghost { min-height: 42px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.edu-status { margin: 0; font-weight: 600; }
.edu-status[data-kind="ok"] { color: var(--ok, #16a34a); }
.edu-status[data-kind="warn"] { color: #d97706; }
.edu-status[data-kind="bad"] { color: #dc2626; }
.edu-status[data-kind="muted"] { color: var(--muted); font-weight: 500; }
.edu-errors { display: grid; gap: 0.2rem; margin: 0; padding-left: 1.1rem; color: #dc2626; font-size: 0.84rem; overflow-wrap: anywhere; }
.edu-pro-box { display: grid; gap: 0.6rem; padding-top: 0.2rem; border-top: 1px dashed var(--border); }
.edu-preview canvas { max-width: 420px; }
.edu-pager { display: flex; align-items: center; justify-content: center; gap: 0.6rem; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.edu-file-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.edu-file-actions .btn-ghost { min-height: 42px; }
.edu-open { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.edu-open:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.edu[data-wide] .calc-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; overscroll-behavior: contain; }
.edu-subs { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.edu-sub { display: grid; grid-template-columns: minmax(0, 1fr) 4.6rem 4.6rem auto; align-items: end; gap: 0.4rem; }
.edu-sub .edu-field input { min-width: 0; }
.edu-sub .edu-del { align-self: end; }
.edu-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.edu-table-wrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.edu-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
.edu-table th, .edu-table td { padding: 0.25rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.edu-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-solid, var(--surface)); font-size: 0.78rem; color: var(--muted); }
.edu-table input { width: 100%; min-height: 40px; padding: 0.3rem 0.4rem; font-variant-numeric: tabular-nums; }
.edu-grid .edu-cell-roll { width: 4.2rem; }
.edu-grid .edu-cell-name { width: 10.5rem; }
.edu-grid .edu-cell-mark { width: 4.2rem; text-align: right; }
.edu-grid td:nth-child(3), .edu-grid th:nth-child(3) { position: sticky; left: 0; z-index: 1; background: var(--surface-solid, var(--surface)); box-shadow: 1px 0 0 var(--border); }
.edu-grid thead th:nth-child(3) { z-index: 2; }
.edu-rownum { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.edu-out { font-weight: 600; font-variant-numeric: tabular-nums; }
.edu-out[data-kind="ok"] { color: var(--ok, #16a34a); }
.edu-out[data-kind="bad"] { color: #dc2626; }
.edu input[aria-invalid="true"] { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18); background: color-mix(in srgb, #dc2626 6%, transparent); }
.edu-band-table input { width: 5rem; }
.edu-bands { display: grid; gap: 0.5rem; }
.edu-import { display: grid; gap: 0.5rem; }
.edu-import > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
.edu-import[open] { padding-bottom: 0.2rem; }
.edu input[type="time"] { min-height: 42px; }
.edu-radios { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0; padding: 0; border: 0; }
.edu-days { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 12px; }
.edu-days legend { padding: 0 0.3rem; font-size: 0.8rem; color: var(--muted); }
.edu-num-col { text-align: center !important; }
.edu-att-grid .edu-out { text-align: center; min-width: 2.2rem; }
.edu-day-nav { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.edu-day-nav select { flex: 1 1 auto; min-width: 0; }
.edu-att-list { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.edu-att-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.35rem 0.6rem; min-width: 0; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.edu-att-row[data-code="A"] { border-color: rgba(220, 38, 38, 0.55); }
.edu-att-name { flex: 1 1 9rem; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.edu-att-codes { display: flex; gap: 0.3rem; }
.edu-att-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.edu-att-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.edu-att-btn[aria-pressed="true"][data-code="P"] { background: #16a34a; border-color: #16a34a; color: #fff; }
.edu-att-btn[aria-pressed="true"][data-code="A"] { background: #dc2626; border-color: #dc2626; color: #fff; }
.edu-att-btn[aria-pressed="true"][data-code="L"] { background: #d97706; border-color: #d97706; color: #fff; }
.edu-att-btn[aria-pressed="true"][data-code="E"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.edu-periods, .edu-class-list, .edu-slots { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.edu-period { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; min-width: 0; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 12px; }
.edu-period.is-break, .edu-slot.is-break { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.edu-period-label { flex: 0 0 5.5rem; font-weight: 600; font-size: 0.85rem; }
.edu-period input[type="time"] { width: 7.4rem; }
.edu-period .edu-break-label { flex: 1 1 6rem; min-width: 0; width: auto; }
.edu-period .edu-q-tools { margin-left: auto; }
.edu-class-item { display: flex; gap: 0.35rem; }
.edu-class-item input { flex: 1 1 auto; min-width: 0; }
.edu-slot { display: grid; gap: 0.35rem; min-width: 0; padding: 0.45rem 0.55rem; border: 1px solid var(--border); border-radius: 12px; }
.edu-slot-time { font-size: 0.8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.edu-slot-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 0.8fr); gap: 0.35rem; }
.edu-slot-fields input { width: 100%; min-width: 0; }
.edu-slot-msg { margin: 0; color: #dc2626; font-size: 0.82rem; overflow-wrap: anywhere; }
.edu-sub-title { margin: 0.4rem 0 0; font-size: 0.9rem; }
.edu-week td { min-width: 4.5rem; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-size: 0.8rem; }
.edu-week td.is-day { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.edu-week td.is-bad { color: #dc2626; font-weight: 700; box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.5); }
.edu-exam-grid .edu-x-date { width: 9.5rem; }
.edu-exam-grid .edu-x-start, .edu-exam-grid .edu-x-end { width: 7.4rem; }
.edu-exam-grid .edu-x-cls, .edu-exam-grid .edu-x-room { width: 6.5rem; }
.edu-exam-grid .edu-x-subject, .edu-exam-grid .edu-x-inv { width: 10rem; }
.ic-scope { margin: 0; }
.ic-color-row input[type="color"] { width: 100%; min-height: 42px; padding: 0.15rem; border: 1px solid var(--border); border-radius: 10px; background: transparent; cursor: pointer; }
.ic-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.6rem; }
.ic-asset { display: grid; gap: 0.35rem; min-width: 0; }
.ic-asset .lt-hint { margin: 0; overflow-wrap: anywhere; }
.ic-asset-title { font-size: 0.85rem; font-weight: 600; }
.ic-list { display: grid; gap: 0.35rem; max-height: 22rem; margin: 0; padding: 0.1rem; overflow-y: auto; list-style: none; overscroll-behavior: contain; }
.ic-item { min-width: 0; }
.ic-pick { display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 52px; padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ic-pick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic-pick[aria-current="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.ic-thumb { flex: none; width: 33px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--border); }
.ic-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.ic-item-text { display: grid; flex: 1 1 auto; min-width: 0; }
.ic-item-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ic-item-meta { overflow: hidden; color: var(--muted); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.ic-item-flag { flex: none; max-width: 7.5rem; font-size: 0.75rem; font-weight: 600; text-align: right; }
.ic-item-flag[data-kind="warn"] { color: #d97706; }
.ic-item-flag[data-kind="bad"] { color: #dc2626; }
.ic-editor:empty { display: none; }
.ic-photo-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.7rem; }
.ic-photo-big { flex: none; width: 72px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--border); font-size: 0.72rem; text-align: center; }
.ic-photo-actions { display: flex; flex: 1 1 10rem; flex-wrap: wrap; align-content: flex-start; gap: 0.4rem; min-width: 0; }
.ic-photo-actions .btn-ghost { min-height: 42px; }
.ic-photo-file { flex-basis: 100%; margin: 0; overflow-wrap: anywhere; }
.ic-ranges { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: 0.4rem 0.7rem; }
.ic-range input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--brand); }
.ic-range input:disabled { opacity: 0.45; }
.ic-fields .ic-field-name, .ic-fields .ic-field-address { grid-column: 1 / -1; }
.ic-preview { display: grid; gap: 0.5rem; margin: 0; }
.ic-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.ic-cards canvas { max-width: 100%; height: auto; border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 4px 14px rgba(0, 0, 0, 0.12); }
.ic-preview[data-orient="port"] .ic-cards canvas { max-width: calc(50% - 0.3rem); }
.edu-errors .ic-warn { color: #b45309; }
.nc-tpl-btn { align-self: end; }
.nc-tpl-btn .btn-ghost { width: 100%; min-height: 42px; }
.nc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: -0.2rem 0 0.6rem; }
.nc-chips .lt-hint { flex-basis: 100%; margin: 0; }
.nc-chip { min-height: 36px; padding: 0.2rem 0.55rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; }
.nc-preview canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 4px 14px rgba(0, 0, 0, 0.12); }
.nc-pv-flag { margin: 0; color: #b45309; text-align: center; }
.nc-pv-flag:empty { display: none; }
@media (max-width: 520px) {
  .edu-slot-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .edu-slot-fields input:last-child { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
  .edu-sec, .edu-q { padding: 0.5rem; }
  .edu-parts { padding-left: 0.9rem; }
  .edu-sub { grid-template-columns: minmax(0, 1fr) 4rem 4rem; }
  .edu-sub .edu-sub-name { grid-column: 1 / -1; }
}

/* ── Passport Photo: Quick / Pro, automatic preparation, background and brush (Release F) ──────────── */
/* Quick mode keeps only the task (photo, size, background, download); Pro shows every control. */
.pp[data-pp-mode="quick"] [data-pp-pro] { display: none !important; }
.pp-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; padding: 0.25rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.pp-mode-btn {
  min-height: 44px; border: 0; border-radius: 10px; background: none; color: var(--muted);
  font: inherit; font-size: 0.92rem; font-weight: 650; cursor: pointer;
}
.pp-mode-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--brand) 16%, var(--surface-solid)); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--brand); }
.pp-mode-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pp-auto { display: grid; gap: 0.6rem; padding: 0.95rem; border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border)); border-radius: 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface)); }
.pp-auto-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.pp-auto .pp-panel-title { display: block; }
.pp-auto-btn { min-height: 44px; }
.pp.is-preparing .pp-auto-btn { opacity: 0.7; cursor: progress; }
.pp-checks { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; font-size: 0.88rem; }
.pp-check { position: relative; padding-left: 1.6rem; line-height: 1.4; color: var(--text); }
.pp-check::before { position: absolute; left: 0; top: 0.05rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; color: #fff; }
.pp-check.is-ok::before { content: ""; background: #16a34a; }
/* drawn tick (a symbol-font glyph would cost a fallback-font lookup) */
.pp-check.is-ok::after { content: ""; position: absolute; left: 0.42rem; top: 0.22rem; width: 0.28rem; height: 0.55rem; border: solid #fff; border-width: 0 0.13rem 0.13rem 0; transform: rotate(45deg); }
.pp-check.is-warn::before { content: "!"; background: #d97706; }
.pp-check.is-idle { color: var(--muted); padding-left: 0; }
.pp-auto-adjust { justify-self: start; }
.pp-swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pp-swatch {
  position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--sw, #fff); cursor: pointer; padding: 0; overflow: hidden;
}
.pp-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.pp-swatch:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.pp-swatch--clear { background: repeating-conic-gradient(#d9dde3 0% 25%, #ffffff 0% 50%) 50% / 12px 12px; }
.pp-swatch--custom { display: grid; place-items: center; background: conic-gradient(#f87171, #fbbf24, #34d399, #60a5fa, #a78bfa, #f87171); }
.pp-swatch--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.pp-brush { display: grid; gap: 0.65rem; padding: 0.75rem; border: 1px dashed var(--border); border-radius: 12px; }
.pp-sub { margin: 0; font-size: 0.9rem; font-weight: 700; }
.pp-brush-tools, .pp-brush-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pp-brush-tools .btn-ghost, .pp-brush-actions .btn-ghost { min-height: 44px; }
.pp-brush-tools .btn-ghost[aria-pressed="true"], .pp-brush-actions .btn-ghost[aria-pressed="true"] { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.pp-brush-cursor {
  position: absolute; z-index: 5; pointer-events: none; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.pp-brush-cursor[data-mode="erase"] { background: rgba(255, 46, 136, 0.18); }
.pp-brush-cursor[data-mode="restore"] { background: rgba(22, 163, 74, 0.18); }
.pp.is-brushing .pp-stage { cursor: none; touch-action: none; }
/* P8B Telecom batch rail + print-lab quick copies */
.pp-batch { display: grid; gap: 0.55rem; margin: 0 0 0.75rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.pp-batch[hidden] { display: none !important; }
.pp-batch-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pp-batch-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pp-batch-rail { display: flex; gap: 0.55rem; overflow-x: auto; padding: 0.15rem 0.1rem 0.35rem; margin: 0; list-style: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.pp-batch-item { position: relative; flex: 0 0 auto; scroll-snap-align: start; }
.pp-batch-thumb {
  position: relative; width: 72px; height: 96px; padding: 0; border-radius: 12px; border: 2px solid var(--border);
  overflow: hidden; background: var(--surface-solid, #fff); cursor: pointer;
}
.pp-batch-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-batch-placeholder { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 700; color: var(--muted); }
.pp-batch-item.is-active .pp-batch-thumb { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.pp-batch-item.is-review .pp-batch-thumb { border-color: #d97706; }
.pp-batch-item.is-fail .pp-batch-thumb { border-color: #dc2626; }
.pp-batch-item.is-ready .pp-batch-badge { background: #16a34a; }
.pp-batch-badge {
  position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 0.1rem 0.25rem; border-radius: 6px;
  font-size: 0.62rem; font-weight: 700; color: #fff; background: rgba(15, 23, 42, 0.75); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pp-batch-remove {
  position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-solid, #fff); color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
}
.pp-quick-copies { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.35rem 0 0.55rem; }
.pp-quick-copies-label { font-size: 0.88rem; color: var(--muted); margin-right: 0.15rem; }
.pp-desk {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.8rem;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand, #3b6fb6) 35%, var(--border));
  background: color-mix(in srgb, var(--brand, #3b6fb6) 8%, var(--surface));
}
.pp-desk-title { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 700; }
.pp-desk-papers { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.45rem 0 0.35rem; }
.pp-desk-go { width: 100%; min-height: 48px; margin-top: 0.35rem; }
.pp-desk-actual {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--muted);
}
.pp-chip-btn[aria-pressed="true"] {
  border-color: var(--brand, #3b6fb6);
  background: color-mix(in srgb, var(--brand, #3b6fb6) 18%, var(--surface));
  font-weight: 700;
}
.pp-proof {
  margin: 0.75rem 0 0.35rem;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, var(--brand, #3b6fb6) 6%);
}
.pp-proof-list { margin: 0.35rem 0 0.55rem 1.1rem; padding: 0; font-size: 0.86rem; line-height: 1.4; color: var(--muted); }
.pp-proof-list li { margin: 0.2rem 0; }
.pp-proof-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0; }
.pp-proof-actions .btn-ghost { min-height: 44px; }
.pp-chip-btn {
  min-width: 44px; min-height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-weight: 650; cursor: pointer;
}
.pp-chip-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pp-preflight { margin: 0 0 0.55rem; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.pp-print-lab-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.65rem 0 0.35rem; }
.pp-print-lab-actions .btn-primary, .pp-print-lab-actions .btn-ghost { min-height: 44px; }
@media (max-width: 430px) {
  .pp-batch-thumb { width: 64px; height: 86px; }
  .pp-batch-actions .btn-ghost { min-height: 40px; font-size: 0.85rem; }
}
/* Release F3: 'More options' folds (Photo Studio / Service Centre). Less-used settings fold away; the summary counts
   the ones set away from the page's defaults. */
.lt-adv:not(.ps-col) { margin: 0.6rem 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.lt-adv > .lt-adv-sum { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; cursor: pointer; list-style: none; }
.lt-adv > .lt-adv-sum::-webkit-details-marker { display: none; }
/* a drawn chevron (no glyph): points down when closed, up when open */
.lt-adv > .lt-adv-sum::after { content: ""; flex: none; margin-left: auto; width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: 0.75; transition: transform 0.15s ease; }
.lt-adv[open] > .lt-adv-sum::after { transform: translateY(2px) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { .lt-adv > .lt-adv-sum::after { transition: none; } }
.lt-adv:not(.ps-col) > .lt-adv-sum { padding: 0 0.85rem; font-weight: 600; }
.lt-adv > .lt-adv-sum:focus-visible { outline: 3px solid var(--accent, #0ea5e9); outline-offset: 2px; border-radius: 10px; }
.lt-adv-count { font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px;
  background: rgba(14, 165, 233, 0.16); color: var(--text); white-space: nowrap; }
.lt-adv-count[hidden] { display: none; }
.lt-adv:not(.ps-col) > .lt-adv-body { padding: 0 0.85rem 0.6rem; }
/* Release H1/H2: Dental Prescription Maker — an editor with a live page that stays in view. Everything is scoped to .drx
   (no shared rule changes): phone = page pinned on top + one section at a time; wide = sections left, page right. */
.drx { --drx-acc: #2563eb; --drx-acc2: #0ea5e9; --drx-card: color-mix(in srgb, var(--surface-solid, #fff) 92%, transparent);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.85rem; min-width: 0; }
.drx [hidden] { display: none !important; }
.drx-view { position: sticky; top: 60px; z-index: 6; display: grid; gap: 0.4rem; padding: 0.5rem 0.6rem 0.55rem; border-radius: 18px;
  background: color-mix(in srgb, var(--bg, #0b1020) 82%, transparent); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 10px 30px rgba(0, 0, 0, 0.28); }
.drx-view-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.drx-view-title { font-weight: 700; font-size: 0.95rem; }
.drx-view-tools { display: flex; gap: 0.35rem; }
.drx-ic { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: inherit; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); transition: transform 0.12s; }
.drx-ic:active { transform: translateY(1px); box-shadow: none; }
.drx-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drx-view.is-collapsed [data-drx-collapse] svg { transform: rotate(180deg); }
.drx-paper { display: flex; justify-content: center; align-items: flex-start; max-height: 27svh; overflow: hidden; cursor: zoom-in;
  perspective: 900px; }
.drx-paper canvas { height: min(27svh, 100%); max-height: 27svh; width: auto; max-width: 100%; background: #fff; border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 12px 28px rgba(0, 0, 0, 0.35); transform: rotateX(2deg); transform-origin: 50% 0; }
.drx-view.is-collapsed .drx-paper, .drx-view.is-collapsed .drx-view-hint { display: none; }
.drx-view-hint { margin: 0; text-align: center; }
.drx:not([data-wide]) .drx-view-hint { display: none; }
.drx-edit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; min-width: 0; }
.drx-setup { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(14, 165, 233, 0.1)); border: 1px solid rgba(37, 99, 235, 0.35); }
.drx-tabs { display: flex; gap: 0.4rem; overflow-x: auto; scroll-snap-type: x proximity; padding: 0.2rem 0.1rem 0.45rem;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.drx-tabs::-webkit-scrollbar { display: none; }
.drx-tab { flex: 0 0 auto; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px;
  padding: 0.35rem 0.85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: inherit;
  font-weight: 600; font-size: 0.92rem; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); transition: transform 0.12s, box-shadow 0.12s; }
.drx-tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drx-tab[aria-selected="true"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2));
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45), 0 1px 0 rgba(255, 255, 255, 0.25) inset; transform: translateY(-1px); }
.drx-tab:active { transform: translateY(1px); box-shadow: none; }
.drx-tab-n { min-width: 1.35rem; height: 1.35rem; padding: 0 0.3rem; display: inline-grid; place-items: center; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: #1e3a8a; font-size: 0.75rem; font-weight: 800; }
.drx-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; padding: 0.95rem; border-radius: 20px; background: var(--drx-card);
  border: 1px solid var(--border); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 14px 34px rgba(0, 0, 0, 0.18); min-width: 0; }
.drx-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.drx-panel-head h3 { margin: 0; font-size: 1.1rem; }
.drx-f { display: grid; gap: 0.3rem; font-size: 0.86rem; font-weight: 600; min-width: 0; }
.drx-f input, .drx-f select, .drx-f textarea, .drx-other { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; min-height: 44px;
  padding: 0.55rem 0.75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 400; }
.drx-f textarea { min-height: 72px; resize: vertical; line-height: 1.4; }
.drx-f input:focus, .drx-f select:focus, .drx-f textarea:focus, .drx-other:focus { outline: 2px solid var(--drx-acc); outline-offset: 1px; }
.drx-row2, .drx-row3 { display: grid; gap: 0.6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.drx-row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 380px) { .drx-row3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 340px) { .drx-row2, .drx-row3 { grid-template-columns: 1fr; } }
.drx-sm { min-height: 44px; }
.drx-seg { display: flex; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.drx-seg label { position: relative; flex: 1 1 0; display: grid; }
.drx-seg input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.drx-seg span { display: grid; place-items: center; min-height: 44px; padding: 0 0.3rem; font-weight: 600; cursor: pointer; }
.drx-seg input:checked + span { color: #fff; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.drx-seg input:focus-visible + span { outline: 2px solid var(--drx-acc); outline-offset: -3px; }
.drx-group { border: 0; padding: 0; margin: 0; display: grid; gap: 0.45rem; min-width: 0; }
.drx-group legend { font-weight: 700; padding: 0; margin-bottom: 0.35rem; }
.drx-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.drx-chip { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 0.92rem; user-select: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); transition: transform 0.1s; }
.drx-chip input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.drx-chip:active { transform: translateY(1px); box-shadow: none; }
.drx-chip:has(input:checked) { color: #fff; border-color: transparent; font-weight: 600;
  background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4); }
.drx-chip:has(input:focus-visible) { outline: 2px solid var(--drx-acc); outline-offset: 2px; }
.drx-teeth { align-items: end; }
.drx-boundary { font-weight: 600; margin: 0; }
.drx-meds { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.drx-med { display: grid; gap: 0.5rem; padding: 0.7rem; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); }
.drx-med-top { display: flex; gap: 0.5rem; align-items: end; }
.drx-med-top .drx-med-name { flex: 1 1 auto; }
.drx-med-n { flex: 0 0 auto; width: 2rem; height: 2rem; margin-bottom: 0.4rem; display: grid; place-items: center; border-radius: 10px;
  color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.drx-med-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.drx-med-more .drx-med-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0.5rem; }
.drx-med-f { display: grid; gap: 0.2rem; font-size: 0.78rem; font-weight: 600; min-width: 0; }
.drx-med-f input { width: 100%; min-width: 0; box-sizing: border-box; min-height: 44px; padding: 0.5rem 0.6rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg, transparent); color: var(--text); font-size: 16px; }
.drx-mchips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.drx-mchip { min-height: 36px; padding: 0.2rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: inherit; font-weight: 600; cursor: pointer; }
.drx-mchip.is-on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.drx-med-more > summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; min-height: 32px; display: flex; align-items: center; }
.drx-med-act { display: flex; justify-content: flex-end; margin-top: 0.4rem; }
.drx-del { width: 44px; height: 44px; color: #dc2626; }
.drx-nav { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.2rem; }
.drx-next { min-height: 48px; }
.drx-slot { margin: 0; }
.drx-chart { display: grid; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; }
.drx-arch { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; min-width: 560px; }
.drx-arch + .drx-arch { border-top: 2px solid var(--border); padding-top: 0.35rem; }
.drx-quad { display: flex; gap: 0.2rem; }
.drx-quad:first-child { justify-content: flex-end; border-right: 2px solid var(--border); padding-right: 0.5rem; }
.drx-tooth { min-width: 32px; min-height: 44px; flex: 1 1 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: inherit; font-weight: 700; font-size: 0.82rem; cursor: pointer; padding: 0; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.drx-tooth.has-c { background: rgba(220, 38, 38, 0.22); }
.drx-tooth.has-d { background: rgba(22, 163, 74, 0.28); }
.drx-tooth.has-p { box-shadow: inset 0 0 0 2px #2563eb; }
.drx-tooth.is-x { text-decoration: line-through; opacity: 0.7; }
.drx-tooth.is-sel { outline: 3px solid var(--drx-acc); outline-offset: 1px; transform: translateY(-1px); }
.drx-tooth-ed { border: 1px dashed var(--border); border-radius: 14px; padding: 0.7rem; display: grid; gap: 0.5rem; }
.drx-tooth-ed h4 { margin: 0; }
.drx-pro > summary { min-height: 44px; }
.drx-pro[open] { display: grid; gap: 0.6rem; }
.drx-zoomer { width: min(980px, 100vw); max-width: 100vw; height: 100svh; max-height: 100svh; margin: 0 auto; padding: 0; border: 0;
  background: #0b1020; color: #fff; }
.drx-zoomer::backdrop { background: rgba(0, 0, 0, 0.6); }
.drx-zoomer-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.8rem;
  background: rgba(11, 16, 32, 0.92); }
.drx-zoomer-body { padding: 0.5rem; display: grid; justify-items: center; }
.drx-zoomer-body canvas { width: 100%; max-width: 900px; height: auto; background: #fff; border-radius: 4px; }
/* Wide: sections on the left, the page on the right (sticky) */
.drx[data-wide] { grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); align-items: start; }
.drx[data-wide] .drx-view { order: 2; top: 84px; background: transparent; backdrop-filter: none; box-shadow: none; padding: 0; }
.drx[data-wide] .drx-edit { order: 1; }
.drx[data-wide] .drx-paper { max-height: calc(100vh - 150px); }
.drx[data-wide] .drx-paper canvas { height: auto; max-height: calc(100vh - 150px); width: auto; max-width: 100%; }
.drx[data-wide] [data-drx-collapse] { display: none; }
html[data-theme="light"] .drx:not([data-wide]) .drx-view { background: color-mix(in srgb, #f8fafc 86%, transparent); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14); }
/* Release H2: Pharmacy editors (same shell as the dental editor; .phx adds the line grid, checks and totals) */
.phx .phx-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.phx .phx-grid .phx-wide { grid-column: 1 / -1; }
.phx .phx-grid select { width: 100%; min-width: 0; box-sizing: border-box; min-height: 44px; padding: 0.4rem 0.5rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg, transparent); color: var(--text); font-size: 16px; }
@media (max-width: 380px) { .phx .phx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.phx .drx-med-f[data-exp="expired"] input, .phx .drx-med-f[data-exp="bad"] input { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25); }
.phx .drx-med-f[data-exp="soon"] input { border-color: #d97706; }
.phx .phx-exp-note { font-size: 0.74rem; font-weight: 700; color: #dc2626; }
.phx .drx-med-f[data-exp="soon"] .phx-exp-note { color: #b45309; }
.phx .phx-issues { margin: 0; padding: 0.6rem 0.8rem 0.6rem 1.8rem; border-radius: 14px; border: 1px solid rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.08); display: grid; gap: 0.2rem; font-size: 0.9rem; }
.phx .phx-totals { margin: 0; display: grid; gap: 0.25rem; padding: 0.7rem 0.8rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.phx .phx-totals div { display: flex; justify-content: space-between; gap: 1rem; }
.phx .phx-totals dt { margin: 0; color: var(--muted, inherit); }
.phx .phx-totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.phx .phx-totals .phx-grand { border-top: 1px solid var(--border); padding-top: 0.3rem; font-size: 1.15rem; }
.drx .drx-f-check { align-self: end; min-height: 44px; display: flex; align-items: center; }
/* Release H2B: Pharmacy inventory / stock / suppliers / reports (local IndexedDB) */
.phx-inv .btn-primary,
.phx-inv .btn-ghost { min-height: 44px; box-sizing: border-box; }
.phx-inv .phx-mode { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 0.4rem; }
.phx-inv .phx-catalog, .phx-inv .phx-batch-list, .phx-inv .phx-alert-list, .phx-inv .phx-move-list,
.phx-inv .phx-sup-list, .phx-inv .phx-pur-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.phx-inv .phx-cat-item, .phx-inv .phx-batch-item, .phx-inv .phx-sup-list > li, .phx-inv .phx-move-list > li,
.phx-inv .phx-pur-history > li, .phx-inv .phx-alert-list > li {
  display: grid; gap: 0.2rem; padding: 0.65rem 0.75rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; min-width: 0; }
.phx-inv .phx-cat-stock { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; font-size: 0.9rem; }
.phx-inv .phx-badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 999px;
  background: rgba(217, 119, 6, 0.15); color: #b45309; }
.phx-inv .phx-badge.warn { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.phx-inv .phx-summary { font-size: 0.9rem; color: var(--muted, inherit); margin: 0.35rem 0 0.55rem; }
.phx-inv .phx-product-form, .phx-inv .phx-batch-form, .phx-inv .phx-backup {
  display: grid; gap: 0.55rem; padding: 0.75rem; border-radius: 14px; border: 1px dashed var(--border); min-width: 0; }
.phx-inv .phx-backup-status[data-kind="ok"] { color: #15803d; }
.phx-inv .phx-backup-status[data-kind="err"] { color: #b91c1c; }
.phx-inv [data-inv-quota][data-warn="1"] { color: #b45309; font-weight: 600; }
.phx-inv-picker { display: grid; gap: 0.4rem; padding: 0.6rem 0.7rem; border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent); margin-bottom: 0.55rem; }
.phx-pick-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.phx-pick { min-height: 40px; padding: 0.35rem 0.65rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg, transparent); color: var(--text); cursor: pointer; font-size: 0.9rem; }
.phx-pick:hover, .phx-pick:focus-visible { border-color: #0f766e; outline: 2px solid rgba(15, 118, 110, 0.35); }
.phx-pur-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.phx-pur-lines .phx-line { display: grid; gap: 0.4rem; padding: 0.55rem; border-radius: 12px; border: 1px solid var(--border); }
@media (max-width: 360px) {
  .phx-inv .phx-cat-item, .phx-inv .phx-product-form { padding: 0.55rem; }
}
/* Release H3: Dental Clinic management (appointments, visit notes, treatment plans, billing, follow-up) */
.dcx .btn-primary, .dcx .btn-ghost { min-height: 44px; box-sizing: border-box; }
.dcx .dc-sub { margin: 0.2rem 0 0; font-size: 0.95rem; }
.dcx .dc-editing { margin: 0; padding: 0.4rem 0.7rem; border-radius: 10px; background: rgba(37, 99, 235, 0.1); font-weight: 600; }
.dcx .dc-store { display: grid; gap: 0.55rem; padding: 0.75rem; border-radius: 14px; border: 1px dashed var(--border); min-width: 0; }
.dcx .dc-store[data-mode="device"] { border-style: solid; border-color: rgba(21, 128, 61, 0.55); }
.dcx .dc-store-mode { margin: 0; display: grid; gap: 0.15rem; }
.dcx .dc-store-warn { margin: 0; padding: 0.5rem 0.7rem; border-radius: 10px; background: rgba(217, 119, 6, 0.14); color: #92400e; font-weight: 600; }
.dcx [data-dc-store-status][data-kind="ok"] { color: #15803d; }
.dcx [data-dc-store-status][data-kind="err"] { color: #b91c1c; }
.dcx .dc-file { position: relative; display: inline-flex; align-items: center; cursor: pointer; overflow: hidden; }
.dcx .dc-file input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.dcx .dc-file:focus-within { outline: 2px solid var(--drx-acc); outline-offset: 2px; }
.dcx .dc-inline { flex: 1 1 12rem; }
.dcx .dc-pick { display: grid; gap: 0.4rem; padding: 0.6rem 0.7rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.dcx .dc-pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.dcx .dc-pick-row { width: 100%; min-height: 44px; display: grid; gap: 0.05rem; text-align: left; padding: 0.35rem 0.65rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg, transparent); color: inherit; cursor: pointer; font: inherit; }
.dcx .dc-pick-row.is-on { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.dcx .dc-pick-row.is-on .muted-sm { color: rgba(255, 255, 255, 0.85); }
.dcx .dc-pick [data-dc-pick-new] { justify-self: start; }
.dcx .dc-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.dcx .dc-seg input[type="date"] { min-height: 44px; padding: 0.4rem 0.6rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 16px; max-width: 11rem; }
.dcx .dc-chip, .dcx .dc-chip-r span { display: inline-flex; align-items: center; min-height: 40px; padding: 0.3rem 0.75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.dcx .dc-chip:active, .dcx .dc-chip-r span:active { transform: translateY(1px); box-shadow: none; }
.dcx .dc-chip.is-on, .dcx .dc-chip-r input:checked + span { color: #fff; border-color: transparent; font-weight: 600;
  background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.dcx .dc-chip-r { position: relative; display: inline-flex; }
.dcx .dc-chip-r input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.dcx .dc-chip-r input:focus-visible + span { outline: 2px solid var(--drx-acc); outline-offset: 2px; }
.dcx .dc-cal-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; }
.dcx .dc-cal { display: grid; gap: 0.6rem; min-width: 0; }
.dcx .dc-day { display: grid; gap: 0.4rem; padding: 0.6rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.dcx .dc-day.is-today { border-color: var(--drx-acc); }
.dcx .dc-day h4 { margin: 0; font-size: 0.95rem; }
.dcx .dc-ap-list, .dcx .dc-hist, .dcx .dc-items, .dcx .dc-pays, .dcx .dc-services, .dcx .dc-tnotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; min-width: 0; }
.dcx .dc-ap, .dcx .dc-hist-item { display: grid; gap: 0.3rem; padding: 0.55rem 0.65rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg, transparent); min-width: 0; }
.dcx .dc-ap p, .dcx .dc-hist-item p { margin: 0; overflow-wrap: anywhere; }
.dcx .dc-hist-item.is-on { border-color: var(--drx-acc); }
.dcx .dc-hist-item.is-late { border-left: 4px solid #d97706; }
.dcx .dc-hist-item > .dc-chip { justify-self: start; }
.dcx .dc-ap-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.dcx .dc-ap-time { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.dcx .dc-ap-who { font-weight: 600; overflow-wrap: anywhere; }
.dcx .dc-ap.is-cancelled, .dcx .dc-ap.is-no_show { opacity: 0.7; }
.dcx .dc-ap-acts { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.dcx .dc-badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
.dcx .dc-badge.is-arrived { background: rgba(14, 165, 233, 0.16); color: #0369a1; }
.dcx .dc-badge.is-completed { background: rgba(21, 128, 61, 0.15); color: #15803d; }
.dcx .dc-badge.is-cancelled, .dcx .dc-badge.is-no_show { background: rgba(100, 116, 139, 0.2); color: #475569; }
.dcx .dc-badge.is-warn { background: rgba(220, 38, 38, 0.13); color: #b91c1c; }
.dcx .dc-item { display: grid; gap: 0.45rem; padding: 0.65rem; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); min-width: 0; }
.dcx .dc-item.is-done { border-color: rgba(21, 128, 61, 0.55); }
.dcx .dc-item.is-cancelled { opacity: 0.65; }
.dcx .dc-item-head { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.dcx .dc-pay { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.3rem 0.3rem 0.7rem;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-variant-numeric: tabular-nums; min-width: 0; }
.dcx .dc-pay span { overflow-wrap: anywhere; }
.dcx .dc-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.dcx .dc-teeth-box { border: 1px solid var(--border); border-radius: 14px; padding: 0.6rem; margin: 0; display: grid; gap: 0.45rem; min-width: 0; }
.dcx .dc-teeth-box legend { font-weight: 700; padding: 0 0.3rem; }
.dcx .dc-teeth { display: grid; gap: 0.3rem; overflow-x: auto; padding-bottom: 0.2rem; }
.dcx .dc-teeth-row { display: grid; grid-template-columns: repeat(16, minmax(1.9rem, 1fr)); gap: 0.2rem; min-width: 34rem; }
.dcx .dc-teeth-row.is-primary { grid-template-columns: repeat(10, minmax(1.9rem, 1fr)); min-width: 22rem; max-width: 26rem; margin: 0 auto; }
.dcx .dc-teeth-row:nth-child(2) { margin-bottom: 0.35rem; }
.dcx .dc-tooth { min-height: 44px; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--bg, transparent); color: inherit;
  font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.dcx .dc-tooth.is-on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--drx-acc), var(--drx-acc2)); }
.dcx .dc-tooth:focus-visible { outline: 2px solid var(--drx-acc); outline-offset: 2px; }
.dcx .dc-tnotes li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.4rem; align-items: center; }
.dcx .dc-tnotes input { min-height: 44px; padding: 0.45rem 0.65rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 16px; width: 100%; box-sizing: border-box; min-width: 0; }
.dcx .phx-totals .is-due dd { color: #b45309; }
.dcx .phx-totals .is-err dd { color: #b91c1c; font-weight: 600; }
.dcx input:invalid { border-color: #dc2626; }
@media (prefers-reduced-motion: reduce) { .dcx .dc-chip, .dcx .dc-tooth { transition: none; } }

/* Tea Shop Quick Sales (T1A) */
.tea .tea-price-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.65rem 0.8rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 0.5rem; }
.tea .tea-price-bar strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.tea .tea-vars { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.6rem; }
.tea .tea-var { min-height: 44px; padding: 0.45rem 0.75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.tea .tea-var.is-on { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0f766e, #0d9488); }
.tea .tea-qty { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; margin-bottom: 0.5rem; }
.tea .tea-qbtn { min-height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; touch-action: manipulation; }
.tea .tea-qty-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.tea .tea-qty-val { min-width: 2.5rem; text-align: center; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tea .tea-qty-custom { flex: 1 1 7rem; margin: 0; }
.tea .tea-add { min-height: 52px; font-size: 1.05rem; font-weight: 800; width: 100%; }
.tea .tea-success { margin: 0.4rem 0; padding: 0.65rem 0.8rem; border-radius: 12px; background: rgba(21, 128, 61, 0.14); color: #15803d; font-weight: 700; }
.tea .tea-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.tea .tea-sale { display: grid; gap: 0.3rem; padding: 0.7rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.tea .tea-sale.is-void { opacity: 0.55; }
.tea .tea-sale-head { display: flex; justify-content: space-between; gap: 0.5rem; font-variant-numeric: tabular-nums; }
.tea .tea-sale-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tea .tea-dialog { border: none; border-radius: 18px; padding: 0; max-width: min(92vw, 26rem); background: var(--surface); color: inherit; box-shadow: 0 18px 50px rgba(0,0,0,0.28); }
.tea .tea-dialog::backdrop { background: rgba(0,0,0,0.45); }
.tea .tea-dialog-body { display: grid; gap: 0.65rem; padding: 1rem 1.05rem 1.1rem; }
.tea .tea-dialog-body h3 { margin: 0; font-size: 1.1rem; }
.tea .dc-seg { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.6rem; }
.tea .dc-chip-r { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; }
.tea .dc-chip-r:has(input:checked) { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0f766e, #0d9488); }
.tea .dc-chip-r input { position: absolute; opacity: 0; pointer-events: none; }
.tea .dc-sub { margin: 0.6rem 0 0.3rem; font-size: 0.95rem; }
@media (max-width: 380px) { .tea .tea-qty { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* P8C1 Photo Editor */
.pe { display: grid; gap: 0.75rem; }
.pe-lead { margin: 0; font-size: 1.02rem; line-height: 1.45; max-width: 40rem; }
.pe-landing-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pe-sub { margin: 0.4rem 0 0.35rem; font-size: 0.95rem; }
.pe-recent-list, .pe-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.pe-recent-list button, .pe-layer-name, .pe-vis { font: inherit; cursor: pointer; touch-action: manipulation; }
.pe-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.pe-tool { min-height: 44px; padding: 0.4rem 0.7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.pe-tool[aria-pressed="true"] { border-color: #3b6fb6; box-shadow: inset 0 0 0 1px #3b6fb6; }
.pe-sep { width: 1px; height: 1.6rem; background: var(--border); margin: 0 0.15rem; }
.pe-main { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .pe-main { grid-template-columns: minmax(0, 1fr) 16rem; align-items: start; } }
.pe-stage-wrap { min-width: 0; }
.pe-stage { position: relative; border-radius: 14px; border: 1px solid var(--border); background: #111827; overflow: hidden; min-height: 220px; display: grid; place-items: center; padding: 0.5rem; touch-action: none; overscroll-behavior: none; }
.pe-stage canvas { max-width: 100%; height: auto; display: block; touch-action: none; }
.pe.is-brushing .pe-stage { cursor: crosshair; touch-action: none; }
.pe.is-panning .pe-stage { cursor: grab; touch-action: none; }
.pe.is-panning .pe-stage:active { cursor: grabbing; }
html.pe-lock-scroll, html.pe-lock-scroll body { overflow: hidden; overscroll-behavior: none; touch-action: none; }
.pe-modebar { display: flex; gap: 0.35rem; margin: 0 0 0.45rem; }
.pe-mode { min-height: 40px; padding: 0 0.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: inherit; font-weight: 650; }
.pe-mode.is-active { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 14%, var(--surface)); }
.pe-id-warn { margin: 0 0 0.5rem; }
.pe[data-pe-ui="quick"] .pe-pro-only { display: none !important; }
.pe[data-pe-ui="quick"] .pe-side .pe-adj,
.pe[data-pe-ui="quick"] .pe-side [data-pe-mask-tools],
.pe[data-pe-ui="quick"] .pe-side .pe-layer-ops { display: none; }
.pe-status { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--muted, #64748b); }
.pe-side { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 0.7rem 0.75rem; display: grid; gap: 0.45rem; }
.pe-layer { display: flex; gap: 0.35rem; align-items: center; min-width: 0; }
.pe-layer.is-active .pe-layer-name { font-weight: 800; }
.pe-layer.is-hidden { opacity: 0.55; }
.pe-vis, .pe-layer-name { min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg, var(--surface)); color: inherit; }
.pe-vis { width: 2.4rem; flex: 0 0 auto; }
.pe-layer-name { flex: 1 1 auto; text-align: left; padding: 0 0.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-layer-ops { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pe-adj { border: 1px dashed var(--border); border-radius: 12px; padding: 0.45rem 0.55rem 0.55rem; margin: 0; }
.pe-export-panel { border: 1px dashed var(--border); border-radius: 12px; padding: 0.55rem 0.65rem 0.65rem; display: grid; gap: 0.4rem; }
.pe-export-panel .control-row { display: grid; grid-template-columns: minmax(7rem, 0.9fr) minmax(0, 1.2fr) auto; gap: 0.4rem; align-items: center; }
.pe-export-panel .control-row label { font-size: 0.9rem; }
.pe-project-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; padding-top: 0.25rem; border-top: 1px solid var(--border); }
.pe-consent { display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.9rem; max-width: 36rem; }
@media (max-width: 430px) {
  .pe-export-panel .control-row { grid-template-columns: 1fr; }
  .pe-stage { min-height: min(58vh, 420px); max-height: 62vh; }
  .pe-toolbar {
    position: sticky; bottom: 0; z-index: 3; padding: 0.45rem 0 calc(0.45rem + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px);
    gap: 0.3rem;
  }
  .pe-tool { flex: 1 1 auto; min-width: 2.75rem; font-size: 0.82rem; padding: 0.35rem 0.45rem; }
  .pe-main { gap: 0.55rem; }
  .pe-side { order: 2; }
}

/* P10A — searchable ISO currency picker */
.fst-cur { position: relative; width: 100%; min-width: 0; }
.fst-cur-native {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; border: 0 !important;
}
.fst-cur-btn {
  width: 100%; min-height: 44px; text-align: left; padding: 0.45rem 0.7rem; border-radius: 10px;
  border: 1px solid var(--border, #cbd5e1); background: var(--surface, #fff); color: var(--text, #0f172a);
  font: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer;
}
.fst-cur-btn:focus-visible { outline: 2px solid var(--brand, #0d9488); outline-offset: 1px; }
.fst-cur.is-open .fst-cur-btn { border-color: color-mix(in srgb, var(--brand, #0d9488) 55%, var(--border, #cbd5e1)); }
.fst-cur-pop {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: min(60vh, 360px); display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.5rem; border-radius: 12px; border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}
.fst-cur-pop[hidden] { display: none !important; }
.fst-cur-search {
  width: 100%; min-height: 40px; box-sizing: border-box; padding: 0.4rem 0.6rem; border-radius: 8px;
  border: 1px solid var(--border, #cbd5e1); background: transparent; color: inherit; font: inherit;
}
.fst-cur-list {
  list-style: none; margin: 0; padding: 0; overflow: auto; max-height: min(44vh, 260px); display: grid; gap: 2px;
}
.fst-cur-list li {
  display: grid; grid-template-columns: 3.2rem 2.6rem 1fr auto; gap: 0.35rem; align-items: center;
  min-height: 40px; padding: 0.35rem 0.45rem; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
}
.fst-cur-list li:hover, .fst-cur-list li:focus { background: color-mix(in srgb, var(--brand, #0d9488) 12%, transparent); outline: none; }
.fst-cur-list li[aria-selected="true"] { background: color-mix(in srgb, var(--brand, #0d9488) 18%, transparent); font-weight: 700; }
.fst-cur-code { font-weight: 800; font-variant-numeric: tabular-nums; }
.fst-cur-sym { color: var(--muted, #64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fst-cur-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fst-cur-dp { color: var(--muted, #64748b); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.fst-cur-hint { margin: 0; font-size: 0.72rem; color: var(--muted, #64748b); line-height: 1.3; }
@media (max-width: 430px) {
  .fst-cur-pop {
    position: fixed; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; top: auto; max-height: min(70vh, 420px);
    border-radius: 16px 16px 12px 12px; padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }
  .fst-cur-list li { grid-template-columns: 3rem 2.2rem 1fr; }
  .fst-cur-dp { display: none; }
}
@media (prefers-color-scheme: dark) {
  .fst-cur-btn, .fst-cur-pop { background: var(--surface, #0f172a); }
}

/* P14B — return to Job Desk while a customer job context is active */
.svc-desk-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.45rem;
  padding: 0.45rem 0.75rem; min-height: 48px;
  background: var(--surface, #fff); border-bottom: 1px solid var(--border, #dbe1ea); color: inherit;
}
.svc-desk-bar .btn-ghost { min-height: 44px; }
.has-svc-desk-bar .local-tool { padding-top: 0.5rem; }
