/* ═══════════════════════════════════════════
   KPI CARDS
═══════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  animation: risein 0.4s ease both;
}
.kpi-card:nth-child(1) {
  animation-delay: 0.04s;
}
.kpi-card:nth-child(2) {
  animation-delay: 0.08s;
}
.kpi-card:nth-child(3) {
  animation-delay: 0.12s;
}
.kpi-card:nth-child(4) {
  animation-delay: 0.16s;
}
.kpi-card:nth-child(5) {
  animation-delay: 0.2s;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.kpi-card.c-brass::before {
  background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi));
}
.kpi-card.c-green::before {
  background: linear-gradient(90deg, #15803d, #22c55e);
}
.kpi-card.c-teal::before {
  background: linear-gradient(90deg, #0f766e, #14b8a6);
}
.kpi-card.c-blue::before {
  background: linear-gradient(90deg, #1d4ed8, #60a5fa);
}
.kpi-card.c-amber::before {
  background: linear-gradient(90deg, #b45309, #fbbf24);
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: 5px;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-2);
}
.kpi-sub.up {
  color: #16a34a;
}
.kpi-sub.down {
  color: #dc2626;
}

/* Crew dashboard renders only 2 of the 4 KPI tiles —
   collapse the grid so they fill the row instead of left-aligning. */
.kpi-grid.kpi-grid--narrow {
  grid-template-columns: repeat(2, 1fr);
  max-width: 640px;
}

/* ═══════════════════════════════════════════
   PIPELINE
═══════════════════════════════════════════ */
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 22px;
  animation: risein 0.4s ease 0.2s both;
}
.pipeline-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--border-lo);
  display: flex;
  gap: 2px;
  overflow: hidden;
  margin: 12px 0 14px;
}
.pipe-seg {
  height: 100%;
  border-radius: 2px;
}
.pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
}
.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.leg-n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-1);
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   ACTIVITY TIMELINE
═══════════════════════════════════════════ */
.atl {
  display: flex;
  flex-direction: column;
}
.atl-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.atl-item:last-child {
  padding-bottom: 0;
}
.atl-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
}
.atl-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.atl-dot svg {
  width: 12px;
  height: 12px;
}
.atl-line {
  width: 1px;
  flex: 1;
  background: var(--border-lo);
  margin-top: 4px;
  min-height: 12px;
}
.atl-item:last-child .atl-line {
  display: none;
}
.atl-body {
  flex: 1;
  padding-top: 3px;
}
.atl-msg {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.4;
}
.atl-msg strong {
  font-weight: 600;
}
.atl-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
}
.act-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--brass);
}

/* Activity feed (compact) */
.activity-feed {
  display: flex;
  flex-direction: column;
}
.act-item {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-lo);
}
.act-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.act-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.act-icon svg {
  width: 12px;
  height: 12px;
}
.act-body {
  flex: 1;
  min-width: 0;
}
.act-text {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.4;
}
.act-text strong {
  font-weight: 600;
}
.act-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}

/* ═══════════════════════════════════════════
   DASHBOARD STAGGERED ANIMATIONS
═══════════════════════════════════════════ */
/* Side-stack panels cascade in after KPI + pipeline */
.dash-grid .side-stack > .panel {
  animation: risein 0.35s ease both;
}
.dash-grid .side-stack > .panel:nth-child(1) {
  animation-delay: 0.1s;
}
.dash-grid .side-stack > .panel:nth-child(2) {
  animation-delay: 0.16s;
}
.dash-grid .side-stack > .panel:nth-child(3) {
  animation-delay: 0.22s;
}
.dash-grid .side-stack > .panel:nth-child(4) {
  animation-delay: 0.28s;
}
.dash-grid .side-stack > .panel:nth-child(5) {
  animation-delay: 0.34s;
}

/* Job cards stagger within dashboard lists */
.job-list > .job-card:nth-child(1) {
  animation-delay: 0.06s;
}
.job-list > .job-card:nth-child(2) {
  animation-delay: 0.1s;
}
.job-list > .job-card:nth-child(3) {
  animation-delay: 0.14s;
}
.job-list > .job-card:nth-child(4) {
  animation-delay: 0.18s;
}
.job-list > .job-card:nth-child(5) {
  animation-delay: 0.22s;
}
.job-list > .job-card:nth-child(6) {
  animation-delay: 0.26s;
}
.job-list > .job-card:nth-child(7) {
  animation-delay: 0.3s;
}
.job-list > .job-card:nth-child(8) {
  animation-delay: 0.34s;
}
.job-list > .job-card:nth-child(9) {
  animation-delay: 0.38s;
}
.job-list > .job-card:nth-child(10) {
  animation-delay: 0.42s;
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .kpi-card {
    padding: 14px 14px;
  }
  .kpi-value {
    font-size: 24px;
  }
  .kpi-label {
    font-size: 8.5px;
    margin-bottom: 4px;
  }
  .kpi-sub {
    font-size: 11px;
  }
  .pipeline-card {
    padding: 14px 16px;
    margin-bottom: 16px;
  }
  .pipeline-legend {
    gap: 6px 12px;
  }
  .dash-grid {
    gap: 14px;
  }
}

/* ═══════════════════════════════════════════
   MY DAY DASHBOARD
═══════════════════════════════════════════ */

.myday-date-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.myday-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  flex-shrink: 0;
}
.myday-arrow:hover {
  border-color: var(--text-3);
  color: var(--text-1);
  background: var(--surface-hi);
}
.myday-date-center {
  flex: 1;
  text-align: center;
}
.myday-date-label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}

.myday-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.myday-chips {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.myday-chips::-webkit-scrollbar {
  display: none;
}
.myday-user-select {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 24px 5px 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.myday-user-select:focus {
  outline: none;
  border-color: var(--brass);
}

/* Sections */
.myday-section {
  margin-bottom: 24px;
}
.myday-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-lo);
}
.myday-section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 7px;
  line-height: 18px;
}

/* Action Items */
.myday-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.myday-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.12s;
  cursor: pointer;
}
.myday-action-item:hover {
  border-color: var(--text-3);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.myday-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.myday-dot-red {
  background: var(--red, #e74c3c);
}
.myday-dot-amber {
  background: var(--amber, #f59e0b);
}
.myday-dot-blue {
  background: #3b82f6;
}
.myday-action-body {
  flex: 1;
  min-width: 0;
}
.myday-action-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.3;
}
.myday-action-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.myday-action-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.myday-action-arrow {
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* Schedule */
.myday-schedule {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.myday-appt-block {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brass);
  border-radius: var(--r-md);
  transition: all 0.12s;
  cursor: pointer;
}
.myday-appt-block:hover {
  border-color: var(--text-3);
  border-left-color: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.myday-appt-mine {
  background: var(--surface-hi);
}
.myday-appt-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  min-width: 72px;
  padding-top: 2px;
  flex-shrink: 0;
}
.myday-appt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.myday-appt-body {
  flex: 1;
  min-width: 0;
}
.myday-appt-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.myday-appt-person {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.myday-appt-addr {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
}
.myday-appt-tags {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Empty state */
.myday-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 8px;
  color: var(--text-3);
}
.myday-empty p {
  font-size: 13px;
  margin: 0;
}

/* ─── Dashboard Mobile ─── */
@media (max-width: 768px) {
  /* Dashboard tab bar — bigger touch targets */
  .tab-bar {
    gap: 0;
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }
  .tab-bar .tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
  }

  .myday-date-nav {
    gap: 10px;
    margin-bottom: 12px;
  }
  .myday-date-label {
    font-size: 18px;
  }
  .myday-arrow {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  /* Appointment blocks */
  .myday-appt-block {
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
  }
  .myday-appt-time {
    min-width: auto;
    font-size: 11px;
  }
  .myday-action-item {
    padding: 10px 12px;
  }
  .myday-action-badge {
    font-size: 9px;
  }
}
