/* Shared, low-risk usability improvements. Keep workflow decisions and saves in
   their existing page logic; this file changes presentation and feedback only. */
:root {
  --ux-focus: #4b217d;
  --ux-error: #a32639;
  --ux-error-soft: #fff4f4;
  --ux-muted: #5f536d;
}

/* Filter controls are dense across the app. Keep them readable while allowing
   the existing list scroll stack to provide horizontal room for wide tables. */
.list-controls,
.list-result-count,
.list-selected-count,
.list-quick-bar label {
  font-size: 14px;
  line-height: 1.4;
}
.list-filter-pending {
  padding: 3px 8px;
  border: 1px solid #b7791f;
  border-radius: 999px;
  background: #fff7e8;
  color: #68400a;
  font-size: 13px;
  line-height: 1.35;
}
.list-bulk-scope-btn,
.list-order-details-toggle button {
  min-height: 34px;
  font-size: 13px;
}
.list-view-table input.list-column-input,
.list-view-table select.list-column-input,
table[data-list-view] input.list-column-input,
table[data-list-view] select.list-column-input {
  min-height: 36px;
  font-size: 13px !important;
  line-height: 1.35;
}
.list-native-filters > summary {
  min-height: 34px;
  font-size: 13px !important;
  line-height: 1.2;
}
.list-native-fields label,
.list-native-fields .list-native-column-search label {
  color: #3d3150;
  font-size: 13px;
  line-height: 1.4;
}
.list-native-fields :is(input, select, textarea) {
  font-size: 14px;
}
button.list-column-suggest-option {
  min-height: 36px;
  font-size: 13px;
}
.list-native-filters > summary.has-active-filter {
  border-color: #6c3fc9;
  background: #eee4fa;
  color: #35165d;
  box-shadow: inset 0 0 0 1px #6c3fc9;
}

/* Client pickers show the name first and keep verification details legible. */
.client-search-option {
  min-height: 48px;
  padding: 9px 11px;
  font-size: 15px;
  line-height: 1.4;
}
.client-search-option small {
  margin-top: 2px;
  color: var(--ux-muted);
  font-size: 13px;
  line-height: 1.4;
}
.client-search-hint {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ux-muted);
  font-size: 14px;
  line-height: 1.4;
}

/* Reusable error styles for forms that expose field errors or summaries. */
.error-summary,
.form-error-summary,
[data-error-summary] {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 2px solid var(--ux-error);
  border-radius: 10px;
  background: var(--ux-error-soft);
  color: #641a25;
  font-size: 15px;
  line-height: 1.5;
  scroll-margin-top: 220px;
}
.error-summary :is(h2, h3),
.form-error-summary :is(h2, h3),
[data-error-summary] :is(h2, h3) {
  margin: 0 0 6px;
  color: #641a25;
  font-size: 17px;
}
.form-error-summary__list {
  margin: 0;
  padding-left: 22px;
}
.form-error-summary__list li + li { margin-top: 4px; }
.form-error-summary__list a { color: #641a25; font-weight: 700; text-decoration: underline; }
.field-error,
.validation-error,
.invalid-feedback {
  display: block;
  margin-top: 4px;
  color: #8b1e2d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
:is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--ux-error) !important;
  box-shadow: 0 0 0 2px rgba(163, 38, 57, .14);
}
#critical-banner {
  font-size: 15px;
  line-height: 1.5;
}

/* Keyboard focus stays visible against both white and tinted surfaces. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ux-focus) !important;
  outline-offset: 2px;
}

/* The link still opens in its existing tab; the cue makes that behaviour
   visible. base.html adds a localized tooltip and aria-description. */
a[target="_blank"]:not(.client-search-create-new)::after {
  content: " ↗";
  display: inline-block;
  margin-left: 2px;
  color: currentColor;
  font-size: .82em;
  font-weight: 700;
  text-decoration: none;
  vertical-align: .08em;
}

/* SP001 is a workflow dashboard; raise the working steps above summaries and
   remove clipped instructions. */
.sp1-page { font-size: 15px; line-height: 1.5; }
.sp1-page .sp1-page-tagline { font-size: 14px; line-height: 1.45; }
.sp1-page .sp1-panel h3,
.sp1-page .sp1-sidebar h3 { font-size: 16px; line-height: 1.35; }
.sp1-page .sp1-panel .sp1-sub { font-size: 14px; line-height: 1.45; color: #514361; }
.sp1-page .sp1-kpi__label { font-size: 12px; color: #514361; }
.sp1-page .sp1-kpi-note { font-size: 13px; line-height: 1.45; color: #514361; }
.sp1-page .sp1-party__label,
.sp1-page .sp1-party__hours { font-size: 13px; }
.sp1-page .sp1-table { font-size: 14px; }
.sp1-page .sp1-table th { font-size: 13px; color: #514361; }
.sp1-page .sp1-step { padding: 10px 12px; gap: 8px 12px; }
.sp1-page .sp1-step__detail {
  display: block;
  overflow: visible;
  font-size: 15px;
  line-height: 1.5;
  color: #514361;
}
.sp1-page .sp1-chip { min-height: 28px; align-items: center; font-size: 13px; }
.sp1-page .sp1-step .btn { min-height: 42px; }
.sp1-page .sp1-batch,
.sp1-page .sp1-status-row { font-size: 14px; line-height: 1.45; }

/* SP003: steps and current status precede aggregate metrics. */
.m2d-page .m2d-step__title { font-size: 18px; line-height: 1.35; }
.m2d-page .m2d-step__detail { font-size: 15px; line-height: 1.5; color: #514361; }
.m2d-page .m2d-chip { min-height: 30px; align-items: center; font-size: 13px; }
.m2d-page .m2d-step__action .btn { min-height: 42px; }
.m2d-page .m2d-kpi__label { font-size: 14px; color: #514361; }
.m2d-page .m2d-warning-badge { min-width: 28px; min-height: 28px; align-items: center; font-size: 13px; }

@media (max-width: 700px) {
  .sp1-page .sp1-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp1-page .sp1-step .btn,
  .m2d-page .m2d-step__action .btn { width: 100%; }
}
