html,
body {
  height: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef3f9;
  color: #0f172a;
  font-family: Arial, sans-serif;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1321, #1d3557);
}

.login-page > .container {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.login-page > .container > .row {
  width: 100%;
  margin-top: 0 !important;
}

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 1100;
  color: #fff;
  background: #0f172a;
}

.sidebar-close {
  display: none;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #22c55e);
}

.brand-name {
  font-weight: 700;
}

.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  color: #dfe7ff;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.main-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  min-height: 72px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-toggle {
  border: 0;
  padding: 0.5rem;
  color: #0f172a;
  background: transparent;
  font-size: 1.25rem;
}

.page-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 1.5rem !important;
}

.page-title {
  margin: 0;
  color: #0f172a;
  font-size: 2rem;
  font-weight: 700;
}

.dashboard-grid {
  display: block;
}

.card {
  border: 0;
  border-radius: 16px;
}

.stat-card,
.summary-card,
.metric-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.stat-card .card-body {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  justify-content: center;
}

.label {
  margin-bottom: 10px;
  color: #64748b;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 2rem;
  font-weight: 700;
}

.stat-card small {
  margin-top: 8px;
  color: #64748b;
}

.section-title {
  margin-bottom: 1rem;
  color: #0f172a;
  font-weight: 700;
}

.summary-list .list-group-item,
.metric-list .list-group-item {
  padding: 0.9rem 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  border-right: 0;
  border-left: 0;
}

.summary-list .list-group-item:first-child,
.metric-list .list-group-item:first-child {
  border-top: 0;
}

.summary-list strong,
.metric-list span:last-child {
  color: #0f172a;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table th {
  white-space: nowrap;
}

.badge {
  letter-spacing: 0.02em;
}

img,
canvas,
svg {
  max-width: 100%;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 991px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: min(84vw, 300px);
    min-width: 0;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 30px rgba(15, 23, 42, 0.2);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  body.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.45);
  }

  .main-panel {
    width: 100%;
    min-height: auto;
  }

  .topbar {
    min-height: 60px;
  }

  .topbar .container-fluid {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .page-content {
    padding: 1rem !important;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .user-menu .dropdown-toggle {
    padding-right: 0;
    font-size: 0;
  }

  .user-menu .dropdown-toggle i {
    margin-right: 0 !important;
    font-size: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .table {
    min-width: 720px;
  }

  .d-flex.gap-2 {
    flex-wrap: wrap;
  }

  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .nav-link {
    white-space: nowrap;
  }

  .summary-list .list-group-item,
  .metric-list .list-group-item {
    gap: 0.75rem;
  }

  .summary-list strong,
  .metric-list span:last-child {
    overflow-wrap: anywhere;
    text-align: right;
  }

  .form-control,
  .form-select,
  .btn {
    min-height: 42px;
  }
}

@media (max-width: 575px) {
  .page-content {
    padding: 0.75rem !important;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .stat-card h3 {
    font-size: 1.65rem;
  }

  .page-content > .d-flex:first-child {
    align-items: flex-start !important;
  }

  .row {
    --bs-gutter-x: 0.85rem;
  }

  .card {
    border-radius: 12px;
  }

  .login-page > .container {
    padding: 1rem;
  }

  .login-page .card-body {
    padding: 1.25rem !important;
  }

  .login-page h2 {
    font-size: 1.5rem;
  }
}
