* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #edf3f3;
  color: #15334c;
}
[hidden] {
  display: none !important;
}
.photo-app {
  max-width: 1440px;
  margin: 18px auto;
  padding: 0 18px;
}
.photo-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.photo-title h1 {
  margin: 0;
  font-size: 25px;
  color: #006e68;
}
.photo-title p {
  font-size: 13px;
  margin: 6px 0;
  color: #526674;
}
.photo-app button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: white;
  background: #006e68;
  border: 1px solid #006e68;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 38px;
}
.photo-app button.secondary {
  color: #285048;
  background: #f4f8f7;
  border-color: #c0d3ce;
}
.photo-app button:disabled {
  opacity: 0.45;
  cursor: default;
}
.photo-app :focus-visible {
  outline: 3px solid #dca34f;
  outline-offset: 2px;
}
.photo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.photo-import {
  background: white;
  border: 1px solid #c8d8d4;
  border-radius: 9px;
  padding: 4px 14px;
  margin: 14px 0 0;
}
.privacy-label {
  font-size: 12px;
  color: #526674;
  margin-inline-start: auto;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.photo-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.photo-pending > span {
  display: flex;
  gap: 6px;
  align-items: center;
  background: #edf7f4;
  padding: 4px 8px;
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.photo-pending button {
  padding: 3px 8px;
  min-height: 30px;
}
.photo-status {
  font-size: 13px;
  line-height: 1.5;
  color: #006e68;
  min-height: 26px;
  padding: 5px 0;
}
.photo-status.error {
  color: #a32535;
}
.photo-empty {
  text-align: center;
  background: white;
  border: 1px dashed #a4c5ba;
  border-radius: 10px;
  padding: 60px 14px;
  margin: 12px 0;
}
.photo-empty h2 {
  font-size: 22px;
}
.photo-empty p,
.photo-empty small {
  color: #526674;
}
.photo-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding: 2px;
}
.photo-thumb {
  display: flex;
  align-items: center;
  flex: 0 0 165px;
  position: relative;
  border: 1px solid #becfc9;
  background: white;
  border-radius: 7px;
  padding: 5px;
  gap: 5px;
}
.photo-thumb.active {
  border: 2px solid #006e68;
  background: #e1f1ec;
}
.photo-thumb .thumb-select {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: transparent;
  color: #15334c;
  padding: 0;
  border: 0;
  text-align: start;
}
.photo-thumb img {
  width: 38px;
  height: 48px;
  object-fit: contain;
}
.thumb-title {
  font-size: 11px;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumb-actions {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  width: 34px;
}
.thumb-actions button {
  font-size: 12px;
  min-height: 22px;
  padding: 0 6px;
}
.photo-workgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 365px;
  gap: 12px;
  align-items: start;
}
.photo-preview-panel {
  background: #e3ebe8;
  border: 1px solid #bdcec8;
  border-radius: 10px;
  overflow: hidden;
  position: sticky;
  top: 10px;
}
.preview-toolbar {
  background: white;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.preview-toolbar strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-toolbar button {
  font-size: 11px;
  padding: 4px 9px;
  min-height: 30px;
  white-space: nowrap;
}
.canvas-stage {
  min-height: 340px;
  height: calc(100dvh - 360px);
  max-height: 660px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: repeating-conic-gradient(#d8e1dd 0% 25%, #eef3f1 0% 50%) 50%/18px
    18px;
}
.canvas-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  box-shadow: 0 3px 20px #18352b20;
}
.preview-caption {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 11px;
  padding: 8px 10px;
  background: white;
  min-height: 30px;
  line-height: 1.5;
}
.photo-controls {
  border: 1px solid #bdcec8;
  border-radius: 10px;
  background: white;
  overflow: hidden;
}
.photo-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: #eff5f3;
  border-bottom: 1px solid #d2dfda;
}
.photo-tabs button {
  color: #36514b;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 11px;
  padding: 12px 3px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.photo-tabs button[aria-selected="true"] {
  background: white;
  color: #006e68;
  box-shadow: inset 0 -3px #006e68;
}
.tool-panel {
  padding: 16px;
}
.tool-panel h2 {
  font-size: 17px;
  margin: 0 0 12px;
}
.photo-hint {
  font-size: 12px;
  color: #526674;
  line-height: 1.6;
}
.photo-app
  input:not([type="file"]):not([type="checkbox"]):not([type="range"]):not(
    [type="color"]
  ),
.photo-app select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #b8cdc6;
  border-radius: 5px;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  background: white;
  color: #15334c;
}
.photo-app label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.photo-app select {
  margin: 6px 0 12px;
}
.range-label {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 15px 0;
}
.range-label input {
  width: 100%;
  accent-color: #006e68;
}
.check-label {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 14px 0;
}
.check-label input {
  width: 18px;
  height: 18px;
}
.photo-app details {
  border-top: 1px solid #d5e0db;
  padding-top: 12px;
  margin-top: 14px;
}
.photo-app summary {
  font-size: 12px;
  cursor: pointer;
}
.crop-fields,
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.crop-fields input,
.export-grid input {
  margin-top: 5px;
}
.photo-edit-footer {
  border-top: 1px solid #d5e0db;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.photo-output {
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  margin: 10px 0;
}
.photo-app #photo-background-custom {
  height: 36px;
  width: 100%;
  padding: 2px;
  border: 1px solid #c0d3ce;
}
.photo-app #photo-busy {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
}
.photo-app progress {
  width: 100%;
  height: 12px;
  accent-color: #006e68;
}
@media (max-width: 850px) {
  .photo-workgrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .photo-preview-panel {
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .canvas-stage {
    height: 35dvh;
    min-height: 210px;
    max-height: 360px;
    padding: 8px;
  }
  .photo-controls {
    overflow: visible;
  }
  .photo-tabs {
    position: sticky;
    top: var(--photo-preview-height, calc(35dvh + 75px));
    z-index: 6;
  }
  .photo-tabs button {
    font-size: 11px;
    min-height: 43px;
    white-space: nowrap;
    overflow-wrap: normal;
  }
  .photo-preview-panel .preview-caption {
    padding: 5px 8px;
    min-height: 26px;
  }
  .tool-panel {
    padding: 12px;
  }
  .photo-list {
    margin-bottom: 7px;
  }
  .photo-app {
    padding: 0 9px;
    margin-top: 12px;
  }
  .photo-title h1 {
    font-size: 22px;
  }
  .photo-title > button {
    font-size: 11px;
    padding: 5px 8px;
  }
  .privacy-label {
    display: none;
  }
  .photo-import {
    padding: 2px 8px;
  }
  .photo-status {
    font-size: 12px;
  }
  .photo-thumb {
    flex-basis: 155px;
  }
  .photo-edit-footer {
    position: static;
  }
  .photo-buttons button {
    min-height: 40px;
  }
  .photo-empty {
    padding: 35px 12px;
  }
}

@media (max-width: 850px) and (max-height: 600px) {
  .canvas-stage {
    min-height: 120px;
    height: 30dvh;
    max-height: 200px;
  }
}

.photo-apply-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #d5e0db;
  background: #edf7f3;
  position: sticky;
  bottom: 0;
  z-index: 7;
}
.photo-apply-bar #photo-apply {
  flex: 1;
  font-weight: 700;
}
.photo-apply-bar #photo-revert {
  font-size: 11px;
}
.photo-app #photo-export-toggle {
  margin: 10px 0;
}

.background-swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 12px;
}
.photo-app .background-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  min-width: 0;
  padding: 7px 3px;
  background: #f7faf9;
  color: #234f47;
  border: 1px solid #c1d4cb;
  min-height: 58px;
}
.photo-app .background-swatch[aria-pressed="true"] {
  border: 2px solid #006e68;
  background: #e1f3ea;
}
.swatch-chip {
  display: block;
  width: 27px;
  height: 23px;
  border: 1px solid #9cafaa;
  border-radius: 4px;
}
.swatch-chip.transparent {
  background: repeating-conic-gradient(#ccc 0% 25%, white 0% 50%) 50%/8px 8px;
}
.swatch-chip.custom {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.photo-app #photo-background-custom {
  width: 100%;
  min-height: 38px;
  font: inherit;
  padding: 8px;
  border: 1px solid #b8cdc6;
}
.photo-app #photo-background-custom[aria-invalid="true"] {
  border-color: #a32535;
}

.photo-app .file-picker {
  display: inline-flex;
  align-items: center;
  font:
    600 13px Arial,
    sans-serif;
  color: white;
  background: #006e68;
  border: 1px solid #006e68;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 38px;
}
.photo-app .file-picker.secondary {
  color: #285048;
  background: #f4f8f7;
  border-color: #c0d3ce;
}
.auto-edit-card {
  border: 1px solid #9ccac0;
  border-radius: 9px;
  background: #eff9f5;
  padding: 12px;
  margin-bottom: 18px;
}
.auto-edit-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.auto-edit-card p {
  font-size: 12px;
  line-height: 1.6;
}
.preview-toolbar {
  flex-wrap: wrap;
}
#photo-auto-quick {
  padding: 6px 9px;
  font-size: 12px;
}

.native-photo-picker {
  position: static;
  width: min(100%, 300px);
  min-height: 44px;
  font-size: 13px;
  color: #15334c;
  border: 1px solid #adcac3;
  border-radius: 6px;
  padding: 5px;
  background: white;
}
.native-photo-picker::file-selector-button {
  background: #006e68;
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
}
#panel-save > .export-grid > p.small {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.5;
}

.photo-buttons .picker-caption {
  font-size: 13px;
  font-weight: 600;
  color: #285048;
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
}

.photo-camera-control {
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  .photo-camera-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
  }
}

@media (hover: none) and (pointer: coarse) {
  .desktop-webcam {
    display: none;
  }
}
#photo-webcam-dialog {
  width: min(640px, 94vw);
  max-height: 90dvh;
  overflow: auto;
  border: 1px solid #83ada5;
  border-radius: 12px;
  color: #15334c;
  padding: 18px;
}
#photo-webcam-dialog::backdrop {
  background: #102a3c99;
}
#photo-webcam-video {
  display: block;
  width: 100%;
  max-height: 60dvh;
  background: #122c36;
  object-fit: contain;
}
#photo-webcam-dialog button {
  background: #006e68;
  color: white;
  border: 0;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 6px;
  cursor: pointer;
}
#photo-webcam-dialog button:disabled {
  opacity: 0.45;
}

.canvas-stage.detail-zoom {
  display: block;
  overflow: auto;
  height: 360px;
  max-height: 45dvh;
}
.canvas-stage.detail-zoom canvas {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  display: block;
  margin: 0;
}

@media (max-width: 850px) {
  html {
    scroll-padding-top: calc(var(--photo-preview-height, 340px) + 54px);
    scroll-padding-bottom: 90px;
  }
  .photo-controls button,
  .photo-controls select,
  .photo-controls input {
    scroll-margin-top: 12px;
    scroll-margin-bottom: 12px;
  }
  .canvas-stage {
    height: 28dvh;
    min-height: 160px;
  }
  .canvas-stage.detail-zoom {
    height: 28dvh;
  }
}

#photo-review:not([hidden]) { display:flex; align-items:center; gap:8px; padding:8px; background:#eef8f6; font-size:12px; }
#photo-review input { flex:1; min-width:50px; width:100px; }
#photo-review button { padding:6px; font-size:12px; }

.photo-hub-back{display:inline-block;margin-bottom:18px;color:#007d74;font-size:14px;font-weight:700;text-decoration:none}
