:root {
  --crm-bg: #f4f5f1;
  --crm-bg-alt: #eef1ea;
  --crm-card: rgba(255, 255, 255, 0.88);
  --crm-card-strong: #ffffff;
  --crm-border: rgba(15, 23, 42, 0.08);
  --crm-text: #162133;
  --crm-muted: #6b7280;
  --crm-navy: #0f1a2e;
  --crm-accent: #2f6f5e;
  --crm-accent-soft: #dcece6;
  --crm-warning: #a16207;
  --crm-warning-soft: #fef3c7;
  --crm-danger: #b42318;
  --crm-danger-soft: #fee4e2;
  --crm-success: #16794b;
  --crm-success-soft: #dcfae6;
  --crm-info: #2559b0;
  --crm-info-soft: #dbeafe;
  --crm-radius: 22px;
  --crm-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
}

body.page-postep-crm {
  background:
    radial-gradient(circle at top right, rgba(47, 111, 94, 0.12), transparent 30%),
    linear-gradient(180deg, #f7f8f5 0%, #edf0ea 100%);
  color: var(--crm-text);
}

body.page-postep-crm .topbar {
  z-index: 80;
}

body.page-postep-crm h1,
body.page-postep-crm h2,
body.page-postep-crm h3,
body.page-postep-crm h4 {
  font-family: 'Fraunces', Georgia, serif;
  letter-spacing: -0.02em;
}

body.page-postep-crm,
body.page-postep-crm input,
body.page-postep-crm select,
body.page-postep-crm textarea,
body.page-postep-crm button {
  font-family: 'Manrope', system-ui, sans-serif;
}

.crm-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.crm-sidebar {
  position: sticky;
  top: 92px;
  margin-bottom: 0;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(15, 26, 46, 0.96), rgba(20, 37, 56, 0.96));
  color: rgba(255, 255, 255, 0.9);
  padding: 22px;
  box-shadow: 0 30px 60px rgba(15, 26, 46, 0.24);
}

.crm-content {
  min-width: 0;
}

.crm-panel {
  display: none;
  gap: 18px;
}

.crm-panel.is-active {
  display: block;
}

.crm-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.crm-panel-head h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
}

.crm-kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 800;
  color: var(--crm-accent);
}

.crm-sidebar .crm-kicker,
.crm-sidebar .crm-muted,
.crm-sidebar h2 {
  color: rgba(255, 255, 255, 0.92);
}

.crm-sidebar h2 {
  font-size: 28px;
  margin: 0 0 12px;
}

.crm-muted {
  color: var(--crm-muted);
}

.crm-user-box {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 6px;
  margin: 20px 0 16px;
}

.crm-user-role,
.crm-status-chip,
.crm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.crm-user-role,
.crm-status-chip.is-info,
.crm-badge.is-info {
  background: var(--crm-info-soft);
  color: var(--crm-info);
}

.crm-status-chip.is-warning,
.crm-badge.is-warning {
  background: var(--crm-warning-soft);
  color: var(--crm-warning);
}

.crm-status-chip.is-danger,
.crm-badge.is-danger {
  background: var(--crm-danger-soft);
  color: var(--crm-danger);
}

.crm-status-chip.is-success,
.crm-badge.is-success {
  background: var(--crm-success-soft);
  color: var(--crm-success);
}

.crm-nav {
  display: grid;
  gap: 8px;
}

.crm-nav-link {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}

.crm-nav-link:hover,
.crm-nav-link.is-active {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.crm-side-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.crm-kpi-card,
.crm-list-card,
.crm-table-card,
.crm-filter-card,
.crm-section-card,
.crm-map-card,
.crm-map-sidebar,
.crm-presentation-card,
.crm-focus-card,
.crm-detail-empty {
  border-radius: var(--crm-radius);
  border: 1px solid var(--crm-border);
  background: var(--crm-card);
  backdrop-filter: blur(10px);
  box-shadow: var(--crm-shadow);
}

.crm-kpi-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.crm-kpi-value {
  font-family: 'Fraunces', serif;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.crm-kpi-meta {
  color: var(--crm-muted);
  font-size: 13px;
}

.crm-two-column,
.crm-grid-halves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.crm-card-head,
.crm-focus-head,
.crm-project-overview-head,
.crm-dialog-head,
.crm-presentation-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.crm-card-head h3,
.crm-focus-head h3,
.crm-project-overview h3,
.crm-dialog-head h3,
.crm-presentation-head h3 {
  margin: 0;
  font-size: 24px;
}

.crm-stack-list,
.crm-data-list,
.crm-folder-list,
.crm-import-preview,
.crm-import-result {
  display: grid;
  gap: 10px;
}

.crm-item,
.crm-row-card,
.crm-folder-row {
  border: 1px solid var(--crm-border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
}

.crm-item.is-current {
  border-color: rgba(47, 111, 94, 0.32);
  background: rgba(220, 236, 230, 0.58);
}

.crm-item-header,
.crm-item-meta,
.crm-folder-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.crm-item-title {
  font-weight: 800;
  margin: 0;
}

.crm-item-subtitle,
.crm-item-body,
.crm-folder-path {
  margin: 4px 0 0;
  color: var(--crm-muted);
  font-size: 13px;
}

.crm-filter-grid,
.crm-form-grid,
.crm-export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.crm-form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-filter-grid label,
.crm-form-grid label {
  display: grid;
  gap: 8px;
}

.crm-filter-grid label span,
.crm-form-grid label span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #607082;
}

.crm-filter-grid .full,
.crm-form-grid .full {
  grid-column: 1 / -1;
}

.crm-filter-actions,
.crm-form-actions,
.crm-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.crm-form-actions.full {
  grid-column: 1 / -1;
}

.crm-filter-grid input,
.crm-filter-grid select,
.crm-form-grid input,
.crm-form-grid select,
.crm-form-grid textarea {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.94);
  color: var(--crm-text);
  padding: 12px 14px;
}

.crm-form-grid textarea {
  min-height: 110px;
  resize: vertical;
}

.crm-table-wrap {
  overflow: auto;
}

.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1480px;
}

.crm-table thead th {
  position: sticky;
  top: 0;
  background: #f7f8f5;
  z-index: 1;
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #607082;
  border-bottom: 1px solid var(--crm-border);
}

.crm-table tbody td {
  padding: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  vertical-align: top;
  font-size: 13px;
}

.crm-table tbody tr {
  cursor: pointer;
}

.crm-table tbody tr:hover,
.crm-table tbody tr.is-selected {
  background: rgba(47, 111, 94, 0.06);
}

.crm-progress-pill {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.12);
  color: var(--crm-accent);
  font-weight: 800;
}

.crm-project-overview {
  padding: 22px;
}

.crm-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.crm-overview-grid .crm-overview-cell,
.crm-overview-stats .crm-overview-cell {
  border: 1px solid var(--crm-border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.crm-overview-cell strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #607082;
}

.crm-overview-bars {
  display: grid;
  gap: 12px;
}

.crm-bar {
  display: grid;
  gap: 8px;
}

.crm-bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
}

.crm-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6f5e 0%, #72b09d 100%);
}

.crm-map-layout,
.crm-presentation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.crm-map-card,
.crm-map-sidebar,
.crm-presentation-card {
  overflow: hidden;
}

.crm-map {
  min-height: 560px;
  border-radius: 18px;
  overflow: hidden;
  z-index: 1;
}

.crm-map .leaflet-control-container,
.crm-presentation-card .leaflet-control-container {
  z-index: 5;
}

.crm-marker-wrap {
  background: transparent;
  border: none;
}

.crm-marker {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
}

.crm-marker-info {
  background: var(--crm-info);
}

.crm-marker-warning {
  background: var(--crm-warning);
}

.crm-marker-danger {
  background: var(--crm-danger);
}

.crm-marker-success {
  background: var(--crm-success);
}

.crm-toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 120;
}

.crm-toast {
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.22);
}

.crm-toast.is-info {
  background: linear-gradient(135deg, #2559b0, #4d8de0);
}

.crm-toast.is-success {
  background: linear-gradient(135deg, #16794b, #28a66a);
}

.crm-toast.is-warning {
  background: linear-gradient(135deg, #a16207, #cf8b0f);
}

.crm-toast.is-danger {
  background: linear-gradient(135deg, #b42318, #dd4a3f);
}

.crm-map-sidebar {
  max-height: 640px;
  overflow: auto;
}

.crm-map-filters {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.crm-detail-layout.hidden,
.hidden {
  display: none !important;
}

.crm-presentation-card {
  padding: 22px;
}

.crm-presentation-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.crm-presentation-side {
  display: grid;
  gap: 12px;
}

.crm-photo-tile {
  display: grid;
  gap: 8px;
}

.crm-photo-tile img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--crm-border);
}

.crm-export-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.crm-dialog {
  width: min(980px, calc(100vw - 24px));
  border: none;
  padding: 0;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(15, 23, 42, 0.25);
}

.crm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.crm-dialog-card {
  margin: 0;
  padding: 24px;
  background: linear-gradient(180deg, #fafaf7 0%, #f1f4ee 100%);
}

.crm-wizard-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.crm-wizard-step-indicator {
  min-height: 44px;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid var(--crm-border);
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.crm-wizard-step-indicator.is-active {
  background: var(--crm-accent-soft);
  color: var(--crm-accent);
  border-color: rgba(47, 111, 94, 0.25);
}

.crm-wizard-step {
  display: none;
}

.crm-wizard-step.is-active {
  display: block;
}

.crm-empty-note {
  padding: 18px;
  border: 1px dashed rgba(15, 23, 42, 0.14);
  border-radius: 18px;
  color: var(--crm-muted);
  background: rgba(255, 255, 255, 0.7);
}

@media (max-width: 1320px) {
  .crm-shell,
  .crm-map-layout,
  .crm-presentation-layout {
    grid-template-columns: 1fr;
  }

  .crm-sidebar {
    position: static;
  }
}

@media (max-width: 980px) {
  .crm-kpi-grid,
  .crm-two-column,
  .crm-grid-halves,
  .crm-overview-grid,
  .crm-form-grid,
  .crm-filter-grid,
  .crm-export-grid,
  .crm-presentation-stats {
    grid-template-columns: 1fr 1fr;
  }

  .crm-form-grid.compact {
    grid-template-columns: 1fr 1fr;
  }

  .crm-wizard-steps {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .crm-kpi-grid,
  .crm-two-column,
  .crm-grid-halves,
  .crm-overview-grid,
  .crm-form-grid,
  .crm-form-grid.compact,
  .crm-filter-grid,
  .crm-export-grid,
  .crm-presentation-stats,
  .crm-wizard-steps {
    grid-template-columns: 1fr;
  }

  .crm-panel-head,
  .crm-card-head,
  .crm-focus-head,
  .crm-project-overview-head,
  .crm-dialog-head,
  .crm-presentation-head,
  .crm-item-header,
  .crm-item-meta,
  .crm-folder-row,
  .crm-dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .crm-map {
    min-height: 420px;
  }
}
