/* CRM — Dashboard premium */

.main-view--dashboard {
  max-width: 1280px;
}

.dash-page {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.dash-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  animation: dash-fade-in 0.5s ease both;
}

.dash-page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #082b5b;
}

.dash-page-lead {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: #64748b;
  max-width: 42ch;
}

.dash-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.dash-chip-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 76, 151, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: #0f4c97;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.dash-chip-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 76, 151, 0.15);
  background: #fff;
}

.dash-executive {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  animation: dash-fade-in 0.55s ease 0.12s both;
}

.dash-exec-card {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 76, 151, 0.08);
  box-shadow: 0 8px 24px rgba(15, 76, 151, 0.06);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.dash-exec-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(15, 76, 151, 0.12);
}

.dash-exec-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.dash-exec-value {
  margin: 0.35rem 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  color: #082b5b;
  letter-spacing: -0.02em;
}

.dash-exec-bar {
  margin-top: 0.65rem;
  height: 4px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}

.dash-exec-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f4c97, #3b82f6);
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.dash-kpi-card {
  position: relative;
  padding: 1.2rem 1.25rem 1.1rem;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 1px 2px rgba(15, 76, 151, 0.04),
    0 12px 28px rgba(15, 76, 151, 0.08);
  overflow: hidden;
  animation: dash-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--kpi-i, 0) * 0.07s);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease;
}

.dash-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--kpi-accent, #0f4c97);
  border-radius: 16px 0 0 16px;
}

.dash-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 4px 8px rgba(15, 76, 151, 0.06),
    0 20px 40px rgba(15, 76, 151, 0.14);
}

@keyframes dash-card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dash-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.65rem;
  background: var(--kpi-icon-bg, rgba(15, 76, 151, 0.1));
  color: var(--kpi-accent, #0f4c97);
}

.dash-kpi-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-kpi-value {
  margin: 0.4rem 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: #082b5b;
  letter-spacing: -0.02em;
}

.dash-kpi-meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.dash-kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #16a34a;
}

.dash-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dash-chart-card {
  padding: 1.15rem 1.2rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 76, 151, 0.08);
  box-shadow: 0 10px 28px rgba(15, 76, 151, 0.07);
  animation: dash-fade-in 0.5s ease both;
}

.dash-chart-card--wide {
  grid-column: 1 / -1;
}

.dash-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #082b5b;
}

.dash-section-sub {
  margin: 0.2rem 0 0.85rem;
  font-size: 0.8rem;
  color: #64748b;
}

.dash-chart-canvas-wrap {
  position: relative;
  height: 220px;
}

.dash-panel {
  padding: 1.25rem 1.3rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 76, 151, 0.08);
  box-shadow: 0 12px 32px rgba(15, 76, 151, 0.08);
  animation: dash-fade-in 0.55s ease 0.15s both;
}

.dash-panel--calendar-first {
  animation: dash-fade-in 0.5s ease 0.05s both;
}

.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-cal-view-tabs {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 12px;
  background: #f1f5f9;
  gap: 0.15rem;
}

.dash-cal-tab {
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.dash-cal-tab.is-active {
  background: #fff;
  color: #0f4c97;
  box-shadow: 0 2px 8px rgba(15, 76, 151, 0.12);
}

.dashboard-cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dashboard-cal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dash-btn-ghost,
.dash-btn-primary-soft {
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.dash-btn-ghost {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
}

.dash-btn-ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 76, 151, 0.1);
}

.dash-btn-primary-soft {
  border: none;
  background: rgba(15, 76, 151, 0.1);
  color: #0f4c97;
}

.dash-btn-primary-soft:hover {
  background: rgba(15, 76, 151, 0.16);
}

.dashboard-cal-week-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
}

.dashboard-cal-wrap {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fafbfd;
  overflow: hidden;
  min-height: 120px;
}

.dash-cal-animate.dash-cal-transition {
  animation: dash-cal-swipe 0.35s ease;
}

@keyframes dash-cal-swipe {
  from {
    opacity: 0.4;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.dashboard-cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-height: 200px;
}

.dashboard-cal-day {
  border-right: 1px solid #e8eef4;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.dashboard-cal-day:last-child {
  border-right: none;
}

.dashboard-cal-day.is-today .dashboard-cal-day-head {
  background: linear-gradient(180deg, rgba(15, 76, 151, 0.12), rgba(15, 76, 151, 0.04));
  color: #0f4c97;
  font-weight: 700;
}

.dashboard-cal-day-head {
  padding: 0.55rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
}

.dashboard-cal-day-body {
  flex: 1;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  max-height: 280px;
}

.dashboard-cal-empty {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.75rem 0.35rem;
}

.dashboard-cal-event {
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
  border-left: 3px solid #0f4c97;
  background: rgba(15, 76, 151, 0.08);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.dashboard-cal-event:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 10px rgba(15, 76, 151, 0.12);
}

.dashboard-cal-event--contract {
  border-left-color: #d97706;
  background: rgba(217, 119, 6, 0.1);
}

.dashboard-cal-event--quote {
  border-left-color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
}

.dashboard-cal-event-time {
  font-weight: 700;
  color: #334155;
}

.dashboard-cal-event-sub {
  margin-top: 0.15rem;
  color: #64748b;
  font-size: 0.68rem;
}

/* Vista día */
.dashboard-cal-day-view {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
}

.dashboard-cal-day-view .dashboard-cal-event {
  padding: 0.75rem 0.85rem;
  font-size: 0.85rem;
}

/* Vista mes */
.dashboard-cal-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e2e8f0;
}

.dashboard-cal-month-head {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  background: #f1f5f9;
}

.dashboard-cal-month-cell {
  min-height: 88px;
  padding: 0.35rem;
  background: #fff;
  font-size: 0.72rem;
}

.dashboard-cal-month-cell.is-today {
  background: rgba(15, 76, 151, 0.06);
  outline: 2px solid rgba(15, 76, 151, 0.25);
  outline-offset: -2px;
}

.dashboard-cal-month-cell.is-other {
  background: #f8fafc;
  color: #94a3b8;
}

.dashboard-cal-month-num {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dashboard-cal-month-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.dashboard-cal-month-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f4c97;
}

.dashboard-cal-month-dot--contract {
  background: #d97706;
}

.dashboard-cal-month-dot--quote {
  background: #7c3aed;
}

.dash-inline-msg {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.dash-inline-msg.msg-err,
.dash-inline-msg:not(.hidden).msg-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.dash-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: dash-skeleton 1.2s ease infinite;
  border-radius: 16px;
  min-height: 100px;
}

@keyframes dash-skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 900px) {
  .dash-charts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-cal-week {
    grid-template-columns: 1fr;
  }

  .dashboard-cal-day {
    border-right: none;
    border-bottom: 1px solid #e8eef4;
    min-height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-kpi-card,
  .dash-page-head,
  .dash-chart-card,
  .dash-panel,
  .dash-cal-animate {
    animation: none !important;
  }

  .dash-kpi-card:hover,
  .dash-exec-card:hover {
    transform: none;
  }
}
