/* Lead-v4 dialog system: clear context, connected sections and an anchored action row. */
body.rx-crm :is(.modal-overlay,.cp-modal-bg){padding:24px;background:rgba(26,37,29,.32);backdrop-filter:blur(3px)}
body.rx-crm :is(.modal-overlay,.cp-modal-bg):has(>.rd-dialog){opacity:1}
body.rx-crm .drawer-overlay.gc-quick-overlay:has(>.rd-quick-drawer){opacity:1}
body.rx-crm :is(.modal,.cp-modal).rd-dialog{--rd-width:680px;display:flex;flex-direction:column;width:min(var(--rd-width),calc(100vw - 48px));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);margin:auto;overflow:hidden;border:1px solid #dce2d4;border-radius:16px;background:var(--rx-surface);box-shadow:0 24px 80px rgba(25,40,28,.2);font-family:var(--rx-font);color:var(--rx-ink)}
body.rx-crm :is(.modal,.cp-modal).rd-dialog[data-rd-size=compact]{--rd-width:520px}
body.rx-crm :is(.modal,.cp-modal).rd-dialog[data-rd-size=workbench]{--rd-width:960px}
body.rx-crm :is(.modal,.cp-modal).rd-dialog[data-rd-size=canvas]{--rd-width:1120px}
body.rx-crm .rd-dialog :is(.rd-dialog-head,.rd-dialog-foot){flex:0 0 auto;min-width:0}
body.rx-crm .rd-dialog .rd-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:22px 28px;background:var(--rx-canvas);border-bottom:1px solid var(--rx-line);box-shadow:inset 4px 0 var(--rx-brand)}
body.rx-crm .rd-dialog .rd-dialog-head>h3{margin:0;font-size:21px;font-weight:600;line-height:1.3;letter-spacing:-.025em;overflow-wrap:anywhere;color:var(--rx-ink)}
body.rx-crm .rd-dialog .rd-dialog-head :is(.icon-btn,.cp-x){flex:0 0 36px;width:36px;min-width:36px;min-height:36px;height:36px;padding:8px;border:1px solid var(--rx-line);border-radius:9px;background:var(--rx-surface);color:var(--rx-muted);font-size:14px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
body.rx-crm .rd-dialog .rd-dialog-head :is(.icon-btn,.cp-x):hover{color:var(--rx-ink);border-color:#bec9ae;background:#fff}
body.rx-crm .rd-dialog .rd-dialog-body{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;padding:26px 28px 28px;background:var(--rx-surface)}
body.rx-crm .rd-dialog .rd-dialog-body>*{max-width:100%;min-width:0}
body.rx-crm .rd-dialog .rd-dialog-foot{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:18px 28px;border-top:1px solid var(--rx-line);background:var(--rx-canvas)}
body.rx-crm .rd-dialog :is(.btn,.cp-btn):not(.rd-protected *){min-height:40px;height:auto;padding:9px 14px;border-radius:9px;font-size:13px;font-weight:550;line-height:1.4;white-space:normal;max-width:100%;box-shadow:none;display:inline-flex;align-items:center;justify-content:center;gap:8px}
body.rx-crm .rd-dialog :is(.btn--sm,.cp-btn--sm):not(.rd-protected *){min-height:36px;padding:7px 11px;font-size:12px}
body.rx-crm .rd-dialog .rd-dialog-foot :is(.btn,.cp-btn){min-width:96px;min-height:40px!important;height:auto;flex:0 1 auto}
body.rx-crm .rd-dialog :is(.btn,.cp-btn):disabled{cursor:not-allowed}
body.rx-crm .rd-dialog :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--rx-brand);outline-offset:3px}
body.rx-crm .rd-dialog .rd-control{min-width:0;max-width:100%;width:100%;min-height:40px;padding:9px 11px;border:1px solid #c8d0c1;border-radius:9px;background:var(--rx-surface);color:var(--rx-ink);font-family:inherit;font-size:13px;line-height:1.5;box-shadow:none}
body.rx-crm .rd-dialog textarea.rd-control{min-height:96px;resize:vertical;line-height:1.65}
body.rx-crm .rd-dialog :is(input[type=checkbox],input[type=radio]).rd-control{width:17px;min-width:17px;height:17px;min-height:17px;padding:0;accent-color:var(--rx-brand);vertical-align:middle;flex:0 0 17px}
body.rx-crm .rd-dialog input[type=file].rd-control{padding:9px;background:var(--rx-canvas);line-height:1.5}
body.rx-crm .rd-dialog input[type=file].rd-control::file-selector-button{min-height:30px;padding:5px 10px;margin-right:12px;border:1px solid var(--rx-line);border-radius:6px;background:var(--rx-surface);color:var(--rx-ink);font:inherit;cursor:pointer}
body.rx-crm .rd-dialog .rd-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:22px;row-gap:20px;align-items:start}
body.rx-crm .rd-dialog .rd-fields>.rd-field{margin:0}
body.rx-crm .rd-dialog :is(.rd-fields>.rd-field-long,.rd-span-all){grid-column:1/-1}
body.rx-crm .rd-dialog .rd-field{display:flex;flex-direction:column;gap:7px;min-width:0;margin:0 0 20px}
body.rx-crm .rd-dialog .rd-field:last-child{margin-bottom:0}
body.rx-crm .rd-dialog .rd-field>label,body.rx-crm .rd-dialog label.rd-field>span:first-child{margin:0;color:var(--rx-ink);font-size:12px;font-weight:600;line-height:1.5}
body.rx-crm .rd-dialog label.rd-field:has(>input[type=checkbox]),body.rx-crm .rd-dialog label.rd-field:has(>input[type=radio]){display:flex;flex-direction:row;align-items:flex-start;gap:9px;line-height:1.65}
body.rx-crm .rd-dialog .rd-field .rd-help{margin:0;font-size:12px;font-weight:400;color:var(--rx-muted)}
body.rx-crm .rd-dialog .rd-dialog-body :is(.form-row,.sa-form-grid,.hd-form-grid):not(.rd-protected *){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 22px;align-items:start;margin-bottom:20px}
body.rx-crm .rd-dialog :is(.form-row,.sa-form-grid,.hd-form-grid)>.rd-field{margin:0}
body.rx-crm .rd-dialog .rd-section{display:block;margin:0 0 24px;padding:0 0 24px;border:0;border-bottom:1px solid var(--rx-line);background:transparent;min-width:0}
body.rx-crm .rd-dialog .rd-section:last-child{margin-bottom:0;padding-bottom:0;border-bottom:0}
body.rx-crm .rd-dialog .rd-section>:is(h2,h3,h4,.section-title,.lc-card__h,.set-block__h):first-child{margin:0 0 18px!important;padding:0!important;border:0!important;font-size:15px;line-height:1.5;font-weight:600;letter-spacing:-.01em;color:var(--rx-ink);background:transparent}
body.rx-crm .rd-dialog .rd-help{font-size:12px;line-height:1.7;overflow-wrap:anywhere}
body.rx-crm .rd-dialog .rd-dialog-body>.rd-help:first-child,body.rx-crm .rd-dialog .rd-dialog-body>div>.rd-help:first-child:not(:only-child){margin:0 0 22px;padding:12px 15px;border-left:3px solid var(--rx-brand);border-radius:0 8px 8px 0;background:var(--rx-brand-soft)}
body.rx-crm .rd-dialog :is(.form-err,[role=alert]).rd-help{color:var(--rx-danger)}
body.rx-crm .rd-dialog .rd-table{min-width:0;max-width:100%;overflow:auto;border:1px solid var(--rx-line);border-radius:10px;margin:16px 0;background:var(--rx-surface)}
body.rx-crm .rd-dialog .rd-table table{width:100%;margin:0;min-width:480px}
body.rx-crm .rd-dialog .rd-table :is(th,td){padding:13px 14px;font-size:12px;line-height:1.65;vertical-align:middle}
body.rx-crm .rd-dialog .rd-table th{font-weight:550;background:var(--rx-canvas)}
body.rx-crm .rd-dialog .rd-action-row{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-top:18px;min-width:0}
body.rx-crm .rd-dialog .rd-amount{font-variant-numeric:tabular-nums;max-width:100%;font-size:var(--rd-amount-size,inherit);line-height:1.35;white-space:nowrap;overflow-wrap:normal}
body.rx-crm .rd-dialog[data-rd-size=compact] .rd-dialog-body{padding-top:24px;padding-bottom:26px}
body.rx-crm .rd-dialog[data-rd-size=compact] [data-testid=rx-confirm-message]{margin:0;font-size:14px;line-height:1.8;color:var(--rx-ink)}
body.rx-crm .rd-dialog[data-rd-size=compact] .rd-dialog-head>h3{font-size:19px}
body.rx-crm .rd-dialog[data-rd-size=compact] .rd-fields{display:block}
body.rx-crm .rd-dialog[data-rd-size=canvas] .rd-dialog-body{padding:20px;overflow:auto}
/* The existing lead quick view gets fixed context/actions and its own scrolling body. */
body.rx-crm .gc-quick-drawer.rd-quick-drawer{width:min(580px,calc(100vw - 32px));height:100dvh;max-height:100dvh;overflow:hidden;display:flex;flex-direction:column;background:var(--rx-surface);border-left:1px solid var(--rx-line);box-shadow:-20px 0 70px rgba(25,40,28,.18)}
body.rx-crm .rd-quick-header{flex:0 0 auto;background:var(--rx-canvas);padding:24px 28px 20px;border-bottom:1px solid var(--rx-line)}
body.rx-crm .rd-quick-header .gc-quick-head{padding:0;border:0;gap:16px;background:transparent}
body.rx-crm .rd-quick-header .gc-quick-identity{align-items:flex-start;gap:12px;min-width:0}
body.rx-crm .rd-quick-header .gc-quick-identity>div:last-child{min-width:0}
body.rx-crm .rd-quick-header .gc-quick-identity h2{font-size:23px;line-height:1.25;letter-spacing:-.035em;margin:5px 0 7px;overflow-wrap:anywhere}
body.rx-crm .rd-quick-header .gc-quick-identity p{font-size:12px;line-height:1.65;overflow-wrap:anywhere}
body.rx-crm .rd-quick-header .gc-quick-badges{display:flex;gap:8px;flex-wrap:wrap;margin:15px 0 0;padding:0}
body.rx-crm .rd-quick-header .gc-quick-actions{display:flex;gap:8px;flex-wrap:wrap;padding:0;margin:16px 0 0}
body.rx-crm .rd-quick-header .gc-quick-actions>.btn{min-height:36px;padding:8px 12px;font-size:12px;background:var(--rx-surface);border:1px solid var(--rx-line)}
body.rx-crm .rd-quick-body{min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;padding:0 28px}
body.rx-crm .rd-quick-body .gc-quick-section{padding:22px 0;border:0;border-bottom:1px solid var(--rx-line);background:transparent;box-shadow:none}
body.rx-crm .rd-quick-body .gc-next-action{margin:0;padding:23px 0;background:transparent;border:0;border-bottom:1px solid var(--rx-line);border-radius:0}
body.rx-crm .rd-quick-body .gc-next-action h3{font-size:17px;line-height:1.45;margin:8px 0;color:var(--rx-ink)}
body.rx-crm .rd-quick-body .gc-section-label{font-size:12px;font-weight:600;line-height:1.5;letter-spacing:.04em;color:var(--rx-muted)}
body.rx-crm .rd-quick-body .gc-quick-context{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 22px;margin-top:16px}
body.rx-crm .rd-quick-body .gc-quick-kv>span{font-size:12px;line-height:1.5;color:var(--rx-muted)}
body.rx-crm .rd-quick-body .gc-quick-kv>b{font-size:13px;font-weight:550;line-height:1.6;overflow-wrap:anywhere}
body.rx-crm .rd-quick-body .gc-quick-timeline{margin-top:18px}
body.rx-crm .rd-quick-body .gc-quick-timeline p b{font-size:13px;line-height:1.6;font-weight:550}
body.rx-crm .rd-quick-body .gc-quick-timeline small,body.rx-crm .rd-quick-body .gc-quick-timeline time{font-size:12px;line-height:1.65;overflow-wrap:anywhere}
body.rx-crm .rd-quick-header .gc-quick-identity p,body.rx-crm .rd-quick-body .gc-quick-timeline time{color:var(--rx-muted)}
body.rx-crm .rd-quick-drawer>.gc-quick-foot{flex:0 0 auto;margin:0;padding:18px 28px;border-top:1px solid var(--rx-line);background:var(--rx-canvas)}
body.rx-crm .rd-quick-drawer>.gc-quick-foot>.btn{width:100%;min-height:40px;border-radius:9px;font-size:13px}
/* Native action menus keep their original open/close state and event handlers. */
body.rx-crm :is(.lc-menu__list,.sa-more-menu,.hdr-menu){max-width:calc(100vw - 48px);border:1px solid var(--rx-line);border-radius:11px;background:var(--rx-surface);box-shadow:0 14px 36px rgba(30,43,30,.12)}
body.rx-crm .lc-menu__list{width:250px;padding:7px;max-height:min(520px,calc(100dvh - 120px));overflow:auto}
body.rx-crm :is(.lc-menu__item,.hdr-menu__item){display:flex;align-items:center;gap:10px;min-height:39px;padding:10px 12px;border-radius:7px;font-size:12px;line-height:1.5;text-align:left;white-space:normal;color:var(--rx-ink)}
body.rx-crm :is(.lc-menu__item,.hdr-menu__item):hover{background:var(--rx-brand-soft)}
body.rx-crm .lc-menu__item--danger{color:var(--rx-danger)}
body.rx-crm .sa-more-menu>.btn{min-height:38px;justify-content:flex-start;font-size:12px;line-height:1.5}
@media(max-width:1080px){body.rx-crm :is(.modal,.cp-modal).rd-dialog[data-rd-size=workbench]{--rd-width:880px}body.rx-crm .rd-dialog .rd-dialog-head{padding:20px 24px}body.rx-crm .rd-dialog .rd-dialog-body{padding:24px}body.rx-crm .rd-dialog .rd-dialog-foot{padding:16px 24px}body.rx-crm .rd-dialog .rd-fields{column-gap:20px}}
@media(max-width:700px){body.rx-crm :is(.modal-overlay,.cp-modal-bg){padding:12px}body.rx-crm :is(.modal,.cp-modal).rd-dialog{width:calc(100vw - 24px);max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);border-radius:13px}body.rx-crm .rd-dialog .rd-fields,body.rx-crm .rd-dialog .rd-dialog-body :is(.form-row,.sa-form-grid,.hd-form-grid):not(.rd-protected *){grid-template-columns:1fr}body.rx-crm .rd-dialog .rd-dialog-head{padding:18px 20px}body.rx-crm .rd-dialog .rd-dialog-head>h3{font-size:19px}body.rx-crm .rd-dialog .rd-dialog-body{padding:20px}body.rx-crm .rd-dialog .rd-dialog-foot{padding:15px 20px}body.rx-crm .rd-dialog .rd-dialog-foot :is(.btn,.cp-btn){flex:1 1 auto}body.rx-crm .rd-quick-header{padding:20px}body.rx-crm .rd-quick-body{padding:0 20px}body.rx-crm .rd-quick-drawer>.gc-quick-foot{padding:16px 20px}}
@media(prefers-reduced-motion:reduce){body.rx-crm .rd-dialog,body.rx-crm .rd-quick-drawer{animation:none;transition:none}}
