:root {
  --sidebar-dark: #1a1a2e;
  --sidebar-mid: #16213e;
  --content-bg: #f4f6f9;
  --card-bg: #ffffff;
  --blue: #0277bd;
  --blue-light: #e1f5fe;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --purple: #7b1fa2;
  --purple-light: #f3e5f5;
  --orange: #f57c00;
  --orange-light: #fff3e0;
  --red: #c62828;
  --red-light: #fce4ec;
  --brown: #5d4037;
  --brown-light: #efebe9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: var(--content-bg);
  color: #1a1a2e;
  overflow: hidden;
  height: 100vh;
}

#root {
  height: 100vh;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c0c4cc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a4ac;
}

.kanban-col {
  min-width: 280px;
  max-width: 280px;
}

.kanban-col.archive-col {
  border: 2px dashed #bbb;
  opacity: 0.75;
  background: #f0eeeb !important;
}

.deal-card {
  background: white;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
  cursor: grab;
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
  user-select: none;
  font-size: 12px;
  position: relative;
}

.deal-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
  transform: translateY(-2px);
}

.deal-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.deal-card.drag-over-card {
  border-top: 3px solid var(--blue);
}

.drop-zone-active {
  background: rgba(2,119,189,0.08) !important;
  border: 2px dashed var(--blue) !important;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  gap: 10px;
  position: relative;
}

.sidebar-nav-item:hover {
  background: #f1f8f2;
  color: #333;
}

.sidebar-nav-item.active {
  background: #edf7ee;
  color: #2e7d32;
  font-weight: 600;
  border-left-color: #2e7d32;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s;
}

.modal-panel {
  width: 560px;
  max-width: 95vw;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  overflow-y: auto;
  animation: slideIn 0.25s ease-out;
  border-radius: 12px 0 0 12px;
}

.modal-center {
  justify-content: center;
  align-items: center;
}

.modal-center .modal-panel {
  width: 480px;
  height: auto;
  max-height: 90vh;
  border-radius: 12px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.table-row {
  transition: background 0.15s;
  cursor: pointer;
}

.table-row:hover {
  background: #f0f4ff !important;
}

.table-row.archived {
  opacity: 0.55;
  text-decoration: line-through;
}

.btn-primary {
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.input-field {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e0e3e8;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: border-color 0.2s;
  outline: none;
  background: #fafbfc;
}

.input-field:focus {
  border-color: var(--blue);
  background: #fff;
}

select.input-field {
  cursor: pointer;
  appearance: auto;
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

.dashboard-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
  transition: box-shadow 0.2s, transform 0.2s;
}

.dashboard-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.funnel-overview-card {
  border-radius: 12px;
  transition: all 0.2s;
}

.funnel-overview-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.bar-chart-bar {
  transition: width 0.6s ease-out;
  border-radius: 0 4px 4px 0;
}

/* =================== KPI Cards =================== */
.kpi-card {
  background: white;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, transform 0.2s;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.kpi-value {
  font-size: 32px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.kpi-value-small {
  font-size: 16px;
}

.kpi-label {
  font-size: 11px;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 4px;
}

/* =================== Calendar =================== */
.calendar-widget {
  user-select: none;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cal-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
}

.cal-nav {
  background: none;
  border: 1px solid #e0e3e8;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #555;
  transition: all 0.15s;
}

.cal-nav:hover {
  background: #f0f1f3;
  color: #1a1a2e;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-names {
  margin-bottom: 4px;
}

.cal-day-name {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  padding: 4px 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 2px;
  transition: all 0.15s;
  position: relative;
  min-height: 36px;
}

.cal-cell.empty {
  background: transparent;
}

.cal-cell:not(.empty):hover {
  background: #f0f4ff;
}

.cal-cell.today {
  background: #e1f5fe;
  border: 1.5px solid #0277bd;
}

.cal-cell.has-events {
  background: #f8f9fa;
}

.cal-cell.has-events:hover {
  background: #e8ebf0;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  line-height: 1;
}

.cal-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  align-items: center;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* =================== Status Timeline =================== */
.status-timeline {
  padding: 4px 0;
}

.timeline-entry {
  display: flex;
  gap: 12px;
}

.timeline-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}

.timeline-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s;
}

.timeline-line {
  width: 2px;
  flex: 1;
  min-height: 20px;
  border-radius: 1px;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.timeline-status.from {
  background: #f0f1f3;
  color: #888;
  border: 1px solid #e0e3e8;
}

.timeline-status.to {
  border: 1px solid;
}

.filter-panel-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
}

@media (max-width: 768px) {
  .sidebar-collapsed .sidebar-text {
    display: none;
  }
  .kanban-col {
    min-width: 240px;
    max-width: 240px;
  }
}