:root {
  --ink: #10213d;
  --muted: #657389;
  --line: #d7e3ee;
  --panel: #ffffff;
  --soft: #eef6fb;
  --blue: #0a4f76;
  --navy: #08213d;
  --gold: #f5b93f;
  --green: #22c55e;
  --danger: #dc2626;
  --shadow: 0 18px 44px rgba(8, 33, 61, .12);
}

.email-log-row.email-row-unopened {
  border-left: 4px solid #0b6aa2 !important;
  background: #f7fbff !important;
}

.email-row-unopened .email-list-party,
.email-row-unopened .email-list-subject strong {
  color: #0b2345 !important;
  font-weight: 900 !important;
}

.email-log-row.email-row-opened {
  background: #fbfcfe !important;
}

.email-row-opened .email-list-party,
.email-row-opened .email-list-subject {
  color: #7b8798 !important;
  text-decoration: none !important;
}

.email-read-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.email-read-unopened {
  color: #075985;
  background: #dbeeff;
}

.email-read-opened {
  color: #667085;
  background: #eef1f5;
}

/* 20260726 clean dashboard override: stop status colors from filling full rows. */
.lead-table-wrap {
  border: 1px solid #d9e5ef !important;
  border-radius: 8px !important;
  background: #f8fbfe !important;
  box-shadow: 0 18px 46px rgba(8, 33, 61, .08) !important;
}
.lead-table {
  min-width: 1320px !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 7px !important;
  padding: 8px !important;
  background: transparent !important;
}
.lead-table th {
  padding: 9px 12px !important;
  border: 0 !important;
  background: transparent !important;
  color: #6b7b91 !important;
  font-size: 11px !important;
  letter-spacing: .08em !important;
}
.lead-table td,
.lead-table tr[class*="stage-row-"] td,
tr[class*="stage-row-"] td {
  padding: 13px 12px !important;
  border-top: 1px solid #e2edf6 !important;
  border-bottom: 1px solid #e2edf6 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #243653 !important;
  line-height: 1.22 !important;
  vertical-align: top !important;
}
.lead-table td:first-child,
.lead-table tr[class*="stage-row-"] td:first-child,
tr[class*="stage-row-"] td:first-child {
  border-left: 7px solid var(--status-accent, #cbd5e1) !important;
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
}
.lead-table td:last-child {
  border-right: 1px solid #e2edf6 !important;
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}
.lead-table tr[class*="stage-row-"]:hover td,
tr[class*="stage-row-"]:hover td {
  background: #fbfdff !important;
  background-color: #fbfdff !important;
  border-top-color: #cfe0ec !important;
  border-bottom-color: #cfe0ec !important;
}
.lead-table tr[class*="stage-row-"] a,
.lead-table tr[class*="stage-row-"] strong,
tr[class*="stage-row-"] a,
tr[class*="stage-row-"] strong {
  color: #172a45 !important;
}
.lead-table .lead-id-cell strong {
  color: #0b3556 !important;
  font-size: 15px !important;
  letter-spacing: .01em !important;
}
.lead-table .lead-id-cell span {
  margin-top: 3px !important;
  color: #243653 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}
.lead-table small {
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}
.lead-table .badge {
  min-height: 28px !important;
  padding: 5px 10px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  box-shadow: none !important;
}
.lead-table .badge[class*="stage-"] {
  background: color-mix(in srgb, var(--status-badge-bg, #e9f4fb) 62%, #ffffff) !important;
  color: var(--status-text, #0d5479) !important;
  border-color: color-mix(in srgb, var(--status-border, #c9e5f5) 76%, #ffffff) !important;
}
.lead-table .stage-cant-fund {
  background: #f8fafc !important;
  color: #5b341f !important;
  border-color: #c89b78 !important;
}
.lead-table .doc-requested,
.lead-table .doc-not-requested,
.lead-table .doc-partial,
.lead-table .doc-received {
  min-width: 112px !important;
  background: #f8fafc !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
.lead-table .doc-received {
  background: #ecfdf5 !important;
  color: #166534 !important;
  border-color: #bbf7d0 !important;
}
.lead-table .doc-requested {
  background: #fffbeb !important;
  color: #92400e !important;
  border-color: #fde68a !important;
}
.lead-col-lead { width: 175px !important; }
.lead-col-contact { width: 210px !important; }
.lead-col-dob { width: 130px !important; }
.lead-col-case { width: 155px !important; }
.lead-col-stage { width: 175px !important; }
.lead-col-docs { width: 150px !important; }
.lead-col-attorney { width: 185px !important; }
.lead-col-funding { width: 145px !important; }
.lead-col-assigned { width: 110px !important; }
.lead-col-updated { width: 175px !important; }
.lead-col-action { width: 96px !important; }

.lead-activity-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.lead-activity-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 5px;
  align-items: baseline;
}
.lead-activity-item b {
  color: #0b5f72;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}
.lead-activity-email b {
  color: #9a5b0a;
}
.lead-activity-item time {
  color: #243653;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}
.lead-activity-updated {
  padding-top: 5px;
  border-top: 1px solid #e2e8f0;
  color: #7a8798;
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .lead-table {
    min-width: 0 !important;
    padding: 0 !important;
    border-spacing: 0 !important;
  }
  .lead-table,
  .lead-table tbody,
  .lead-table tr,
  .lead-table td {
    background: transparent !important;
  }
  .lead-table tr[class*="stage-row-"] {
    background: #ffffff !important;
    border-left: 7px solid var(--status-accent, #cbd5e1) !important;
  }
  .lead-table tr[class*="stage-row-"] td {
    background: #ffffff !important;
  }
}

/* V120: make the server-restored conversation focus visible before the next command. */
.ai-chat-focus {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 18px;
  border-top: 1px solid #c8e1e8;
  border-bottom: 1px solid #c8e1e8;
  background: #eff9fb;
  color: #27445b;
  font-size: 0.86rem;
}

.ai-chat-focus strong {
  color: #0a6577;
  white-space: nowrap;
}

.ai-chat-focus span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-chat-focus small {
  margin-left: auto;
  color: #5d7084;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .ai-chat-focus {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-chat-focus small {
    margin-left: 0;
    white-space: normal;
  }
}

/* AI Operations Desk */
.ai-desk-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 10px 2px 0;
}
.ai-desk-header h1 {
  margin: 4px 0 6px;
  font-size: 3rem;
  letter-spacing: 0;
}
.ai-desk-header p {
  max-width: 760px;
  margin: 0;
  color: #5c6d83;
}
.ai-desk-header form {
  display: grid;
  gap: 6px;
  justify-items: stretch;
  min-width: 190px;
}
.ai-desk-header form small {
  color: #64748b;
  text-align: right;
}
.ai-lawyer-command {
  margin-bottom: 14px;
  border: 1px solid #a9d7d0;
  border-left: 6px solid #087f75;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 35, 60, .06);
}
.ai-lawyer-command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  background: #eefaf8;
  border-bottom: 1px solid #cfe9e4;
}
.ai-lawyer-command-head h2 { margin: 3px 0; font-size: 1.28rem; }
.ai-lawyer-command-head p { margin: 0; color: #53667b; }
.ai-lawyer-command-head > a { color: #075f59; font-weight: 850; }
.ai-priority-label { color: #a84d00; font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.ai-lawyer-queues { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ai-lawyer-queues a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 70px;
  padding: 13px 17px;
  color: #10213d;
  text-decoration: none;
  border-right: 1px solid #dce5ee;
}
.ai-lawyer-queues a:last-child { border-right: 0; }
.ai-lawyer-queues a:hover { background: #f5fafb; box-shadow: inset 0 -3px 0 #087f75; }
.ai-lawyer-queues span { font-size: .78rem; font-weight: 850; text-transform: uppercase; }
.ai-lawyer-queues strong { font-size: 1.75rem; }
.ai-lawyer-queues .reply { background: #eaf8ef; }
.ai-lawyer-queues .reply strong { color: #18794e; }
.ai-lawyer-queues .unopened { background: #fff4dd; }
.ai-lawyer-queues .unopened strong { color: #9a5000; }
.ai-lawyer-queues .reminder { background: #fff8e7; }
.ai-lawyer-queues .reminder strong { color: #a45c00; }
.ai-lawyer-queues .missing { background: #fff2f0; }
.ai-lawyer-queues .missing strong { color: #b42318; }
.ai-workflow-command {
  border-color: #b8cae6;
  border-left-color: #245da8;
}
.ai-workflow-command .ai-lawyer-command-head {
  background: #f0f5fc;
  border-bottom-color: #d7e2f2;
}
.ai-workflow-command .ai-lawyer-command-head > a { color: #194f96; }
.ai-workflow-command .ai-lawyer-queues { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ai-workflow-command .workflow-new { background: #eef6ff; }
.ai-workflow-command .workflow-new strong { color: #175fa7; }
.ai-workflow-command .workflow-client { background: #f4f0ff; }
.ai-workflow-command .workflow-client strong { color: #6d47a8; }
.ai-workflow-command .workflow-lawyer { background: #eefaf8; }
.ai-workflow-command .workflow-lawyer strong { color: #087f75; }
.ai-workflow-command .workflow-funder { background: #fff8e7; }
.ai-workflow-command .workflow-funder strong { color: #9a5000; }
.ai-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #cbd9e8;
  border-left: 5px solid #0f7382;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.ai-stat-strip > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 82px;
  padding: 15px 18px;
  border-right: 1px solid #dce5ee;
  color: inherit;
  text-decoration: none;
}
.ai-stat-strip > a:last-child {
  border-right: 0;
}
.ai-stat-strip > a:hover {
  background: #f5fafb;
  box-shadow: inset 0 -3px 0 #0f7382;
}
.ai-stat-strip span {
  color: #5c6d83;
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
}
.ai-stat-strip strong {
  color: #10213d;
  font-size: 2rem;
}
.ai-stat-strip .urgent {
  background: #fff4f2;
}
.ai-stat-strip .urgent strong {
  color: #b42318;
}
.ai-stat-strip .docs-due {
  background: #effaf8;
}
.ai-stat-strip .docs-due strong {
  color: #0f7382;
}
.ai-chat-shell {
  margin-top: 18px;
  border: 1px solid #b8cde2;
  border-radius: 10px;
  background: #f4f8fc;
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(15, 35, 60, .09);
}
.ai-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 20px;
  border-bottom: 1px solid #c9d9e8;
  background: linear-gradient(135deg, #102d4f 0%, #0b5e72 100%);
  color: #fff;
}
.ai-chat-head .eyebrow { color: #9ee7dc; }
.ai-chat-head h2 { margin: 3px 0 5px; color: #fff; font-size: 1.65rem; letter-spacing: 0; }
.ai-chat-head p { max-width: 740px; margin: 0; color: #d7e8f1; }
.ai-chat-connected,
.ai-chat-connect {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: .76rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}
.ai-chat-connected i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #55e6a5;
  box-shadow: 0 0 0 4px rgba(85,230,165,.18);
}
.ai-chat-connect:hover { background: rgba(255,255,255,.22); }
.ai-chat-messages {
  display: grid;
  gap: 12px;
  min-height: 210px;
  max-height: 560px;
  padding: 18px 20px;
  overflow-y: auto;
  background: linear-gradient(#edf4fa, #f7fafc);
}
.ai-chat-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  max-width: min(860px, 92%);
}
.ai-chat-message.user {
  justify-self: end;
  grid-template-columns: minmax(0, 1fr) 38px;
}
.ai-chat-message.user .ai-chat-avatar { grid-column: 2; grid-row: 1; background: #0f7382; }
.ai-chat-message.user > div:not(.ai-chat-avatar) { grid-column: 1; grid-row: 1; background: #dff3f5; border-color: #aedbe0; }
.ai-chat-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: #163c63;
  color: #fff;
  font-size: .72rem;
  font-weight: 950;
}
.ai-chat-message > div:not(.ai-chat-avatar) {
  padding: 11px 13px;
  border: 1px solid #cedbe8;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(18,49,79,.05);
}
.ai-chat-message strong { display: block; margin-bottom: 4px; color: #18334f; font-size: .76rem; }
.ai-chat-message p {
  margin: 0;
  color: #243b53;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-chat-message.pending p { color: #64748b; }
.ai-chat-message.pending .ai-chat-avatar { animation: ai-chat-pulse 1.2s ease-in-out infinite; }
@keyframes ai-chat-pulse { 50% { opacity: .52; transform: scale(.94); } }
.ai-chat-lead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.ai-chat-lead-link {
  padding: 6px 9px;
  border: 1px solid #9eced3;
  border-radius: 999px;
  background: #eaf8f7;
  color: #075d68;
  font-size: .75rem;
  font-weight: 850;
  text-decoration: none;
}
.ai-chat-lead-link:hover { border-color: #0f7382; background: #d9f1ef; }
.ai-chat-workflow-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-chat-workflow-link { min-height: 34px; padding: 7px 11px; font-size: .76rem; }
.ai-chat-action-list { display: grid; gap: 9px; margin-top: 11px; }
.ai-chat-action-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #edbd49;
  border-radius: 8px;
  background: #fff9e8;
}
.ai-chat-action-card > strong { margin: 0; color: #17324d; font-size: .82rem; }
.ai-chat-action-card > span { color: #53677c; font-size: .74rem; }
.ai-chat-action-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-chat-action-controls .btn { min-height: 32px; padding: 6px 10px; font-size: .74rem; }
.ai-chat-action-status { color: #64748b; font-weight: 750; }
.ai-chat-action-status:empty { display: none; }
.ai-chat-action-status.success { color: #166534; }
.ai-chat-action-status.error { color: #991b1b; }
.ai-chat-bulk-preview {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 9px 10px;
  border: 1px solid #d7c47e;
  border-radius: 7px;
  background: rgba(255, 255, 255, .78);
}
.ai-chat-bulk-preview > small { color: #496078; font-weight: 850; }
.ai-chat-bulk-preview ul { display: grid; gap: 5px; margin: 0; padding-left: 20px; }
.ai-chat-bulk-preview li { color: #41566c; font-size: .74rem; line-height: 1.35; }
.ai-chat-bulk-preview a { color: #075d68; font-weight: 800; }
.ai-chat-bulk-email-preview { max-height: 440px; border-color: #82bbc4; background: #f7fcfc; }
.ai-chat-bulk-email-preview li { display: grid; gap: 3px; padding: 7px 0; border-bottom: 1px solid #dbe9ec; }
.ai-chat-bulk-email-preview li:last-child { border-bottom: 0; }
.ai-chat-bulk-email-preview li > strong { color: #17324d; }
.ai-chat-bulk-email-preview li > span { overflow-wrap: anywhere; }
.ai-chat-bulk-email-preview li > small { color: #64748b; }
.ai-chat-bulk-sms-preview { max-height: 480px; border-color: #58aebb; background: #f2fbfb; }
.ai-chat-bulk-sms-preview li { display: grid; gap: 3px; padding: 7px 0; border-bottom: 1px solid #d5e9eb; }
.ai-chat-bulk-sms-preview li:last-child { border-bottom: 0; }
.ai-chat-bulk-sms-preview li > strong { color: #17324d; }
.ai-chat-bulk-sms-preview li > span { overflow-wrap: anywhere; }
.ai-chat-bulk-sms-preview li > small { color: #526a7d; }
.ai-chat-error {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff1f2;
  color: #991b1b;
  font-weight: 750;
}
.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 20px 0;
  border-top: 1px solid #d7e2ec;
  background: #fff;
}
.ai-chat-suggestions button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #b9ccdc;
  border-radius: 999px;
  background: #f7fafc;
  color: #23445f;
  font-size: .77rem;
  font-weight: 850;
}
.ai-chat-suggestions button:hover:not(:disabled) { border-color: #0f7382; background: #eaf7f6; color: #075d68; }
.ai-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 20px 15px;
  background: #fff;
}
.ai-chat-composer label { min-width: 0; }
.ai-chat-composer textarea {
  width: 100%;
  min-height: 82px;
  max-height: 220px;
  resize: vertical;
  border-color: #9fb8cd;
  background: #fbfdff;
  font-size: .96rem;
}
.ai-chat-composer textarea:focus { border-color: #0f7382; box-shadow: 0 0 0 3px rgba(15,115,130,.12); }
.ai-chat-actions { display: grid; gap: 7px; min-width: 136px; }
.ai-chat-actions .btn { width: 100%; min-height: 38px; }
.ai-chat-shell footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 20px;
  border-top: 1px solid #d7e2ec;
  background: #f7fafc;
  color: #65758a;
  font-size: .72rem;
  font-weight: 750;
}
.ai-query-console {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #cbd9e8;
  border-left: 6px solid #0f7382;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 35, 60, .06);
}
.ai-query-console-head,
.ai-query-results-head,
.ai-query-result-head,
.ai-query-result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.ai-query-console-head h2,
.ai-query-results-head h2 {
  margin: 3px 0 0;
  font-size: 1.45rem;
  letter-spacing: 0;
}
.ai-live-data {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #9adbc7;
  border-radius: 999px;
  background: #ecfdf5;
  color: #176448;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-query-form {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(190px, .28fr) minmax(145px, .2fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 15px;
}
.ai-query-form label {
  display: grid;
  gap: 6px;
}
.ai-query-form label > span {
  color: #52647b;
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-query-form input,
.ai-query-form select,
.ai-query-form button {
  min-height: 50px;
}
.ai-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.ai-quick-prompts a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd9e8;
  border-radius: 6px;
  background: #f7fafc;
  color: #29435d;
  font-size: .8rem;
  font-weight: 850;
  text-decoration: none;
}
.ai-quick-prompts a:hover {
  border-color: #0f7382;
  background: #eef9f8;
}
.ai-quick-prompts strong {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border-radius: 5px;
  background: #dcecf2;
  color: #0b5368;
  font-size: .73rem;
}
.ai-work-filters {
  display: grid;
  grid-template-columns: minmax(230px, .45fr) minmax(170px, .3fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 18px;
  padding: 13px;
  border: 1px solid #cbd9e8;
  border-radius: 8px;
  background: #fff;
}
.ai-work-filters label {
  display: grid;
  gap: 5px;
}
.ai-work-filters label > span {
  color: #52647b;
  font-size: .73rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-work-filters select,
.ai-work-filters .btn {
  min-height: 44px;
}
.ai-query-results {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #cbd9e8;
  border-radius: 8px;
  background: #f6f9fb;
}
.ai-query-results-head {
  align-items: flex-end;
  margin-bottom: 13px;
}
.ai-query-results-head p {
  margin: 0;
  color: #607188;
  font-weight: 750;
}
.ai-query-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ai-query-result {
  padding: 15px;
  border: 1px solid #cfdae6;
  border-left: 5px solid #1f7892;
  border-radius: 7px;
  background: #fff;
}
.ai-query-result-head {
  align-items: flex-start;
}
.ai-query-result-head a {
  color: #0b6682;
  font-size: .78rem;
  font-weight: 950;
}
.ai-query-result-head h3 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  letter-spacing: 0;
}
.ai-query-result-head > span {
  padding: 5px 8px;
  border-radius: 5px;
  background: #e8f0f7;
  color: #37516b;
  font-size: .7rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-query-reason {
  margin: 11px 0;
  padding: 9px 10px;
  border-left: 3px solid #e9a62f;
  background: #fff8e9;
  color: #65480f;
  font-size: .84rem;
  font-weight: 800;
}
.ai-touch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.ai-touch-grid > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e1e8ef;
  border-radius: 5px;
  background: #f8fafc;
}
.ai-touch-grid span,
.ai-touch-grid strong {
  display: block;
}
.ai-touch-grid span {
  color: #738298;
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-touch-grid strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: #243b55;
  font-size: .72rem;
}
.ai-query-result-foot {
  align-items: center;
  flex-wrap: wrap;
  margin-top: 11px;
  color: #62738a;
  font-size: .74rem;
  font-weight: 750;
}
.ai-query-result-foot .btn {
  margin-left: auto;
  min-height: 34px;
  padding: 7px 10px;
  font-size: .76rem;
}
.ai-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #d6e0ea;
  overflow-x: auto;
}
.ai-tabs a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-bottom: 3px solid transparent;
  color: #51637a;
  font-weight: 850;
  text-decoration: none;
}
.ai-tabs a.active {
  border-bottom-color: #0f7382;
  color: #08213d;
}
.ai-recommendation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.ai-recommendation {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(300px, 1.35fr) minmax(250px, 1.05fr) minmax(170px, .65fr);
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid #cbd9e8;
  border-left: 6px solid #3b82a0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 35, 60, .045);
  overflow: hidden;
}
.ai-recommendation.ai-severity-urgent {
  border-left-color: #c9362b;
}
.ai-recommendation.ai-severity-high {
  border-left-color: #ef8b22;
}
.ai-card-head,
.ai-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ai-card-head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ai-severity,
.ai-category,
.ai-channel {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 6px;
  background: #eef4f8;
  color: #334a63;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-severity-urgent .ai-severity {
  background: #fee4e2;
  color: #a4221a;
}
.ai-severity-high .ai-severity {
  background: #fff0d8;
  color: #8a4a05;
}
.ai-channel {
  background: #e3f6ee;
  color: #166441;
}
.ai-record-identity,
.ai-record-summary,
.ai-next-action,
.ai-record-controls,
.ai-draft-disclosure {
  min-width: 0;
  padding: 13px 15px;
}
.ai-record-summary,
.ai-next-action,
.ai-record-controls,
.ai-draft-disclosure {
  border-left: 1px solid #e1e8ef;
}
.ai-record-identity {
  display: grid;
  align-content: start;
  gap: 9px;
}
.ai-card-head {
  align-items: flex-start;
}
.ai-lead-line {
  display: grid;
  gap: 4px;
}
.ai-lead-line a {
  display: grid;
  gap: 2px;
  color: #0b6682;
  font-weight: 900;
  line-height: 1.25;
  text-decoration: none;
}
.ai-lead-line a span {
  color: #142b49;
  font-size: .9rem;
  font-weight: 850;
}
.ai-lead-line small,
.ai-generated {
  color: #65758a;
  font-size: .72rem;
  font-weight: 750;
}
.ai-record-summary {
  display: grid;
  align-content: start;
  gap: 5px;
}
.ai-record-summary > span,
.ai-next-action > strong {
  color: #52647b;
  font-size: .69rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}
.ai-record-summary h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}
.ai-next-action {
  display: grid;
  align-content: start;
  gap: 5px;
  background: #f0f9f8;
}
.ai-record-summary p,
.ai-next-action p {
  margin: 0;
  color: #52647b;
  font-size: .86rem;
  line-height: 1.4;
}
.ai-next-action small {
  margin-top: 4px;
  color: #51637a;
  font-size: .72rem;
  overflow-wrap: anywhere;
}
.ai-next-action small span {
  color: #0f6671;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-record-controls {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 7px;
}
.ai-record-controls form,
.ai-draft-dismiss {
  margin: 0;
}
.ai-record-controls .btn,
.ai-card-actions .btn,
.ai-draft-dismiss .btn {
  min-height: 38px;
  padding: 9px 11px;
  font-size: .78rem;
}
.ai-record-state {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #edf2f7;
  color: #53657b;
  font-size: .76rem;
  font-weight: 850;
}
.ai-draft-disclosure {
  align-self: stretch;
}
.ai-draft-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid #c8d5e4;
  border-radius: 6px;
  background: #fff;
  color: #17304f;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 900;
  list-style: none;
}
.ai-draft-disclosure > summary::-webkit-details-marker {
  display: none;
}
.ai-draft-disclosure > summary::before {
  content: "+";
  color: #0f7382;
  font-size: 1rem;
  font-weight: 900;
}
.ai-draft-disclosure[open] {
  grid-column: 1 / -1;
  border-top: 1px solid #e1e8ef;
  border-left: 0;
  background: #f8fbfd;
}
.ai-draft-disclosure[open] > summary {
  width: max-content;
  margin-bottom: 12px;
}
.ai-draft-disclosure[open] > summary::before {
  content: "-";
}
.ai-draft-form {
  display: grid;
  gap: 10px;
}
.ai-draft-form label {
  display: grid;
  gap: 6px;
  font-weight: 850;
}
.ai-draft-form textarea {
  min-height: 120px;
  resize: vertical;
}
.ai-email-template-loader {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px 12px;
  align-items: end;
  padding: 10px;
  border: 1px solid #acd9d6;
  border-radius: 7px;
  background: #eef9f8;
}
.ai-email-template-loader > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ai-email-template-loader > small {
  grid-column: 1 / -1;
  color: #5a6c80;
  font-weight: 700;
}
.ai-email-template-loader > small.success { color: #166534; }
.ai-email-template-loader > small.error { color: #991b1b; }
.ai-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.ai-card-actions form {
  margin: 0;
}
.ai-draft-dismiss {
  margin-top: 8px;
}
.ai-send-error {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 0;
}
.ai-lead-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.ai-lead-panel h2 {
  margin: 3px 0 0;
}
.ai-lead-panel ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.ai-lead-panel li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d6e0ea;
  border-left: 4px solid #3b82a0;
  border-radius: 6px;
  background: #f9fbfc;
}
.ai-lead-panel li.ai-mini-urgent {
  border-left-color: #c9362b;
}
.ai-lead-panel li.ai-mini-high {
  border-left-color: #ef8b22;
}
.ai-lead-panel li > span {
  color: #6b7788;
  font-size: .69rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-lead-panel li div {
  display: grid;
  gap: 3px;
}
.ai-lead-panel li small {
  color: #64748b;
  line-height: 1.35;
}
.nav-ai-desk.hot .nav-label {
  color: #a4221a;
}

@media (max-width: 1120px) {
  .ai-recommendation {
    grid-template-columns: minmax(210px, .75fr) minmax(0, 1.25fr);
  }
  .ai-next-action,
  .ai-record-controls,
  .ai-draft-disclosure {
    border-top: 1px solid #e1e8ef;
  }
  .ai-next-action {
    border-left: 0;
  }
}

@media (max-width: 980px) {
  .ai-lawyer-queues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-workflow-command .ai-lawyer-queues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-lead-panel ul,
  .ai-query-result-grid {
    grid-template-columns: 1fr;
  }
  .ai-query-form {
    grid-template-columns: minmax(0, 1fr) minmax(180px, .45fr);
  }
  .ai-stat-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ai-chat-head,
  .ai-chat-shell footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .ai-chat-messages {
    min-height: 250px;
    padding: 14px 12px;
  }
  .ai-chat-message { max-width: 98%; }
  .ai-chat-suggestions { padding: 10px 12px 0; }
  .ai-chat-composer {
    grid-template-columns: 1fr;
    padding: 10px 12px 12px;
  }
  .ai-chat-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
  .ai-lawyer-command-head { align-items: flex-start; flex-direction: column; }
  .ai-lawyer-queues { grid-template-columns: 1fr; }
  .ai-workflow-command .ai-lawyer-queues { grid-template-columns: 1fr; }
  .ai-lawyer-queues a { border-right: 0; border-bottom: 1px solid #dce5ee; }
  .ai-desk-header h1 {
    font-size: 2.2rem;
  }

  .ai-desk-header {
    display: grid;
    align-items: start;
  }
  .ai-desk-header form {
    min-width: 0;
  }
  .ai-desk-header form small {
    text-align: left;
  }
  .ai-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-stat-strip > a {
    min-height: 72px;
    padding: 12px;
    border-bottom: 1px solid #dce5ee;
  }
  .ai-card-head,
  .ai-lead-panel .panel-head,
  .ai-query-console-head,
  .ai-query-results-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .ai-query-form {
    grid-template-columns: 1fr;
  }
  .ai-work-filters {
    grid-template-columns: 1fr 1fr;
  }
  .ai-query-form input,
  .ai-query-form select,
  .ai-query-form button {
    width: 100%;
  }
  .ai-work-filters .btn {
    width: 100%;
  }
  .ai-touch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-recommendation {
    grid-template-columns: 1fr;
  }
  .ai-record-summary,
  .ai-next-action,
  .ai-record-controls,
  .ai-draft-disclosure {
    border-top: 1px solid #e1e8ef;
    border-left: 0;
  }
  .ai-draft-disclosure[open] {
    grid-column: auto;
  }
}

/* Agent-to-admin attorney document request workflow */
.nav-document-requests,
.nav-new-leads,
.nav-alert,
.nav-email {
  position: relative;
}

.nav-document-requests.hot,
.nav-new-leads.hot,
.nav-alert.hot,
.nav-email.hot {
  padding-right: 34px !important;
}

.nav-count-badge {
  position: absolute;
  top: 3px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 950;
}

.nav-count-badge[hidden] {
  display: none !important;
}

.document-request-agent {
  background: #f5b93f !important;
  border-color: #d99a17 !important;
  color: #08213d !important;
}

.document-request-agent.waiting {
  background: #e8eef4 !important;
  border-color: #cbd5e1 !important;
  color: #64748b !important;
  opacity: 1 !important;
}

.agent-document-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #f0b429;
  border-left: 6px solid #f5b93f;
  border-radius: 7px;
  background: #fff9eb;
}

.agent-document-request-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-document-request-copy strong {
  color: #08213d;
}

.agent-document-request-copy span {
  color: #64748b;
  font-size: 13px;
}

.agent-document-request-row .document-request-agent {
  flex: 0 0 auto;
  min-height: 42px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .agent-document-request-row {
    align-items: stretch;
    flex-direction: column;
  }

  .agent-document-request-row .document-request-agent {
    width: 100%;
    white-space: normal;
  }
}

.document-request-queue-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 14px 18px;
  border: 1px solid #f0b429;
  border-left: 7px solid #dc2626;
  border-radius: 7px;
  background: #fff8e8;
  color: #7c2d12;
}

.document-request-queue-alert strong {
  color: #991b1b;
  font-size: 17px;
}

.document-request-filter {
  margin-bottom: 14px;
  padding: 12px !important;
}

.document-request-filter form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, auto) auto auto;
}

.document-request-list {
  display: grid;
  gap: 10px;
}

.document-request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #d7e3ed;
  border-left: 7px solid #f5b93f;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(8, 33, 61, .06);
}

.document-request-card h2 {
  margin: 2px 0 8px;
  font-size: 21px;
}

.document-request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: #475569;
  font-size: 13px;
}

.document-request-meta span {
  display: inline-flex;
  gap: 6px;
}

.document-request-meta b {
  color: #64748b;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .08em;
}

.document-request-card-status,
.document-request-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-request-card-actions form {
  margin: 0;
}

.document-request-email {
  background: #f5b93f !important;
  border-color: #d99a17 !important;
  color: #08213d !important;
}

.document-request-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #f0b429;
  border-radius: 999px;
  background: #fff8e8;
  color: #8a4b08;
  font-size: 12px;
  font-weight: 900;
}

.document-request-state.is-completed {
  border-color: #cbd5e1;
  background: #eef2f6;
  color: #64748b;
}

.document-request-card.is-completed {
  border-left-color: #94a3b8;
  background: #f8fafc;
}

.document-request-card.is-completed .document-request-card-main,
.document-request-card.is-completed .document-request-card-status {
  color: #7b8798;
  opacity: .78;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.document-request-card.is-completed .document-request-card-actions {
  opacity: 1;
  text-decoration: none;
}

@media (max-width: 980px) {
  .document-request-card {
    grid-template-columns: 1fr;
  }

  .document-request-card-status,
  .document-request-card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .document-request-queue-alert {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-request-filter form {
    grid-template-columns: 1fr;
  }

  .document-request-card-actions .btn,
  .document-request-card-actions form,
  .document-request-card-actions button {
    width: 100%;
  }
}

/* Admin-only funder pipeline */
.funder-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.funder-status-ready-to-send,
.funder-status-sent { background: #eaf4ff; border-color: #bdd9f2; color: #0b4f7c; }
.funder-status-documents-requested { background: #fff3cd; border-color: #f4d47e; color: #7a4b00; }
.funder-status-documents-sent { background: #e9f8f4; border-color: #a9dfd1; color: #12624f; }
.funder-status-in-review { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.funder-status-approved { background: #dcfce7; border-color: #86efac; color: #166534; }
.funder-status-funded { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.funder-status-rejected { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.funder-status-sent-to-another-funder { background: #e0f2fe; border-color: #7dd3fc; color: #075985; }
.funder-status-withdrawn { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }

.funder-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.funder-metrics .stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d6e2ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(8, 33, 61, .06);
}

.funder-metrics small,
.funder-case-meta span {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 11px !important;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.funder-metrics strong {
  color: #08213d;
  font-size: 22px;
  line-height: 1;
}

.funder-filter-panel {
  margin-bottom: 10px;
  padding: 12px !important;
}

.funder-filter-panel .filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 260px) auto auto;
  gap: 10px;
  align-items: end;
}

.funder-tracking-list {
  display: grid;
  gap: 8px;
}

.funder-case-card {
  overflow: hidden;
  border: 1px solid #cbdbe8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(8, 33, 61, .06);
}

.funder-case-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid #dce6ee;
  background: linear-gradient(135deg, #f8fbfd, #eef6fb);
}

.funder-case-head h2 {
  margin: 1px 0 3px !important;
  font-size: 20px !important;
  line-height: 1.15 !important;
}

.funder-case-head p:last-child {
  margin: 0;
  color: #52647b;
}

.funder-case-head .eyebrow {
  margin-bottom: 2px !important;
  font-size: 10px !important;
}

.funder-case-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.funder-visibility-form {
  margin: 0;
}

.funder-removed-note {
  display: block;
  margin-top: 4px;
  color: #9a3412;
  font-weight: 800;
}

.funder-case-meta {
  display: grid;
  grid-template-columns: 1fr 1.4fr .8fr .65fr .65fr;
  gap: 0;
  border-bottom: 1px solid #dce6ee;
  background: #fff;
}

.funder-case-meta > div {
  min-width: 0;
  padding: 8px 12px;
  border-right: 1px solid #e2e8f0;
}

.funder-case-meta > div:last-child {
  border-right: 0;
}

.funder-case-meta strong {
  display: block;
  overflow-wrap: anywhere;
  color: #132b48;
  font-size: 13px;
}

.funder-case-meta .badge,
.funder-case-meta .doc-badge {
  min-height: 24px !important;
  padding: 4px 8px !important;
  font-size: 10px !important;
}

.funder-followup-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid #dce6ee;
  background: #fffaf0;
}

.funder-followup-bar > div {
  display: grid;
  min-width: 190px;
  gap: 1px;
}

.funder-followup-bar span {
  color: #9a6500;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.funder-followup-bar strong {
  color: #102a48;
  font-size: 13px;
}

.funder-followup-bar small {
  color: #64748b;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.funder-followup-bar nav {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.funder-followup-bar .btn {
  min-height: 34px;
  padding: 6px 10px;
  border-color: #d7b45b;
  background: #fff;
}

.funder-followup-bar .btn:first-child {
  border-color: #e0a625;
  background: #f8bd3e;
  color: #102947;
}

.funder-followup-bar.is-compact {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid #ead49a;
  border-radius: 7px;
}

.funder-followup-bar.is-disabled {
  background: #f8fafc;
}

.funder-case-workspace {
  background: #f8fafc;
}

.funder-case-workspace > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  cursor: pointer;
  color: #0b4f7c;
  font-size: 13px;
  font-weight: 900;
  list-style-position: inside;
}

.funder-case-workspace > summary:hover {
  background: #edf5fb;
}

.funder-case-workspace > summary small {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.funder-case-workspace[open] > summary {
  border-bottom: 1px solid #dce6ee;
  background: #edf5fb;
}

.funder-case-workspace-body {
  padding-bottom: 12px;
}

.funder-attempt-list {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}

.funder-attempt {
  padding: 16px;
  border: 1px solid #d8e2ea;
  border-left: 5px solid #1e638c;
  border-radius: 8px;
  background: #fff;
}

.funder-attempt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.funder-attempt-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.funder-attempt-heading small {
  color: #64748b;
  text-align: right;
}

.funder-attempt-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, .8fr) minmax(120px, .5fr);
  gap: 12px;
  align-items: end;
}

.funder-attempt-form .funder-wide {
  grid-column: span 3;
}

.funder-attempt-form textarea {
  min-height: 76px !important;
  resize: vertical;
}

.funder-email-history {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #dbe5ed;
}

.funder-email-history-title,
.funder-email-event-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.funder-email-history-title {
  justify-content: space-between;
  color: #123453;
}

.funder-email-history-title span,
.funder-email-event-head small {
  color: #64748b;
  font-size: 12px;
}

.funder-email-event {
  padding: 12px 14px;
  border: 1px solid #d9e5ed;
  border-radius: 7px;
  background: #f8fbfd;
}

.funder-email-event-head strong {
  min-width: 180px;
  flex: 1;
  overflow-wrap: anywhere;
  color: #102a48;
}

.funder-email-event-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  margin-top: 9px;
  color: #4b6077;
  font-size: 12px;
}

.funder-email-event-meta span {
  overflow-wrap: anywhere;
}

.funder-email-event details {
  margin-top: 10px;
}

.funder-email-event summary,
.funder-unmatched-email summary {
  cursor: pointer;
  color: #14557e;
  font-weight: 800;
}

.funder-email-event details p {
  max-height: 280px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 11px;
  border-radius: 6px;
  background: #fff;
  color: #334b63;
  white-space: normal;
}

.funder-unmatched-email {
  margin: 0 20px 16px;
  padding: 14px 16px;
  border: 1px solid #e8c46b;
  border-left: 5px solid #e3a829;
  border-radius: 8px;
  background: #fffaf0;
}

.funder-unmatched-email > p {
  margin: 8px 0 0;
  color: #6f5a25;
}

.funder-form-action {
  grid-column: span 3;
  display: flex;
  justify-content: flex-end;
}

.funder-empty {
  padding: 18px;
  border: 1px dashed #9fb7ca;
  border-radius: 8px;
  background: #fff;
}

.funder-empty p {
  margin: 6px 0 0;
  color: #64748b;
}

.funder-add-another {
  margin: 0;
  padding: 0 14px 2px;
  background: #f8fafc;
}

.funder-add-another summary {
  cursor: pointer;
  padding: 13px 16px;
  border: 1px solid #d5e1ea;
  border-radius: 8px;
  background: #edf5fb;
  color: #0b3b60;
  font-weight: 900;
}

.funder-add-another[open] summary {
  margin-bottom: 12px;
}

.funder-add-another .funder-attempt-form {
  padding: 16px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 980px) {
  .funder-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .funder-filter-panel .filters {
    grid-template-columns: 1fr 1fr;
  }

  .funder-case-meta {
    grid-template-columns: 1fr 1fr;
  }

  .funder-case-meta > div:nth-child(2) {
    border-right: 1px solid #e2e8f0;
  }

  .funder-case-meta > div:nth-child(even) {
    border-right: 0;
  }

  .funder-case-meta > div:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
  }
}

@media (max-width: 680px) {
  .funder-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .funder-filter-panel .filters,
  .funder-attempt-form {
    grid-template-columns: 1fr;
  }

  .funder-attempt-form .funder-wide,
  .funder-form-action {
    grid-column: auto;
  }

  .funder-filter-panel .btn,
  .funder-filter-panel button,
  .funder-form-action button {
    width: 100%;
  }

  .funder-case-head,
  .funder-attempt-heading,
  .funder-followup-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .funder-case-actions {
    justify-content: flex-start;
  }

  .funder-attempt-heading small {
    text-align: left;
  }

  .funder-email-event-meta {
    grid-template-columns: 1fr;
  }

  .funder-case-meta {
    grid-template-columns: 1fr;
  }

  .funder-case-meta > div {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .funder-case-meta > div:last-child {
    border-bottom: 0;
  }

  .funder-attempt-list,
  .funder-add-another {
    padding-left: 12px;
    padding-right: 12px;
  }

  .funder-unmatched-email {
    margin-left: 12px;
    margin-right: 12px;
  }

  .funder-followup-bar nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .funder-followup-bar .btn {
    width: 100%;
    text-align: center;
  }
}

/* UX INTERACTION UPGRADE 20260728: clearer navigation, row actions, mobile scan, and focus states. */
:focus-visible {
  outline: 3px solid rgba(245, 185, 63, .78) !important;
  outline-offset: 3px !important;
}

.app-header {
  box-shadow: 0 8px 22px rgba(8, 33, 61, .06) !important;
}

nav a {
  border: 1px solid transparent !important;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease !important;
}

nav a.nav-active {
  background: #08213d !important;
  color: #ffffff !important;
  border-color: #123f60 !important;
  box-shadow: 0 8px 18px rgba(8, 33, 61, .15) !important;
}

nav a.nav-alert.hot.nav-active {
  background: #991b1b !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

section.panel > form.filters:first-child {
  position: sticky !important;
  top: 84px !important;
  z-index: 12 !important;
  padding: 10px !important;
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: rgba(248, 251, 254, .96) !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .08) !important;
  backdrop-filter: blur(12px) !important;
}

.lead-action-bar {
  position: sticky !important;
  top: 84px !important;
  z-index: 13 !important;
}

.lead-table tr[data-lead-href] {
  cursor: pointer !important;
}

.lead-table tr[data-lead-href] td {
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease !important;
}

.lead-table tr[data-lead-href]:hover td {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 7px 18px rgba(8,33,61,.07) !important;
}

.lead-table tr[data-lead-href]:focus-visible td {
  border-top-color: #f5b93f !important;
  border-bottom-color: #f5b93f !important;
  background: #fffdf5 !important;
}

.lead-table tr[data-lead-href]:focus-visible td:first-child {
  border-left-color: #f5b93f !important;
}

.lead-table .lead-id-cell a,
.lead-table .justcall-phone-link {
  display: inline-flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  border-radius: 6px !important;
}

.lead-table .justcall-phone-link {
  display: inline-flex !important;
  min-height: 28px !important;
  align-items: flex-start !important;
  justify-content: center !important;
  color: #0a4f76 !important;
  font-weight: 950 !important;
}

.lead-table .justcall-phone-link:hover {
  color: #08213d !important;
  text-decoration: none !important;
}

.panel {
  transition: border-color .16s ease, box-shadow .16s ease !important;
}

.panel:focus-within {
  border-color: #b9d7ea !important;
  box-shadow: 0 20px 46px rgba(8, 33, 61, .10) !important;
}

.task-card,
.alert-card,
.comm-card,
.file-row,
.note,
.justcall-call-log-item {
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease !important;
}

.task-card:hover,
.alert-card:hover,
.comm-card:hover,
.file-row:hover,
.note:hover,
.justcall-call-log-item:hover {
  border-color: #bfd7e7 !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .08) !important;
}

.alert-card:not(.alert-read) {
  border-left-width: 7px !important;
  background: #fffdf7 !important;
}

.task-card.task-open {
  border-left-width: 7px !important;
}

.workflow-panel {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 16px 34px rgba(8,33,61,.10) !important;
}

.workflow-field select,
.workflow-field input,
input,
select,
textarea {
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8ecae6 !important;
  box-shadow: 0 0 0 4px rgba(142, 202, 230, .18) !important;
}

.autosave-row {
  align-items: center !important;
  padding-top: 10px !important;
  border-top: 1px solid #edf3f8 !important;
}

.autosave-status[data-mode="saved"] {
  color: #166534 !important;
}

.autosave-status[data-mode="saving"],
.autosave-status[data-mode="pending"] {
  color: #92400e !important;
}

.autosave-status[data-mode="error"] {
  color: #991b1b !important;
}

.lead-hero-summary-item {
  overflow-wrap: anywhere !important;
}

.lead-hero-contact a {
  text-decoration: none !important;
}

.lead-hero-phone:hover,
.lead-hero-email a:hover {
  color: #0a4f76 !important;
}

.lead-side-rail {
  align-self: start !important;
  position: sticky !important;
  top: 92px !important;
}

.lead-side-rail .panel {
  max-width: 100% !important;
}

.funding-summary-panel textarea#funding-request-email-body,
.justcall-panel textarea,
textarea[name="notes"],
textarea[name="body"] {
  resize: vertical !important;
}

@media (min-width: 761px) {
  .lead-table tr[data-lead-href]:hover td:first-child {
    transform: translateX(2px) !important;
  }
}

@media (max-width: 980px) {
  .app-header {
    gap: 10px !important;
    padding: 12px 14px !important;
  }

  .brand-logo {
    width: 210px !important;
    max-width: 78vw !important;
  }

  nav {
    width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    padding-bottom: 4px !important;
    scrollbar-width: thin !important;
  }

  nav a {
    flex: 0 0 auto !important;
  }

  section.panel > form.filters:first-child,
  .lead-action-bar,
  .lead-side-rail {
    position: static !important;
  }
}

@media (max-width: 760px) {
  .lead-table tr[data-lead-href] {
    outline-offset: 2px !important;
  }

  .lead-table tr[data-lead-href]:hover td,
  .lead-table tr[data-lead-href]:focus-visible td {
    box-shadow: none !important;
  }

  .lead-table td {
    grid-template-columns: 104px minmax(0, 1fr) !important;
    align-items: start !important;
  }

  .lead-table .lead-id-cell a,
  .lead-table .justcall-phone-link {
    width: 100% !important;
  }

  .lead-updated-cell,
  .lead-assigned-cell {
    color: #475569 !important;
    font-weight: 850 !important;
  }
}

/* CRM COMMUNICATOR RAIL FINAL OVERRIDE 20260730 */
.lead-side-rail .communicator-log-panel {
  border-color: #b8d5e9 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .08) !important;
}

.lead-side-rail .communicator-log-form .form-grid {
  grid-template-columns: 1fr !important;
  gap: 9px !important;
}

.lead-side-rail .communicator-log-form textarea {
  min-height: 88px !important;
}

.lead-side-rail .communicator-log-form button {
  width: 100% !important;
}

.lead-side-rail .communicator-log-list {
  max-height: 560px !important;
  overflow: auto !important;
  padding-right: 4px !important;
}

.lead-side-rail .communicator-log-list .comm-card {
  padding: 12px !important;
  gap: 5px !important;
}

.lead-side-rail .communicator-log-list .comm-card h3 {
  font-size: 15px !important;
  line-height: 1.15 !important;
  margin: 0 !important;
}

.lead-side-rail .communicator-log-list .comm-card p {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.lead-side-rail .justcall-comm-card {
  border-left: 5px solid #0a4f76 !important;
  background: #f8fbff !important;
}

.comm-meta-pills {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-top: 8px !important;
}

.comm-meta-pills span,
.comm-meta-pills a {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 4px 8px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  color: #243653 !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  text-decoration: none !important;
}

.comm-meta-pills a.recording-link {
  border-color: #86efac !important;
  background: #dcfce7 !important;
  color: #166534 !important;
}

@media (max-width: 1220px) {
  .lead-side-rail .communicator-log-list {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }
}

/* CRM COMMUNICATOR RAIL 20260730 */
.communicator-log-panel {
  border-color: #b8d5e9 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .08) !important;
}

.communicator-log-panel h2 {
  margin-bottom: 4px !important;
}

.communicator-log-panel .muted {
  margin: 0 !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.communicator-log-form {
  gap: 10px !important;
  padding-top: 4px !important;
}

.communicator-log-form .form-grid {
  grid-template-columns: 1fr !important;
  gap: 9px !important;
}

.communicator-log-form textarea {
  min-height: 88px !important;
}

.communicator-log-form button {
  width: 100% !important;
}

.communicator-log-list {
  max-height: 560px !important;
  overflow: auto !important;
  padding-right: 4px !important;
}

.lead-side-rail .communicator-log-list .comm-card {
  padding: 12px !important;
  gap: 5px !important;
}

.lead-side-rail .communicator-log-list .comm-card h3 {
  font-size: 15px !important;
  line-height: 1.15 !important;
  margin: 0 !important;
}

.lead-side-rail .communicator-log-list .comm-card p {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.justcall-comm-card {
  border-left: 5px solid #0a4f76 !important;
  background: #f8fbff !important;
}

.justcall-comm-card h3 {
  color: #0a4f76 !important;
}

.comm-meta-pills {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-top: 8px !important;
}

.comm-meta-pills span,
.comm-meta-pills a {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 4px 8px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  color: #243653 !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  text-decoration: none !important;
}

.comm-meta-pills a.recording-link {
  border-color: #86efac !important;
  background: #dcfce7 !important;
  color: #166534 !important;
}

.uploaded-documents-panel {
  background: #ffffff !important;
}

.uploaded-documents-panel h2 {
  margin-bottom: 6px !important;
}

@media (max-width: 1220px) {
  .communicator-log-list {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }
}

/* CRM COMPACT LAYOUT RESCUE 20260729: restore normal desktop proportions after emergency restore. */
body {
  font-size: 14px !important;
  line-height: 1.42 !important;
}

.app-header {
  gap: 14px !important;
  padding: 10px 22px !important;
  min-height: 74px !important;
}

.brand-logo {
  width: 215px !important;
  max-width: 30vw !important;
}

nav {
  gap: 6px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: thin !important;
}

nav a {
  min-height: 38px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
  font-weight: 850 !important;
}

.nav-alert.hot::after {
  top: 5px !important;
  right: 6px !important;
  width: 7px !important;
  height: 7px !important;
}

.shell {
  width: min(1380px, calc(100% - 36px)) !important;
  margin: 20px auto 56px !important;
}

.toolbar {
  gap: 14px !important;
  margin-bottom: 16px !important;
}

.panel {
  padding: 20px !important;
  box-shadow: 0 12px 30px rgba(8, 33, 61, .08) !important;
}

.stack {
  gap: 14px !important;
}

h1 {
  font-size: clamp(32px, 3vw, 46px) !important;
  line-height: 1.04 !important;
}

h2 {
  margin-bottom: 14px !important;
  font-size: 23px !important;
  line-height: 1.1 !important;
}

h3 {
  font-size: 17px !important;
  line-height: 1.14 !important;
}

p,
.muted,
small {
  line-height: 1.42 !important;
}

label {
  margin-bottom: 5px !important;
  font-size: 14px !important;
}

input,
select,
textarea {
  min-height: 42px !important;
  padding: 9px 12px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
}

textarea {
  min-height: 92px !important;
}

.btn,
button,
input[type="submit"] {
  min-height: 40px !important;
  padding: 9px 14px !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
}

.form-grid {
  gap: 13px !important;
}

.lead-layout {
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 430px) !important;
  gap: 16px !important;
}

.lead-layout-single {
  grid-template-columns: minmax(0, 1fr) !important;
}

.lead-detail-hero {
  padding: 16px 18px !important;
  border-left-width: 7px !important;
}

.lead-detail-hero .eyebrow {
  margin-bottom: 6px !important;
  font-size: 11px !important;
  letter-spacing: .15em !important;
}

.lead-detail-hero h1 {
  max-width: 760px !important;
  font-size: clamp(30px, 2.8vw, 42px) !important;
  line-height: 1.02 !important;
}

.lead-hero-contact {
  gap: 8px 10px !important;
  margin-top: 10px !important;
}

.lead-hero-phone {
  min-height: 38px !important;
  padding: 6px 10px !important;
  font-size: 18px !important;
}

.lead-hero-email {
  min-height: 36px !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

.lead-hero-summary {
  grid-template-columns: repeat(4, minmax(120px, 1fr)) !important;
  gap: 8px !important;
  max-width: 820px !important;
  margin-top: 10px !important;
}

.lead-hero-summary-item {
  min-height: 52px !important;
  padding: 8px 10px !important;
}

.lead-hero-summary-item span {
  margin-bottom: 3px !important;
  font-size: 10px !important;
}

.lead-hero-summary-item strong {
  font-size: 14px !important;
}

.lead-action-bar {
  top: 76px !important;
}

.lead-action-bar .btn,
.lead-action-bar button {
  min-height: 40px !important;
  padding: 9px 12px !important;
}

.workflow-panel {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  padding: 14px !important;
  border-left-width: 7px !important;
}

.workflow-field {
  padding: 11px !important;
}

.workflow-field label {
  font-size: 11px !important;
}

.assignment-dropdown summary {
  min-height: 48px !important;
  padding: 9px 11px !important;
  border-width: 2px !important;
  font-size: 14px !important;
}

.assignment-menu {
  max-height: 190px !important;
}

.lead-side-rail {
  top: 84px !important;
}

.lead-side-rail .panel {
  padding: 14px !important;
}

.lead-side-rail .justcall-panel h2 {
  font-size: 20px !important;
}

.lead-side-rail .justcall-panel .toolbar p:not(.eyebrow) {
  font-size: 12px !important;
}

.justcall-dialer-shell,
.lead-side-rail .justcall-dialer-shell {
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.justcall-dialer-card,
.justcall-sms-card,
.slicktext-sms-card {
  padding: 10px !important;
}

.justcall-status-row {
  gap: 8px !important;
  margin-bottom: 8px !important;
  font-size: 12px !important;
}

.justcall-status-row [data-justcall-status] {
  min-height: 26px !important;
  padding: 4px 9px !important;
  font-size: 12px !important;
}

.justcall-dialer-frame,
.lead-side-rail .justcall-dialer-frame {
  min-height: 480px !important;
  max-height: 520px !important;
}

.justcall-call-log {
  gap: 8px !important;
  margin-top: 10px !important;
  padding-top: 10px !important;
}

.justcall-call-log-item {
  padding: 9px !important;
}

.comm-card,
.note,
.file-row,
.task-card,
.alert-card {
  padding: 11px 12px !important;
}

.comm-card p,
.note p,
.alert-card p,
.justcall-call-log-item p {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.comm-card a,
.note a,
.justcall-call-log-item a {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.funding-summary-panel textarea,
.funding-summary-panel textarea#funding-request-email-body {
  min-height: 300px !important;
}

.lead-table {
  min-width: 1220px !important;
}

.lead-table td,
.lead-table tr[class*="stage-row-"] td,
tr[class*="stage-row-"] td {
  padding: 10px 11px !important;
  line-height: 1.16 !important;
}

.lead-table .lead-id-cell strong {
  font-size: 14px !important;
}

.lead-table .lead-id-cell span,
.lead-table small {
  font-size: 12px !important;
}

.lead-table .badge[class*="stage-"] {
  min-height: 29px !important;
  min-width: 94px !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
}

.lead-table .lead-stage-cell .badge[class*="stage-"] {
  width: 132px !important;
  min-width: 132px !important;
  max-width: 132px !important;
}

.lead-table .lead-stage-cell .badge.priority-low,
.lead-table .lead-stage-cell .badge.priority-normal,
.lead-table .lead-stage-cell .badge.priority-high,
.lead-table .lead-stage-cell .badge.priority-hot {
  min-width: 62px !important;
  max-width: 94px !important;
  min-height: 23px !important;
  font-size: 10.5px !important;
}

@media (max-width: 1220px) {
  .app-header {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  .brand-logo {
    width: 205px !important;
    max-width: 82vw !important;
  }

  nav {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  .lead-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .lead-side-rail {
    position: static !important;
  }

  .lead-side-rail .justcall-dialer-frame {
    max-width: 440px !important;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px !important;
  }

  .app-header {
    padding: 10px 12px !important;
  }

  .shell {
    width: min(100% - 20px, 1380px) !important;
    margin-top: 14px !important;
  }

  .panel {
    padding: 14px !important;
  }

  h1,
  .lead-detail-hero h1 {
    font-size: 29px !important;
  }

  h2 {
    font-size: 21px !important;
  }

  .toolbar {
    flex-direction: column !important;
  }

  .lead-hero-summary,
  .workflow-panel,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .lead-hero-phone {
    width: 100% !important;
    justify-content: center !important;
    font-size: 17px !important;
  }

  .lead-hero-email {
    width: 100% !important;
    justify-content: center !important;
  }

  .lead-table {
    min-width: 0 !important;
  }

  .lead-table td {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    padding: 10px 11px !important;
  }

  .lead-table .lead-stage-cell .badge[class*="stage-"] {
    width: auto !important;
    min-width: 120px !important;
    max-width: 100% !important;
  }

  .justcall-dialer-frame,
  .lead-side-rail .justcall-dialer-frame {
    min-height: 500px !important;
    max-height: none !important;
  }
}

/* Retell Inbox 20260729 */
.toolbar-actions {
  display: flex !important;
  gap: 10px !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
}

.toolbar-actions form {
  margin: 0 !important;
}

.retell-toolbar-card {
  padding: 18px !important;
}

.retell-filter-grid {
  display: grid !important;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) minmax(140px, .7fr) minmax(150px, .7fr) auto auto !important;
  gap: 12px !important;
  align-items: end !important;
}

.retell-inbox-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 14px !important;
}

.retell-pagination {
  margin: 14px 0 !important;
}

.retell-record-card {
  border: 1px solid #d8e5ef !important;
  border-left: 8px solid #0a4f76 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%) !important;
  box-shadow: 0 16px 36px rgba(8, 33, 61, .08) !important;
  padding: 18px !important;
}

.retell-record-card.retell-chat {
  border-left-color: #7c3aed !important;
}

.retell-record-card.retell-converted {
  border-left-color: #22c55e !important;
}

.retell-record-card.retell-unopened {
  border-left-color: #f59e0b !important;
  background: linear-gradient(180deg, #fffdf5 0%, #ffffff 100%) !important;
}

.retell-record-card.retell-opened {
  border-left-color: #94a3b8 !important;
}

.retell-record-card.retell-opened .retell-record-copy {
  opacity: .62;
  text-decoration-line: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(100, 116, 139, .75);
}

.retell-state-row {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.retell-read-state {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 26px !important;
  border-radius: 999px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
}

.retell-read-state.is-unopened {
  background: #fff1c2 !important;
  color: #8a4b00 !important;
  border: 1px solid #f8cf63 !important;
}

.retell-read-state.is-opened {
  background: #e2e8f0 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

.retell-record-head {
  display: flex !important;
  justify-content: space-between !important;
  gap: 18px !important;
  align-items: flex-start !important;
}

.retell-record-head h2 {
  margin: 8px 0 4px !important;
  font-size: 24px !important;
  color: #10213d !important;
}

.retell-record-head p {
  margin: 0 !important;
  color: #657389 !important;
  font-weight: 850 !important;
}

.retell-pill {
  display: inline-flex !important;
  align-items: center !important;
  border: 1px solid #c9dfeb !important;
  border-radius: 999px !important;
  background: #eaf6fb !important;
  color: #0a4f76 !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
  letter-spacing: .08em !important;
}

.retell-record-meta {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin: 16px 0 !important;
}

.retell-record-meta div {
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  padding: 10px !important;
  min-width: 0 !important;
}

.retell-record-meta span {
  display: block !important;
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  margin-bottom: 4px !important;
}

.retell-record-meta strong {
  display: block !important;
  color: #10213d !important;
  font-size: 14px !important;
  overflow-wrap: anywhere !important;
}

.retell-actions {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
}

.retell-actions form {
  margin: 0 !important;
}

/* Admin-owned new-lead SMS automation. Credentials never render back into the page. */
.slicktext-settings {
  margin-top: 18px !important;
  border-left: 6px solid #0f7f85 !important;
}

.slicktext-settings-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 20px !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid #dbe7ef !important;
}

.slicktext-settings-head h2 {
  margin: 4px 0 6px !important;
}

.slicktext-settings-head p:last-child {
  margin-bottom: 0 !important;
}

.slicktext-status {
  flex: none !important;
  display: inline-flex !important;
  align-items: center !important;
  min-height: 34px !important;
  padding: 6px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.slicktext-status.success {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.slicktext-status.danger {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #fca5a5 !important;
}

.slicktext-status.warning {
  background: #fef3c7 !important;
  color: #854d0e !important;
  border-color: #f5c451 !important;
}

.slicktext-switches {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.setting-toggle {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  min-height: 92px !important;
  margin: 0 !important;
  padding: 15px !important;
  border: 1px solid #d8e5ec !important;
  border-radius: 8px !important;
  background: #f8fbfc !important;
  cursor: pointer !important;
}

.setting-toggle.consent {
  border-color: #f4cf79 !important;
  background: #fffbeb !important;
}

.setting-toggle input {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px !important;
  margin: 2px 0 0 !important;
}

.setting-toggle span,
.setting-toggle strong,
.setting-toggle small {
  display: block !important;
}

.setting-toggle small {
  margin-top: 5px !important;
  color: #64748b !important;
  line-height: 1.4 !important;
}

.slicktext-config-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.credential-state {
  display: block !important;
  margin-top: 6px !important;
  color: #64748b !important;
  font-weight: 750 !important;
}

.slicktext-settings .inline-check {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  margin-top: 8px !important;
  color: #9f2f2f !important;
  font-size: 13px !important;
}

.slicktext-settings .inline-check input {
  width: 17px !important;
  height: 17px !important;
  margin: 0 !important;
}

.slicktext-mode-note {
  padding: 14px 16px !important;
  border: 1px solid #d8e5ec !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
}

.slicktext-mode-note p {
  margin: 5px 0 0 !important;
  color: #526173 !important;
}

.slicktext-settings .info {
  padding: 12px 14px !important;
  border: 1px solid #b8dbea !important;
  border-radius: 8px !important;
  background: #f0f9ff !important;
  color: #0c4a6e !important;
  font-weight: 850 !important;
}

.slicktext-legacy-fields {
  padding: 12px 14px !important;
  border: 1px solid #d8e5ec !important;
  border-radius: 8px !important;
  background: #fbfdfe !important;
}

.slicktext-legacy-fields summary {
  cursor: pointer !important;
  color: #526173 !important;
  font-weight: 900 !important;
}

.slicktext-legacy-fields .form-grid {
  margin-top: 14px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.slicktext-test-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  margin-top: 14px !important;
}

.slicktext-test-row form,
.slicktext-test-row p {
  margin: 0 !important;
}

.slicktext-test-row p {
  color: #64748b !important;
  font-size: 13px !important;
  font-weight: 750 !important;
}

.slicktext-check {
  margin-top: 12px !important;
  padding: 12px 14px !important;
  border: 1px solid #d8e5ec !important;
  border-radius: 8px !important;
  font-weight: 750 !important;
}

.slicktext-check strong,
.slicktext-check small {
  display: block !important;
}

.slicktext-check small {
  margin-top: 4px !important;
  font-size: 12px !important;
}

.slicktext-check.success {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}

.slicktext-check.warning {
  background: #fffbeb !important;
  border-color: #f5c451 !important;
  color: #854d0e !important;
}

.slicktext-check.danger {
  background: #fff5f5 !important;
  border-color: #fca5a5 !important;
  color: #991b1b !important;
}

@media (max-width: 900px) {
  .slicktext-settings-head {
    display: grid !important;
  }

  .slicktext-switches,
  .slicktext-config-grid {
    grid-template-columns: 1fr !important;
  }

  .slicktext-legacy-fields .form-grid {
    grid-template-columns: 1fr !important;
  }
}

.btn.danger,
button.danger {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #fecaca !important;
  box-shadow: none !important;
}

.retell-preview {
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #f8fbfe !important;
  padding: 12px !important;
  margin: 10px 0 !important;
}

.retell-preview strong {
  display: block !important;
  color: #10213d !important;
  margin-bottom: 5px !important;
}

.retell-preview p {
  margin: 0 !important;
  color: #42526a !important;
}

.retell-details {
  margin-top: 10px !important;
  border-top: 1px solid #dbe7f0 !important;
  padding-top: 10px !important;
}

.retell-details summary {
  cursor: pointer !important;
  color: #0a4f76 !important;
  font-weight: 950 !important;
}

.retell-details pre {
  white-space: pre-wrap !important;
  overflow-x: auto !important;
  background: #081f3a !important;
  color: #eaf6fb !important;
  border-radius: 8px !important;
  padding: 12px !important;
  max-height: 360px !important;
}

.retell-debug-card {
  display: grid !important;
  grid-template-columns: minmax(0, .85fr) minmax(260px, 1.15fr) !important;
  gap: 16px !important;
  align-items: start !important;
  border-left: 8px solid #f5b72f !important;
}

.retell-debug-help {
  display: grid !important;
  gap: 8px !important;
  padding: 12px !important;
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #f8fbfe !important;
}

.retell-debug-help code {
  display: block !important;
  padding: 10px !important;
  border-radius: 8px !important;
  background: #081f3a !important;
  color: #eaf6fb !important;
  overflow-wrap: anywhere !important;
}

.retell-config-status {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin: 12px 0 !important;
}

.retell-config-status div {
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #f8fbfe !important;
  padding: 9px 10px !important;
  min-width: 0 !important;
}

.retell-config-status span {
  display: block !important;
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
}

.retell-config-status strong {
  display: block !important;
  margin-top: 3px !important;
  color: #10213d !important;
  font-size: 13px !important;
  overflow-wrap: anywhere !important;
}

.retell-config-status strong.ok {
  color: #166534 !important;
}

.retell-config-status strong.bad {
  color: #991b1b !important;
}

.retell-debug-table-wrap {
  overflow-x: auto !important;
}

.retell-debug-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  min-width: 720px !important;
}

.retell-debug-table th,
.retell-debug-table td {
  padding: 10px !important;
  border-bottom: 1px solid #dbe7f0 !important;
  text-align: left !important;
  vertical-align: top !important;
}

.retell-debug-table th {
  color: #41516a !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  letter-spacing: .08em !important;
  background: #f2f7fb !important;
}

.retell-debug-table small {
  display: block !important;
  margin-top: 4px !important;
  color: #64748b !important;
  font-weight: 800 !important;
  overflow-wrap: anywhere !important;
}

.retell-log-status {
  display: inline-flex !important;
  align-items: center !important;
  border-radius: 999px !important;
  padding: 4px 9px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

.retell-log-accepted .retell-log-status,
.retell-log-test-ok .retell-log-status {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.retell-log-forbidden .retell-log-status {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.retell-log-invalid .retell-log-status {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.retell-debug-table details summary {
  color: #0a4f76 !important;
  cursor: pointer !important;
  font-weight: 900 !important;
}

.retell-debug-table pre {
  max-height: 220px !important;
  overflow: auto !important;
  white-space: pre-wrap !important;
  background: #081f3a !important;
  color: #eaf6fb !important;
  padding: 10px !important;
  border-radius: 8px !important;
}

.mini {
  font-size: 13px !important;
}

@media (max-width: 980px) {
  .retell-filter-grid,
  .retell-record-meta {
    grid-template-columns: 1fr 1fr !important;
  }

  .retell-debug-card {
    grid-template-columns: 1fr !important;
  }

  .retell-config-status {
    grid-template-columns: 1fr !important;
  }

  .retell-filter-grid button,
  .retell-filter-grid .btn {
    width: 100% !important;
  }
}

@media (max-width: 700px) {
  .retell-filter-grid,
  .retell-record-meta {
    grid-template-columns: 1fr !important;
  }

  .retell-record-head {
    flex-direction: column !important;
  }

  .retell-actions {
    width: 100% !important;
    justify-content: stretch !important;
  }

  .retell-actions .btn,
  .retell-actions button,
  .retell-actions form {
    width: 100% !important;
  }
}

/* ADMIN DASHBOARD CHARTS 20260728 */
.admin-ops-panel {
  display: grid !important;
  gap: 16px !important;
  margin-top: 22px !important;
  margin-bottom: 22px !important;
  padding: 16px !important;
  border: 1px solid #d9e5ef !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: 0 18px 46px rgba(8, 33, 61, .08) !important;
}

.admin-ops-head,
.chart-card-head,
.agent-chart-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;
}

.admin-ops-head h2,
.chart-card-head h3,
.agent-chart-head h3 {
  margin: 0 !important;
  color: #10213d !important;
}

.admin-date-filter {
  justify-content: flex-end !important;
}

.admin-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) !important;
  gap: 12px !important;
}

.admin-kpi {
  min-height: 106px !important;
  padding: 14px !important;
  border: 1px solid #dbe7f0 !important;
  border-left: 6px solid #0a4f76 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  box-shadow: 0 10px 24px rgba(8, 33, 61, .06) !important;
}

.admin-kpi:nth-child(2) {
  border-left-color: #f59e0b !important;
}

.admin-kpi:nth-child(3) {
  border-left-color: #06b6d4 !important;
}

.admin-kpi:nth-child(4) {
  border-left-color: #7c3aed !important;
}

.admin-kpi.waiting-docs {
  border-left-color: #ef4444 !important;
}

.admin-kpi small,
.agent-metric-grid small,
.chart-card-head span,
.agent-chart-head small,
.agent-chart-foot {
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: .05em !important;
  text-transform: uppercase !important;
}

.admin-kpi strong {
  display: block !important;
  margin-top: 7px !important;
  color: #10213d !important;
  font-size: 26px !important;
  line-height: 1 !important;
}

.admin-kpi span {
  display: block !important;
  margin-top: 8px !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 850 !important;
}

.admin-chart-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr) minmax(300px, .85fr) !important;
  gap: 14px !important;
  align-items: start !important;
}

.chart-card {
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .06) !important;
}

.chart-card.wide {
  min-height: 100% !important;
}

.agent-chart-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(230px, 1fr)) !important;
  gap: 10px !important;
  margin-top: 12px !important;
}

.agent-chart-card {
  display: grid !important;
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: #f8fbff !important;
}

.time-split {
  display: flex !important;
  height: 10px !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  background: #e2e8f0 !important;
}

.time-split span {
  display: block !important;
  min-width: 0 !important;
}

.time-active {
  width: var(--active-width, 0%) !important;
  background: #16a34a !important;
}

.time-idle {
  width: var(--idle-width, 0%) !important;
  background: #f59e0b !important;
}

.agent-metric-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.agent-metric-grid div {
  min-width: 0 !important;
  padding: 8px !important;
  border: 1px solid #e2edf6 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

.agent-metric-grid strong {
  display: block !important;
  margin-top: 3px !important;
  color: #10213d !important;
  font-size: 17px !important;
  line-height: 1 !important;
}

.agent-chart-foot {
  margin: 0 !important;
  color: #64748b !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
  text-transform: none !important;
}

.chart-row {
  display: grid !important;
  gap: 7px !important;
  margin-top: 12px !important;
}

.chart-row-label {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  color: #243653 !important;
  font-weight: 900 !important;
}

.chart-row-label span {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.chart-row-label strong {
  color: #10213d !important;
}

.chart-bar {
  height: 12px !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  background: #e8f0f7 !important;
}

.chart-bar span {
  display: block !important;
  width: var(--bar-width, 0%) !important;
  height: 100% !important;
  border-radius: inherit !important;
  background: var(--bar-color, #0a4f76) !important;
}

.doc-donut {
  display: grid !important;
  place-items: center !important;
  width: 128px !important;
  height: 128px !important;
  margin: 16px auto 8px !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at center, #ffffff 0 54%, transparent 55%),
    conic-gradient(#ef4444 0 var(--waiting, 0%), #16a34a var(--waiting, 0%) 100%) !important;
  box-shadow: inset 0 0 0 1px #dbe7f0, 0 12px 26px rgba(8, 33, 61, .08) !important;
}

.doc-donut strong,
.doc-donut small {
  grid-area: 1 / 1 !important;
}

.doc-donut strong {
  margin-top: -12px !important;
  color: #10213d !important;
  font-size: 28px !important;
  line-height: 1 !important;
}

.doc-donut small {
  margin-top: 34px !important;
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
}

@media (max-width: 1180px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr)) !important;
  }

  .admin-chart-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 760px) {
  .admin-ops-panel {
    padding: 12px !important;
  }

  .admin-ops-head,
  .chart-card-head,
  .agent-chart-head {
    display: grid !important;
  }

  .admin-date-filter {
    justify-content: stretch !important;
  }

  .admin-date-filter input,
  .admin-date-filter button,
  .admin-date-filter a {
    width: 100% !important;
  }

  .admin-kpi-grid,
  .agent-chart-grid,
  .agent-metric-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 18px, 1480px) !important;
    margin-top: 14px !important;
  }

  .toolbar {
    gap: 12px !important;
  }

  .lead-detail-hero {
    padding: 16px !important;
  }

  .lead-detail-hero h1 {
    font-size: 30px !important;
    line-height: 1.08 !important;
  }

  .lead-hero-phone,
  .lead-hero-email {
    justify-content: flex-start !important;
    text-align: left !important;
  }

  .lead-table td {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 11px 12px !important;
  }

  .justcall-dialer-frame {
    min-height: 510px !important;
  }
}

.activity-table td strong,
.activity-table td small {
  display: block;
}

.activity-table td small {
  margin-top: 3px;
  color: #657389;
  font-size: 12px;
  font-weight: 850;
}

.activity-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 950;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.activity-active {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.activity-idle {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.activity-offline {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

/* FINAL OVERRIDE 20260727: keep the upgraded stage column winning after row cleanup rules. */
.lead-table .lead-stage-cell {
  text-align: center !important;
  vertical-align: middle !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.lead-table .lead-stage-cell .badge-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 62px !important;
  padding: 6px 4px !important;
}

.lead-table .lead-stage-cell .badge[class*="stage-"] {
  width: 148px !important;
  min-width: 148px !important;
  max-width: 148px !important;
  min-height: 34px !important;
  padding: 7px 12px !important;
  border-width: 2px !important;
  border-radius: 999px !important;
  font-size: 12.5px !important;
  line-height: 1.05 !important;
  font-weight: 950 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  box-shadow: 0 3px 8px rgba(8, 33, 61, .13), inset 0 1px 0 rgba(255, 255, 255, .78) !important;
}

.lead-table .lead-stage-cell .stage-call-back {
  background: #fff1f2 !important;
  color: #991b1b !important;
  -webkit-text-fill-color: #991b1b !important;
  border-color: #fb7185 !important;
}

.lead-table .lead-stage-cell .stage-got-lawyer-info {
  background: #ecfeff !important;
  color: #155e75 !important;
  -webkit-text-fill-color: #155e75 !important;
  border-color: #22d3ee !important;
}

.lead-table .lead-stage-cell .stage-contacted-lawyer {
  background: #eef2ff !important;
  color: #3730a3 !important;
  -webkit-text-fill-color: #3730a3 !important;
  border-color: #818cf8 !important;
}

.lead-table .lead-stage-cell .stage-documents-collected {
  background: #ccfbf1 !important;
  color: #115e59 !important;
  -webkit-text-fill-color: #115e59 !important;
  border-color: #2dd4bf !important;
}

.lead-table .lead-stage-cell .stage-send-to-funder {
  background: #fffbeb !important;
  color: #92400e !important;
  -webkit-text-fill-color: #92400e !important;
  border-color: #f59e0b !important;
}

.lead-table .lead-stage-cell .stage-funded {
  background: #ecfdf5 !important;
  color: #14532d !important;
  -webkit-text-fill-color: #14532d !important;
  border-color: #22c55e !important;
}

.lead-table .lead-stage-cell .stage-cant-fund {
  background: #fff7ed !important;
  color: #5b341f !important;
  -webkit-text-fill-color: #5b341f !important;
  border-color: #8b5a3c !important;
}

.lead-bottom-email {
  margin-top: 18px !important;
}

.funding-summary-panel textarea#funding-request-email-body {
  min-height: 360px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  line-height: 1.45 !important;
}

.justcall-panel {
  border-color: #dbe5ef !important;
}

.justcall-panel .toolbar {
  align-items: flex-start !important;
  margin-bottom: 8px !important;
}

.justcall-panel textarea {
  min-height: 96px !important;
}

.justcall-panel .filters {
  gap: 8px !important;
}

.justcall-panel .assignment-note {
  color: #657389 !important;
}

.justcall-dialer-shell {
  display: grid !important;
  grid-template-columns: minmax(340px, 390px) minmax(320px, 1fr) !important;
  gap: 16px !important;
  align-items: start !important;
}

.justcall-dialer-card,
.justcall-sms-card,
.slicktext-sms-card {
  border: 1px solid #dbe5ef !important;
  border-radius: 8px !important;
  background: #f8fbff !important;
  padding: 12px !important;
}

.justcall-dialer-card {
  box-shadow: 0 14px 30px rgba(15, 35, 62, .08) !important;
}

.slicktext-sms-card {
  border-left: 4px solid #0f766e !important;
  background: #ffffff !important;
}

.slicktext-composer-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.slicktext-composer-head label {
  display: block !important;
  margin-top: 3px !important;
  font-size: 16px !important;
}

.slicktext-provider {
  color: #0f766e !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: .12em !important;
  text-transform: uppercase !important;
}

.slicktext-composer-state {
  flex: 0 0 auto !important;
  border: 1px solid #fecaca !important;
  border-radius: 8px !important;
  background: #fff1f2 !important;
  color: #991b1b !important;
  padding: 5px 8px !important;
  font-size: 11px !important;
  font-weight: 850 !important;
}

.slicktext-composer-state.is-ready {
  border-color: #86efac !important;
  background: #ecfdf5 !important;
  color: #166534 !important;
}

.slicktext-sms-card textarea {
  min-height: 118px !important;
}

.slicktext-template-picker {
  display: grid !important;
  gap: 7px !important;
  padding: 10px !important;
  border: 1px solid #dbe5ef !important;
  border-radius: 7px !important;
  background: #f6f9fc !important;
}

.slicktext-template-picker > label {
  margin: 0 !important;
  color: #10233f !important;
  font-size: 13px !important;
  font-weight: 850 !important;
}

.slicktext-template-controls {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: stretch !important;
}

.slicktext-template-controls select,
.slicktext-template-controls button {
  min-height: 44px !important;
}

.slicktext-template-picker small {
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
}

.slicktext-sms-card button[disabled] {
  cursor: not-allowed !important;
  opacity: .55 !important;
}

@media (max-width: 640px) {
  .slicktext-template-controls {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .slicktext-template-controls button {
    width: 100% !important;
  }
}

.slicktext-thread {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid #dbe5ef;
}

.slicktext-thread-head,
.slicktext-thread-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slicktext-thread-head h3 {
  margin: 2px 0 0;
  color: #10243f;
  font-size: 18px;
}

.slicktext-thread-head > span,
.slicktext-thread-meta span,
.slicktext-thread-message small {
  color: #66758a;
  font-size: 11px;
  font-weight: 750;
}

.slicktext-thread-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 380px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f6f9fc;
}

.slicktext-thread-message {
  width: min(82%, 620px);
  padding: 10px 12px;
  border: 1px solid #d7e1eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(15, 35, 62, .05);
}

.slicktext-thread-message.inbound {
  align-self: flex-start;
  border-left: 4px solid #0f766e;
}

.slicktext-thread-message.outbound {
  align-self: flex-end;
  border-color: #9fd8cb;
  background: #eaf8f4;
}

.slicktext-thread-message p {
  margin: 5px 0 4px;
  color: #172b46;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.slicktext-thread-empty {
  margin: 0;
  padding: 20px 12px;
  color: #68788c;
  text-align: center;
}

.slicktext-setup-actions {
  align-items: center !important;
  flex-wrap: wrap !important;
}

.slicktext-setup-actions p {
  flex: 1 1 320px !important;
  margin: 0 !important;
}

.justcall-status-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  margin-bottom: 10px !important;
  color: #243653 !important;
  font-size: 13px !important;
}

.justcall-status-row [data-justcall-status] {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 28px !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  padding: 5px 10px !important;
  font-weight: 900 !important;
  text-align: right !important;
}

.justcall-status-row [data-mode="saved"] {
  background: #dcfce7 !important;
  border-color: #bbf7d0 !important;
  color: #166534 !important;
}

.justcall-status-row [data-mode="saving"] {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #075985 !important;
}

.justcall-status-row [data-mode="pending"] {
  background: #fef9c3 !important;
  border-color: #fde68a !important;
  color: #854d0e !important;
}

.justcall-status-row [data-mode="error"] {
  background: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

.justcall-dialer-frame {
  width: 100% !important;
  min-height: 610px !important;
  overflow: hidden !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

.justcall-dialer-frame[hidden],
.lead-side-rail .justcall-dialer-frame[hidden] {
  display: none !important;
  min-height: 0 !important;
  border: 0 !important;
}

.justcall-call-log {
  display: grid !important;
  gap: 9px !important;
  margin-top: 12px !important;
  padding-top: 12px !important;
  border-top: 1px solid #dbe5ef !important;
}

.justcall-call-log-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  color: #243653 !important;
  font-size: 13px !important;
}

.justcall-call-log-head span {
  color: #657389 !important;
  font-size: 11px !important;
  font-weight: 850 !important;
}

.justcall-call-log-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
  padding: 10px !important;
  border: 1px solid #dbe5ef !important;
  border-left: 5px solid #0a4f76 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

.justcall-call-log-item strong,
.justcall-call-log-item small {
  display: block !important;
}

.justcall-call-log-item strong {
  color: #10213d !important;
  font-size: 13px !important;
}

.justcall-call-log-item small {
  color: #657389 !important;
  font-size: 11px !important;
  margin-top: 2px !important;
}

.justcall-call-log-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 5px !important;
}

.justcall-call-log-meta span,
.justcall-call-log-meta a {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 24px !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  background: #f8fafc !important;
  color: #243653 !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  text-decoration: none !important;
}

.justcall-call-log-meta a {
  border-color: #bae6fd !important;
  background: #e0f2fe !important;
  color: #075985 !important;
}

.justcall-call-log-meta a.recording-link {
  border-color: #86efac !important;
  background: #dcfce7 !important;
  color: #166534 !important;
}

.justcall-call-log-meta .recording-pending {
  border-color: #fde68a !important;
  background: #fffbeb !important;
  color: #92400e !important;
}

.justcall-primary-action[aria-busy="true"],
.justcall-phone-link[aria-busy="true"],
.lead-hero-phone[aria-busy="true"] {
  opacity: .72 !important;
  pointer-events: none !important;
}

.justcall-phone-link {
  color: inherit !important;
  text-decoration: none !important;
}

.justcall-phone-link:hover {
  color: #0f5d86 !important;
  text-decoration: underline !important;
}

@media (max-width: 760px) {
  .justcall-dialer-shell {
    grid-template-columns: 1fr !important;
  }

  .slicktext-thread-message {
    width: 94%;
  }

  .justcall-status-row {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  .justcall-dialer-frame {
    min-height: 560px !important;
  }

  .justcall-call-log-item {
    grid-template-columns: 1fr !important;
  }

  .justcall-call-log-meta {
    justify-content: flex-start !important;
  }

  .lead-table .lead-stage-cell {
    text-align: left !important;
  }

  .lead-table .lead-stage-cell .badge-stack {
    align-items: flex-start !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  .lead-table .lead-stage-cell .badge[class*="stage-"] {
    width: auto !important;
    min-width: 130px !important;
    max-width: 100% !important;
  }
}

/* FINAL OVERRIDE 20260726: Salesforce-style stage column upgrade. */
.lead-table .lead-stage-cell {
  text-align: center !important;
  vertical-align: middle !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.lead-table .lead-stage-cell .badge-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 62px !important;
  padding: 6px 4px !important;
}

.lead-table .lead-stage-cell .badge[class*="stage-"] {
  width: 148px !important;
  min-width: 148px !important;
  max-width: 148px !important;
  min-height: 34px !important;
  padding: 7px 12px !important;
  border-width: 2px !important;
  border-radius: 999px !important;
  font-size: 12.5px !important;
  line-height: 1.05 !important;
  font-weight: 950 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  box-shadow: 0 3px 8px rgba(8, 33, 61, .13), inset 0 1px 0 rgba(255, 255, 255, .78) !important;
}

.lead-table .lead-stage-cell .badge.priority-low,
.lead-table .lead-stage-cell .badge.priority-normal,
.lead-table .lead-stage-cell .badge.priority-high,
.lead-table .lead-stage-cell .badge.priority-hot {
  width: auto !important;
  min-width: 70px !important;
  max-width: 104px !important;
  min-height: 25px !important;
  padding: 4px 10px !important;
  border-width: 1px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  box-shadow: none !important;
}

.lead-table .lead-stage-cell .stage-call-back {
  background: #fff1f2 !important;
  color: #991b1b !important;
  -webkit-text-fill-color: #991b1b !important;
  border-color: #fb7185 !important;
}

.lead-table .lead-stage-cell .stage-got-lawyer-info {
  background: #ecfeff !important;
  color: #155e75 !important;
  -webkit-text-fill-color: #155e75 !important;
  border-color: #22d3ee !important;
}

.lead-table .lead-stage-cell .stage-contacted-lawyer {
  background: #eef2ff !important;
  color: #3730a3 !important;
  -webkit-text-fill-color: #3730a3 !important;
  border-color: #818cf8 !important;
}

.lead-table .lead-stage-cell .stage-documents-collected {
  background: #ccfbf1 !important;
  color: #115e59 !important;
  -webkit-text-fill-color: #115e59 !important;
  border-color: #2dd4bf !important;
}

.lead-table .lead-stage-cell .stage-send-to-funder {
  background: #fffbeb !important;
  color: #92400e !important;
  -webkit-text-fill-color: #92400e !important;
  border-color: #f59e0b !important;
}

.lead-table .lead-stage-cell .stage-funded {
  background: #ecfdf5 !important;
  color: #14532d !important;
  -webkit-text-fill-color: #14532d !important;
  border-color: #22c55e !important;
}

.lead-table .lead-stage-cell .stage-cant-fund {
  background: #fff7ed !important;
  color: #5b341f !important;
  -webkit-text-fill-color: #5b341f !important;
  border-color: #8b5a3c !important;
}

@media (max-width: 760px) {
  .lead-table .lead-stage-cell {
    text-align: left !important;
  }

  .lead-table .lead-stage-cell .badge-stack {
    align-items: flex-start !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  .lead-table .lead-stage-cell .badge[class*="stage-"] {
    width: auto !important;
    min-width: 130px !important;
    max-width: 100% !important;
  }
}

/* FINAL OVERRIDE 20260726: make Cant Fund readable without coloring the whole row. */
.lead-table tr.stage-row-cant-fund td:first-child,
tr.stage-row-cant-fund td:first-child {
  border-left-color: #6f3d1f !important;
}
.lead-table .badge.stage-cant-fund,
.lead-table .stage-cant-fund,
.badge.stage-cant-fund {
  background: #4a2c1a !important;
  color: #fff7ed !important;
  border-color: #8b5a3c !important;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.22), 0 1px 2px rgba(8,33,61,.12) !important;
}
.lead-table .badge.stage-cant-fund:hover,
.badge.stage-cant-fund:hover {
  background: #3a2114 !important;
  color: #ffffff !important;
}

/* FINAL OVERRIDE 20260726: make every stage badge more noticeable. */
.lead-table .badge[class*="stage-"],
.badge[class*="stage-"] {
  min-height: 32px !important;
  min-width: 104px !important;
  padding: 7px 13px !important;
  border-width: 2px !important;
  font-size: 13px !important;
  line-height: 1.05 !important;
  font-weight: 950 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  box-shadow: 0 2px 5px rgba(8,33,61,.10), inset 0 -1px 0 rgba(8,33,61,.10) !important;
}
.lead-table .badge.stage-call-back,
.badge.stage-call-back {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #f87171 !important;
}
.lead-table .badge.stage-got-lawyer-info,
.badge.stage-got-lawyer-info {
  background: #cffafe !important;
  color: #155e75 !important;
  border-color: #22d3ee !important;
}
.lead-table .badge.stage-contacted-lawyer,
.badge.stage-contacted-lawyer {
  background: #e0e7ff !important;
  color: #3730a3 !important;
  border-color: #818cf8 !important;
}
.lead-table .badge.stage-lawyer-issues,
.badge.stage-lawyer-issues {
  background: #ffe4e6 !important;
  color: #881337 !important;
  border-color: #e11d48 !important;
}
.lead-table .badge.stage-documents-collected,
.badge.stage-documents-collected {
  background: #ccfbf1 !important;
  color: #115e59 !important;
  border-color: #2dd4bf !important;
}
.lead-table .badge.stage-send-to-funder,
.badge.stage-send-to-funder {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
}
.lead-table .badge.stage-funded,
.badge.stage-funded {
  background: #dcfce7 !important;
  color: #14532d !important;
  border-color: #22c55e !important;
}
.lead-table .badge.stage-need-more-documents,
.badge.stage-need-more-documents {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-color: #fb923c !important;
}
.lead-table .badge.stage-cant-reach-client,
.badge.stage-cant-reach-client {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #94a3b8 !important;
}
.lead-table .badge.stage-new,
.badge.stage-new {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}
.lead-table .badge.stage-cold,
.badge.stage-cold {
  background: #dbeafe !important;
  color: #1e40af !important;
  border-color: #60a5fa !important;
}
.lead-table .badge.stage-warm,
.badge.stage-warm {
  background: #fed7aa !important;
  color: #9a3412 !important;
  border-color: #fb923c !important;
}
.lead-table .badge.stage-hot,
.badge.stage-hot {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #ef4444 !important;
}
.lead-table .badge.stage-cant-fund,
.badge.stage-cant-fund {
  background: #4a2c1a !important;
  color: #fff7ed !important;
  border-color: #8b5a3c !important;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.22), 0 2px 5px rgba(8,33,61,.16) !important;
}

/* FINAL OVERRIDE 20260726: Cant Fund text must stay readable on white rows. */
.lead-stage-cell .badge.stage-cant-fund,
.lead-table .badge.stage-cant-fund,
.lead-table .stage-cant-fund,
.badge.stage-cant-fund,
.stage-cant-fund {
  background: #fff7ed !important;
  color: #5b341f !important;
  -webkit-text-fill-color: #5b341f !important;
  border-color: #8b5a3c !important;
  text-shadow: none !important;
}
.lead-stage-cell .badge.stage-cant-fund *,
.lead-table .badge.stage-cant-fund *,
.lead-table .stage-cant-fund *,
.badge.stage-cant-fund *,
.stage-cant-fund * {
  color: #5b341f !important;
  -webkit-text-fill-color: #5b341f !important;
  text-shadow: none !important;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef7fc 0%, #ffffff 260px);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  letter-spacing: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand-logo { width: 245px; max-width: 52vw; display: block; }
nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #34455f;
  font-weight: 850;
  white-space: nowrap;
}
nav a:hover { background: #edf5fb; color: var(--blue); }
.nav-alert.hot {
  position: relative;
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.nav-alert.hot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
}

.shell {
  width: min(1480px, calc(100% - 48px));
  margin: 34px auto 80px;
}
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.lead-detail-hero {
  --status-bg: #edf3f8;
  --status-accent: #94a3b8;
  --status-border: #d5e1ea;
  padding: 22px 24px;
  border: 1px solid var(--status-border);
  border-left: 8px solid var(--status-accent);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.28), rgba(255,255,255,.70) 92%),
    var(--status-bg);
  box-shadow: 0 12px 32px rgba(8, 33, 61, .11);
}
.lead-hero-main {
  flex: 1 1 620px;
  min-width: 280px;
}
.lead-detail-hero .eyebrow {
  margin-bottom: 10px;
  color: #b77900;
  font-size: 16px;
  letter-spacing: .22em;
}
.lead-detail-hero h1 {
  max-width: 980px;
  margin: 0;
  color: var(--ink);
  font-size: 48px;
  line-height: 1.02;
  letter-spacing: 0;
}
.lead-hero-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 18px;
}
.lead-hero-phone {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid rgba(8, 33, 61, .14);
  border-radius: 8px;
  background: rgba(255,255,255,.68);
  color: #08213d;
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.lead-hero-phone:hover { color: #0f5d86; }
.muted-phone {
  color: #64748b;
  font-size: 26px;
}
.lead-hero-email {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.54);
  color: #34455f;
  font-size: 15px;
  font-weight: 850;
}
.lead-hero-email a {
  color: #123f60;
  text-decoration: none;
}
.lead-hero-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
  max-width: 920px;
  margin-top: 14px;
}
.lead-hero-summary-item {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid rgba(8, 33, 61, .10);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.lead-hero-summary-item span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.lead-hero-summary-item strong {
  display: block;
  color: #08213d;
  font-size: 16px;
  line-height: 1.16;
  font-weight: 950;
}
.lead-detail-hero .filters { justify-content: flex-end; }
.lead-detail-hero .btn.secondary { background: rgba(255,255,255,.88); }
.lead-action-bar {
  align-items: center;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--status-border) 58%, #ffffff);
  border-radius: 8px;
  background: rgba(255,255,255,.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.64);
}
.lead-action-bar .btn,
.lead-action-bar button {
  min-height: 48px;
  padding: 13px 18px;
}
.btn.update,
button.update {
  background: linear-gradient(135deg, var(--navy), #123f60);
  color: white;
  border-color: #09213a;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 12px 22px rgba(8,33,61,.14);
}
.btn.update:hover,
button.update:hover { filter: brightness(1.05); }
.status-theme-new,
.stage-row-new,
.stage-new { --status-bg: #ffffff; --status-badge-bg: #ffffff; --status-accent: #cbd5e1; --status-border: #d9e4ed; --status-text: #10213d; }
.status-theme-contacted,
.stage-row-contacted,
.stage-contacted { --status-bg: #e0f2fe; --status-badge-bg: #bae6fd; --status-accent: #0284c7; --status-border: #7dd3fc; --status-text: #075985; }
.status-theme-got-lawyer-info,
.stage-row-got-lawyer-info,
.stage-got-lawyer-info { --status-bg: #cffafe; --status-badge-bg: #a5f3fc; --status-accent: #0891b2; --status-border: #67e8f9; --status-text: #155e75; }
.status-theme-contacted-lawyer,
.stage-row-contacted-lawyer,
.stage-contacted-lawyer { --status-bg: #e0e7ff; --status-badge-bg: #c7d2fe; --status-accent: #4f46e5; --status-border: #a5b4fc; --status-text: #3730a3; }
.status-theme-lawyer-issues,
.stage-row-lawyer-issues,
.stage-lawyer-issues { --status-bg: #fff1f2; --status-badge-bg: #ffe4e6; --status-accent: #be123c; --status-border: #fda4af; --status-text: #881337; }
.status-theme-documents-collected,
.stage-row-documents-collected,
.stage-documents-collected { --status-bg: #ccfbf1; --status-badge-bg: #99f6e4; --status-accent: #0f766e; --status-border: #5eead4; --status-text: #115e59; }
.status-theme-send-to-funder,
.stage-row-send-to-funder,
.stage-send-to-funder { --status-bg: #fef3c7; --status-badge-bg: #fde68a; --status-accent: #d97706; --status-border: #fcd34d; --status-text: #92400e; }
.status-theme-funded,
.stage-row-funded,
.stage-funded { --status-bg: #dcfce7; --status-badge-bg: #bbf7d0; --status-accent: #16a34a; --status-border: #86efac; --status-text: #14532d; }
.status-theme-cant-fund,
.stage-row-cant-fund,
.stage-cant-fund { --status-bg: #4a2c1a; --status-badge-bg: #2f1b0f; --status-accent: #7c3f1d; --status-border: #8b5a3c; --status-text: #fff7ed; }
.status-theme-need-more-documents,
.stage-row-need-more-documents,
.stage-need-more-documents { --status-bg: #ffedd5; --status-badge-bg: #fed7aa; --status-accent: #f97316; --status-border: #fdba74; --status-text: #9a3412; }
.status-theme-cant-reach-client,
.stage-row-cant-reach-client,
.stage-cant-reach-client { --status-bg: #f3f4f6; --status-badge-bg: #e5e7eb; --status-accent: #6b7280; --status-border: #d1d5db; --status-text: #374151; }
.status-theme-call-back,
.stage-row-call-back,
.stage-call-back { --status-bg: #fee2e2; --status-badge-bg: #fecaca; --status-accent: #f87171; --status-border: #fca5a5; --status-text: #991b1b; }
.status-theme-lead-nurture-not-yet-ready-for-funding,
.stage-row-lead-nurture-not-yet-ready-for-funding,
.stage-lead-nurture-not-yet-ready-for-funding { --status-bg: #f3e8ff; --status-badge-bg: #e9d5ff; --status-accent: #7e22ce; --status-border: #d8b4fe; --status-text: #581c87; }
.status-theme-cold,
.stage-row-cold,
.stage-cold { --status-bg: #dbeafe; --status-badge-bg: #bfdbfe; --status-accent: #2563eb; --status-border: #93c5fd; --status-text: #1e40af; }
.status-theme-warm,
.stage-row-warm,
.stage-warm { --status-bg: #fed7aa; --status-badge-bg: #fdba74; --status-accent: #ea580c; --status-border: #fb923c; --status-text: #9a3412; }
.status-theme-hot,
.stage-row-hot,
.stage-hot { --status-bg: #fee2e2; --status-badge-bg: #fecaca; --status-accent: #dc2626; --status-border: #fca5a5; --status-text: #991b1b; }
.status-theme-not-interested,
.stage-row-not-interested,
.stage-not-interested { --status-bg: #f5f5f4; --status-badge-bg: #e7e5e4; --status-accent: #78716c; --status-border: #d6d3d1; --status-text: #44403c; }
.status-theme-new-cold-lead,
.stage-row-new-cold-lead,
.stage-new-cold-lead { --status-bg: #f0f9ff; --status-badge-bg: #e0f2fe; --status-accent: #0369a1; --status-border: #bae6fd; --status-text: #075985; }
.status-theme-pitched-funding-call,
.stage-row-pitched-funding-call,
.stage-pitched-funding-call { --status-bg: #fef9c3; --status-badge-bg: #fef08a; --status-accent: #ca8a04; --status-border: #fde047; --status-text: #854d0e; }
.status-theme-pitched-mva-transfer-and-funding,
.stage-row-pitched-mva-transfer-and-funding,
.stage-pitched-mva-transfer-and-funding { --status-bg: #f3e8ff; --status-badge-bg: #e9d5ff; --status-accent: #9333ea; --status-border: #d8b4fe; --status-text: #6b21a8; }
.status-theme-working-pre-funding-case,
.stage-row-working-pre-funding-case,
.stage-working-pre-funding-case { --status-bg: #ecfccb; --status-badge-bg: #d9f99d; --status-accent: #65a30d; --status-border: #bef264; --status-text: #3f6212; }
.status-theme-send-to-funding-intake,
.stage-row-send-to-funding-intake,
.stage-send-to-funding-intake { --status-bg: #eff6ff; --status-badge-bg: #dbeafe; --status-accent: #1d4ed8; --status-border: #bfdbfe; --status-text: #1e3a8a; }
.status-theme-cold-follow-up,
.stage-row-cold-follow-up,
.stage-cold-follow-up { --status-bg: #fae8ff; --status-badge-bg: #f5d0fe; --status-accent: #c026d3; --status-border: #f0abfc; --status-text: #86198f; }
h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}
h2 { font-size: 30px; line-height: 1.08; margin: 0 0 18px; }
h3 { font-size: 20px; margin: 0 0 10px; }
p { color: var(--muted); line-height: 1.52; }
.eyebrow {
  color: var(--gold);
  font-weight: 950;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.stack { display: grid; gap: 18px; }
.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(360px, .92fr);
  gap: 22px;
  align-items: start;
}
.lead-layout-single { grid-template-columns: minmax(0, 1fr); }
.lead-side-rail {
  position: sticky;
  top: 18px;
  align-self: start;
}
.lead-side-rail .panel {
  padding: 18px;
}
.lead-side-rail .justcall-panel {
  border-color: #b9d7ea !important;
  background: linear-gradient(180deg, #ffffff 0%, #f5fbff 100%) !important;
  box-shadow: 0 16px 34px rgba(8, 33, 61, .13) !important;
}
.lead-side-rail .justcall-panel h2 {
  margin-bottom: 6px;
  font-size: 24px;
}
.lead-side-rail .justcall-panel .toolbar {
  gap: 12px !important;
  margin-bottom: 12px !important;
}
.lead-side-rail .justcall-panel .toolbar p:not(.eyebrow) {
  margin: 0;
  font-size: 13px;
}
.lead-side-rail .justcall-panel .filters {
  width: 100%;
}
.lead-side-rail .justcall-panel .filters .btn,
.lead-side-rail .justcall-panel .filters button {
  flex: 1 1 145px;
}
.lead-side-rail .justcall-dialer-shell {
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}
.lead-side-rail .justcall-dialer-card,
.lead-side-rail .justcall-sms-card,
.lead-side-rail .slicktext-sms-card {
  padding: 10px !important;
}
.lead-side-rail .justcall-dialer-frame {
  min-height: 560px !important;
}
.lead-side-rail .justcall-status-row {
  align-items: flex-start !important;
  flex-direction: column !important;
}
.lead-side-rail .justcall-status-row [data-justcall-status] {
  width: 100% !important;
  justify-content: center !important;
  text-align: center !important;
}
.sales-dialer-panel {
  margin-bottom: 18px;
  border-color: #b9d7ea;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,251,255,.98)),
    #ffffff;
}
.sales-dialer-panel .toolbar {
  margin-bottom: 4px;
}
.sales-dialer-panel h2 {
  margin-bottom: 8px;
}
.sales-dialer-form {
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fbff;
}
.sales-dialer-form button[type="submit"] {
  min-height: 52px;
  background: linear-gradient(135deg, #08213d, #0a4f76);
  color: #ffffff;
  border-color: #08213d;
}
.compact-table table {
  min-width: 760px;
}
.compact-table td,
.compact-table th {
  padding: 10px 11px;
}
.compact-table small {
  display: block;
  margin-top: 3px;
}
.btn.tiny {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}
.stat strong { display: block; font-size: 34px; }

.btn, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid #d19b1b;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(8, 33, 61, .12);
  white-space: nowrap;
}
.btn.secondary, button.secondary, .secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.btn.danger, button.danger {
  background: #fff5f5;
  border-color: #fecaca;
  color: var(--danger);
}
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dashboard-actions,
.lead-book-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
  width: min(460px, 100%);
}
.lead-book-actions {
  width: min(380px, 100%);
}
.dashboard-actions .btn,
.lead-book-actions .btn {
  width: 100%;
  min-height: 48px;
  text-align: center;
  white-space: normal;
}
.user-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  min-width: 360px;
}
.user-contact-grid input {
  min-height: 40px;
  padding: 9px 10px;
  font-size: 14px;
}
.user-contact-grid button {
  min-height: 40px;
  padding: 9px 12px;
}
.delete-user-form {
  display: grid;
  gap: 8px;
  min-width: 210px;
}
.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}
.inline-check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin-top: 1px;
}

label {
  display: block;
  color: var(--ink);
  font-weight: 950;
  margin: 0 0 7px;
}
input, select, textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cbdbea;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}
textarea { min-height: 118px; resize: vertical; }
input::placeholder { color: #7c8796; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field.full { grid-column: 1 / -1; }

.workflow-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
  border-left: 10px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(135deg, #08213d, #0e668c);
}
.workflow-field {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255,255,255,.1);
}
.workflow-field label { color: #fff; text-transform: uppercase; letter-spacing: .08em; }
.workflow-field select, .workflow-field input { background: #fff; color: var(--ink); }
.assignment-picker {
  display: grid;
  gap: 8px;
}
.workflow-field .assignment-select {
  width: 100%;
  min-height: 92px;
  padding: 8px;
  border: 3px solid #22c55e;
  border-radius: 8px;
  background: #fff;
  color: #14532d;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.assignment-select option {
  padding: 8px;
  border-radius: 6px;
}
.assign-lead-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #22c55e;
  color: #052e16;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.assign-lead-button:hover { background: #4ade80; }
.assignment-note {
  display: block;
  color: rgba(255,255,255,.88);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
}
.assignment-dropdown {
  position: relative;
  z-index: 4;
}
.assignment-dropdown[open] { z-index: 20; }
.assignment-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 13px 14px;
  border: 3px solid #22c55e;
  border-radius: 8px;
  background: #fff;
  color: #14532d;
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
  list-style: none;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.assignment-dropdown summary::-webkit-details-marker { display: none; }
.assignment-dropdown summary::after {
  content: "v";
  color: #0f766e;
  font-size: 20px;
  line-height: 1;
}
.assignment-dropdown[open] summary::after { content: "^"; }
.assignment-dropdown summary small {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}
.assignment-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
  padding: 8px;
  border: 2px solid #22c55e;
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .18);
}
.assignment-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 7px;
  color: #14532d;
  font-size: 14px;
}
.assignment-check:hover { background: #ecfdf5; }
.assignment-check input {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  box-shadow: none;
}
.assignment-check span { font-weight: 900; }
.assignment-check small { color: #64748b; font-weight: 800; }
.assignment-readonly {
  min-height: 48px;
  padding: 11px 12px;
  border: 2px solid #22c55e;
  border-radius: 8px;
  background: white;
  color: #14532d;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.assignment-readonly span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}
.workflow-hint { display: block; margin-top: 9px; color: rgba(255,255,255,.85); font-weight: 850; }
.autosave-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lead-create-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
}
.lead-create-command strong {
  display: block;
  color: #14532d;
  font-size: 18px;
  font-weight: 950;
}
.lead-create-command span {
  display: block;
  margin-top: 3px;
  color: #3f6f54;
  font-weight: 850;
}
.lead-create-command button {
  flex: 0 0 auto;
  min-width: 190px;
}
.autosave-status {
  color: var(--muted);
  font-weight: 850;
}
.autosave-status[data-mode="saved"] { color: #15803d; }
.autosave-status[data-mode="error"] { color: var(--danger); }
.required-field {
  display: inline-block;
  margin-left: 6px;
  color: #b45309;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.justcall-missing-phone {
  border-color: #f5c451 !important;
  background: #fffaf0 !important;
}
.justcall-missing-phone .btn {
  align-self: flex-start;
}

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f4f8fb; color: #34455f; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
td { font-weight: 720; color: #243653; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.lead-table {
  min-width: 1260px;
  table-layout: fixed;
}
.lead-table th,
.lead-table td {
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.lead-col-lead { width: 160px; }
.lead-col-contact { width: 210px; }
.lead-col-dob { width: 135px; }
.lead-col-case { width: 150px; }
.lead-col-stage { width: 165px; }
.lead-col-docs { width: 145px; }
.lead-col-attorney { width: 180px; }
.lead-col-funding { width: 140px; }
.lead-col-assigned { width: 120px; }
.lead-col-updated { width: 175px; }
.lead-col-action { width: 96px; }
.lead-id-cell a,
.lead-id-cell span,
.lead-table small,
.lead-table td strong {
  display: block;
}
.lead-table small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 850;
}
.lead-stage-cell .badge-stack {
  display: grid;
  justify-items: start;
  gap: 7px;
}
.lead-docs-cell {
  text-align: center;
}
.lead-docs-cell .badge {
  width: 100%;
  max-width: 132px;
  justify-content: center;
}
.lead-attorney-cell strong {
  max-width: 100%;
}
.lead-action-cell form {
  margin: 0;
}
.lead-action-cell button {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
  white-space: normal;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 950;
  font-size: 13px;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.1;
}
.badge[class*="stage-"] {
  background: var(--status-badge-bg, #e9f4fb);
  color: var(--status-text, #0d5479);
  border-color: var(--status-border, #c9e5f5);
}
.priority-hot, .priority-high { background: #fff7ed; color: #9a3412; border-color: #fdba74; }
.priority-low { background: #f8fafc; color: #64748b; }
.doc-not-requested { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.doc-requested { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.doc-partial { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.doc-received { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.task-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.task-card {
  border: 1px solid var(--line);
  border-left: 7px solid #38bdf8;
  border-radius: 8px;
  padding: 13px;
  background: #fbfdff;
}
.task-card.task-done {
  border-left-color: #22c55e;
  background: #f0fdf4;
}
.task-card.task-canceled {
  border-left-color: #94a3b8;
  background: #f8fafc;
  opacity: .78;
}
.task-card h3 { margin: 8px 0 6px; font-size: 17px; }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.task-actions button { padding: 8px 10px; font-size: 13px; }
.task-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  border: 1px solid #bae6fd;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 950;
}
.task-badge.task-done { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.task-badge.task-canceled { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.alerts-panel {
  border-color: #cfe0ec;
}
.alert-filter-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border-color: #bfd8e8;
  background: #f8fbfd;
}
.alert-filter-panel form {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(175px, .75fr) minmax(155px, .65fr) auto auto;
  gap: 10px;
  align-items: end;
}
.alert-filter-panel label {
  display: grid;
  gap: 6px;
  color: #10213d;
  font-size: 13px;
  font-weight: 900;
}
.alert-filter-panel input,
.alert-filter-panel select {
  width: 100%;
  min-width: 0;
}
.alert-filter-panel > p {
  margin: 0;
  color: #657389;
  font-size: 13px;
  font-weight: 800;
}
.alert-filter-panel > p strong {
  color: #0e7490;
}
.alert-filter-empty {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 5px;
  text-align: center;
}
.alert-filter-empty h2,
.alert-filter-empty p {
  margin: 0;
}
.alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid #cfe0ec;
  border-left: 7px solid #dc2626;
  border-radius: 8px;
  padding: 14px;
  background: #fff7f7;
  box-shadow: 0 10px 22px rgba(8, 33, 61, .06);
}
.alert-card.alert-read {
  border-left-color: #94a3b8;
  background: #f8fafc;
  opacity: .78;
}
.alert-card.alert-read > div:first-child small,
.alert-card.alert-read > div:first-child h3,
.alert-card.alert-read > div:first-child strong,
.alert-card.alert-read > div:first-child p {
  text-decoration-line: line-through;
  text-decoration-color: #64748b;
  text-decoration-thickness: 2px;
}
.alert-card h3 {
  margin: 4px 0 6px;
  color: #10213d;
  font-size: 18px;
}
.alert-card strong {
  display: block;
  color: #243653;
  font-size: 14px;
}
.alert-card p {
  margin: 6px 0 0;
  color: #657389;
  font-weight: 750;
}
.alert-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}
.alert-card-actions form {
  margin: 0;
}
.new-lead-queue-head {
  align-items: flex-start;
  gap: 20px;
}
.new-lead-queue-head > div:first-child {
  max-width: 850px;
}
.new-lead-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid #cfe0ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(8, 33, 61, .06);
}
.new-lead-summary a {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid #dce7ef;
  color: #10213d;
  text-decoration: none;
}
.new-lead-summary a:last-child {
  border-right: 0;
}
.new-lead-summary a:hover,
.new-lead-summary a:focus-visible {
  background: #f0f9ff;
}
.new-lead-summary small {
  color: #657389;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.new-lead-summary strong {
  color: #0b3152;
  font-size: 30px;
  line-height: 1;
}
.new-lead-filter-panel {
  margin-bottom: 14px;
  padding: 14px;
}
.new-lead-filter-panel form {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}
.new-lead-filter-panel label {
  display: grid;
  gap: 6px;
  color: #10213d;
  font-weight: 900;
}
.new-lead-filter-panel select {
  width: 100%;
}
.new-leads-panel .alert-card.alert-new-lead {
  border-left-color: #0e7490;
  background: #f0f9ff;
}
.new-leads-panel .alert-card.alert-duplicate {
  border-left-color: #d97706;
  background: #fff7ed;
}
.alert-type-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 3px;
  padding: 4px 8px;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.alert-duplicate .alert-type-pill {
  border-color: #fed7aa;
  background: #ffedd5;
  color: #9a3412;
}
.lead-assignment-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin: 8px 0 7px;
  padding: 6px 10px;
  border: 1px solid #b9dfc8;
  border-radius: 7px;
  background: #edf9f1;
  color: #14532d;
  font-size: 13px;
  line-height: 1.2;
}
.lead-assignment-chip span {
  color: #4b6656;
  font-weight: 700;
}
.lead-assignment-chip strong {
  color: inherit;
  font-weight: 900;
}
.lead-assignment-chip.is-unassigned {
  border-color: #f3c5c5;
  background: #fff1f1;
  color: #9b1c1c;
}
.lead-assignment-chip.is-unassigned span {
  color: #8b4b4b;
}
.new-lead-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 30px;
  text-align: center;
}
.new-lead-empty h2,
.new-lead-empty p {
  margin: 0;
}
.new-lead-dashboard-panel {
  border-top: 4px solid #f5b93f;
}

@media (max-width: 760px) {
  .alert-filter-panel form {
    grid-template-columns: 1fr;
  }
  .alert-filter-panel .btn {
    width: 100%;
  }
  .new-lead-queue-head {
    display: grid;
  }
  .new-lead-queue-head .alert-page-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .new-lead-queue-head .alert-page-actions form,
  .new-lead-queue-head .alert-page-actions button {
    width: 100%;
  }
  .new-lead-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .new-lead-summary a {
    border-bottom: 1px solid #dce7ef;
  }
  .new-lead-summary a:nth-child(2n) {
    border-right: 0;
  }
  .new-lead-summary a:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .new-lead-filter-panel form {
    grid-template-columns: 1fr;
  }
  .new-lead-filter-panel .btn {
    width: 100%;
  }
}
tr[class*="stage-row-"],
tr[class*="stage-row-"] td {
  background: var(--status-bg, #ffffff) !important;
  background-color: var(--status-bg, #ffffff) !important;
  color: var(--status-text, #243653);
}
tr[class*="stage-row-"] td:first-child { border-left: 7px solid var(--status-accent, #cbd5e1); }
tr[class*="stage-row-"] a,
tr[class*="stage-row-"] strong { color: var(--status-text, #243653); }
tr.stage-row-new td {
  font-weight: 950;
}
tr.stage-row-new .lead-id-cell a {
  font-weight: 950;
}
tr[class*="stage-row-"]:hover td {
  background: color-mix(in srgb, var(--status-bg, #ffffff) 78%, #ffffff) !important;
  background-color: var(--status-bg, #ffffff) !important;
}

.status-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.file-row, .note, .comm-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.file-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
small, .muted { color: var(--muted); }
.login-wrap { max-width: 440px; margin: 7vh auto; }
.alert { border: 1px solid #fecaca; background: #fff5f5; color: #991b1b; padding: 12px 14px; border-radius: 8px; font-weight: 850; }
.success { border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; padding: 12px 14px; border-radius: 8px; font-weight: 850; }
.funding-summary-panel textarea { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 650; line-height: 1.45; }
.lead-bottom-email { margin-top: 18px; }

@media (max-width: 980px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  nav { justify-content: flex-start; }
  .shell { width: min(100% - 28px, 1480px); margin-top: 22px; }
  .toolbar { flex-direction: column; }
  .dashboard-actions,
  .lead-book-actions {
    width: 100%;
    max-width: 520px;
  }
  .lead-layout, .grid-3, .grid-4, .form-grid, .workflow-panel { grid-template-columns: 1fr; }
  .lead-side-rail { position: static; }
  .lead-hero-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-detail-hero h1 { font-size: 42px; }
  h1 { font-size: 44px; }
  .brand-logo { max-width: 84vw; }
}

@media (max-width: 560px) {
  .panel { padding: 18px; }
  .lead-detail-hero { padding: 20px; }
  .lead-detail-hero h1 { font-size: 34px; }
  .lead-hero-phone { width: 100%; justify-content: center; font-size: 23px; }
  .lead-hero-email { width: 100%; justify-content: center; }
  .lead-hero-summary { grid-template-columns: 1fr; }
  .workflow-panel { padding: 14px; }
  .btn, button, input[type="submit"] { width: 100%; white-space: normal; }
  .filters { width: 100%; }
  .dashboard-actions,
  .lead-book-actions {
    grid-template-columns: 1fr;
  }
  nav a { padding: 8px 9px; font-size: 14px; }
  .alert-card {
    grid-template-columns: 1fr;
  }
  .alert-card-actions {
    justify-content: stretch;
  }
  .alert-card-actions .btn,
  .alert-card-actions button {
    flex: 1 1 120px;
  }
}

@media (max-width: 760px) {
  .lead-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .lead-table {
    display: block;
    min-width: 0;
    background: transparent;
  }
  .lead-table thead {
    display: none;
  }
  .lead-table tbody,
  .lead-table tr,
  .lead-table td {
    display: block;
    width: 100%;
  }
  .lead-table tr {
    margin: 0 0 14px;
    border: 1px solid var(--status-border, var(--line));
    border-left: 7px solid var(--status-accent, #cbd5e1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(8, 33, 61, .10);
  }
  .lead-table tr[class*="stage-row-"] td:first-child {
    border-left: 0;
  }
  .lead-table td {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
  }
  .lead-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .lead-stage-cell .badge-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
  }
  .lead-stage-cell .badge-stack,
  .lead-stage-cell .badge,
  .lead-docs-cell .badge {
    justify-self: start;
    width: auto;
    max-width: 100%;
  }
  .lead-docs-cell {
    text-align: left;
  }
  .lead-action-cell button {
    justify-self: stretch;
  }
}

/* FINAL OVERRIDE 20260726: keep lead-book rows clean white on live CRM. */
.lead-table-wrap {
  border: 1px solid #d9e5ef !important;
  border-radius: 8px !important;
  background: #f8fbfe !important;
  box-shadow: 0 18px 46px rgba(8, 33, 61, .08) !important;
}
.lead-table {
  min-width: 1320px !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 7px !important;
  padding: 8px !important;
  background: transparent !important;
}
.lead-table th {
  padding: 9px 12px !important;
  border: 0 !important;
  background: transparent !important;
  color: #6b7b91 !important;
  font-size: 11px !important;
  letter-spacing: .08em !important;
}
.lead-table td,
.lead-table tr[class*="stage-row-"] td,
tr[class*="stage-row-"] td {
  padding: 13px 12px !important;
  border-top: 1px solid #e2edf6 !important;
  border-bottom: 1px solid #e2edf6 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #243653 !important;
  line-height: 1.22 !important;
  vertical-align: top !important;
}
.lead-table td:first-child,
.lead-table tr[class*="stage-row-"] td:first-child,
tr[class*="stage-row-"] td:first-child {
  border-left: 7px solid var(--status-accent, #cbd5e1) !important;
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
}
.lead-table td:last-child {
  border-right: 1px solid #e2edf6 !important;
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}
.lead-table tr[class*="stage-row-"]:hover td,
tr[class*="stage-row-"]:hover td {
  background: #fbfdff !important;
  background-color: #fbfdff !important;
  border-top-color: #cfe0ec !important;
  border-bottom-color: #cfe0ec !important;
}
.lead-table tr[class*="stage-row-"] a,
.lead-table tr[class*="stage-row-"] strong,
tr[class*="stage-row-"] a,
tr[class*="stage-row-"] strong {
  color: #172a45 !important;
}
.lead-table .lead-id-cell strong {
  color: #0b3556 !important;
  font-size: 15px !important;
  letter-spacing: .01em !important;
}
.lead-table .lead-id-cell span {
  margin-top: 3px !important;
  color: #243653 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}
.lead-table small {
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}
.lead-table .badge {
  min-height: 28px !important;
  padding: 5px 10px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  box-shadow: none !important;
}
.lead-table .badge[class*="stage-"] {
  background: #f8fafc !important;
  color: var(--status-text, #0d5479) !important;
  border-color: color-mix(in srgb, var(--status-border, #c9e5f5) 76%, #ffffff) !important;
}
.lead-table .stage-cant-fund {
  background: #f8fafc !important;
  color: #5b341f !important;
  border-color: #c89b78 !important;
}
.lead-table .doc-requested,
.lead-table .doc-not-requested,
.lead-table .doc-partial,
.lead-table .doc-received {
  min-width: 112px !important;
  background: #f8fafc !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
.lead-table .doc-received {
  background: #ecfdf5 !important;
  color: #166534 !important;
  border-color: #bbf7d0 !important;
}
.lead-table .doc-requested {
  background: #fffbeb !important;
  color: #92400e !important;
  border-color: #fde68a !important;
}
.lead-col-lead { width: 175px !important; }
.lead-col-contact { width: 210px !important; }
.lead-col-dob { width: 130px !important; }
.lead-col-case { width: 155px !important; }
.lead-col-stage { width: 175px !important; }
.lead-col-docs { width: 150px !important; }
.lead-col-attorney { width: 185px !important; }
.lead-col-funding { width: 145px !important; }
.lead-col-assigned { width: 110px !important; }
.lead-col-updated { width: 175px !important; }
.lead-col-action { width: 96px !important; }

@media (max-width: 760px) {
  .lead-table {
    min-width: 0 !important;
    padding: 0 !important;
    border-spacing: 0 !important;
  }
  .lead-table tr[class*="stage-row-"] {
    background: #ffffff !important;
    border-left: 7px solid var(--status-accent, #cbd5e1) !important;
  }
  .lead-table tr[class*="stage-row-"] td {
    background: #ffffff !important;
  }
}

/* TRUE FINAL UX OVERRIDE 20260728: interaction polish must win after legacy live-row cleanup. */
nav a.nav-active {
  background: #08213d !important;
  color: #ffffff !important;
  border-color: #123f60 !important;
  box-shadow: 0 8px 18px rgba(8, 33, 61, .15) !important;
}

nav a.nav-alert.hot.nav-active {
  background: #991b1b !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

section.panel > form.filters:first-child {
  position: sticky !important;
  top: 84px !important;
  z-index: 12 !important;
  padding: 10px !important;
  border: 1px solid #dbe7f0 !important;
  border-radius: 8px !important;
  background: rgba(248, 251, 254, .96) !important;
  box-shadow: 0 12px 28px rgba(8, 33, 61, .08) !important;
  backdrop-filter: blur(12px) !important;
}

.lead-action-bar {
  position: sticky !important;
  top: 84px !important;
  z-index: 13 !important;
}

.lead-table tr[data-lead-href] {
  cursor: pointer !important;
}

.lead-table tr[data-lead-href] td {
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease !important;
}

.lead-table tr[data-lead-href]:hover td {
  background: #f8fbff !important;
  background-color: #f8fbff !important;
  border-top-color: #bfd7e7 !important;
  border-bottom-color: #bfd7e7 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 7px 18px rgba(8,33,61,.07) !important;
}

.lead-table tr[data-lead-href]:focus-visible td {
  border-top-color: #f5b93f !important;
  border-bottom-color: #f5b93f !important;
  background: #fffdf5 !important;
  background-color: #fffdf5 !important;
}

.lead-table tr[data-lead-href]:focus-visible td:first-child {
  border-left-color: #f5b93f !important;
}

.lead-table .lead-id-cell a,
.lead-table .justcall-phone-link {
  display: inline-flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  border-radius: 6px !important;
}

.lead-table .justcall-phone-link {
  min-height: 28px !important;
  align-items: flex-start !important;
  justify-content: center !important;
  color: #0a4f76 !important;
  font-weight: 950 !important;
}

.lead-table .justcall-phone-link:hover {
  color: #08213d !important;
  text-decoration: none !important;
}

.lead-side-rail {
  align-self: start !important;
  position: sticky !important;
  top: 92px !important;
}

.alert-card:not(.alert-read),
.task-card.task-open {
  border-left-width: 7px !important;
}

@media (min-width: 761px) {
  .lead-table tr[data-lead-href]:hover td:first-child {
    transform: translateX(2px) !important;
  }
}

@media (max-width: 980px) {
  .app-header {
    gap: 10px !important;
    padding: 12px 14px !important;
  }

  .brand-logo {
    width: 210px !important;
    max-width: 78vw !important;
  }

  nav {
    width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    padding-bottom: 4px !important;
    scrollbar-width: thin !important;
  }

  nav a {
    flex: 0 0 auto !important;
  }

  section.panel > form.filters:first-child,
  .lead-action-bar,
  .lead-side-rail {
    position: static !important;
  }
}

@media (max-width: 760px) {
  .lead-table tr[data-lead-href] {
    outline-offset: 2px !important;
  }

  .lead-table tr[data-lead-href]:hover td,
  .lead-table tr[data-lead-href]:focus-visible td {
    box-shadow: none !important;
  }

  .lead-table td {
    grid-template-columns: 104px minmax(0, 1fr) !important;
    align-items: start !important;
  }

  .lead-table .lead-id-cell a,
  .lead-table .justcall-phone-link {
    width: 100% !important;
  }

  .lead-updated-cell,
  .lead-assigned-cell {
    color: #475569 !important;
    font-weight: 850 !important;
  }
}
/* Admin email center */
.table-secondary{display:block;margin-top:4px;color:#64748b;font-size:.78rem;font-weight:700;overflow-wrap:anywhere}
.email-account-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:14px;margin:20px 0}.email-account-card{display:grid;gap:5px;padding:18px;border:1px solid #d8e2ec;border-left:4px solid #f5b62f;border-radius:8px;background:#fff;box-shadow:0 8px 22px rgba(13,45,74,.07)}.email-account-card span,.email-account-card small{color:#64748b}.email-account-card form{margin-top:8px}.email-center-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:20px;align-items:start}.email-compose-form textarea{min-height:260px}.email-attachments{border:1px solid #d8e2ec;border-radius:8px;padding:14px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.email-attachments legend{font-weight:800;padding:0 8px}.email-attachment{display:flex;align-items:flex-start;gap:10px;padding:10px;border:1px solid #e4eaf0;border-radius:7px;background:#f8fafc}.email-attachment input{width:auto;margin-top:3px}.email-attachment span{display:grid;min-width:0}.email-attachment strong{overflow-wrap:anywhere}.email-attachment small{color:#64748b}.email-confirm{padding:14px;border:1px solid #f0bd55;border-radius:8px;background:#fff9e9;font-weight:750}.email-confirm input{width:auto}.email-activity{margin-top:22px}.email-log-card{display:grid;gap:10px;padding:17px;border:1px solid #dce5ed;border-left:4px solid #163e5c;border-radius:8px;background:#fff}.email-log-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.email-log-head>div{display:grid;gap:4px}.email-log-head a{font-size:.8rem;font-weight:850;color:#176b8f}.email-log-head strong{font-size:1rem;overflow-wrap:anywhere}.email-route{display:flex;flex-wrap:wrap;gap:8px 18px;color:#64748b;font-size:.84rem}.email-log-card p{margin:0;max-height:240px;overflow:auto;white-space:normal}.email-status{display:inline-flex;padding:5px 9px;border-radius:999px;background:#edf2f7;color:#334155;font-size:.74rem;font-weight:850;white-space:nowrap}.email-status-sent,.email-status-received,.email-status-test-sent{background:#dcfce7;color:#166534}.email-status-failed{background:#fee2e2;color:#991b1b}.email-unmatched{color:#a3392e;font-weight:850}.email-assign-form{display:flex;gap:8px;max-width:430px}.email-assign-form input{min-width:210px}.email-kpis{margin-top:0}.lead-hero .eyebrow span{opacity:.72;font-weight:700}
.email-security-strip{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0 0 20px}.email-security-strip>div{display:grid;gap:5px;padding:15px 17px;border:1px solid #d8e2ec;border-radius:8px;background:#f8fafc}.email-security-strip span{color:#64748b;font-size:.76rem;font-weight:850;text-transform:uppercase}.email-security-strip strong{color:#102947}.email-settings-list{display:grid;gap:22px}.email-settings-card{padding:24px}.email-settings-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.email-settings-head h2{margin:.2rem 0}.email-settings-state{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.email-settings-form fieldset{min-width:0;margin:0;padding:18px;border:1px solid #d8e2ec;border-radius:8px;background:#fbfdff}.email-settings-form legend{padding:0 8px;color:#102947;font-weight:850}.email-settings-form small{display:block;margin-top:6px;color:#64748b}.email-settings-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;align-items:center;gap:12px}.email-settings-actions .inline-check{margin:0}.email-clear-check{color:#9f2f2f}
.email-provider-settings{border-color:#b8d7eb!important;background:#f4faff!important}.email-postmark-note{display:grid;gap:5px;padding:14px 16px;border-left:4px solid #0c7995;background:#fff;border-radius:6px;color:#102947}.email-postmark-note span{color:#5c6d83;line-height:1.5}.email-postmark-test-action{display:flex;align-items:end}.email-postmark-test-action button{width:100%}
.email-send-progress{padding:12px 14px;border:1px solid #9ac9dc;border-radius:8px;background:#eef9fc;color:#164e63;font-weight:800}.email-compose-form [data-email-send-button][aria-busy="true"]{cursor:wait;opacity:.82}
.email-log-collapsible{display:block;padding:0;overflow:hidden}.email-log-collapsible>summary{padding:15px 17px;cursor:pointer;color:#102947}.email-log-collapsible>summary:hover{background:#f8fbfe}.email-log-summary-content{display:inline-flex;width:calc(100% - 22px);align-items:center;justify-content:space-between;gap:16px;vertical-align:middle}.email-log-summary-content>strong{min-width:0;overflow-wrap:anywhere}.email-log-summary-actions{display:inline-flex;align-items:center;gap:10px;flex:none}.email-expand-label{color:#176b8f;font-size:.78rem;font-weight:850;white-space:nowrap}.email-log-collapsible[open] .email-expand-label{font-size:0}.email-log-collapsible[open] .email-expand-label::after{content:"Hide email";font-size:.78rem}.email-log-expanded{display:grid;gap:12px;padding:0 17px 17px;border-top:1px solid #e4eaf0}.email-log-expanded>.email-log-head{padding-top:14px}.email-log-expanded>p{max-height:none}
.email-sync-control{display:flex;align-items:center;gap:16px;margin:0 0 20px;padding:14px 16px;border:1px solid #d8e2ec;border-radius:8px;background:#f8fafc}.email-sync-control form{flex:none}.email-sync-control>div{display:grid;gap:3px}.email-sync-control small{color:#64748b}.lead-email-directory{display:grid;gap:10px;padding:16px;border:1px solid #cfdce8;border-left:4px solid #f5b62f;border-radius:8px;background:#f8fbfe}.lead-email-directory-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px}.lead-email-directory-head h3{margin:.1rem 0}.lead-email-directory-head p{margin:0;color:#64748b}.lead-email-contact{display:grid;grid-template-columns:minmax(180px,.8fr) minmax(260px,1.2fr);align-items:center;gap:14px;padding:11px 12px;border:1px solid #dce5ed;border-radius:7px;background:#fff;transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease}.lead-email-contact:hover,.lead-email-contact:focus-within{border-color:#79aab5;background:#f4fbfc;box-shadow:0 7px 18px rgba(16,41,71,.08)}.lead-email-contact.is-selected{border-color:#177e89;background:#effcf8;box-shadow:inset 3px 0 #177e89}.lead-email-contact>div:first-child{display:grid;gap:3px}.lead-email-contact small{color:#64748b}.lead-email-copy{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px}.lead-email-copy-all>div{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}.lead-email-copy input,.lead-email-copy-all input{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:#f8fafc}.lead-email-copy .btn{white-space:nowrap}.lead-email-copy .recipient-use{opacity:0;pointer-events:none;transform:translateY(2px);transition:opacity .16s ease,transform .16s ease}.lead-email-contact:hover .recipient-use,.lead-email-contact:focus-within .recipient-use,.lead-email-contact.is-selected .recipient-use{opacity:1;pointer-events:auto;transform:none}.lead-email-copy-all{display:grid;gap:6px;padding-top:5px}.lead-email-copy-all label{font-weight:800}.email-log-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}.email-attachment-links{display:block;margin-top:4px;color:#64748b;font-weight:850}.email-attachment-links a{display:inline-flex;margin:2px 6px 2px 0;color:#176b8f;text-decoration:underline;text-underline-offset:2px}
@media(max-width:980px){.email-center-grid{grid-template-columns:1fr}.email-attachments{grid-template-columns:1fr}}
@media(max-width:980px){.email-security-strip{grid-template-columns:1fr}.email-settings-head{display:grid}.email-settings-state{justify-content:flex-start}.email-settings-actions{grid-template-columns:1fr}.email-settings-actions button{width:100%}.lead-email-contact{grid-template-columns:1fr}}
@media(max-width:680px){.email-log-head{display:grid}.email-log-actions{justify-content:flex-start}.email-route{display:grid;gap:4px}.email-assign-form{display:grid;max-width:none}.email-assign-form input{min-width:0}.email-account-grid{grid-template-columns:1fr}.email-settings-card{padding:16px}.email-settings-form fieldset{padding:14px}.email-sync-control{display:grid}.email-sync-control button{width:100%}.lead-email-directory-head{display:grid}.lead-email-copy,.lead-email-copy-all>div{grid-template-columns:1fr}.lead-email-copy .recipient-use{opacity:1;pointer-events:auto;transform:none}.lead-email-copy .btn,.lead-email-copy-all button{width:100%}}
@media(max-width:680px){.email-log-summary-content{align-items:flex-start}.email-log-summary-actions{display:grid;justify-items:end}.email-log-expanded{padding:0 14px 14px}}

.email-lead-picker{display:grid!important;grid-template-columns:minmax(280px,1.35fr) minmax(280px,1.2fr) auto;align-items:start!important;width:100%}
.email-lead-picker button{align-self:start;margin-top:25px;min-height:48px}
.email-lead-search-control{display:grid;gap:5px;min-width:0}
.email-lead-search-control label{margin:0;color:#102947;font-size:.78rem;font-weight:900}
.email-lead-search-control small{min-height:16px;color:#64748b;font-size:.72rem;font-weight:750}
.email-lead-search-control input[type="search"]{padding-right:38px;background-color:#fff}
@media(max-width:1200px){.email-lead-picker{grid-template-columns:1fr 1fr}.email-lead-picker button{grid-column:1/-1;width:100%;margin-top:0}}
@media(max-width:680px){.email-lead-picker{grid-template-columns:1fr}.email-lead-picker button{width:100%}}

/* Compact mail console */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.email-upload-control{display:grid;gap:7px;padding:14px;border:1px solid #d8e2ec;border-radius:8px;background:#f8fafc}.email-upload-control label{font-weight:850}.email-upload-control input{background:#fff}.email-upload-control small{color:#64748b}
.email-activity-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.email-activity-heading p{margin-bottom:0}.email-console-tools{display:flex;align-items:center;gap:12px;min-width:min(100%,520px)}.email-console-tools>input[type="search"]{min-width:220px;background:#f1f5f9}.email-bulk-controls{display:flex;align-items:center;gap:12px;flex:none}.email-bulk-controls .inline-check{margin:0}.email-bulk-controls input,.email-row-select input{width:auto}
.email-log-list{overflow:hidden;border:1px solid #d8e2ec;border-radius:8px;background:#fff}.email-log-row{display:grid;grid-template-columns:44px minmax(0,1fr);min-height:52px;border-bottom:1px solid #e6ebf0}.email-log-row:last-child{border-bottom:0}.email-row-select{display:flex;align-items:center;justify-content:center;margin:0;background:#f8fafc}.email-log-row:has(details[open]) .email-row-select{align-items:flex-start;padding-top:18px;background:#eef5fb}
.email-log-row .email-log-card{min-width:0;border:0;border-radius:0;border-left:0;background:#fff;box-shadow:none}.email-log-row .email-log-collapsible>summary{display:grid;grid-template-columns:minmax(130px,180px) minmax(260px,1fr) auto minmax(120px,155px) 42px;align-items:center;gap:12px;min-height:52px;padding:8px 12px;list-style:none}.email-log-row .email-log-collapsible>summary::-webkit-details-marker{display:none}.email-log-row .email-log-collapsible>summary:hover{background:#f3f6fa}.email-log-row .email-log-collapsible[open]>summary{background:#eef5fb}.email-list-party{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#1f2937;font-weight:800}.email-list-subject{display:flex;min-width:0;overflow:hidden;white-space:nowrap}.email-list-subject strong{flex:none;max-width:64%;overflow:hidden;text-overflow:ellipsis}.email-list-subject>span{min-width:0;overflow:hidden;text-overflow:ellipsis;color:#64748b}.email-list-state{justify-self:end}.email-log-row summary time{color:#475569;font-size:.76rem;font-weight:750;white-space:nowrap}.email-log-row .email-expand-label{text-align:right}.email-log-row .email-log-collapsible[open] .email-expand-label::after{content:"Close"}.email-log-row .email-log-expanded{padding:16px 18px 20px;background:#fff}.email-log-row .email-log-expanded>p{margin:0;padding:18px;border:1px solid #e6ebf0;border-radius:8px;background:#fbfcfe;max-height:440px;overflow:auto;line-height:1.55}.email-log-row .email-attachment-links a{padding:6px 9px;border:1px solid #d8e2ec;border-radius:6px;background:#f8fafc;text-decoration:none}.email-log-actions form{margin:0}
.lead-email-log-panel .toolbar{align-items:flex-start}.lead-email-log-list{overflow:hidden;border-top:1px solid #d8e2ec;border-bottom:1px solid #d8e2ec}.lead-email-log-item{border-bottom:1px solid #e6ebf0}.lead-email-log-item:last-child{border-bottom:0}.lead-email-log-item>summary{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px 4px;cursor:pointer;list-style:none}.lead-email-log-item>summary::-webkit-details-marker{display:none}.lead-email-log-item>summary>span:first-child{min-width:0;overflow-wrap:anywhere;font-weight:850}.lead-email-log-detail{display:grid;gap:12px;padding:2px 4px 16px}.lead-email-log-detail>p{margin:0;padding:14px;border:1px solid #e6ebf0;border-radius:8px;background:#fbfcfe;max-height:360px;overflow:auto;line-height:1.5}
@media(max-width:1050px){.email-log-row .email-log-collapsible>summary{grid-template-columns:minmax(120px,160px) minmax(220px,1fr) auto 42px}.email-log-row summary time{display:none}}
@media(max-width:760px){.email-activity-heading{display:grid;align-items:start}.email-console-tools{display:grid;min-width:0;width:100%}.email-console-tools>input[type="search"]{min-width:0}.email-bulk-controls{justify-content:space-between}.email-log-row{grid-template-columns:38px minmax(0,1fr)}.email-log-row .email-log-collapsible>summary{grid-template-columns:minmax(0,1fr) auto;gap:5px 10px;padding:10px}.email-list-party{grid-column:1}.email-list-subject{grid-column:1/3;grid-row:2}.email-list-state{grid-column:2;grid-row:1}.email-log-row .email-expand-label{grid-column:2;grid-row:3}.email-log-row summary time{display:block;grid-column:1;grid-row:3}.email-list-subject strong{max-width:78%}.email-log-row .email-log-expanded{padding:14px}.lead-email-log-panel .toolbar{display:grid}.lead-email-log-panel .toolbar .btn{width:100%}}

/* Compact email composer */
.email-compose-panel{gap:14px;padding:20px}.email-compose-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.email-compose-head h2{margin:.15rem 0 0}.email-compose-head>span{max-width:390px;color:#64748b;font-size:.8rem;font-weight:750;text-align:right}.email-compose-panel .email-lead-picker{gap:10px;margin:0;padding:10px!important}.email-compose-panel .email-lead-picker button{min-height:42px;margin-top:22px;padding:8px 15px}.email-compose-panel .email-lead-search-control{gap:3px}.email-compose-panel .email-lead-search-control small{min-height:12px}.email-compose-form{gap:12px}.email-composer-shell{overflow:hidden;border:1px solid #d8e2ec;border-radius:8px;background:#fff}.email-compose-routing{display:grid;grid-template-columns:minmax(220px,1fr) minmax(150px,.55fr) minmax(280px,1.25fr);gap:12px;padding:11px 14px;border-bottom:1px solid #e6ebf0;background:#f8fafc}.email-compose-routing>div,.email-copy-grid>div{display:grid;gap:4px;min-width:0}.email-compose-routing label,.email-copy-grid label,.email-compose-subject label,.email-compose-message label{margin:0;color:#102947;font-size:.72rem;font-weight:900}.email-compose-routing select,.email-compose-routing input{min-height:42px;padding:8px 10px}.email-copy-fields{border-bottom:1px solid #e6ebf0}.email-copy-fields>summary{padding:9px 14px;cursor:pointer;color:#176b8f;font-size:.78rem;font-weight:850;list-style:none}.email-copy-fields>summary::-webkit-details-marker{display:none}.email-copy-fields>summary::before{content:"+";display:inline-block;width:18px;color:#64748b}.email-copy-fields[open]>summary::before{content:"−"}.email-copy-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:0 14px 12px}.email-copy-grid input{min-height:40px;padding:8px 10px}.email-compose-subject{display:grid;grid-template-columns:70px minmax(0,1fr);align-items:center;padding:0 14px;border-bottom:1px solid #e6ebf0}.email-compose-subject input{min-height:42px;padding:9px 0!important;border:0!important;border-radius:0!important;background:#fff!important;box-shadow:none!important}.email-compose-message{display:grid;gap:5px;padding:10px 14px}.email-compose-form .email-compose-message textarea{min-height:180px!important;padding:0!important;border:0!important;border-radius:0!important;background:#fff!important;box-shadow:none!important;resize:vertical}.email-compose-form .email-attachments,.email-compose-form .email-upload-control,.email-compose-form .email-confirm{margin:0}.email-compose-form>button[type="submit"]{min-height:44px}
@media(max-width:980px){.email-compose-routing{grid-template-columns:1fr 1fr}.email-compose-to{grid-column:1/-1}.email-compose-panel .email-lead-picker button{margin-top:0}}
@media(max-width:680px){.email-compose-panel{padding:14px}.email-compose-head{display:grid;align-items:start}.email-compose-head>span{text-align:left}.email-compose-routing,.email-copy-grid{grid-template-columns:1fr}.email-compose-to{grid-column:auto}.email-compose-subject{grid-template-columns:1fr;padding-top:9px}.email-compose-subject input{padding:7px 0!important}.email-compose-form .email-compose-message textarea{min-height:165px!important}}

/* Forwarding and attachment handling */
.email-forward-context{display:grid;grid-template-columns:auto minmax(0,1fr);gap:3px 12px;padding:11px 14px;border:1px solid #9ac9dc;border-left:4px solid #177e89;border-radius:8px;background:#effafc}.email-forward-context strong{color:#0f5f69}.email-forward-context span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:800}.email-forward-context small{grid-column:1/-1;color:#52657d}.email-attachment-manager{overflow:hidden;border:1px solid #d8e2ec;border-radius:8px;background:#f8fafc}.email-attachment-manager>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 14px;cursor:pointer;list-style:none;background:#eef5fb}.email-attachment-manager>summary::-webkit-details-marker{display:none}.email-attachment-manager>summary span{color:#102947;font-weight:900}.email-attachment-manager>summary small{color:#64748b;text-align:right}.email-attachment-manager-body{display:grid;gap:10px;padding:12px}.email-attachment-manager .email-attachments,.email-attachment-manager .email-upload-control{background:#fff}.email-list-state{display:flex;align-items:center;justify-content:flex-end;gap:6px}.email-file-count{display:inline-flex;padding:4px 7px;border:1px solid #b9d7e4;border-radius:999px;background:#eef9fc;color:#0f6072;font-size:.68rem;font-weight:900;white-space:nowrap}.email-attachment-links{padding:11px 12px;border:1px solid #d8e2ec;border-radius:8px;background:#f8fafc}.email-attachment-links::first-letter{color:#102947}
@media(max-width:680px){.email-forward-context{grid-template-columns:1fr}.email-forward-context small{grid-column:auto}.email-attachment-manager>summary{display:grid;gap:3px}.email-attachment-manager>summary small{text-align:left}.email-list-state{justify-content:flex-end;flex-wrap:wrap}}

/* Full alert history controls */
.alert-page-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap}.alert-page-actions form{margin:0}.alert-page-actions .btn{min-height:42px}.alert-page-actions .danger{background:#fff1f2;color:#a22525;border-color:#fecaca}.alert-page-actions .danger:hover{background:#a22525;color:#fff;border-color:#a22525}
@media(max-width:680px){.alert-page-actions{display:grid;width:100%;justify-content:stretch}.alert-page-actions form,.alert-page-actions .btn{width:100%}}

/* Email generator lives in Email Center */
.email-generator-picker{grid-template-columns:minmax(260px,1.15fr) minmax(240px,1fr) minmax(210px,.8fr) auto!important}
.email-compose-routing-compact{grid-template-columns:minmax(230px,.8fr) minmax(360px,1.4fr)}
@media(max-width:1200px){.email-generator-picker{grid-template-columns:1fr 1fr!important}.email-generator-picker button{grid-column:1/-1}}
@media(max-width:680px){.email-generator-picker{grid-template-columns:1fr!important}.email-compose-routing-compact{grid-template-columns:1fr}}

/* Mailbox-style Email Center */
.email-center-title{margin-bottom:14px}.email-center-title h1{font-size:clamp(2rem,4vw,3.25rem);margin:.1rem 0}.email-mail-workspace{display:grid;grid-template-columns:230px minmax(0,1fr);min-height:720px;overflow:hidden;border:1px solid #d7e1eb;border-radius:8px;background:#fff;box-shadow:0 12px 32px rgba(16,41,71,.08)}
.email-mail-sidebar{display:flex;flex-direction:column;gap:15px;padding:18px 14px;border-right:1px solid #dfe7ef;background:#f6f8fb}.email-compose-button{display:flex;align-items:center;justify-content:center;min-height:48px;padding:10px 18px;border:1px solid #8fb8d1;border-radius:8px;background:#dceefa;color:#102947;font-weight:900;text-decoration:none}.email-compose-button:hover{background:#c9e5f6;border-color:#5e9abe}.email-account-switcher{display:grid;gap:5px}.email-account-switcher label{color:#52657d;font-size:.72rem;font-weight:900;text-transform:uppercase}.email-account-switcher select{min-width:0;min-height:42px;padding:8px 32px 8px 10px;background:#fff;font-size:.82rem}
.email-mailbox-nav{display:grid;gap:3px}.email-mailbox-link{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;min-height:42px;padding:8px 12px;border-radius:6px;color:#27364b;text-decoration:none}.email-mailbox-link:hover{background:#e9eef5}.email-mailbox-link.is-active{background:#dce8f7;color:#102947}.email-mailbox-link span{font-weight:820}.email-mailbox-link strong{color:#53657a;font-size:.78rem}.email-sidebar-actions{display:grid;gap:10px;margin-top:auto;padding-top:14px;border-top:1px solid #dce4ec}.email-sidebar-actions form,.email-sidebar-actions button{width:100%}.email-sidebar-actions a{color:#176b8f;font-size:.78rem;font-weight:850;text-align:center}
.email-mail-main{min-width:0;background:#fff}.email-mail-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:78px;padding:14px 20px;border-bottom:1px solid #dfe7ef;background:#fbfcfe}.email-mail-toolbar h2{margin:.1rem 0;font-size:1.65rem}.email-mail-toolbar .eyebrow{max-width:65vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.email-mail-toolbar>span{color:#64748b;font-size:.82rem;font-weight:800;white-space:nowrap}
.email-compose-drawer{margin:16px 18px 0;padding:0!important;overflow:hidden}.email-compose-drawer>summary{list-style:none}.email-compose-drawer>summary::-webkit-details-marker{display:none}.email-compose-toggle{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:13px 16px;cursor:pointer;background:#eef5fb}.email-compose-toggle:hover{background:#e4f0f8}.email-compose-toggle span{color:#102947;font-weight:900}.email-compose-toggle small{color:#64748b;text-align:right}.email-compose-content{padding:14px}.email-compose-drawer:not([open]) .email-compose-toggle::after{content:"Open";color:#176b8f;font-size:.75rem;font-weight:900}.email-compose-drawer[open] .email-compose-toggle::after{content:"Close";color:#176b8f;font-size:.75rem;font-weight:900}.email-compose-drawer .email-compose-toggle small{margin-left:auto}
.email-mail-main>.email-activity{margin:16px 18px 20px}.email-mail-main .email-activity-heading{padding:14px 2px}.email-mail-main .email-activity-heading h2{margin:.1rem 0}.email-mail-main .email-log-list{border-radius:6px}.email-empty-mailbox{padding:38px 20px;text-align:center}.email-status-junk{background:#fff0d9;color:#8a4c08}
@media(max-width:980px){.email-mail-workspace{grid-template-columns:190px minmax(0,1fr)}.email-console-tools{min-width:0}.email-activity-heading{display:grid}.email-compose-toggle small{display:none}}
@media(max-width:760px){.email-mail-workspace{display:block;min-height:0}.email-mail-sidebar{display:grid;grid-template-columns:1fr 1fr;border-right:0;border-bottom:1px solid #dfe7ef}.email-compose-button{grid-column:1}.email-account-switcher{grid-column:2}.email-mailbox-nav{grid-column:1/-1;grid-template-columns:repeat(4,minmax(0,1fr))}.email-mailbox-link{display:grid;justify-items:center;padding:7px 4px}.email-mailbox-link strong{font-size:.7rem}.email-sidebar-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;margin-top:0;padding-top:10px}.email-sidebar-actions form{width:auto}.email-sidebar-actions button{width:auto}.email-mail-toolbar{min-height:66px;padding:11px 14px}.email-mail-toolbar h2{font-size:1.35rem}.email-compose-drawer,.email-mail-main>.email-activity{margin-left:10px;margin-right:10px}.email-compose-toggle{align-items:flex-start}.email-compose-drawer .email-compose-toggle small{display:none}}
@media(max-width:480px){.email-mail-sidebar{grid-template-columns:1fr}.email-compose-button,.email-account-switcher,.email-mailbox-nav,.email-sidebar-actions{grid-column:1}.email-mailbox-link span{font-size:.77rem}.email-mail-toolbar .eyebrow{max-width:70vw}.email-mail-toolbar>span{display:none}}

/* Gmail-inspired mail workspace and lead paging */
body[data-route="email-center"] .shell{max-width:none;padding:12px 16px 28px;background:#f3f7fb}
.email-center-title{min-height:52px;margin:0 0 10px;padding:0 4px}.email-center-title h1{margin:0;font-size:1.8rem}.email-center-title .eyebrow{font-size:.65rem}.email-center-title .btn{min-height:38px;padding:8px 13px}
.email-mail-workspace{grid-template-columns:218px minmax(0,1fr);min-height:calc(100vh - 180px);border:0;border-radius:8px;background:#fff;box-shadow:0 2px 10px rgba(16,41,71,.08)}
.email-mail-sidebar{gap:12px;padding:14px 12px;border-right:0;background:#edf3f8}
.email-compose-button{justify-content:flex-start;gap:14px;width:max-content;min-width:174px;min-height:56px;padding:12px 24px;border:0;border-radius:18px;background:#c2e7ff;color:#0b1f38;font-size:1.05rem;font-weight:750;box-shadow:0 1px 2px rgba(16,41,71,.08)}
.email-compose-button::before{content:"\270E";display:inline-grid;place-items:center;width:26px;height:26px;color:#071b2f;font-size:1.75rem;font-weight:400;line-height:1;transform:rotate(-10deg)}
.email-compose-button:hover{border:0;background:#b4defa;box-shadow:0 3px 7px rgba(16,41,71,.14)}
.email-account-switcher label{font-size:.66rem}.email-mailbox-nav{gap:1px}.email-mailbox-link{min-height:36px;padding:6px 13px;border-radius:18px}.email-mailbox-link.is-active{background:#d3e3fd}.email-sidebar-actions{padding-top:10px}
.email-mail-toolbar{display:grid;grid-template-columns:minmax(150px,auto) minmax(220px,620px) auto;min-height:68px;padding:10px 18px;background:#fff}.email-mail-toolbar h2{font-size:1.35rem}.email-mail-search{display:block;min-width:0}.email-mail-search input{width:100%;min-height:46px;padding:10px 18px;border:0;border-radius:24px;background:#edf3f8;box-shadow:none}.email-mail-search input:focus{background:#fff;box-shadow:0 1px 5px rgba(16,41,71,.2)}
.email-compose-drawer{margin:12px 16px 0;border:1px solid #d8e2ec!important;border-radius:8px!important;box-shadow:0 8px 24px rgba(16,41,71,.12)}.email-compose-toggle{min-height:45px;padding:10px 14px;background:#edf3f8}.email-compose-toggle:hover{background:#e5eef6}.email-compose-content{padding:12px}.email-compose-panel .email-lead-picker{padding:8px!important;border:0;background:#f8fafc}.email-forward-lead-picker{grid-template-columns:minmax(240px,1.1fr) minmax(230px,1fr) minmax(210px,.85fr) auto!important}.email-compose-panel .email-lead-picker button{background:#c2e7ff;color:#0b1f38;border-color:#9bcce9}
.email-composer-shell{border-color:#cfd8e3;box-shadow:0 1px 2px rgba(16,41,71,.06)}.email-compose-routing{padding:8px 12px;background:#fff}.email-compose-routing label,.email-copy-grid label,.email-compose-subject label,.email-compose-message label{color:#5f6368;font-size:.8rem;font-weight:650}.email-compose-routing select,.email-compose-routing input{min-height:38px;border:0!important;border-radius:0!important;background:#fff!important;box-shadow:none!important}.email-copy-fields>summary{padding:7px 12px}.email-compose-subject{grid-template-columns:62px minmax(0,1fr);padding:0 12px}.email-compose-message{padding:10px 12px 12px}.email-compose-form .email-compose-message textarea{min-height:210px!important}.email-compose-drawer.is-forwarding .email-compose-form .email-compose-message textarea{min-height:82px!important}
.email-forward-source{margin-top:10px;padding:12px 0 0;border-top:1px solid #e0e6ed;color:#3c4043}.email-forward-source header{display:grid;grid-template-columns:24px minmax(0,1fr) auto;align-items:start;gap:8px}.email-forward-arrow{font-size:1.1rem}.email-forward-source header>div{display:grid;gap:2px;min-width:0}.email-forward-source header strong{color:#202124}.email-forward-source header span,.email-forward-source header time{overflow:hidden;color:#5f6368;font-size:.78rem;text-overflow:ellipsis;white-space:nowrap}.email-forward-source-meta{display:grid;gap:2px;margin:8px 0 10px;padding-left:32px;color:#5f6368;font-size:.78rem}.email-forward-source-body{max-height:300px;overflow:auto;padding:12px 14px;border-left:2px solid #d9dfe7;background:#fafbfc;color:#3c4043;line-height:1.5}.email-forward-source footer{display:flex;justify-content:space-between;gap:12px;margin-top:9px;color:#64748b;font-size:.72rem}
.email-attachment-manager{border-color:#dfe5ec;background:#fff}.email-attachment-manager>summary{padding:9px 12px;background:#f7f9fc}.email-attachment-manager>summary small{font-size:.72rem}
.email-compose-form>button[type="submit"]{justify-self:start;width:auto;min-width:132px;min-height:46px!important;padding:10px 18px;border:0;border-radius:24px;background:#0b57d0;color:#fff;box-shadow:0 1px 2px rgba(11,87,208,.2)}.email-compose-form>button[type="submit"]::after{content:"";display:inline-block;margin-left:13px;border:5px solid transparent;border-top-color:#fff;transform:translateY(3px)}.email-compose-form>button[type="submit"]:hover{background:#0842a0}.email-compose-form>button[type="submit"]:disabled{background:#9eb7db;color:#eef4ff}
.email-mail-main>.email-activity{margin:10px 16px 18px}.email-mail-main .email-activity-heading{align-items:center;min-height:42px;padding:6px 8px}.email-list-caption{color:#52657d;font-size:.72rem;font-weight:850;text-transform:uppercase}.email-log-list{border-color:#e0e6ed;border-radius:0!important}.email-log-row{min-height:46px}.email-row-select{background:#fff}.email-log-row .email-log-collapsible>summary{min-height:46px;padding:6px 10px}.email-log-row .email-log-collapsible>summary:hover{box-shadow:0 1px 4px rgba(16,41,71,.16)}
.lead-pagination{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:16px;padding:10px 12px;border-top:1px solid #dce5ed}.lead-pagination>span{color:#64748b;font-size:.82rem;font-weight:800}.lead-pagination>div{display:flex;gap:8px}.lead-pagination .btn{min-height:38px;padding:8px 14px}.lead-pagination .is-disabled{pointer-events:none;opacity:.45}
@media(max-width:980px){.email-mail-workspace{grid-template-columns:190px minmax(0,1fr)}.email-mail-toolbar{grid-template-columns:1fr minmax(200px,1.2fr) auto}.email-forward-lead-picker{grid-template-columns:1fr 1fr!important}.email-forward-lead-picker button{grid-column:1/-1}.email-forward-source footer{display:grid}}
@media(max-width:760px){body[data-route="email-center"] .shell{padding:8px}.email-mail-toolbar{grid-template-columns:1fr auto}.email-mail-search{grid-column:1/-1;grid-row:2}.email-mail-toolbar>span{display:block}.email-compose-button{width:100%;min-width:0;justify-content:center}.email-forward-lead-picker{grid-template-columns:1fr!important}.email-forward-source header{grid-template-columns:22px minmax(0,1fr)}.email-forward-source header time{grid-column:2}.email-forward-source-meta{padding-left:30px}.lead-pagination{align-items:stretch}.lead-pagination>div{margin-left:auto}}
@media(max-width:480px){.email-mail-toolbar{padding:10px}.email-mail-toolbar>span{display:none}.email-compose-drawer,.email-mail-main>.email-activity{margin-left:6px;margin-right:6px}.email-compose-subject{grid-template-columns:1fr}.email-forward-source-body{padding:10px}.lead-pagination{display:grid}.lead-pagination>div{display:grid;grid-template-columns:1fr 1fr;margin:0}.lead-pagination .btn{text-align:center}}

/* Compact funder attempt editor */
.funder-attempt-list{gap:8px;padding:8px 10px}.funder-attempt{padding:10px 12px;border-left-width:4px}.funder-attempt-heading{gap:10px;margin-bottom:8px}.funder-attempt-heading .funder-status{min-height:26px;padding:4px 8px}.funder-attempt-heading small{font-size:.72rem}.funder-attempt-form{grid-template-columns:minmax(150px,1fr) minmax(190px,1.15fr) minmax(130px,.65fr) minmax(110px,.5fr);gap:8px 10px}.funder-attempt-form>div{min-width:0}.funder-attempt-form label{margin-bottom:3px;font-size:.72rem}.funder-attempt-form input,.funder-attempt-form select{min-height:38px;padding:7px 10px}.funder-attempt-form .funder-wide{grid-column:span 2}.funder-attempt-form textarea{min-height:56px!important;padding:8px 10px;line-height:1.35}.funder-form-action{grid-column:span 4}.funder-form-action button{min-height:38px;padding:8px 14px}.funder-email-history{gap:7px;margin-top:9px;padding-top:8px}.funder-email-history-title{font-size:.8rem}
@media(max-width:1200px){.funder-attempt-form{grid-template-columns:1fr 1fr}.funder-attempt-form .funder-wide,.funder-form-action{grid-column:span 2}}
@media(max-width:680px){.funder-attempt-list{padding:8px}.funder-attempt{padding:10px}.funder-attempt-form{grid-template-columns:1fr}.funder-attempt-form .funder-wide,.funder-form-action{grid-column:auto}.funder-attempt-form textarea{min-height:70px!important}}

/* Analytics dashboard */
body[data-route="dashboard"] .shell{width:min(100% - 34px,1700px);max-width:none;margin-top:18px}
.dashboard-page-head{display:flex;align-items:center;justify-content:space-between;gap:22px;margin:0 -17px 14px;padding:16px 18px;border:1px solid #d8e1eb;border-radius:6px;background:#f4f6f9}
.dashboard-title-block{display:flex;align-items:flex-start;gap:14px;min-width:0}.dashboard-title-icon{display:grid;flex:0 0 46px;width:46px;height:46px;place-items:center;border-radius:4px;background:#e85d57;color:#fff;font-size:1.7rem;box-shadow:inset 0 -2px rgba(0,0,0,.1)}
.dashboard-title-block h1{margin:1px 0 2px;font-size:2rem;line-height:1.08;letter-spacing:0}.dashboard-title-block p:last-child{margin:0;color:#5e6d82;font-size:.78rem;font-weight:750}.dashboard-title-block .eyebrow{color:#40516a;font-size:.63rem}
.dashboard-header-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}.dashboard-header-actions .btn,.dashboard-more-actions>summary{min-height:38px;padding:8px 13px;border-radius:4px;font-size:.78rem}.dashboard-more-actions{position:relative}.dashboard-more-actions>summary{list-style:none;cursor:pointer}.dashboard-more-actions>summary::-webkit-details-marker{display:none}.dashboard-more-actions>div{position:absolute;z-index:20;right:0;top:calc(100% + 6px);display:grid;min-width:180px;padding:6px;border:1px solid #d5dee8;border-radius:5px;background:#fff;box-shadow:0 12px 28px rgba(16,41,71,.16)}.dashboard-more-actions a{padding:9px 10px;border-radius:3px;color:#15314f;font-size:.78rem;font-weight:800;text-decoration:none}.dashboard-more-actions a:hover{background:#eef4f9}
.admin-ops-panel{display:grid!important;gap:14px!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}.dashboard-report-toolbar{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:10px 12px;border:1px solid #d9e2eb;border-radius:5px;background:#fff}.dashboard-report-toolbar>div{display:grid;gap:1px}.dashboard-report-toolbar strong{color:#122b48;font-size:.9rem}.dashboard-report-toolbar span{color:#6b788a;font-size:.72rem}.dashboard-report-toolbar .filters{gap:7px}.dashboard-report-toolbar input,.dashboard-report-toolbar .btn{min-height:34px;padding:6px 10px;border-radius:4px;font-size:.72rem}
.dashboard-kpi-strip,.dashboard-summary-strip{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));border:1px solid #d9e2eb;border-radius:5px;background:#fff;overflow:hidden}.dashboard-kpi-strip>a,.dashboard-summary-strip>a{display:grid;gap:3px;min-height:86px;padding:13px 15px;border-right:1px solid #d9e2eb;color:#122b48;text-decoration:none}.dashboard-kpi-strip>a:last-child,.dashboard-summary-strip>a:last-child{border-right:0}.dashboard-kpi-strip>a:hover,.dashboard-summary-strip>a:hover{background:#f4f8fc}.dashboard-kpi-strip small,.dashboard-summary-strip small{color:#607087;font-size:.67rem;font-weight:850;text-transform:uppercase}.dashboard-kpi-strip strong,.dashboard-summary-strip strong{font-size:1.7rem;line-height:1}.dashboard-kpi-strip span{color:#718096;font-size:.68rem;font-weight:700}.dashboard-summary-strip{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:14px}
.dashboard-visual-grid{display:grid;grid-template-columns:minmax(0,1.75fr) minmax(320px,.72fr);gap:14px}.dashboard-side-stack{display:grid;grid-template-rows:1fr 1fr;gap:14px}.chart-card{min-width:0;padding:14px;border:1px solid #d6e0ea;border-radius:5px;background:#fff;box-shadow:0 2px 8px rgba(16,41,71,.05)}.chart-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px}.chart-card-head h3{margin:0;color:#102947;font-size:1rem}.chart-card-head span{display:block;margin-top:2px;color:#6b788a;font-size:.7rem}.chart-card-head>a{color:#176b8f;font-size:.7rem;font-weight:850;text-decoration:none;white-space:nowrap}.chart-card-head>a:hover{text-decoration:underline}
.owner-status-axis{display:grid;grid-template-columns:repeat(5,1fr);margin:0 34px 7px 150px;color:#7a8798;font-size:.65rem}.owner-status-axis span{text-align:center}.owner-status-axis span:first-child{text-align:left}.owner-status-axis span:last-child{text-align:right}.owner-status-chart{display:grid;gap:9px}.owner-status-row{display:grid;grid-template-columns:140px minmax(0,1fr) 28px;align-items:center;gap:10px}.owner-status-name{overflow:hidden;color:#25364f;font-size:.74rem;font-weight:800;text-align:right;text-overflow:ellipsis;white-space:nowrap}.owner-status-track{display:flex;height:28px;overflow:hidden;border:1px solid #dbe4ed;background:repeating-linear-gradient(90deg,#f7f9fc 0,#f7f9fc calc(25% - 1px),#e0e7ef calc(25% - 1px),#e0e7ef 25%)}.owner-status-segment{display:block;flex:0 0 var(--segment-width);height:100%;background:var(--segment-color)}.owner-status-row>strong{font-size:.72rem}.owner-status-legend{display:flex;justify-content:center;gap:8px 15px;flex-wrap:wrap;margin-top:14px;padding-top:10px;border-top:1px solid #e4e9ef;color:#55657a;font-size:.65rem;font-weight:750}.owner-status-legend span{display:flex;align-items:center;gap:5px}.owner-status-legend i{width:9px;height:9px;background:var(--legend-color)}
.dashboard-gauge-card{display:grid;align-content:start}.dashboard-gauge{display:grid;justify-items:center;color:#102947;text-decoration:none}.dashboard-gauge-face{position:relative;display:block;width:min(100%,240px);height:118px;overflow:hidden}.dashboard-gauge-face::before{content:"";position:absolute;left:50%;top:0;width:232px;height:232px;border-radius:50%;background:conic-gradient(from 270deg,#cf4439 0 60deg,#e6c75a 60deg 120deg,#0a8a77 120deg 180deg,transparent 180deg 360deg);transform:translateX(-50%)}.dashboard-gauge-face::after{content:"";position:absolute;z-index:1;left:50%;top:35px;width:162px;height:162px;border-radius:50%;background:#fff;transform:translateX(-50%)}.dashboard-gauge-face i{position:absolute;z-index:3;left:50%;bottom:2px;width:88px;height:5px;border-radius:5px;background:#173a61;box-shadow:0 1px 2px rgba(0,0,0,.25);transform:rotate(var(--gauge-angle));transform-origin:0 50%}.dashboard-gauge-face i::after{content:"";position:absolute;left:-8px;top:-6px;width:17px;height:17px;border-radius:50%;background:#173a61}.dashboard-gauge strong{margin-top:-2px;font-size:1.75rem}.dashboard-gauge small{color:#607087;font-size:.7rem;font-weight:750}
.dashboard-trend-chart{display:flex;align-items:stretch;gap:8px;height:135px;padding-top:6px}.dashboard-trend-bar{display:grid;grid-template-rows:minmax(0,1fr) auto auto;flex:1;justify-items:center;gap:3px;color:#5d6b7f;text-decoration:none}.dashboard-trend-bar>span{align-self:end;width:min(100%,30px);height:var(--trend-height);min-height:3px;background:#17a3d5;transition:background .15s}.dashboard-trend-bar:hover>span{background:#0c6f9f}.dashboard-trend-bar small{font-size:.61rem}.dashboard-trend-bar b{font-size:.66rem}
.dashboard-secondary-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(250px,.8fr) minmax(250px,.8fr);gap:14px}.dashboard-agent-list{display:grid}.dashboard-agent-row{display:grid;grid-template-columns:minmax(145px,.75fr) minmax(120px,.8fr) minmax(260px,1.8fr);align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid #e4eaf0}.dashboard-agent-row:last-child{border-bottom:0}.dashboard-agent-name{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:2px 7px}.dashboard-agent-name .activity-status{grid-row:1/3}.dashboard-agent-name strong{overflow:hidden;font-size:.76rem;text-overflow:ellipsis;white-space:nowrap}.dashboard-agent-name small{font-size:.63rem}.dashboard-agent-metrics{display:flex;align-items:center;gap:5px 12px;flex-wrap:wrap;color:#68788e;font-size:.64rem}.dashboard-agent-metrics b{color:#17314e}.dashboard-time-legend{display:flex;gap:14px;margin-top:9px;color:#627187;font-size:.64rem}.dashboard-time-legend span{display:flex;align-items:center;gap:5px}.dashboard-time-legend i{width:10px;height:10px;background:#0c93c4}.dashboard-time-legend span:last-child i{background:#d7e3ec}
.dashboard-operational-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}.dashboard-compact-panel,.dashboard-recent-leads{padding:14px;border-radius:5px}.dashboard-compact-panel>.toolbar,.dashboard-recent-leads>.toolbar{align-items:center;margin:0 0 10px}.dashboard-compact-panel h2,.dashboard-recent-leads h2{margin:0;font-size:1rem}.dashboard-alert-list{display:grid;gap:7px;max-height:390px;overflow:auto}.dashboard-alert-list .alert-card{grid-template-columns:minmax(0,1fr) auto;gap:9px;padding:9px;border-left-width:4px;border-radius:4px;box-shadow:none}.dashboard-alert-list .alert-card h3{margin:2px 0;font-size:.82rem}.dashboard-alert-list .alert-card p{display:-webkit-box;overflow:hidden;margin:3px 0 0;font-size:.7rem;-webkit-box-orient:vertical;-webkit-line-clamp:2}.dashboard-alert-list .alert-card small,.dashboard-alert-list .alert-card strong{font-size:.66rem}.dashboard-alert-list .btn{min-height:30px;padding:5px 7px;font-size:.65rem}.dashboard-alert-list .alert-card-actions{max-width:155px}.dashboard-task-board{display:grid;grid-template-columns:1fr;gap:7px;max-height:390px;overflow:auto}.dashboard-task-board .task-card{padding:9px;border-left-width:4px;border-radius:4px}.dashboard-task-board .task-card h3{margin:4px 0;font-size:.8rem}.dashboard-task-board .task-meta{gap:3px 8px;font-size:.64rem}.dashboard-recent-leads{margin-top:14px}.dashboard-recent-leads .table-wrap{max-height:500px}.dashboard-recent-leads th,.dashboard-recent-leads td{padding:8px 10px;font-size:.72rem}
@media(max-width:1180px){.dashboard-kpi-strip{grid-template-columns:repeat(3,1fr)}.dashboard-kpi-strip>a:nth-child(3){border-right:0}.dashboard-kpi-strip>a:nth-child(-n+3){border-bottom:1px solid #d9e2eb}.dashboard-visual-grid,.dashboard-secondary-grid{grid-template-columns:1fr}.dashboard-side-stack{grid-template-columns:1fr 1fr;grid-template-rows:auto}.dashboard-operational-grid{grid-template-columns:1fr}.dashboard-agent-row{grid-template-columns:minmax(145px,.7fr) minmax(120px,.7fr) minmax(240px,1.6fr)}}
@media(max-width:760px){body[data-route="dashboard"] .shell{width:min(100% - 16px,1700px);margin-top:8px}.dashboard-page-head{align-items:stretch;margin:0 0 10px;padding:12px}.dashboard-title-icon{display:none}.dashboard-title-block h1{font-size:1.45rem}.dashboard-header-actions{justify-content:flex-start}.dashboard-header-actions .btn,.dashboard-more-actions{flex:1 1 130px}.dashboard-more-actions>summary{width:100%;text-align:center}.dashboard-report-toolbar{display:grid}.dashboard-report-toolbar .filters{display:grid;grid-template-columns:1fr 1fr}.dashboard-report-toolbar input{grid-column:1/-1}.dashboard-kpi-strip,.dashboard-summary-strip{grid-template-columns:repeat(2,1fr)}.dashboard-kpi-strip>a,.dashboard-summary-strip>a{border-bottom:1px solid #d9e2eb}.dashboard-kpi-strip>a:nth-child(2n),.dashboard-summary-strip>a:nth-child(2n){border-right:0}.dashboard-side-stack{grid-template-columns:1fr}.owner-status-axis{margin-left:95px}.owner-status-row{grid-template-columns:85px minmax(0,1fr) 24px}.owner-status-name{font-size:.65rem}.dashboard-agent-row{grid-template-columns:1fr}.dashboard-operational-grid{margin-top:10px}.dashboard-alert-list .alert-card{grid-template-columns:1fr}.dashboard-alert-list .alert-card-actions{justify-content:flex-start;max-width:none}}

/* Dense Gmail-style inbox and full-screen composer */
body[data-route="email-center"] .shell{width:100%;margin-top:8px;padding:8px 14px 22px}.email-center-title{min-height:38px;margin:0;padding:0 8px}.email-center-title h1{font-size:1.3rem}.email-center-title .eyebrow{display:none}.email-center-title .btn{min-height:32px;padding:6px 10px}
.email-mail-workspace{grid-template-columns:238px minmax(0,1fr);min-height:calc(100vh - 128px);border-radius:14px;box-shadow:0 2px 12px rgba(25,48,74,.09)}.email-mail-sidebar{padding:14px 10px;background:#eef4fa}.email-compose-button{min-width:176px;min-height:54px;border-radius:16px}.email-account-switcher{padding:0 6px}.email-mailbox-link{grid-template-columns:24px minmax(0,1fr) auto;padding:6px 12px}.email-mailbox-link::before{display:grid;width:20px;height:20px;place-items:center;color:#46556a;font-size:1rem;font-weight:800}.email-mailbox-inbox::before{content:"\2709"}.email-mailbox-sent::before{content:"\27A4"}.email-mailbox-junk::before{content:"!";border:2px solid currentColor;border-radius:50%;font-size:.68rem}.email-mailbox-all::before{content:"\25A3"}.email-mailbox-link.is-active::before{color:#102947}.email-mailbox-link span{font-size:.82rem}
.email-mail-main{border-radius:14px;background:#fff;overflow:hidden}.email-mail-toolbar{position:sticky;z-index:7;top:0;grid-template-columns:minmax(135px,auto) minmax(260px,700px) auto;min-height:66px;padding:9px 18px;border-bottom:1px solid #e2e8ef}.email-mail-toolbar h2{font-size:1.25rem}.email-mail-search input{min-height:44px;padding-left:42px;background-color:#edf3fa;background-image:linear-gradient(45deg,transparent 44%,#5b6676 44%,#5b6676 56%,transparent 56%);background-position:20px 14px;background-repeat:no-repeat;background-size:9px 9px}.email-mail-toolbar>span{font-size:.74rem}
.email-auto-sync-status{display:flex;align-items:center;justify-content:center;gap:10px;min-height:38px;padding:7px 14px;border-bottom:1px solid #dbe7ef;background:#f4f8fb;color:#52657d;font-size:.78rem;font-weight:800}.email-auto-sync-status[hidden]{display:none}.email-auto-sync-status[data-mode="checking"]{color:#176b8f}.email-auto-sync-status[data-mode="new"]{border-color:#9fe2bd;background:#ecfdf3;color:#166534}.email-auto-sync-status[data-mode="error"]{border-color:#fecaca;background:#fff1f2;color:#991b1b}.email-auto-sync-status button{min-height:32px;padding:5px 12px;border:0;border-radius:16px;background:#176b8f;color:#fff;font:inherit;cursor:pointer}
.email-mail-main>.email-activity{margin:0}.email-mail-main .email-activity-heading{position:sticky;z-index:6;top:66px;display:flex;align-items:center;justify-content:flex-start;gap:14px;min-height:54px;margin:0;padding:7px 14px;border-bottom:1px solid #dfe5ec;background:#fff;box-shadow:0 1px 3px rgba(16,41,71,.05)}.email-list-caption{font-size:0}.email-list-caption::before{content:"Mail";font-size:.72rem;color:#52657d}.email-bulk-controls{display:flex;align-items:center;gap:8px;min-width:0;width:100%}.email-master-select{display:flex;align-items:center;gap:7px;margin:0;padding:5px 8px;border-radius:4px;color:#45566d;font-size:.7rem;font-weight:800}.email-master-select:hover{background:#eef3f8}.email-selection-count{min-width:72px;color:#69778a;font-size:.68rem;font-weight:750}.email-bulk-shortcuts{display:flex;align-items:center;gap:3px}.email-bulk-shortcuts button{min-height:31px;padding:5px 8px;border:0;border-radius:4px;background:transparent;color:#2f4158;font-size:.68rem}.email-bulk-shortcuts button:hover{background:#e9eef4}.email-bulk-controls form{margin-left:auto}.email-bulk-controls .danger{min-height:32px;padding:6px 10px}.email-bulk-controls button:disabled{opacity:.42;cursor:not-allowed}
.email-log-list{border:0!important}.email-log-row{grid-template-columns:70px minmax(0,1fr);min-height:43px;border-bottom:1px solid #e7ebf0;background:#fff}.email-log-row:nth-child(even){background:#f7f9fc}.email-log-row.is-selected{background:#dbe8fb}.email-row-select{position:relative;gap:11px;background:transparent!important}.email-row-select::after{content:"\2606";color:#8c96a5;font-size:1.15rem}.email-row-select:hover::after{color:#4b596b}.email-row-select input{width:16px;height:16px}.email-log-row .email-log-card{background:transparent}.email-log-row .email-log-collapsible>summary{grid-template-columns:minmax(150px,215px) minmax(260px,1fr) auto minmax(106px,130px) 36px;min-height:43px;padding:5px 11px;background:transparent}.email-log-row .email-log-collapsible>summary:hover{background:#eef3f8;box-shadow:0 1px 4px rgba(16,41,71,.14)}.email-log-row.is-selected .email-log-collapsible>summary{background:#dbe8fb}.email-list-party{font-size:.74rem}.email-list-subject{font-size:.73rem}.email-list-state{display:flex;align-items:center;gap:5px}.email-file-count,.email-status{min-height:24px;padding:4px 8px;font-size:.62rem}.email-log-row summary time{font-size:.68rem}.email-expand-label{font-size:.66rem}.email-log-row .email-log-collapsible[open]>summary{background:#eef4fb}.email-log-row .email-log-expanded{padding:14px 18px 18px}.email-log-row .email-log-expanded>p{font-size:.78rem}.email-empty-mailbox{padding:56px 20px}
body:has(.email-compose-drawer[open]){overflow:hidden}.email-compose-drawer[open]{position:fixed!important;z-index:1000;inset:3vh 2vw!important;display:grid;grid-template-rows:auto minmax(0,1fr);margin:0!important;padding:0!important;max-width:none!important;max-height:none!important;overflow:hidden!important;border:1px solid #cdd7e2!important;border-radius:7px!important;background:#fff!important;box-shadow:0 0 0 100vmax rgba(26,31,38,.55),0 18px 60px rgba(0,0,0,.28)!important}.email-compose-drawer[open]>.email-compose-toggle{position:relative;z-index:2;min-height:52px;padding:10px 20px;border-bottom:1px solid #d9e2eb;background:#eef3fb}.email-compose-drawer[open]>.email-compose-toggle span{font-size:.94rem}.email-compose-drawer[open]>.email-compose-toggle small{max-width:55%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.email-compose-drawer[open]>.email-compose-content{display:grid;align-content:start;gap:10px;min-height:0;height:100%;padding:12px 20px 16px;overflow:auto;background:#fff}.email-compose-drawer[open] .email-lead-picker{grid-template-columns:minmax(220px,1.1fr) minmax(210px,.9fr) minmax(210px,.8fr) auto!important;gap:8px;padding:8px 10px!important;border:1px solid #e1e7ee!important;border-radius:4px;background:#f8fafc}.email-compose-drawer[open] .email-lead-search-control label{font-size:.67rem}.email-compose-drawer[open] .email-lead-picker input,.email-compose-drawer[open] .email-lead-picker select,.email-compose-drawer[open] .email-lead-picker button{min-height:36px;padding:6px 9px;font-size:.74rem}.email-compose-drawer[open] .lead-email-directory{min-height:148px;max-height:220px;padding:10px;overflow:auto;border-radius:4px}.email-compose-drawer[open] .lead-email-directory-head h3{font-size:.88rem}.email-compose-drawer[open] .lead-email-directory-head p{font-size:.68rem}.email-compose-drawer[open] .lead-email-contact{grid-template-columns:minmax(150px,.7fr) minmax(260px,1.3fr);padding:7px 9px}.email-compose-drawer[open] .lead-email-copy input,.email-compose-drawer[open] .lead-email-copy .btn{min-height:34px;padding:6px 8px;font-size:.7rem}
.email-compose-drawer[open] .email-compose-form{display:grid;grid-template-rows:minmax(410px,1fr) auto auto auto;gap:8px;min-height:calc(88vh - 250px)}.email-compose-drawer[open] .email-composer-shell{display:grid;grid-template-rows:auto auto auto minmax(260px,1fr);min-height:410px;border:1px solid #d8e0e8;border-radius:4px;overflow:hidden;box-shadow:none}.email-compose-drawer[open] .email-compose-routing{grid-template-columns:minmax(260px,.75fr) minmax(360px,1.25fr);padding:3px 14px;border-bottom:1px solid #e4e8ed}.email-compose-drawer[open] .email-compose-routing>div{display:grid;grid-template-columns:48px minmax(0,1fr);align-items:center}.email-compose-drawer[open] .email-compose-routing select,.email-compose-drawer[open] .email-compose-routing input{min-height:34px;padding:5px 8px}.email-compose-drawer[open] .email-copy-fields{border-bottom:1px solid #e4e8ed}.email-compose-drawer[open] .email-compose-subject{min-height:42px;border-bottom:1px solid #e4e8ed}.email-compose-drawer[open] .email-compose-subject input{min-height:38px;border:0!important;box-shadow:none!important}.email-compose-drawer[open] .email-compose-message{display:grid;grid-template-rows:auto minmax(210px,1fr);min-height:0;padding:9px 14px}.email-compose-drawer[open] .email-compose-message textarea{width:100%;height:100%;min-height:240px!important;padding:6px 0;border:0!important;border-radius:0!important;box-shadow:none!important;resize:none}.email-compose-drawer[open].is-forwarding .email-compose-message textarea{height:auto;min-height:70px!important;resize:vertical}.email-compose-drawer[open] .email-forward-source{overflow:auto}.email-compose-drawer[open] .email-attachment-manager{border-radius:4px}.email-compose-drawer[open] .email-compose-form>button[type="submit"]{position:sticky;bottom:0;z-index:3;min-width:142px;min-height:42px!important;margin-top:0;border-radius:20px}.email-compose-drawer[open] .email-send-progress{margin:0}
.email-attachment-link-only{border-color:#f1c36d;background:#fff8e8}.email-attachment-link-only small{color:#9a5b00}.email-attachment-link-only strong::after{content:" link";display:inline-flex;margin-left:6px;padding:2px 6px;border-radius:999px;background:#f59e0b;color:#fff;font-size:.62rem;font-weight:900;text-transform:uppercase;vertical-align:middle}
@media(max-width:1080px){.email-mail-workspace{grid-template-columns:194px minmax(0,1fr)}.email-log-row .email-log-collapsible>summary{grid-template-columns:minmax(120px,160px) minmax(220px,1fr) auto 35px}.email-log-row summary time{display:none}.email-compose-drawer[open]{inset:16px!important}.email-compose-drawer[open] .email-lead-picker{grid-template-columns:1fr 1fr!important}.email-compose-drawer[open] .email-lead-picker button{grid-column:1/-1}.email-compose-drawer[open] .email-compose-routing{grid-template-columns:1fr}}
@media(max-width:760px){body[data-route="email-center"] .shell{padding:6px}.email-center-title{display:none}.email-mail-workspace{display:block;min-height:calc(100vh - 80px)}.email-mail-sidebar{display:grid;grid-template-columns:1fr 1fr;padding:10px}.email-mailbox-nav{grid-template-columns:repeat(4,1fr)}.email-mailbox-link{grid-template-columns:1fr;justify-items:center;border-radius:8px}.email-mailbox-link::before{display:none}.email-mail-toolbar{position:static;grid-template-columns:1fr auto;min-height:58px}.email-mail-search{grid-column:1/-1}.email-mail-main .email-activity-heading{position:static;overflow-x:auto}.email-bulk-controls{min-width:max-content}.email-bulk-shortcuts{display:none}.email-log-row{grid-template-columns:42px minmax(0,1fr)}.email-row-select::after{display:none}.email-log-row .email-log-collapsible>summary{grid-template-columns:minmax(0,1fr) auto;gap:4px 8px}.email-list-party{grid-column:1}.email-list-state{grid-column:2}.email-list-subject{grid-column:1/3;grid-row:2}.email-expand-label{grid-column:2;grid-row:3}.email-log-row summary time{display:block;grid-column:1;grid-row:3}.email-compose-drawer[open]{inset:0!important;border:0!important;border-radius:0!important}.email-compose-drawer[open]>.email-compose-content{padding:8px}.email-compose-drawer[open] .email-lead-picker{grid-template-columns:1fr!important}.email-compose-drawer[open] .lead-email-contact{grid-template-columns:1fr}.email-compose-drawer[open] .email-compose-form{min-height:620px}.email-compose-drawer[open] .email-compose-routing>div{grid-template-columns:42px minmax(0,1fr)}}

/* Mobile-first PWA shell: presentation-only overrides, no backend or route changes. */
html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
body {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
body[data-crm-user="1"] {
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: 224px;
  background: #f5f8fb;
}
body[data-crm-user="1"] .app-header {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: 224px;
  height: 100vh;
  height: 100dvh;
  align-items: stretch !important;
  justify-content: flex-start;
  flex-direction: column !important;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  border: 0;
  border-right: 1px solid #d6e2ec;
  background: #ffffff;
  box-shadow: 4px 0 20px rgba(8, 33, 61, .05);
  overflow: hidden;
}
body[data-crm-user="1"] .app-header .brand {
  display: flex;
  min-height: 64px;
  align-items: center;
  padding: 8px;
}
body[data-crm-user="1"] .brand-logo {
  width: 184px;
  max-width: 100%;
}
.primary-nav {
  display: grid;
  align-content: start;
  justify-content: stretch;
  gap: 3px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0;
}
.primary-nav a,
.primary-nav button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  color: #34455f;
  font-size: .84rem;
  line-height: 1.15;
  white-space: normal;
}
.primary-nav button {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.primary-nav a:hover,
.primary-nav a.nav-active,
.primary-nav button:hover {
  background: #e8f2fa;
  color: #08213d;
}
.primary-nav a.nav-active {
  box-shadow: inset 4px 0 0 #0b6f91;
}
.primary-nav .nav-logout {
  margin-top: 10px;
  color: #8f1f1f;
}
.nav-logout-form,
.mobile-signout-form {
  margin: 0;
}
.primary-nav .nav-count-badge {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  margin-left: auto;
  place-items: center;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: .68rem;
}
.mobile-bottom-nav,
.mobile-signout,
.mobile-lead-actions {
  display: none;
}
.native-mobile-contact,
.native-mobile-text {
  display: none;
}
.email-server-lead-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}
.email-server-lead-search button {
  min-width: 64px;
  min-height: 44px;
  padding-inline: 12px;
}
body[data-crm-user="1"] .shell {
  width: min(100% - 36px, 1540px);
  min-width: 0;
  margin: 22px auto 64px;
}
.shell > *,
.panel,
.toolbar,
.lead-layout,
.form-grid,
.workflow-panel,
.table-wrap {
  min-width: 0;
  max-width: 100%;
}
.connection-status {
  position: fixed;
  z-index: 1200;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  max-width: min(440px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid #d6e2ec;
  border-radius: 6px;
  background: #08213d;
  color: #fff;
  box-shadow: 0 16px 40px rgba(8, 33, 61, .24);
  font-size: .88rem;
  font-weight: 800;
}
.connection-status[data-mode="offline"] { background: #991b1b; border-color: #fecaca; }
.connection-status[data-mode="reconnecting"] { background: #8a5800; border-color: #f5cc72; }
.connection-status[data-mode="online"] { background: #166534; border-color: #86efac; }
button,
.btn,
input[type="submit"],
input[type="button"],
summary,
a {
  -webkit-tap-highlight-color: rgba(11, 111, 145, .14);
}
button[aria-disabled="true"],
input[aria-disabled="true"] {
  pointer-events: none;
  opacity: .66;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #f4b83f !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(244, 184, 63, .2) !important;
}
form[data-submitting="1"] {
  cursor: progress;
}
form[data-draft-restored="1"] [data-autosave-status]::after {
  content: " · recovered on this device";
}

@media (min-width: 768px) and (max-width: 1180px) {
  body[data-crm-user="1"] { padding-left: 184px; }
  body[data-crm-user="1"] .app-header { width: 184px; padding-right: 9px; padding-left: calc(9px + env(safe-area-inset-left)); }
  body[data-crm-user="1"] .brand-logo { width: 158px; }
  .primary-nav a { padding: 9px 10px; font-size: .76rem; }
  body[data-crm-user="1"] .shell { width: min(100% - 24px, 1540px); margin-top: 14px; }
  body[data-crm-user="1"] :where(button, .btn, input, select, textarea, summary) { min-height: 44px; }
  .lead-table { min-width: 0 !important; width: 100% !important; table-layout: auto !important; }
  .lead-table th,
  .lead-table td { padding: 8px 7px !important; font-size: .7rem !important; }
  .lead-table .lead-col-dob,
  .lead-table .lead-dob-cell,
  .lead-table .lead-col-updated,
  .lead-table .lead-updated-cell { display: none !important; }
  .lead-table .lead-id-cell strong,
  .lead-table .lead-contact-cell strong,
  .lead-table .lead-case-cell strong { font-size: .72rem !important; }
  .lead-table small { font-size: .62rem !important; }
  .lead-table .badge { min-height: 28px; padding: 5px 7px !important; font-size: .58rem !important; }
  .lead-detail-hero h1 { font-size: 2rem; }
  .lead-hero-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-layout { grid-template-columns: 1fr !important; }
  .lead-side-rail { position: static !important; }
  [role="dialog"],
  dialog,
  .modal { max-width: calc(100vw - 220px); max-height: calc(100dvh - 32px); overflow: auto; }
}

@media (min-width: 768px) and (max-width: 900px) {
  .lead-table .lead-col-case,
  .lead-table .lead-case-cell,
  .lead-table .lead-col-attorney,
  .lead-table .lead-attorney-cell,
  .lead-table .lead-col-funding,
  .lead-table .lead-funding-cell { display: none !important; }
}

@media (max-width: 767px) {
  html { scroll-padding-top: calc(76px + env(safe-area-inset-top)); }
  :where(button, .btn, input, select, textarea, summary) { min-height: 44px; }
  :where(input, select, textarea) { font-size: 16px !important; }
  .login-wrap {
    width: auto;
    max-width: none;
    margin: calc(24px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  body[data-crm-user="1"] {
    padding: 0 0 calc(74px + env(safe-area-inset-bottom));
  }
  body[data-route="lead"] {
    padding-bottom: calc(136px + env(safe-area-inset-bottom));
  }
  body[data-crm-user="1"] .app-header {
    position: sticky !important;
    inset: 0 auto auto;
    width: 100%;
    height: auto;
    min-height: calc(62px + env(safe-area-inset-top));
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left));
    border: 0;
    border-bottom: 1px solid #d6e2ec;
    box-shadow: 0 4px 18px rgba(8, 33, 61, .07);
    overflow: visible;
  }
  body[data-crm-user="1"] .app-header .brand { min-height: 44px; padding: 3px; }
  body[data-crm-user="1"] .brand-logo { width: 164px; max-width: 65vw; }
  .primary-nav { display: none !important; }
  .mobile-signout {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    color: #52657d;
    font-size: .75rem;
    font-weight: 850;
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
  }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    padding: 5px max(5px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    border-top: 1px solid #cfdce7;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 28px rgba(8, 33, 61, .12);
    backdrop-filter: blur(18px);
  }
  .mobile-bottom-nav a {
    display: grid;
    min-width: 0;
    min-height: 54px;
    place-items: center;
    padding: 6px 3px;
    border-radius: 6px;
    color: #52657d;
    font-size: .69rem;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }
  .mobile-bottom-nav a.nav-active { background: #e3f1fa; color: #08213d; }
  .mobile-bottom-nav .nav-alert.hot { background: #fee2e2; color: #991b1b; }
  body[data-crm-user="1"] .shell,
  body[data-route="email-center"] .shell,
  body[data-route="dashboard"] .shell {
    width: 100%;
    margin: 0;
    padding: 12px max(10px, env(safe-area-inset-right)) 18px max(10px, env(safe-area-inset-left));
  }
  .connection-status {
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: calc(8px + env(safe-area-inset-left));
    max-width: none;
    border-radius: 6px;
  }
  body[data-route="lead"] .connection-status { bottom: calc(132px + env(safe-area-inset-bottom)); }
  body[data-crm-user="1"] :where(button, .btn, input, select, textarea, summary) {
    min-height: 44px;
  }
  body[data-crm-user="1"] :where(input, select, textarea) {
    max-width: 100%;
    font-size: 16px !important;
  }
  body[data-crm-user="1"] textarea { line-height: 1.45; }
  .toolbar { gap: 12px; margin-bottom: 14px; }
  .toolbar h1,
  h1 { font-size: clamp(1.65rem, 9vw, 2.35rem); }
  .panel { padding: 14px !important; border-radius: 6px !important; }
  .form-grid,
  .workflow-panel,
  .grid-3,
  .grid-4,
  .lead-layout { grid-template-columns: 1fr !important; }
  .workflow-panel { gap: 10px; padding: 12px !important; }
  .workflow-field { min-width: 0; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters > * { width: 100% !important; max-width: none !important; }
  .filters > input:first-of-type { grid-column: 1 / -1; }
  .filters > button { grid-column: 1 / -1; }
  section.panel > form.filters:first-child { position: static !important; }
  .lead-detail-hero {
    display: block !important;
    padding: 15px !important;
    border-left-width: 5px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(8, 33, 61, .09);
  }
  .lead-detail-hero h1 { font-size: clamp(1.65rem, 8vw, 2.1rem); }
  .lead-detail-hero .eyebrow { font-size: .68rem; line-height: 1.45; letter-spacing: .12em; }
  .lead-hero-contact { gap: 8px; margin-top: 12px; }
  .lead-hero-phone,
  .lead-hero-email { width: 100%; min-height: 44px; justify-content: flex-start; padding: 8px 10px; overflow-wrap: anywhere; }
  .lead-hero-phone { font-size: 1.25rem; }
  .lead-hero-summary { grid-template-columns: 1fr 1fr !important; gap: 7px; }
  .lead-hero-summary-item { min-height: 56px; padding: 8px; }
  .lead-hero-summary-item span { font-size: .61rem; }
  .lead-hero-summary-item strong { font-size: .8rem; overflow-wrap: anywhere; }
  .lead-action-bar { position: static !important; display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-top: 12px; }
  .lead-action-bar > * { min-width: 0; width: 100%; }
  .lead-action-bar .btn,
  .lead-action-bar button { min-height: 44px; padding: 9px 10px; font-size: .75rem; }
  .mobile-lead-actions {
    position: fixed;
    z-index: 110;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 5px max(5px, env(safe-area-inset-right)) 5px max(5px, env(safe-area-inset-left));
    border-top: 1px solid #d6e2ec;
    background: #08213d;
    box-shadow: 0 -6px 22px rgba(8, 33, 61, .2);
  }
  .mobile-lead-actions > a,
  .mobile-lead-actions > span,
  .mobile-lead-actions > button {
    display: grid;
    width: 100% !important;
    min-width: 0;
    min-height: 54px;
    place-items: center;
    padding: 6px 3px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #fff;
    box-shadow: none;
    font-size: .68rem;
    line-height: 1.05;
    text-align: center;
  }
  .mobile-lead-actions > *:hover { background: rgba(255, 255, 255, .1); }
  .mobile-lead-actions .is-disabled { opacity: .38; }
  .mobile-lead-actions strong { font-size: inherit; white-space: normal; }
  #lead-workflow,
  #lead-notes { scroll-margin-top: calc(80px + env(safe-area-inset-top)); }
  .lead-side-rail { position: static !important; }
  .lead-table-wrap { overflow: visible !important; }
  .lead-table { min-width: 0 !important; width: 100% !important; table-layout: auto !important; }
  .lead-table tr { margin-bottom: 10px !important; border-radius: 6px !important; box-shadow: 0 7px 20px rgba(8, 33, 61, .08) !important; }
  .lead-table td { grid-template-columns: 96px minmax(0, 1fr) !important; gap: 9px !important; padding: 9px 11px !important; font-size: .81rem !important; overflow-wrap: anywhere; }
  .lead-table td::before { font-size: .61rem !important; }
  .lead-table .lead-id-cell strong { font-size: 1rem !important; }
  .lead-table .desktop-contact-link { display: none !important; }
  .lead-table .native-mobile-contact {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: #075d7b;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .lead-table .lead-contact-cell small a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    overflow-wrap: anywhere;
  }
  .lead-table .native-mobile-text {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-left: 96px;
    padding: 7px 16px;
    border: 1px solid #a9ccdc;
    border-radius: 5px;
    background: #e8f4f9;
    color: #075d7b;
    font-weight: 850;
  }
  .lead-table .lead-action-cell form,
  .lead-table .lead-action-cell button { width: 100%; }
  .table-wrap:not(.lead-table-wrap) { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pagination,
  .lead-pagination { align-items: stretch; flex-direction: column; }
  .lead-pagination > div { display: grid; grid-template-columns: 1fr 1fr; }
  .lead-pagination .btn { width: 100%; }
  [role="dialog"],
  dialog,
  .modal {
    inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
    overscroll-behavior: contain;
  }
  .email-compose-drawer[open] {
    inset: 0 !important;
    width: 100% !important;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh !important;
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
  .email-compose-drawer[open] > .email-compose-content {
    min-height: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .email-compose-drawer[open] .email-compose-form { min-height: 0 !important; }
  .email-compose-drawer[open] .email-composer-shell { min-height: 360px; }
  .email-compose-drawer[open] .email-compose-form > button[type="submit"] { bottom: env(safe-area-inset-bottom); min-height: 48px !important; }
  .email-mail-sidebar { grid-template-columns: 1fr !important; gap: 8px; }
  .email-mailbox-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .email-mailbox-link { min-height: 48px; padding: 7px 3px; }
  .email-mail-toolbar { grid-template-columns: 1fr !important; padding: 9px 10px; }
  .email-mail-toolbar > span { justify-self: start; }
  .email-mail-main .email-activity-heading { overflow-x: visible; }
  .email-bulk-controls { min-width: 0; flex-wrap: wrap; }
  .email-bulk-controls form { margin-left: 0; }
  .email-log-row { grid-template-columns: 44px minmax(0, 1fr) !important; }
  .email-log-row .email-log-collapsible > summary { min-height: 58px; }
}

@media (display-mode: standalone) {
  body[data-crm-user="1"] .app-header { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* Final touch-size guard: older compact component rules use !important. */
@media (max-width: 1180px) {
  body[data-crm-user="1"] :where(button, .btn, input, select, textarea, summary) {
    min-height: 44px !important;
  }
}

/* Full-message reader: calm Gmail-style hierarchy with CRM tools kept below the message. */
body.email-popout-open::before {
  background: rgba(18, 31, 47, .52);
  backdrop-filter: blur(2px);
}
.email-log-row .email-log-collapsible[open] > .email-log-expanded {
  position: fixed;
  z-index: 790;
  inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  width: auto;
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbd7e2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(8, 25, 43, .38);
}
.email-reader-toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 10px 20px;
  border-bottom: 1px solid #e1e7ee;
  background: #f8fafc;
}
.email-reader-back {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: auto !important;
  min-width: 0;
  min-height: 42px;
  padding: 7px 12px 7px 9px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #1e344d;
  box-shadow: none;
}
.email-reader-back:hover,
.email-reader-back:focus-visible { background: #e8eef5; color: #102947; }
.email-reader-back > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}
.email-reader-back strong { font-size: .86rem; }
.email-reader-toolbar-actions,
.email-reader-footer-actions { display: flex; align-items: center; gap: 9px; }
.email-reader-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid #c8d4df;
  border-radius: 22px;
  background: #fff;
  color: #17334e;
  font-size: .82rem;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 41, 71, .06);
}
.email-reader-action > span { font-size: 1.2rem; line-height: 1; }
.email-reader-action:hover,
.email-reader-action:focus-visible { border-color: #86abc4; background: #eef6fb; color: #0b638f; }
.email-reader-action.email-reply-action { border-color: #8fc6df; background: #eaf6fc; color: #075f89; }
.email-reader-action.email-reply-action:hover,
.email-reader-action.email-reply-action:focus-visible { border-color: #4b9fc4; background: #d9eff9; color: #064f72; }
.email-reader-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  scrollbar-gutter: stable;
}
.email-reader-main {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 34px 52px 64px;
}
.email-reader-subject { margin: 0 0 27px; }
.email-reader-subject > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.email-reader-subject h2 {
  min-width: 0;
  margin: 0;
  color: #172b43;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 720;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.email-reader-badges { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.email-reader-lead { display: inline-flex; align-items: center; }
.email-reader-lead a,
.email-reader-lead .email-unmatched {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 5px;
  background: #eef2f6;
  color: #42546a;
  font-size: .68rem;
  font-weight: 850;
  text-decoration: none;
}
.email-reader-lead a:hover { background: #dfeaf3; color: #0d658c; }
.email-reader-sender {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  padding: 2px 0 21px;
  border-bottom: 1px solid #e8edf2;
}
.email-reader-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: #176f88;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}
.email-reader-identity { display: grid; gap: 3px; min-width: 0; padding-top: 2px; }
.email-reader-identity > strong {
  overflow: hidden;
  color: #172b43;
  font-size: .95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-reader-sender > time { padding-top: 5px; color: #65758a; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.email-reader-routing { width: max-content; max-width: 100%; }
.email-reader-routing > summary {
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  color: #65758a;
  font-size: .74rem;
  font-weight: 700;
  list-style-position: outside;
}
.email-reader-routing[open] > summary { color: #176b8f; }
.email-reader-routing .email-route {
  display: grid;
  gap: 5px;
  width: min(560px, 72vw);
  margin-top: 9px;
  padding: 11px 13px;
  border: 1px solid #dce5ed;
  border-radius: 7px;
  background: #f8fafc;
  color: #52657d;
  font-size: .72rem;
}
.email-reader-routing .email-route b { display: inline-block; min-width: 58px; color: #223c57; }
.email-reader-message { padding: 30px 0 42px; }
.email-reader-content {
  width: min(100%, 980px);
  min-height: 140px;
  color: #26384c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.68;
  overflow-wrap: anywhere;
  white-space: normal;
}
.email-reader-attachments {
  display: grid;
  gap: 10px;
  width: min(100%, 980px);
  margin: 0 0 26px;
  padding-top: 18px;
  border-top: 1px solid #e8edf2;
}
.email-reader-attachments > header { display: flex; align-items: center; gap: 9px; }
.email-reader-attachments > header strong { color: #26384c; font-size: .82rem; }
.email-reader-attachments > header span { color: #728196; font-size: .68rem; font-weight: 750; }
.email-attachment-links { display: flex; flex-wrap: wrap; gap: 8px; }
.email-attachment-links a,
.email-reader-attachment-static {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  min-width: 210px;
  max-width: 340px;
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid #d7e0e8;
  border-radius: 7px;
  background: #fbfcfd;
  color: #25405a;
  text-decoration: none;
}
.email-attachment-links a > span,
.email-reader-attachment-static > span { grid-row: 1 / 3; color: #176b8f; font-size: 1.2rem; }
.email-attachment-links a strong,
.email-reader-attachment-static strong { min-width: 0; overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.email-attachment-links a small { color: #728196; font-size: .63rem; }
.email-attachment-links a:hover { border-color: #78afca; background: #eef8fc; }
.email-reader-outcome { width: min(100%, 980px); margin-bottom: 24px; }
.email-reader-footer-actions { margin: 4px 0 38px; }
.email-reader-footer-actions .email-reader-action { min-width: 118px; min-height: 46px; }
.email-reader-main > .email-match-panel {
  width: min(100%, 980px);
  margin-top: 14px;
  padding: 18px;
  border-color: #d6e1ea;
  background: #f8fbfd;
}
.email-reader-main > .email-match-panel > header strong { color: #1d3852; font-size: .9rem; }

@media (max-width: 820px) {
  .email-log-row .email-log-collapsible[open] > .email-log-expanded {
    inset: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
    grid-template-rows: 58px minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }
  .email-reader-toolbar { padding: 8px 11px; }
  .email-reader-back { padding-inline: 5px 9px; }
  .email-reader-back strong { display: none; }
  .email-reader-action { min-width: 88px; min-height: 40px; padding: 7px 12px; }
  .email-reader-main { padding: 24px 18px calc(44px + env(safe-area-inset-bottom)); }
  .email-reader-subject { margin-bottom: 22px; }
  .email-reader-subject > div { display: grid; gap: 12px; }
  .email-reader-subject h2 { font-size: 1.3rem; }
  .email-reader-badges { justify-content: flex-start; }
  .email-reader-sender { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .email-reader-avatar { width: 42px; height: 42px; }
  .email-reader-sender > time { grid-column: 2; padding: 0; }
  .email-reader-message { padding: 24px 0 34px; }
  .email-reader-content { min-height: 100px; font-size: .94rem; line-height: 1.62; }
  .email-reader-main > .email-match-panel > header { display: grid; }
}

@media (max-width: 440px) {
  .email-reader-toolbar-actions { gap: 6px; }
  .email-reader-action { min-width: 44px; padding-inline: 11px; font-size: 0; }
  .email-reader-action > span { font-size: 1.25rem; }
  .email-reader-footer-actions .email-reader-action { min-width: 112px; font-size: .8rem; }
  .email-reader-footer-actions .email-reader-action > span { font-size: 1.15rem; }
  .email-reader-main { padding-inline: 14px; }
  .email-reader-routing .email-route { width: calc(100vw - 86px); }
  .email-attachment-links a,
  .email-reader-attachment-static { width: 100%; max-width: none; }
}

/* Task Center: visible priorities, due-state grouping, filtering, and quick actions. */
.dashboard-operational-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, .72fr);
  align-items: start;
}
.dashboard-task-panel,
.lead-task-panel {
  min-width: 0;
  padding: 18px;
  border-color: #cddbe7;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(8, 33, 61, .07);
}
.task-workspace-heading {
  align-items: flex-start;
  margin: 0;
}
.task-workspace-heading h2 {
  margin: 1px 0 3px;
  color: #0d2746;
  font-size: 1.35rem;
}
.task-workspace-heading p:last-child {
  margin: 0;
  color: #64748b;
  font-size: .82rem;
  font-weight: 700;
}
.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #d6e1eb;
  border-radius: 6px;
  background: #fff;
}
.task-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 0;
  border-right: 1px solid #d6e1eb;
  border-radius: 0;
  background: #fff;
  color: #18314f;
  box-shadow: none;
  text-align: left;
}
.task-summary:last-child { border-right: 0; }
.task-summary:hover,
.task-summary.is-active { box-shadow: inset 0 -4px currentColor; transform: none; }
.task-summary small { overflow: hidden; font-size: .72rem; font-weight: 900; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.task-summary strong { font-size: 1.45rem; line-height: 1; }
.task-summary-overdue { color: #a51d23; background: #fff3f3; }
.task-summary-today { color: #9a5000; background: #fff7e8; }
.task-summary-upcoming { color: #075b83; background: #eff9ff; }
.task-summary-unscheduled { color: #526174; background: #f6f8fa; }
.task-summary-complete { color: #176a3a; background: #effaf3; }
.task-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(5, minmax(112px, .72fr)) auto;
  align-items: end;
  gap: 9px;
  padding: 12px;
  border: 1px solid #d6e1eb;
  border-radius: 6px;
  background: #f6f9fc;
}
.task-filter-bar label { min-width: 0; margin: 0; }
.task-filter-bar label > span { display: block; margin: 0 0 4px; color: #53657d; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.task-filter-bar input,
.task-filter-bar select,
.task-filter-bar .btn { min-height: 40px; padding: 8px 10px; border-radius: 5px; font-size: .78rem; }
.task-filter-reset { white-space: nowrap; }
.task-result-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #68778b; font-size: .75rem; }
.task-result-line strong { color: #18314f; font-size: .82rem; }
.task-board.dashboard-task-board,
.task-board.lead-task-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  max-height: 680px;
  overflow: auto;
  padding: 1px 3px 3px 1px;
}
.task-card {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid #cbdbe8;
  border-left: 7px solid #1682a8;
  border-radius: 6px;
  background: #f8fcff;
  box-shadow: 0 4px 12px rgba(8, 33, 61, .05);
  opacity: 1;
}
.task-card.task-priority-theme-urgent { border-left-color: #d92d36; background: #fff5f5; }
.task-card.task-priority-theme-high { border-left-color: #d88400; background: #fff9eb; }
.task-card.task-priority-theme-normal { border-left-color: #1682a8; background: #f5fbff; }
.task-card.task-priority-theme-low { border-left-color: #607386; background: #f7f9fb; }
.task-card.task-timing-overdue { border-color: #e8a5a9; border-left-color: #bd1f29; background: #fff0f0; }
.task-card.task-timing-today { border-color: #efc47f; border-left-color: #d46b00; background: #fff7e7; }
.task-card.task-done { border-color: #a7d8b8; border-left-color: #23854c; background: #effaf3; }
.task-card.task-canceled { border-color: #cdd5df; border-left-color: #7a8796; background: #f3f5f7; opacity: .86; }
.task-card[hidden] { display: none !important; }
.task-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-card-badges { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.task-badge,
.task-priority,
.task-type-badge,
.task-due-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.1;
}
.task-priority-urgent { border-color: #efadb1; background: #ffe2e3; color: #a0161e; }
.task-priority-high { border-color: #f0c471; background: #fff0c9; color: #875000; }
.task-priority-normal { border-color: #a9d7ea; background: #def3fc; color: #075b7d; }
.task-priority-low { border-color: #cbd5df; background: #edf1f5; color: #506173; }
.task-type-badge { border-color: #d9e1e9; background: #fff; color: #4c5e74; }
.task-due-badge { max-width: 50%; justify-content: flex-end; border-radius: 5px; text-align: right; }
.task-due-overdue { border-color: #efb2b5; background: #ffe1e2; color: #9f1720; }
.task-due-today { border-color: #efc477; background: #ffedc6; color: #875000; }
.task-due-upcoming { border-color: #abd6e8; background: #e5f6fd; color: #075b7d; }
.task-due-later { border-color: #c2d5e3; background: #eef5fa; color: #405c72; }
.task-due-unscheduled { border-color: #d4dae1; background: #f2f4f6; color: #647184; }
.task-due-completed { border-color: #b3dec0; background: #ddf5e5; color: #176a3a; }
.task-due-canceled { border-color: #d1d7de; background: #eceff2; color: #657285; }
.task-card h3,
.dashboard-task-board .task-card h3 {
  margin: 10px 0 7px;
  color: #102541;
  font-size: 1.02rem;
  line-height: 1.25;
}
.task-card h3 a { color: inherit; text-decoration: none; }
.task-card h3 a:hover { color: #0b6f91; text-decoration: underline; }
.task-lead-link {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #4f6178;
  font-size: .76rem;
  text-decoration: none;
}
.task-lead-link span { flex: none; color: #0b6f91; font-weight: 950; }
.task-lead-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-detail-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(103, 127, 151, .2); }
.task-detail-item { display: grid; gap: 2px; min-width: 110px; color: #203852; }
.task-detail-item small { color: #69798e; font-size: .64rem; font-weight: 900; text-transform: uppercase; }
.task-detail-item strong { font-size: .76rem; }
.task-notes { display: -webkit-box; overflow: hidden; margin: 9px 0 0; color: #53657a; font-size: .77rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.task-actions { align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(103, 127, 151, .2); }
.task-actions form { margin: 0; }
.task-actions .btn,
.task-actions button { min-height: 34px; padding: 7px 10px; border-radius: 5px; font-size: .72rem; }
.task-complete-button { border-color: #19864b; background: #19864b; color: #fff; }
.task-edit-drawer { position: relative; }
.task-edit-drawer > summary { list-style: none; cursor: pointer; }
.task-edit-drawer > summary::-webkit-details-marker { display: none; }
.task-edit-drawer[open] { width: 100%; }
.task-edit-drawer[open] > summary { margin-bottom: 8px; }
.task-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid #cbd8e4;
  border-radius: 6px;
  background: #fff;
}
.task-edit-form label { margin-bottom: 3px; color: #53657d; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.task-edit-form input,
.task-edit-form select,
.task-edit-form textarea { min-height: 38px; padding: 7px 9px; border-radius: 4px; font-size: .78rem; }
.task-edit-title,
.task-edit-notes,
.task-edit-submit { grid-column: 1 / -1; }
.task-edit-form textarea { min-height: 74px; }
.task-filter-empty { margin: 0; padding: 30px 16px; border: 1px dashed #bdcad7; border-radius: 6px; background: #f8fafc; color: #64748b; font-weight: 800; text-align: center; }
.task-create-form { padding: 13px; border: 1px solid #cbdbe8; border-radius: 6px; background: #f6f9fc; }
.task-create-form textarea { min-height: 76px; }
.task-owner-field {
  min-width: 0;
  padding: 12px;
  border: 2px solid #c8d7e5;
  border-radius: 6px;
  background: #fff;
}
.task-owner-field > label,
.task-owner-label label { margin: 0; }
.task-owner-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 7px;
}
.task-owner-label span {
  padding: 3px 7px;
  border-radius: 4px;
  background: #fff0d0;
  color: #8d5200;
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.task-owner-field select { margin: 0; border-width: 2px; }
.task-owner-field > small {
  display: block;
  margin-top: 7px;
  color: #61728a;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.35;
}
.task-owner-required { border-left: 7px solid #d88400; background: #fffaf0; }
.task-owner-required.is-ready { border-color: #63b990; border-left-color: #178553; background: #f2fbf6; }
.task-owner-identity {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  padding: 9px 11px;
  border: 1px solid #aedfc6;
  border-radius: 5px;
  background: #edf9f2;
}
.task-owner-identity > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #11693f;
  color: #fff;
  font-size: .72rem;
  font-weight: 950;
}
.task-owner-identity div { display: grid; min-width: 0; gap: 2px; }
.task-owner-identity strong { overflow: hidden; color: #123e2a; font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
.task-owner-identity small { color: #3e7358; font-size: .75rem; font-weight: 800; }
.task-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 2px;
}
.task-submit-row > span { color: #63748a; font-size: .78rem; font-weight: 800; }
.task-submit-row button { min-width: 220px; }
.task-submit-row button:disabled { border-color: #ccd5df; background: #dfe5eb; color: #718095; box-shadow: none; cursor: not-allowed; }
.task-edit-owner-locked { display: grid; align-content: start; gap: 4px; }
.task-edit-owner-locked strong { color: #173554; font-size: .86rem; }
.task-edit-owner-locked small { color: #68788d; font-size: .7rem; line-height: 1.3; }
@media (max-width: 620px) {
  .task-submit-row { align-items: stretch; flex-direction: column; }
  .task-submit-row button { width: 100%; min-width: 0; }
}

/* Larger, easier-to-scan mailbox typography. */
body[data-route="email-center"] .email-log-row { min-height: 56px; }
body[data-route="email-center"] .email-log-row .email-log-collapsible > summary { min-height: 56px; padding: 8px 13px; }
body[data-route="email-center"] .email-list-party { font-size: .9rem; line-height: 1.25; }
body[data-route="email-center"] .email-list-subject { font-size: .88rem; line-height: 1.3; }
body[data-route="email-center"] .email-log-row summary time { font-size: .76rem; }
body[data-route="email-center"] .email-file-count,
body[data-route="email-center"] .email-status { min-height: 28px; padding: 5px 9px; font-size: .7rem; }
body[data-route="email-center"] .email-expand-label { font-size: .72rem; }

@media (max-width: 1350px) {
  .dashboard-operational-grid { grid-template-columns: 1fr; }
  .dashboard-task-panel { grid-row: 1; }
  .task-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-search-field { grid-column: span 2; }
}
@media (max-width: 980px) {
  .task-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-summary:nth-child(3) { border-right: 0; }
  .task-summary:nth-child(n+4) { border-top: 1px solid #d6e1eb; }
  .task-board.dashboard-task-board,
  .task-board.lead-task-board { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .dashboard-task-panel,
  .lead-task-panel { padding: 13px; }
  .task-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-summary { border-top: 1px solid #d6e1eb; }
  .task-summary:nth-child(-n+2) { border-top: 0; }
  .task-summary:nth-child(2n) { border-right: 0; }
  .task-filter-bar { grid-template-columns: 1fr 1fr; }
  .task-search-field { grid-column: 1 / -1; }
  .task-filter-reset { grid-column: 1 / -1; }
  .task-card-heading { display: grid; }
  .task-due-badge { max-width: 100%; justify-self: start; text-align: left; }
  .task-edit-form { grid-template-columns: 1fr; }
  .task-edit-title,
  .task-edit-notes,
  .task-edit-submit { grid-column: auto; }
  .task-result-line { display: grid; }
  body[data-route="email-center"] .email-list-party { font-size: .88rem; }
  body[data-route="email-center"] .email-list-subject { font-size: .84rem; }
}

/* Email replies stay visually distinct from forwarding and custom mail. */
.email-log-actions .email-reply-action {
  border-color: #0b6fb2;
  background: #0b6fb2;
  color: #fff;
  box-shadow: 0 2px 6px rgba(11, 111, 178, .2);
}
.email-log-actions .email-reply-action:hover,
.email-log-actions .email-reply-action:focus-visible {
  border-color: #084f81;
  background: #084f81;
  color: #fff;
}
.email-compose-drawer.is-replying .email-compose-toggle { background: #e8f3fb; }
.email-compose-drawer.is-replying .email-forward-arrow { color: #0b6fb2; font-weight: 900; }
.email-reply-source { border-top-color: #bdd9ec; }
.email-reply-source .email-forward-source-body { border-left-color: #8ebfdc; background: #f7fbfe; }

@media (max-width: 760px) {
  .email-compose-drawer[open].is-replying .email-compose-form {
    display: block;
    min-height: 0 !important;
  }
  .email-compose-drawer[open].is-replying .email-composer-shell {
    display: block;
    min-height: 0 !important;
    overflow: visible;
  }
  .email-compose-drawer[open].is-replying .email-compose-message {
    display: block;
    overflow: visible;
  }
  .email-compose-drawer[open].is-replying .email-compose-message textarea {
    display: block;
    height: 210px !important;
    min-height: 210px !important;
    margin-top: 8px;
  }
  .email-compose-drawer[open].is-replying .email-forward-source {
    max-height: none;
    overflow: visible;
  }
  .email-compose-drawer[open].is-replying .email-attachment-manager,
  .email-compose-drawer[open].is-replying .email-send-progress,
  .email-compose-drawer[open].is-replying .email-compose-form > button[type="submit"] {
    margin-top: 14px;
  }
  .email-compose-drawer[open].is-replying .email-compose-form > button[type="submit"] {
    position: static !important;
  }
}

/* Team Chat: release conversation-list space when desktop zoom or width gets tight. */
body[data-route="chat"] .chat-sidebar-collapse {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #c9d9e6;
  border-radius: 6px;
  background: #fff;
  color: #0b587d;
  font-size: .66rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
body[data-route="chat"] .chat-sidebar-collapse:hover {
  border-color: #75b8d5;
  background: #eef8fc;
}
body[data-route="chat"] .chat-sidebar-collapse span {
  font-size: 1.35rem;
  line-height: .7;
}

@media (min-width: 761px) {
  body[data-route="chat"] .chat-app {
    transition: grid-template-columns .2s ease;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed {
    grid-template-columns: 74px minmax(0, 1fr) !important;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar {
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar > header {
    min-height: 66px;
    justify-content: center;
    padding: 10px 8px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-title,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-count,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-search,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-thread-copy,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-thread-side {
    display: none !important;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-head-actions {
    justify-content: center;
    width: 100%;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-collapse {
    width: 48px;
    height: 42px;
    padding: 0;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-collapse strong {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-sidebar-collapse span {
    font-size: 1.9rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-new-panel {
    margin: 9px auto 7px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-new-panel > summary {
    width: 48px;
    min-height: 48px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-new-panel > summary span {
    color: #0b587d;
    font-size: 1.65rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-new-panel[open] > form {
    position: fixed;
    z-index: 1350;
    top: 84px;
    left: 86px;
    width: min(420px, calc(100vw - 110px));
    max-height: calc(100vh - 104px);
    overflow: auto;
    box-shadow: 0 18px 46px rgba(15, 42, 71, .22);
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-thread-list {
    align-items: center;
    padding: 5px 7px 12px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-thread-row {
    width: 56px;
    min-height: 56px;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 5px;
    border-left-width: 3px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-thread-avatar {
    width: 42px;
    height: 42px;
    font-size: .82rem;
  }

  /* The active conversation becomes the reader view in compact mode. */
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-conversation-head {
    min-height: 92px;
    padding: 14px 20px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-conversation-head > div > .chat-thread-avatar {
    width: 50px;
    height: 50px;
    font-size: .95rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-conversation-head h1 {
    font-size: 1.5rem;
    line-height: 1.15;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-member-chip {
    font-size: .78rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-board {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 14px;
    padding: 12px 18px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-board > header strong {
    font-size: 1.02rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-board > header b,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-board > header span {
    font-size: .72rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-item {
    min-width: min(430px, 72vw);
    max-width: 520px;
    padding: 12px 40px 12px 12px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-lead a,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-lead span {
    font-size: .83rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-copy p {
    font-size: .9rem;
    line-height: 1.45;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-task-copy small {
    font-size: .7rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message-list {
    padding: 18px 22px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message {
    max-width: min(980px, 88%);
    gap: 10px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message > .chat-avatar {
    width: 42px;
    height: 42px;
    font-size: .8rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message-meta strong {
    font-size: .9rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message-meta time {
    font-size: .74rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-bubble {
    padding: 14px 17px;
    font-size: 1.1rem;
    line-height: 1.55;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-lead-links a {
    font-size: .78rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-composer {
    padding: 12px 18px 15px;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-composer textarea {
    min-height: 96px;
    padding: 13px 15px;
    font-size: 1.06rem;
    line-height: 1.5;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-mention-tools,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-compose-tip,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-lead-picker > summary {
    font-size: .78rem;
  }
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-send-button {
    min-height: 46px;
    padding-inline: 18px;
    font-size: .9rem;
  }
}

@media (max-width: 760px) {
  body[data-route="chat"] .chat-sidebar-collapse {
    display: none !important;
  }
}

/* Make the matched loan file unmistakable and render safe rich email content. */
.email-reader-lead a {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 1px 8px;
  min-height: 43px;
  padding: 6px 12px;
  border: 1px solid #83bdd5;
  border-left: 5px solid #147b9c;
  border-radius: 7px;
  background: #eaf7fc;
  color: #0d5775;
  box-shadow: 0 3px 9px rgba(15, 91, 122, .12);
}
.email-reader-lead a > span {
  color: #557089;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}
.email-reader-lead a > strong {
  font-size: .82rem;
  font-weight: 950;
  line-height: 1.1;
}
.email-reader-lead a > small {
  grid-column: 1 / -1;
  max-width: 230px;
  overflow: hidden;
  color: #435c73;
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-reader-lead a:hover,
.email-reader-lead a:focus-visible {
  border-color: #167a9d;
  background: #d9f0f9;
  color: #084b67;
  transform: translateY(-1px);
}
.email-reader-lead .email-unmatched {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid #efb6b1;
  border-left: 5px solid #c94b42;
  background: #fff0ef;
  color: #8f2e29;
}
.email-reader-lead .email-unmatched b { margin-right: 6px; }
.email-reader-content a {
  color: #075f91;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.email-reader-content a:hover,
.email-reader-content a:focus-visible { color: #c55318; }
.email-reader-content img {
  display: block;
  width: auto;
  max-width: 100% !important;
  height: auto !important;
  margin: 10px 0;
  object-fit: contain;
}
.email-reader-content table {
  width: auto;
  max-width: 100% !important;
  border-collapse: collapse;
}
.email-reader-content td,
.email-reader-content th { max-width: 100%; overflow-wrap: anywhere; }
.email-reader-content blockquote {
  margin: 18px 0;
  padding-left: 14px;
  border-left: 3px solid #cfdbe5;
  color: #53677c;
}
.email-reader-content pre { max-width: 100%; overflow: auto; white-space: pre-wrap; }

@media (max-width: 760px) {
  .email-reader-subject > div { display: grid; }
  .email-reader-badges { justify-content: stretch; }
  .email-reader-lead,
  .email-reader-lead a { width: 100%; }
  .email-reader-lead a > small { max-width: none; }
}

/* Replies open beneath the selected email instead of taking over the screen. */
.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: grid !important;
  grid-template-rows: auto auto !important;
  width: min(100%, 980px) !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 980px !important;
  max-height: none !important;
  margin: 18px 0 28px !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 1px solid #cfd9e4 !important;
  border-radius: 8px !important;
  background: #fff !important;
  box-shadow: 0 4px 18px rgba(16, 41, 71, .12) !important;
}

.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) 28px !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 46px !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid #e2e8ef !important;
  background: #f8fafc !important;
  cursor: pointer !important;
}

.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle::after {
  content: "\00d7";
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
}

.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle:hover::after {
  background: #e8eef5;
  color: #102947;
}

.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle small {
  max-width: 100% !important;
  overflow: hidden !important;
  color: #64748b !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-content {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-lead-picker,
.email-compose-drawer[open].is-replying.is-inline-reply .lead-email-directory {
  display: none !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-form {
  display: grid !important;
  grid-template-rows: auto !important;
  gap: 0 !important;
  min-height: 0 !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-composer-shell {
  display: block !important;
  min-height: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-routing {
  display: block !important;
  padding: 7px 14px !important;
  border-bottom: 1px solid #e6ebf0 !important;
  background: #fff !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-routing > div:first-child {
  display: none !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-routing > .email-compose-to {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-routing input {
  min-height: 34px !important;
  padding: 4px 0 !important;
  border: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-copy-fields > summary {
  padding: 7px 14px !important;
  font-size: .72rem !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-subject,
.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-message > label,
.email-compose-drawer[open].is-replying.is-inline-reply .email-reply-source {
  display: none !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-message {
  display: block !important;
  min-height: 0 !important;
  padding: 14px !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-message textarea {
  display: block !important;
  width: 100% !important;
  height: 160px !important;
  min-height: 160px !important;
  max-height: 340px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  resize: vertical !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-attachment-manager {
  margin: 0 14px 10px !important;
  border-radius: 6px !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-attachment-manager > summary {
  padding: 7px 10px !important;
  background: #f8fafc !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-send-progress {
  margin: 0 14px 10px !important;
}

.email-compose-drawer[open].is-replying.is-inline-reply .email-compose-form > button[type="submit"] {
  position: static !important;
  justify-self: start !important;
  width: auto !important;
  min-width: 132px !important;
  min-height: 42px !important;
  margin: 0 14px 14px !important;
}

@media (max-width: 680px) {
  .email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply {
    width: 100% !important;
    max-width: none !important;
    margin: 14px 0 22px !important;
    border-radius: 7px !important;
  }

  .email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle {
    grid-template-columns: auto minmax(0, 1fr) 28px !important;
  }

  .email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply > .email-compose-toggle small {
    font-size: .68rem !important;
  }

  .email-compose-drawer[open].is-replying.is-inline-reply .email-compose-message textarea {
    height: 135px !important;
    min-height: 135px !important;
  }

  .email-compose-drawer[open].is-replying.is-inline-reply .email-attachment-manager > summary small {
    display: none !important;
  }
}

/* Lead-aware Team Chat launcher and selected lead context. */
.lead-chat-launcher {
  position: relative;
}
.lead-chat-launcher > summary {
  list-style: none;
  cursor: pointer;
}
.lead-chat-launcher > summary::-webkit-details-marker {
  display: none;
}
.lead-chat-launcher-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: min(350px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #cbdbe6;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 36, 58, .22);
  color: #132844;
  text-align: left;
}
.lead-chat-launcher-heading {
  display: grid;
  gap: 3px;
}
.lead-chat-launcher-heading strong {
  font-size: .9rem;
}
.lead-chat-launcher-heading small {
  color: #687a8f;
  font-size: .68rem;
  font-weight: 700;
}
.lead-chat-launcher-menu label {
  color: #344a62;
  font-size: .7rem;
  font-weight: 900;
}
.lead-chat-launcher-menu select {
  min-height: 44px;
  font-size: .76rem;
}
.lead-chat-launcher-menu button {
  width: 100%;
  min-height: 44px;
}
.lead-chat-launcher-context {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-left: 4px solid #1688b2;
  border-radius: 5px;
  background: #eef8fc;
}
.lead-chat-launcher-context span {
  color: #1480a7;
  font-size: .58rem;
  font-weight: 900;
  text-transform: uppercase;
}
.lead-chat-launcher-context strong {
  font-size: .72rem;
  overflow-wrap: anywhere;
}
.lead-chat-launcher-empty {
  margin: 0;
  padding: 9px;
  border-radius: 5px;
  background: #fff4e5;
  color: #8a5200;
  font-size: .7rem;
  font-weight: 800;
}
.chat-active-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid #b8d6e8;
  border-left: 4px solid #1688b2;
  border-radius: 6px;
  background: #eef8fc;
}
.chat-active-lead > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.chat-active-lead span {
  color: #147ca1;
  font-size: .58rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chat-active-lead strong {
  overflow: hidden;
  color: #173854;
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-active-lead-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chat-active-lead-actions a {
  padding: 5px 8px;
  border: 1px solid #b8d6e8;
  border-radius: 4px;
  background: #fff;
  color: #0b6f99;
  font-size: .62rem;
  font-weight: 900;
  text-decoration: none;
}
.chat-active-lead-actions a:hover {
  background: #dff2fa;
}

@media (max-width: 760px) {
  .lead-chat-launcher {
    width: 100%;
  }
  .lead-chat-launcher > summary {
    width: 100%;
  }
  .lead-chat-launcher-menu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: calc(100vh - 110px);
    overflow: auto;
  }
  .chat-active-lead {
    align-items: flex-start;
    flex-direction: column;
  }
  .chat-active-lead-actions {
    width: 100%;
  }
  .chat-active-lead-actions a {
    flex: 1;
    text-align: center;
  }
}

/* Email center v25: one read-state badge, four-column rows, and reliable actions. */
body[data-route="email-center"] .email-log-row .email-log-collapsible > summary {
  grid-template-columns: minmax(150px, 215px) minmax(260px, 1fr) auto minmax(106px, 130px);
}
body[data-route="email-center"] .email-expand-label {
  display: none !important;
}
body[data-route="email-center"] .email-reader-toolbar-actions form,
body[data-route="email-center"] .email-reader-footer-actions form {
  margin: 0;
}
body[data-route="email-center"] .email-delete-action {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
  cursor: pointer;
}
body[data-route="email-center"] .email-delete-action:hover,
body[data-route="email-center"] .email-delete-action:focus-visible {
  border-color: #f87171;
  background: #ffe4e6;
  color: #7f1d1d;
}

@media (max-width: 760px) {
  body[data-route="email-center"] .email-log-row .email-log-collapsible > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Lead-book instant filters and Retell unread badge. */
.lead-filter-form .lead-filter-status {
  flex: 1 1 150px;
  color: #6b7d91;
  font-size: .69rem;
  font-weight: 800;
  white-space: nowrap;
}
.nav-retell { position: relative; }
.nav-retell.hot { padding-right: 52px !important; }

@media (max-width: 760px) {
  .lead-filter-form .lead-filter-status {
    grid-column: 1 / -1;
    text-align: center;
  }
}

/* Team Chat v18: isolate the workspace from legacy CRM navigation rules. */
body[data-route="chat"] .shell {
  width: calc(100% - 24px) !important;
  max-width: none !important;
  height: calc(100dvh - 24px);
  margin: 12px auto !important;
  padding: 0 !important;
}
body[data-route="chat"] .chat-app {
  width: 100%;
  height: 100%;
  min-height: 620px;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  border-radius: 8px;
}
body[data-route="chat"] .chat-sidebar {
  position: relative;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
}
body[data-route="chat"] .chat-sidebar > header {
  min-width: 0;
  padding: 18px 18px 14px;
}
body[data-route="chat"] .chat-sidebar h2 {
  margin: 2px 0 0 !important;
  font-size: 1.34rem !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
}
.chat-sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-mobile-list-open,
.chat-mobile-list-close {
  display: none;
}
body[data-route="chat"] .chat-thread-list {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 0 8px 14px !important;
}
body[data-route="chat"] .chat-thread-row {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 70px !important;
  margin: 0 !important;
  padding: 9px 10px !important;
  font-size: inherit !important;
  line-height: 1.2 !important;
}
body[data-route="chat"] .chat-thread-copy strong {
  font-size: .84rem !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}
body[data-route="chat"] .chat-thread-copy small {
  font-size: .69rem !important;
  line-height: 1.3 !important;
}
body[data-route="chat"] .chat-conversation-head h1 {
  margin: 0 0 5px !important;
  font-size: 1.16rem !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
}
body[data-route="chat"] .chat-conversation-head > div:first-of-type {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}
body[data-route="chat"] .chat-conversation-head > div:first-of-type > span:last-child {
  min-width: 0;
}
body[data-route="chat"] .chat-new-panel[open] {
  top: 78px;
  right: 12px;
  left: 12px;
  width: auto;
  max-height: calc(100% - 92px);
  overflow: auto;
}
.chat-new-panel-heading {
  display: grid;
  gap: 2px;
  padding: 2px 1px 5px;
}
.chat-new-panel-heading strong {
  color: #102a47;
  font-size: .86rem;
}
.chat-new-panel-heading small {
  color: #718196;
  font-size: .68rem;
  line-height: 1.4;
}
.chat-user-choice {
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease;
}
.chat-user-choice:hover,
.chat-user-choice:has(input:checked) {
  border-color: #80c7e5;
  background: #edf9fe;
}
body[data-route="chat"] .chat-message-list,
body[data-route="chat"] .chat-conversation {
  min-height: 0;
}

@media (max-width: 1100px) and (min-width: 761px) {
  body[data-route="chat"] .chat-app {
    grid-template-columns: minmax(270px, 315px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body[data-route="chat"] .shell {
    width: 100% !important;
    height: calc(100dvh - 64px);
    margin: 0 !important;
    padding: 0 !important;
  }
  body[data-route="chat"] .chat-app {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body[data-route="chat"] .chat-app.chat-has-active:not(.chat-list-open) .chat-sidebar {
    display: none;
  }
  body[data-route="chat"] .chat-conversation {
    height: 100%;
    min-height: 0;
  }
  body[data-route="chat"] .chat-conversation-head {
    min-height: 66px;
    gap: 10px;
    padding: 9px 11px;
  }
  body[data-route="chat"] .chat-conversation-head h1 {
    max-width: 52vw;
    overflow: hidden;
    font-size: 1rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body[data-route="chat"] .chat-conversation-head .chat-thread-avatar {
    width: 38px;
    height: 38px;
  }
  .chat-mobile-list-open {
    display: inline-flex;
    min-width: 44px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 9px;
    border: 1px solid #cbd9e5;
    border-radius: 6px;
    background: #f5f9fc;
    color: #163b58;
    font-size: .7rem;
  }
  .chat-mobile-list-open span {
    font-size: 1rem;
  }
  .chat-mobile-list-close {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 1px solid #cad8e3;
    border-radius: 6px;
    background: #fff;
    color: #27445e;
    font-size: 1.5rem;
  }
  body[data-route="chat"] .chat-app.chat-list-open .chat-sidebar {
    position: fixed;
    z-index: 1250;
    inset: 0;
    display: grid !important;
    max-height: none;
    border: 0;
    background: #f7f9fc;
    box-shadow: 0 18px 54px rgba(11, 35, 60, .24);
  }
  body.chat-mobile-drawer-open {
    overflow: hidden;
  }
  body[data-route="chat"] .chat-thread-list {
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 10px 16px !important;
  }
  body[data-route="chat"] .chat-thread-row {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 70px !important;
  }
  body[data-route="chat"] .chat-new-panel[open] {
    position: fixed;
    z-index: 1260;
    top: 72px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: none;
  }
  body[data-route="chat"] .chat-message-list {
    min-height: 0;
    max-height: none;
    padding: 18px 10px 14px;
  }
  body[data-route="chat"] .chat-message {
    max-width: 96%;
  }
  body[data-route="chat"] .chat-composer {
    position: static;
    bottom: auto;
    padding: 8px 10px max(9px, env(safe-area-inset-bottom));
  }
  body[data-route="chat"] .chat-composer textarea {
    min-height: 58px;
  }
}

/* Keep the lead-assignment picker readable and inside the lead workspace. */
.workflow-panel,
.workflow-field,
.workflow-field .assignment-picker,
.workflow-field .assignment-dropdown {
  min-width: 0 !important;
  max-width: 100%;
}

.workflow-field .assignment-picker,
.workflow-field .assignment-dropdown {
  position: relative;
  width: 100%;
}

.workflow-field .assignment-dropdown {
  z-index: 6;
}

.workflow-field .assignment-dropdown[open] {
  z-index: 80;
}

.workflow-field .assignment-dropdown > summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 56px !important;
  padding: 7px 9px !important;
  overflow: hidden;
  list-style: none;
  border: 2px solid #22c55e !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 4px rgb(245 181 52 / 28%);
  cursor: pointer;
}

.workflow-field .assignment-dropdown > summary::-webkit-details-marker {
  display: none;
}

.workflow-field .assignment-dropdown > summary::after {
  content: "v";
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.workflow-field .assignment-dropdown[open] > summary::after {
  content: "^";
}

.workflow-field .assignment-summary-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.workflow-field .assignment-summary-copy strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #14532d !important;
  -webkit-text-fill-color: #14532d;
  font-size: 14px !important;
  font-weight: 900 !important;
  line-height: 1.15;
  letter-spacing: 0 !important;
  text-overflow: ellipsis;
  text-transform: none !important;
  white-space: nowrap;
}

.workflow-field .assignment-summary-copy small {
  display: block;
  overflow: hidden;
  color: #64748b !important;
  -webkit-text-fill-color: #64748b;
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: 0 !important;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: none !important;
  white-space: nowrap;
}

.workflow-field .assignment-summary-action {
  color: #0f766e !important;
  -webkit-text-fill-color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap;
}

.workflow-field .assignment-dropdown .assignment-menu {
  position: absolute !important;
  top: calc(100% + 7px) !important;
  right: 0 !important;
  left: auto !important;
  z-index: 500;
  display: grid !important;
  width: min(340px, calc(100vw - 32px)) !important;
  max-width: 340px !important;
  max-height: none !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  box-shadow: 0 20px 44px rgb(15 23 42 / 24%) !important;
}

.workflow-field .assignment-menu-heading {
  display: grid;
  gap: 2px;
  padding: 11px 12px 9px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.workflow-field .assignment-menu-heading strong {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0 !important;
  line-height: 1.2;
  text-transform: none !important;
}

.workflow-field .assignment-menu-heading span {
  color: #64748b !important;
  -webkit-text-fill-color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.workflow-field .assignment-options {
  display: grid !important;
  gap: 4px;
  max-height: min(230px, 40vh) !important;
  padding: 6px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.workflow-field .assignment-check {
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 9px !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 7px 9px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
  cursor: pointer;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.workflow-field .assignment-check:hover {
  border-color: #99f6e4 !important;
  background: #f0fdfa !important;
}

.workflow-field .assignment-check.is-selected {
  border-color: #86efac !important;
  background: #ecfdf5 !important;
  box-shadow: inset 3px 0 0 #22c55e;
}

.workflow-field .assignment-check input {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  accent-color: #16a34a;
}

.workflow-field .assignment-check-copy {
  display: grid !important;
  min-width: 0;
  gap: 2px;
}

.workflow-field .assignment-check-copy strong {
  display: block !important;
  overflow: hidden;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
  font-size: 14px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: none !important;
  white-space: nowrap;
}

.workflow-field .assignment-check-copy small {
  display: block !important;
  color: #64748b !important;
  -webkit-text-fill-color: #64748b;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  line-height: 1.15;
  text-transform: capitalize !important;
}

.workflow-field .assignment-check-status {
  color: #15803d !important;
  -webkit-text-fill-color: #15803d;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0 !important;
  opacity: 0;
  text-transform: none !important;
}

.workflow-field .assignment-check.is-selected .assignment-check-status {
  opacity: 1;
}

.workflow-field .assignment-menu .assign-lead-button {
  width: calc(100% - 12px) !important;
  min-height: 42px;
  margin: 0 6px 6px !important;
  border-radius: 8px !important;
}

@media (max-width: 767px) {
  .workflow-field .assignment-dropdown .assignment-menu {
    right: auto !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .workflow-field .assignment-summary-action {
    display: none;
  }

  .workflow-field .assignment-dropdown > summary {
    grid-template-columns: minmax(0, 1fr) 24px;
  }
}

/* Background mailbox checks remain available throughout the admin CRM. */
.email-auto-sync-global {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 190;
  width: min(460px, calc(100vw - 36px));
  justify-content: space-between;
  border: 1px solid #c8d8e4;
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(8, 33, 61, .2);
}

@media (max-width: 767px) {
  .email-auto-sync-global {
    right: 8px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
  }
}

@media (max-width: 767px) {
  body[data-route="lead"] .mobile-lead-actions > :where(a, span, button) {
    height: 54px !important;
    min-height: 54px !important;
    padding: 6px 3px !important;
  }
}

/* Email matching, searchable mail, collapsible rail, and focused message viewer. */
.email-mail-search { position: relative; display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
.email-mail-search input { grid-column: 1 / -1; grid-row: 1; padding-right: 122px !important; }
.email-mail-search button,
.email-mail-search a { position: relative; z-index: 1; grid-row: 1; min-height: 34px; margin-right: 6px; padding: 5px 10px; border: 0; border-radius: 17px; background: #d9e7f7; color: #123250; font-size: .69rem; font-weight: 850; text-decoration: none; }
.email-mail-search button { grid-column: 2; }
.email-mail-search a { grid-column: 3; background: transparent; color: #176b8f; }
.email-mail-search button:hover,
.email-mail-search button:focus-visible { background: #c7dbf0; }
.email-mailbox-match::before { content: "\2261"; }
.email-sidebar-collapse { align-self: flex-end; display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: max-content; min-width: 44px; min-height: 36px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: #51647a; font-size: .68rem; cursor: pointer; }
.email-sidebar-collapse:hover,
.email-sidebar-collapse:focus-visible { background: #dce8f3; color: #102947; }
.email-sidebar-collapse > span { font-size: 1.45rem; line-height: .7; transition: transform .2s ease; }
.email-match-queue-tools { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.15fr) auto; align-items: end; gap: 16px; margin: 14px 16px 4px; padding: 14px 16px; border: 1px solid #cfe0ed; border-left: 4px solid #168398; border-radius: 7px; background: #f7fbfd; }
.email-match-queue-tools h3 { margin: 2px 0 4px; font-size: 1rem; }
.email-match-queue-tools p { margin: 0; color: #617188; font-size: .73rem; line-height: 1.45; }
.email-match-lead-search { display: grid; gap: 5px; }
.email-match-lead-search label { color: #35485f; font-size: .7rem; font-weight: 850; }
.email-match-lead-search > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.email-match-lead-search input { min-height: 40px; border-radius: 5px 0 0 5px; }
.email-match-lead-search button { min-height: 40px; border-radius: 0 5px 5px 0; }
.email-match-panel { display: grid; gap: 10px; margin-top: 14px; padding: 12px; border: 1px solid #cfe0ed; border-radius: 6px; background: #f6fbfd; }
.email-match-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.email-match-panel > header > div { display: grid; gap: 3px; }
.email-match-panel > header span { color: #65768b; font-size: .72rem; }
.email-match-candidates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.email-match-candidates form { margin: 0; }
.email-match-candidate { display: grid; gap: 2px; width: 100%; min-height: 52px; padding: 8px 10px; border: 1px solid #bcd5e6; border-radius: 5px; background: #fff; color: #102947; text-align: left; }
.email-match-candidate:hover { border-color: #168398; background: #eef9fb; }
.email-match-candidate span { color: #66788d; font-size: .68rem; }
.email-assign-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, .45fr) auto; gap: 8px; }
.email-popout-bar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 52px; margin: -14px -18px 2px; padding: 10px 16px; border-bottom: 1px solid #dce5ee; background: #eef4fb; }
.email-popout-bar strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-popout-bar button { flex: 0 0 auto; width: auto !important; min-width: 76px; min-height: 40px; padding: 7px 12px; border: 0; border-radius: 5px; background: #d9e7f7; color: #123250; font-weight: 850; }
body.email-popout-open { overflow: hidden; }
body.email-popout-open::before { content: ""; position: fixed; z-index: 780; inset: 0; background: rgba(15, 28, 43, .4); }
.email-log-row.email-row-popout-open { position: relative; z-index: 785; opacity: 1 !important; }
.email-log-row .email-log-collapsible[open] > .email-log-expanded { position: fixed; z-index: 790; top: max(72px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: min(860px, calc(100vw - 72px)); padding: 14px 18px 20px; overflow: auto; overscroll-behavior: contain; border: 1px solid #c8d4df; border-radius: 8px; background:#fff; box-shadow: 0 20px 70px rgba(9, 27, 46,.34); }

@media (min-width: 761px) {
  .email-mail-workspace { transition: grid-template-columns .22s ease; }
  .email-mail-sidebar { overflow: hidden; transition: padding .22s ease, width .22s ease; }
  .email-mail-workspace.is-sidebar-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
  .email-mail-workspace.is-sidebar-collapsed .email-mail-sidebar { align-items: center; padding: 12px 7px; }
  .email-mail-workspace.is-sidebar-collapsed .email-sidebar-collapse { align-self: center; }
  .email-mail-workspace.is-sidebar-collapsed .email-sidebar-collapse > span { transform: rotate(180deg); }
  .email-mail-workspace.is-sidebar-collapsed .email-sidebar-collapse strong,
  .email-mail-workspace.is-sidebar-collapsed .email-account-switcher,
  .email-mail-workspace.is-sidebar-collapsed .email-sidebar-actions,
  .email-mail-workspace.is-sidebar-collapsed .email-mailbox-link span,
  .email-mail-workspace.is-sidebar-collapsed .email-mailbox-link strong { display: none; }
  .email-mail-workspace.is-sidebar-collapsed .email-compose-button { width: 52px; min-width: 52px; height: 52px; min-height: 52px; padding: 0; overflow: hidden; font-size: 0; }
  .email-mail-workspace.is-sidebar-collapsed .email-compose-button::before { width: 52px; height: 52px; font-size: 1.55rem; }
  .email-mail-workspace.is-sidebar-collapsed .email-mailbox-nav { width: 100%; }
  .email-mail-workspace.is-sidebar-collapsed .email-mailbox-link { display: grid; grid-template-columns: 1fr; justify-items: center; min-height: 44px; padding: 7px 4px; }
}

@media (max-width: 900px) {
  .email-match-queue-tools { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 760px) {
  .email-sidebar-collapse { display: none; }
  .email-mailbox-nav { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .email-match-queue-tools { margin: 10px 8px 2px; padding: 12px; }
  .email-match-candidates { grid-template-columns: 1fr; }
  .email-assign-form { grid-template-columns: 1fr; }
  .email-log-row .email-log-collapsible[open] > .email-log-expanded { inset: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0; width: 100%; max-width: none; border: 0; border-radius: 0; }
  .email-popout-bar { gap: 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .email-popout-bar button { min-width: 72px !important; max-width: 96px; }
}

/* Funding-lead desktop table must keep Assignment and Actions in view. */
@media (min-width: 761px) {
  .lead-table-wrap { width: 100%; max-width: 100%; overflow-x: hidden !important; }
  .lead-table { width: 100% !important; min-width: 0 !important; padding: 5px !important; table-layout: fixed !important; }
  .lead-table th,
  .lead-table td,
  .lead-table tr[class*="stage-row-"] td { padding: 10px 7px !important; overflow-wrap: anywhere; word-break: normal; }
  .lead-table .lead-id-cell strong { font-size: 13px !important; }
  .lead-table .lead-id-cell span { font-size: 12px !important; }
  .lead-table small,
  .lead-table td { font-size: 11px !important; }
  .lead-table .badge { min-width: 0 !important; width: auto; max-width: 100%; padding: 5px 7px !important; font-size: 10px !important; }
  .lead-col-lead { width: 12% !important; }
  .lead-col-contact { width: 13% !important; }
  .lead-col-dob { width: 6% !important; }
  .lead-col-case { width: 8% !important; }
  .lead-col-stage { width: 10% !important; }
  .lead-col-docs { width: 9% !important; }
  .lead-col-attorney { width: 11% !important; }
  .lead-col-funding { width: 9% !important; }
  .lead-col-assigned { width: 8% !important; }
  .lead-col-updated { width: 6% !important; }
  .lead-col-action { width: 8% !important; }
  .lead-action-cell button { width: 100%; min-width: 0; padding: 6px 4px; font-size: 10px; }
}

@media (min-width: 761px) and (max-width: 1500px) {
  .lead-table .lead-col-dob,
  .lead-table .lead-col-updated,
  .lead-table tbody td:nth-child(3),
  .lead-table tbody td:nth-child(10) { display: none; }
  .lead-col-lead { width: 12% !important; }
  .lead-col-contact { width: 15% !important; }
  .lead-col-case { width: 9% !important; }
  .lead-col-stage { width: 13% !important; }
  .lead-col-docs { width: 10% !important; }
  .lead-col-attorney { width: 14% !important; }
  .lead-col-funding { width: 9% !important; }
  .lead-col-assigned { width: 10% !important; }
  .lead-col-action { width: 8% !important; }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .lead-table .lead-col-case,
  .lead-table .lead-col-funding,
  .lead-table tbody td:nth-child(4),
  .lead-table tbody td:nth-child(8) { display: none; }
  .lead-col-lead { width: 17% !important; }
  .lead-col-contact { width: 19% !important; }
  .lead-col-stage { width: 16% !important; }
  .lead-col-docs { width: 14% !important; }
  .lead-col-attorney { width: 16% !important; }
  .lead-col-assigned { width: 10% !important; }
  .lead-col-action { width: 8% !important; }
}

/* Rich mailbox signatures: Gmail-like editing without leaving CRM settings. */
.email-signature-builder {
  overflow: hidden;
  border: 1px solid #cbd9e8;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(11, 43, 75, .05);
}
.email-signature-editor {
  min-height: 180px;
  max-height: 360px;
  padding: 20px;
  overflow: auto;
  color: #17233a;
  font: 16px/1.5 Arial, sans-serif;
  outline: none;
  overflow-wrap: anywhere;
}
.email-signature-editor:empty::before {
  content: "Add your name, title, contact details, logo, and links";
  color: #778499;
}
.email-signature-editor img {
  width: auto;
  max-width: min(100%, 600px);
  height: auto;
  max-height: 300px;
}
.email-signature-editor a { color: #145d88; text-decoration: underline; }
.email-signature-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 54px;
  padding: 5px 8px;
  overflow-x: auto;
  border-top: 1px solid #d8e2ee;
  background: #f7f9fc;
  -webkit-overflow-scrolling: touch;
}
.email-signature-tool,
.email-signature-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #17233a;
  font: 700 13px/1 Arial, sans-serif;
  cursor: pointer;
}
.email-signature-tool:hover,
.email-signature-upload:hover { background: #e7eef7; }
.signature-tool-italic { font-style: italic; }
.signature-tool-underline { text-decoration: underline; }
.email-signature-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.email-signature-upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #d8e2ee;
  background: #eef7fb;
  color: #42526a;
  font-size: 13px;
}
.email-signature-upload-preview[hidden] { display: none; }
.email-signature-upload-preview img { width: 72px; height: 48px; object-fit: contain; background: #fff; }
.email-signature-defaults {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}
.email-signature-before-quote { grid-column: 1 / -1; min-height: 44px; }

@media (max-width: 760px) {
  .email-signature-editor { min-height: 150px; padding: 15px; }
  .email-signature-defaults { grid-template-columns: 1fr; }
  .email-signature-before-quote { grid-column: auto; }
  .email-signature-tool,
  .email-signature-upload { min-width: 44px; min-height: 44px; padding: 8px 10px; }
}

/* Compact CRM and mailbox rails keep Mail Center aligned without horizontal scrolling. */
.app-sidebar-toggle { display: none; }

@media (min-width: 768px) {
  body[data-crm-user="1"],
  body[data-crm-user="1"] .app-header {
    transition: padding-left .22s ease, width .22s ease;
  }
  .app-sidebar-toggle {
    display: inline-flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 9px;
    border: 0;
    border-radius: 6px;
    background: #eef4fa;
    color: #51647a;
    font-size: .7rem;
    font-weight: 850;
    cursor: pointer;
  }
  .app-sidebar-toggle:hover,
  .app-sidebar-toggle:focus-visible { background: #dce8f3; color: #102947; }
  .app-sidebar-toggle > span { font-size: 1.4rem; line-height: .7; transition: transform .22s ease; }
  .primary-nav a::before {
    display: none;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 6px;
    background: #eef4fa;
    color: #24425f;
    font-size: .72rem;
    font-weight: 900;
  }
  .primary-nav a[data-nav-item="dashboard"]::before { content: "D"; }
.primary-nav a[data-nav-item="leads"]::before { content: "L"; }
.primary-nav a[data-nav-item="chat"]::before { content: "C"; }
.primary-nav a[data-nav-item="alerts"]::before { content: "!"; }
  .primary-nav a[data-nav-item="settings"]::before { content: "S"; }
  .primary-nav a[data-nav-item="funder-tracking"]::before { content: "F"; }
  .primary-nav a[data-nav-item="email-center"]::before { content: "M"; }
  .primary-nav a[data-nav-item="retell-inbox"]::before { content: "R"; }
  .primary-nav a[data-nav-item="document-requests"]::before { content: "Q"; }
  .primary-nav a[data-nav-item="logout"]::before { content: "X"; }
  body[data-crm-user="1"].app-sidebar-collapsed { padding-left: 76px; }
  body[data-crm-user="1"].app-sidebar-collapsed .app-header {
    width: 76px;
    gap: 8px;
    padding-right: 8px;
    padding-left: calc(8px + env(safe-area-inset-left));
  }
  body[data-crm-user="1"].app-sidebar-collapsed .app-header .brand {
    width: 52px;
    min-height: 54px;
    overflow: hidden;
    padding: 4px;
  }
  body[data-crm-user="1"].app-sidebar-collapsed .brand-logo {
    width: 184px;
    max-width: none;
    flex: 0 0 184px;
  }
  body[data-crm-user="1"].app-sidebar-collapsed .app-sidebar-toggle {
    width: 52px;
    padding: 6px;
  }
  body[data-crm-user="1"].app-sidebar-collapsed .app-sidebar-toggle > span { transform: rotate(180deg); }
  body[data-crm-user="1"].app-sidebar-collapsed .app-sidebar-toggle > strong,
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav .nav-label,
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav .nav-count-badge { display: none; }
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav { width: 52px; overflow-x: hidden; }
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav a {
    width: 52px;
    min-height: 46px;
    justify-content: center;
    padding: 6px;
  }
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav a::before { display: grid; }
  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav a.nav-active::before { background: #cfe5f4; color: #08213d; }
  body[data-route="email-center"] .shell {
    width: min(calc(100% - 20px), 1900px);
    margin-top: 10px;
  }
}

/* Native CRM Team Chat */
.nav-chat { position: relative; }
.nav-chat.hot { padding-right: 34px !important; }

.chat-global-notice {
  position: fixed;
  z-index: 1200;
  top: 18px;
  right: 20px;
  display: grid;
  grid-template-columns: 42px minmax(180px, 1fr) auto 32px;
  align-items: center;
  gap: 11px;
  width: min(560px, calc(100vw - 40px));
  padding: 12px 13px;
  border: 1px solid #9fd8ef;
  border-left: 5px solid #0795c7;
  border-radius: 7px;
  background: #f0fbff;
  color: #0b2b46;
  box-shadow: 0 18px 46px rgba(15, 38, 60, .22);
}
.chat-global-notice[hidden] { display: none !important; }
.chat-notice-avatar,
.chat-avatar,
.chat-thread-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #0f789c;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}
.chat-notice-avatar { width: 42px; height: 42px; font-size: .9rem; }
.chat-global-notice > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.chat-global-notice strong { font-size: .88rem; }
.chat-global-notice small { overflow: hidden; color: #547086; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-global-notice a { padding: 8px 12px; border-radius: 5px; background: #0d789d; color: #fff; font-size: .76rem; font-weight: 900; text-decoration: none; }
.chat-global-notice button { width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: #6d8294; font-size: 1.5rem; cursor: pointer; }

body[data-route="chat"] .shell {
  width: min(calc(100% - 24px), 1880px);
  max-width: none;
  margin-top: 12px;
}
.chat-app {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 760px;
  height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid #d3e0eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(22, 43, 66, .1);
}
.chat-sidebar {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid #dce5ed;
  background: #f7f9fc;
}
.chat-sidebar > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 19px 15px;
}
.chat-sidebar h2 { margin: 2px 0 0; color: #0b2342; font-size: 1.45rem; }
.chat-sidebar-count { color: #64748b; font-size: .7rem; font-weight: 850; white-space: nowrap; }
.chat-new-panel { margin: 0 14px 11px; }
.chat-new-panel > summary {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #91c9e4;
  border-radius: 7px;
  background: #dff3fc;
  color: #075980;
  font-size: .84rem;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}
.chat-new-panel > summary::-webkit-details-marker { display: none; }
.chat-new-panel > summary span { font-size: 1.25rem; line-height: .7; }
.chat-new-panel[open] {
  position: absolute;
  z-index: 20;
  top: 72px;
  left: 15px;
  width: min(430px, calc(100vw - 30px));
  margin: 0;
  padding: 12px;
  border: 1px solid #cbd9e5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 36, 58, .22);
}
.chat-new-panel[open] > summary { justify-content: flex-start; background: #eef7fb; }
.chat-new-panel form { display: grid; gap: 9px; padding-top: 11px; }
.chat-new-panel label { color: #344a62; font-size: .74rem; font-weight: 900; }
.chat-new-panel label small { color: #7b8b9d; font-weight: 700; }
.chat-user-choices { display: grid; max-height: 265px; gap: 5px; overflow: auto; }
.chat-user-choice {
  display: grid;
  grid-template-columns: 20px 34px 1fr;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid #e1e8ef;
  border-radius: 6px;
  background: #fafcfe;
}
.chat-user-choice .chat-avatar { width: 32px; height: 32px; font-size: .68rem; }
.chat-user-choice > span:last-child { display: grid; gap: 1px; }
.chat-user-choice strong { font-size: .78rem; }
.chat-user-choice small { color: #738297; font-size: .65rem; }
.chat-form-hint { margin: 0; color: #64748b; font-size: .68rem; }

.chat-search {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  margin: 0 14px 11px;
  padding: 0 9px;
  border: 1px solid #d8e2eb;
  border-radius: 6px;
  background: #fff;
}
.chat-search span { color: #718096; font-size: .74rem; }
.chat-search input { min-height: 42px; padding: 8px 0; border: 0; background: transparent; box-shadow: none; font-size: .78rem; }
.chat-thread-list { min-height: 0; overflow: auto; padding: 0 8px 14px; }
.chat-thread-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 9px 10px;
  border-left: 4px solid transparent;
  border-radius: 6px;
  color: #223b56;
  text-decoration: none;
}
.chat-thread-row:hover { background: #edf4f9; }
.chat-thread-row.is-active { border-left-color: #0d85b2; background: #dceefa; }
.chat-thread-row.has-unread { background: #eef9ff; }
.chat-thread-avatar { width: 40px; height: 40px; font-size: .75rem; }
.chat-thread-row.is-active .chat-thread-avatar { background: #096b92; }
.chat-thread-copy { display: grid; min-width: 0; gap: 4px; }
.chat-thread-copy strong { overflow: hidden; color: #102a47; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-row.has-unread .chat-thread-copy strong { font-weight: 950; }
.chat-thread-copy small { overflow: hidden; color: #75869a; font-size: .68rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-side { display: grid; justify-items: end; gap: 5px; }
.chat-thread-side time { color: #8996a5; font-size: .6rem; font-weight: 750; }
.chat-thread-side b { min-width: 21px; height: 21px; display: inline-grid; place-items: center; padding: 0 5px; border-radius: 999px; background: #0b88b6; color: #fff; font-size: .62rem; }
.chat-no-threads { padding: 22px 14px; color: #7a8a9b; font-size: .76rem; text-align: center; }

.chat-conversation {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #fff;
}
.chat-conversation-head {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  border-bottom: 1px solid #dce5ed;
  background: #fff;
}
.chat-conversation-head > div:first-child { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-conversation-head .chat-thread-avatar { width: 44px; height: 44px; }
.chat-conversation-head h1 { margin: 0 0 5px; color: #10243e; font-size: 1.12rem; }
.chat-member-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-member-chip { padding: 3px 6px; border: 1px solid #d8e1e9; border-radius: 4px; background: #f8fafc; color: #607287; font-size: .6rem; font-weight: 800; }
.chat-manage { position: relative; }
.chat-manage > summary { padding: 8px 10px; border: 1px solid #d4dfe9; border-radius: 5px; color: #486177; font-size: .7rem; font-weight: 850; list-style: none; cursor: pointer; }
.chat-manage > summary::-webkit-details-marker { display: none; }
.chat-manage[open] > .chat-manage-menu { position: absolute; z-index: 15; top: 40px; right: 0; width: 330px; display: grid; gap: 12px; padding: 12px; border: 1px solid #cad7e2; border-radius: 7px; background: #fff; box-shadow: 0 16px 40px rgba(18, 39, 61, .22); }
.chat-manage-menu > form { display: grid; gap: 8px; }
.chat-manage-users { display: grid; max-height: 220px; gap: 5px; overflow: auto; }
.chat-manage-users label { display: flex; align-items: center; gap: 7px; padding: 5px; font-size: .72rem; }
.chat-delete-form { padding-top: 10px; border-top: 1px solid #e4e9ef; }
.chat-delete-form button { width: 100%; min-height: 38px; border: 1px solid #fecaca; border-radius: 5px; background: #fff1f2; color: #a51d25; font-size: .72rem; font-weight: 900; cursor: pointer; }
.chat-delete-form small { color: #8a6670; font-size: .61rem; line-height: 1.35; }

.chat-task-board {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  min-width: 0;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #dce5ed;
  background: #f4f8fb;
}
.chat-task-board > header { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; }
.chat-task-board > header div { display: grid; gap: 1px; }
.chat-task-board > header span { color: #b26d00; font-size: .57rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.chat-task-board > header strong { color: #102a47; font-size: .85rem; }
.chat-task-board > header b { padding: 3px 7px; border-radius: 999px; background: #fff3ce; color: #865500; font-size: .6rem; }
.chat-task-list { display: flex; min-width: 0; gap: 8px; overflow-x: auto; padding: 1px 0 4px; scrollbar-width: thin; }
.chat-task-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; min-width: min(360px, 72vw); max-width: 420px; gap: 8px; padding: 9px 38px 9px 10px; border: 1px solid #c9d9e6; border-left: 4px solid #f0ad27; border-radius: 6px; background: #fff; }
.chat-task-item.is-complete { border-left-color: #76b88a; background: #f5faf7; opacity: .72; }
.chat-task-check { width: 27px; height: 27px; display: grid; place-items: center; padding: 0; border: 2px solid #d29a29; border-radius: 5px; background: #fffaf0; color: #166534; font-size: .9rem; font-weight: 950; cursor: pointer; }
.chat-task-item.is-complete .chat-task-check { border-color: #65a979; background: #dcfce7; }
.chat-task-copy { display: grid; min-width: 0; gap: 3px; }
.chat-task-lead { min-width: 0; }
.chat-task-lead a,
.chat-task-lead span { display: block; overflow: hidden; color: #096c94; font-size: .68rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.chat-task-copy p { display: -webkit-box; margin: 0; overflow: hidden; color: #273e56; font-size: .7rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.chat-task-item.is-complete .chat-task-copy p { color: #64748b; text-decoration: line-through; }
.chat-task-copy small { color: #8190a0; font-size: .56rem; }
.chat-task-delete { position: absolute; top: 6px; right: 6px; }
.chat-task-delete button { width: 25px; height: 25px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #9b6670; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.chat-task-delete button:hover { border-color: #fecaca; background: #fff1f2; color: #b4232d; }
.chat-task-empty { align-self: center; margin: 0; color: #718196; font-size: .67rem; }

.chat-message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 28px clamp(18px, 4vw, 62px) 20px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.chat-history-controls { display: flex; align-items: center; justify-content: center; gap: 9px; margin: -10px 0 22px; }
.chat-history-controls button { min-height: 32px; padding: 6px 11px; border: 1px solid #bfd0de; border-radius: 5px; background: #fff; color: #365c78; font-size: .65rem; font-weight: 900; cursor: pointer; }
.chat-history-controls small { color: #8190a0; font-size: .58rem; }
.chat-message { display: flex; align-items: flex-end; gap: 9px; max-width: min(780px, 82%); margin: 0 0 16px; }
.chat-message-mine { flex-direction: row-reverse; margin-left: auto; }
.chat-message .chat-avatar { width: 34px; height: 34px; font-size: .65rem; }
.chat-message-stack { display: grid; min-width: 0; gap: 5px; }
.chat-message-mine .chat-message-stack { justify-items: end; }
.chat-message-meta { display: flex; align-items: baseline; gap: 7px; padding: 0 3px; }
.chat-message-mine .chat-message-meta { flex-direction: row-reverse; }
.chat-message-meta strong { color: #33485f; font-size: .68rem; }
.chat-message-meta time { color: #8a97a6; font-size: .58rem; font-weight: 700; }
.chat-bubble { padding: 10px 13px; border: 1px solid #dce4eb; border-radius: 8px 8px 8px 2px; background: #fff; color: #243a52; font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.chat-message-mine .chat-bubble { border-color: #b8d8ed; border-radius: 8px 8px 2px 8px; background: #dceefa; color: #113653; }
.chat-message-link,
.chat-inline-lead { color: #086da2; font-weight: 850; text-decoration: underline; text-underline-offset: 2px; }
.chat-mention { display: inline-block; padding: 0 4px; border-radius: 3px; background: #fef3c7; color: #92400e; font-weight: 900; }
.chat-lead-links { display: grid; gap: 5px; width: min(420px, 100%); }
.chat-lead-card { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid #b8d6e8; border-left: 4px solid #1688b2; border-radius: 6px; background: #fff; color: #173854; text-decoration: none; }
.chat-lead-card:hover { background: #f1f9fd; }
.chat-lead-card span { color: #1480a7; font-size: .57rem; font-weight: 900; text-transform: uppercase; }
.chat-lead-card strong { font-size: .72rem; }
.chat-lead-card small { color: #66788b; font-size: .62rem; }
.chat-start-note { display: grid; justify-items: center; gap: 4px; padding: 60px 20px; color: #718196; text-align: center; }
.chat-start-note strong { color: #324b64; font-size: .9rem; }

.chat-composer { display: grid; gap: 8px; padding: 11px 17px 14px; border-top: 1px solid #d9e3eb; background: #fff; }
.chat-mention-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.chat-mention-tools > span { color: #718196; font-size: .64rem; font-weight: 800; }
.chat-mention-tools button { min-height: 26px; padding: 4px 7px; border: 1px solid #d7e0e8; border-radius: 5px; background: #f8fafc; color: #446178; font-size: .62rem; font-weight: 850; cursor: pointer; }
.chat-mention-tools button:hover { border-color: #9dcde4; background: #eaf7fc; color: #0d698e; }
.chat-composer textarea { min-height: 72px; max-height: 180px; padding: 11px 13px; border-color: #c9d7e2; border-radius: 7px; background: #f8fafc; font-size: .84rem; resize: vertical; }
.chat-compose-footer { display: flex; align-items: center; gap: 10px; }
.chat-lead-picker { position: relative; }
.chat-lead-picker > summary { padding: 7px 10px; border: 1px solid #cbd8e3; border-radius: 5px; color: #365a74; font-size: .68rem; font-weight: 900; list-style: none; cursor: pointer; }
.chat-lead-picker > summary::-webkit-details-marker { display: none; }
.chat-lead-picker[open] > div { position: absolute; z-index: 14; bottom: 40px; left: 0; width: min(430px, calc(100vw - 45px)); display: grid; gap: 7px; padding: 10px; border: 1px solid #c6d4e0; border-radius: 7px; background: #fff; box-shadow: 0 14px 42px rgba(18, 39, 61, .22); }
.chat-lead-picker small { color: #718196; font-size: .62rem; }
.chat-lead-choice-list { display: grid; max-height: 235px; gap: 4px; overflow-y: auto; padding-right: 3px; }
.chat-lead-choice { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid #e0e8ef; border-radius: 5px; background: #fafcfe; cursor: pointer; }
.chat-lead-choice:hover { border-color: #a9cfe2; background: #f0f9fd; }
.chat-lead-choice:has(input:checked) { border-color: #59a9c9; background: #e6f6fc; }
.chat-lead-choice input { width: 15px; height: 15px; margin: 0; accent-color: #0d80a9; }
.chat-lead-choice > span { display: grid; min-width: 0; gap: 1px; }
.chat-lead-choice strong { overflow: hidden; color: #1b3852; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-lead-choice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pin-task { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px; border: 1px solid #f2cf78; border-radius: 5px; background: #fff9e8; cursor: pointer; }
.chat-pin-task input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: #c98300; }
.chat-pin-task > span { display: grid; gap: 1px; }
.chat-pin-task strong { color: #704900; font-size: .67rem; }
.chat-pin-task input:disabled + span { opacity: .55; }
.chat-compose-tip { margin-right: auto; color: #8090a2; font-size: .64rem; }
.chat-send-button { min-width: 104px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 6px; background: #0d80a9; color: #fff; }
.chat-send-button b { font-size: 1rem; }
.chat-empty-state { min-height: 600px; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 30px; color: #75869a; text-align: center; }
.chat-empty-state > span { font-size: 2.2rem; }
.chat-empty-state h2 { margin: 0; color: #2e475f; font-size: 1.25rem; }
.chat-empty-state p { max-width: 430px; margin: 0; font-size: .8rem; }

@media (max-width: 980px) {
  .chat-app { grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); }
  .chat-message { max-width: 92%; }
  .chat-compose-tip { display: none; }
}

@media (max-width: 760px) {
  body[data-route="chat"] .shell { width: 100%; margin: 0; padding: 0 0 calc(74px + env(safe-area-inset-bottom)); }
  .chat-app { height: auto; min-height: calc(100vh - 74px); grid-template-columns: 1fr; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  .chat-sidebar { max-height: 310px; border-right: 0; border-bottom: 1px solid #d8e3ec; }
  .chat-sidebar > header { padding: 14px 15px 10px; }
  .chat-new-panel[open] { position: fixed; top: 10vh; right: 12px; left: 12px; width: auto; }
  .chat-thread-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 0 10px 12px; }
  .chat-thread-row { width: 245px; min-width: 245px; min-height: 64px; }
  .chat-conversation { min-height: 720px; }
  .chat-conversation-head { min-height: 70px; padding: 10px 13px; }
  .chat-conversation-head h1 { font-size: .98rem; }
  .chat-member-list { max-height: 22px; overflow: hidden; }
  .chat-manage[open] > .chat-manage-menu { position: fixed; z-index: 100; top: 15vh; right: 12px; left: 12px; width: auto; }
  .chat-task-board { grid-template-columns: 90px minmax(0, 1fr); gap: 8px; padding: 8px 10px; }
  .chat-task-item { min-width: min(310px, 78vw); }
  .chat-message-list { min-height: 450px; max-height: 62vh; padding: 20px 11px 14px; }
  .chat-message { max-width: 95%; }
  .chat-bubble { font-size: .8rem; }
  .chat-composer { position: sticky; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 8; padding: 9px 10px; }
  .chat-mention-tools { max-height: 34px; overflow-x: auto; flex-wrap: nowrap; }
  .chat-mention-tools button { white-space: nowrap; }
  .chat-compose-footer { gap: 7px; }
  .chat-send-button { min-width: 84px; }
  .chat-global-notice { top: 8px; right: 8px; grid-template-columns: 36px minmax(0, 1fr) auto 28px; width: calc(100vw - 16px); }
  .chat-notice-avatar { width: 36px; height: 36px; }
  .chat-global-notice a { padding: 7px 8px; font-size: .68rem; }
}

body[data-route="email-center"] .email-center-title { margin-bottom: 8px; }
body[data-route="email-center"] .email-mail-workspace,
body[data-route="email-center"] .email-mail-main,
body[data-route="email-center"] .email-activity,
body[data-route="email-center"] .email-log-list { min-width: 0; max-width: 100%; }
.email-mail-toolbar { min-width: 0; }
.email-mail-toolbar > * { min-width: 0; }
.email-mail-search { width: 100%; min-width: 0; }
.email-mail-main .email-activity-heading { overflow: visible; }
.email-bulk-controls {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.email-bulk-shortcuts { min-width: 0; flex-wrap: wrap; }
.email-bulk-controls form { margin: 0; }
.email-bulk-controls .danger { white-space: nowrap; }
.email-log-row { grid-template-columns: 70px minmax(0, 1fr); }

@media (max-width: 1100px) and (min-width: 768px) {
  .email-bulk-shortcuts button { padding-inline: 5px; }
  .email-selection-count { min-width: 58px; }
  .email-log-row .email-log-collapsible > summary {
    grid-template-columns: minmax(110px, 150px) minmax(180px, 1fr) auto 34px;
  }
  .email-log-row summary time { display: none; }
}

@media (max-width: 767px) {
  .app-sidebar-toggle { display: none !important; }
  .email-bulk-shortcuts { display: none; }
  .email-log-row { grid-template-columns: 42px minmax(0, 1fr) !important; }
}

/* Let Mail use every pixel released by the collapsible CRM navigation. */
@media (min-width: 768px) {
  body[data-route="email-center"][data-crm-user="1"] {
    padding-left: 224px;
  }
  body[data-route="email-center"][data-crm-user="1"].app-sidebar-collapsed {
    padding-left: 76px !important;
  }
  body[data-route="email-center"] .shell {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 8px 8px 22px !important;
  }
  body[data-route="email-center"] .email-center-title {
    padding-inline: 4px;
  }
  body[data-route="email-center"] .email-mail-workspace {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  body[data-route="email-center"][data-crm-user="1"] {
    padding-left: 184px;
  }
  body[data-route="email-center"][data-crm-user="1"].app-sidebar-collapsed {
    padding-left: 76px !important;
  }
}

/* Final reader geometry override must remain after legacy popout rules. */
.email-log-row .email-log-collapsible[open] > .email-log-expanded {
  inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  width: auto;
  max-width: none;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
}
.email-reader-back:focus-visible {
  outline: 2px solid #4f9cbe !important;
  outline-offset: 1px !important;
  box-shadow: 0 0 0 4px rgba(79, 156, 190, .16) !important;
}

@media (max-width: 820px) {
  .email-log-row .email-log-collapsible[open] > .email-log-expanded {
    inset: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
    grid-template-rows: 58px minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }
}

/* Compact sender row: keep help below the account instead of in the label rail. */
.email-compose-drawer[open] .email-compose-routing > .email-compose-from {
  grid-template-areas:
    "label sender"
    ". help";
  grid-template-columns: 48px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  row-gap: 0;
}
.email-compose-from > label { grid-area: label; }
.email-compose-from-control {
  grid-area: sender;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.email-compose-from-control > select {
  width: 100%;
  min-width: 0;
}
.email-provider-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid #86d6ae;
  border-radius: 999px;
  background: #e9fbf2;
  color: #11643d;
  font-size: .64rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.email-provider-badge[data-provider="smtp"] {
  border-color: #f1bd64;
  background: #fff6dc;
  color: #8a5100;
}
.email-compose-from-help {
  grid-area: help;
  display: block;
  min-width: 0;
  padding: 0 8px 5px;
  color: #64748b;
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
}
.email-compose-from-help.is-warning {
  color: #a33a22;
  font-weight: 850;
}
.email-compose-drawer[open] .email-compose-routing > .email-compose-to {
  align-self: start;
}

@media (max-width: 760px) {
  .email-compose-drawer[open] .email-compose-routing > .email-compose-from {
    grid-template-columns: 42px minmax(0, 1fr);
  }
}

/* V65: Postmark delivery events shown inside each lead. */
.email-status-processed,
.email-status-delivered {
  background: #dcfce7;
  color: #166534;
}
.email-status-opened,
.email-status-clicked {
  background: #dff4ff;
  color: #075d7a;
}
.email-status-bounced,
.email-status-complaint,
.email-status-unsubscribed {
  background: #fee2e2;
  color: #991b1b;
}
.postmark-delivery-card {
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid #cfe0ec;
  border-left: 4px solid #f2b632;
  border-radius: 8px;
  background: #f8fbfd;
}
.postmark-delivery-head,
.postmark-delivery-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.postmark-delivery-head {
  justify-content: space-between;
}
.postmark-wordmark {
  color: #0c7995;
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: 0;
}
.postmark-status-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.postmark-status-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  color: #718096;
}
.postmark-status-step > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.postmark-status-step strong,
.postmark-status-step small,
.postmark-status-step em {
  overflow-wrap: anywhere;
}
.postmark-status-step strong {
  font-size: .8rem;
}
.postmark-status-step small,
.postmark-status-step em,
.postmark-message-id {
  color: #718096;
  font-size: .67rem;
  font-style: normal;
}
.postmark-status-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  font-size: .72rem;
  font-weight: 950;
}
.postmark-status-step.is-complete {
  color: #145c3a;
}
.postmark-status-step.is-complete .postmark-status-dot {
  border-color: #2dae72;
  background: #2dae72;
}
.postmark-status-step.is-current .postmark-status-dot {
  box-shadow: 0 0 0 4px rgba(45, 174, 114, .14);
}
.postmark-status-step.is-error {
  color: #991b1b;
}
.postmark-status-step.is-error .postmark-status-dot {
  border-color: #dc3f45;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(220, 63, 69, .12);
}
.postmark-status-step.is-error .postmark-status-dot::before {
  content: "!";
  color: #b91c1c;
  font-weight: 950;
}
.postmark-message-id {
  display: block;
  overflow-wrap: anywhere;
}
.postmark-webhook-setup {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
  gap: 10px 18px;
  padding: 16px;
  border: 1px solid #b8d7eb;
  border-left: 4px solid #f2b632;
  border-radius: 8px;
  background: #fff;
}
.postmark-webhook-setup > div {
  grid-row: span 3;
}
.postmark-webhook-setup p {
  margin: 5px 0 0;
  color: #5c6d83;
  line-height: 1.45;
}
.postmark-webhook-setup input[readonly] {
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .77rem;
}

@media (max-width: 760px) {
  .postmark-delivery-head,
  .postmark-delivery-head > div {
    align-items: flex-start;
  }
  .postmark-delivery-head {
    display: grid;
  }
  .postmark-status-rail,
  .postmark-webhook-setup {
    grid-template-columns: 1fr;
  }
  .postmark-webhook-setup > div {
    grid-row: auto;
  }
}

/* COMPACT FUNDING LEAD ACTIVITY V68
   Keep call, email, and update timestamps horizontal so one narrow cell cannot
   inflate every lead row. The wrapper scrolls only when all columns cannot fit. */
@media (min-width: 761px) {
  .lead-table-wrap {
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-gutter: stable;
  }

  .lead-table {
    width: 100% !important;
    min-width: 1680px !important;
    table-layout: fixed !important;
  }

  .lead-table th,
  .lead-table td,
  .lead-table tr[class*="stage-row-"] td {
    padding: 9px 8px !important;
    vertical-align: middle !important;
  }

  .lead-col-lead { width: 170px !important; }
  .lead-col-contact { width: 190px !important; }
  .lead-col-dob { width: 95px !important; }
  .lead-col-case { width: 140px !important; }
  .lead-col-stage { width: 160px !important; }
  .lead-col-docs { width: 125px !important; }
  .lead-col-attorney { width: 175px !important; }
  .lead-col-funding { width: 135px !important; }
  .lead-col-assigned { width: 105px !important; }
  .lead-col-updated { width: 300px !important; }
  .lead-col-action { width: 85px !important; }

  .lead-table .lead-col-updated,
  .lead-table .lead-updated-cell,
  .lead-table tbody td:nth-child(10) {
    display: table-cell !important;
  }

  .lead-updated-cell {
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: nowrap !important;
  }

  .lead-activity-list {
    display: flex !important;
    min-width: max-content;
    align-items: stretch;
    gap: 6px;
    white-space: nowrap;
  }

  .lead-activity-item {
    display: inline-flex !important;
    min-width: 84px;
    flex: 1 0 auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 6px 7px;
    border: 1px solid #dce7ef;
    border-radius: 6px;
    background: #f8fbfd;
    line-height: 1.1;
  }

  .lead-activity-item b,
  .lead-activity-item time {
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: nowrap !important;
  }

  .lead-activity-item b {
    font-size: 9px;
    letter-spacing: .05em;
  }

  .lead-activity-item time {
    font-size: 10px;
  }

  .lead-activity-updated {
    padding-top: 6px;
    border-top: 1px solid #dce7ef;
    color: #243653;
  }

  .lead-activity-updated b {
    color: #65758a;
  }
}

@media (max-width: 760px) {
  .lead-activity-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .lead-activity-item {
    display: flex !important;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 7px;
    border: 1px solid #dce7ef;
    border-radius: 6px;
    background: #f8fbfd;
  }

  .lead-activity-item b,
  .lead-activity-item time {
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .lead-activity-updated {
    padding-top: 7px;
    border-top: 1px solid #dce7ef;
  }
}

/* COMPLETE FUNDING LEAD ACTIVITY V69
   Give the lead book a wide, calm workspace and keep identity/actions visible
   while calls, email, SMS, notes, and record updates stay on one compact row. */
@media (min-width: 761px) {
  .lead-table-wrap {
    position: relative;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-behavior: smooth;
    scrollbar-gutter: stable both-edges;
  }

  .lead-table {
    width: 100% !important;
    min-width: 2200px !important;
  }

  .lead-col-lead { width: 190px !important; }
  .lead-col-contact { width: 220px !important; }
  .lead-col-dob { width: 110px !important; }
  .lead-col-case { width: 160px !important; }
  .lead-col-stage { width: 170px !important; }
  .lead-col-docs { width: 140px !important; }
  .lead-col-attorney { width: 200px !important; }
  .lead-col-funding { width: 150px !important; }
  .lead-col-assigned { width: 120px !important; }
  .lead-col-updated { width: 520px !important; }
  .lead-col-action { width: 110px !important; }

  .lead-table .lead-id-cell,
  .lead-table th.lead-col-lead {
    position: sticky !important;
    left: 0;
    z-index: 6;
  }

  .lead-table th.lead-col-lead {
    z-index: 8;
    background: #f8fbfe !important;
  }

  .lead-table .lead-id-cell {
    background: #ffffff !important;
    box-shadow: 8px 0 14px -13px rgba(8, 33, 61, .65);
  }

  .lead-table .lead-action-cell,
  .lead-table th.lead-col-action {
    position: sticky !important;
    right: 0;
    z-index: 6;
  }

  .lead-table th.lead-col-action {
    z-index: 8;
    background: #f8fbfe !important;
  }

  .lead-table .lead-action-cell {
    background: #ffffff !important;
    box-shadow: -8px 0 14px -13px rgba(8, 33, 61, .65);
  }

  .lead-action-cell button {
    width: 100% !important;
    min-width: 88px !important;
    padding: 8px 10px !important;
    white-space: nowrap !important;
  }

  .lead-activity-list {
    display: grid !important;
    min-width: 0;
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    gap: 7px;
  }

  .lead-activity-item {
    min-width: 0;
    width: 100%;
    padding: 7px 8px;
  }

  .lead-activity-sms b {
    color: #11745b;
  }

  .lead-activity-note b {
    color: #6b4aa0;
  }
}

@media (max-width: 760px) {
  .lead-activity-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-activity-updated {
    grid-column: 1 / -1;
  }
}

/* NO-SCROLL FUNDING LEAD GRID V70
   Every lead field remains visible. Wide screens use one detail row plus one
   slim activity row; narrower workspaces reflow into two detail rows. */
@media (min-width: 761px) {
  .lead-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .lead-table,
  .lead-table thead,
  .lead-table tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .lead-table {
    padding: 7px !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
  }

  .lead-table thead tr,
  .lead-table tbody tr {
    display: grid !important;
    width: 100%;
    min-width: 0;
  }

  .lead-table tbody {
    display: grid !important;
    gap: 8px;
  }

  .lead-table tbody tr {
    overflow: hidden;
    border: 1px solid #dce7ef;
    border-left: 7px solid var(--status-accent, #cbd5e1);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 7px 20px rgba(8, 33, 61, .07);
  }

  .lead-table th,
  .lead-table td,
  .lead-table tr[class*="stage-row-"] td,
  .lead-table .lead-col-dob,
  .lead-table .lead-dob-cell,
  .lead-table .lead-col-case,
  .lead-table .lead-case-cell,
  .lead-table .lead-col-attorney,
  .lead-table .lead-attorney-cell,
  .lead-table .lead-col-funding,
  .lead-table .lead-funding-cell,
  .lead-table .lead-col-updated,
  .lead-table .lead-updated-cell,
  .lead-table tbody td:nth-child(3),
  .lead-table tbody td:nth-child(4),
  .lead-table tbody td:nth-child(8),
  .lead-table tbody td:nth-child(10) {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 9px 9px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow-wrap: break-word;
  }

  .lead-table td:first-child,
  .lead-table tr[class*="stage-row-"] td:first-child {
    border-left: 0 !important;
  }

  .lead-table .lead-id-cell { grid-area: lead; }
  .lead-table .lead-contact-cell { grid-area: contact; }
  .lead-table .lead-dob-cell { grid-area: dob; }
  .lead-table .lead-case-cell { grid-area: case; }
  .lead-table .lead-stage-cell { grid-area: stage; }
  .lead-table .lead-docs-cell { grid-area: docs; }
  .lead-table .lead-attorney-cell { grid-area: attorney; }
  .lead-table .lead-funding-cell { grid-area: funding; }
  .lead-table .lead-assigned-cell { grid-area: assigned; }
  .lead-table .lead-updated-cell {
    grid-area: activity;
    padding: 7px 9px 9px !important;
    border-top: 1px solid #e4edf4 !important;
    background: #fbfdff !important;
    white-space: normal !important;
  }
  .lead-table .lead-action-cell {
    grid-area: action;
    display: flex !important;
    align-items: center;
    justify-content: stretch;
  }

  .lead-table .lead-action-cell form,
  .lead-table .lead-action-cell button {
    width: 100% !important;
  }

  .lead-table .lead-action-cell button {
    min-width: 0 !important;
    padding: 7px 8px !important;
    white-space: nowrap !important;
  }

  .lead-activity-list {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
    white-space: normal;
  }

  .lead-activity-item,
  .lead-activity-item time {
    min-width: 0;
    width: 100%;
    white-space: normal !important;
  }

  .lead-activity-item time {
    font-size: 10px;
    line-height: 1.2;
  }
}

@media (min-width: 1500px) {
  .lead-table thead {
    display: block !important;
  }

  .lead-table thead tr {
    grid-template-columns: minmax(150px, 1.25fr) minmax(145px, 1.15fr) minmax(68px, .55fr) minmax(105px, .85fr) minmax(120px, .95fr) minmax(105px, .8fr) minmax(130px, 1.05fr) minmax(115px, .9fr) minmax(88px, .7fr) minmax(84px, .65fr);
    grid-template-areas: "lead contact dob case stage docs attorney funding assigned action";
  }

  .lead-table thead .lead-col-lead { grid-area: lead; }
  .lead-table thead .lead-col-contact { grid-area: contact; }
  .lead-table thead .lead-col-dob { grid-area: dob; }
  .lead-table thead .lead-col-case { grid-area: case; }
  .lead-table thead .lead-col-stage { grid-area: stage; }
  .lead-table thead .lead-col-docs { grid-area: docs; }
  .lead-table thead .lead-col-attorney { grid-area: attorney; }
  .lead-table thead .lead-col-funding { grid-area: funding; }
  .lead-table thead .lead-col-assigned { grid-area: assigned; }
  .lead-table thead .lead-col-action { grid-area: action; }
  .lead-table thead .lead-col-updated { display: none !important; }

  .lead-table tbody tr {
    grid-template-columns: minmax(150px, 1.25fr) minmax(145px, 1.15fr) minmax(68px, .55fr) minmax(105px, .85fr) minmax(120px, .95fr) minmax(105px, .8fr) minmax(130px, 1.05fr) minmax(115px, .9fr) minmax(88px, .7fr) minmax(84px, .65fr);
    grid-template-areas:
      "lead contact dob case stage docs attorney funding assigned action"
      "activity activity activity activity activity activity activity activity activity activity";
  }
}

@media (min-width: 761px) and (max-width: 1499px) {
  .lead-table thead {
    display: none !important;
  }

  .lead-table tbody tr {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-areas:
      "lead contact dob case stage"
      "docs attorney funding assigned action"
      "activity activity activity activity activity";
  }

  .lead-table td::before {
    display: block;
    margin-bottom: 4px;
    content: attr(data-label);
    color: #6b7b91;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .07em;
    text-transform: uppercase;
  }

  .lead-table .lead-updated-cell::before,
  .lead-table .lead-action-cell::before {
    display: none;
  }
}

/* TEAM CHAT WORKSPACE V75
   A dense channel-style workspace for fast admin and agent collaboration. */
body[data-route="chat"] .chat-app {
  grid-template-columns: 268px minmax(0, 1fr);
  height: calc(100vh - 24px);
  min-height: 680px;
  border-color: #cfdbe5;
  border-radius: 6px;
  box-shadow: 0 12px 34px rgba(8, 33, 61, .11);
}

body[data-route="chat"] .chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right-color: #254d56;
  background: #123943;
  color: #f7fbfc;
}

body[data-route="chat"] .chat-sidebar > header {
  min-height: 70px;
  padding: 13px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

body[data-route="chat"] .chat-sidebar-title .eyebrow {
  margin: 0 0 2px;
  color: #f4bd45;
  font-size: .58rem;
  letter-spacing: .08em;
}

body[data-route="chat"] .chat-sidebar h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0;
}

body[data-route="chat"] .chat-sidebar-count {
  color: #d9e8eb;
  font-size: .58rem;
}

body[data-route="chat"] .chat-sidebar-collapse {
  min-height: 28px;
  padding: 4px 7px;
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
}

body[data-route="chat"] .chat-new-panel {
  margin: 10px 11px 8px;
}

body[data-route="chat"] .chat-new-panel > summary {
  min-height: 36px;
  justify-content: flex-start;
  padding: 7px 10px;
  border-color: #d69a1e;
  background: #f4b93f;
  color: #10243e;
  font-size: .72rem;
}

body[data-route="chat"] .chat-new-panel[open] {
  top: 64px;
  border-color: #b9cad6;
}

body[data-route="chat"] .chat-new-panel[open] > summary {
  background: #fff5d8;
  color: #674200;
}

body[data-route="chat"] .chat-search {
  min-height: 35px;
  margin: 0 11px 8px;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1);
}

body[data-route="chat"] .chat-search span {
  color: #c8dadd;
}

body[data-route="chat"] .chat-search input {
  min-height: 34px;
  color: #ffffff;
  font-size: .7rem;
}

body[data-route="chat"] .chat-search input::placeholder {
  color: #bfd1d5;
  opacity: 1;
}

body[data-route="chat"] .chat-sidebar-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px 5px;
  color: #b9ced2;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

body[data-route="chat"] .chat-sidebar-section-label b {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
  font-size: .55rem;
  text-align: center;
}

body[data-route="chat"] .chat-thread-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 7px 12px;
}

body[data-route="chat"] .chat-thread-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 49px;
  padding: 6px 8px;
  border-left-width: 3px;
  border-radius: 4px;
  color: #e8f1f3;
}

body[data-route="chat"] .chat-thread-row:hover,
body[data-route="chat"] .chat-thread-row.has-unread {
  background: rgba(255, 255, 255, .09);
}

body[data-route="chat"] .chat-thread-row.is-active {
  border-left-color: #f7c34f;
  background: #0a727a;
}

body[data-route="chat"] .chat-thread-avatar {
  width: 28px;
  height: 28px;
  background: #e5f0f2;
  color: #123943;
  font-size: .58rem;
}

body[data-route="chat"] .chat-thread-row.is-group .chat-thread-avatar {
  border: 1px solid rgba(255, 255, 255, .28);
  background: transparent;
  color: #f7c34f;
  font-size: .9rem;
}

body[data-route="chat"] .chat-thread-row.is-active .chat-thread-avatar {
  background: #ffffff;
  color: #0a6870;
}

body[data-route="chat"] .chat-thread-copy {
  gap: 1px;
}

body[data-route="chat"] .chat-thread-copy strong {
  color: #ffffff;
  font-size: .72rem;
}

body[data-route="chat"] .chat-thread-copy small {
  color: #bdd0d4;
  font-size: .59rem;
}

body[data-route="chat"] .chat-thread-row.is-active .chat-thread-copy small {
  color: #d7f0f2;
}

body[data-route="chat"] .chat-thread-side time {
  color: #a9c1c6;
  font-size: .52rem;
}

body[data-route="chat"] .chat-thread-side b {
  min-width: 18px;
  height: 18px;
  background: #f4b93f;
  color: #10243e;
  font-size: .55rem;
}

body[data-route="chat"] .chat-no-threads {
  color: #c3d4d7;
}

body[data-route="chat"] .chat-conversation {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #ffffff;
}

body[data-route="chat"] .chat-conversation-head {
  min-height: 62px;
  padding: 8px 14px;
  border-bottom-color: #d8e1e8;
}

body[data-route="chat"] .chat-conversation-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

body[data-route="chat"] .chat-conversation-head .chat-thread-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: #0a727a;
  color: #ffffff;
}

body[data-route="chat"] .chat-conversation-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body[data-route="chat"] .chat-conversation-title-row,
body[data-route="chat"] .chat-conversation-subline {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

body[data-route="chat"] .chat-conversation-head h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #10243e;
  font-size: .94rem;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-route="chat"] .chat-presence-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #21a366;
}

body[data-route="chat"] .chat-conversation-subline > b {
  color: #728195;
  font-size: .56rem;
  white-space: nowrap;
}

body[data-route="chat"] .chat-member-list {
  flex-wrap: nowrap;
  min-width: 0;
  max-width: min(48vw, 520px);
  overflow: hidden;
}

body[data-route="chat"] .chat-member-chip {
  flex: 0 0 auto;
  padding: 2px 5px;
  font-size: .52rem;
}

body[data-route="chat"] .chat-manage > summary {
  padding: 6px 8px;
  font-size: .62rem;
}

body[data-route="chat"] .chat-task-board {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 9px;
  padding: 7px 13px;
  background: #f6f8fa;
}

body[data-route="chat"] .chat-task-board > header {
  gap: 3px;
}

body[data-route="chat"] .chat-task-board > header strong {
  font-size: .7rem;
}

body[data-route="chat"] .chat-task-item {
  min-width: min(320px, 68vw);
  max-width: 380px;
  padding: 7px 34px 7px 8px;
}

body[data-route="chat"] .chat-task-copy p {
  -webkit-line-clamp: 1;
}

body[data-route="chat"] .chat-message-list {
  padding: 14px clamp(10px, 2.3vw, 34px) 10px;
  background: #ffffff;
}

body[data-route="chat"] .chat-history-controls {
  margin: 0 0 12px;
}

body[data-route="chat"] .chat-message,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message {
  width: 100%;
  max-width: none;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 6px 9px;
  border-left: 3px solid transparent;
}

body[data-route="chat"] .chat-message:hover {
  background: #f7f9fb;
}

body[data-route="chat"] .chat-message-mine {
  flex-direction: row;
  margin-left: 0;
}

body[data-route="chat"] .chat-message-mine:hover {
  border-left-color: #9ccddd;
  background: #f1f8fa;
}

body[data-route="chat"] .chat-message .chat-avatar,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message > .chat-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  background: #0b7b86;
  color: #ffffff;
  font-size: .6rem;
}

body[data-route="chat"] .chat-message-stack,
body[data-route="chat"] .chat-message-mine .chat-message-stack {
  width: 100%;
  justify-items: stretch;
  gap: 2px;
}

body[data-route="chat"] .chat-message-meta,
body[data-route="chat"] .chat-message-mine .chat-message-meta {
  flex-direction: row;
  gap: 7px;
  padding: 0;
}

body[data-route="chat"] .chat-message-meta strong,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message-meta strong {
  color: #182c43;
  font-size: .72rem;
}

body[data-route="chat"] .chat-message-meta time,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-message-meta time {
  color: #8995a3;
  font-size: .55rem;
}

body[data-route="chat"] .chat-bubble,
body[data-route="chat"] .chat-message-mine .chat-bubble,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-bubble {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #263b52;
  font-size: .78rem;
  line-height: 1.42;
}

body[data-route="chat"] .chat-lead-links {
  width: min(560px, 100%);
  margin-top: 4px;
}

body[data-route="chat"] .chat-lead-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
}

body[data-route="chat"] .chat-lead-card small {
  text-align: right;
}

body[data-route="chat"] .chat-composer,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-composer {
  position: relative;
  gap: 6px;
  margin: 8px 15px 13px;
  padding: 8px;
  border: 1px solid #aebdca;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(8, 33, 61, .08);
}

body[data-route="chat"] .chat-mention-tools {
  min-height: 24px;
  padding-bottom: 4px;
  border-bottom: 1px solid #edf1f4;
}

body[data-route="chat"] .chat-composer textarea,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-composer textarea {
  min-height: 60px;
  max-height: 150px;
  padding: 7px 8px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  font-size: .78rem;
  line-height: 1.4;
}

body[data-route="chat"] .chat-compose-footer {
  min-height: 32px;
  padding-top: 4px;
  border-top: 1px solid #edf1f4;
}

body[data-route="chat"] .chat-send-button,
body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-send-button {
  min-width: 88px;
  min-height: 32px;
  padding: 5px 10px;
  background: #0a727a;
  font-size: .7rem;
}

body[data-route="chat"] .chat-send-button:hover {
  background: #075e65;
}

/* Keep the AI review count attached to its navigation item. */
.nav-ai-desk {
  position: relative;
}

.nav-ai-desk.hot {
  padding-right: 34px !important;
}

@media (max-width: 980px) and (min-width: 761px) {
  body[data-route="chat"] .chat-app {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  body[data-route="chat"] .chat-member-list {
    max-width: 34vw;
  }
}

@media (max-width: 760px) {
  body[data-route="chat"] .chat-app {
    height: auto;
    min-height: calc(100vh - 70px);
    grid-template-columns: 1fr;
    border: 0;
    box-shadow: none;
  }

  body[data-route="chat"] .chat-sidebar {
    max-height: min(72vh, 620px);
  }

  body[data-route="chat"] .chat-sidebar-section-label {
    padding-inline: 12px;
  }

  body[data-route="chat"] .chat-thread-list {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 7px 10px;
  }

  body[data-route="chat"] .chat-thread-row {
    width: 100%;
    min-width: 0;
    min-height: 50px;
  }

  body[data-route="chat"] .chat-conversation-head {
    min-height: 58px;
    padding: 7px 9px;
  }

  body[data-route="chat"] .chat-conversation-head .chat-thread-avatar {
    display: none;
  }

  body[data-route="chat"] .chat-conversation-head h1 {
    max-width: 44vw;
    font-size: .82rem;
  }

  body[data-route="chat"] .chat-member-list {
    display: none;
  }

  body[data-route="chat"] .chat-task-board {
    grid-template-columns: 76px minmax(0, 1fr);
    padding: 6px 8px;
  }

  body[data-route="chat"] .chat-task-item {
    min-width: min(285px, 78vw);
  }

  body[data-route="chat"] .chat-message-list {
    min-height: 390px;
    max-height: 60vh;
    padding: 10px 4px 8px;
  }

  body[data-route="chat"] .chat-message {
    gap: 7px;
    padding: 6px;
  }

  body[data-route="chat"] .chat-message .chat-avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  body[data-route="chat"] .chat-lead-card {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  body[data-route="chat"] .chat-lead-card small {
    text-align: left;
  }

  body[data-route="chat"] .chat-composer,
  body[data-route="chat"] .chat-app.is-chat-sidebar-collapsed .chat-composer {
    position: sticky;
    bottom: calc(62px + env(safe-area-inset-bottom));
    z-index: 8;
    margin: 6px 7px 8px;
    padding: 7px;
  }

  body[data-route="chat"] .chat-compose-tip {
    display: none;
  }
}

/* V85 shared CRM experience refresh. Keep route behavior intact while making
   the application shell denser, calmer, and consistent across workspaces. */
body[data-crm-user="1"] {
  --v85-navy: #0b2f4b;
  --v85-teal: #0b7580;
  --v85-gold: #e9a928;
  --v85-ink: #152b42;
  --v85-muted: #64758a;
  --v85-line: #cfdae4;
  --v85-soft: #eef3f7;
  --v85-panel: #ffffff;
  padding-left: 240px;
  background: #f2f5f7;
  color: var(--v85-ink);
  letter-spacing: 0;
}

body[data-crm-user="1"] .app-header {
  width: 240px;
  gap: 9px;
  padding: calc(14px + env(safe-area-inset-top)) 13px calc(14px + env(safe-area-inset-bottom)) calc(13px + env(safe-area-inset-left));
  border-right-color: var(--v85-line);
  box-shadow: 3px 0 16px rgba(11, 47, 75, .06);
}

body[data-crm-user="1"] .app-header .brand {
  min-height: 58px;
  padding: 5px 7px 10px;
  border-bottom: 1px solid #e6edf2;
}

body[data-crm-user="1"] .brand-logo {
  width: 188px;
}

.nav-section-label {
  display: block;
  margin: 8px 10px 3px;
  color: #8190a1;
  font-size: .63rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-nav {
  gap: 2px;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #c4d1dc transparent;
}

.primary-nav a,
.primary-nav button {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #43556a;
  font-size: .79rem;
  font-weight: 780;
}

.primary-nav a:hover,
.primary-nav button:hover {
  border-color: #d6e2ea;
  background: #f1f6f9;
  color: var(--v85-navy);
}

.primary-nav a.nav-active {
  border-color: var(--v85-navy);
  background: var(--v85-navy);
  color: #ffffff;
  box-shadow: none;
}

.primary-nav a.nav-active .nav-count-badge {
  border-color: rgba(255, 255, 255, .7);
}

.primary-nav .nav-count-badge {
  min-width: 20px;
  min-height: 20px;
  padding: 0 5px;
  border: 2px solid #ffffff;
  font-size: .61rem;
}

.nav-account {
  display: grid;
  gap: 2px;
  margin: 12px 4px 0;
  padding: 10px 11px;
  border-top: 1px solid #e1e9ef;
  color: var(--v85-muted);
}

.nav-account span {
  font-size: .61rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-account strong {
  overflow: hidden;
  color: var(--v85-ink);
  font-size: .75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar-toggle {
  min-height: 36px;
  border: 1px solid #d8e3eb;
  background: #f4f7fa;
}

body[data-crm-user="1"] .shell {
  width: min(calc(100% - 40px), 1720px);
  margin: 20px auto 56px;
}

body[data-crm-user="1"] .shell > .toolbar,
body[data-crm-user="1"] .dashboard-page-head {
  min-height: 88px;
  margin-bottom: 14px;
  padding: 17px 20px;
  border: 1px solid var(--v85-line);
  border-radius: 8px;
  background: var(--v85-panel);
  box-shadow: 0 4px 14px rgba(11, 47, 75, .05);
}

body[data-crm-user="1"] .shell > .toolbar h1,
body[data-crm-user="1"] .dashboard-page-head h1 {
  margin: 2px 0 4px;
  color: var(--v85-ink);
  font-size: 2rem;
  line-height: 1.08;
  letter-spacing: 0;
}

body[data-crm-user="1"] .shell > .toolbar p,
body[data-crm-user="1"] .dashboard-page-head p {
  max-width: 820px;
  margin: 0;
  color: var(--v85-muted);
  font-size: .84rem;
  line-height: 1.45;
}

body[data-crm-user="1"] .eyebrow,
body[data-crm-user="1"] th {
  letter-spacing: 0;
}

body[data-crm-user="1"] .panel,
body[data-crm-user="1"] .chart-card {
  border-color: var(--v85-line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(11, 47, 75, .045);
}

body[data-crm-user="1"] :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: #c8d5df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--v85-ink);
  box-shadow: none;
}

body[data-crm-user="1"] :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  border-color: var(--v85-teal);
}

body[data-crm-user="1"] :where(button, .btn, input[type="submit"], input[type="button"]) {
  min-height: 38px;
  border-radius: 6px;
  letter-spacing: 0;
}

body[data-crm-user="1"] :where(button, .btn):not(.secondary):not(.danger):not(.nav-logout):not(.app-sidebar-toggle):not(.mobile-signout) {
  box-shadow: 0 2px 0 rgba(90, 58, 0, .16);
}

body[data-crm-user="1"] .table-wrap {
  border: 1px solid var(--v85-line);
  border-radius: 8px;
  background: #ffffff;
}

body[data-crm-user="1"] table {
  border-collapse: separate;
  border-spacing: 0;
}

body[data-crm-user="1"] th {
  background: #edf3f7;
  color: #586b80;
  font-size: .66rem;
}

body[data-crm-user="1"] td {
  border-color: #e0e8ee;
}

body[data-crm-user="1"] tbody tr:hover td {
  background: #f8fbfc;
}

.connection-status {
  border-radius: 6px;
}

@media (min-width: 768px) {
  body[data-crm-user="1"].app-sidebar-collapsed .nav-section-label,
  body[data-crm-user="1"].app-sidebar-collapsed .nav-account {
    display: none;
  }

  body[data-crm-user="1"].app-sidebar-collapsed .primary-nav a.nav-active::before {
    background: var(--v85-navy);
    color: #ffffff;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  body[data-crm-user="1"] {
    padding-left: 196px;
  }

  body[data-crm-user="1"] .app-header {
    width: 196px;
  }

  body[data-crm-user="1"] .brand-logo {
    width: 164px;
  }

  body[data-crm-user="1"] .shell {
    width: min(calc(100% - 24px), 1720px);
  }
}

@media (max-width: 767px) {
  body[data-crm-user="1"] {
    padding-left: 0;
    background: #f4f7f9;
  }

  body[data-crm-user="1"] .app-header {
    width: 100%;
    min-height: calc(58px + env(safe-area-inset-top));
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  body[data-crm-user="1"] .app-header .brand {
    min-height: 42px;
    padding: 2px;
    border-bottom: 0;
  }

  body[data-crm-user="1"] .brand-logo {
    width: 154px;
  }

  body[data-crm-user="1"] .shell,
  body[data-route="email-center"] .shell,
  body[data-route="dashboard"] .shell {
    padding: 10px max(8px, env(safe-area-inset-right)) 18px max(8px, env(safe-area-inset-left));
  }

  body[data-crm-user="1"] .shell > .toolbar,
  body[data-crm-user="1"] .dashboard-page-head {
    min-height: 0;
    padding: 13px 14px;
    border-radius: 7px;
  }

  body[data-crm-user="1"] .shell > .toolbar h1,
  body[data-crm-user="1"] .dashboard-page-head h1 {
    font-size: 1.5rem;
  }

  .mobile-bottom-nav {
    grid-auto-columns: 76px;
    justify-content: start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .mobile-bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-bottom-nav a {
    min-width: 72px;
    min-height: 52px;
    font-size: .65rem;
  }

  body[data-crm-user="1"] .panel,
  body[data-crm-user="1"] .chart-card,
  body[data-crm-user="1"] .table-wrap {
    border-radius: 7px;
  }
}

/* Lightweight operations dashboard */
.ops-dashboard-head {
  align-items: center;
}

.ops-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.ops-dashboard-metrics a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 16px;
  color: #10213a;
  text-decoration: none;
  background: #fff;
  border: 1px solid #cfdae3;
  border-radius: 7px;
}

.ops-dashboard-metrics a:hover {
  border-color: #00899a;
}

.ops-dashboard-metrics small {
  color: #65758a;
  font-weight: 800;
}

.ops-dashboard-metrics strong {
  font-size: 1.7rem;
}

.ops-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ops-dashboard-panel {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.ops-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #dbe4ea;
}

.ops-panel-head h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.ops-panel-head a,
.ops-panel-head > span {
  font-size: .78rem;
  font-weight: 800;
}

.ops-dashboard-list {
  max-height: 430px;
  overflow-y: auto;
}

.ops-dashboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #e3eaf0;
}

.ops-dashboard-row:last-child {
  border-bottom: 0;
}

.ops-row-main {
  min-width: 0;
}

.ops-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.ops-row-meta span {
  padding: 3px 6px;
  color: #5a6d81;
  font-size: .65rem;
  font-weight: 900;
  background: #edf3f6;
  border-radius: 4px;
}

.ops-dashboard-row h3 {
  margin: 0;
  font-size: .92rem;
}

.ops-dashboard-row p {
  display: -webkit-box;
  margin: 4px 0;
  overflow: hidden;
  color: #5d6b7c;
  font-size: .8rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ops-dashboard-row small {
  display: block;
  color: #526375;
  line-height: 1.35;
}

.ops-lead-link {
  display: inline-block;
  margin-top: 3px;
  color: #006f79;
  font-size: .78rem;
  font-weight: 850;
  text-decoration: none;
}

.ops-ai-row.severity-urgent,
.ops-ai-row.severity-high {
  border-left: 4px solid #d83a2f;
}

.ops-dashboard-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 18px;
  color: #65758a;
}

.ops-pipeline-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.ops-pipeline-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  color: #10213a;
  text-decoration: none;
  border: 1px solid #dbe4ea;
  border-radius: 6px;
}

.ops-pipeline-links strong {
  font-size: 1.35rem;
}

@media (max-width: 900px) {
  .ops-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .ops-dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-dashboard-row {
    align-items: start;
  }
}

/* V112 inline AI writing assistant */
.ai-writing-assistant {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #a9d9d8;
  border-radius: 8px;
  background: linear-gradient(135deg, #f4fbfb 0%, #eef7ff 100%);
}

.ai-writing-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ai-writing-head strong {
  color: #103653;
  font-size: .88rem;
}

.ai-writing-head small {
  color: #607184;
  font-size: .72rem;
  text-align: right;
}

.ai-writing-prompt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-writing-prompt input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #b8cbd8;
  border-radius: 6px;
  background: #fff;
}

.ai-writing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-writing-actions button {
  padding: 7px 10px;
  border: 1px solid #92bdc7;
  border-radius: 6px;
  background: #fff;
  color: #104a5e;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}

.ai-writing-actions button:first-child {
  border-color: #087d88;
  background: #087d88;
  color: #fff;
}

.ai-writing-actions button:disabled {
  cursor: wait;
  opacity: .58;
}

.ai-writing-status {
  min-height: 1em;
  color: #56677a;
  font-size: .75rem;
}

.ai-writing-status.is-success,
.ai-writing-status.success {
  color: #13724a;
}

.ai-writing-status.is-error,
.ai-writing-status.error {
  color: #a32222;
}

.slicktext-sms-card .ai-writing-assistant {
  margin-top: 2px;
}

.email-compose-message .ai-writing-assistant {
  margin: 2px 0 6px;
}

.email-compose-drawer[open] .email-compose-message {
  grid-template-rows: auto auto minmax(210px, 1fr);
}

@media (max-width: 680px) {
  .ai-email-template-loader {
    grid-template-columns: 1fr;
  }

  .ai-email-template-loader > small {
    grid-column: 1;
  }

  .ai-writing-head,
  .ai-writing-prompt {
    grid-template-columns: 1fr;
  }

  .ai-writing-head {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .ai-writing-head small {
    text-align: left;
  }
}

/* V112 confirmation-gated Email Center sending from AI chat */
.ai-chat-email-fields {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.ai-chat-email-fields label {
  display: grid;
  gap: 5px;
  color: #31465c;
  font-size: .76rem;
  font-weight: 800;
}

.ai-chat-email-fields input,
.ai-chat-email-fields textarea {
  width: 100%;
  border: 1px solid #a9c7d2;
  border-radius: 8px;
  background: #fff;
  color: #152f4c;
  font: inherit;
  font-weight: 500;
  padding: 9px 10px;
}

.ai-chat-email-fields textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.45;
}

.ai-chat-email-fields input:focus,
.ai-chat-email-fields textarea:focus {
  outline: 3px solid rgba(247, 181, 51, .35);
  border-color: #d99a16;
}

.ai-chat-action-card:has(.ai-chat-email-fields) {
  align-items: stretch;
  max-width: 920px;
  background: #f7fbfc;
  border-color: #70b7c2;
}

/* V112 confirmation-gated SlickText sending from AI chat */
.ai-chat-sms-fields {
  display: grid;
  gap: 7px;
  width: 100%;
  margin-top: 4px;
}

.ai-chat-sms-fields label {
  display: grid;
  gap: 5px;
  color: #31465c;
  font-size: .76rem;
  font-weight: 800;
}

.ai-chat-sms-fields textarea {
  width: 100%;
  min-height: 125px;
  resize: vertical;
  border: 1px solid #8dbfc7;
  border-radius: 8px;
  background: #fff;
  color: #152f4c;
  font: inherit;
  font-weight: 500;
  line-height: 1.45;
  padding: 9px 10px;
}

.ai-chat-sms-fields textarea:focus {
  outline: 3px solid rgba(247, 181, 51, .35);
  border-color: #d99a16;
}

.ai-chat-sms-fields > small {
  justify-self: end;
  color: #64748b;
  font-size: .7rem;
  font-weight: 750;
}

.ai-chat-action-card:has(.ai-chat-sms-fields) {
  align-items: stretch;
  max-width: 920px;
  background: #f4fbfb;
  border-color: #58aebb;
}

/* V114 deterministic outreach history shown beside every reviewable draft. */
.ai-chat-outreach-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c6dce2;
  border-radius: 7px;
  background: #eef7f8;
  color: #41576c;
  font-size: .7rem;
  line-height: 1.35;
}

.ai-chat-outreach-facts > strong {
  flex-basis: 100%;
  color: #0b6570;
  font-size: .72rem;
}

.ai-chat-outreach-facts span {
  white-space: normal;
}

.ai-chat-outreach-facts b {
  color: #253f57;
}

.ai-chat-bulk-preview .ai-chat-outreach-facts {
  margin-top: 3px;
  padding: 6px 8px;
  font-size: .66rem;
}

/* V113 Mail Center: verified forwarding and proportional composer geometry. */
.email-forward-readiness {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #e3b24d;
  border-radius: 8px;
  background: #fff8e7;
  color: #63420d;
}

.email-forward-readiness.is-blocking {
  border-color: #d99036;
  background: #fff4df;
}

.email-forward-readiness > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.email-forward-readiness strong {
  color: #6f3f08;
  font-size: .86rem;
}

.email-forward-readiness p {
  margin: 0;
  font-size: .75rem;
  line-height: 1.42;
}

.email-forward-readiness form,
.email-forward-readiness button {
  margin: 0;
  white-space: nowrap;
}

.email-attachment.email-attachment-unavailable {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-color: #e6b458;
  background: #fff9eb;
  color: #72470b;
}

.email-attachment-unavailable > span:first-child {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #b96812;
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
}

.email-forward-selection-summary {
  padding: 7px 10px;
  border-radius: 6px;
  background: #e9f7f3;
  color: #12664f;
  font-size: .72rem;
  font-weight: 850;
}

.email-forward-selection-summary.is-empty {
  background: #f1f4f7;
  color: #65758a;
}

.email-forward-missing-ack {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid #e3b24d;
  border-radius: 7px;
  background: #fff9eb;
  color: #674714;
  font-size: .74rem;
  font-weight: 750;
  line-height: 1.4;
}

.email-forward-missing-ack input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

@media (min-width: 761px) {
  .email-compose-drawer[open]:not(.is-inline-reply) {
    inset: clamp(14px, 4vh, 42px) max(18px, calc((100vw - 1180px) / 2)) !important;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content {
    gap: 9px;
    padding: 11px 16px 15px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
    min-height: 0;
    max-height: 165px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form {
    grid-template-rows: auto auto auto auto;
    align-content: start;
    min-height: 0;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-composer-shell {
    grid-template-rows: auto auto auto auto;
    min-height: 0;
    overflow: visible;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message {
    grid-template-rows: auto auto minmax(170px, 30vh) auto;
    min-height: 0;
    padding: 9px 13px 11px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message textarea {
    height: clamp(170px, 30vh, 310px);
    min-height: 170px !important;
    max-height: 40vh;
    resize: vertical;
  }

  .email-compose-drawer[open].is-forwarding:not(.is-inline-reply) .email-compose-message textarea {
    height: clamp(105px, 17vh, 180px);
    min-height: 105px !important;
    max-height: 230px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body {
    max-height: 220px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager-body {
    max-height: 260px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form > button[type="submit"] {
    position: static;
  }
}

.email-reader-main {
  width: min(100%, 1080px);
  padding-block: 28px 48px;
}

.email-reader-content,
.email-reader-attachments,
.email-reader-outcome,
.email-reader-main > .email-match-panel,
.email-reader-main > .email-compose-drawer[open].is-replying.is-inline-reply {
  width: min(100%, 900px) !important;
  max-width: 900px !important;
}

.email-reader-message {
  padding: 24px 0 30px;
}

.email-reader-content {
  min-height: 80px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .email-forward-readiness {
    grid-template-columns: 1fr;
  }

  .email-forward-readiness button {
    width: 100%;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message textarea {
    height: 170px;
    min-height: 150px !important;
    max-height: 38vh;
    resize: vertical;
  }

  .email-compose-drawer[open].is-forwarding:not(.is-inline-reply) .email-compose-message textarea {
    height: 120px;
    min-height: 110px !important;
  }

  .email-reader-main {
    padding-block: 20px calc(36px + env(safe-area-inset-bottom));
  }
}

/* V115 Mail Center: keep the full composer in normal document flow.
   Grid tracks sized from the viewport could let the attachment manager paint over
   the forward cover-message textarea when the contact directory or AI helper was
   taller than expected. The inline reply composer keeps its compact layout. */
.email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content {
  display: flex;
  flex-direction: column;
  align-content: initial;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-content: initial;
  min-height: 0 !important;
  overflow: visible;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-composer-shell {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0 !important;
  overflow: visible !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0 !important;
  overflow: visible;
  isolation: isolate;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > label {
  order: 0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > textarea {
  position: relative;
  z-index: 1;
  order: 1;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  height: 210px !important;
  min-height: 180px !important;
  max-height: 46vh;
  padding: 10px 11px !important;
  border: 1px solid #a9c8d8 !important;
  border-radius: 7px !important;
  background: #fff !important;
  box-shadow: inset 0 1px 2px rgba(16, 41, 71, .06) !important;
  resize: vertical;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > textarea:focus {
  outline: 3px solid rgba(247, 181, 51, .3);
  border-color: #d99a16 !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > .ai-writing-assistant {
  position: relative;
  z-index: 0;
  order: 2;
  flex: 0 0 auto;
  margin: 7px 0 0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > .email-forward-source {
  position: relative;
  z-index: 0;
  order: 3;
  flex: 0 0 auto;
  margin-top: 8px;
}

.email-compose-drawer[open].is-forwarding:not(.is-inline-reply) .email-compose-message > textarea {
  height: 170px !important;
  min-height: 150px !important;
  max-height: 38vh;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager {
  position: relative !important;
  z-index: 0;
  display: block;
  flex: 0 0 auto;
  clear: both;
  width: 100%;
  margin: 0 !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager-body {
  position: static;
}

@media (max-width: 760px) {
  .email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content {
    scrollbar-gutter: auto;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > textarea,
  .email-compose-drawer[open].is-forwarding:not(.is-inline-reply) .email-compose-message > textarea {
    height: 160px !important;
    min-height: 140px !important;
    max-height: 42vh;
  }
}

/* V116: AI Desk is the dashboard's primary workspace. */
.dashboard-ai-chat {
  margin: 0 0 18px;
  border: 2px solid #7fb9c7;
  border-radius: 14px;
  box-shadow: 0 20px 46px rgba(13, 45, 74, .16);
}

.dashboard-ai-chat .ai-chat-head {
  min-height: 126px;
  padding: 24px 28px;
}

.dashboard-ai-chat .ai-chat-head h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.dashboard-ai-chat .ai-chat-head p {
  max-width: 900px;
  font-size: 1rem;
}

.dashboard-ai-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.dashboard-ai-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .76rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-ai-open:hover {
  background: rgba(255, 255, 255, .22);
}

.dashboard-ai-open b {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #f7b533;
  color: #102947;
}

.dashboard-ai-chat .ai-chat-messages {
  min-height: clamp(340px, 42vh, 520px);
  max-height: 720px;
  padding: 24px 28px;
}

.dashboard-ai-chat .ai-chat-message {
  max-width: min(1120px, 94%);
}

.dashboard-ai-chat .ai-chat-message > div:not(.ai-chat-avatar) {
  padding: 15px 17px;
  font-size: 1rem;
}

.dashboard-ai-chat .ai-chat-suggestions {
  padding: 14px 28px 0;
}

.dashboard-ai-chat .ai-chat-suggestions button {
  min-height: 38px;
  padding: 7px 13px;
}

.dashboard-ai-chat .ai-chat-composer {
  padding: 16px 28px 20px;
}

.dashboard-ai-chat .ai-chat-composer textarea {
  min-height: 132px;
  max-height: 320px;
  padding: 15px 16px;
  font-size: 1.05rem;
}

.dashboard-ai-chat .ai-chat-actions {
  min-width: 166px;
}

.dashboard-ai-chat .ai-chat-actions .btn {
  min-height: 48px;
}

.dashboard-ai-chat footer {
  padding: 11px 28px;
}

/* V116: the forward cover message always owns its own space. */
.email-ai-writing-tools {
  overflow: hidden;
}

.email-ai-writing-tools > summary {
  cursor: pointer;
  list-style: none;
}

.email-ai-writing-tools > summary::-webkit-details-marker {
  display: none;
}

.email-ai-writing-tools > summary::after {
  content: "Open";
  margin-left: auto;
  color: #0b6570;
  font-size: .7rem;
  font-weight: 900;
}

.email-ai-writing-tools[open] > summary::after {
  content: "Hide";
}

.email-ai-writing-tools > summary > span {
  display: none;
}

.email-ai-writing-tools-body {
  display: grid;
  gap: 8px;
  padding-top: 9px;
}

.email-ai-writing-tools:not([open]) > .email-ai-writing-tools-body {
  display: none;
}

.email-ai-writing-tools[open] > .email-ai-writing-tools-body {
  display: grid;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > textarea[data-email-compose-body] {
  display: block !important;
  position: static !important;
  order: 1;
  flex: 0 0 auto !important;
  width: 100% !important;
  height: 190px !important;
  min-height: 170px !important;
  max-height: 44vh !important;
  margin: 0 !important;
  resize: vertical !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-ai-writing-tools {
  position: static !important;
  order: 2;
  flex: 0 0 auto !important;
  width: 100%;
}

.email-compose-drawer[open]:not(.is-inline-reply) [data-email-attachment-manager],
.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form > [data-email-send-button] {
  position: static !important;
  flex: 0 0 auto !important;
  transform: none !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) [data-email-attachment-manager] {
  order: initial;
  margin-top: 0 !important;
}

@media (max-width: 760px) {
  .dashboard-ai-chat .ai-chat-head {
    display: grid;
    min-height: 0;
    padding: 18px;
  }

  .dashboard-ai-chat .ai-chat-head h2 {
    font-size: 2rem;
  }

  .dashboard-ai-head-actions {
    align-items: flex-start;
  }

  .dashboard-ai-chat .ai-chat-messages {
    min-height: 300px;
    max-height: 58vh;
    padding: 16px;
  }

  .dashboard-ai-chat .ai-chat-suggestions {
    flex-wrap: nowrap;
    padding: 12px 16px 0;
    overflow-x: auto;
  }

  .dashboard-ai-chat .ai-chat-suggestions button {
    flex: 0 0 auto;
  }

  .dashboard-ai-chat .ai-chat-composer {
    grid-template-columns: 1fr;
    padding: 14px 16px 17px;
  }

  .dashboard-ai-chat .ai-chat-composer textarea {
    min-height: 112px;
  }

  .dashboard-ai-chat .ai-chat-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .dashboard-ai-chat footer {
    display: grid;
    padding: 10px 16px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > textarea[data-email-compose-body] {
    height: 160px !important;
    min-height: 145px !important;
    max-height: 40vh !important;
  }
}

/* V118: full-composer lead contacts reserve space and keep complete, scrollable hit areas. */
.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
  box-sizing: border-box;
  height: auto !important;
  min-height: 300px !important;
  max-height: min(42vh, 420px) !important;
  align-self: start;
  align-content: start;
  grid-auto-rows: minmax(66px, auto);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact {
  min-height: 66px;
  padding: 10px 12px;
  overflow: visible;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact > div {
  min-width: 0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact strong,
.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact small {
  display: block;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy {
  min-height: 42px;
  align-items: center;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy input,
.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy .btn {
  height: auto !important;
  min-height: 42px !important;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
    height: auto !important;
    min-height: 260px !important;
    max-height: 48vh !important;
    grid-auto-rows: auto;
    scrollbar-gutter: auto;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact {
    min-height: 0;
  }
}

/* V122 Mail: correct any record match from the reader and make forwarding explicit. */
.email-match-action {
  border-color: #8dc6d8 !important;
  background: #eef9fc !important;
  color: #0f617c !important;
}

.email-reader-main > .email-match-panel {
  display: block;
  padding: 0;
  overflow: hidden;
}

.email-match-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.email-match-panel > summary::-webkit-details-marker { display: none; }
.email-match-panel > summary > span { display: grid; gap: 3px; }
.email-match-panel > summary strong { color: #173652; }
.email-match-panel > summary small { color: #61758a; font-size: .76rem; }
.email-match-panel > summary > b { color: #0d7896; font-size: .76rem; white-space: nowrap; }
.email-match-panel[open] > summary { border-bottom: 1px solid #cfe0ed; background: #eaf6fa; }
.email-match-panel-body { display: grid; gap: 13px; padding: 15px; }

.email-current-match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 12px;
  padding: 12px 14px;
  border: 1px solid #c7ddce;
  border-radius: 7px;
  background: #f2faf4;
}

.email-current-match > span { color: #607367; font-size: .7rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.email-current-match > strong { overflow-wrap: anywhere; color: #185b38; }
.email-current-match > small { grid-column: 1 / -1; color: #617188; }
.email-current-match.is-unmatched { border-color: #efc3b9; background: #fff6f3; }
.email-current-match.is-unmatched > strong { color: #a33d2e; }

.email-record-search { display: grid; gap: 6px; }
.email-record-search > label { color: #243f58; font-size: .78rem; font-weight: 900; }
.email-record-search > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.email-record-search input { min-height: 44px; border-radius: 6px 0 0 6px; }
.email-record-search button { min-height: 44px; border-radius: 0 6px 6px 0; }
.email-record-search small { color: #687a8e; }

.email-forward-send-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid #efc66f;
  border-left: 5px solid #e2a72e;
  border-radius: 8px;
  background: #fff8e8;
  color: #493714;
}

.email-forward-send-guide > span { font-size: 1.35rem; }
.email-forward-send-guide p { margin: 3px 0 0; color: #6a5525; font-size: .82rem; line-height: 1.45; }
.email-required { margin-left: 6px; color: #a73728; font-size: .66rem; font-weight: 900; text-transform: uppercase; }
.email-compose-to > small { display: block; margin-top: 4px; color: #8b4e23; font-weight: 750; }
.email-large-link-control { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #dfe8ef; }
.email-large-link-control label { color: #243f58; font-weight: 850; }
.email-large-link-control textarea { min-height: 82px; resize: vertical; }
.email-large-link-control small { color: #64748b; }

@media (max-width: 760px) {
  .email-match-panel > summary,
  .email-record-search > div,
  .email-current-match { grid-template-columns: 1fr; }
  .email-match-panel > summary { align-items: flex-start; }
  .email-record-search input,
  .email-record-search button { border-radius: 6px; }
}

/* V123 Mail composer: clear recipient flow, visible contact actions, and stable geometry. */
.email-compose-drawer[open]:not(.is-inline-reply) {
  --composer-label-width: 86px;
  border-radius: 14px !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-toggle {
  min-height: 60px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #eef6fc 0%, #f8fbfe 100%);
}

.email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-toggle span {
  color: #102f4b;
  font-size: 1.05rem;
}

.email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content {
  gap: 12px;
  padding: 14px 20px 20px;
  background: #f7fafc;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-lead-picker {
  gap: 10px;
  padding: 12px !important;
  border-color: #cad9e6 !important;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 47, 75, .06);
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-lead-picker label {
  color: #1f3d59;
  font-size: .76rem;
  font-weight: 900;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
  height: auto !important;
  min-height: 0 !important;
  max-height: min(34vh, 300px) !important;
  padding: 12px;
  gap: 8px;
  border-color: #cbdce9;
  border-left-width: 5px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 47, 75, .06);
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory-head {
  position: sticky;
  z-index: 2;
  top: -12px;
  margin: -12px -12px 2px;
  padding: 12px;
  border-bottom: 1px solid #e0e9f0;
  background: #fff;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory-head h3 {
  font-size: 1rem;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory-head p:not(.eyebrow) {
  font-size: .75rem;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact {
  grid-template-columns: minmax(210px, .8fr) minmax(420px, 1.4fr);
  min-height: 58px;
  padding: 9px 11px;
  border-radius: 9px;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  min-height: 38px;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy input,
.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy .btn {
  min-height: 38px !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy .recipient-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  border-color: #0d7896;
  background: #0d7896;
  color: #fff;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy .recipient-use:hover {
  border-color: #075d76;
  background: #075d76;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact.is-selected {
  border-color: #31a67b;
  background: #effbf5;
  box-shadow: inset 4px 0 #1b976d;
}

.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact.is-selected .recipient-use {
  border-color: #b8dbc9;
  background: #dff4e9;
  color: #156444;
}

.email-forward-send-guide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.email-forward-guide-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #6e501d;
  font-size: .72rem;
}

.email-forward-guide-title strong {
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff0c8;
  color: #765112;
  font-size: .63rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.email-forward-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d6e2eb;
  border-radius: 9px;
  background: #fff;
  color: #3e5367;
}

.email-forward-step > b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #e6edf3;
  color: #496174;
  font-size: .78rem;
}

.email-forward-step > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.email-forward-step strong {
  color: #183650;
  font-size: .78rem;
}

.email-forward-step small {
  color: #687a8d;
  font-size: .68rem;
  line-height: 1.35;
}

.email-forward-step.is-current {
  border-color: #7fc0d1;
  background: #eef9fc;
}

.email-forward-step.is-current > b {
  background: #0d7896;
  color: #fff;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-composer-shell {
  overflow: hidden !important;
  border-color: #c7d8e5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(16, 47, 75, .07);
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 0;
  padding: 0;
  background: #fff;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-from,
.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-to {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: var(--composer-label-width) minmax(0, 1fr) !important;
  align-items: center;
  gap: 3px 12px;
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-from {
  grid-template-areas:
    "label sender"
    ". help";
  border-bottom: 1px solid #e4eaf0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-to {
  grid-template-areas:
    "label field"
    ". help";
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-to > label {
  grid-area: label;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #31475c;
  font-weight: 850;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-to > input {
  grid-area: field;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #9fc1d2 !important;
  border-radius: 8px !important;
  background: #fbfdff !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-to > input:focus {
  outline: 3px solid rgba(247, 181, 51, .28);
  border-color: #d99a16 !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-to > small {
  grid-area: help;
  display: block;
  margin: 0;
  padding-top: 2px;
  color: #73552a;
  font-size: .7rem;
  font-weight: 750;
  line-height: 1.35;
}

.email-required {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  margin: 0;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff0ed;
  color: #9f3327;
  font-size: .58rem;
  line-height: 1;
  white-space: nowrap;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-from-help {
  padding: 1px 0 0;
}

.email-compose-subject {
  min-height: 50px;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message {
  padding: 13px 14px 15px;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message > label::before {
  content: "Step 2 · ";
  color: #0d7896;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager {
  overflow: hidden !important;
  border-color: #c7d8e5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(16, 47, 75, .06);
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager > summary span::before {
  content: "Step 3 · ";
  color: #0d7896;
}

.email-send-dock {
  position: sticky;
  z-index: 6;
  bottom: -1px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 14px;
  border: 1px solid #c6d8e5;
  border-radius: 10px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 24px rgba(16, 47, 75, .12);
  backdrop-filter: blur(8px);
}

.email-send-dock > span {
  display: grid;
  gap: 2px;
}

.email-send-dock > span strong {
  color: #193950;
  font-size: .8rem;
}

.email-send-dock > span small {
  color: #687a8d;
  font-size: .68rem;
}

.email-send-dock .email-send-progress {
  grid-column: 1 / -1;
}

.email-send-dock > [data-email-send-button] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  min-height: 48px;
  padding: 10px 22px;
  border: 0;
  border-radius: 9px;
  background: #0d7896;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(13, 120, 150, .24);
}

.email-send-dock > [data-email-send-button]:hover {
  background: #075d76;
}

.email-send-dock > [data-email-send-button]:disabled {
  background: #9fb4c4;
  color: #edf3f7;
  box-shadow: none;
}

.email-send-dock > [data-email-send-button]::after {
  content: "→";
  margin-left: 10px;
  font-size: 1rem;
}

@media (max-width: 980px) {
  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-contact {
    grid-template-columns: 1fr;
  }

  .email-forward-send-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .email-compose-drawer[open]:not(.is-inline-reply) {
    --composer-label-width: 68px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content {
    padding: 9px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
    max-height: 42vh !important;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy {
    grid-template-columns: minmax(0, 1fr) 1fr;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-copy input {
    grid-column: 1 / -1;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-from,
  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-to {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "label"
      "sender"
      "help";
    padding: 10px;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-routing > .email-compose-to {
    grid-template-areas:
      "label"
      "field"
      "help";
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-compose-from-help {
    grid-area: help;
  }

  .email-send-dock {
    grid-template-columns: 1fr;
  }

  .email-send-dock > [data-email-send-button] {
    width: 100%;
  }
}

/* V124 Mail composer: keep the recipient directory from collapsing as the
   message, AI helper, or attachment sections grow inside the scroll column. */
.email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
  flex: 0 0 auto;
  flex-shrink: 0 !important;
  align-self: stretch;
  width: 100%;
  min-height: clamp(230px, 27vh, 300px) !important;
  max-height: min(38vh, 360px) !important;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

@media (max-width: 760px) {
  .email-compose-drawer[open]:not(.is-inline-reply) .lead-email-directory {
    flex: 0 0 auto;
    flex-shrink: 0 !important;
    min-height: clamp(220px, 40vh, 280px) !important;
    max-height: 48vh !important;
    scrollbar-gutter: auto;
  }
}

/* V125 Mail forwarding: long URLs and security-banner text inside a forwarded
   message must never widen the composer or push its send action off-screen. */
.email-compose-drawer[open]:not(.is-inline-reply) > .email-compose-content,
.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form,
.email-compose-drawer[open]:not(.is-inline-reply) .email-composer-shell,
.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-message,
.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source,
.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body,
.email-compose-drawer[open]:not(.is-inline-reply) .email-attachment-manager,
.email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-compose-form {
  overflow-x: clip;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source,
.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body,
.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body :where(a, p, div, span, td, th, pre, code) {
  overflow-wrap: anywhere !important;
  word-break: break-word;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body pre,
.email-compose-drawer[open]:not(.is-inline-reply) .email-forward-source-body code {
  max-width: 100%;
  white-space: pre-wrap;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock {
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  inset-inline: 0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock > span {
  min-width: 0;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock > [data-email-send-button] {
  position: sticky !important;
  right: 0;
  flex: 0 0 auto !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.email-compose-drawer[open]:not(.is-inline-reply) .email-send-progress.is-error {
  border-color: #f1a69d;
  background: #fff1f0;
  color: #9f2f24;
}

@media (max-width: 760px) {
  .email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock {
    grid-template-columns: 1fr;
  }

  .email-compose-drawer[open]:not(.is-inline-reply) .email-send-dock > [data-email-send-button] {
    width: 100% !important;
  }
}

/* V136 Mail state controls: real persistent stars, reversible read state, and
   a denser 12-message page without using the old decorative fake star. */
.email-mailbox-starred::before { content: "\2605"; }
.email-row-select::after { display: none !important; content: none !important; }
body[data-route="email-center"] .email-log-row {
  grid-template-columns: 44px 44px minmax(0, 1fr) !important;
}
.email-row-select { grid-column: 1; }
.email-row-star-form {
  grid-column: 2;
  display: grid;
  min-width: 0;
  margin: 0;
  place-items: center;
  background: transparent;
}
.email-log-row .email-log-card { grid-column: 3; }
.email-row-star {
  display: grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8290a3;
  font-size: 1.28rem;
  line-height: 1;
  box-shadow: none;
}
.email-row-star:hover,
.email-row-star:focus-visible { background: #eef3f8; color: #53657a; }
.email-row-star.is-starred,
.email-row-star.is-starred:hover,
.email-row-star.is-starred:focus-visible { color: #d68a00; background: #fff6d9; }
.email-row-star:disabled { cursor: wait; opacity: .58; }
.email-row-starred { box-shadow: inset 3px 0 0 #e5a719; }
.email-reader-star.is-starred {
  border-color: #edc964;
  background: #fff7da;
  color: #805900;
}
.email-reader-action > b { font: inherit; }
.email-bulk-state-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.email-bulk-state-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #c9d7e4;
  border-radius: 5px;
  background: #f4f8fb;
  color: #183550;
  font-size: .69rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(18, 43, 72, .05);
}
.email-bulk-state-action:hover,
.email-bulk-state-action:focus-visible {
  border-color: #78a9c5;
  background: #e8f4fb;
  color: #075f89;
}
.email-bulk-state-action.is-primary {
  border-color: #70b6d6;
  background: #e3f4fc;
  color: #075f89;
}
.email-bulk-state-action:disabled {
  opacity: .42;
  cursor: not-allowed;
  box-shadow: none;
}
.email-bulk-state-status {
  min-width: 0;
  color: #33708c;
  font-size: .67rem;
  font-weight: 800;
}

@media (max-width: 760px) {
  .email-mailbox-nav { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  body[data-route="email-center"] .email-log-row {
    grid-template-columns: 38px 44px minmax(0, 1fr) !important;
  }
  .email-row-star { width: 40px; min-width: 40px; height: 44px; min-height: 44px !important; }
  .email-bulk-state-actions { order: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .email-bulk-state-action { width: 100%; min-height: 44px; padding-inline: 11px; }
  .email-bulk-state-status { order: 4; width: 100%; }
}
