/* Photo Editor Studio — Release BF.
   The full-screen Photo Editor as one application in the natural-green Fah Swe identity (same system as the Passport
   studio, passport-studio.css):
   - wide screens: top bar with the step tracker, a large canvas and an inspector column on every screen. Edit: the
     photo with its history / compare bar and the quick actions above it, the Retouch / Background tools beside it.
     Settings: the photo stays on the canvas as a live preview of the adjustments, Quick / Pro, layers and adjustments
     beside it. Preview: the finished photo large, export options, Export and — after Export — the downloads beside it;
   - phones: one task per screen, Back / Next fixed at the bottom above the safe area;
   - follows the site theme (light / dark); the photo always sits on a neutral backdrop.
   Loaded after photo-app.css on the Photo Editor page only. Scope: the open workspace of this tool. */

html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] {
  --pa-bg: #0a0f0c;
  --pa-bar: #101814;
  --pa-card: #141e19;
  --pa-card-2: #1a2620;
  --pa-field: #0c130f;
  --pa-line: rgba(220, 255, 230, 0.09);
  --pa-line-strong: rgba(220, 255, 230, 0.17);
  --pa-text: #eef4ef;
  --pa-muted: #a3b4a9;
  --pa-canvas: #060907;
  --pa-accent: #5cbf5f;
  --pa-accent-press: #4aa64e;
  --pa-accent-soft: rgba(124, 204, 90, 0.16);
  --pa-accent-text: #a6e38a;
  --pa-raise: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.28);
  --pa-press: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  --pa-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.3);
  --pe-insp: clamp(20rem, 26vw, 25rem);
  background: var(--pa-bg) !important;
  color: var(--pa-text);
}
html[data-theme="light"].fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] {
  --pa-bg: #eef2ef;
  --pa-bar: #ffffff;
  --pa-card: #ffffff;
  --pa-card-2: #f5f8f5;
  --pa-field: #ffffff;
  --pa-line: #dde4de;
  --pa-line-strong: #c4cec6;
  --pa-text: #14201a;
  --pa-muted: #56665c;
  --pa-canvas: #dfe5e0;
  --pa-accent: #23803d;
  --pa-accent-press: #1a6331;
  --pa-accent-soft: rgba(35, 128, 61, 0.1);
  --pa-accent-text: #1a6b33;
  --pa-raise: inset 0 1px 0 #ffffff, 0 1px 2px rgba(16, 24, 40, 0.1), 0 4px 10px rgba(16, 24, 40, 0.06);
  --pa-press: inset 0 2px 4px rgba(16, 24, 40, 0.14);
  --pa-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 22px rgba(16, 24, 40, 0.06);
}

/* ── shared visual system (phones and wide screens) ───────────────────────────────────────────────────────────── */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa { color: var(--pa-text); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :focus-visible {
  outline: 2px solid var(--pa-accent);
  outline-offset: 2px;
}
/* top bar and step tracker */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-workbar {
  background: var(--pa-bar);
  border-top: 0;
  border-bottom: 1px solid var(--pa-line);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-workbar .pa-icon {
  border-radius: 10px;
  color: var(--pa-text);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-workbar .pa-icon:hover { background: var(--pa-accent-soft); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-work-title {
  color: var(--pa-text);
  font-size: 0.9rem;
  font-weight: 700;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps {
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  background: var(--pa-bar);
  border-bottom: 1px solid var(--pa-line);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps li {
  padding: 0.28rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--pa-muted);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps li.is-done { color: var(--pa-accent-text); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps li.is-current {
  color: var(--pa-text);
  background: var(--pa-accent-soft);
  border-color: color-mix(in srgb, var(--pa-accent) 45%, transparent);
}
/* footer: Back (raised) and the green primary action */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav {
  background: var(--pa-bar);
  border-top: 1px solid var(--pa-line);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav-back {
  border: 1px solid var(--pa-line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--pa-card-2), var(--pa-card));
  color: var(--pa-text);
  box-shadow: var(--pa-raise);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav-go {
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 12px;
  background-color: var(--brand2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--brand), var(--brand2));
  color: var(--on-brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px var(--brand-glow);
  font-weight: 800;
  letter-spacing: 0.01em;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-nav-back, .pe-nav-go) {
  transition: transform 120ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 200ms, filter 120ms;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-nav-back, .pe-nav-go):hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-nav-back, .pe-nav-go):active {
  transform: translateY(1px);
  box-shadow: var(--pa-press);
}

/* upload screen: a centred card */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-landing {
  align-items: center;
  justify-content: center;
  margin: auto;
  padding: 1.6rem 1.2rem;
  max-width: 28rem;
  width: calc(100% - 2rem);
  box-sizing: border-box;
  border: 1px solid var(--pa-line);
  border-radius: 18px;
  background: var(--pa-card);
  box-shadow: var(--pa-card-shadow);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-lead { color: var(--pa-text); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-landing .lt-hint { color: var(--pa-muted); font-size: 0.78rem; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-landing-actions {
  display: grid;
  gap: 0.55rem;
  width: 100%;
  margin: 0 0 0.8rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-landing-actions :is(.btn-primary, .btn-ghost) {
  min-height: 46px;
  border-radius: 12px;
  font-weight: 750;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-landing-actions .btn-ghost,
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-recent-list button {
  border: 1px solid var(--pa-line-strong);
  background: linear-gradient(180deg, var(--pa-card-2), var(--pa-card));
  color: var(--pa-text);
  box-shadow: var(--pa-raise);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-recent { width: 100%; text-align: left; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-recent-list button { min-height: 44px; width: 100%; border-radius: 10px; text-align: left; padding: 0 0.75rem; }

/* the canvas: the photo on a neutral backdrop, nothing drawn over it */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main { background: var(--pa-canvas); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-stage-wrap { position: relative; padding: 0.75rem; box-sizing: border-box; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-stage canvas {
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.32);
}
/* the document line is a caption under the photo, never over it (it covered the photo's lower left corner) */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-stage-wrap { flex-direction: column; gap: 0.35rem; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-stage-wrap > .pe-stage { flex: 1 1 auto; min-height: 0; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-status {
  position: static;
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 0.7rem;
  color: var(--pa-muted);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-status:empty { display: none; }
/* history / compare: a raised group */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-edit-bar {
  align-self: flex-start;
  gap: 0.25rem;
  margin: 0.55rem 0.6rem 0;
  padding: 0.2rem;
  border: 1px solid var(--pa-line);
  border-radius: 12px;
  background: var(--pa-bar);
  box-shadow: var(--pa-raise);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-edit-bar .pa-icon {
  min-width: 40px;
  min-height: 40px;
  border-radius: 9px;
  color: var(--pa-text);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-edit-bar .pa-icon:hover { background: var(--pa-accent-soft); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-edit-bar .pa-icon[aria-pressed="true"] {
  background: var(--pa-accent-soft);
  box-shadow: inset 0 0 0 1px var(--pa-accent);
}
/* tool chips (Retouch / Background / Auto improve …): raised, the open tool green-edged (light theme was white on white) */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-edit-tools {
  gap: 0.4rem !important;
  padding: 0.55rem 0.6rem;
  background: var(--pa-bar);
  border-top: 1px solid var(--pa-line);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-tool {
  min-height: 42px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--pa-line-strong);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--pa-card-2), var(--pa-card));
  color: var(--pa-text);
  box-shadow: var(--pa-raise);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-tool[hidden] { display: none; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-tool[aria-pressed="true"] {
  border-color: var(--pa-accent);
  background: var(--pa-accent-soft);
  box-shadow: inset 0 0 0 1px var(--pa-accent), var(--pa-press);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-tool.pe-tool-primary {
  border-color: rgba(0, 0, 0, 0.16);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--brand), var(--brand2));
  color: var(--on-brand);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-tool:active { transform: translateY(1px); box-shadow: var(--pa-press); }
/* the ID-photo note is guidance: shown, quiet */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-id-warn {
  display: block !important;
  margin: 0;
  padding: 0.35rem 0.7rem 0.5rem;
  background: var(--pa-bar);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--pa-muted);
}

/* inspector cards */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-edit-sheets > .pa-sheet, .pe-side, .pe-adj[data-pe-adj], .pe-export-panel) {
  display: block;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--pa-line);
  border-radius: 16px;
  background: var(--pa-card);
  box-shadow: var(--pa-card-shadow);
  color: var(--pa-text);
  box-sizing: border-box;
  min-width: 0;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-project-bar { display: flex; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) > :is(h3.pe-sub, legend) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  float: none;
  width: 100%;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pa-muted);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) > :is(h3.pe-sub, legend)::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 0 0 3px var(--pa-accent-soft);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pa-adv > .pe-sub,
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa [data-pe-mask-tools] > legend {
  display: block;
  margin: 1rem 0 0.55rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pa-line);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pa-text);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa [data-pe-mask-tools] { border: 0; margin: 0; padding: 0; min-width: 0; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa [data-pe-mask-tools] > legend::before { display: none; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-export-panel .lt-hint {
  display: block;
  margin: 0 0 0.75rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--pa-muted);
}
/* fields: labels above, value at the end of the label row */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin: 0 0 0.7rem;
  min-height: 0;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row label {
  grid-column: 1;
  min-height: 0;
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--pa-muted);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row > span {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pa-text);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row > :is(input, select) { grid-column: 1 / -1; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row select {
  width: 100%;
  min-height: 42px;
  padding: 0 0.75rem;
  border: 1px solid var(--pa-line-strong);
  border-radius: 10px;
  background-color: var(--pa-field);
  color: var(--pa-text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
  font: inherit;
  font-size: 0.86rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .control-row select:focus-visible {
  outline: none;
  border-color: var(--pa-accent);
  box-shadow: 0 0 0 3px var(--pa-accent-soft);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: var(--pa-accent);
  background: transparent;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa input[type="color"] {
  justify-self: start;
  width: 3.2rem;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--pa-line-strong);
  border-radius: 10px;
  background: var(--pa-field);
  box-shadow: var(--pa-raise);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--pa-text);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-consent input { width: 1.1rem; height: 1.1rem; margin-top: 0.1rem; accent-color: var(--pa-accent); flex: 0 0 auto; }
/* buttons in the inspector: raised, green when on */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-layer-ops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.4rem;
  margin: 0 0 0.8rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj, .pe-project-bar) .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--pa-line-strong);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--pa-card-2), var(--pa-card));
  color: var(--pa-text);
  box-shadow: var(--pa-raise);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: transform 120ms cubic-bezier(0.2, 0.7, 0.2, 1), border-color 150ms, background 150ms;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj, .pe-project-bar) .btn-ghost:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--pa-accent) 60%, var(--pa-line-strong));
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj, .pe-project-bar) .btn-ghost:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--pa-press);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pa-sheet, .pe-side, .pe-adj) .btn-ghost[aria-pressed="true"] {
  border-color: var(--pa-accent);
  background: var(--pa-accent-soft);
  box-shadow: inset 0 0 0 1px var(--pa-accent), var(--pa-press);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-export-panel .btn-primary {
  border: 1px solid rgba(0, 0, 0, 0.16);
  background-color: var(--brand2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px var(--brand-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin: 0 0 0.5rem;
  border-radius: 12px;
  color: var(--on-brand);
  font-size: 0.9rem;
  font-weight: 800;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-export-panel > .btn-ghost {
  display: flex;
  width: 100%;
  margin: 0 0 0.25rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-project-bar {
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pa-line);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-project-bar .btn-ghost { flex: 1 1 8rem; }
/* layers: rows of raised buttons, the active one green-edged */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-layers { margin: 0 0 0.75rem; gap: 0.4rem; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-vis, .pe-layer-name) {
  min-height: 42px;
  border: 1px solid var(--pa-line-strong);
  border-radius: 10px;
  background: var(--pa-field);
  color: var(--pa-text);
  font-size: 0.82rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-vis { flex: 0 0 42px; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-layer.is-active .pe-layer-name {
  border-color: var(--pa-accent);
  background: var(--pa-accent-soft);
  box-shadow: inset 0 0 0 1px var(--pa-accent);
}
/* Quick / Pro: a segmented control */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-modebar {
  gap: 0;
  padding: 3px;
  margin: 0 0 0.75rem;
  border: 1px solid var(--pa-line);
  border-radius: 12px;
  background: var(--pa-field);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-modebar .pe-mode {
  flex: 1 1 0;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--pa-muted);
  font-size: 0.84rem;
  font-weight: 750;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-modebar .pe-mode.is-active {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%), linear-gradient(135deg, var(--brand), var(--brand2));
  color: var(--on-brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px var(--brand-glow);
}
/* Advanced: a disclosure row */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-adj [data-pa-advanced] {
  display: flex !important;
  width: 100%;
  justify-content: space-between;
  margin: 0.35rem 0 0.8rem;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-adj [data-pa-advanced]::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-adj [data-pa-advanced][aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
/* Preview: the finished photo */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.9rem;
  background: var(--pa-canvas);
  box-sizing: border-box;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-final canvas {
  background: repeating-conic-gradient(#d8dce4 0% 25%, #f0f2f6 0% 50%) 0 0 / 16px 16px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.32);
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-final figcaption {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--pa-line);
  border-radius: 999px;
  background: var(--pa-bar);
  color: var(--pa-text);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-final figcaption:empty { display: none; }

/* the downloads after Export: inside the export card, under the Export button (they sat below the Back / Export bar) */
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result {
  position: static !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  overflow: visible !important;
  max-height: none !important;
  margin: 0 0 0.6rem !important;
  padding: 0.85rem !important;
  border: 1px solid color-mix(in srgb, var(--pa-accent) 45%, var(--pa-line)) !important;
  border-radius: 14px !important;
  background: var(--pa-accent-soft) !important;
  color: var(--pa-text);
  box-shadow: none !important;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result.hidden { display: none !important; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result:not(.hidden) { display: grid !important; gap: 0.55rem; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result > * { order: 5; min-width: 0; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result .lt-note { order: 1; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result .lt-outputs { order: 2; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result .lt-result-actions { order: 3; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result :is(.lt-note, .lt-notes, table, th, td, p, li) { color: var(--pa-text); }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result table { width: 100%; font-size: 0.78rem; }
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result a[download] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 800;
}
html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage] [data-pe-export-slot] .lt-result .btn-ghost {
  min-height: 42px;
  border: 1px solid var(--pa-line-strong);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--pa-card-2), var(--pa-card));
  color: var(--pa-text);
  box-shadow: var(--pa-raise);
}

/* ── wide screens: canvas + inspector on every screen ─────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa:not([data-pe-stage="upload"]) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "bar" "steps" "work" "nav";
    height: 100%;
    min-height: 0;
  }
  /* every row named: an older rule gives .pa-top the area "top", which made implicit columns here */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa > .pe-workbar { grid-area: bar; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa > .pe-steps { grid-area: steps; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa > .pe-work { grid-area: work; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa > .pe-nav { grid-area: nav; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps {
    justify-content: center;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps li { flex: 0 1 9rem; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-work.pa-app {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--pe-insp);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "canvas insp";
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  /* Edit: the photo column (history bar, photo, quick actions, note) with the Retouch / Background tools as the
     inspector beside it — one grid, no DOM change */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-work.pa-app > .pe-main {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) var(--pe-insp);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "ebar tools insp" "stage stage insp" "warn warn insp";
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }
  /* Settings: the same photo column, the settings beside it */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="settings"] .pe-work.pa-app > .pe-main {
    grid-area: canvas;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "ebar" "stage";
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main > .pe-edit-bar { grid-area: ebar; justify-self: start; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main > .pe-stage-wrap { grid-area: stage; max-height: none; min-height: 0; height: 100%; }
  /* one toolbar row above the photo: history / compare, then the quick actions */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main > .pe-edit-tools {
    grid-area: tools;
    align-self: end;
    justify-content: flex-start;
    margin: 0.55rem 0.6rem 0 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main > .pe-id-warn { grid-area: warn; text-align: center; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-main .pe-stage { min-height: 0 !important; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-main > .pe-edit-sheets { grid-area: insp; max-height: none; }
  /* the inspector column: one scrolling panel, cards stacked */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-main > .pe-edit-sheets,
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="settings"] .pe-work.pa-app > .pe-settings,
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-export-panel {
    display: flex !important;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.9rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--pa-bar);
    border-left: 1px solid var(--pa-line);
    box-sizing: border-box;
    min-height: 0;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="settings"] .pe-work.pa-app > .pe-settings {
    grid-area: insp;
    grid-column: auto;
    grid-row: auto;
    max-width: none;
    width: auto;
    max-height: none;
    justify-self: stretch;
  }
  /* items of a scrolling column keep their size (they shrank to 0 px after Export and overlapped) */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-settings, .pe-edit-sheets, .pe-export-panel) > * { flex: 0 0 auto; }
  /* Settings: the photo stays on the canvas as the live preview; the Edit-only rows are not shown there */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="settings"] .pe-main :is(.pe-edit-tools, .pe-id-warn, .pe-edit-sheets) { display: none !important; }
  /* Preview: the finished photo is the canvas, export beside it */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-work.pa-app > .pe-preview-screen {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--pe-insp);
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    min-height: 0;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-final { height: 100%; min-height: 0; overflow: hidden; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-export-panel {
    border-radius: 0;
    border-width: 0 0 0 1px;
    box-shadow: none;
    background: var(--pa-bar);
  }
  /* footer: Back on the left, the primary action a button on the right (not a bar across the screen) */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav {
    position: static;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav-back { flex: 0 0 auto; min-width: 7rem; margin-right: auto; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav-go { flex: 0 0 auto; min-width: 13rem; padding: 0 1.4rem; }
}

/* ── phones and tablets: one task per screen, Back / Next fixed at the bottom ─────────────────────────────────── */
@media (max-width: 899px) {
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] {
    --pe-nav-h: calc(3.9rem + env(safe-area-inset-bottom, 0px));
    padding-bottom: var(--pe-nav-h) !important;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    margin: 0;
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  }
  /* Edit: the photo keeps most of the screen, the tool chips one scrolling row, the sheet below it scrolls */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-edit-tools {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 0 0 auto;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-edit-tools .pe-tool { flex: 0 0 auto; white-space: nowrap; }
  /* the photo keeps the room: the ID-photo note stays a wide-screen line (hidden on phones, as before), the document
     line sits beside the history buttons instead of under the photo */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-id-warn { display: none !important; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-main { position: relative; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-status {
    position: absolute;
    top: 0.4rem;
    left: 9.2rem;
    right: 0.6rem;
    height: 46px;
    line-height: 46px;
    text-align: right;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-stage-wrap { gap: 0; position: static; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-edit-bar { margin: 0.4rem 0.5rem 0; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-edit-tools { padding: 0.45rem 0.5rem; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-edit-sheets {
    max-height: 28%;
    padding: 0.6rem;
    background: var(--pa-bg);
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="edit"] .pe-stage-wrap { padding: 0.4rem; }
  /* Settings / Preview: the panel is the screen and scrolls */
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="settings"] .pe-settings,
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-preview-screen {
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem;
    box-sizing: border-box;
  }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa :is(.pe-settings, .pe-preview-screen) > * { flex: 0 0 auto; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa[data-pe-stage="preview"] .pe-final { border-radius: 14px; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-work.pa-app { min-height: 0; overflow: hidden; }
}

@media (max-width: 380px) {
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps { gap: 0.15rem; padding: 0.35rem 0.35rem; }
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa .pe-steps li { padding: 0.26rem 0.15rem; font-size: 0.64rem; }
}

@media (prefers-reduced-motion: reduce) {
  html.fst-workspace-open .local-tool.is-workspace[data-tool-id="photo-editor"] .pe.pa * { transition: none !important; }
}
