.dashboard-page {
  display: block;
}

.dashboard-page__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-lg);
  align-items: stretch;
}

/* ---------- Welcome ---------- */

.dashboard-welcome {
  grid-column: span 12;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: #fff;
}

.dashboard-welcome__intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dashboard-welcome__eyebrow {
  margin: 0;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-semibold, 600);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.dashboard-welcome__title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--font-weight-bold, 700);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-welcome__env-badge {
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-semibold, 600);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  align-self: center;
}

.dashboard-welcome__env-badge--production {
  background: color-mix(in srgb, #fff 25%, transparent);
  color: #fff;
}

.dashboard-welcome__env-badge--development {
  background: color-mix(in srgb, #fff 90%, transparent);
  color: var(--warning-color);
}

.dashboard-welcome__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: var(--space-lg);
}

.dashboard-welcome__facts app-dashboard-metric {
  --text-primary: #fff;
  --text-light: rgba(255, 255, 255, 0.75);
}

/* ---------- Shortcut / quick-action grids ---------- */

.dashboard-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

.dashboard-shortcut-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* ---------- Draft status ---------- */

.dashboard-draft__lead {
  margin: 0;
  font-size: var(--font-size-lg, 1rem);
  color: var(--text-primary);
}

.dashboard-draft__all-clear {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  font-size: var(--font-size-lg, 1rem);
  color: var(--success-color);
  font-weight: var(--font-weight-semibold, 600);
}

.dashboard-draft__fields {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.dashboard-draft__field-chip {
  font-size: var(--font-size-xs, 0.75rem);
  padding: 2px 8px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
  color: var(--primary-color);
}

.dashboard-draft__field-chip--muted {
  background: var(--bg-tertiary);
  color: var(--text-light);
}

.dashboard-draft__saved-at {
  margin: 0;
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-secondary);
}

.dashboard-draft__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

/* ---------- Documentation ---------- */

.dashboard-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-doc-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-xs) 0;
  border: none;
  background: none;
  font-size: var(--font-size-lg, 1rem);
  color: var(--text-light);
  text-align: left;
  cursor: not-allowed;

  .pi {
    color: var(--text-light);
  }
}

.dashboard-doc-list__badge {
  margin-left: auto;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-semibold, 600);
  padding: 2px 8px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  color: var(--text-light);
}

/* ---------- Responsive ---------- */

/* Tablet: the three-across health/draft/activity/doc row becomes 2 columns instead of 3. */
@media (max-width: 1023px) and (min-width: 640px) {
  .dashboard-page__grid > app-dashboard-card {
    grid-column: span 6 !important;
  }

  .dashboard-welcome__facts {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

/* Mobile: everything is a single column, nothing scrolls sideways. */
@media (max-width: 639px) {
  .dashboard-page__grid > * {
    grid-column: span 12 !important;
  }

  .dashboard-welcome {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-welcome__facts {
    grid-template-columns: 1fr;
  }

  .dashboard-shortcut-grid,
  .dashboard-shortcut-grid--compact {
    grid-template-columns: 1fr;
  }
}
