dialog.photo-markup-dialog{width:min(760px,calc(100vw - 16px));max-height:calc(100dvh - 16px);padding:0;border:1px solid var(--line);border-radius:16px;background:var(--card,#fff);color:var(--ink);overflow:auto}
.photo-markup-dialog::backdrop{background:rgba(9,24,38,.72)}
.photo-markup-head{display:flex;align-items:start;gap:12px;padding:16px;border-bottom:1px solid var(--line)}
.photo-markup-head>div{flex:1;min-width:0}.photo-markup-head h2{font-size:19px;line-height:1.3;letter-spacing:0;text-transform:none;margin:0;color:var(--navy)}
.photo-markup-head p{font-size:12px;line-height:1.45;color:var(--mut);margin:5px 0 0}
.photo-markup-dialog .btn{margin:0;min-height:44px}.photo-markup-body{padding:12px 16px}
.photo-markup-stage{display:flex;justify-content:center;background:#152331;border-radius:8px;overflow:hidden}
.photo-markup-stage canvas{display:block;max-width:100%;width:auto;height:auto;max-height:48dvh;object-fit:contain;touch-action:none;cursor:crosshair}
.photo-markup-comment{display:grid;gap:6px;margin-top:14px;font-size:13px;font-weight:700}.photo-markup-comment textarea{width:100%;min-height:85px;resize:vertical;font-weight:400}
.photo-markup-comment[hidden]{display:none}.photo-markup-comment textarea{font-size:16px}
.photo-review-stage canvas{touch-action:pan-y;cursor:default;max-height:52dvh}
.photo-review-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:10px}
.photo-review-actions .btn{min-width:0;padding-left:6px;padding-right:6px}
.photo-markup-error{color:var(--bad);font-size:13px;margin:8px 0 0}.photo-markup-error:empty{display:none}
.photo-markup-footer{padding:12px 16px;position:sticky;bottom:0;background:var(--card,#fff);border-top:1px solid var(--line)}.photo-markup-footer .btn{width:100%}
.job-photo-edit{margin-top:4px!important;min-height:44px!important}.job-photo-comment{font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere;margin:2px 0;color:var(--ink)}
.job-photo-copy-note{font-size:11px;color:var(--mut)}
html[data-theme="dark"] .photo-markup-footer .btn:not(.sub){background:#9cc8ff;color:#102033;border-color:#9cc8ff}
html[data-theme="dark"] .job-photo-card label.f{color:var(--mut)}
html[data-theme="dark"] .job-photo-card .seg{background:var(--bg);border-color:var(--line)}
html[data-theme="dark"] .job-photo-card .btn:not(.sub){background:#9cc8ff;color:#102033;border-color:#9cc8ff}

/* Keep the photo and the controls on separate layers of the work surface. */
dialog.ls-markup-editor {
  --editor-paper: #fff;
  --editor-work: #f5f6f8;
  --editor-grid: #33394a0b;
  --editor-ink: #20212a;
  --editor-muted: #5e6371;
  --editor-line: #dadce3;
  --editor-dock: #202027;
  --editor-blue: #3786ed;
  box-sizing: border-box; width: min(880px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: hidden;
  border: 1px solid var(--editor-line); border-radius: 16px;
  background: var(--editor-paper); color: var(--editor-ink); font-family: inherit;
  box-shadow: 0 20px 80px #11172538;
}
dialog.ls-markup-editor[open] { display: flex; flex-direction: column; }
dialog.ls-markup-editor::backdrop { background: #11152583; backdrop-filter: blur(4px); }
.ls-markup-editor *, .ls-markup-editor *::before, .ls-markup-editor *::after { box-sizing: border-box; }
.ls-markup-editor svg { display: block; flex: none; width: 20px; height: 20px; }
.ls-markup-editor button { color: inherit; font: inherit; cursor: pointer; }
.ls-markup-editor button:focus-visible, .ls-markup-editor textarea:focus-visible {
  outline: 3px solid #408ef5; outline-offset: 2px;
}
.markup-head, .markup-footer {
  display: flex; align-items: center; flex: none; gap: 12px; padding: 12px 22px;
  background: var(--editor-paper);
}
.markup-head { border-bottom: 1px solid var(--editor-line); }
.markup-title { flex: 1; min-width: 0; }
.ls-markup-editor .markup-title h2 {
  margin: 0; padding: 0; background: none; color: var(--editor-ink);
  font: inherit; font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -.035em; text-transform: none;
}
.markup-title h2:focus { outline: none; }
.markup-title p {
  display: flex; align-items: baseline; min-width: 0; margin: 4px 0 0; color: var(--editor-muted);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.markup-title [data-photo-name] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.markup-resolution { flex: none; white-space: nowrap; }
.markup-title [data-photo-name]:not([hidden]) + .markup-resolution::before { content: '·'; margin-inline: 7px; }
.ls-markup-editor .markup-close, .ls-markup-editor .markup-visibility {
  display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 5px;
  width: auto; min-width: 44px; min-height: 44px; margin: 0; padding: 0 10px; box-shadow: none;
  border: 0; border-radius: 8px; background: transparent; color: var(--editor-muted);
  font-size: 14px; font-weight: 650;
}
.ls-markup-editor .markup-visibility { display: none; }
.ls-markup-editor .markup-close:hover, .ls-markup-editor .markup-visibility:hover { background: var(--editor-work); }
.markup-layout { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.markup-view {
  display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 16px 18px;
  background-color: var(--editor-work);
  background-image: linear-gradient(to right, var(--editor-grid) 1px, transparent 1px),
                    linear-gradient(to bottom, var(--editor-grid) 1px, transparent 1px);
  background-size: 24px 24px; background-position: center;
}
.ls-markup-editor .markup-stage {
  display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%; height: clamp(170px, 51dvh, 540px); overflow: visible; border-radius: 0; background: transparent;
}
.ls-markup-editor .markup-stage canvas {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
  box-shadow: 0 0 0 1px #10132024, 0 2px 6px #1013201a;
}
.markup-dock {
  display: flex; position: relative; flex: none; align-items: stretch;
  background: var(--editor-dock); color: #fff; border-radius: 12px;
  box-shadow: 0 2px 4px #11121b20, 0 8px 18px #11121b24;
}
.markup-dock > button, .markup-dock-end > button {
  display: inline-flex; justify-content: center; align-items: center; gap: 5px;
  width: clamp(50px, 7vw, 65px); height: 52px; margin: 0; padding: 0;
  color: #fff; background: transparent; border: 0; border-radius: 0;
}
.markup-dock > button svg, .markup-dock-end > button svg { width: 24px; height: 24px; stroke-width: 1.9; }
.markup-dock-end { display: flex; }
.markup-dock-end:first-child > button { border-radius: 12px 0 0 12px; }
.markup-dock-end:last-child > button { border-radius: 0 12px 12px 0; }
.markup-dock > button[aria-pressed=true] { background: var(--editor-blue); }
.markup-dock-end > button[aria-expanded=true] { background: #41414d; }
@media (hover: hover) {
  .markup-dock > button[aria-pressed=false]:hover, .markup-dock-end > button:hover { background: #3a3a45; }
}
.ls-markup-editor .markup-dock button:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.markup-shape { position: relative; }
.markup-shape > button[aria-pressed=true] { background: var(--editor-blue); }
.markup-shape .markup-popover { left: 50%; transform: translateX(-50%); min-width: 152px; }
.markup-options [data-shape][aria-pressed=true] { background: #294567; }
.markup-popover {
  position: absolute; bottom: calc(100% + 7px); z-index: 2; padding: 5px; border-radius: 10px;
  background: var(--editor-dock); color: #fff; border: 1px solid #464650; box-shadow: 0 6px 20px #13152233;
}
.markup-popover[hidden], .markup-caption[hidden] { display: none; }
.markup-history { left: 0; min-width: 154px; }
.markup-options button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 14px; text-align: left;
}
.markup-options button:hover:enabled { background: #41414d; }
.markup-options button:disabled { color: #aaaab4; cursor: default; }
.markup-options svg { width: 17px; height: 17px; }
.markup-palette { display: flex; align-items: center; }
.markup-swatches { display: flex; align-items: center; padding-inline: 5px; border-left: 1px solid #ffffff30; }
.markup-swatches > button, .markup-primes > button {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; cursor: pointer;
}
.markup-dock button { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.markup-primes { display: flex; right: 0; }
.markup-swatches [data-toggle="colours"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 48px;
}
.markup-swatches [data-toggle="colours"] > svg { width: 12px; height: 12px; color: #fff; stroke-width: 2.4; }
.markup-swatches [data-toggle="colours"][aria-expanded=true] { background: #41414d; }
.markup-shades { right: 0; width: min(238px, 100%); padding: 10px; }
.markup-shades strong { display: block; padding: 0 5px; font-size: 13px; }
.markup-tones { display: flex; }
.markup-tones button { flex: 1; height: 44px; padding: 0; border: 0; background: transparent; }
.markup-tones button::before { content: ''; display: inline-block; width: 23px; height: 23px; background: var(--swatch); border: 1px solid #ffffff60; border-radius: 50%; }
.markup-tones button[aria-pressed=true]::before { outline: 1px solid white; outline-offset: 2px; }
.markup-shades label { position: relative; display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 6px; font-size: 13px; cursor: pointer; }
.markup-shades input { width: 42px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.markup-crop-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; padding: 5px 8px; background: var(--editor-dock); color: white; border-radius: 9px; }
.markup-crop-actions span { padding: 0 6px; font-size: 12px; }
.markup-crop-actions button { min-height: 44px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: #fff; font-size: 13px; }
.markup-crop-actions [data-crop-apply] { background: #2367be; }
.markup-dock[hidden], .markup-crop-actions[hidden] { display: none; }
.markup-swatches [data-prime] span, .markup-swatches [data-toggle="colours"] span {
  display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%;
  background: var(--swatch); border: 1px solid #ffffff55;
}
.markup-swatches button[aria-pressed=true] span { outline: 1px solid #fff; outline-offset: 3px; }
.markup-primes svg { width: 14px; height: 14px; stroke-width: 3; visibility: hidden; color: #fff; }
.markup-primes button[aria-pressed=true] svg { visibility: visible; }
.markup-swatches [data-colour="#ffd400"] svg, .markup-swatches [data-colour="#18aa69"] svg { color: #202027; }
.markup-caption {
  display: flex; align-items: center; gap: 15px; margin: 0; padding: 8px 22px;
  border-top: 1px solid var(--editor-line); color: var(--editor-ink); font-size: 13px; font-weight: 650;
}
.ls-markup-editor .markup-caption textarea {
  flex: 1; display: block; min-width: 0; width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; resize: vertical;
  background: var(--editor-paper); color: var(--editor-ink); border: 1px solid var(--editor-line);
  border-radius: 6px; box-shadow: none; font: inherit; font-size: 16px; font-weight: 400; line-height: 1.4;
}
.markup-caption textarea::placeholder { color: var(--editor-muted); }
.ls-markup-editor .photo-markup-error:not(:empty) { margin: 8px 22px; }
.markup-footer { justify-content: space-between; border-top: 1px solid var(--editor-line); }
.markup-copy { display: inline-flex; align-items: center; gap: 7px; color: var(--editor-muted); font-size: 12px; }
.markup-copy svg { width: 15px; height: 15px; }
.ls-markup-editor .markup-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 8px;
  background: #215eb8; color: #fff; font-size: 14px; font-weight: 650;
}
.markup-save:hover { background: #194d9b; }
.markup-save svg { width: 16px; height: 16px; }
html[data-theme=dark] dialog.ls-markup-editor {
  --editor-paper: #23252c; --editor-work: #30323b; --editor-grid: #ffffff09;
  --editor-ink: #fafaff; --editor-muted: #c0c3d0; --editor-line: #484b56; --editor-dock: #1f1f26;
}
html[data-theme=dark] .markup-dock { outline: 1px solid #555560; }
@media (max-width: 680px) {
  dialog.ls-markup-editor {
    width: calc(100vw - 12px); max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - env(safe-area-inset-bottom));
    border-radius: 12px;
  }
  .markup-head, .markup-footer { gap: 6px; padding: 9px 12px; }
  .ls-markup-editor .markup-title h2 { font-size: 18px; }
  .markup-view { padding: 14px 10px; gap: 14px; }
  .markup-dock > button, .markup-dock-end > button { height: 48px; }
  .markup-caption { padding: 8px 12px; gap: 10px; }
}
@media (max-height: 520px) {
  dialog.ls-markup-editor { max-height: calc(100dvh - 8px); }
  .markup-head, .markup-footer { padding-block: 5px; }
  .markup-view { gap: 9px; padding-block: 10px; }
  .ls-markup-editor .markup-stage { height: max(125px, calc(100dvh - 265px)); }
  .markup-dock > button, .markup-dock-end > button { height: 44px; }
}

.markup-background {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-height: 44px;
  margin: 0; padding: 0 9px; border: 1px solid var(--editor-line, var(--line, #d8dce3)); border-radius: 8px;
  background: var(--editor-paper, var(--card, #fff)); color: var(--editor-ink, var(--ink, #252735)); cursor: pointer;
}
.markup-background svg { width: 18px; height: 18px; flex: none; }
.markup-background span { font-size: 12px; font-weight: 600; }
.markup-background[aria-pressed=true] { color: #2164be; border-color: #82a9db; }
.markup-background[aria-busy=true] { opacity: .6; cursor: progress; }
@media (max-width: 530px) {
  .markup-title p { flex-wrap: wrap; }
  .markup-title [data-photo-name]:not([hidden]) + .markup-resolution::before { content: none; }
  .markup-title .markup-resolution { flex-basis: 100%; }
  .jg-foot .markup-background span, .docbar .markup-background span, .photo-markup-head .markup-background span { display: none; }
}

.lic-photo-head { display: flex; align-items: center; gap: 6px; }
.lic-photo-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 530px) { .lic-photo-head .markup-background span { display: none; } }

@media (max-height: 520px) { .markup-shape .markup-popover { min-width: 220px; display: grid; grid-template-columns: 1fr 1fr; } .markup-shape .markup-popover[hidden] { display: none; } }

/* Cutout corrections share the markup dock's position and touch targets. */
.markup-dock:has([data-refine]:not([hidden])) { flex-wrap: wrap; }
.markup-dock > [data-refine] {
  width: 100%; height: 44px; flex-basis: 100%; grid-column: 1 / -1; gap: 8px;
  border-top: 1px solid #ffffff30; border-radius: 0 0 12px 12px; font-size: 13px; font-weight: 600;
}
.markup-dock > [data-refine] svg { width: 17px; height: 17px; }
.markup-brush-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px;
  max-width: 100%; padding: 5px; border-radius: 12px; color: #fff; background: var(--editor-dock);
  box-shadow: 0 4px 14px #11121b24;
}
.markup-brush-tools button {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-width: 44px; height: 44px;
  border: 0; border-radius: 7px; padding: 0 9px; background: transparent; color: #fff; font-size: 13px; font-weight: 600;
}
.markup-brush-tools svg { width: 17px; height: 17px; }
.markup-brush-tools button[aria-pressed=true] { background: #2565ba; }
.markup-brush-tools button:disabled { opacity: .4; }
.markup-brush-actions, .markup-brush-modes, .markup-brush-size { display: flex; align-items: center; }
.markup-brush-size { gap: 6px; padding-inline: 8px; font-size: 12px; }
.markup-brush-size input { width: 82px; min-height: 44px; margin: 0; accent-color: #6aabff; }
.markup-brush-size output { min-width: 5ch; text-align: right; font-variant-numeric: tabular-nums; }
.markup-brush-tools [data-brush-done] { background: #41414d; }
.ls-markup-editor [data-refine][hidden], .markup-brush-tools[hidden], .markup-brush-tools button[hidden] { display: none; }
.markup-gesture-hint { color: var(--editor-muted); font-size: 12px; line-height: 1.3; margin-top: -6px; }

.ls-markup-editor .markup-stage { position: relative; touch-action: none; }
.ls-markup-editor .markup-endpoint {
  position: absolute; transform: translate(-50%,-50%); display: grid; place-items: center;
  width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; box-shadow: none; cursor: grab; touch-action: none;
}
.ls-markup-editor .markup-endpoint[hidden] { display: none; }
.markup-endpoint::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: #fff;
  border: 2px solid #1765bb; box-shadow: 0 0 0 1px #fff, 0 1px 3px #0009;
}
.markup-endpoint:active { cursor: grabbing; }
.ls-markup-editor .markup-dock > .markup-photo-ai {
  flex: none; gap: 3px; color: #d0e4ff; background: transparent; border: 0; box-shadow: none;
  font: 650 13px/1 system-ui, sans-serif; letter-spacing: normal;
}
.ls-markup-editor .markup-photo-ai svg { width: 17px; height: 17px; margin: 0; }
.ls-markup-editor .markup-photo-ai:hover { background: #3a3a45; }
.markup-dock > [aria-busy=true] { opacity: .6; cursor: progress; }
.ls-markup-editor [data-view-fit] {
  min-width: 50px; min-height: 44px; padding: 0 5px; color: #fff; background: transparent; border: 0; border-radius: 7px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.ls-markup-editor [data-view-fit]:disabled { color: #aaaab4; opacity: 1; cursor: default; }
.markup-gesture-hint { text-align: center; }
/* Allocate one column per visible tool, including the optional AI and cutout buttons. */
@media (max-width: 680px), (max-height: 520px) and (max-width: 950px) {
  .ls-markup-editor .markup-visibility { display: inline-flex; }
  .markup-view {
    display: grid; grid-template-columns: minmax(0,1fr); justify-items: center;
    row-gap: 8px; padding: 0 0 10px;
  }
  .ls-markup-editor .markup-stage {
    grid-area: 1 / 1; height: auto; min-height: 252px;
    grid-template-rows: auto; align-items: end;
  }
  .ls-markup-editor .markup-stage canvas {
    max-height: max(175px, calc(100dvh - 205px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  }
  .markup-view > :is(.markup-dock, .markup-brush-tools, .markup-crop-actions) {
    grid-area: 1 / 1; align-self: end; z-index: 1; margin-bottom: 8px;
    max-width: calc(100% - 16px);
    box-shadow: 0 0 0 1px #ffffff30, 0 4px 12px #10132050;
  }
  .ls-markup-editor[data-tools-hidden] .markup-view > :is(.markup-dock, .markup-brush-tools, .markup-crop-actions) {
    display: none;
  }
  .markup-gesture-hint { grid-area: 2 / 1; margin: 0; padding-inline: 8px; }
  .markup-dock:not([hidden]) {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr);
    width: min(100%, 460px); align-items: center;
  }
  .markup-dock .markup-palette { display: contents; }
  .markup-dock .markup-swatches { min-width: 0; padding: 0; border: 0; }
  .markup-dock > button, .markup-dock-end > button, .markup-dock [data-toggle="colours"],
  .ls-markup-editor .markup-dock [data-view-fit] {
    width: 100%; min-width: 0; height: 48px; padding: 0;
  }
  .markup-dock > [data-refine] {
    grid-column: auto; border: 0; border-radius: 0 12px 12px 0;
  }
  .markup-dock > [data-refine] span { display: none; }
  .markup-dock > [data-refine] svg { width: 22px; height: 22px; }
  .markup-shape { position: static; }
  .markup-shape .markup-popover { left: 0; transform: none; }
  .markup-brush-tools:not([hidden]) {
    flex-wrap: nowrap; width: min(100%, 470px); gap: 2px; padding: 3px;
  }
  .markup-brush-size { flex: 1; min-width: 0; gap: 4px; padding-inline: 4px; }
  .markup-brush-size input { flex: 1; width: 0; min-width: 0; }
}
@media (max-height: 520px) and (max-width: 950px) {
  .ls-markup-editor .markup-stage { min-height: 205px; }
}
@media (max-width: 460px) {
  .markup-brush-modes button span { display: none; }
  .markup-brush-size {
    display: grid; grid-template-columns: auto auto; grid-template-rows: 14px 1fr;
    align-content: center; justify-content: stretch; column-gap: 2px; row-gap: 0; height: 44px;
  }
  .markup-brush-size span { font-size: 11px; }
  .markup-brush-size output { grid-column: 2; grid-row: 1; min-width: 0; font-size: 11px; text-align: right; }
  .markup-brush-size input { grid-column: 1 / -1; width: 100%; min-height: 0; height: 100%; }
  .ls-markup-editor .markup-brush-actions [data-view-fit] { min-width: 44px; padding-inline: 3px; }
  .markup-crop-actions { flex-wrap: nowrap; gap: 2px; padding: 3px; }
  .markup-crop-actions button { padding-inline: 6px; }
}
@media (max-width: 390px) {
  .markup-dock [data-toggle="colours"] { gap: 2px; }
  .markup-dock [data-toggle="colours"] span { width: 20px; height: 20px; }
  .markup-dock [data-toggle="colours"] svg { width: 9px; }
  .ls-markup-editor .markup-dock [data-view-fit] { font-size: 10px; }
}
