/* Customer surfaces share the brand site's restrained type and spacing hierarchy.
   Loaded after the legacy styles; internal tools intentionally do not opt in. */
body.customer-mode {
  --ui-ink: #111214;
  --ui-text: #42464e;
  --ui-muted: #65686f;
  --ui-line: #dfe2e6;
  --ui-soft: #f5f6f7;
  --ui-surface: #fff;
  --ui-accent: #176653;
  --ui-radius: 8px;
  --ui-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Both native dialogs and existing overlay cards use the same visual surface.
   Important declarations are limited to properties locked by war-room legacy CSS. */
body.customer-mode .customer-brand-logo {
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-text);
  min-width: 0;
}
body.customer-mode .customer-brand-logo summary {
  cursor: pointer;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--ui-ink);
}
body.customer-mode .customer-brand-logo-body {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  min-width: 0;
}
body.customer-mode .customer-brand-logo-body p {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.7 !important;
  color: var(--ui-muted) !important;
  overflow-wrap: anywhere;
}
body.customer-mode .customer-brand-logo-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
body.customer-mode .customer-brand-logo-preview img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: contain;
  background: var(--ui-soft);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
}
body.customer-mode .customer-brand-logo-preview span { min-width: 0; }
body.customer-mode .customer-brand-logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
body.customer-mode .customer-brand-logo-actions button {
  width: auto !important;
  min-height: 44px;
  padding: 8px 12px !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-ink);
}
body.customer-mode .customer-brand-logo-actions button:hover { background: var(--ui-soft); }
body.customer-mode .customer-brand-logo-actions button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
body.customer-mode .customer-brand-logo-actions button:disabled { opacity: .6; cursor: wait; }
body.customer-mode .customer-brand-logo [hidden] { display: none !important; }
body.customer-mode :is(.customer-privacy-card, .customer-entry-dialog, .customer-production-image-save-panel),
body.customer-mode #customerReferenceEntryDialog {
  box-sizing: border-box !important;
  padding: 28px !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-ink) !important;
  font-family: var(--ui-font) !important;
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: 0 !important;
  box-shadow: 0 16px 48px rgba(22, 24, 32, .12) !important;
  max-height: calc(100dvh - 48px) !important;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.customer-mode .customer-privacy-dialog {
  padding: 24px !important;
  background: rgba(22, 24, 32, .38) !important;
}
body.customer-mode .customer-entry-dialog::backdrop,
body.customer-mode #customerReferenceEntryDialog::backdrop {
  background: rgba(22, 24, 32, .38);
}
body.customer-mode :is(.customer-privacy-head, .customer-entry-dialog > header, .customer-production-image-save-panel > header),
body.customer-mode #customerReferenceEntryDialog > header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center !important;
  gap: 16px !important;
  margin: 0 0 20px !important;
  padding: 0 0 16px !important;
  border-bottom: 1px solid var(--ui-line) !important;
}
body.customer-mode :is(.customer-privacy-head, .customer-entry-dialog > header) h2,
body.customer-mode #customerReferenceEntryDialog > header h2 {
  min-width: 0;
  margin: 0 !important;
  color: var(--ui-ink) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere;
}
body.customer-mode .customer-privacy-head p {
  margin: 0 0 4px !important;
  color: var(--ui-muted) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
}
body.customer-mode :is(.customer-privacy-close, .customer-entry-dialog > header > button, .customer-production-image-save-panel > header > button),
body.customer-mode #customerReferenceEntryClose,
body.customer-mode #customerExamplesClose {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
  font: 400 24px/1 var(--ui-font) !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.customer-mode :is(.customer-privacy-card, .customer-entry-dialog) :is(p, li),
body.customer-mode #customerReferenceEntryDialog :is(p, li) {
  font-size: 14px !important;
  line-height: 1.75 !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere;
}
body.customer-mode .customer-privacy-card .customer-privacy-head p {
  font-size: 12px !important;
  line-height: 1.5 !important;
}
body.customer-mode :is(.customer-account-intro, .customer-account-hint, .customer-account-empty, .customer-privacy-note, .customer-entry-dialog > p),
body.customer-mode #customerReferenceEntryDialog > p {
  color: var(--ui-muted) !important;
  margin: 0 0 20px !important;
}
body.customer-mode :is(.customer-business-profile-form, .customer-content-evidence-form),
body.customer-mode #customerReferenceEntryForm,
body.customer-mode #customerReferenceEntryBusiness {
  gap: 20px 16px !important;
}
body.customer-mode :is(.customer-business-profile-form, .customer-content-evidence-form, .customer-content-evidence-review) label,
body.customer-mode #customerReferenceEntryForm label {
  min-width: 0;
  gap: 8px !important;
  color: var(--ui-text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.6 !important;
}
body.customer-mode .customer-privacy-card :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), textarea, select),
body.customer-mode #customerReferenceEntryDialog :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), textarea, select) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 10px 12px !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-ink) !important;
  font-family: var(--ui-font) !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
  box-shadow: none !important;
}
body.customer-mode .customer-privacy-card textarea,
body.customer-mode #customerReferenceEntryDialog textarea {
  min-height: 128px !important;
  resize: vertical;
}
body.customer-mode .customer-privacy-card ::placeholder,
body.customer-mode #customerReferenceEntryDialog ::placeholder {
  color: var(--ui-muted) !important;
  opacity: 1;
}
body.customer-mode .customer-privacy-card input[type=file] {
  max-width: 100%;
  font-family: var(--ui-font) !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  color: var(--ui-text) !important;
}
body.customer-mode .customer-privacy-card input[type=file]::file-selector-button {
  margin: 0 12px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-soft);
  color: var(--ui-ink);
  font: 500 16px/1.6 var(--ui-font);
  cursor: pointer;
}
body.customer-mode .customer-privacy-card small,
body.customer-mode #customerReferenceEntryDialog small {
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.65 !important;
  overflow-wrap: anywhere;
}
/* Shared geometry does not imply a primary action. Secondary stays secondary
   everywhere, including controls created after a task or account response. */
body.customer-mode :is(.customer-account-inline button, .customer-account-primary, .customer-account-secondary, .customer-entry-dialog-actions button:not(.customer-examples-text-button)),
body.customer-mode #customerReminderSave {
  min-height: 44px !important;
  padding: 10px 16px !important;
  border: 1px solid var(--ui-ink) !important;
  border-radius: var(--ui-radius) !important;
  font: 600 14px/1.6 var(--ui-font) !important;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none !important;
}
body.customer-mode :is(.customer-account-inline button, .customer-account-primary, .customer-entry-dialog-actions button:not(.customer-examples-text-button)),
body.customer-mode #customerReminderSave {
  background: var(--ui-ink) !important;
  color: #fff !important;
}
body.customer-mode .customer-account-secondary {
  border-color: var(--ui-line) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
}
body.customer-mode .customer-account-text-button,
body.customer-mode #customerAccountChangeEmail {
  min-height: 44px !important;
  max-width: 100%;
  padding: 8px 0 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.6 !important;
  color: var(--ui-accent) !important;
  white-space: normal;
}
body.customer-mode #customerAccountCodeForm .customer-account-change-email {
  min-height: 44px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}
body.customer-mode :is(.customer-account-section, .customer-account-projects) { gap: 16px !important; }
body.customer-mode :is(.customer-account-project, .customer-content-evidence-item, .customer-content-evidence-empty, .customer-content-evidence-summary > div) {
  border-radius: var(--ui-radius) !important;
  border-color: var(--ui-line) !important;
}
body.customer-mode :is(.customer-account-project-head, .customer-account-settings-row, .customer-account-project-head-actions) {
  gap: 16px !important;
}
body.customer-mode .customer-account-settings-row > div { min-width: 0; }
body.customer-mode .customer-account-settings-row .customer-account-text-button { flex-shrink: 0; }
body.customer-mode .customer-account-settings-row span { line-height: 1.65; overflow-wrap: anywhere; }
body.customer-mode .customer-account-form label { font-size: 14px !important; font-weight: 500 !important; }
body.customer-mode .customer-account-inline { gap: 12px !important; }
body.customer-mode .customer-content-evidence-add {
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.customer-mode .customer-content-evidence-add > summary {
  padding: 12px 0;
  background: transparent;
  border-bottom: 1px solid var(--ui-line);
  font-weight: 600;
}
body.customer-mode .customer-content-evidence-form { padding: 20px 0; }
body.customer-mode .customer-business-reference-fields {
  min-width: 0;
  margin: 8px 0 0;
  padding: 20px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--ui-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* Preserve content, layout and action roles on plan/production/public pages. */
body.customer-mode :is(.customer-info-page, .customer-plans-page, .customer-production-preview) {
  --cp-line: var(--ui-line);
  --cp-muted: var(--ui-muted);
  --cp-ink: var(--ui-ink);
}
body.customer-mode :is(.customer-info-page, .customer-plans-head) h1 {
  font-size: 32px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere;
}
body.customer-mode :is(.customer-info-page, .customer-plan-note) h2 {
  margin: 0 0 16px !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
}
body.customer-mode :is(.customer-info-page, .customer-plans-head, .customer-plan-note) :is(p, li) {
  font-size: 15px !important;
  line-height: 1.9 !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere;
}
body.customer-mode :is(.customer-policy-stack, .customer-info-grid) { gap: 24px !important; }
body.customer-mode :is(.customer-production-heading h2, .customer-plan-head h2) {
  font-size: 24px !important;
  line-height: 1.5 !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}
body.customer-mode :is(.customer-production-form-actions, .customer-production-heading-actions, .customer-plan-actions) {
  gap: 12px !important;
  align-items: center;
}
body.customer-mode .customer-production-manual-copy {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--cp-line);
  border-radius: var(--cp-r-sm);
  background: var(--cp-surface);
}
body.customer-mode .customer-production-manual-copy p { margin: 0; font-size: 14px; line-height: 1.7; }
body.customer-mode .customer-production-manual-copy textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 12px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--cp-text);
  background: var(--cp-surface);
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}
body.customer-mode .customer-production-manual-copy button { justify-self: start; }
body.customer-mode :is(.customer-production-primary, .customer-production-back, .customer-plan-action) {
  min-height: 44px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.6 !important;
  letter-spacing: 0 !important;
}
body.customer-mode :is(.customer-privacy-card, .customer-entry-dialog, .customer-production-image-save-panel) :focus-visible,
body.customer-mode #customerReferenceEntryDialog :focus-visible {
  outline: 2px solid var(--ui-accent) !important;
  outline-offset: 3px !important;
}
body.customer-mode .customer-entry-dialog h2[autofocus]:focus,
body.customer-mode #customerReferenceEntryDialog h2[autofocus]:focus {
  outline: none !important;
}
body.customer-mode :is(.customer-privacy-card, .customer-entry-dialog) button:active:not(:disabled),
body.customer-mode #customerReferenceEntryDialog button:active:not(:disabled) { filter: brightness(.94); }
@media (hover: hover) {
  body.customer-mode :is(.customer-privacy-close, .customer-entry-dialog > header > button, .customer-production-image-save-panel > header > button):hover,
  body.customer-mode #customerReferenceEntryClose:hover,
  body.customer-mode #customerExamplesClose:hover {
    background: var(--ui-soft) !important;
    color: var(--ui-ink) !important;
  }
}
@media (max-width: 600px) {
  body.customer-mode #customerAssessmentForm :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea, select),
  body.customer-mode #customerEffectForm :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea, select) {
    font-size: 16px !important;
    min-height: 44px !important;
  }
  body.customer-mode #customerAssessmentForm select,
  body.customer-mode #customerEffectForm select {
    height: 44px !important;
  }
  body.customer-mode .customer-privacy-dialog {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) !important;
    align-items: center !important;
  }
  body.customer-mode :is(.customer-privacy-card, .customer-entry-dialog),
  body.customer-mode #customerReferenceEntryDialog {
    max-width: 100% !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    padding: 20px !important;
  }
  body.customer-mode :is(.customer-privacy-head, .customer-entry-dialog > header),
  body.customer-mode #customerReferenceEntryDialog > header { gap: 12px !important; }
  body.customer-mode :is(.customer-privacy-head, .customer-entry-dialog > header) h2,
  body.customer-mode #customerReferenceEntryDialog > header h2,
  body.customer-mode #customerAccountSetupDialog .customer-privacy-head h2 { font-size: 18px !important; }
  body.customer-mode :is(.customer-business-profile-form, .customer-content-evidence-review) { grid-template-columns: minmax(0, 1fr) !important; }
  body.customer-mode :is(.customer-account-status-row, .customer-account-project-head) { flex-wrap: wrap; }
  body.customer-mode .customer-entry-dialog-actions { gap: 12px; }
  body.customer-mode :is(.customer-info-page, .customer-plans-head) h1 { font-size: 26px !important; }
  body.customer-mode :is(.customer-production-heading h2, .customer-plan-head h2) { font-size: 22px !important; }
}
/* Match the existing viewer's 760px breakpoint, independently of form dialogs. */
@media (max-width: 760px) {
  body.customer-mode .customer-production-image-save-panel {
    border: 0 !important;
    border-radius: 0 !important;
    max-height: none !important;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) !important;
  }
}

body.customer-mode .customer-account-setup-entry{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:16px 0}
body.customer-mode .customer-account-setup-entry>button{width:auto;min-height:44px;margin:0;padding:10px 16px;font-size:14px;line-height:1.5;border:1px solid var(--war-line,#dde0e5);border-radius:8px;background:#fff;color:var(--war-text,#17181b);cursor:pointer}
body.customer-mode .customer-account-setup-entry>button:hover{background:#f1f6f4}
body.customer-mode .customer-account-setup-entry>span{font-size:12px;line-height:1.6;color:var(--war-muted,#6b7078)}
body.customer-mode .customer-avatar-editor{grid-column:1/-1;min-width:0;width:100%;box-sizing:border-box;padding-top:16px;border-top:1px solid var(--war-line,#dde0e5);display:grid;gap:16px}
body.customer-mode .customer-avatar-editor header{display:flex;justify-content:space-between;align-items:center;gap:12px}
body.customer-mode .customer-avatar-editor canvas{display:block;width:min(100%,240px);height:auto;aspect-ratio:1;margin:0 auto;border-radius:50%;outline:1px solid var(--war-line,#dde0e5)}
body.customer-mode .customer-avatar-editor label{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;margin:0;font-size:14px;line-height:1.6}
body.customer-mode #customerAccountSetupDialog .customer-avatar-editor input[type=range]{appearance:auto!important;width:100%!important;height:32px!important;padding:0!important;margin:0!important;background:transparent!important;border:0!important;box-shadow:none!important;accent-color:var(--war-green,#176653)}
body.customer-mode #customerAccountSetupDialog .customer-avatar-editor input[type=color]{width:48px!important;height:36px!important;padding:2px!important;border:1px solid var(--war-line,#dde0e5)}
body.customer-mode .customer-account-setup-content:has(>[data-avatar-editor])>:not([data-avatar-editor]){display:none!important}
body.customer-mode .customer-avatar-editor p{margin:0;font-size:12px;line-height:1.7;color:var(--war-muted,#6b7078)}
body.customer-mode .customer-avatar-editor button{min-height:44px;border:1px solid var(--war-line,#dde0e5);border-radius:8px;background:#fff;color:var(--war-text,#17181b);padding:8px 12px;font-size:14px;cursor:pointer}
body.customer-mode .customer-avatar-editor header button{width:44px;height:44px;padding:0;font-size:24px;flex-shrink:0}
body.customer-mode .customer-avatar-editor button:active{background:#e1ede7}
body.customer-mode .customer-avatar-editor button:disabled{opacity:.55;cursor:wait}
@media(max-width:600px){body.customer-mode .customer-account-setup-entry{align-items:flex-start;flex-direction:column;gap:8px}}

body.customer-mode .customer-production-revision-materials{display:grid;justify-items:start;gap:8px;min-width:0;padding:12px 0;border-block:1px solid var(--war-line,#dde0e5)}
body.customer-mode .customer-production-revision-materials p,body.customer-mode [data-revision-material-status]{margin:0;font-size:12px;line-height:1.7;color:var(--war-muted,#6b7078);overflow-wrap:anywhere}
body.customer-mode .customer-production-revision-materials button{width:auto;min-height:44px;padding:8px 12px;border:1px solid var(--war-line,#dde0e5);border-radius:8px;background:#fff;color:var(--war-text,#17181b);font-size:14px;line-height:1.5;white-space:normal}
body.customer-mode .customer-production-revision-materials button:active{background:#e1ede7}
body.customer-mode .customer-production-revision-materials button:disabled{opacity:.55;cursor:not-allowed}

.customer-production-next-action details { flex: 0 0 auto; width: 100%; min-width: 0; max-width: 100%; }
.customer-production-next-action summary { cursor: pointer; font-size: 14px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.customer-production-next-action textarea { box-sizing: border-box; display: block; width: 100%; margin-top: 8px; padding: 12px; border: 1px solid var(--cp-line, #dfe2e6); border-radius: 8px; font: inherit; font-size: 14px; line-height: 1.6; background: #fff; color: #111214; resize: vertical; }
