/*
UI Polish: calmer palette + hierarchy
Before:
- Strong red blocks and high-contrast emphasis across many areas
- Inconsistent spacing and heavy typography weight
- Step area and card hierarchy competing for attention

After:
- Tokenized design system with restrained SA palette usage
- Softer surfaces, subtle borders/shadows, consistent spacing scale
- Clear hierarchy: top context -> stepper -> active panel -> logs/files
- Red reserved for primary actions and critical states only
*/

:root {
  --sa-navy: #132230;
  --sa-blue: #002056;
  --sa-red: #EF3E42;
  --sa-grey: #989799;
  --sa-light: #EBEBEB;

  --bg: #F6F7F9;
  --card: #FFFFFF;
  --text: #132230;
  --muted: rgba(19, 34, 48, 0.65);
  --subtle: rgba(19, 34, 48, 0.50);
  --border: rgba(19, 34, 48, 0.10);
  --border-strong: rgba(19, 34, 48, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --focus: 0 0 0 2px rgba(0, 32, 86, 0.25);

  --radius: 12px;
  --radius-sm: 10px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;

  --avatar-size: 84px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--sa-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus, button:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: var(--focus);
}

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sa-navy);
  color: rgba(255, 255, 255, 0.8);
  padding: var(--space-3);
}

.brand {
  color: rgba(255, 255, 255, 0.96);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.sidebar nav { display: grid; gap: 4px; }

.sidebar nav a {
  position: relative;
  color: rgba(255, 255, 255, 0.82);
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .16s ease, color .16s ease;
}

.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }

.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--sa-red);
}

.section-label {
  margin-top: var(--space-3);
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.main { padding: var(--space-3) var(--space-4); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.topbar-title {
  color: var(--sa-navy);
  font-size: 1.2rem;
  font-weight: 600;
}

.topbar input[type='search'] {
  width: min(420px, 90vw);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px 12px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }

h1, h2, h3, h4 { margin: 0 0 var(--space-2); color: var(--sa-navy); font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

.metric p { margin: 4px 0 0; color: var(--sa-blue); font-size: 1.2rem; font-weight: 600; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.actions, .actions-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #f6f7f9;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.btn:hover { background: #eef1f5; color: var(--text); }

.btn.primary {
  background: #4a90e2;
  border-color: #4a90e2;
  color: #fff;
}

.btn.primary:hover { background: #3b7fd1; border-color: #3b7fd1; }

.btn.danger {
  background: var(--sa-red);
  border-color: var(--sa-red);
  color: #fff;
}
.btn.danger:hover { background: #d9373b; border-color: #d9373b; }
.link-btn { border: none; background: transparent; color: var(--sa-blue); cursor: pointer; padding: 0; }
.danger-link { color: #9e1a23; }
.danger-link:hover { color: #7f131b; text-decoration: underline; }

.form-grid { display: grid; gap: var(--space-2); }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.span-2 { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--subtle);
  letter-spacing: .04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

textarea { min-height: 90px; }
.inline-check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.year-picker-group { display: grid; gap: 8px; }
.is-hidden { display: none !important; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f2f4f8;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
}

.status-pill.status-not-started { background: #eef2f8; color: #4d6075; border-color: #d5deea; }
.status-pill.status-in-progress { background: #f3f7ff; color: #29496c; border-color: #cadaef; }
.status-pill.status-completed { background: #e9f7ef; color: #1f8a4c; border-color: #b7ddc6; }
.status-pill.status-completed::before { content: "\2713"; margin-right: 4px; font-size: 10px; }
.status-pill.status-blocked { background: #ffecee; color: #9e1a23; border-color: #f0b6bd; }

.flash-wrap { display: grid; gap: 8px; margin-bottom: var(--space-2); }
.flash { border-radius: 10px; border: 1px solid; padding: 10px 12px; font-size: 14px; }
.flash.success { background: #ecf8f1; border-color: #b4dcc3; color: #1f6f3d; }
.flash.warning { background: #fff8e9; border-color: #f3d593; color: #8a5d00; }
.flash.info { background: #edf5ff; border-color: #b5d2f3; color: #184f8a; }
.flash.danger { background: #ffecee; border-color: #f3b3ba; color: #9e1a23; }

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(19, 34, 48, 0.14);
  overflow: hidden;
}

.toast-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.toast.success { border-color: #b4dcc3; background: #f2fbf6; }
.toast.warning { border-color: #f3d593; background: #fffaf0; }
.toast.info { border-color: #b5d2f3; background: #f3f8ff; }
.toast.danger { border-color: #f3b3ba; background: #fff2f4; }

.toast-close {
  border: none;
  background: transparent;
  color: var(--subtle);
  line-height: 1;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
}

.toast-progress {
  display: block;
  height: 3px;
  background: rgba(0, 32, 86, 0.22);
  transform-origin: left center;
  animation-name: toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  animation-duration: var(--toast-duration, 4.5s);
}

.toast.success .toast-progress { background: rgba(31, 138, 76, 0.38); }
.toast.warning .toast-progress { background: rgba(138, 93, 0, 0.40); }
.toast.info .toast-progress { background: rgba(24, 79, 138, 0.40); }
.toast.danger .toast-progress { background: rgba(158, 26, 35, 0.40); }

@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.drop-zone { border: 1px dashed rgba(19,34,48,.30); border-radius: 10px; padding: 12px; background: #fafbfd; }
.drop-zone input[type='file'] {
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
}

.drop-zone input[type='file']::file-selector-button,
.drop-zone input[type='file']::-webkit-file-upload-button {
  height: 38px;
  padding: 0 14px;
  margin-right: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #f6f7f9;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.drop-zone input[type='file']:hover::file-selector-button,
.drop-zone input[type='file']:hover::-webkit-file-upload-button {
  background: #eef1f5;
  color: var(--text);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: #f7f8fb; color: var(--subtle); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr:hover { background: #f9fbff; }

tr.clickable-row { cursor: pointer; }
tr.clickable-row:focus,
tr.clickable-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 32, 86, 0.20);
}

.list { margin: 0; padding-left: 18px; }
.checklist li { display: flex; align-items: center; gap: 6px; }
.checkbox-btn {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(19,34,48,0.30);
  background: #fff;
  color: #fff;
  padding: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.checkbox-btn.readonly { cursor: default; }
.checkbox-btn:hover { border-color: rgba(0,32,86,0.50); }
.checkbox-btn:focus,
.checkbox-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0,32,86,0.22); }
.checkbox-btn .checkbox-icon {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  position: relative;
}
.checkbox-btn.is-checked {
  background: #1f8a4c;
  border-color: #1f8a4c;
}
.checkbox-btn.is-checked .checkbox-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  top: -1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(19,34,48,0.35);
  background: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
}
input[type="checkbox"]:hover { border-color: rgba(0,32,86,0.50); }
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0,32,86,0.22); }
input[type="checkbox"]:checked {
  border-color: var(--sa-blue);
  background: var(--sa-blue);
}
input[type="checkbox"]:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.auth-card { width: min(460px, 96vw); }

.candidate-page { display: grid; grid-template-columns: minmax(260px, .78fr) 10px minmax(0, 2.2fr); gap: var(--space-2); align-items: start; }
.candidate-center, .candidate-right { min-width: 0; }

.profile-photo-wrap { display: grid; justify-items: center; gap: 8px; margin: 8px 0 10px; }
.crop-circle { width: var(--avatar-size); height: var(--avatar-size); border-radius: 50%; overflow: hidden; border: 2px solid #d6deea; background: #f3f6fb; position: relative; display: block; }
.crop-image { width: 100%; height: 100%; object-fit: contain; transform-origin: center center; pointer-events: none; user-select: none; -webkit-user-drag: none; display: block; clip-path: circle(50% at 50% 50%); background: #f3f6fb; }
.crop-image.transformed { transform: translate(var(--photo-x, 0px), var(--photo-y, 0px)) scale(var(--photo-scale, 1)); }
.crop-image.silhouette { object-fit: contain; padding: 10px; background: #eef2f8; }

.profile-photo-frame { border: none; background: transparent; }
.profile-photo-frame, .profile-photo-click, .photo-summary-preview {
  padding: 0;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  line-height: 0;
  font-size: 0;
  background: transparent;
}

.profile-photo-placeholder {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  border: 2px solid #d6deea;
  display: grid;
  place-items: center;
  background: #eef3fb;
  color: var(--sa-blue);
  font-weight: 600;
  font-size: 14px;
}

.candidate-list-photo,
.candidate-list-photo-placeholder {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
}

.candidate-list-photo {
  border: 1px solid var(--border);
  background: #f3f6fb;
  vertical-align: middle;
}

.candidate-list-photo-placeholder {
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #eef3fb;
  color: var(--sa-blue);
  font-size: 11px;
  font-weight: 600;
}

.candidate-list-photo-hidden {
  color: var(--subtle);
  font-size: 12px;
}

.candidate-name-title {
  margin: 0 0 12px;
  text-align: center;
  color: var(--sa-navy);
  font-size: 1.55rem;
  font-weight: 600;
}

.family-card { display: grid; gap: 12px; }
.family-subhead {
  margin: 0;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--subtle);
}

.family-grid {
  display: grid;
  gap: 12px;
}

.family-spouse-grid { grid-template-columns: 1fr; }
.family-children-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.family-member-card {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.family-member-card:hover {
  border-color: var(--border-strong);
  background: #fbfcfe;
}

.family-photo {
  width: 80px;
  height: 80px;
}

.family-photo.profile-photo-placeholder {
  width: 80px;
  height: 80px;
  font-size: 13px;
  border-width: 1px;
}

.family-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--sa-navy);
  line-height: 1.25;
}

.family-meta {
  color: var(--subtle);
  font-size: 12px;
}

.family-candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.family-candidate-tile { margin: 0; }

.family-merge-page { display: grid; gap: 16px; }
.family-merge-panel { margin: 0; }
.family-merge-results {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  margin-top: 6px;
}
.family-merge-summary {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.family-preview-output {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.family-merge-confirm { margin: 0; }

.family-warning {
  border: 1px solid rgba(239, 62, 66, 0.24);
  background: rgba(239, 62, 66, 0.08);
  border-radius: 10px;
  padding: 12px;
  color: #7e1b24;
}

.related-profiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 0 0 14px;
}

.related-profile-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 62px;
  text-decoration: none;
  color: inherit;
}

.related-profile-photo {
  width: 52px;
  height: 52px;
  border-width: 1px;
}

.related-profile-photo.profile-photo-placeholder {
  width: 52px;
  height: 52px;
  font-size: 12px;
  border-width: 1px;
}

.related-profile-name {
  font-size: 12px;
  color: var(--subtle);
  text-align: center;
  line-height: 1.2;
}

.related-profile-meta {
  font-size: 11px;
  color: var(--subtle);
  text-align: center;
  line-height: 1.2;
}

.related-profiles-manage {
  justify-content: flex-start;
  margin-top: 12px;
}

.info-list { margin: 0; display: grid; gap: 8px; }
.info-list dt { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); font-weight: 600; }
.info-list dd { margin: 0; color: var(--text); font-size: 16px; padding: 2px 0 10px; border-bottom: 1px solid var(--border); word-break: break-word; }
.info-stack p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.info-stack strong { color: var(--sa-navy); }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--sa-blue);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn.danger { color: #9e1a23; border-color: rgba(158, 26, 35, .34); }

.process-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding-bottom: 4px;
}

.process-tab-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8f9fc;
  padding: 8px 8px 7px;
  min-height: 74px;
  text-align: left;
  display: grid;
  gap: 4px;
  position: relative;
  cursor: pointer;
}

.process-tab-card .step-tab-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.process-tab-card .step-number { color: var(--sa-navy); font-weight: 600; font-size: 12px; }
.process-tab-card .step-small { font-size: 11px; line-height: 1.25; color: var(--subtle); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.process-tab-card .status-pill { font-size: 10px; padding: 2px 7px; }

.process-tab-card.active {
  background: rgba(19,34,48,0.06);
  border-color: rgba(19,34,48,0.22);
}

.process-tabs.has-open-step .process-tab-card {
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.process-tab-card.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -2px;
  height: 2px;
  background: var(--sa-blue);
  border-radius: 2px;
}

.process-tab-card:focus,
.process-tab-card:focus-visible { outline: none; box-shadow: var(--focus); }

.process-panel-wrap {
  border: 1px solid var(--border-strong);
  border-radius: 0 12px 12px 12px;
  background: #fff;
  margin-top: -1px;
  overflow: hidden;
  transition: max-height .32s ease, opacity .22s ease, margin-top .32s ease, border-color .22s ease;
  max-height: 1200px;
  opacity: 1;
}

.process-panel-wrap.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0;
  border-color: transparent;
}

.process-panel { display: none; }
.process-panel.active { display: block; }

.drawer-body { padding: var(--space-3); border-top: 1px solid var(--border); }
.process-panel .drawer-body { border-top: none; }

.follow-drawers {
  display: grid;
  grid-template-columns: minmax(0,1fr) 10px minmax(0,1fr);
  gap: var(--space-2);
  align-items: start;
  transition: transform .32s ease, margin-top .32s ease, opacity .24s ease;
  will-change: transform;
}

.contact-log-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.contact-log-header h3 { margin-bottom: 2px; }

.contact-accordion {
  display: grid;
  gap: 8px;
}

.contact-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.contact-item__header {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.contact-item__header:hover { background: #f9fbff; }
.contact-item__header:focus,
.contact-item__header:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(0,32,86,0.20); }

.contact-item__summary {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.contact-type {
  justify-self: flex-start;
  background: #eef2f8;
  color: #29496c;
  border-color: #cadaef;
}

.contact-subject {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.contact-meta {
  font-size: 12px;
  color: var(--subtle);
  line-height: 1.35;
}

.contact-done {
  color: #1f8a4c;
  font-weight: 600;
}

.contact-chevron {
  color: var(--subtle);
  font-size: 16px;
  line-height: 1;
  transition: transform .2s ease;
}

.contact-item__header[aria-expanded="true"] .contact-chevron {
  transform: rotate(180deg);
}

.contact-item__body {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: grid;
  gap: 12px;
  background: #fcfdff;
}

.contact-item__body[hidden] {
  display: none !important;
}

.contact-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
}

.contact-meta-grid dt {
  font-size: 11px;
  color: var(--subtle);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
}

.contact-meta-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.contact-notes {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.contact-attachments h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--sa-navy);
}

.contact-attachment-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.contact-attachment-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.contact-attachment-actions {
  display: inline-flex;
  gap: 10px;
  white-space: nowrap;
}

.contact-attach-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.contact-attach-form .drop-zone {
  flex: 1 1 230px;
  margin: 0;
}

.contact-item-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.contact-item-actions form { margin: 0; }


.col-resizer {
  width: 10px;
  align-self: stretch;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
  position: relative;
}

.col-resizer::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: rgba(19,34,48,0.12);
  transition: background .15s ease;
}

.col-resizer:hover::before,
.col-resizer.dragging::before {
  background: rgba(0,32,86,0.35);
}

[data-steps-card].steps-collapsed + .follow-drawers {
  transform: translateY(-10px);
  margin-top: 4px;
}

.photo-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.photo-editor > label { width: 100%; }
.photo-editor-preview { margin: 2px 0; cursor: grab; touch-action: none; }
.photo-editor-preview.drag-over { border-color: var(--sa-blue); box-shadow: 0 0 0 3px rgba(0,32,86,.16); }
.photo-editor-preview.dragging { cursor: grabbing; }
.photo-editor-empty { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; color: var(--subtle); font-size: 12px; }
.photo-summary { display: grid; gap: 8px; justify-items: start; }
.photo-summary-actions { display: flex; gap: 8px; align-items: center; justify-content: center; width: 100%; }
.help-text { margin: 0; color: var(--subtle); font-size: 13px; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 32px; align-items: center; gap: 8px; }
.bar { height: 8px; background: #edf1f6; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sa-blue); }

.modal { position: fixed; inset: 0; background: rgba(19, 34, 48, 0.32); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 30; }
.modal.open { display: flex; }
.modal-panel {
  width: min(820px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(19, 34, 48, 0.16);
  padding: 16px;
}
.modal.modal-inner { z-index: 35; }
.modal-panel.modal-panel-sm { width: min(560px, 96vw); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.candidate-form-shell {
  min-height: calc(100vh - 160px);
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: 8px;
}

.candidate-form-shell .modal-panel {
  width: min(900px, 96vw);
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

.filters-top {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.filters-top input[type='search'] {
  flex: 1 1 320px;
}

.status-segmented {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 2px solid #4a90e2;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.status-segmented-row {
  width: fit-content;
  justify-content: flex-end;
  margin-left: auto;
  margin-top: 2px;
}

.status-segment-btn {
  height: 38px;
  min-width: 92px;
  border: 0;
  border-right: 1px solid rgba(74, 144, 226, 0.35);
  border-radius: 0;
  background: #f1f2f4;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
  padding: 0 18px;
}

.status-segment-btn:hover {
  background: #e9edf3;
  color: var(--text);
}

.status-segment-btn.active {
  background: #4a90e2;
  color: #fff;
}

.status-segment-btn:last-child {
  border-right: 0;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  margin: 0;
}

.filter-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  flex: 0 0 18px;
  padding: 0 !important;
  margin: 0;
  border-radius: 5px;
  border: 1px solid rgba(19,34,48,0.34);
  background: #fff;
  display: inline-block;
  position: relative;
  vertical-align: middle;
  box-shadow: none;
}

.filter-check input[type="checkbox"]:hover {
  border-color: rgba(0,32,86,0.56);
}

.filter-check input[type="checkbox"]:focus,
.filter-check input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,32,86,0.18);
}

.filter-check input[type="checkbox"]:checked {
  border-color: var(--sa-blue);
  background: var(--sa-blue);
}

.filter-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

@media (max-width: 980px) {
  .filters-top {
    flex-direction: column;
    align-items: stretch;
  }
  .status-segmented-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
  }
}

@media (max-width: 1180px) {
  .candidate-page { grid-template-columns: 1fr; }
  .follow-drawers { grid-template-columns: 1fr; }
  .col-resizer { display: none; }
  .contact-meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }
  .main { padding: 12px; }
  .grid-2, .grid-3, .grid-4, .form-grid.cols-2 { grid-template-columns: 1fr; }
  .process-tabs { grid-template-columns: repeat(7, minmax(130px, 1fr)); overflow-x: auto; }
}
