#sidebar {
  min-width: 190px;
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 22px 8px 10px 12px;
  box-shadow: 0 8px 40px 0 rgba(40, 90, 180, 0.08);
  border-radius: 0;
  z-index: 2;
}
.sidebar-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 68px;
  margin-bottom: 12px;
  padding: 0 8px 10px 12px;
  border-bottom: 1.2px solid #2d2d2d;
}
.sidebar-logo {
  width: 16px;
  display: block;
  margin: 0 0 10px;
}
.app-title {
  font-family: 'Inter', 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 1.23rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: #fff;
  margin-bottom: 2px;
}
.team-subtitle {
  font-size: 0.99rem;
  color: #e7e7e7;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0.93;
  margin-bottom: 3px;
}
#sidebar button {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 8px;
  transition: background 0.15s, font-weight 0.17s, color 0.16s;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 0px;
}
#sidebar button.active,
#sidebar button:hover {
  background: #fff;
  color: #111;
  font-weight: 700;
}

main {
  flex: 1;
  padding: 28px clamp(18px, 6vw, 72px) 42px clamp(18px, 6vw, 72px);
  background: #f3f5fa;
}
main#content {
    margin-left: 20px;
    padding: 12px;
    min-height: 100vh;
    background-color: #f5f5f5;
    max-width: none;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ===== MOBILE TOP BAR ===== */
#mobile-topbar {
  display: none; /* Hidden by default, shown on mobile only */
  width: 100%;
  background: #111;
  color: #fff;
  height: 60px;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  box-sizing: border-box;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1100;
  box-shadow: 0 4px 20px -4px rgba(40,90,180,0.08);
}

.mobile-topbar-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  flex: 1;
  padding-top: 4px;
}

#mobile-topbar .app-title {
  font-family: 'Inter', 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: #fff;
  margin-bottom: 0px;
  line-height: 1.07;
}

#mobile-topbar .team-subtitle {
  font-size: 0.96rem;
  color: #e7e7e7;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0.93;
  margin-top: 1px;
  line-height: 1.1;
}

#mobile-topbar #mobile-menu-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  background: #fff;
  color: #2463eb;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px 0 rgba(36,99,235,0.08);
  padding: 8px 17px;
  font-size: 1.77rem;
  cursor: pointer;
  transition: background 0.18s;
  z-index: 1150;
}

/* Show topbar and pad main content on mobile only */
@media (max-width: 700px) {
  #mobile-topbar {
    display: flex;
  }
  main#content {
    margin-top: 70px !important; /* Push content below topbar on mobile */
  }
}

/* Hide mobile topbar on desktop */
@media (min-width: 701px) {
  #mobile-topbar {
    display: none !important;
  }
}

/* Add media query for smaller screens */
@media screen and (max-width: 768px) {
    main#content {
        margin-left: 0;
        padding: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active {
        transform: translateX(0);
    }
}

/* ========== LOCKED DOWN CONTAINER FOR CONSISTENT LAYOUT ========== */
.content-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  padding-left: 0;
  padding-right: clamp(18px, 3vw, 72px);
  padding-top: 18px;
  padding-bottom: 40px;
  overflow-x: visible;
}
@media (max-width: 900px) {
  .content-container {
    padding-left: 2vw;
    padding-right: 2vw;
    max-width: 100%;
    overflow-x: auto;
  }
}
.card, .page-banner.card {
  width: 100%;
  box-sizing: border-box;
  max-width: none;
}
.card-container {
    display: grid;
    grid-gap: 12px;
    margin: 0;
    padding: 0;
}

/* ========================================= */

.page-banner {
  width: 100%;
  background: #fff;
  color: #2463eb;
  min-height: 68px;
  height: auto;
  padding: 0;
  margin: 0 0 32px 0;
  box-shadow: 0 4px 24px -4px rgba(40, 90, 180, 0.07);
  border-radius: 10px;
  display: flex;
  align-items: center;
  position: relative;
  max-width: none;
  box-sizing: border-box;
}
.page-banner h2 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #111;
  flex: 1;
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 1;
}

@media (max-width: 900px) {
  .page-banner {
    padding: 20px 8px 12px 12px;
    margin: 0 0 18px 0;
    min-height: 44px;
    max-width: 100%;
  }
  .page-banner h2 { font-size: 1.22rem; }
  #sidebar { min-width: 100px; padding: 14px 5px; }
  #sidebar button { font-size: 15px; padding: 7px 7px;}
}

/* ==== SIDEBAR & MAIN LAYOUT RESPONSIVENESS ==== */
@media (max-width: 800px) {
  #sidebar {
    width: 100%;
    min-width: 0;
    position: static;
    flex-direction: row;
    padding: 8px 0;
    height: auto;
    display: flex;
    justify-content: space-around;
    border-radius: 0 0 10px 10px;
    max-width: 100%;
    box-sizing: border-box;
  }
  #sidebar button {
    font-size: 0.96rem;
    padding: 8px 4px;
    flex: none;
    min-width: 0;
    white-space: nowrap;
  }
}

@media (max-width: 700px) {
  #sidebar {
    display: none;
  }
  main {
    padding: 12px 2vw 18px 2vw;
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Mobile Nav: Hide sidebar, show burger icon, compact menu */
@media (max-width: 700px) {
  #sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(82vw, 250px);
    max-width: 96vw;
    min-width: unset !important;
    height: auto;
    z-index: 1001;
    background: #111;
    transition: transform 0.26s cubic-bezier(.34,1.56,.64,1);
    transform: translateX(-105%);
    box-shadow: 4px 0 22px 2px rgba(0,0,0,0.14);
    gap: 0;
    box-sizing: border-box;
  }
  #sidebar.active {
    display: flex;
    transform: translateX(0%);
    flex-direction: column;
    align-items: stretch;
    padding-top: 0;
    height: auto;
    max-width: 96vw;
    min-width: unset !important;
    box-sizing: border-box;
  }
  .sidebar-header {
    height: auto;
    margin-bottom: 0;
    padding: 10px 14px 4px 18px;
    border-bottom: 1.2px solid #232323;
  }
  .sidebar-header .app-title {
    margin-bottom: 0;
    font-size: 1.07rem;
    line-height: 1.1;
  }
  .sidebar-header .team-subtitle {
    font-size: 0.91rem;
    margin-bottom: 0;
    line-height: 1.15;
  }
  #sidebar button {
    font-size: 1rem;
    padding: 12px 0 12px 22px;
    flex: none;
    min-width: 0;
    width: 100%;
    white-space: nowrap;
    border-radius: 0;
    border-bottom: 1px solid #232323;
    background: none;
    margin: 0;
    line-height: 1.2;
    height: auto;
    box-sizing: border-box;
  }
  #sidebar button:last-child {
    border-bottom: none;
  }

  #sidebar-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(36, 99, 235, 0.10);
    animation: fadeIn 0.15s;
  }
  #sidebar-overlay.active {
    display: block;
  }
  /* MOBILE CONTENT WIDTH LOCK — only for ≤700px */
  main,
  .content-container,
  .report-card,
  .settings-card,
  .card,
  .card-content,
  .table-responsive {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
  }

  /* Allow dashboard cards to grow vertically without inner scrollbars */
  .dashboard-card {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }
}

/* --- RESTORE NORMAL WIDTH ON DESKTOP --- */
@media (min-width: 701px) {
  main,
  .content-container,
  .dashboard-card,
  .report-card,
  .settings-card,
  .card,
  .card-content,
  .table-responsive {
    width: auto;
    max-width: none;
    overflow-x: visible;
  }
}

/* Desktop: Push main content right by sidebar width */
@media (min-width: 801px) {
  main {
    margin-left: 190px;
  }
}

/* On mobile (≤800px), remove margin since sidebar is not left of content */
@media (max-width: 800px) {
  main {
    margin-left: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
}

.page-banner-inner {
  width: 100%;
  padding: 0 30px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  max-width: none;
}
@media (max-width: 900px) {
  .page-banner-inner {
    padding: 12px 8px;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Keep all main content cards aligned with the header bar */
.content-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  padding-left: 0;
  padding-right: clamp(18px, 3vw, 72px);
  padding-top: 18px;
  padding-bottom: 40px;
  overflow-x: visible;
}

/* Optional: Tighter padding on mobile */
@media (max-width: 900px) {
  .content-container {
    padding-left: 2vw;
    padding-right: 2vw;
    max-width: 100%;
    overflow-x: auto;
  }
}

/* Cards and banners fill the full width of container */
.card, .page-banner.card {
  width: 100%;
  box-sizing: border-box;
  max-width: none;
}

/* Make tables responsive and prevent overflow */
.table-responsive {
  overflow-x: auto;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

#sidebar-logout {
  margin-top: auto;
  background: #f87171;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.18s;
}
#sidebar-logout:hover {
  background: #c53030;
}
