.photo-viewer-tools { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; border-top: 1px solid var(--line); padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: var(--surface); }
.photo-viewer-tools .icon-button, .photo-dialog .icon-button { width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 8px; border-radius: 4px; flex: 0 0 auto; }
.photo-viewer-tools .icon { width: 20px; height: 20px; }
.photo-album-count { flex: 0 0 48px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.photo-status { margin: 0; min-width: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.photo-viewer-tools > .photo-status:empty { display: none; }
.photo-viewer-tools > .photo-status:not(:empty) { width: 100%; text-align: center; }
.photo-actions-menu { position: static; }
.photo-actions-menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; }
.photo-actions-menu summary::-webkit-details-marker { display: none; }
.photo-actions-items { position: absolute; right: 12px; bottom: calc(100% + 8px); z-index: 5; width: 224px; max-width: calc(100vw - 24px); padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 4px 16px #0002; }
.photo-actions-items .photo-command { display: flex; width: 100%; height: auto; min-height: 44px; gap: 10px; text-align: left; justify-content: flex-start; white-space: normal; }
.photo-dialog { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: min(1100px, calc(100vw - 32px)); max-width: 100vw; max-height: 100dvh; }
.photo-dialog[open] { display: flex; flex-direction: column; animation: none; }
.photo-dialog::backdrop { background: #111b18cc; }
.photo-dialog-head { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin: 0; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.photo-dialog h2 { flex: 1; margin: 0; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.photo-dialog-footer { display: flex; flex-shrink: 0; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border-top: 1px solid var(--line); }
.photo-dialog-footer .photo-status { flex: 1; }
.photo-command { display: inline-flex; align-items: center; gap: 8px; width: auto !important; white-space: nowrap; font-size: 13px; }
.photo-command .icon { width: 18px; height: 18px; flex-shrink: 0; }
.photo-error { margin: 0; padding: 8px 12px; flex-shrink: 0; color: #b72828; font-size: 13px; overflow-wrap: anywhere; }
.photo-editor { height: min(820px, calc(100dvh - 32px)); }
.photo-editor-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.photo-editor-tools [aria-pressed=true] { background: var(--accent, #207b5b); color: #fff; }
.photo-editor-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 260px; flex: 1; min-height: 0; min-width: 0; }
.photo-editor-stage { display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; min-height: 0; background: #232726; }
.photo-editor-stage canvas { display: block; max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; }
.photo-editor-panel { padding: 12px; overflow: auto; border-left: 1px solid var(--line); font-size: 13px; min-width: 0; }
.photo-slider { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: center; gap: 6px; margin: 12px 0; }
.photo-slider > span { grid-column: 1 / -1; }
.photo-slider input { min-width: 0; width: 100%; padding: 0; accent-color: var(--accent, #207b5b); }
.photo-slider output { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.photo-check { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.photo-check input { width: auto; }
.photo-adjustments summary { cursor: pointer; font-weight: 600; }
.photo-swatches { display: flex; gap: 8px; margin: 16px 0 12px; flex-wrap: wrap; }
.photo-swatch { width: 26px; height: 26px; min-width: 26px; padding: 0; border: 1px solid #88928c; border-radius: 50%; background: var(--swatch); }
.photo-swatch[aria-pressed=true] { outline: 2px solid var(--ink); outline-offset: 2px; }
.photo-mark-controls > input[type=color] { width: 40px; height: 32px; padding: 2px; }
.photo-text-controls input { width: 100%; min-width: 0; }
.photo-crop-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0; border: 0; margin: 12px 0 0; }
.photo-crop-controls label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-crop-controls input { width: 100%; min-width: 0; }
.photo-crop-controls .photo-command { grid-column: 1 / -1; justify-self: end; }
.photo-recognition { width: min(640px, calc(100vw - 24px)); height: min(620px, calc(100dvh - 24px)); }
.photo-recognition textarea { flex: 1; min-height: 80px; width: auto; resize: none; margin: 12px; overflow: auto; white-space: pre-wrap; }
.photo-dialog :focus-visible, .photo-viewer-tools :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (min-width: 601px) { .file-window .photo-viewer-tools .icon-button { width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 7px; } }
@media (max-width: 600px), (pointer: coarse) {
  .photo-viewer-tools .icon-button, .file-window .photo-viewer-tools .icon-button, .photo-dialog .icon-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 12px; }
  .photo-actions-items .photo-command { padding: 10px; }
  .photo-swatch { width: 44px; height: 44px; min-width: 44px; }
  .photo-slider input, .photo-crop-controls input, .photo-text-controls input { min-height: 44px; }
  .photo-check { min-height: 44px; }
  .photo-mark-controls > input[type=color] { width: 44px; height: 44px; }
}
@media (max-width: 600px) {
  .file-window .file-viewer-head { flex-wrap: wrap; }
  .file-window .file-viewer-head h2 { flex-basis: 100%; }
  .photo-dialog { width: 100vw; height: 100dvh; margin: 0; max-width: 100vw; max-height: 100dvh; border-radius: 0; border: 0; }
  .photo-editor-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(100px, 1fr) auto; }
  .photo-editor-panel { border-left: 0; border-top: 1px solid var(--line); max-height: 32dvh; padding: 8px 12px; }
  .photo-editor-tools { padding: 4px 8px; justify-content: center; }
  .photo-dialog-footer { flex-wrap: wrap; gap: 4px; }
  .photo-dialog-footer .photo-status:not(:empty) { flex-basis: 100%; }
  .photo-dialog-footer .photo-status:empty { display: none; }
  .photo-viewer-tools { gap: 4px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
}
@media print { .photo-viewer-tools, .photo-dialog { display: none !important; } }
