/* Shared ERP density; scoped to the authenticated CRM, never public proposals. */
.crm-erp .topbar {
  height: 64px;
  padding-inline: 16px;
}
.crm-erp .workspace-footer {
  display: none;
}
.crm-erp main#content {
  max-width: none;
  min-height: 0;
  padding: 10px 16px 12px;
}
.erp-page {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
}
.erp-page > * {
  flex-shrink: 0;
}
.erp-page .erp-scroll-body {
  min-height: 240px;
  max-height: 65dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
.erp-page .erp-scroll-body:focus-visible {
  outline: 2px solid rgb(var(--acid));
  outline-offset: 2px;
}
.erp-page .btn,
.crm-erp .record-drawer .btn {
  min-height: 34px;
  padding: 6px 12px;
  gap: 6px;
  font-size: 11px;
}
.erp-page .btn .icon {
  width: 15px;
  height: 15px;
}
.erp-page .circle {
  width: 32px;
  height: 32px;
}
.erp-page .filter-panel {
  margin: 0 0 8px;
  padding: 0 0 6px;
}
.erp-page .filter-primary {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.erp-page .filter-primary > .inline-search {
  min-width: 160px;
}
.crm-erp .erp-page .filter-primary .inline-search input[type='search'] {
  min-height: 34px;
  height: 34px;
  padding: 6px 10px 6px 32px;
  font-size: 11px;
  border-radius: 11px;
}
.erp-page .filter-secondary {
  margin-top: 6px;
  font-size: 10px;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.erp-page .filter-secondary > .text-link {
  margin-left: auto;
}
.erp-page .filter-secondary .quick-filters {
  margin: 0;
}
.erp-page .filter-secondary .small {
  font-size: 10px;
}
.erp-page .quick-filters {
  gap: 4px;
  margin-top: 6px;
}
.erp-page .quick-filters .badge {
  padding: 4px 8px;
  font-size: 10px;
}
.erp-page nav.quick-filters {
  max-height: 68px;
  overflow-y: auto;
}
.erp-page .filter-options {
  gap: 10px 12px;
  padding: 10px 0;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.erp-page .filter-options .field > span {
  font-size: 10px;
  margin-bottom: 4px;
}
.erp-page .filter-options .app-select-control {
  min-height: 36px;
  padding-block: 6px;
  font-size: 11px;
  border-radius: 11px;
}
.erp-page .filter-options .app-select,
.erp-page .filter-options .app-date-field {
  margin-top: 0;
}
.erp-page .filter-options .app-date-field {
  grid-template-columns: minmax(0, 1fr) 36px;
}
.erp-page .filter-options .field input.app-date-input {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 11px 0 0 11px;
}
.erp-page .filter-options .app-date-toggle {
  min-height: 36px;
  height: 36px;
  width: 36px;
  border-radius: 0 11px 11px 0;
}
.erp-page .lead-lists,
.erp-page .list-toolbar {
  margin: 6px 0;
}
.erp-page .segmented {
  width: fit-content;
  border-radius: 10px;
  padding: 2px;
}
.erp-page .segmented a {
  border-radius: 8px;
  min-height: 30px;
  padding: 5px 10px;
}
.erp-page .segmented .active {
  background: rgb(var(--acid));
  color: white;
}
.erp-page .contact-queues {
  margin: 0;
  padding: 5px 0;
  gap: 4px;
}
.erp-page .contact-queues a {
  padding: 5px 10px;
  min-height: 30px;
  border-radius: 8px;
  font-size: 10px;
  border-color: transparent;
}
.erp-page .contact-queues a.active {
  border-color: rgb(var(--line-soft));
}
.erp-page .erp-viewbar .contact-queues {
  min-width: 0;
}
.erp-page .erp-viewbar > .text-link {
  flex: none;
  font-size: 11px;
}
.erp-page .summary-strip {
  margin: 6px 0 10px;
  border-radius: 0;
  box-shadow: none;
}
.erp-page .summary-strip > div,
.erp-page .summary-strip > a {
  padding: 8px 12px;
  min-height: 62px;
}
.erp-page .summary-strip span {
  font-size: 8px;
  letter-spacing: 0.3px;
}
.erp-page .summary-strip strong {
  margin: 1px 0;
  font-size: 19px;
  line-height: 1.3;
}
.erp-page .summary-strip small {
  font-size: 9px;
}
.erp-page .section-heading {
  margin: 8px 0;
  gap: 12px;
}
.erp-page .section-heading h2 {
  font-size: 13px;
}
.erp-page .section-heading p {
  font-size: 10px;
  line-height: 1.5;
  margin-top: 2px;
}
.erp-page .inline-notice,
.crm-erp .record-drawer .inline-notice {
  margin: 8px 0;
  padding: 9px 12px;
  font-size: 10px;
  line-height: 1.6;
  border-radius: 8px;
}
.erp-data-wrap {
  border: 1px solid rgb(var(--line));
  border-top: 2px solid rgb(var(--contrast));
}
.erp-data-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.erp-data-table th,
.erp-data-table td {
  border-right: 1px solid rgb(var(--line-soft));
  padding: 6px 12px;
  background: white;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.erp-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  color: #54545e;
  background: #f8f8fa;
  font-size: 9px;
}
.erp-data-table td {
  height: 44px;
  font-size: 11px;
}
.erp-data-table th:first-child,
.erp-data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right-color: rgb(var(--line));
  padding-left: 12px;
  min-width: 200px;
}
.erp-data-table th:first-child {
  z-index: 3;
}
.erp-data-table th:last-child,
.erp-data-table td:last-child {
  padding-right: 12px;
}
.erp-data-table tbody tr:nth-child(even) td {
  background: #fafafb;
}
.erp-data-table tbody tr:hover td {
  background: #eff6ff;
}
.erp-data-table .record-link {
  min-height: 30px;
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  text-align: left;
}
.erp-data-table .btn {
  min-height: 32px;
  padding: 5px 10px;
}
.erp-long-text {
  display: block;
  max-width: 260px;
  min-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.erp-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgb(var(--line));
  border-top: 0;
  background: #f8f8fa;
  color: #54545e;
  font-size: 10px;
  margin: 0;
}
.erp-page .empty-state {
  border: 0;
  padding: 32px 20px;
}
.erp-page .empty-state h3 {
  font-size: 14px;
}
.erp-page .empty-state p {
  font-size: 11px;
  margin-bottom: 12px;
}
.erp-page .goals-strip {
  gap: 16px;
  padding: 8px 12px;
  margin: 0 0 8px;
  border-radius: 0;
}
.erp-page .goals-strip h2 {
  font-size: 11px;
}
.erp-page .goals-strip p {
  font-size: 9px;
}
.erp-page .goal-progress {
  min-width: 135px;
  max-width: 240px;
}
.erp-page .goal-progress > div {
  margin-bottom: 4px;
  font-size: 10px;
}
.erp-page .goal-progress strong {
  font-size: 16px;
}
.erp-page .goal-progress progress {
  height: 4px;
}
.erp-page .contact-grid {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}
.erp-page .contact-grid .erp-table-wrap {
  flex: 1;
  min-height: 0;
  max-height: 65dvh;
}
.erp-page .contacts-register th {
  height: 34px;
  padding: 7px 12px;
}
.erp-page .contacts-register td {
  height: 44px;
  padding: 5px 12px;
}
.erp-page .contacts-register .record-link {
  min-height: 32px;
}
.erp-page .table-footer {
  min-height: 40px;
  margin: 0;
  padding: 6px 10px;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid rgb(var(--line));
  border-top: 0;
  background: #f8f8fa;
}
.erp-page .table-footer .btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 10px;
}
.erp-page .table-footer button:disabled {
  cursor: not-allowed;
}
.erp-page .kanban-scroll {
  padding: 0 0 8px;
  border-top: 2px solid rgb(var(--contrast));
}
.erp-page .kanban {
  min-height: 300px;
  gap: 8px;
  padding-top: 8px;
}
.erp-page .kanban-column {
  width: 228px;
  flex-basis: 228px;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.erp-page .kanban-column > header {
  padding: 2px 2px 8px;
  flex: none;
}
.erp-page .kanban-cards {
  min-height: 0;
  overflow-y: auto;
}
.erp-page .deal-card {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  box-shadow: none;
}
.erp-page .deal-card-title {
  margin-block: 6px;
}
.erp-page .deal-card-title strong {
  font-size: 12px;
}
.erp-page .deal-card-title span {
  font-size: 10px;
}
.erp-page .deal-value {
  margin: 8px 0;
}
.erp-page .deal-value strong {
  font-size: 17px;
}
.erp-page .deal-card-footer {
  padding-top: 8px;
}
.erp-page .calendar-toolbar {
  margin: 4px 0 8px;
  gap: 12px;
}
.erp-page .calendar-navigation {
  gap: 8px;
}
.erp-page .calendar-navigation h2 {
  font-size: 14px;
  min-width: 0;
}
.erp-page .calendar-legend {
  gap: 10px;
  margin-bottom: 8px;
  font-size: 9px;
}
.erp-page .calendar-legend > .muted {
  font-size: 9px;
}
.erp-page .calendar-grid {
  height: 100%;
  min-height: 650px;
  grid-template-rows: 28px repeat(6, minmax(100px, 1fr));
}
.erp-page .weekday {
  padding: 7px 4px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f8fa;
}
.erp-page .calendar-cell {
  min-height: 100px;
  padding: 4px;
}
.erp-page .day-number {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
}
.erp-page .calendar-event {
  padding: 3px 5px;
  margin-top: 3px;
  font-size: 9px;
}
.erp-page .calendar-event b {
  font-size: 9px;
}
.erp-page .week-grid {
  grid-template-rows: 28px minmax(0, 1fr);
  min-height: 360px;
}
.erp-page .week-grid .calendar-cell {
  overflow-y: auto;
  min-height: 0;
}
.erp-page .week-grid .calendar-event {
  margin: 5px 0;
  padding: 6px;
}
.erp-page .day-agenda {
  max-width: none;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.erp-settings-body {
  padding: 0 2px;
}
.erp-page .settings-section {
  margin: 0 0 16px;
}
.erp-page .settings-section .register td {
  padding: 9px 12px;
}
.erp-page .settings-section .register th {
  padding: 8px 12px;
}
.erp-page .goal-settings {
  padding: 10px 0;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.erp-page .goal-settings h3 {
  font-size: 12px;
  margin: 0;
}
.erp-page .goal-inputs {
  gap: 10px;
  grid-template-columns: repeat(4, minmax(85px, 1fr)) auto;
}
.erp-page .goal-inputs input {
  min-height: 36px;
  padding: 6px 10px;
}
.erp-page .goal-inputs .field > span {
  font-size: 10px;
}
.erp-page .goal-settings .form-error {
  grid-column: 1/-1;
}
/* Drawers preserve the same fields and safeguards with tighter form rhythm. */
.crm-erp .drawer-header {
  min-height: 74px;
  padding: 14px 20px;
  gap: 12px;
}
.crm-erp .drawer-header h2 {
  font-size: 19px;
}
.crm-erp .drawer-header .eyebrow {
  margin-bottom: 4px;
}
.crm-erp .drawer-body {
  padding: 0 20px 20px;
}
.crm-erp .drawer-section {
  padding: 14px 0;
}
.crm-erp .drawer-section > h3 {
  font-size: 13px;
  margin-bottom: 10px;
}
.crm-erp .drawer-section > p {
  margin: 6px 0;
  font-size: 11px;
  line-height: 1.6;
}
.crm-erp .drawer-body .receipt-row {
  padding: 8px 0;
  gap: 12px;
}
.crm-erp .drawer-body .call-history-row > div {
  display: grid;
  grid-template-columns: 160px 130px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  width: 100%;
}
.crm-erp .drawer-body .call-history-row small,
.crm-erp .drawer-body .call-history-row p {
  margin: 0;
}
.crm-erp .drawer-body .call-history-row p {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.crm-erp .drawer-section .section-heading {
  margin: 0 0 10px;
}
.crm-erp .drawer-section .section-heading h3 {
  font-size: 13px;
}
.crm-erp .communication-entry {
  padding-block: 16px;
}
.crm-erp .communication-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.crm-erp .communication-entry-header h3,
.crm-erp .communication-entry-header p {
  margin: 0;
}
.crm-erp .communication-entry-header h3 {
  font-size: 14px;
}
.crm-erp .communication-entry-header p {
  margin-top: 4px;
  color: #6f6f78;
  font-size: 11px;
  line-height: 1.45;
}
.crm-erp .communication-entry-header > .btn {
  flex: none;
}
.crm-erp .communication-pending .section-heading {
  margin-bottom: 8px;
}
.crm-erp .communication-pending-list {
  border: 1px solid rgb(var(--line-soft));
  background: #fff;
}
.crm-erp .communication-pending-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 11px 12px;
}
.crm-erp .communication-pending-row + .communication-pending-row {
  border-top: 1px solid rgb(var(--line-soft));
}
.crm-erp .communication-pending-row > div {
  min-width: 0;
}
.crm-erp .communication-cell-label {
  display: block;
  margin-bottom: 5px;
  color: #85858f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.055em;
}
.crm-erp .communication-pending-row strong {
  display: block;
  overflow: hidden;
  color: #202027;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-erp .communication-pending-row > .btn {
  justify-self: end;
  min-width: 168px;
}
.crm-erp .communication-empty {
  display: grid;
  gap: 4px;
  padding: 15px 16px;
  border: 1px solid rgb(var(--line-soft));
  background: #f7f7f9;
}
.crm-erp .communication-empty strong {
  font-size: 12px;
}
.crm-erp .communication-empty span {
  color: #6f6f78;
  font-size: 11px;
}
.crm-erp .drawer-actions {
  margin: 12px 0;
  gap: 6px;
}
.crm-erp .call-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.crm-erp .call-record-heading h3 {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.crm-erp .call-record-details {
  margin: 0;
  padding: 12px 0;
  border-block: 1px solid rgb(var(--line-soft));
}
.crm-erp .call-record-details dt {
  color: #62626c;
}
.crm-erp .call-record-details dd {
  margin-top: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.crm-erp .call-record-notes {
  margin-block: 14px;
}
.crm-erp .call-record-notes h4 {
  margin: 0 0 6px;
  font-size: 11px;
}
.crm-erp .call-record-notes p {
  margin: 0;
  color: #62626c;
  overflow-wrap: anywhere;
}
.crm-erp .drawer-actions.call-record-actions {
  padding-top: 14px;
  margin: 0;
  border-top: 1px solid rgb(var(--line-soft));
  gap: 8px;
}
.crm-erp .drawer-footer {
  min-height: 58px;
  padding: 10px 20px;
  gap: 10px;
}
.crm-erp .drawer-body .form-grid {
  gap: 12px 16px;
}
.crm-erp .drawer-body label > span {
  font-size: 11px;
}
.crm-erp .drawer-body .field > span {
  margin-bottom: 4px;
}
.crm-erp
  .drawer-body
  .field
  > input:not([type='hidden']):not([type='checkbox']):not([type='radio']),
.crm-erp .drawer-body .line-row > input,
.crm-erp .drawer-body .app-select-control {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 11px;
}
.crm-erp .drawer-body .app-select-control {
  padding-right: 34px;
}
.crm-erp .drawer-body .app-select,
.crm-erp .drawer-body .app-date-field,
.crm-erp .drawer-body .app-time-field {
  margin-top: 0;
}
.crm-erp .drawer-body .app-date-field,
.crm-erp .drawer-body .app-time-field {
  grid-template-columns: minmax(0, 1fr) 38px;
}
.crm-erp .drawer-body input.app-date-input,
.crm-erp .drawer-body input.app-time-input {
  min-height: 38px !important;
  padding: 0 12px;
  border-radius: 11px 0 0 11px;
}
.crm-erp .drawer-body .app-date-toggle,
.crm-erp .drawer-body .app-time-toggle {
  min-height: 38px !important;
  width: 38px;
  border-radius: 0 11px 11px 0;
}
.crm-erp .drawer-body textarea {
  padding: 9px 12px;
  font-size: 12px;
  border-radius: 11px;
}
.crm-erp .drawer-body .choice-field {
  margin-bottom: 12px;
}
.crm-erp .drawer-body .choice-grid {
  gap: 6px;
}
.crm-erp .drawer-body .choice-pill {
  padding: 7px 10px;
  min-height: 34px;
}
.crm-erp .drawer-body .detail-grid {
  gap: 10px 16px;
}
.crm-erp .drawer-body .deal-summary > div {
  padding: 12px;
}
.crm-erp .drawer-body .deal-summary strong {
  font-size: 21px;
}
.crm-erp .drawer-body .line-total {
  padding: 12px 0;
}
.crm-erp .drawer-body .line-total strong {
  font-size: 21px;
}
.crm-erp .drawer-body .timeline-item {
  padding: 10px 0;
}
.crm-erp .drawer-body .lead-history li {
  padding-bottom: 14px;
}
.crm-erp .drawer-body .history-meta {
  font-size: 10px;
}
.crm-erp .drawer-body .lead-history p {
  margin: 4px 0;
  font-size: 11px;
}
.crm-erp .drawer-body .column-option {
  padding: 8px 0;
}
.crm-erp .drawer-body .register td {
  padding: 9px 10px;
}
.crm-erp .drawer-body .register th {
  padding: 9px 10px;
}
.crm-erp .drawer-back {
  margin: 10px 20px;
  padding: 0;
  font-size: 11px;
}
@media (min-width: 1024px) and (min-height: 700px) {
  .crm-erp:has(.erp-page) {
    overflow: hidden;
  }
  .crm-erp:has(.erp-page) .app-shell {
    height: 100dvh;
    min-height: 0;
  }
  .crm-erp:has(.erp-page) main#content {
    display: flex;
    flex-direction: column;
  }
  .erp-page {
    flex: 1;
    min-height: 0;
  }
  .erp-page .erp-scroll-body {
    flex: 1 1 auto;
    min-height: 100px;
    max-height: none;
  }
  .erp-page .contact-grid {
    flex: 1;
    min-height: 100px;
  }
  .erp-page .contact-grid .erp-table-wrap {
    max-height: none;
  }
  .erp-page .day-agenda {
    flex: 1;
  }
  .erp-page .kanban {
    height: 100%;
  }
  .crm-erp:has(.erp-page [data-filter-toggle][aria-expanded='true']) {
    overflow: auto;
  }
  .crm-erp:has(.erp-page [data-filter-toggle][aria-expanded='true']) .app-shell {
    height: auto;
    min-height: 100dvh;
  }
  .erp-page:has([data-filter-toggle][aria-expanded='true']) .erp-scroll-body,
  .erp-page:has([data-filter-toggle][aria-expanded='true']) .contact-grid {
    flex: none;
    height: 55dvh;
    min-height: 300px;
  }
}
@media (max-width: 1199px) {
  .erp-page .erp-scroll-hint {
    display: none;
  }
  .erp-page .goal-settings {
    grid-template-columns: 1fr;
  }
  .erp-page .summary-strip {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }
}
@media (max-width: 760px) {
  .erp-page .filter-primary .erp-record-actions {
    flex-basis: 100%;
    border: 0;
    padding: 0;
  }
  .erp-page .filter-primary > .inline-search {
    flex-basis: calc(100% - 120px);
    min-width: 100px;
  }
  .erp-page .filter-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .erp-page .erp-statusbar > span:last-child {
    display: none;
  }
  .erp-page .erp-viewbar {
    flex-wrap: wrap;
  }
  .erp-page .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .erp-page .summary-strip > div {
    min-width: 0;
    padding: 8px 10px;
  }
  .erp-page .summary-strip strong {
    font-size: 17px;
  }
  .erp-page .goals-strip {
    gap: 8px;
    padding: 8px;
  }
  .erp-page .goal-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .erp-page .calendar-toolbar,
  .erp-page .calendar-navigation {
    flex-wrap: wrap;
  }
  .erp-page .calendar-legend > .muted {
    display: none;
  }
  .erp-page .calendar-navigation h2 {
    font-size: 13px;
  }
  .erp-page .table-footer {
    justify-content: center;
  }
  .crm-erp .drawer-header {
    padding: 12px 16px;
  }
  .crm-erp .drawer-body {
    padding: 0 16px 16px;
  }
  .crm-erp .drawer-footer {
    padding: 10px 16px;
  }
  .crm-erp .drawer-body .form-grid {
    gap: 12px;
  }
  .crm-erp .drawer-body .call-history-row > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .crm-erp .drawer-body .call-history-row p {
    grid-column: 1/-1;
  }
  .crm-erp .communication-entry-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .crm-erp .communication-pending-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .crm-erp .communication-pending-row > .btn {
    grid-column: 1/-1;
    justify-self: stretch;
  }
}
@media (max-width: 600px) {
  .erp-data-table th:first-child {
    left: auto;
  }
  .erp-data-table td:first-child {
    position: static;
  }
}
@media (max-width: 420px) {
  .crm-erp main#content {
    padding-inline: 10px;
  }
  .erp-page .btn {
    font-size: 10px;
    padding-inline: 9px;
  }
}
