.crm-app .sector-kpis { container: sector-kpis / inline-size; }
.crm-app .sector-kpis .kpi .kpi-money {
  font-size: clamp(15px, 1.4vw, 25px);
  font-size: clamp(15px, 2.8cqi, 25px);
}
.kpi-money bdi { display: block; white-space: nowrap; }

.crm-app .column-head { white-space: normal; }
.crm-app .column-head b { min-width: 0; overflow-wrap: anywhere; }
.crm-app .column-head span { flex: none; }

[data-email-estimates] .sales-draft-tool-content { grid-template-columns: minmax(0, 1fr); }
[data-email-estimates] .data-table td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
}
[data-email-estimates] .data-table td small { display: block; color: var(--muted); }

@container sector-kpis (max-width: 550px) {
  .crm-app .sector-kpis .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 690px) {
  .crm-app .sector-kpis .kpi .kpi-money { font-size: clamp(14px, 4.35vw, 24px); }
  .crm-app .kanban:is(.compact, .one-stage, .five-stages), .crm-app .module-grid .kanban {
    grid-template-columns: minmax(0, 1fr);
    overflow-x: visible;
  }
  .crm-app .kanban-column { min-height: 0; }
  .crm-app .column-empty { padding-block: 6px; }
  .crm-app .column-total { white-space: normal; }
  .crm-app [data-email-estimates] .sales-draft-tool { padding-inline: 8px; }
  .crm-app :is([data-email-estimates] .data-table, .agent-review-heading ~ .data-table) table {
    table-layout: fixed;
    white-space: normal;
  }
  .crm-app :is([data-email-estimates] .data-table, .agent-review-heading ~ .data-table) :is(th, td) {
    padding-inline: 4px;
    overflow-wrap: anywhere;
  }
  .crm-app :is([data-email-estimates] .data-table, .agent-review-heading ~ .data-table) th:first-child { width: 42%; }
}

.crm-app > .crm-sidebar-backdrop,
.crm-app #crm-sidebar > .crm-sidebar-close {
  display: none;
}

@media (max-width: 690px) {
  .crm-app.mobile-open > .crm-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 81;
    background: rgb(20 35 67 / 24%);
    touch-action: none;
  }

  .crm-app.mobile-open > #crm-sidebar {
    z-index: 82;
    overscroll-behavior: contain;
  }

  .crm-app.mobile-open #crm-sidebar > .crm-sidebar-close {
    display: grid;
    position: absolute;
    inset-block-start: 10px;
    inset-inline-end: 10px;
    width: 44px;
    height: 44px;
    color: inherit;
    touch-action: manipulation;
  }

  .crm-app.mobile-open #crm-sidebar > .crm-sidebar-close:is(:hover, :focus-visible) {
    background: rgb(124 151 196 / 18%);
  }
}

.crm-app .industry-priority-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding-block: 10px;
}

.crm-app .industry-priority-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crm-app :is(.deal, .records) .sales-deal-title:has(.deal-probability) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.crm-app .deal-probability {
  display: inline-block;
  vertical-align: 0.08em;
  margin-inline-start: 0.28em;
  padding: 0.12em 0.45em;
  border-radius: 0.4em;
  font-size: 0.78em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
}

.crm-app .deal-probability[data-tone="hot"] { background: #fce6e5; color: #912b2c; }
.crm-app .deal-probability[data-tone="warm"] { background: #fff1cf; color: #764600; }
.crm-app .deal-probability[data-tone="cold"] { background: #e5efff; color: #224b84; }

@media (max-width: 690px) {
  .crm-app .industry-priority-row {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .crm-app .industry-priority-row .button {
    min-height: 44px;
  }
}

.crm-approval-list {
  display: grid;
  gap: 10px;
}
.crm-approval-card, .crm-approval-mail {
  padding: 14px;
  min-width: 0;
  border: 1px solid var(--subtle, #e2e8f2);
  border-radius: 13px;
  background: #fff;
}
.crm-approval-card > header, .crm-approval-heading, .crm-approval-mail > summary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: space-between;
}
.crm-approval-card h3, .crm-approval-heading h3, .crm-approval-mail > summary > strong {
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--ink, #152340);
}
.crm-approval-heading > div, .crm-approval-card h3, .crm-approval-mail > summary > strong {
  flex: 1 1 210px;
  min-width: 0;
}
.crm-approval-role {
  color: var(--muted, #52627b);
  font-size: 12px;
  margin: 5px 0;
}
.crm-approval-next {
  margin: 8px 0 12px;
  color: #31476a;
  overflow-wrap: anywhere;
}
.crm-approval-state {
  border-radius: 999px;
  padding: 4px 8px;
  display: inline-block;
  color: #405475;
  background: #edf2f9;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 690;
  white-space: nowrap;
}
.crm-approval-state[data-state="ready"] { background: #e6f0ff; color: #174582; }
.crm-approval-state[data-state="paused"] { background: #fff0cc; color: #744a00; }
.crm-approval-state[data-state="rejected"] { background: #fee9e8; color: #932822; }
.crm-approval-state:is([data-state="approved"], [data-state="sent"]) { background: #e4f5ec; color: #16613b; }
.crm-approval-card .crm-approval-review { margin-top: 6px; }
.crm-approval-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
}
.crm-approval-actions:empty { display: none; }
.crm-approval-actions .button, .crm-approval-review {
  min-height: 44px;
  white-space: normal;
}
.crm-approval-confirm, .crm-approval-send-review { min-width: 0; }
.crm-approval-confirm[open], .crm-approval-send-review { flex: 1 1 100%; }
.crm-approval-confirm > summary { list-style: none; }
.crm-approval-confirm > summary::-webkit-details-marker { display: none; }
.crm-approval-confirm > div, .crm-approval-send-review {
  margin: 8px 0 0;
  padding: 10px;
  background: #f5f8fc;
  border-radius: 10px;
}
.crm-approval-confirm > div p, .crm-approval-send-review p { margin: 0 0 8px; }
.crm-approval-confirm label {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
}
.crm-approval-confirm textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid #ccd8e9;
  border-radius: 8px;
  padding: 8px;
  font: inherit;
}
.crm-approval-confirm .crm-approval-reject { color: #a32f29; }
.crm-approval-mail > summary { cursor: pointer; }
.crm-approval-mail:not([open]) > summary::after { content: "＋"; color: var(--blue-dark); }
.crm-approval-mail[open] > summary::after { content: "−"; color: var(--blue-dark); }
[data-agent-decision-status]:empty, [data-email-decision-status]:empty { display: none; }

@media (max-width: 690px) {
  .crm-approval-card, .crm-approval-mail { padding: 11px; }
  .crm-approval-estimate-lines table, .crm-approval-estimate-lines tbody { display: block; }
  .crm-approval-estimate-lines thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .crm-app .crm-approval-estimate-lines tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--subtle, #e2e8f2);
  }
  .crm-app .crm-approval-estimate-lines tbody td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    overflow-wrap: anywhere;
    text-align: start;
    white-space: normal;
    border: 0;
  }
  .crm-app .crm-approval-estimate-lines tbody td:first-child { grid-column: 1 / -1; }
  .crm-approval-estimate-lines td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    line-height: 1.2;
    color: var(--muted, #52627b);
  }
}

.crm-estimate-notes,
.crm-estimate-coverage {
  min-width: 0;
  margin-block: 16px;
  overflow-wrap: anywhere;
}

.crm-estimate-notes > p {
  margin-block: 6px 0;
  white-space: pre-wrap;
}

.crm-estimate-scope {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #f0d18e;
  border-radius: 8px;
  background: #fff6df;
  color: #684400;
}

.crm-estimate-stages,
.crm-estimate-catalog > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr));
  gap: 8px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.crm-estimate-stage,
.crm-estimate-catalog > ul > li {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--subtle, #e2e8f2);
  border-radius: 8px;
}

.crm-estimate-stage h4,
.crm-estimate-stage-status,
.crm-estimate-stage ul,
.crm-estimate-catalog h4 {
  margin: 0;
}

.crm-estimate-stage ul { padding-inline-start: 1.2em; }
.crm-estimate-catalog { margin-block-start: 12px; }
.crm-estimate-catalog small { color: var(--muted, #52627b); }
.crm-estimate-stage-status[data-status="priced"] { color: #16613b; }
.crm-estimate-stage-status[data-status="partial"],
.crm-estimate-stage-status[data-status="missing"] { color: #744a00; }

.crm-app .crm-quote-lines tbody td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 690px) {
  .crm-app .crm-quote-lines { min-width: 0; }
  .crm-app .crm-quote-lines :is(table, tbody) { display: block; width: 100%; }
  .crm-app .crm-quote-lines thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .crm-app .crm-quote-lines tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--subtle, #e2e8f2);
  }
  .crm-app .crm-quote-lines tbody td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .crm-app .crm-quote-lines tbody td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
  }
  .crm-app .crm-quote-lines td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-block-end: 2px;
    color: var(--muted, #52627b);
    font-size: 11px;
  }
}
