.photo-editor {
  --pe-border: #dce3e5;
  --pe-muted: #596a70;
  --pe-accent: #146b5c;
}

.photo-editor [hidden] { display: none !important; }
.photo-editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.photo-editor-actions .btn { gap: 6px; }
.photo-editor .photo-editor-icon { min-width: 42px; width: 42px; min-height: 42px; padding: 0; justify-content: center; }
.photo-editor svg { width: 18px; height: 18px; flex: 0 0 auto; }
.photo-editor-status { color: var(--pe-muted); margin: 0 0 10px; overflow-wrap: anywhere; }
.photo-editor-status:empty { display: none; }
.photo-editor-status[data-error] { color: #a52336; }

.photo-editor-drop {
  width: 100%; min-height: 235px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; padding: 20px; border: 1px dashed #93a7a9; border-radius: 8px; background: #f6f9f8;
  color: #1c3032; font: inherit; text-align: center; cursor: pointer;
}
.photo-editor-drop:hover, .photo-editor-drop[data-drag] { background: #eaf4f0; border-color: var(--pe-accent); }
.photo-editor-drop svg { width: 28px; height: 28px; color: var(--pe-accent); }
.photo-editor-drop strong { font-size: 17px; }
.photo-editor-drop span, .photo-editor-drop small { color: var(--pe-muted); }

.photo-editor-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 255px); gap: 16px; align-items: start; }
.photo-editor-viewer, .photo-editor-settings { min-width: 0; }
.photo-editor-viewer { border: 1px solid var(--pe-border); border-radius: 8px; overflow: hidden; background: #fff; }
.photo-editor-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; }
body.admin-shell .photo-editor button[aria-pressed="true"] { background: #e4f1eb; color: #10594b; border-color: #a9cabd; }
.photo-editor button:disabled { opacity: .45; cursor: default; }
.photo-editor-stage {
  display: grid; place-items: center; padding: 14px; min-height: 300px; overflow: hidden;
  border-block: 1px solid var(--pe-border); background: #edf1f1;
}
.photo-editor-stage canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: min(67vh, 740px); touch-action: pan-y; }
.photo-editor-stage canvas[data-drawing] { touch-action: none; cursor: crosshair; }
.photo-editor-preview-bar { min-height: 54px; }
.photo-editor-segment { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--pe-border); border-radius: 6px; overflow: hidden; }
.photo-editor-segment button { background: #fff; border: 0; padding: 7px 10px; min-height: 34px; color: #33464b; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.photo-editor-segment button + button { border-left: 1px solid var(--pe-border); }

.photo-editor-settings { border-top: 1px solid var(--pe-border); color: #1e3034; }
.photo-editor-settings-section { display: grid; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--pe-border); }
.photo-editor-settings-section h2, .photo-editor-confirm h2 { font-size: 15px; margin: 0; letter-spacing: 0; }
.photo-editor-settings label { display: block; min-width: 0; font-size: 12px; font-weight: 650; }
.photo-editor-settings input:not([type="checkbox"]), .photo-editor-settings select { width: 100%; min-width: 0; }
.photo-editor-settings input[type="text"], .photo-editor-settings input[type="number"], .photo-editor-settings select {
  min-height: 39px; margin-top: 4px; border: 1px solid #a8b7ba; border-radius: 6px; background: #fff; color: #1e3034; padding: 6px 8px;
}
.photo-editor-settings input[type="range"], .photo-editor-settings input[type="checkbox"] { accent-color: var(--pe-accent); margin-inline: 0; }
.photo-editor-settings-section .btn { width: 100%; justify-content: center; gap: 6px; }
.photo-editor-settings-section .btn span { white-space: normal; }
.photo-editor-slider span { display: flex; justify-content: space-between; gap: 8px; }
.photo-editor-settings .photo-editor-checkbox { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 32px; }
body.admin-shell .photo-editor .photo-editor-checkbox input { width: 17px; height: 17px; min-height: 17px; margin: 0; padding: 0; flex: 0 0 17px; }
.photo-editor-crop-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.photo-editor-fill { display: flex; align-items: end; gap: 7px; }
.photo-editor-fill label { width: 66px; }
.photo-editor-fill input[type="color"] { display: block; height: 42px; margin-top: 4px; padding: 3px; cursor: pointer; }
.photo-editor-fill .photo-editor-icon { width: 42px; }
#photoEditorTextValue { display: block; width: 100%; margin-top: 4px; resize: vertical; font-size: 16px; }
.photo-editor-ink { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; }
.photo-editor-ink input[type="color"] { height: 35px; background: #fff; border: 1px solid #a8b7ba; border-radius: 5px; padding: 3px; }
.photo-editor-optional { font-weight: normal; color: var(--pe-muted); }
#photoEditorDetails { overflow-wrap: anywhere; }
.photo-editor-confirm { color: #1e3034; background: #fff; border: 1px solid var(--pe-border); border-radius: 8px; padding: 18px; max-width: calc(100% - 28px); }
.photo-editor-confirm .photo-editor-actions { margin-top: 14px; }
.photo-editor-confirm::backdrop { background: #142024aa; }
.photo-type-command { min-height: 42px; }
.photo-editor .photo-type-layer-row, .photo-editor .photo-type-style { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.photo-editor .photo-type-layer-row select { flex: 1 1 85px; margin: 0; text-overflow: ellipsis; }
.photo-editor .photo-type-panel .photo-editor-icon { flex: 0 0 34px; width: 34px; min-width: 34px; min-height: 38px; }
.photo-type-font { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 8px; }
.photo-editor .photo-type-style input[type=color] { width: 40px; height: 38px; padding: 3px; border: 1px solid #a8b7ba; border-radius: 5px; background: white; cursor: pointer; }
.photo-type-panel textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; resize: vertical; min-height: 74px; border: 1px solid #a8b7ba; border-radius: 6px; background: white; color: #1e3034; padding: 8px; font: inherit; font-size: 16px; }
.photo-type-style .photo-editor-checkbox { margin-inline-start: auto; }
.photo-editor canvas[data-typing] { cursor: text; }
.photo-editor canvas[data-moving-type] { cursor: grabbing; }
.photo-editor-pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-bottom: 1px solid var(--pe-border); background: #f6f9f8; font-size: 14px; }
.photo-editor-pager label { display: inline-flex; align-items: center; gap: 6px; }
.photo-editor-pager select { min-height: 36px; width: 64px; color: #1e3034; background: #fff; border: 1px solid #a8b7ba; border-radius: 5px; padding-inline: 6px; }
#photoEditorPdfHint { color: var(--pe-muted); }

@media (max-width: 850px) {
  .photo-editor-workspace { grid-template-columns: minmax(0, 1fr); }
  .photo-editor-stage { min-height: 225px; padding: 8px; }
  .photo-editor-stage canvas { max-height: 56vh; }
  .photo-editor-settings input[type="text"], .photo-editor-settings input[type="number"], .photo-editor-settings select { font-size: 16px; }
}
