.dashboard-container {
  padding: 0.25rem 0.5rem 0.25rem;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-background-secondary) 0%, var(--color-background-tertiary) 100%);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dashboard-container::-webkit-scrollbar {
  display: none;
}

:root.dark .dashboard-container,
:root.auto.dark .dashboard-container {
  background: linear-gradient(135deg, var(--color-background-primary) 0%, var(--color-background-secondary) 100%);
}

.dashboard-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.15) 1px, transparent 0);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0.5;
}

:root.dark .dashboard-container::before,
:root.auto.dark .dashboard-container::before {
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
  opacity: 0.3;
}

.dashboard-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.3) 20%,
    rgba(16, 185, 129, 0.3) 50%,
    rgba(139, 92, 246, 0.3) 80%,
    transparent 100%
  );
  z-index: 0;
}

.metrics-overview {
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(280px, auto);
  gap: 0.375rem;
  max-width: 1600px;
  margin: 0 auto;
  flex: 1;
  position: relative;
  z-index: 1;
  align-items: stretch;
  align-content: start;
  min-height: 0;
  width: 100%;
  padding: 0;
}

.dashboard-grid.three-column {
  display: grid;

  grid-template-columns: 1fr 1fr 1.2fr;
  grid-template-rows: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 0.5rem;
  min-height: min-content;
  align-items: stretch;
  padding: 0.25rem;
}

@media (max-width: 1200px) {
  .dashboard-grid.three-column {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, minmax(280px, auto));
    gap: 0.5rem;
    min-height: auto;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(5) {
    grid-column: 1 / span 2;
    grid-row: 3;
    min-height: 280px;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 0.25rem;
  }

  .dashboard-grid,
  .dashboard-grid.three-column {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0.375rem;
    padding: 0;
  }

  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(1),
  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(2),
  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(3),
  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(4),
  .dashboard-grid.three-column .dashboard-card-wrapper:nth-child(5) {
    grid-column: 1;
    grid-row: auto;
    min-height: 240px;
  }
}

.metrics-card {
  grid-column: span 1;
}

.status-card {
  grid-column: span 1;
}

.dashboard-grid:has(.metrics-card) {
  grid-template-columns: repeat(2, 1fr);
}
.dashboard-card-wrapper > * {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-card-wrapper {
  min-height: 280px;
  max-height: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 16px;
  background: transparent;
}

.dashboard-card-wrapper:hover {
  background: rgba(255, 255, 255, 0.5);
}

.dashboard-card-wrapper:hover > * {
  border-color: rgba(59, 130, 246, 0.3);
}

:root.dark .dashboard-card-wrapper:hover > *,
:root.auto.dark .dashboard-card-wrapper:hover > * {
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6), 0 8px 16px -5px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dashboard-grid > *:nth-child(1),
.dashboard-grid > *:nth-child(2) {
  min-height: auto;
}

.dashboard-grid > *:nth-child(3),
.dashboard-grid > *:nth-child(4) {
  min-height: auto;
}

.dashboard-grid:focus-within > *:not(:focus-within) {
  opacity: 0.7;
}

.dashboard-grid > *:focus-within {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: 4px;
  border-radius: 20px;
}

@media (max-width: 1400px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: min-content;
    max-width: 1200px;
    gap: 0.75rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

@media (max-width: 1200px) {
  .dashboard-container {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    gap: 0.75rem;
    max-width: 100%;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .dashboard-header {
    margin-bottom: 0.75rem;
  }

  .dashboard-title {
    font-size: 1.75rem;
  }

  .dashboard-subtitle {
    font-size: 0.9375rem;
  }
}

@media (max-width: 900px) {
  .dashboard-grid.two-column {
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .dashboard-grid {
    gap: 0.5rem;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    max-width: 100%;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .dashboard-header {
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
  }

  .dashboard-title {
    font-size: 1.5rem;
  }

  .dashboard-subtitle {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .dashboard-grid {
    gap: 0.5rem;
    grid-auto-rows: min-content;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .dashboard-header {
    margin-bottom: 0.5rem;
  }

  .dashboard-title {
    font-size: 1.25rem;
  }

  .dashboard-subtitle {
    font-size: 0.8125rem;
  }

  .dashboard-grid > *:hover {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-container::before,
  .dashboard-container::after,
  .dashboard-grid > *,
  .dashboard-grid > *:hover,
  .dashboard-grid:focus-within > *:not(:focus-within) {
    animation: none;
    transition: none;
    transform: none;
  }
}

.dashboard-header {
  text-align: center;
  margin-bottom: 1rem;
  padding: 0 1rem;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  line-height: 1.2;
}

.dashboard-subtitle {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 0;
  font-weight: 400;
  opacity: 0.8;
  line-height: 1.4;
}

:root.dark .dashboard-subtitle,
:root.auto.dark .dashboard-subtitle {
  color: var(--color-text-secondary);
}

@media (max-width: 768px) {
  .dashboard-header {
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
  }

  .dashboard-title {
    font-size: 2rem;
  }

  .dashboard-subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .dashboard-header {
    margin-bottom: 1rem;
  }

  .dashboard-title {
    font-size: 1.75rem;
  }

  .dashboard-subtitle {
    font-size: 0.9375rem;
  }
}

.dashboard-grid {
  contain: layout style;
  will-change: transform;
}

.dashboard-grid > * {
  contain: layout style paint;
}
