/* Partner CRM — tabs, overview, placeholder tables */

.crm-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.crm-tabs__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--text-silver);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.crm-tabs__btn:last-child {
  border-right: 0;
}

.crm-tabs__btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.04);
}

.crm-tabs__btn.is-active,
.crm-tabs__btn[aria-selected='true'] {
  color: var(--text-white);
  background: rgba(214, 0, 0, 0.12);
  box-shadow: inset 0 -2px 0 rgba(214, 0, 0, 0.85);
}

.crm-table__organize {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  vertical-align: middle;
}

.crm-table__organize:hover {
  color: #fff;
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
}

.crm-table__organize-icon {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.crm-lightbox__panel.crm-lightbox__panel--narrow {
  width: min(28rem, 100%);
}

.crm-columns-organize {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(60vh, 28rem);
  overflow: auto;
}

.crm-columns-organize__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.crm-columns-organize__item.is-hidden-col {
  opacity: 0.55;
}

.crm-columns-organize__check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-white);
  cursor: pointer;
}

.crm-columns-organize__check input {
  margin: 0;
}

.crm-columns-organize__meta {
  font-size: 0.72rem;
  color: var(--text-muted, #9a9a9a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-columns-organize__moves {
  display: inline-flex;
  gap: 0.25rem;
}

.crm-columns-organize__moves .btn {
  min-width: 2rem;
  padding: 0.25rem 0.4rem;
}

.crm-panel[hidden] {
  display: none !important;
}

.crm-panel__header {
  margin-bottom: 1.1rem;
}

.crm-panel__header--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
}

.crm-invoice-automate {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.crm-invoice-automate__history {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.crm-invoice-automate__history:hover,
.crm-invoice-automate__history:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.crm-invoice-automate__icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.crm-invoice-automate__switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.6rem;
  height: 1.45rem;
  cursor: pointer;
}

.crm-invoice-automate__switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.crm-invoice-automate__track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.18s ease;
}

.crm-invoice-automate__track::after {
  content: '';
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #f3f3f5;
  transition: transform 0.18s ease, background 0.18s ease;
}

.crm-invoice-automate__switch input:checked + .crm-invoice-automate__track {
  background: #1f9d55;
}

.crm-invoice-automate__switch input:checked + .crm-invoice-automate__track::after {
  transform: translateX(1.15rem);
  background: #fff;
}

.crm-invoice-automate.is-on {
  border-color: rgba(31, 157, 85, 0.55);
  background: rgba(31, 157, 85, 0.12);
}

.crm-invoice-automate.is-on .crm-invoice-automate__history {
  color: #7dffa8;
}

.crm-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.crm-panel__subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-overview__loading {
  margin: 0;
  color: var(--text-muted, #9a9a9a);
  font-size: 0.9rem;
}

.crm-overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}

.crm-overview__card {
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.crm-overview__label {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-silver);
}

.crm-overview__value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.3;
}

.crm-overview__split {
  opacity: 0.45;
  font-weight: 500;
  margin: 0 0.15rem;
}

.crm-overview__meta {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-overview-period {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-overview-period-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 0.85rem;
  margin: 0 0 1rem;
}

.crm-overview-period-filter__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-overview-period-filter__field input[type='date'] {
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-white);
  color-scheme: dark;
}

.crm-overview-period-filter__refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.crm-overview-period-filter__refresh:hover,
.crm-overview-period-filter__refresh:focus-visible {
  border-color: rgba(214, 0, 0, 0.7);
  color: #fff;
  outline: none;
}

.crm-overview-period-filter__refresh svg {
  width: 1.15rem;
  height: 1.15rem;
}

.crm-overview-period-filter__status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #9a9a9a);
  width: 100%;
}

.crm-overview-period-filter__status.is-error {
  color: #ff8f8f;
}

.crm-trend {
  margin-top: 1.15rem;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
}

.crm-trend__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  margin-bottom: 0.75rem;
}

.crm-trend__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.crm-trend__note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-trend__mode {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.crm-trend__mode-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.crm-trend__mode-btn.is-active {
  background: rgba(214, 0, 0, 0.85);
  color: #fff;
}

.crm-trend__legend {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  color: var(--text-silver, #c8c8c8);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.crm-trend__swatch {
  width: 0.85rem;
  height: 0.2rem;
  border-radius: 1px;
  display: inline-block;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.crm-trend__swatch--inquiries { background: #9aa4b2; }
.crm-trend__swatch--appointments { background: #7dd3c0; }
.crm-trend__swatch--sales { background: #7ec8ff; }
.crm-trend__swatch--completed { background: #8fd18f; }
.crm-trend__swatch--warranty { background: #c4a1ff; }
.crm-trend__swatch--sponsors { background: #ff9ecf; }
.crm-trend__swatch--costing { background: #ffb070; }
.crm-trend__swatch--revenue {
  background: #d4af37;
  height: 0.32rem;
}

.crm-trend__canvas-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}

.crm-trend__svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.crm-trend__grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.crm-trend__axis-label {
  fill: rgba(255, 255, 255, 0.45);
  font-size: 9px;
}

.crm-trend__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.crm-trend__line--inquiries { stroke: #9aa4b2; }
.crm-trend__line--appointments { stroke: #7dd3c0; }
.crm-trend__line--sales { stroke: #7ec8ff; }
.crm-trend__line--completed { stroke: #8fd18f; }
.crm-trend__line--warranty { stroke: #c4a1ff; }
.crm-trend__line--sponsors { stroke: #ff9ecf; }
.crm-trend__line--costing { stroke: #ffb070; }
.crm-trend__line--revenue {
  stroke: #d4af37;
  stroke-width: 3.5;
}

.crm-trend__crosshair {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.crm-trend__tooltip {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  max-width: 220px;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(12, 12, 12, 0.94);
  color: #f0f0f0;
  font-size: 0.72rem;
  line-height: 1.35;
  pointer-events: none;
}

.crm-trend__tooltip strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.crm-trend__tooltip span {
  display: block;
}

.crm-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.crm-table th,
.crm-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  white-space: nowrap;
}

.crm-table td.crm-table__cell--wrap {
  white-space: normal;
  min-width: 10rem;
  max-width: 18rem;
}

.crm-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-silver);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.crm-table td {
  font-size: 0.9rem;
  color: var(--text-white);
}

.crm-table tbody tr:last-child td {
  border-bottom: 0;
}

.crm-table tbody tr.crm-table__row {
  cursor: pointer;
}

.crm-table tbody tr.crm-table__row:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.crm-table__empty {
  color: var(--text-muted, #9a9a9a) !important;
  text-align: center !important;
  padding: 1.75rem 1rem !important;
}

.crm-table__actions-col {
  width: 2.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.crm-row-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crm-row-actions__progress {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  user-select: none;
}

.crm-row-actions__progress.is-complete {
  color: #d4af37;
  font-weight: 700;
}

.crm-row-actions__progress.is-complete .crm-row-actions__progress-total {
  color: #f0d56a;
}

.crm-row-actions__gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.crm-row-actions__gear:hover,
.crm-row-actions__gear[aria-expanded='true'] {
  color: #fff;
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
}

.crm-row-actions__gear-icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

.crm-row-actions__menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1400;
  min-width: 10.5rem;
  padding: 0.3rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: #0a0a0a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.crm-row-actions__menu[hidden] {
  display: none !important;
}

.crm-row-actions__item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.crm-row-actions__item:hover:not(:disabled) {
  background: rgba(214, 0, 0, 0.14);
}

.crm-row-actions__item:disabled,
.crm-row-actions__item[aria-disabled='true'] {
  color: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
  opacity: 0.55;
}

.crm-edited-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted, #9a9a9a);
}

body.crm-lightbox-open {
  overflow: hidden;
}

.crm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.crm-lightbox[hidden] {
  display: none;
}

.crm-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(6px);
}

.crm-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: linear-gradient(180deg, #0e0e0e 0%, #080808 100%);
  box-shadow:
    0 0 0 1px rgba(214, 0, 0, 0.08),
    0 32px 96px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.crm-lightbox__header,
.crm-lightbox__footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #0c0c0c;
}

.crm-lightbox__footer {
  border-bottom: 0;
  border-top: 1px solid var(--border-subtle);
  justify-content: flex-end;
}

.crm-lightbox__eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.crm-lightbox__title {
  margin: 0;
  font-size: 1.1rem;
}

.crm-lightbox__subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.crm-lightbox__close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.crm-lightbox__body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  background: #0a0a0a;
}

.crm-form-group {
  margin: 0 0 1.35rem;
  padding: 0 0 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-form-group:last-of-type {
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.crm-form-group[hidden] {
  display: none;
}

.crm-form-group__title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-white, #fff);
}

.crm-form-group__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(46, 204, 113, 0.16);
  color: #3ddc84;
  flex-shrink: 0;
}

.crm-form-group__check[hidden] {
  display: none;
}

.crm-form-group__check svg {
  width: 0.78rem;
  height: 0.78rem;
}

.crm-form-group.is-inactive {
  opacity: 0.72;
}

.crm-form-group.is-inactive .crm-form-group__title {
  color: rgba(255, 255, 255, 0.55);
}

.crm-form-group.is-inactive .crm-form-group__check {
  opacity: 1;
}

.crm-form-subgroup {
  margin: 0 0 1.1rem;
}

.crm-form-subgroup:last-child {
  margin-bottom: 0;
}

.crm-form-subgroup__title {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-silver, #c8c8c8);
}

.crm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.crm-time-field {
  position: relative;
}

.crm-form-grid .form-field input.crm-input-time {
  width: 100%;
  padding-right: 2.55rem;
  font-variant-numeric: tabular-nums;
}

.crm-time-field__clock {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}

.crm-time-field__clock svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.crm-time-field__clock:hover,
.crm-time-field__clock[aria-expanded='true'] {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.crm-time-field__clock:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(214, 0, 0, 0.7);
}

.crm-time-picker {
  position: fixed;
  z-index: 80;
  min-width: 13.5rem;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: #141414;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.crm-time-picker[hidden] {
  display: none;
}

.crm-time-picker__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.crm-time-picker__col {
  max-height: 12.5rem;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: #0d0d0d;
  scrollbar-width: thin;
}

.crm-time-picker__option {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
  padding: 0.48rem 0.2rem;
  cursor: pointer;
}

.crm-time-picker__option:last-child {
  border-bottom: 0;
}

.crm-time-picker__option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.crm-time-picker__option.is-selected {
  background: rgba(214, 0, 0, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(214, 0, 0, 0.65);
}

.crm-form-grid .form-field input[type='date'].crm-input-date {
  position: relative;
  color: #ffffff;
  color-scheme: light;
  padding-right: 2.55rem;
  background-color: #0a0a0a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2'/%3E%3Cpath d='M3.5 10h17M8 3.5v3.5M16 3.5v3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.05rem 1.05rem;
}

.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit,
.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit-fields-wrapper,
.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit-text,
.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit-month-field,
.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit-day-field,
.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-datetime-edit-year-field {
  color: #ffffff;
}

.crm-form-grid .form-field input[type='date'].crm-input-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0;
  position: absolute;
  right: 0.35rem;
  top: 0;
  width: 2.2rem;
  height: 100%;
  margin: 0;
  padding: 0;
}

.crm-form-grid .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.crm-form-grid .form-field--full {
  grid-column: 1 / -1;
}

.crm-form-grid .form-field > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-silver);
}

.crm-form-grid .form-field input:not([type='checkbox']):not([type='radio']),
.crm-form-grid .form-field select,
.crm-form-grid .form-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  background: #0a0a0a;
  color: var(--text-white);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.65rem 0.75rem;
  color-scheme: dark;
}

.crm-form-grid .form-field input:not([type='checkbox']):not([type='radio']):focus,
.crm-form-grid .form-field select:focus,
.crm-form-grid .form-field textarea:focus {
  outline: none;
  border-color: rgba(214, 0, 0, 0.55);
}

.crm-form-grid .form-field input:not([type='checkbox']):not([type='radio'])[readonly],
.crm-form-grid .form-field input:not([type='checkbox']):not([type='radio']):disabled,
.crm-form-grid .form-field select:disabled,
.crm-form-grid .form-field textarea:disabled {
  color: rgba(255, 255, 255, 0.72);
  background: #080808;
  cursor: default;
}

.crm-form-group.is-inactive .crm-setup-option {
  pointer-events: none;
  opacity: 0.7;
}

.crm-form-group.is-inactive .crm-urgency {
  pointer-events: none;
  opacity: 0.75;
}

.crm-form-grid .form-field select {
  appearance: none;
  background-color: #0a0a0a;
  background-image: linear-gradient(45deg, transparent 50%, #9a9a9a 50%),
    linear-gradient(135deg, #9a9a9a 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.crm-form-grid .form-field select option,
.crm-form-grid .form-field select optgroup {
  background-color: #0a0a0a;
  color: #ffffff;
}

.crm-form-grid .form-field .crm-label-req {
  margin-left: 0.2rem;
  color: var(--accent-red, #d60000);
}

.crm-form-grid .form-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-setup-search {
  margin-bottom: 0.55rem;
}

.crm-location-search {
  position: relative;
}

.crm-location-search__input {
  width: 100%;
  box-sizing: border-box;
}

.crm-location-search__list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 14rem;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: #101010;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.crm-location-search__option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.crm-location-search__option:hover,
.crm-location-search__option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.crm-location-search__empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.82rem;
}

.crm-location-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #9ec1ff;
  font: inherit;
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.crm-location-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none;
}

.crm-location-others {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.crm-location-others__title {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.crm-location-others__title + .crm-location-others__row {
  margin-bottom: 0.75rem;
}

.crm-location-others__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.crm-location-others__row input {
  flex: 1 1 8rem;
  min-width: 0;
}

.crm-location-others__status {
  margin: 0.45rem 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.crm-location-others__status.is-error {
  color: #ffb4b4;
}

.crm-location-others__status.is-ok {
  color: #b6f0c3;
}

.crm-location-others__results {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  max-height: 12rem;
  overflow: auto;
}

.crm-location-others__results li {
  margin: 0;
  padding: 0;
}

.crm-location-others__result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-location-others__result-label {
  min-width: 0;
  font-size: 0.85rem;
  color: #fff;
}

.crm-location-others__result-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
}

.crm-setup-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 16rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: #080808;
  box-sizing: border-box;
}

.crm-setup-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: #101010;
  color: #fff;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.crm-setup-option:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: #141414;
}

.crm-setup-option.is-selected {
  border-color: rgba(214, 0, 0, 0.55);
  background: rgba(214, 0, 0, 0.08);
}

.crm-setup-option[hidden] {
  display: none !important;
}

.crm-setup-option__stepper {
  display: inline-grid;
  grid-template-columns: 1.7rem 1.6rem 1.7rem;
  align-items: center;
  justify-items: center;
  flex-shrink: 0;
}

.crm-form-grid .form-field .crm-setup-option__btn,
.crm-setup-option__btn {
  width: 1.7rem !important;
  height: 1.7rem !important;
  min-width: 1.7rem !important;
  max-width: 1.7rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 3px !important;
  background: #0a0a0a !important;
  color: #fff !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer;
  box-shadow: none !important;
}

.crm-form-grid .form-field .crm-setup-option__btn:hover:not(:disabled),
.crm-setup-option__btn:hover:not(:disabled) {
  border-color: rgba(214, 0, 0, 0.55) !important;
  background: rgba(214, 0, 0, 0.12) !important;
}

.crm-form-grid .form-field .crm-setup-option__btn:disabled,
.crm-setup-option__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.crm-setup-option__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.crm-setup-option__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  width: 100%;
  min-width: 0;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.crm-setup-option__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  overflow: hidden;
}

.crm-setup-option__name {
  display: block;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: #fff;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-setup-option__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.crm-setup-option__code {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bdbdbd;
  white-space: nowrap;
}

.crm-setup-option__stock {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d7d7d7;
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.crm-setup-option__stock--none {
  color: #ffb4b4;
  border-color: rgba(214, 0, 0, 0.35);
  background: rgba(214, 0, 0, 0.08);
}

.crm-setup-option__price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.18rem;
  min-width: 7rem;
  flex-shrink: 0;
}

.crm-setup-option__price-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f8f8f;
}

.crm-setup-option__srp {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
  text-transform: none;
  color: #fff;
  white-space: nowrap;
}

.crm-setup-options__empty {
  margin: 0;
  padding: 0.85rem 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted, #9a9a9a);
  text-align: center;
}

.crm-setup-summary {
  box-sizing: border-box;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: #080808;
  min-height: 3rem;
}

.crm-setup-summary__empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-setup-summary__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.crm-setup-summary__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  column-gap: 0.75rem;
}

.crm-setup-summary__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.crm-setup-summary__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-setup-summary__code {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bdbdbd;
}

.crm-setup-summary__qty {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #d0d0d0;
}

.crm-setup-summary__total {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 640px) {
  .crm-setup-option {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .crm-setup-option__content {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.45rem;
  }

  .crm-setup-option__price {
    align-items: flex-start;
    min-width: 0;
  }

  .crm-setup-summary__item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'main qty'
      'main total';
  }

  .crm-setup-summary__main {
    grid-area: main;
  }

  .crm-setup-summary__qty {
    grid-area: qty;
  }

  .crm-setup-summary__total {
    grid-area: total;
  }
}

.crm-urgency {
  --crm-urgency-thumb: 1rem;
  --crm-urgency-track: 0.28rem;
  --crm-urgency-fill: #8a8a8a;
  --crm-urgency-rest: rgba(255, 255, 255, 0.18);
  --crm-urgency-pct: 0%;
  margin-top: 0.35rem;
}

.crm-urgency.is-warm {
  --crm-urgency-fill: #d4a017;
}

.crm-urgency.is-hot {
  --crm-urgency-fill: #d60000;
}

.crm-urgency__rail {
  height: var(--crm-urgency-thumb);
  display: flex;
  align-items: center;
  /* Extend travel so thumb centers sit flush with mark edges */
  margin: 0 calc(var(--crm-urgency-thumb) / -2);
  padding: 0 calc(var(--crm-urgency-thumb) / 2);
}

.crm-urgency input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--crm-urgency-thumb);
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.crm-urgency input[type='range']:focus {
  outline: none;
}

.crm-urgency input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(214, 0, 0, 0.28);
}

.crm-urgency input[type='range']:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(214, 0, 0, 0.28);
}

.crm-urgency input[type='range']::-webkit-slider-runnable-track {
  height: var(--crm-urgency-track);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--crm-urgency-fill) 0%,
    var(--crm-urgency-fill) var(--crm-urgency-pct),
    var(--crm-urgency-rest) var(--crm-urgency-pct),
    var(--crm-urgency-rest) 100%
  );
}

.crm-urgency input[type='range']::-moz-range-track {
  height: var(--crm-urgency-track);
  border: 0;
  border-radius: 999px;
  background: var(--crm-urgency-rest);
}

.crm-urgency input[type='range']::-moz-range-progress {
  height: var(--crm-urgency-track);
  border-radius: 999px;
  background: var(--crm-urgency-fill);
}

.crm-urgency input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--crm-urgency-thumb);
  height: var(--crm-urgency-thumb);
  margin-top: calc((var(--crm-urgency-track) - var(--crm-urgency-thumb)) / 2);
  border: 2px solid #111;
  border-radius: 50%;
  background: var(--crm-urgency-fill);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.crm-urgency input[type='range']::-moz-range-thumb {
  width: var(--crm-urgency-thumb);
  height: var(--crm-urgency-thumb);
  border: 2px solid #111;
  border-radius: 50%;
  background: var(--crm-urgency-fill);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.crm-urgency__marks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted, #9a9a9a);
}

.crm-urgency-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-silver);
}

.crm-urgency-label.is-warm {
  color: #d4a017;
}

.crm-urgency-label.is-hot {
  color: #d60000;
}

.crm-form-status {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
}

.crm-form-status--success {
  color: #9adf9a;
}

.crm-form-status--error {
  color: #ffb4b4;
}

.crm-form-status--info {
  color: var(--text-muted, #9a9a9a);
}

.crm-form-subgroup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.crm-form-subgroup__head .crm-form-subgroup__title {
  margin: 0;
}

.btn--small {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.crm-upload {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.crm-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.crm-invoice-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.crm-invoice-cell__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.crm-upload__pick.btn {
  min-height: 2.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.crm-upload__pick.btn:hover {
  border-color: rgba(214, 0, 0, 0.75);
  color: var(--text-white);
  background: rgba(214, 0, 0, 0.1);
}

.crm-upload__preview {
  position: relative;
  width: 9.5rem;
  height: 9.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: #111;
  overflow: hidden;
}

.crm-upload__preview[hidden] {
  display: none !important;
}

.crm-upload__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.crm-upload__preview img:not([src]),
.crm-upload__preview img[src=''],
.crm-upload__preview img[src='#'] {
  display: none;
}

.crm-upload__clear {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
}

.crm-sale-setup,
.crm-sale-installer {
  margin: 0 0 0.85rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.crm-sale-setup__head,
.crm-sale-installer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.crm-sale-setup__title,
.crm-sale-installer__title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-silver, #c8c8c8);
}

.crm-qr-drop {
  box-sizing: border-box;
  padding: 0.65rem 0.7rem 0.55rem;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: #0a0a0a;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.crm-qr-drop:focus,
.crm-qr-drop:focus-within {
  border-color: rgba(214, 0, 0, 0.45);
}

.crm-qr-drop.is-dragover {
  border-color: rgba(214, 0, 0, 0.7);
  border-style: solid;
  background: rgba(214, 0, 0, 0.08);
}

.crm-qr-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.crm-qr-drop__hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted, #9a9a9a);
}

.crm-lightbox.is-view-only .crm-upload__pick,
.crm-lightbox.is-view-only .crm-upload__clear,
.crm-lightbox.is-view-only #crm-sale-add-setup,
.crm-lightbox.is-view-only #crm-sale-add-installer,
.crm-lightbox.is-view-only [data-crm-remove-setup],
.crm-lightbox.is-view-only [data-crm-remove-installer],
.crm-lightbox.is-view-only [data-crm-scan-qr],
.crm-lightbox.is-view-only .crm-qr-drop__hint {
  display: none !important;
}

.crm-lightbox.is-view-only .crm-qr-drop {
  border-style: solid;
  pointer-events: none;
}

@media (max-width: 720px) {
  .crm-tabs {
    display: flex;
    width: 100%;
  }

  .crm-tabs__btn {
    flex: 1 1 auto;
    padding: 0.55rem 0.7rem;
    font-size: 0.72rem;
  }

  .crm-form-grid {
    grid-template-columns: 1fr;
  }
}
