.crm-dense {
  padding: 16px 18px;
  max-width: none;
}
.crm-workspace-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 14px;
  min-height: 40px;
}
.crm-workspace-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.crm-workspace-head h1 {
  font-size: 21px;
  margin: 0;
  color: #192a40;
}
.crm-workspace-head > div:first-child > span {
  font-size: 12px;
  color: #758198;
}
.crm-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.crm-dense button {
  font-size: 12px;
  padding: 7px 11px;
  min-height: 31px;
}
.segmented {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #dce2ec;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.segmented button {
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #5c6b80;
  white-space: nowrap;
}
.segmented button + button {
  border-left: 1px solid #e4e8f0;
}
.segmented button.selected {
  color: #fff;
  background: #1763e8;
}
.segmented.small button {
  padding: 4px 10px;
  min-height: 27px;
}
.ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f6f3ff;
  color: #6145bd;
  border: 1px solid #ded4fa;
  white-space: nowrap;
}
.ai-button:hover {
  background: #eee8ff;
}
.ai-button .icon {
  height: 15px;
  width: 15px;
}
.ai-link,
.ai-mini {
  color: #684cc1 !important;
}
.customer-workspace {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  background: #fff;
  border: 1px solid #e4e8f0;
  border-radius: 7px;
  min-height: 650px;
  overflow: hidden;
}
.customer-groups {
  border-right: 1px solid #e8ecf2;
  padding: 8px 8px 15px;
  background: #fff;
}
.group-heading {
  font-size: 13px;
  font-weight: 650;
  padding: 13px 10px 18px;
}
.group-heading small {
  float: right;
  color: #8892a3;
  font-weight: 400;
  font-size: 11px;
}
.customer-group {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 10px !important;
  min-height: 47px !important;
  background: white;
  border: 0;
  border-radius: 3px;
  color: #556174;
  text-align: left;
  gap: 8px;
}
.customer-group span {
  flex: 1;
  line-height: 1.4;
}
.customer-group b {
  font-size: 11px;
  color: #8c96a5;
  font-weight: 400;
}
.customer-group:hover {
  background: #f8faff;
}
.customer-group.selected {
  background: #edf6ff;
  color: #1763e8;
  font-weight: 600;
}
.customer-group.selected b {
  color: #1763e8;
}
.group-note {
  font-size: 11px;
  line-height: 1.8;
  color: #8994a5;
  padding: 18px 10px;
  margin-top: 25px;
  border-top: 1px solid #eef1f6;
}
.customer-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.crm-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border-bottom: 1px solid #e8ecf2;
  margin: 0;
}
.crm-filterbar b {
  font-size: 13px;
  margin-right: auto;
  white-space: nowrap;
}
.crm-filterbar b small {
  font-size: 12px;
  color: #768297;
  font-weight: 400;
  margin-left: 7px;
}
.crm-filterbar input,
.crm-filterbar select {
  min-height: 32px !important;
  padding: 6px 9px !important;
  border: 1px solid #dfe4ed !important;
  border-radius: 4px !important;
  font-size: 12px;
  width: auto;
  background: #fff;
  max-width: 200px;
}
.crm-filterbar input[name="q"] {
  width: 180px;
}
.crm-selection {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 40px;
  padding: 4px 15px;
  font-size: 11px;
  border-bottom: 1px solid #f0f2f6;
}
.crm-selection > .muted {
  margin-left: auto;
  font-size: 11px;
}
.crm-selection .link {
  padding: 2px 0;
  min-height: 25px;
}
.crm-table-scroll {
  overflow: auto;
  min-width: 0;
}
.customer-grid-table {
  min-width: 1120px;
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.customer-grid-table th {
  background: #f7f8fb;
  color: #556174;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  height: 44px;
}
.customer-grid-table th,
.customer-grid-table td {
  padding: 9px 11px;
  border-bottom: 1px solid #ecf0f6;
  border-right: 1px solid #f2f4f8;
  vertical-align: middle;
}
.customer-grid-table th:first-child {
  width: 36px;
}
.customer-grid-table th:nth-child(2) {
  width: 155px;
}
.customer-grid-table th:nth-child(3) {
  width: 180px;
}
.customer-grid-table th:nth-child(4) {
  width: 155px;
}
.customer-grid-table th:nth-child(5) {
  width: 125px;
}
.customer-grid-table th:nth-child(6) {
  width: 210px;
}
.customer-grid-table th:nth-child(7) {
  width: 100px;
}
.customer-grid-table th:nth-child(8) {
  width: 110px;
}
.customer-grid-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 0;
  accent-color: #1763e8;
}
.customer-grid-table tbody tr {
  height: 62px;
}
.customer-grid-table tbody tr:hover {
  background: #f8fbff;
}
.customer-grid-table small,
.deal-list-table small {
  display: block;
  font-size: 11px;
  color: #8a94a3;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-grid-table td > b {
  display: block;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.company-link {
  color: #1763e8;
  background: none;
  border: 0;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  padding: 0 !important;
  line-height: 1.5;
  min-height: 0 !important;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  white-space: nowrap;
}
.company-link:hover {
  text-decoration: underline;
}
.customer-tag {
  display: inline-block;
  border: 1px solid #e5d8ff;
  background: #f4efff;
  color: #8160b6;
  border-radius: 2px;
  font-size: 10px;
  padding: 2px 4px;
  line-height: 1.4;
  margin: 2px 4px 2px 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}
.level-badge {
  font-size: 10px;
  border-radius: 2px;
  background: #25a5be;
  color: white;
  padding: 2px 4px;
  margin: 2px 5px 2px 0;
  display: inline-block;
}
.level-badge.L3 {
  background: #1763e8;
}
.level-badge.L4 {
  background: #7852c9;
}
.activity-cell > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  color: #647086;
  line-height: 1.6;
}
.row-actions {
  white-space: nowrap;
}
.row-actions .link {
  padding: 2px 5px !important;
  font-size: 11px;
}
.crm-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 15px;
  margin-top: auto;
  font-size: 12px;
  color: #6d7a8c;
  border-top: 1px solid #ebeff5;
}
.crm-pagination select {
  width: auto;
  min-height: 31px;
  padding: 3px 6px;
  font-size: 12px;
}
.crm-pagination b {
  font-weight: 500;
}
.opportunity-workspace {
  background: #fff;
  border: 1px solid #e3e8f1;
  border-radius: 7px;
  overflow: hidden;
}
.opportunity-workspace .crm-filterbar input[name="q"] {
  max-width: 160px;
}
.compact-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #7a8697;
}
.compact-date input {
  max-width: 133px;
}
.crm-ai-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  background: #f7f4ff;
  color: #6957a5;
  font-size: 12px;
  margin: 10px 14px;
  border-radius: 4px;
}
.crm-ai-strip .icon {
  width: 16px;
  height: 16px;
}
.crm-ai-strip small {
  font-size: 11px;
  margin-left: auto;
  color: #8c7da9;
}
.pipeline-summary {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 17px 17px;
  font-size: 12px;
  flex-wrap: wrap;
}
.pipeline-summary b {
  color: #1763e8;
  font-size: 13px;
  margin-left: 5px;
  font-weight: 600;
}
.pipeline-summary .segmented {
  margin-left: auto;
}
.pipeline-summary .overdue {
  color: #c34a44;
}
.opportunity-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 239px;
  overflow: auto;
  gap: 5px;
  background: #f0f2f5;
  padding: 0 7px 12px;
  max-height: calc(100dvh - 305px);
  min-height: 430px;
  align-items: start;
}
.pipeline-column {
  min-width: 0;
}
.pipeline-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #41bd84;
  color: white;
  height: 36px;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
}
.pipeline-stage.won {
  background: #1763e8;
}
.pipeline-stage.lost {
  background: #8b96a6;
}
.pipeline-stage span {
  font-size: 11px;
  opacity: 0.95;
}
.stage-amount {
  text-align: center;
  color: #778599;
  background: #fff;
  font-size: 11px;
  height: 26px;
  padding-top: 6px;
  margin-bottom: 8px;
}
.stage-cards {
  display: grid;
  gap: 8px;
  padding: 0 2px;
}
.opportunity-card {
  border: 1px solid #e2e7ef;
  border-radius: 5px;
  background: #fff;
  padding: 11px 11px 0;
  box-shadow: 0 1px 2px #182f4910;
}
.opportunity-title {
  display: flex;
  gap: 5px;
  align-items: start;
}
.opportunity-title > .company-link {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex: 1;
  line-height: 1.6;
}
.ai-mini {
  border: 1px solid #e4dcfa !important;
  background: #faf7ff !important;
  padding: 2px 4px !important;
  min-height: 22px !important;
  font-size: 10px !important;
  border-radius: 3px;
  flex-shrink: 0;
}
.card-amount {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #67748b;
  margin: 8px 0;
}
.card-amount small {
  font-size: 10px;
  color: #9ba4b0;
  margin-left: 5px;
}
.card-customer {
  font-size: 12px;
  padding: 0 !important;
  min-height: 20px !important;
  text-align: left;
}
.opportunity-card dl {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 6px 3px;
  font-size: 11px;
  color: #7b8799;
  margin: 11px 0;
}
.opportunity-card dt {
  font-weight: 400;
}
.opportunity-card dd {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #59677c;
}
.card-next {
  font-size: 11px;
  color: #536278;
  line-height: 1.7;
  margin: 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags {
  min-height: 28px;
}
.attention-tag,
.success-tag {
  font-size: 10px;
  border: 1px solid #f2d6b2;
  border-radius: 2px;
  padding: 2px 4px;
  color: #b88139;
  background: #fff8ee;
}
.success-tag {
  color: #269a6c;
  background: #eefbf6;
  border-color: #c5eddc;
}
.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  border-top: 1px solid #eef1f6;
  margin-top: 5px;
  padding: 6px 0;
}
.card-footer .link {
  font-size: 10px;
  padding: 3px 0 !important;
  min-height: 23px !important;
}
.empty-stage {
  text-align: center;
  color: #a3adba;
  font-size: 11px;
  padding: 35px 0;
}
.deal-list-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}
.deal-list-table th {
  background: #f7f8fb;
  font-size: 12px;
  text-align: left;
  color: #627187;
}
.deal-list-table td,
.deal-list-table th {
  padding: 12px;
  border-bottom: 1px solid #edf1f6;
  font-size: 12px;
}
.deal-list-table td .link {
  font-size: 11px;
  padding: 3px;
}
.context-ai-drawer {
  position: fixed;
  margin: 0 0 0 auto;
  padding: 0;
  height: 100dvh;
  max-height: 100dvh;
  width: 470px;
  max-width: 100vw;
  inset: 0 0 0 auto;
  border: 0;
  border-left: 1px solid #e5e0f3;
  box-shadow: -10px 0 40px #26385924;
  background: #fff;
  color: #253549;
  overflow: hidden;
}
.context-ai-drawer[open] {
  display: flex;
  flex-direction: column;
}
.context-ai-drawer::backdrop {
  background: #1c2c431f;
}
.context-ai-drawer > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eeeaf6;
}
.context-ai-drawer > header > div {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #6b4abd;
}
.context-ai-drawer h2 {
  font-size: 18px;
  margin: 0;
}
.context-ai-drawer > header button {
  border: 0;
  background: none;
  padding: 4px;
}
.ai-drawer-content {
  padding: 18px 20px;
  overflow: auto;
  flex: 1;
}
.ai-scope-note {
  font-size: 12px;
  line-height: 1.8;
  color: #798597;
  background: #f6f7fb;
  padding: 10px;
  border-radius: 5px;
  margin: 0 0 14px;
}
.ai-prompt-options {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}
.ai-prompt-options button {
  font-size: 11px;
  padding: 7px 9px;
  color: #6f51b1;
  border: 1px solid #e7def6;
  background: #faf7ff;
}
.ai-question-label {
  display: block;
  font-size: 12px;
  color: #6d7b90;
}
.ai-question-label textarea {
  width: 100%;
  resize: vertical;
  font-size: 13px;
  margin: 8px 0 12px;
  line-height: 1.7;
  padding: 10px;
  min-height: 80px;
}
.ai-context-draft {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.9;
  margin: 12px 0;
  color: #35425b;
}
.ai-mode {
  font-size: 11px;
  margin: 20px 0 8px;
  padding: 7px 10px;
  border-radius: 4px;
  background: #f4effc;
  color: #7958b7;
}
.ai-mode.rules {
  background: #fff7e9;
  color: #9c752f;
}
.ai-drawer-content details {
  border-top: 1px solid #eceff4;
  margin-top: 20px;
  padding-top: 12px;
  font-size: 12px;
  color: #758298;
}
.ai-drawer-content details p {
  margin: 12px 0;
}
.ai-drawer-content details small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.context-ai-drawer > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #e9edf3;
  padding: 14px 18px;
  background: #fff;
}
.context-ai-drawer > footer span {
  font-size: 10px;
  line-height: 1.6;
  color: #929cac;
}
.context-ai-drawer > footer button {
  font-size: 12px;
  white-space: nowrap;
}
.attention-text {
  font-size: 12px;
  color: #aa7732;
}
.ai-loading {
  padding: 30px 0;
  font-size: 13px;
  color: #7b64ab;
}
@media (max-width: 1200px) {
  .crm-workspace-head > div:first-child > span {
    display: none;
  }
  .customer-workspace {
    grid-template-columns: 175px minmax(0, 1fr);
  }
  .crm-head-actions {
    gap: 5px;
  }
  .crm-filterbar {
    padding: 10px;
  }
  .crm-ai-strip small {
    display: none;
  }
  .crm-selection > .muted {
    display: none;
  }
  .opportunity-board {
    grid-auto-columns: 224px;
  }
  .pipeline-summary {
    gap: 12px;
  }
  .crm-dense {
    padding: 14px;
  }
}
@media (max-width: 760px) {
  .crm-workspace-head {
    flex-wrap: wrap;
    gap: 9px;
  }
  .crm-workspace-head h1 {
    font-size: 19px;
  }
  .crm-head-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
  .customer-workspace {
    grid-template-columns: minmax(0, 1fr);
    min-height: 550px;
  }
  .customer-groups {
    display: flex;
    gap: 5px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid #e6ebf3;
    padding: 8px;
  }
  .group-heading,
  .group-note {
    display: none;
  }
  .customer-group {
    flex: 0 0 auto;
    width: auto;
    min-height: 32px !important;
    padding: 7px 9px !important;
    font-size: 11px;
    gap: 8px;
    white-space: nowrap;
  }
  .crm-selection {
    gap: 8px;
  }
  .crm-pagination {
    gap: 7px;
    font-size: 11px;
  }
  .crm-filterbar {
    gap: 6px;
  }
  .crm-filterbar input[name="q"] {
    width: 150px;
  }
  .crm-filterbar b {
    width: 100%;
  }
  .opportunity-board {
    grid-auto-columns: 232px;
    max-height: none;
    min-height: 450px;
  }
  .pipeline-summary .segmented {
    margin-left: 0;
  }
  .pipeline-summary {
    font-size: 11px;
    padding: 10px;
  }
  .pipeline-summary b {
    font-size: 12px;
  }
  .crm-dense {
    padding: 10px;
  }
  .compact-date input {
    max-width: 125px;
  }
  .crm-ai-strip {
    margin: 8px;
    padding: 9px;
    font-size: 11px;
  }
  .context-ai-drawer {
    width: 100vw;
  }
  .ai-drawer-content {
    padding: 16px;
  }
  .crm-pagination select {
    max-width: 90px;
  }
}
/* Searchable selects wrap native selects; constrain wrappers inside compact filters. */
.crm-filterbar .jw-select {
  width: 120px;
  min-width: 110px;
  flex: 0 0 120px;
  max-width: 170px;
  display: inline-block;
}
.crm-filterbar .jw-select-trigger {
  min-height: 32px;
  height: 32px;
  font-size: 12px;
  padding: 5px 9px;
}
.crm-filterbar .compact-date {
  margin: 0;
}
.customer-grid-table th:last-child,
.customer-grid-table td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -3px 0 7px #2337530a;
  z-index: 1;
}
.customer-grid-table th:last-child {
  background: #f7f8fb;
  z-index: 2;
}
.crm-dense .notice {
  font-size: 11px;
  padding: 9px 14px;
  margin-bottom: 12px;
}
@media (max-width: 760px) {
  .crm-filterbar .jw-select {
    width: 110px;
    flex-basis: 110px;
    min-width: 100px;
  }
  .customer-grid-table td:last-child,
  .customer-grid-table th:last-child {
    width: 105px;
  }
}
.customer-grid-table th:nth-last-child(2),
.customer-grid-table td:nth-last-child(2) {
  position: sticky;
  right: 110px;
  background: #fff;
  z-index: 1;
  box-shadow: -3px 0 7px #23375308;
}
.customer-grid-table th:nth-last-child(2) {
  background: #f7f8fb;
  z-index: 2;
}
@media (min-width: 761px) {
  .customer-main > .crm-table-scroll {
    height: calc(100dvh - 370px);
    max-height: calc(100dvh - 370px);
    min-height: 330px;
  }
  .customer-grid-table th {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .customer-grid-table th:last-child,
  .customer-grid-table th:nth-last-child(2) {
    z-index: 3;
  }
  .opportunity-board {
    height: calc(100dvh - 385px);
    max-height: calc(100dvh - 385px);
    min-height: 380px;
  }
}
.crm-pagination .jw-select {
  width: 110px;
  min-width: 110px;
  flex: 0 0 110px;
  margin-left: 4px;
}
.crm-pagination button,
.crm-pagination b,
.crm-pagination > span {
  white-space: nowrap;
  flex-shrink: 0;
}
