/* Lead workspace only. Shared CRM panels and their overlay order stay unchanged. */
#lead-panel {
  --lead-ink: #16374c;
  --lead-muted: #7d92a5;
  --lead-line: #e8eff4;
  --lead-cyan: #009fca;
  --lead-accent: #009fca;
  --lead-accent-deep: #087eaa;
  --lead-tint: #eaf9fd;
  --lead-accent-border: #b9e7f1;
  --lead-accent-shadow: #009fca30;
  --lead-accent-shadow-strong: #009fca45;
  width: min(1640px, calc(100vw - 48px));
  max-width: none;
  background: radial-gradient(circle at 92% 0%, var(--lead-tint), transparent 34%), #f3f8fb;
  color: var(--lead-ink);
  border-radius: 24px 0 0 24px;
  box-shadow: -18px 0 70px #102e4930;
  text-align: right;
}
#lead-panel::before, #lead-panel .task-notes-panel::before { display: none; }
#lead-panel *, #lead-panel *::before, #lead-panel *::after { box-sizing: border-box; }
#lead-panel [hidden] { display: none !important; }
#lead-panel button, #lead-panel select, #lead-panel input { font-family: inherit; }
#lead-panel button { cursor: pointer; }
#lead-panel :is(button, select, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--lead-cyan);
  outline-offset: 3px;
}
#lead-panel > .panel-header { padding: 24px 24px 0; background: transparent; border: 0; flex-shrink: 0; }
#lead-panel .lead-hero {
  padding: 24px 28px 18px;
  background: linear-gradient(135deg, #fff 0%, #fff 70%, var(--lead-tint) 150%);
  border: 1px solid #edf3f7;
  border-top: 5px solid var(--lead-accent);
  border-radius: 18px;
  color: var(--lead-ink);
  box-shadow: 0 4px 18px #23445b04;
  overflow: visible;
}
#lead-panel .lead-hero::before, #lead-panel .lead-hero::after { display: none; }
#lead-panel .panel-hero-top { align-items: center; gap: 24px; }
#lead-panel .panel-hero-top > div:first-child { min-width: 0; align-items: center !important; }
#lead-panel .panel-hero-top > div:first-child > div:last-child { min-width: 0; }
#lead-panel .panel-context-pill { padding: 0; border: 0; background: none; color: #8299a8; font-size: 11px; gap: 6px; margin-bottom: 3px; }
#lead-panel .lead-context-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lead-accent); }
#lead-panel .panel-name { font-size: 25px; line-height: 1.35; color: var(--lead-ink); font-weight: 800; overflow-wrap: anywhere; }
#lead-panel .panel-sub { color: var(--lead-muted); font-size: 13px; }
#lead-panel #lp-company-sub { color: var(--lead-accent-deep); font-size: 15px; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
#lead-panel .lead-editable:hover { background: #eaf7fb; }
#lead-panel .lead-panel-hero-actions { align-items: center; gap: 10px; flex-shrink: 0; }
#lead-panel .lead-primary-action, #lead-panel .lead-ai-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; border-radius: 10px; padding: 10px 20px; font-size: 13px; font-weight: 700;
  transition: background .16s, box-shadow .16s;
}
#lead-panel .lead-primary-action { color: #fff; background: linear-gradient(110deg, var(--lead-accent-deep), var(--lead-accent)); border: 1px solid transparent; box-shadow: 0 5px 14px var(--lead-accent-shadow); }
#lead-panel .lead-primary-action:hover { background: var(--lead-accent-deep); box-shadow: 0 6px 20px var(--lead-accent-shadow-strong); }
#lead-panel .lead-ai-action { color: var(--lead-accent-deep); background: var(--lead-tint); border: 1px solid var(--lead-accent-border); }
#lead-panel .lead-ai-action:hover { background: #fff; }
#lead-panel .lead-primary-action svg, #lead-panel .lead-ai-action svg { width: 19px; height: 19px; flex-shrink: 0; }
#lead-panel .panel-close-btn { width: 34px; height: 34px; border: 1px solid var(--lead-line); border-radius: 50%; background: #fff; color: #7291a2; flex-shrink: 0; }
#lead-panel .panel-close-btn:hover { background: #edf7fa; color: var(--lead-ink); }
#lead-panel .panel-hero-stats { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; border-top: 1px solid var(--lead-line); padding-top: 16px; margin-top: 20px !important; }
#lead-panel .panel-hero-stat { display: flex; flex-direction: column-reverse; align-items: flex-start; justify-content: center; gap: 4px; background: transparent; border: 0; border-inline-end: 1px solid var(--lead-line); border-radius: 0; padding: 0 0 0 24px; min-width: 160px; }
#lead-panel .panel-hero-stat:last-child { border-inline-end: 0; }
#lead-panel .panel-hero-stat-val { width: 100%; color: var(--lead-ink); text-align: right; }
#lead-panel .panel-hero-stat-label { font-size: 10px; font-weight: 500; color: var(--lead-muted); }
#lead-panel .panel-mini-select { color: var(--lead-ink); text-align: right; font-size: 13px; padding: 3px 0; min-height: 28px; background: transparent; }
#lead-panel #lp-status-val { color: #008c96; font-weight: 800; }
#lead-panel .lead-timing-stat { flex-direction: column; align-items: stretch; justify-content: center; gap: 5px; min-width: 220px; }
#lead-panel .lead-timing-row { display: flex; align-items: baseline; gap: 7px; min-height: 20px; white-space: nowrap; }
#lead-panel .lead-timing-label { flex: 0 0 auto; color: var(--lead-muted); font-size: 10px; font-weight: 600; }
#lead-panel .lead-timing-value { color: var(--lead-ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
#lead-panel .lead-timing-meta { color: #1688a7; font-size: 10px; font-weight: 600; }
#lead-panel .lead-timing-alert { color: #c1434d; font-size: 10px; font-weight: 700; }
#lead-panel .lead-owner-stat { flex-direction: column; justify-content: flex-start; }
#lead-panel #lp-owner-val { width: 100%; max-width: 100%; font-weight: 700; text-overflow: ellipsis; }
#lead-panel #lp-owner-val:disabled { cursor: default; opacity: .8; }
#lead-panel .lead-assigned-by { color: var(--lead-muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
#lead-panel #lp-value-stat { margin-inline-start: auto; order: 4; border: 0; padding: 0; min-width: 190px; }
#lead-panel .lead-panel-billing-values { display: flex; flex-wrap: wrap; gap: 16px; justify-content: flex-start; }
#lead-panel .lead-panel-billing-row { font-size: 21px; gap: 6px; color: var(--lead-ink); }
#lead-panel .lead-panel-billing-type, #lead-panel .lead-panel-billing-empty { color: var(--lead-muted); }
#lead-panel .lead-workspace-body {
  display: grid; grid-template-columns: minmax(280px, .95fr) minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 20px; padding: 20px 24px 28px; overflow-y: auto; overscroll-behavior: contain;
  align-content: start; align-items: start; min-height: 0; scrollbar-width: thin; scrollbar-color: #d4e1e9 transparent;
}
#lead-panel .panel-section, #lead-panel .lead-journey-card, #lead-panel .task-notes-panel {
  min-width: 0; margin: 0; background: #fff; border: 1px solid #edf3f7; border-radius: 16px;
  box-shadow: 0 3px 14px #23445b03;
}
#lead-panel .lead-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
#lead-panel h2 { font-size: 15px; font-weight: 700; line-height: 1.5; margin: 0; color: var(--lead-ink); }
#lead-panel .lead-heading-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e2f9f4; color: #00b59c; font-size: 20px; }
#lead-panel .lead-journey-card { grid-column: 2 / 4; grid-row: 1; padding: 14px 26px 0; align-self: stretch; }
#lead-panel :is(.lead-journey-card, .lead-progress-section) > .lead-card-heading { margin-bottom: 10px; }
#lead-panel .lead-stage-chip { color: #009ca8; background: #e5f9f6; padding: 4px 10px; font-size: 11px; border-radius: 20px; }
#lead-panel .lead-journey { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; padding: 4px 0 12px; margin: 0; }
#lead-panel .lead-journey li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
#lead-panel .lead-journey li:not(:last-child)::after { content: ''; position: absolute; top: 20px; right: calc(50% + 28px); width: calc(100% - 56px); height: 1px; background: #e0eaf1; }
#lead-panel .lead-step-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #f0f6fa; color: #94acbc; margin-bottom: 4px; }
#lead-panel .lead-step-icon svg { width: 18px; height: 18px; }
#lead-panel .lead-journey strong { font-size: 12px; font-weight: 600; }
#lead-panel .lead-journey small { font-size: 10px; color: #8ea3b3; }
#lead-panel .lead-journey .is-past .lead-step-icon { background: #e2f7fb; color: #00a3cc; }
#lead-panel .lead-journey .is-current .lead-step-icon { background: linear-gradient(140deg, #00bad2, #00bd99); color: white; box-shadow: 0 5px 16px #00bca622; }
#lead-panel .lead-journey .is-current small { color: #00a58f; }
#lead-panel .lead-text-action { border: 0; padding: 0; color: var(--lead-cyan); background: none; font-size: 12px; font-weight: 600; }
#lead-panel .lead-text-action:hover { text-decoration: underline; }
#lead-panel .lead-progress-section { grid-column: 1; grid-row: 1; padding: 14px 22px; align-self: stretch; }
#lead-panel .lead-progress-health-card { background: transparent; border: 0; border-radius: 0; padding: 0; margin-bottom: 0; box-shadow: none; animation: none; }
#lead-panel .lead-progress-overview { display: flex; align-items: center; gap: 16px; }
#lead-panel .lead-progress-ring { --lead-progress: 0%; display: grid; place-items: center; width: 96px; height: 96px; flex: 0 0 96px; border-radius: 50%; background: conic-gradient(from 0deg, #00bda7 var(--lead-progress), #edf3f7 0); }
#lead-panel .lead-progress-ring > div { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 82px; height: 82px; background: #fff; border-radius: 50%; }
#lead-panel #lp-progress-pct { font-size: 26px; font-weight: 800; line-height: 1.5; color: var(--lead-ink); }
#lead-panel .lead-progress-caption { font-size: 10px; color: var(--lead-muted); }
#lead-panel .lead-progress-detail { flex: 1; min-width: 0; }
#lead-panel .task-progress-label { font-size: 11px; color: var(--lead-muted); margin-bottom: 9px; }
#lead-panel .task-progress-bar { background: #edf3f7; height: 5px !important; box-shadow: none; }
#lead-panel #lp-progress-fill { background: linear-gradient(90deg, #00bfba, #00a8d5); box-shadow: none; animation: none; }
#lead-panel .lead-progress-quote-flags { margin-top: 12px; gap: 5px; justify-content: flex-start; }
#lead-panel .lead-progress-quote-flag { font-size: 9px; padding: 4px 6px; background: #f1fafc; border: 0; color: #2893ae; }
#lead-panel .lead-progress-quote-flag-icon { width: 17px; height: 17px; }
#lead-panel .lead-health-actions { border-top: 1px solid var(--lead-line); margin-top: 10px; padding-top: 8px; justify-content: flex-start; font-size: 10px; }
#lead-panel .lead-health-inline-toggle { font-size: 11px; }
#lead-panel .lead-health-btn { border: 1px solid #cedee6; color: #8099a7; width: 24px; height: 24px; background: #fff; box-shadow: none; }
#lead-panel .lead-health-btn.active { background: #e0f8f0; border-color: #a8e8d7; color: #00a987; }
#lead-panel .lead-health-date-btn { background: #f3f8fb; border-color: #e0ebf2; color: #69869a; font-size: 10px; }
#lead-panel .lead-progress-health-date { color: #859dab; }
#lead-panel .lead-contact-section { grid-column: 1; grid-row: 2 / 4; padding: 22px; }
#lead-panel .detail-grid { gap: 0 14px; }
#lead-panel .detail-cell { background: none; border: 0; border-radius: 0; padding: 14px 0; min-width: 0; }
#lead-panel .detail-cell.wide { border-bottom: 1px solid var(--lead-line); }
#lead-panel .detail-cell-label { color: #8ca2b3; font-size: 10px; margin-bottom: 8px; }
#lead-panel .detail-cell-val { color: var(--lead-ink); font-size: 12px; overflow-wrap: anywhere; }
#lead-panel .lead-contact-card { padding-top: 18px; }
#lead-panel .lead-contact-grid { gap: 18px 14px; }
#lead-panel .lead-contact-item-label { font-size: 10px; color: #8ca2b3; margin-bottom: 5px; }
#lead-panel .lead-contact-item-value { font-size: 12px; font-weight: 500; color: var(--lead-ink); overflow-wrap: anywhere; }
#lead-panel .lead-contact-item-value.linkish { color: var(--lead-cyan); direction: ltr; text-align: right; unicode-bidi: plaintext; }
#lead-panel .lead-editable-input { color: var(--lead-ink); background: #fff; }
#lead-panel .task-notes-panel { position: static; width: auto; max-width: none; height: auto; max-height: none; inset: auto; z-index: auto; overflow: visible; animation: none; }
#lead-panel #lead-tasks-panel { grid-column: 2; grid-row: 2; align-self: stretch; }
#lead-panel #lead-notes-panel { grid-column: 3; grid-row: 2; align-self: stretch; }
#lead-panel #lead-quote-panel { grid-column: 2 / 4; grid-row: 3; }
#lead-panel .task-notes-panel-header { padding: 20px 22px 16px; background: none; border-bottom: 1px solid var(--lead-line); flex-shrink: 0; min-height: 78px; }
#lead-panel .notes-context-pill { display: none; }
#lead-panel .task-notes-panel-sub { font-size: 10px; color: #8ca2b3; margin-top: 4px; }
#lead-panel .task-notes-panel-add { width: 30px; height: 30px; border: 1px solid #d9edf5; border-radius: 9px; background: #f0faff; color: #009dc9; box-shadow: none; font-size: 23px; font-weight: 400; }
#lead-panel .task-notes-panel-add:hover { background: #dff6ff; }
#lead-panel .task-notes-panel-body { padding: 0 20px 16px; overflow: visible; flex: initial; }
#lead-panel #lead-notes-list, #lead-panel #lead-tasks-list { max-height: 380px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d4e1e9 transparent; }
#lead-panel .task-note-list { border: 0; border-radius: 0; }
#lead-panel .task-notes-box { background: none; border: 0; padding: 12px 0; margin: 0; }
#lead-panel .lead-activity-menu-wrap .lead-quote-menu button { min-height: 38px; font-size: 14px; }
#lead-panel .task-note-item { padding: 16px 0; border-color: var(--lead-line); }
#lead-panel .task-note-title { font-size: 12px; color: var(--lead-ink); }
#lead-panel .task-note-text { font-size: 12px; line-height: 1.85; color: #667f92; }
#lead-panel .task-note-time { color: #91a6b6; font-size: 10px; }
#lead-panel .task-note-actions .icon-action { width: 25px; height: 25px; border-color: #e8eff4; background: #fff; font-size: 11px; opacity: .75; }
#lead-panel .task-note-actions .icon-action:hover { opacity: 1; background: #f4fafd; }
#lead-panel .lead-quote-task-list { padding-top: 14px; }
#lead-panel .project-task-section { gap: 0; }
#lead-panel .project-task-section-title { padding: 5px 0; font-weight: 500; }
#lead-panel .project-task-card { padding: 16px 2px; border: 0; border-bottom: 1px solid var(--lead-line); border-radius: 0; background: transparent; }
#lead-panel .project-task-card:hover { background: #f6fbfd; box-shadow: none; }
#lead-panel .project-task-title { font-size: 12px; font-weight: 600; line-height: 1.5; }
#lead-panel .project-task-card .badge { font-size: 9px; }
#lead-panel .project-task-meta { gap: 8px; }
#lead-panel .lead-quote-list { padding-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#lead-panel .lead-quote-section-title, #lead-panel .lead-quote-empty { grid-column: 1 / -1; }
#lead-panel .lead-quote-card { border: 1px solid #e1eef4; border-radius: 12px; background: #fbfdfe; box-shadow: none; padding: 16px; min-width: 0; }
#lead-panel .lead-quote-card.relevant { border-color: #bdeaf4; background: #f7fdff; }
#lead-panel .lead-quote-card-title { font-size: 12px; }
#lead-panel .lead-quote-card-total { color: #167092; font-size: 20px; }
#lead-panel .lead-quote-menu { z-index: 5; right: auto; left: 0; max-width: calc(100vw - 70px); }
#lead-panel .lead-call-quality-section { grid-column: 1; grid-row: 4; padding: 20px 22px; }
#lead-panel .lead-call-quality-section .lead-card-heading { margin-bottom: 14px; }
#lead-panel .lead-call-quality-sub { margin: 3px 0 0; color: var(--lead-muted); font-size: 10px; }
#lead-panel .lead-call-quality-state { color: #7d92a5; font-size: 12px; line-height: 1.65; padding: 8px 0 2px; }
#lead-panel .lead-call-quality-content { display: grid; gap: 14px; }
#lead-panel .lead-call-quality-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid #d9edf5; border-radius: 11px; background: linear-gradient(135deg, #f6fcfe, #effaf8); }
#lead-panel .lead-call-quality-score-value { display: inline-flex; align-items: baseline; gap: 3px; direction: ltr; }
#lead-panel .lead-call-quality-score-value strong { color: #087eaa; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
#lead-panel .lead-call-quality-score-value span { color: #7794a5; font-size: 11px; font-weight: 700; }
#lead-panel .lead-call-quality-score > div:last-child { display: grid; gap: 3px; text-align: right; }
#lead-panel .lead-call-quality-score > div:last-child strong { color: var(--lead-ink); font-size: 12px; }
#lead-panel .lead-call-quality-score > div:last-child span { color: var(--lead-muted); font-size: 10px; }
#lead-panel .lead-call-quality-note { border-inline-start: 3px solid #00b4c8; padding-inline-start: 10px; }
#lead-panel .lead-call-quality-note > span { color: #1688a7; font-size: 10px; font-weight: 800; }
#lead-panel .lead-call-quality-note p { margin: 5px 0 0; color: #486579; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
#lead-panel #lead-panel-actions { grid-column: 1; grid-row: 5; padding: 0; background: none; border: 0; }
#lead-panel #lead-panel-actions .task-panel-toolbar { justify-content: flex-start; }
#lead-panel #lead-delete-button { width: auto; height: 30px; padding: 0 12px; background: transparent; color: #a5767d; border-color: #e6dce0; border-radius: 7px; font-size: 10px; }
@media (min-width: 1200px) {
  #lead-panel .lead-hero { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(520px, 2fr) auto; align-items: center; gap: 24px; padding: 22px 28px; }
  #lead-panel .panel-hero-top { display: contents; }
  #lead-panel .panel-hero-top > div:first-child { grid-column: 1; grid-row: 1; }
  #lead-panel .lead-panel-hero-actions { grid-column: 3; grid-row: 1; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  #lead-panel .lead-primary-action { grid-column: 1 / -1; }
  #lead-panel .lead-ai-action { min-height: 34px; padding: 6px 12px; }
  #lead-panel .panel-hero-stats { display: grid; grid-template-columns: minmax(210px, 1.35fr) repeat(4, minmax(0, 1fr)); grid-column: 2; grid-row: 1; border: 0; border-inline-end: 1px solid var(--lead-line); padding: 0 0 0 24px; margin: 0 !important; gap: 16px; align-items: stretch; min-height: 48px; }
  #lead-panel .panel-hero-stat { width: auto; min-width: 0; padding: 0; flex: auto; border: 0; }
  /* Separate visible fields without consuming their width; the value field is visually last. */
  #lead-panel .panel-hero-stats > .panel-hero-stat + .panel-hero-stat::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: -8px; width: 1px; background: var(--lead-line); pointer-events: none; }
  #lead-panel .lead-timing-stat { min-width: 0; }
  #lead-panel #lp-value-stat { width: auto; min-width: 0; margin: 0; }
  #lead-panel .lead-panel-billing-values { display: grid; gap: 4px; justify-items: start; }
  #lead-panel .lead-panel-billing-row { font-size: 20px; }
}
@media (min-width: 1500px) {
  #lead-panel .lead-workspace-body { grid-template-columns: minmax(340px, .95fr) minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1150px) {
  #lead-panel { width: calc(100vw - 24px); }
  #lead-panel .lead-workspace-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  #lead-panel .lead-progress-section { grid-column: 1; grid-row: 1; }
  #lead-panel .lead-journey-card { grid-column: 2; grid-row: 1; padding: 14px 18px 0; }
  #lead-panel .lead-journey strong { font-size: 10px; }
  #lead-panel .lead-contact-section { grid-column: 1; grid-row: 2 / 4; }
  #lead-panel #lead-tasks-panel { grid-column: 2; grid-row: 2; }
  #lead-panel #lead-notes-panel { grid-column: 2; grid-row: 3; }
  #lead-panel #lead-quote-panel { grid-column: 1 / -1; grid-row: 4; }
  #lead-panel .lead-call-quality-section { grid-column: 1; grid-row: 5; }
  #lead-panel #lead-panel-actions { grid-column: 1; grid-row: 6; }
  #lead-panel .lead-primary-action, #lead-panel .lead-ai-action { padding: 10px 13px; }
  #lead-panel .panel-name { font-size: 22px; }
}
@media (max-width: 760px) {
  #lead-panel { width: 100vw; border-radius: 0; }
  #lead-panel > .panel-header { padding: 12px 12px 0; }
  #lead-panel .lead-hero { padding: 16px; border-radius: 12px; }
  #lead-panel .panel-hero-top { flex-wrap: wrap; gap: 14px; }
  #lead-panel .panel-hero-top > div:first-child { padding-inline-end: 36px; width: 100%; }
  #lead-panel .panel-name { font-size: 21px; }
  #lead-panel .lead-panel-hero-actions { width: 100%; gap: 8px; }
  #lead-panel .lead-primary-action, #lead-panel .lead-ai-action { flex: 1; min-height: 38px; font-size: 12px; padding: 8px; }
  #lead-panel .panel-close-btn { position: absolute; top: 16px; left: 16px; }
  #lead-panel .panel-hero-stats { gap: 8px 16px; margin-top: 14px !important; padding-top: 10px; }
  #lead-panel .panel-hero-stat { min-width: 0; width: calc(50% - 8px); flex: 0 0 calc(50% - 8px); padding: 0; border: 0; }
  #lead-panel #lp-value-stat { min-width: 0; width: 100%; flex-basis: 100%; margin: 0; }
  #lead-panel .lead-panel-billing-row { font-size: 17px; }
  #lead-panel .panel-hero-stat-label { font-size: 9px; }
  #lead-panel .lead-workspace-body { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  #lead-panel .lead-workspace-body > :is(.panel-section, .lead-journey-card, .task-notes-panel, #lead-panel-actions) { grid-column: 1; grid-row: auto; }
  #lead-panel .lead-journey-card { order: 0; }
  #lead-panel .lead-progress-section { order: 1; }
  #lead-panel .lead-contact-section { order: 2; }
  #lead-panel .lead-call-quality-section { grid-column: 1; grid-row: auto; order: 3; }
  #lead-panel #lead-tasks-panel { order: 4; }
  #lead-panel #lead-notes-panel { order: 5; }
  #lead-panel #lead-quote-panel { order: 6; }
  #lead-panel #lead-panel-actions { order: 7; }
  #lead-panel .lead-quote-list { grid-template-columns: minmax(0, 1fr); }
  #lead-panel .lead-contact-section { padding: 18px; }
  #lead-panel .lead-progress-section { padding: 14px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #lead-panel, #lead-panel *, #lead-panel *::before, #lead-panel *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Keep the right-hand cards together, independent of task/document row heights. */
#lead-panel .lead-workspace-sidebar {
  display: flex; flex-direction: column; gap: 20px;
  grid-column: 1; grid-row: 1 / 4; min-width: 0; align-self: start;
}
/* Legacy expanded-coach placement preserves the same compact sidebar. */
#lead-panel.sales-ai-open .lead-workspace-sidebar { display: flex; flex-direction: column; gap: 20px; grid-column: 1; grid-row: 1 / 6; min-width: 0; }
#lead-panel.sales-ai-open #sales-ai-panel { grid-column: 2 / 4; grid-row: 1; min-width: 0; }
#lead-panel.sales-ai-open .lead-journey-card { grid-row: 2; }
#lead-panel.sales-ai-open .lead-contact-section { grid-row: 2 / 5; }
#lead-panel.sales-ai-open #lead-tasks-panel,
#lead-panel.sales-ai-open #lead-notes-panel { grid-row: 3; }
#lead-panel.sales-ai-open #lead-quote-panel { grid-row: 4; }
#lead-panel.sales-ai-open #lead-panel-actions { grid-row: 5; }
#lead-panel.sales-ai-open .lead-progress-section { align-self: stretch; }
@media (min-width: 761px) and (max-width: 1150px) {
  #lead-panel .lead-workspace-sidebar { gap: 16px; }
  #lead-panel.sales-ai-open #sales-ai-panel { grid-column: 2; }
  #lead-panel.sales-ai-open .lead-contact-section { grid-row: 2 / 5; }
  #lead-panel.sales-ai-open #lead-notes-panel { grid-row: 4; }
  #lead-panel.sales-ai-open #lead-quote-panel { grid-row: 5; }
  #lead-panel.sales-ai-open #lead-panel-actions { grid-row: 6; }
}
@media (max-width: 760px) {
  #lead-panel .lead-workspace-sidebar,
  #lead-panel.sales-ai-open .lead-workspace-sidebar { display: contents; }
  #lead-panel .lead-workspace-sidebar > :is(.panel-section, #lead-panel-actions) { grid-column: 1; grid-row: auto; }
  #lead-panel.sales-ai-open .lead-workspace-body > :is(#sales-ai-panel, .panel-section, .lead-journey-card, .task-notes-panel, #lead-panel-actions) { grid-column: 1; grid-row: auto; }
  #lead-panel.sales-ai-open #sales-ai-panel { order: -1; }
}
