/* PITCH semantic product components v1.0
   Additive, `ps-`-scoped primitives shared by the CRM and management shell.
   Page-specific layouts stay in style.css; these rules provide stable
   component contracts without changing legacy markup. */

:root {
  --ps-accent: var(--theme-primary, var(--workspace-primary, #0f766e));
  --ps-accent-fg: var(--theme-primary-fg, #fff);
  --ps-surface: var(--theme-surface, #fff);
  --ps-surface-subtle: var(--theme-surface-elevated, var(--theme-surface-muted, #f4f8f7));
  --ps-surface-selected: var(--theme-selected, #e9f8f6);
  --ps-text: var(--theme-text, #17242d);
  --ps-text-secondary: var(--theme-text-secondary, #41565d);
  --ps-muted: var(--theme-muted, var(--theme-text-muted, #667085));
  --ps-border: var(--theme-border, #d8e5e4);
  --ps-input-bg: var(--theme-input-bg, #fff);
  --ps-input-fg: var(--theme-input-fg, #17242d);
  --ps-placeholder: var(--theme-placeholder, #7c8d92);
  --ps-info: var(--theme-info, #2563eb);
  --ps-success: var(--theme-success, #087f5b);
  --ps-warning: var(--theme-warning, #9a6700);
  --ps-danger: var(--theme-error, #b42318);
  --ps-radius: var(--product-radius, 14px);
  --ps-shadow: var(--product-shadow, 0 1px 2px rgba(16, 42, 49, .04), 0 9px 24px rgba(16, 42, 49, .06));
  --ps-focus-ring: color-mix(in srgb, var(--ps-accent) 30%, transparent);
  --ps-reading-width: var(--product-reading, 76ch);
}

.management-body {
  --ps-accent: #0f766e;
  --ps-accent-fg: #fff;
  --ps-surface: #fff;
  --ps-surface-subtle: #f4f8f7;
  --ps-surface-selected: #e9f8f6;
  --ps-text: #17242d;
  --ps-text-secondary: #41565d;
  --ps-muted: #667085;
  --ps-border: #d8e5e4;
  --ps-input-bg: #fff;
  --ps-input-fg: #17242d;
  --ps-placeholder: #7c8d92;
}

.ps-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Page hierarchy */
.ps-page-header {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(18px, 2vw, 28px);
  min-width: 0;
  margin: 0 0 24px;
  padding: 2px 0;
  color: var(--ps-text);
}

.ps-page-header__content {
  min-width: 0;
}

.ps-page-header__back {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 5px;
  color: var(--ps-text-secondary);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.ps-page-header__back:hover {
  color: var(--ps-accent);
}

.ps-page-header__eyebrow {
  margin: 0;
  color: var(--ps-accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ps-page-header__title {
  margin: 5px 0 7px;
  color: var(--ps-text);
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 790;
  line-height: 1.08;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.ps-page-header__description {
  max-width: var(--ps-reading-width);
  margin: 0;
  color: var(--ps-muted);
  font-size: 14px;
  line-height: 1.6;
}

.ps-page-header__actions,
.ps-action-group,
.ps-empty-state__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.ps-page-header__actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* Actions */
.ps-action,
:is(.app-main, .management-main) .ps-action[class] {
  min-height: 42px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 !important;
  padding: 9px 15px !important;
  border: 1px solid var(--ps-accent) !important;
  border-radius: 10px !important;
  background: var(--ps-accent) !important;
  color: var(--ps-accent-fg) !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 12px !important;
  font-weight: 760 !important;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.ps-action:hover:not(:disabled):not(.is-disabled),
:is(.app-main, .management-main) .ps-action.ps-action--primary:hover:not(:disabled):not(.is-disabled) {
  border-color: color-mix(in srgb, var(--ps-accent) 88%, #000) !important;
  background: color-mix(in srgb, var(--ps-accent) 88%, #000) !important;
  color: var(--ps-accent-fg) !important;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ps-accent) 18%, transparent) !important;
}

.ps-action--secondary,
:is(.app-main, .management-main) .ps-action.ps-action--secondary {
  border-color: var(--ps-border) !important;
  background: var(--ps-surface) !important;
  color: var(--ps-text-secondary) !important;
}

.ps-action--secondary:hover:not(:disabled):not(.is-disabled),
.ps-action--quiet:hover:not(:disabled):not(.is-disabled),
:is(.app-main, .management-main) .ps-action.ps-action--secondary:hover:not(:disabled):not(.is-disabled),
:is(.app-main, .management-main) .ps-action.ps-action--quiet:hover:not(:disabled):not(.is-disabled) {
  border-color: color-mix(in srgb, var(--ps-accent) 42%, var(--ps-border)) !important;
  background: var(--ps-surface-selected) !important;
  color: var(--ps-accent) !important;
  box-shadow: none !important;
}

.ps-action--quiet,
:is(.app-main, .management-main) .ps-action.ps-action--quiet {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--ps-text-secondary) !important;
}

.ps-action--danger,
:is(.app-main, .management-main) .ps-action.ps-action--danger {
  border-color: color-mix(in srgb, var(--ps-danger) 35%, var(--ps-border)) !important;
  background: color-mix(in srgb, var(--ps-danger) 9%, var(--ps-surface)) !important;
  color: var(--ps-danger) !important;
}

.ps-action--danger:hover:not(:disabled):not(.is-disabled),
:is(.app-main, .management-main) .ps-action.ps-action--danger:hover:not(:disabled):not(.is-disabled) {
  border-color: var(--ps-danger) !important;
  background: color-mix(in srgb, var(--ps-danger) 15%, var(--ps-surface)) !important;
  color: var(--ps-danger) !important;
  box-shadow: none !important;
}

.ps-action:disabled,
.ps-action.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  pointer-events: none;
}

.ps-action-group--start { justify-content: flex-start; }
.ps-action-group--center { justify-content: center; }
.ps-action-group--end { justify-content: flex-end; }
.ps-action-group--between { justify-content: space-between; }

/* Notices */
.ps-notice {
  --ps-notice-color: var(--ps-info);
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid color-mix(in srgb, var(--ps-notice-color) 28%, var(--ps-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--ps-notice-color) 6%, var(--ps-surface));
  color: var(--ps-text);
}

.ps-notice::before {
  content: "";
  background: var(--ps-notice-color);
}

.ps-notice--neutral { --ps-notice-color: var(--ps-muted); }
.ps-notice--info { --ps-notice-color: var(--ps-info); }
.ps-notice--success { --ps-notice-color: var(--ps-success); }
.ps-notice--warning { --ps-notice-color: var(--ps-warning); }
.ps-notice--danger { --ps-notice-color: var(--ps-danger); }

.ps-notice__content {
  min-width: 0;
  padding: 14px 16px;
}

.ps-notice--compact .ps-notice__content {
  padding: 10px 12px;
}

.ps-notice__title {
  display: block;
  color: var(--ps-text);
  font-size: 13px;
  line-height: 1.4;
}

.ps-notice__message,
.ps-notice__body {
  max-width: var(--ps-reading-width);
  margin: 4px 0 0;
  color: var(--ps-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.ps-notice__body > :first-child { margin-top: 0; }
.ps-notice__body > :last-child { margin-bottom: 0; }

/* Empty states */
.ps-empty-state {
  min-height: 148px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 30px 22px;
  border: 1px dashed color-mix(in srgb, var(--ps-accent) 28%, var(--ps-border));
  border-radius: 12px;
  background: var(--ps-surface-subtle);
  color: var(--ps-muted);
  text-align: center;
}

.ps-empty-state--compact {
  min-height: 108px;
  padding: 22px 18px;
}

.ps-empty-state__title {
  color: var(--ps-text);
  font-size: 14px;
  line-height: 1.4;
}

.ps-empty-state__description {
  max-width: 58ch;
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.ps-empty-state > .ps-action,
.ps-empty-state__actions {
  margin-top: 9px !important;
}

.ps-empty-state__actions {
  justify-content: center;
}

/* Status */
.ps-status {
  --ps-status-color: var(--ps-muted);
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--ps-status-color) 30%, var(--ps-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--ps-status-color) 8%, var(--ps-surface));
  color: color-mix(in srgb, var(--ps-status-color) 76%, var(--ps-text));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .025em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ps-status--neutral { --ps-status-color: var(--ps-muted); }
.ps-status--info { --ps-status-color: var(--ps-info); }
.ps-status--success { --ps-status-color: var(--ps-success); }
.ps-status--warning { --ps-status-color: var(--ps-warning); }
.ps-status--danger { --ps-status-color: var(--ps-danger); }

.ps-status__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--ps-status-color);
}

.ps-status__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ps-status--large {
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
}

.ps-status--large .ps-status__dot {
  width: 9px;
  height: 9px;
  flex-basis: 9px;
}

/* Native progress keeps a meaningful value in the accessibility tree. */
.ps-progress {
  width: 220px;
  height: 9px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ps-accent) 15%, transparent);
  color: var(--ps-accent);
  appearance: none;
}

.ps-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: color-mix(in srgb, var(--ps-accent) 15%, transparent);
}

.ps-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--ps-accent);
}

.ps-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--ps-accent);
}

/* Link-based section tabs */
.ps-tabs {
  max-width: 100%;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--ps-border);
}

.ps-tabs__list {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  overflow-x: auto;
  padding: 0 2px;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.ps-tab {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  margin: 0;
  padding: 10px 12px 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 9px 9px 0 0;
  background: transparent;
  color: var(--ps-text-secondary);
  font-size: 12px;
  font-weight: 740;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.ps-tab:hover {
  background: var(--ps-surface-subtle);
  color: var(--ps-text);
}

.ps-tab.is-active,
.ps-tab[aria-current="page"] {
  border-bottom-color: var(--ps-accent);
  background: var(--ps-surface-selected);
  color: var(--ps-accent);
}

.ps-tab__badge {
  min-width: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--ps-surface);
  color: var(--ps-text-secondary);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

/* Tables stay inside one deliberate horizontal scroll container. */
.ps-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.ps-table {
  width: 100%;
}

.ps-table-panel {
  overflow: visible !important;
}

.ps-layout--single {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Form fields */
.ps-field {
  display: grid;
  align-content: start;
  min-width: 0;
  margin: 0 0 15px;
}

.ps-field__label,
:is(.app-main, .management-main) .ps-field .ps-field__label {
  display: inline-flex !important;
  align-items: baseline;
  width: max-content;
  max-width: 100%;
  gap: 3px;
  margin: 0;
  color: var(--ps-text-secondary) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.4;
}

.ps-field__required {
  color: var(--ps-danger);
  font-weight: 900;
}

.ps-field__control,
:is(.app-main, .management-main) .ps-field .ps-field__control {
  width: 100% !important;
  min-height: 44px;
  margin: 6px 0 0 !important;
  padding: 10px 12px !important;
  border: 1px solid var(--ps-border) !important;
  border-radius: 10px !important;
  background: var(--ps-input-bg) !important;
  color: var(--ps-input-fg) !important;
  box-shadow: 0 1px 2px rgba(16, 42, 49, .025) !important;
  font: inherit;
  font-size: 13px !important;
}

textarea.ps-field__control {
  min-height: 108px;
  line-height: 1.55;
  resize: vertical;
}

.ps-field__control::placeholder {
  color: var(--ps-placeholder);
}

.ps-field__control:focus,
:is(.app-main, .management-main) .ps-field .ps-field__control:focus {
  border-color: var(--ps-accent) !important;
  box-shadow: 0 0 0 3px var(--ps-focus-ring) !important;
  outline: 0;
}

.ps-field__control:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.ps-field__control[readonly] {
  background: var(--ps-surface-subtle) !important;
}

.ps-field--error .ps-field__control,
:is(.app-main, .management-main) .ps-field.ps-field--error .ps-field__control {
  border-color: var(--ps-danger) !important;
}

.ps-field--error .ps-field__control:focus,
:is(.app-main, .management-main) .ps-field.ps-field--error .ps-field__control:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ps-danger) 22%, transparent) !important;
}

.ps-field__help,
.ps-field__error {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.ps-field__help { color: var(--ps-muted); }
.ps-field__error { color: var(--ps-danger); font-weight: 700; }

/* Canonical customer profile */
.customer-profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.customer-profile-summary > div {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius);
  background: var(--ps-surface);
  box-shadow: var(--ps-shadow);
}

.customer-profile-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--ps-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.customer-profile-summary b {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ps-text);
  font-size: clamp(20px, 2vw, 28px);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.customer-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr);
  align-items: start;
  gap: 20px;
  margin-bottom: 20px;
}

.customer-profile-contact,
.customer-profile-preferences,
.customer-profile-jobs,
.customer-profile-appointments,
.customer-profile-agreements,
.customer-profile-invoices {
  min-width: 0;
}

.customer-profile-details {
  display: grid;
  margin: 0;
}

.customer-profile-details > div {
  display: grid;
  grid-template-columns: minmax(130px, .4fr) minmax(0, 1fr);
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--ps-border);
}

.customer-profile-details > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.customer-profile-details dt {
  color: var(--ps-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.customer-profile-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ps-text);
}

.customer-communication-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.customer-profile-jobs,
.customer-profile-appointments,
.customer-profile-agreements,
.customer-profile-invoices {
  margin-top: 20px;
}

.customer-profile-jobs .record-row > :last-child,
.customer-profile-appointments .record-row > :last-child,
.customer-profile-agreements .record-row > :last-child,
.customer-profile-invoices .record-row > :last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  text-align: right;
}

/* Finance workspace layouts moved out of template-local style blocks. */
.receipt-page {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.receipt-page .panel { overflow: hidden; }
.receipt-page .panel-heading { align-items: flex-start; gap: 16px; }

.receipt-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.receipt-kpis > div {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--ps-border);
  border-radius: 16px;
  background: var(--ps-surface);
}

.receipt-kpis span,
.receipt-kpis small { display: block; }

.receipt-kpis b {
  display: block;
  margin: 7px 0 3px;
  color: var(--ps-accent);
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1;
}

.receipt-capture-panel { box-shadow: 0 14px 38px rgba(15, 23, 42, .07); }

.receipt-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 20px;
  padding: 18px;
  border-radius: 16px;
}

.receipt-card-main { grid-column: 1; min-width: 0; }
.receipt-card-main > div { min-width: 0; }

.receipt-card-main h3,
.receipt-card-main p,
.receipt-card-main small { overflow-wrap: anywhere; }

.receipt-card-status {
  position: static;
  grid-column: 2;
  display: flex;
  align-self: start;
  align-items: flex-end;
  justify-self: end;
  justify-content: flex-start;
  flex-direction: column;
  gap: 5px;
  white-space: nowrap;
}

.receipt-card > :not(.receipt-card-main):not(.receipt-card-status) { grid-column: 1 / -1; }
.receipt-card details { padding-top: 12px; border-top: 1px solid var(--ps-border); }
.receipt-card summary { color: var(--ps-accent); font-weight: 750; cursor: pointer; }

.receipt-review-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: start;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--ps-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ps-surface) 92%, var(--ps-accent) 8%);
}

.receipt-review-form label { min-width: 0; }
.receipt-review-form .receipt-memo-field,
.receipt-review-form > button { grid-column: 1 / -1; }
.receipt-review-form > button { min-width: 190px; justify-self: start; }
.receipt-review-form small { line-height: 1.45; }

/* Shared submit feedback prevents duplicate actions and makes file scanning visible. */
form[data-submitting="true"] {
  cursor: wait;
}

form[data-submitting="true"] :is(button, input[type="submit"])[data-submitting="true"] {
  cursor: wait !important;
  opacity: .72;
}

form[data-submitting="true"] button[data-submitting="true"]::after {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: ps-submit-spin .7s linear infinite;
}

.workspace-upload-submit-status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 0 0;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--ps-info) 28%, var(--ps-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--ps-info) 7%, var(--ps-surface));
  color: var(--ps-text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.workspace-upload-submit-status::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin-top: .32em;
  border-radius: 50%;
  background: var(--ps-info);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ps-info) 15%, transparent);
  content: "";
}

@keyframes ps-submit-spin {
  to { transform: rotate(360deg); }
}

/* Polling may replace these children; reserve predictable geometry and scrolling. */
[data-live-inbox],
[data-live-inbox-list] {
  min-width: 0;
}

[data-live-inbox-list] {
  min-height: 84px;
  overflow-anchor: none;
  scrollbar-gutter: stable;
}

[data-live-inbox-list] > * {
  overflow-anchor: none;
}

[data-live-inbox-kind="thread"] [data-live-inbox-list] {
  min-height: min(420px, 58vh);
  overscroll-behavior: contain;
}

.ps-tabs--buttons {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.ps-tabs--buttons [role="tab"]:focus-visible {
  outline: 3px solid var(--ps-focus-ring) !important;
  outline-offset: -3px;
}

/* A single, visible keyboard treatment across every shared primitive. */
:where(.ps-action, .ps-page-header__back, .ps-tab, .ps-field__control):focus-visible {
  outline: 3px solid var(--ps-focus-ring) !important;
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .receipt-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .ps-page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
  }

  .ps-page-header__actions,
  .ps-action-group {
    width: 100%;
  }

  .ps-page-header__actions > .ps-action,
  .ps-action-group > .ps-action,
  .ps-page-header__actions > form,
  .ps-action-group > form {
    flex: 1 1 auto;
  }

  .ps-page-header__actions > form > .ps-action,
  .ps-action-group > form > .ps-action {
    width: 100%;
  }

  .ps-notice__content {
    padding: 13px 14px;
  }

  .ps-empty-state {
    min-height: 126px;
    padding: 24px 17px;
  }

  .ps-progress {
    width: 100%;
  }

  .customer-profile-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-profile-details > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .customer-profile-jobs .record-row,
  .customer-profile-appointments .record-row,
  .customer-profile-agreements .record-row,
  .customer-profile-invoices .record-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .customer-profile-jobs .record-row > :last-child,
  .customer-profile-appointments .record-row > :last-child,
  .customer-profile-agreements .record-row > :last-child,
  .customer-profile-invoices .record-row > :last-child {
    justify-content: flex-start;
    text-align: left;
  }

  .receipt-page { gap: 14px; }

  .receipt-heading,
  .receipt-page .panel-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .receipt-heading > .button,
  .receipt-page .panel-heading > .button { justify-self: start; }

  .receipt-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 15px;
  }

  .receipt-card-main,
  .receipt-card-status { grid-column: 1; }

  .receipt-card-status {
    align-items: flex-start;
    justify-self: start;
    flex-direction: row;
    flex-wrap: wrap;
    white-space: normal;
  }

  .receipt-review-form {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
  }

  .receipt-review-form .receipt-memo-field,
  .receipt-review-form > button { grid-column: 1; }

  .receipt-review-form > button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .customer-profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .receipt-kpis {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-card-main {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
  }

  .receipt-thumb {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ps-action,
  .ps-tab {
    transition: none;
  }

  form[data-submitting="true"] button[data-submitting="true"]::after {
    animation: none;
  }
}

@media (forced-colors: active) {
  .ps-action,
  .ps-notice,
  .ps-empty-state,
  .ps-status,
  .ps-tab,
  .ps-field__control,
  .workspace-upload-submit-status {
    forced-color-adjust: auto;
  }

  .ps-notice::before,
  .ps-status__dot {
    background: CanvasText;
  }
}

@media (max-width: 420px) {
  .customer-profile-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Public, report, and management shell cohesion. These selectors deliberately
   bridge established specialist layouts to the semantic product system without
   replacing their branded marketing, training, or reporting presentations. */
.product-skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--ps-text);
  color: var(--ps-surface);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
}

.product-skip-link:focus { transform: translateY(0); }

.product-authenticator-qr {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  padding: 12px;
  border: 1px solid var(--ps-border);
  border-radius: 16px;
  background: #fff;
}

.product-color-context { display: contents; }
.section-spaced { margin-top: var(--space-5, 1.125rem); }

.design-report-swatch {
  background: var(--design-swatch, transparent) !important;
}

.design-workspace-bar h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-launch-progress,
.roof-automation-progress {
  appearance: none;
  display: block;
  overflow: hidden;
  border: 0;
}

.pitch-launch-progress::-webkit-progress-bar,
.roof-automation-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: color-mix(in srgb, var(--theme-primary, var(--ps-accent)) 15%, transparent);
}

.pitch-launch-progress::-webkit-progress-value,
.roof-automation-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--theme-primary, var(--ps-accent));
}

.pitch-launch-progress::-moz-progress-bar,
.roof-automation-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--theme-primary, var(--ps-accent));
}

.portal-public-shell main,
.legal-page,
.public-signed-shell {
  min-width: 0;
}

.legal-page > :where(header, section, footer),
.support-page-content > section {
  scroll-margin-top: 24px;
}

.pitch-auth-page :where(input, button, a),
.legal-page :where(input, select, textarea, button, a),
.support-page :where(input, select, textarea, button, a),
.portal-public-shell a,
.management-body :where(input, select, textarea, button, summary, a),
.management-login-body :where(input, button, a),
.design-report-body :where(button, a),
.roof-print-body :where(button, a) {
  -webkit-tap-highlight-color: transparent;
}

:where(
  .pitch-auth-page,
  .legal-page,
  .support-page,
  .portal-public-shell,
  .management-body,
  .management-login-body,
  .design-report-body,
  .roof-print-body
) :where(input, select, textarea, button, summary, a):focus-visible {
  outline: 3px solid var(--ps-focus-ring) !important;
  outline-offset: 3px;
}

.management-body .management-page-head.ps-page-header {
  align-items: flex-end;
  margin-bottom: 26px;
}

.management-body .management-page-head .ps-page-header__eyebrow {
  color: var(--ps-accent);
}

.management-body .management-page-head .ps-page-header__title {
  font-size: clamp(30px, 4vw, 48px);
}

.management-body .management-page-head .ps-page-header__description {
  max-width: 760px;
  font-size: 12px;
}

.management-body .management-page-head .ps-page-header__actions {
  flex: 0 0 auto;
}

.management-table-panel {
  max-width: 100%;
  overflow-x: auto;
}

.management-table { min-width: 680px; }

.management-traffic-series {
  appearance: none;
  display: block;
  width: 42%;
  height: 100%;
  min-height: 2px;
  overflow: hidden;
  border: 0;
  border-radius: 3px 3px 0 0;
  background: transparent;
  direction: rtl;
  writing-mode: vertical-lr;
}

.management-traffic-series::-webkit-progress-bar { background: transparent; }
.management-traffic-series.views::-webkit-progress-value,
.management-traffic-series.views::-moz-progress-bar { background: var(--ps-accent); }
.management-traffic-series.visitors::-webkit-progress-value,
.management-traffic-series.visitors::-moz-progress-bar { background: var(--ps-info); }

@media (max-width: 760px) {
  .management-sidebar {
    position: static !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 12px !important;
  }

  .management-brand {
    padding-bottom: 10px !important;
  }

  .management-brand img {
    width: 52px !important;
    height: 52px !important;
    border-radius: 13px !important;
  }

  .management-identity {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    margin: 10px 0;
    padding: 10px 12px;
    gap: 8px;
  }

  .management-identity small { grid-column: 1 / -1; }

  .management-sidebar nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .management-sidebar nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .management-sidebar-foot {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    gap: 12px;
  }

  .management-sidebar-foot form { margin: 0; }

  .management-main {
    width: 100%;
    margin: 0 !important;
    padding: 24px 16px 52px !important;
  }

  .management-body .management-page-head.ps-page-header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .management-popover-form {
    position: static;
    width: min(100%, 420px);
    margin-top: 8px;
  }

  .management-traffic-chart {
    min-width: 560px;
  }

  .portal-public-head,
  .portal-public-footer,
  .design-report-head,
  .roof-print-actions {
    align-items: flex-start !important;
    flex-direction: column !important;
  }
}

@media (max-width: 520px) {
  .product-authenticator-qr { margin-inline: auto; }

  .pitch-auth-page :where(.pitch-auth-header, .pitch-auth-layout, .pitch-simple-card),
  .legal-page,
  .portal-public-shell main {
    min-width: 0;
  }

  .management-login-card { padding: 26px 22px !important; }
}

@media print {
  .product-skip-link,
  [data-print-page],
  .roof-print-actions { display: none !important; }
}

/* Validated workflow and preset tokens. Dynamic values are applied only by
   product-system.js after allowlist and format checks. */
.job-phase-legend i,
.status-dot {
  --phase-color: var(--ps-muted);
  background: var(--phase-color);
}

.job-phase-legend .job-phase-legend__closed-marker {
  background: var(--ps-danger);
}

.status-pill {
  --status-color: var(--ps-muted);
}

.job-closed-state,
.job-phase-segment {
  --phase-color: var(--ps-muted);
}

.theme-preset-palette i {
  --preset-color: var(--ps-muted);
}
