/* Optional agent-branding enhancement */
.agent-branding-link { display: grid; width: calc(100% - 40px); grid-template-columns: 34px minmax(0,1fr) 14px; align-items: center; gap: 10px; margin: 0 20px 18px; padding: 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; }
.agent-branding-link > i:first-child { display: grid; width: 34px; height: 34px; place-items: center; color: var(--brand); border-radius: 8px; background: var(--brand-light); }
.agent-branding-link > span { display: flex; min-width: 0; flex-direction: column; }
.agent-branding-link strong { font-size: 10px; }
.agent-branding-link small { margin-top: 2px; overflow: hidden; color: #85918f; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.agent-branding-link > i:last-child { color: #919c9a; font-size: 9px; }
.agent-branding-link:hover { border-color: #d8a5aa; background: #fffafb; }
.branding-overview-grid { display: grid; grid-template-columns: minmax(320px,.9fr) minmax(420px,1.1fr); gap: 18px; }
.agent-brand-card { --agent-brand: #bf062f; position: relative; display: flex; min-height: 270px; overflow: hidden; padding: 26px; color: #fff; border-radius: 16px; background: linear-gradient(135deg,#202020,#333); box-shadow: 0 14px 35px rgba(25,25,25,.16); flex-direction: column; }
.agent-brand-accent { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; background: var(--agent-brand); }
.agent-brand-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.agent-headshot { display: grid; width: 58px; height: 58px; place-items: center; color: #fff; border: 3px solid rgba(255,255,255,.9); border-radius: 50%; background: var(--agent-brand,#bf062f); font: 800 15px "Manrope",sans-serif; box-shadow: 0 5px 18px rgba(0,0,0,.18); }
.agent-team-logo { display: grid; min-width: 44px; height: 34px; padding: 0 8px; place-items: center; color: #2a2a2a; border-radius: 6px; background: #fff; font: 800 11px "Manrope",sans-serif; }
.agent-brand-copy { display: flex; margin-top: auto; flex-direction: column; }
.agent-brand-copy > span { color: rgba(255,255,255,.62); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.agent-brand-copy strong { margin-top: 5px; font: 700 25px "Manrope",sans-serif; }
.agent-brand-copy small { margin-top: 3px; color: rgba(255,255,255,.74); font-size: 10px; }
.agent-brand-contact { display: flex; gap: 18px; margin-top: 17px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.8); font-size: 9px; }
.branding-summary-panel { padding: 8px 20px; }
.branding-summary-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 76px; border-bottom: 1px solid var(--line); }
.branding-summary-row:last-child { border-bottom: 0; }
.branding-summary-row > span:first-child { display: grid; width: 36px; height: 36px; place-items: center; color: var(--brand); border-radius: 9px; background: var(--brand-light); }
.branding-summary-row > div { display: flex; min-width: 0; flex-direction: column; }
.branding-summary-row strong { font-size: 11px; }
.branding-summary-row small { margin-top: 3px; color: #84908e; font-size: 9px; }
.branding-summary-row > b { padding: 4px 7px; color: #387258; border-radius: 6px; background: #e7f3eb; font-size: 8px; }
.branding-summary-row > button { padding: 0; color: var(--brand); border: 0; background: transparent; font-size: 9px; font-weight: 700; }
.brand-color-dot { display: block; width: 23px; height: 23px; border: 3px solid #fff; border-radius: 50%; background: #bf062f; box-shadow: 0 0 0 1px var(--line); }
.branding-modal-body { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 18px; background: #f5f6f5; }
#brandingModal .modal-dialog { height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); margin-top: 16px; margin-bottom: 16px; }
#brandingModal .modal-content { height: 100%; max-height: 100%; overflow: hidden; }
#brandingModal .modal-header,#brandingModal .modal-footer { flex: 0 0 auto; background: var(--panel); }
#brandingModal .modal-body { min-height: 0; overflow-y: auto; }
.branding-editor { display: grid; gap: 14px; }
.branding-assets-panel,.branding-fields-panel,.branding-live-preview { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.branding-section-label { display: block; margin-bottom: 13px; color: #8a9593; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.branding-upload-row { display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: center; gap: 13px; padding: 11px 0; border-top: 1px solid #edf0ed; }
.branding-upload-row > div:last-child { display: flex; align-items: flex-start; flex-direction: column; }
.branding-upload-row strong { font-size: 10px; }
.branding-upload-row small { margin: 3px 0 8px; color: #87928f; font-size: 8px; }
.branding-upload-preview { display: grid; width: 60px; height: 60px; place-items: center; color: #fff; border-radius: 12px; background: var(--brand); font: 800 13px "Manrope",sans-serif; }
.branding-upload-preview.headshot { border-radius: 50%; }
.branding-upload-preview.logo { color: #272727; border: 1px solid var(--line); background: #fff; }
.branding-upload-button { padding: 6px 9px; font-size: 8px; }
.branding-usage-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 7px; padding: 10px; color: #6c7775; border-radius: 8px; background: #f4f5f4; font-size: 8px; line-height: 1.45; }
.branding-usage-note i { color: var(--brand); }
.brand-color-control { display: flex; min-height: 43px; align-items: center; gap: 9px; padding: 6px 9px; border: 1px solid #dce3df; border-radius: 8px; }
.brand-color-control input { width: 31px; height: 29px; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; }
.brand-color-control span { color: var(--ink); font-size: 10px; font-weight: 700; }
.branding-toggle { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.branding-toggle input { margin-top: 2px; accent-color: var(--brand); }
.branding-toggle span { display: flex; flex-direction: column; }
.branding-toggle strong { font-size: 9px; }
.branding-toggle small { margin-top: 3px; color: #85918f; font-size: 8px; }
.branding-live-preview { display: flex; min-width: 0; flex-direction: column; }
.branding-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.branding-preview-heading > div { display: flex; flex-direction: column; }
.branding-preview-heading span { color: #8a9593; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.branding-preview-heading strong { margin-top: 3px; font-size: 11px; }
.branding-preview-heading > small { color: #939e9b; font-size: 7px; }
.branding-preview-sheet { --agent-brand: #bf062f; display: flex; min-height: 390px; overflow: hidden; border: 1px solid #d9ddda; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(25,25,25,.09); flex-direction: column; }
.branding-preview-report { position: relative; display: flex; min-height: 215px; justify-content: flex-end; padding: 23px; color: #fff; background: linear-gradient(140deg,#242424,#454545); flex-direction: column; }
.branding-preview-report::before { position: absolute; top: 0; right: 0; left: 0; height: 7px; background: var(--agent-brand); content: ""; }
.branding-preview-report span { color: rgba(255,255,255,.62); font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.branding-preview-report strong { margin-top: 5px; font: 700 20px "Manrope",sans-serif; }
.branding-preview-report small { margin-top: 4px; color: rgba(255,255,255,.72); font-size: 9px; }
.branding-preview-agent { display: grid; grid-template-columns: 54px minmax(0,1fr) 40px; align-items: center; gap: 10px; padding: 19px; }
.branding-preview-agent .agent-headshot { width: 50px; height: 50px; font-size: 12px; }
.branding-preview-agent > div { display: flex; min-width: 0; flex-direction: column; }
.branding-preview-agent > div > small { color: #929c9a; font-size: 6px; font-weight: 800; letter-spacing: .11em; }
.branding-preview-agent > div > strong { margin-top: 2px; color: #252525; font-size: 12px; }
.branding-preview-agent > div > span { margin-top: 2px; color: #737e7c; font-size: 7px; }
.branding-preview-agent p { display: flex; gap: 7px; margin: 8px 0 0; color: #626d6b; font-size: 6px; }
.branding-preview-agent p b { font-weight: 600; }
.branding-preview-agent .agent-team-logo { min-width: 38px; height: 30px; color: #fff; background: #292929; }

@media (max-width: 991.98px) {
  .branding-overview-grid,.branding-modal-body { grid-template-columns: 1fr; }
  .branding-live-preview { order: -1; }
  .branding-preview-sheet { min-height: 320px; }
}
@media (max-width: 575.98px) {
  .branding-overview-grid { grid-template-columns: 1fr; }
  .agent-brand-card { min-height: 240px; padding: 20px; }
  .agent-brand-contact { gap: 7px; flex-direction: column; }
  .branding-modal-body { padding: 12px; }
  .branding-assets-panel,.branding-fields-panel,.branding-live-preview { padding: 14px; }
}
html[data-theme="dark"] .branding-modal-body { background: #151515; }
html[data-theme="dark"] .branding-assets-panel,
html[data-theme="dark"] .branding-fields-panel,
html[data-theme="dark"] .branding-live-preview,
html[data-theme="dark"] .agent-branding-link { background: var(--panel); }
html[data-theme="dark"] .branding-upload-row { border-color: #333; }
html[data-theme="dark"] .branding-usage-note { color: #aaa; background: #272727; }
html[data-theme="dark"] .brand-color-control { border-color: #3a3a3a; }
