.auth-gate { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(244, 247, 252, .97); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(420px, 100%); padding: 28px; border: 1px solid #d9e1ed; border-radius: 20px; background: #fff; box-shadow: 0 24px 70px rgba(24, 48, 83, .16); }
.auth-card h2 { margin: 5px 0 8px; color: #1c3f7b; }
.auth-card p { margin: 0 0 18px; color: #697586; }
.auth-card label { display: grid; gap: 7px; margin: 13px 0; color: #27364a; font-size: 13px; font-weight: 700; }
.auth-card input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfd7e4; border-radius: 10px; font: inherit; }
.auth-card [hidden] { display: none; }
.auth-card button { width: 100%; min-height: 44px; margin-top: 8px; }
.auth-error { min-height: 22px; margin: 10px 0 0 !important; color: #a23c3c !important; font-size: 13px; }
.auth-user { display: flex; align-items: center; gap: 8px; color: #506075; font-size: 12px; }
.auth-logout { padding: 7px 10px; border: 1px solid #d7deea; border-radius: 999px; color: #1c3f7b; background: #fff; cursor: pointer; font: inherit; font-weight: 700; }
body.auth-locked > :not(.auth-gate):not(script) { visibility: hidden; }
.ai-privacy-dialog, .ai-privacy-dialog * { box-sizing: border-box; }
.ai-privacy-dialog { width: min(1000px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; color: #1e2c3e; background: #f7f9fc; box-shadow: 0 24px 80px rgba(16, 35, 65, .3); }
.ai-privacy-dialog::backdrop { background: rgba(15, 28, 48, .72); }
.ai-privacy-card { display: grid; gap: 12px; padding: 22px; }
.ai-privacy-card > header, .ai-privacy-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-privacy-card h2 { margin: 3px 0; color: #1c3f7b; }
.ai-privacy-card p { margin: 0; line-height: 1.5; }
.ai-privacy-filename, .ai-payload-meta { color: #59687b; font-size: 12px; overflow-wrap: anywhere; }
.ai-privacy-canvas-wrap { display: grid; place-items: center; max-height: 58vh; overflow: auto; border: 1px solid #ccd5e2; border-radius: 12px; background: repeating-conic-gradient(#edf0f5 0% 25%, white 0% 50%) 50% / 18px 18px; touch-action: none; }
.ai-privacy-canvas { display: block; max-width: 100%; max-height: 58vh; object-fit: contain; cursor: crosshair; touch-action: none; }
.ai-privacy-tools { display: flex; align-items: center; gap: 12px; color: #647286; font-size: 12px; }
.ai-privacy-tools button[aria-pressed="true"] { border-color: #1f805d; color: #126447; background: #e9f7f1; }
.ai-crop-units { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; border: 1px solid #d5deeb; border-radius: 10px; background: #fff; }
.ai-crop-units > strong { width: 100%; color: #33445c; font-size: 13px; }
.ai-crop-units label { display: inline-flex; align-items: center; gap: 6px; color: #45556a; font-size: 13px; }
.ai-crop-units input { width: 16px; height: 16px; }
.single-identity-bind { flex-wrap: wrap; padding: 10px; border: 1px solid #d8e1ed; border-radius: 10px; background: #f8fafc; }
.single-identity-bind label { display: grid; gap: 6px; font-size: 12px; }
.single-identity-bind select { min-width: 220px; }
.ai-privacy-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 10px; background: #eaf1fc; line-height: 1.45; }
.ai-privacy-check input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; }
.ai-privacy-card footer { justify-content: flex-end; }
.ai-payload-prompt { max-height: 28vh; overflow: auto; padding: 12px; border: 1px solid #d5deeb; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; background: white; font: 12px/1.5 ui-monospace, Consolas, monospace; }
.ai-payload-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; max-height: 38vh; overflow: auto; }
.ai-payload-images figure { margin: 0; padding: 8px; border: 1px solid #d5deeb; border-radius: 10px; background: white; }
.ai-payload-images img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #f0f2f6; }
.ai-payload-images figcaption { padding-top: 6px; color: #59687b; font-size: 11px; }
.ai-payload-final { max-height: calc(100vh - 24px); overflow: auto; }
.batch-ai-review-dialog { width: min(1280px, calc(100vw - 20px)); height: min(94dvh, 1080px); max-height: calc(100dvh - 20px); overflow: hidden; }
.batch-ai-review-card { height: 100%; min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; overflow: hidden; }
.batch-ai-review-card > header > div { min-width: 0; }
.batch-ai-template-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #d7e1ef; border-radius: 10px; background: #eef4ff; color: #28456d; }
.batch-ai-review-list { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 12px; padding: 2px; }
.batch-ai-review-item { display: grid; gap: 10px; padding: 12px; border: 1px solid #d5deeb; border-radius: 12px; background: #fff; }
.batch-ai-review-item > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.batch-ai-review-item > header > div { display: grid; gap: 4px; min-width: 0; }
.batch-ai-review-item small { color: #637287; overflow-wrap: anywhere; }
.batch-ai-warning { color: #8b4b0e; }
.batch-ai-normal { color: #47705d; }
.batch-inline-editor { display: grid; gap: 10px; padding: 10px; border: 1px solid #d5deeb; border-radius: 10px; background: #f7f9fc; }
.batch-inline-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.batch-inline-tools label { display: grid; gap: 4px; color: #45556a; font-size: 12px; font-weight: 700; }
.batch-inline-tools select { min-height: 38px; max-width: 220px; padding: 6px 9px; border: 1px solid #cfd7e4; border-radius: 8px; background: #fff; font: inherit; }
.batch-inline-tools button[aria-pressed="true"] { border-color: #1f805d; color: #126447; background: #e9f7f1; }
.batch-inline-canvas-wrap { display: grid; place-items: center; max-height: 50vh; overflow: auto; border: 1px solid #ccd5e2; border-radius: 10px; background: repeating-conic-gradient(#edf0f5 0% 25%, white 0% 50%) 50% / 18px 18px; touch-action: none; }
.batch-inline-canvas { display: block; max-width: 100%; max-height: 48vh; object-fit: contain; cursor: crosshair; touch-action: none; }
.batch-inline-canvas[data-mode="group-move"] { cursor: move; }
.batch-inline-canvas[data-mode="group-scale"] { cursor: nwse-resize; }
.batch-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.batch-inline-status { color: #59687b; font-size: 12px; }
.batch-ai-outbound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.batch-ai-outbound-image { min-width: 0; margin: 0; padding: 7px; border: 1px solid #d7deea; border-radius: 9px; background: #f7f9fc; }
.privacy-zoom-trigger { display: grid; place-items: center; width: 100%; min-height: 180px; padding: 0; border: 0; border-radius: 6px; background: #e9edf3; cursor: zoom-in; }
.privacy-zoom-trigger img { display: block; width: 100%; max-width: 100%; max-height: min(54vh, 560px); object-fit: contain; }
.batch-ai-outbound-image figcaption { min-width: 0; max-width: 100%; padding-top: 6px; color: #59687b; font-size: 11px; overflow-wrap: anywhere; word-break: break-all; }
.batch-ai-image-review-state { display: block; padding: 6px 2px 1px; font-size: 12px; }
.batch-ai-image-review-state.is-reviewed { color: #126447; }
.batch-ai-image-review-state.is-pending { color: #8b4f08; }
.quick-anonymous-option { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #cbd9ee; border-radius: 9px; background: #f4f8ff; color: #203a60; font-weight: 700; }
.quick-anonymous-option input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; }
.quick-photo-grouping { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid #d6e0ef; border-radius: 10px; background: #f8faff; }
.quick-photo-grouping legend { padding: 0 4px; color: #28456d; font-weight: 800; }
.quick-photo-grouping label { display: flex; align-items: flex-start; gap: 9px; min-width: 0; line-height: 1.45; }
.quick-photo-grouping input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; }
.quick-photo-grouping small { color: #59687b; line-height: 1.45; }
.quick-anonymous-note { margin: -8px 0 0; color: #59687b; font-size: 12px; }
.quick-anonymous-results { display: grid; gap: 10px; min-width: 0; }
.quick-anonymous-results { scroll-margin: 16px 0 calc(100px + env(safe-area-inset-bottom)); }
.quick-anonymous-results > header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: #28456d; }
.quick-anonymous-results > header span { color: #59687b; }
.quick-anonymous-results ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.quick-anonymous-result-item { min-width: 0; padding: 11px 12px; border: 1px solid #d8e1ef; border-radius: 10px; background: #fff; }
.quick-anonymous-result-item > div { display: flex; justify-content: space-between; gap: 10px; }
.quick-anonymous-result-item > p { margin: 6px 0 0; overflow-wrap: anywhere; color: #243c61; font-weight: 700; }
.quick-anonymous-result-item > small { display: block; margin-top: 5px; color: #59687b; }
.quick-anonymous-result-item.is-failed, .quick-anonymous-result-item.is-uncertain { border-color: #e7b9b9; background: #fff8f8; }
.quick-anonymous-current { margin: 0; padding: 9px 11px; border-radius: 9px; background: #eef4ff; color: #28456d; }
.privacy-fingerprint { color: #718096; font-size: 11px; }
.privacy-zoom-dialog { position: fixed; inset: 2vh 2vw; width: 96vw; height: 96vh; max-width: none; max-height: none; padding: 36px 12px 12px; border: 0; border-radius: 14px; background: #f6f8fc; }
.privacy-zoom-dialog::backdrop { background: rgba(15, 28, 48, .84); }
.privacy-zoom-dialog img { display: block; width: 100%; height: calc(100% - 26px); object-fit: contain; }
.privacy-zoom-dialog p { margin: 4px 0 0; text-align: center; color: #59687b; }
.privacy-zoom-close { position: absolute; top: 6px; right: 8px; }
.privacy-editor-dialog { width: min(1120px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow: hidden; }
.privacy-editor-card { min-height: 0; max-height: calc(100dvh - 20px); overflow: auto; }
.privacy-editor-card .ai-privacy-tools { flex-wrap: wrap; }
.batch-ai-confirm { font-weight: 700; }
@media (max-width: 600px) {
  .ai-privacy-dialog { width: calc(100vw - 12px); max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 14px; }
  .ai-privacy-card { min-width: 0; padding: 12px; gap: 9px; }
  .ai-privacy-card > header, .ai-privacy-card > footer { min-width: 0; gap: 8px; }
  .ai-privacy-card h2 { font-size: clamp(18px, 5.3vw, 22px); overflow-wrap: anywhere; }
  .ai-privacy-card p, .ai-privacy-card small, .batch-ai-template-bar, .batch-ai-review-item { min-width: 0; overflow-wrap: anywhere; }
  .ai-privacy-card footer { justify-content: stretch; }
  .ai-privacy-card footer button { flex: 1 1 0; min-width: 0; padding-inline: 8px; white-space: normal; }
  .batch-ai-review-dialog { width: calc(100vw - 12px); height: min(94dvh, 1100px); max-height: calc(100dvh - 12px); margin: auto; }
  .batch-ai-review-dialog.has-pending-adjustments { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: 100dvh; margin: 0; border-radius: 0; }
  .batch-ai-review-dialog.has-pending-adjustments .batch-ai-review-card { grid-template-rows: auto auto auto minmax(0, 1fr); }
  .batch-ai-review-dialog.has-pending-adjustments .batch-ai-confirm,
  .batch-ai-review-dialog.has-pending-adjustments .batch-ai-review-card > footer { display: none; }
  .batch-ai-review-card { height: 100%; min-height: 0; padding: 11px; gap: 8px; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; overflow: hidden; }
  .batch-ai-review-card > header { align-items: flex-start; }
  .batch-ai-review-card > header > div { flex: 1 1 auto; }
  .batch-ai-review-card > header .icon-button { flex: 0 0 40px; }
  .batch-ai-review-list { overscroll-behavior: contain; touch-action: pan-y; }
  .batch-ai-review-item > header { align-items: flex-start; flex-direction: column; }
  .batch-ai-review-item > header > div { width: 100%; }
  .batch-ai-outbound-grid { grid-template-columns: minmax(0, 1fr); }
  .batch-ai-outbound-image { min-width: 0; }
  .privacy-zoom-trigger { min-height: 120px; }
  .privacy-zoom-trigger img { max-height: 42dvh; }
  .batch-ai-confirm { max-height: 18dvh; overflow: auto; overscroll-behavior: contain; }
  .batch-ai-review-card > footer { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); padding-top: 7px; background: #f7f9fc; }
  .batch-ai-review-card > footer button { min-height: 44px; }
  .privacy-editor-dialog { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; border-radius: 0; }
  .privacy-editor-card { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; height: 100%; max-height: 100%; overflow: hidden; padding: 10px; }
  .privacy-editor-card .ai-privacy-canvas-wrap { min-height: 0; max-height: none; overflow: auto; }
  .privacy-editor-card .ai-privacy-canvas { max-height: 100%; }
  .privacy-editor-card .ai-crop-units { max-height: 13dvh; overflow: auto; }
  .privacy-editor-card .ai-privacy-tools { max-height: 20dvh; overflow: auto; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
  .privacy-editor-card > footer { position: sticky; bottom: 0; z-index: 2; padding-top: 6px; background: #f7f9fc; }
  .privacy-editor-card > footer button { flex: 1 1 0; }
  .batch-inline-tools > label, .batch-inline-tools > button { flex: 1 1 42%; }
  .batch-inline-tools select { width: 100%; max-width: none; }
  .batch-inline-canvas-wrap { max-height: 40dvh; }
  .batch-inline-canvas { max-height: 38dvh; }
  .batch-inline-actions { align-items: stretch; flex-direction: column; }
  .batch-ai-review-dialog.has-pending-adjustments .batch-ai-review-card { padding: max(10px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); }
  .batch-ai-review-dialog.has-pending-adjustments .batch-inline-canvas-wrap { max-height: 37dvh; }
  .batch-ai-review-dialog.has-pending-adjustments .batch-inline-canvas { max-height: 35dvh; }
}
.server-managed-settings { opacity: .78; }
.server-managed-settings #api-key,
.server-managed-settings .key-storage-options,
.server-managed-settings button[type="submit"] { display: none !important; }
.server-managed-settings input,
.server-managed-settings select,
.server-managed-settings button { pointer-events: none; }
