/* Shell uses the real viewport, not 100vw (100vw includes the scrollbar). */
html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

#root {
  min-height: 100%;
  max-width: 100%;
}

#root>.bg-dots,
#root>.bg-mesh {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.dashboard-main-wrapper {
  flex: 1 1 auto !important;
  width: 0 !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.sidebar {
  min-width: 0 !important;
}

/* Brand line wraps inside the 260px rail instead of clipping. */
.sidebar>div:first-child>div>div:last-child {
  min-width: 0;
  flex: 1;
}

.sidebar>div:first-child>div>div:last-child>div:first-child {
  font-size: 12px !important;
  line-height: 1.25 !important;
  white-space: normal !important;
}

.dashboard-header {
  min-width: 0 !important;
  gap: 12px;
}

.dashboard-header>div:first-child {
  min-width: 0;
  flex: 1;
}

.dashboard-header h2,
.dashboard-header p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-main {
  min-width: 0 !important;
}

.dashboard-main table {
  min-width: 860px;
}

.dashboard-main th,
.dashboard-main td {
  white-space: nowrap;
}

.dashboard-main form {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
}

.stat-cards-row-4 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

@media (max-width: 1100px) {

  .dashboard-main div[style*="grid-template-columns: 1fr 1fr"],
  .dashboard-main div[style*="grid-template-columns:1fr 1fr"],
  .dashboard-main div[style*="repeat(2"],
  .dashboard-main div[style*="repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 860px) {
  #root>.bg-dots {
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  .sidebar {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: 42vh;
    flex: 0 0 auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-subtle);
  }

  .sidebar nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px;
  }

  .sidebar nav .nav-link {
    width: auto !important;
  }

  .dashboard-main-wrapper {
    width: 100% !important;
    height: auto !important;
    flex: 1 1 auto !important;
  }

  .dashboard-header {
    height: auto !important;
    min-height: 56px !important;
    max-height: none !important;
    flex-wrap: wrap;
    padding: 10px 14px !important;
  }

  .dashboard-main {
    height: auto !important;
    max-height: none !important;
    padding: 12px !important;
  }
}