.profile-editor {
  --editor-muted: #536078;
  --editor-line: #dfe5ef;
  max-width: 1400px;
}

.profile-editor-heading {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
  padding: 14px 0 12px;
  margin: -14px 0 18px;
  border-bottom: 1px solid var(--editor-line);
}

.profile-editor .form-top { margin: 0 0 16px; align-items: center; }
.profile-editor-title, .profile-editor-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.profile-editor-title .page-title { margin: 0; overflow-wrap: anywhere; }
.profile-editor-save-status { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: var(--editor-muted); font-size: 12px; }
.profile-editor-save-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #37784a; }
.profile-editor-save-status.unsaved::before { background: #bc7100; }
.profile-editor-save { background: var(--navy); color: #fff; }
.profile-editor-save:hover { background: #2c3d62; color: #fff; }
.profile-editor .progress { margin: 0; }
.profile-editor .progress-steps { display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; padding: 3px 3px 8px; }
.profile-editor .progress-steps li { flex: 1 0 142px; }
.profile-editor .progress-steps button { width: 100%; min-height: 54px; border: 0; border-top: 4px solid var(--editor-line); border-radius: 6px; padding: 9px 8px; text-align: left; background: transparent; }
.profile-editor .progress-steps button.on { border-top-color: var(--navy); background: #edf1f8; }
.profile-editor .progress-steps button.done { border-top-color: #a3bb27; }
.profile-editor .progress-steps .step-n { flex: none; }
.profile-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 268px); align-items: start; gap: clamp(14px, 2vw, 26px); }
.profile-editor-main { min-width: 0; }
.profile-editor-rail { display: grid; gap: 12px; }
.profile-editor .profile-editor-rail-toggle { display: none; }
.profile-editor-rail-card, .profile-editor .form-card { border: 1px solid var(--editor-line); box-shadow: 0 4px 18px #182c4d08; }
.profile-editor-rail-card { background: #fff; border-radius: 14px; padding: 16px; overflow-wrap: anywhere; }
.profile-editor-rail-card h2 { margin: 0 0 10px; font-size: 14px; color: var(--navy); }
.profile-editor-rail-card h3, .profile-editor-rail-card p { color: var(--editor-muted); font-size: 13px; margin: 8px 0 0; line-height: 1.5; }
.profile-editor-rail-card ul { padding: 0; margin: 7px 0 0; list-style: none; display: grid; gap: 4px; }
.profile-editor-rail-card .btn-link { display: inline-block; text-align: left; padding: 5px 0; color: #304579; }
.profile-editor-meter { display: flex; align-items: center; gap: 10px; color: var(--navy); font-size: 13px; }
.profile-editor-meter strong { flex: none; white-space: nowrap; }
.profile-editor-meter progress { flex: 1; min-width: 0; height: 8px; appearance: none; border: 0; border-radius: 8px; overflow: hidden; background: #e9edf4; }
.profile-editor-meter progress::-webkit-progress-bar { background: #e9edf4; }
.profile-editor-meter progress::-webkit-progress-value { background: #85a11d; }
.profile-editor-meter progress::-moz-progress-bar { background: #85a11d; }
.profile-editor-language-toggle { display: flex; align-items: flex-start; gap: 9px; color: var(--navy); font-weight: 650; }
.profile-editor-language-toggle input { accent-color: var(--navy); margin-top: 4px; }
.profile-editor-section, .profile-editor .form-field { scroll-margin-top: 180px; }
.profile-editor-section + .profile-editor-section { margin-top: 26px; }
.profile-editor-section > h3 { margin: 12px 0 0; padding: 11px 14px; background: #f2f5fa; border-radius: 8px; color: var(--navy); font-size: 14px; }
.profile-editor .form-card { min-width: 0; padding: clamp(16px, 2.3vw, 28px); }
.profile-editor .form-help { color: var(--editor-muted); }
.profile-editor .reviewed-check { border: 1px solid var(--editor-line); background: #f4f7eb; }
.editor-language-field-themed { border: 1px solid var(--editor-line); padding: 10px; border-radius: 10px; background: #f7f9fc; }
.editor-language-field-themed .bilingual-input.one-language { grid-template-columns: minmax(0, 1fr); }
.editor-language-field-themed .one-language .language-label { display: none; }
.editor-language-tabs { display: flex; gap: 5px; margin: 0 0 8px; }
.editor-language-tabs button { border: 1px solid transparent; border-radius: 6px; padding: 5px 11px; background: transparent; color: var(--editor-muted); font-size: 12px; font-weight: 750; }
.editor-language-tabs button[aria-pressed=true] { background: #fff; color: var(--navy); border-color: var(--editor-line); }
.editor-language-dot { display: inline-block; margin-right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #9ba7bb; }
.editor-language-dot.filled { background: #42834d; }
.profile-editor-list { border: 1px solid var(--editor-line); padding: 10px; border-radius: 10px; }
.profile-editor-list .form-help { margin: 0; padding: 7px 8px; }
.profile-editor-list-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 8px; border-bottom: 1px solid var(--editor-line); overflow-wrap: anywhere; }
.profile-editor-list-row > div:first-child { flex: 1 1 180px; min-width: 0; color: var(--navy); }
.profile-editor-list-row small { display: block; margin-top: 3px; color: var(--editor-muted); }
.profile-editor-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.profile-editor-item-actions .btn { padding: 6px 10px; }
.profile-editor-add { width: 100%; margin-top: 9px; border-style: dashed; color: #354a7d; }
.profile-editor-dialog { --editor-line: #dfe5ef; --editor-muted: #536078; width: min(640px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: 16px; color: var(--navy); background: #fff; box-shadow: 0 24px 60px #141b3459; overflow: hidden; }
.profile-editor-dialog[open] { display: flex; flex-direction: column; }
.profile-editor-dialog.compact { width: min(450px, calc(100% - 28px)); }
.profile-editor-dialog::backdrop { background: #141b3480; }
.profile-editor-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 15px; border-bottom: 1px solid var(--editor-line); }
.profile-editor-dialog-header h2 { margin: 0; font: 700 18px/1.4 var(--font-heading); }
.profile-editor-dialog-header p { margin: 4px 0 0; color: var(--editor-muted); font-size: 13px; overflow-wrap: anywhere; }
.profile-editor-dialog-close { flex: none; border: 0; border-radius: 7px; width: 30px; height: 30px; background: transparent; color: var(--editor-muted); font-size: 21px; line-height: 1; }
.profile-editor-dialog-close:hover { background: #eef2f7; }
.profile-editor-dialog-body { min-height: 0; overflow: auto; padding: 20px 24px; }
.profile-editor-dialog-body > .row-fields { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; }
.profile-editor-dialog-body > .row-fields > .mini { min-width: 0; }
.profile-editor-dialog-body .mini > span:first-child { font-size: 14px; color: var(--navy); font-weight: 600; }
.profile-editor-dialog-body > .field-error { margin: 12px 0 0; }
.profile-editor-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--editor-line); background: #f8f9fc; }
.profile-editor-dialog-danger { background: #aa292e; color: #fff; border-color: #aa292e; }
.profile-editor-dialog .editor-language-field-themed { padding: 0; overflow: hidden; background: #fff; }
.profile-editor-dialog .editor-language-tabs { margin: 0; padding: 0 8px; align-items: center; border-bottom: 1px solid var(--editor-line); background: #f6f8fb; }
.profile-editor-dialog .editor-language-tabs button { padding: 8px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.profile-editor-dialog .editor-language-tabs button[aria-pressed=true] { border-bottom-color: var(--navy); }
.profile-editor-dialog .editor-language-tabs .counter { margin-left: auto; padding-right: 6px; }
.profile-editor-dialog .editor-language-field-themed .input { border: 0; border-radius: 0; }
.profile-editor-dialog .editor-language-field-themed .input:focus { outline-offset: -2px; }
.profile-editor-dialog .editor-language-field-themed textarea { min-height: 100px; }
.editor-language-field-themed .one-language .text-wrap > .counter { display: none; }
.editor-language-tabs .counter { margin-left: auto; align-self: center; }
.profile-editor .editor-drop-zone { flex: 1 1 220px; display: grid; gap: 4px; min-height: 70px; place-content: center; text-align: center; border-style: dashed; background: #f7f9fc; }
.editor-drop-zone small { color: var(--editor-muted); font-weight: 400; }
.profile-editor .editor-drop-zone.dragging { border-color: #617813; background: #f0f7dc; }
.profile-editor-shell .sidebar-editor-options { display: none; }

/* Investor contact entry uses the same step and card treatment as company profiles. */
.crm-contact-entry > .page-title { margin: 10px 0 16px; }
.crm-entry-steps ol { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding: 0; margin: 0 0 15px; list-style: none; }
.crm-entry-steps button { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 48px; padding: 8px; border: 0; border-top: 3px solid #dfe5ef; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 13px; text-align: left; }
.crm-entry-steps button[aria-current="step"] { border-top-color: var(--navy); background: #edf1f8; color: var(--navy); font-weight: 700; }
.crm-entry-steps button span { display: grid; place-items: center; flex: 0 0 22px; height: 22px; border-radius: 50%; background: #e3e9f1; font-weight: 700; }
.crm-entry-steps button[aria-current="step"] span { background: var(--navy); color: #fff; }
.crm-entry-card { padding: 0; border: 1px solid #dfe5ef; overflow: hidden; }
.crm-entry-card-head { padding: 18px clamp(16px,3vw,28px); border-bottom: 1px solid #dfe5ef; }
.crm-entry-card-head h2 { margin: 0; }
.crm-entry-card-head p { margin: 5px 0 0; color: #536078; }
.crm-entry-fields { min-width: 0; padding: 0; margin: 0; border: 0; }
.crm-entry-card > .crm-entry-fields { padding: 18px clamp(16px,3vw,28px); }
.crm-entry-fields .crm-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 18px; margin: 0; }
.crm-entry-card section[hidden] { display: none; }
.crm-entry-fields .field-label { min-height: 0; margin-bottom: 6px; }
.crm-entry-fields .form-help { margin-top: 5px; }
.crm-entry-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.crm-entry-optional { margin-top: 16px; border: 1px solid #dfe5ef; border-radius: 10px; background: #f8fafc; }
.crm-entry-optional summary { padding: 12px 14px; cursor: pointer; color: var(--navy); font-weight: 650; }
.crm-entry-optional > .crm-grid { padding: 8px 14px 14px; }
.crm-entry-footer, .crm-entry-footer > div { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.crm-entry-footer { border-top: 1px solid #dfe5ef; background: #f8f9fc; padding: 14px clamp(16px,3vw,28px); }
.crm-entry-footer > div { justify-content: flex-end; }

@media (min-width: 1260px) {
  .profile-editor-rail { position: sticky; top: 156px; max-height: calc(100vh - 175px); overflow-y: auto; }
}

@media (max-width: 1100px) {
  .profile-editor-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-editor-rail { grid-row: 1; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr)); align-items: start; }
}

@media (max-width: 720px) {
  .profile-editor-shell .sidebar { padding: 12px 16px; gap: 8px; }
  .profile-editor-shell .sidebar-editor-options { display: inline-flex; padding: 7px 12px; }
  .profile-editor-shell .sidebar-workspace { display: none; }
  .profile-editor-shell:not(.sidebar-options-open) .sidebar-help,
  .profile-editor-shell:not(.sidebar-options-open) .sidebar-foot { display: none; }
  .profile-editor-shell .sidebar .nav { margin-top: 0; }
  .profile-editor-heading { position: static; }
  .profile-editor-header-actions { width: 100%; }
  .profile-editor .profile-editor-rail-toggle { display: inline-flex; justify-content: flex-start; grid-row: 1; }
  .profile-editor-rail { display: none; grid-row: 2; grid-template-columns: minmax(0, 1fr); }
  .profile-editor-rail.mobile-open { display: grid; }
  .profile-editor .form-field, .profile-editor-section { scroll-margin-top: 24px; }
  .editor-language-field-themed .bilingual-input { grid-template-columns: minmax(0, 1fr); }
  .crm-entry-steps ol { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .crm-entry-fields .crm-grid { grid-template-columns: minmax(0,1fr); }
}
