:root { --radius: 14px; }

.card { border-radius: var(--radius); }
.form-control, .form-select, .btn { border-radius: 12px; }
.small-muted { color:#6c757d; font-size:.9rem; }

/* Sidebar styling (works for both desktop + offcanvas) */
.sidebar {
  width: 260px;
}

.sidebar .nav-link {
  border-radius: 12px;
  padding: .6rem .8rem;
}

.sidebar .nav-link.active {
  background: rgba(13,110,253,.12);
  color: #0d6efd;
  font-weight: 600;
}

/* Desktop layout: sticky sidebar */
@media (min-width: 992px) { /* lg */
  .sidebar-desktop {
    position: sticky;
    top: 0;
    height: 100vh;
  }
}

/* Desktop collapsible sidebar */
.app-shell {
  display: flex;
  min-height: calc(100vh - 56px); /* 56px approx navbar height */
}

.sidebar-wrap {
  width: 260px;
  transition: width .2s ease;
}

.sidebar-inner {
  width: 260px;
}

.app-shell.is-collapsed .sidebar-wrap {
  width: 0;
}

.app-shell.is-collapsed .sidebar-inner {
  opacity: 0;
  pointer-events: none;
}

/* Make sure main grows */
.main-wrap {
  flex: 1;
  min-width: 0;
}

/* Smooth hide */
.sidebar-inner {
  transition: opacity .15s ease;
}

/* =========================
   APP BRAND / NAVBAR
========================= */
.app-topbar {
  min-height: 72px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.app-brand {
  text-decoration: none;
  min-width: 0;
}

.app-brand-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  flex-shrink: 0;
}

.app-brand-text {
  min-width: 0;
  line-height: 1.15;
}

.app-brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: #212529;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-brand-subtitle {
  font-size: 0.83rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-user-box {
  min-width: 0;
}

.app-user-meta {
  line-height: 1.15;
}

.app-user-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #212529;
  white-space: nowrap;
}

.app-user-role {
  margin-top: 0.2rem;
}

.app-nav-toggle {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   MOBILE
========================= */
@media (max-width: 991.98px) {
  .app-topbar {
    min-height: 64px;
  }

  .app-brand {
    gap: 0.65rem !important;
    max-width: calc(100vw - 150px);
  }

  .app-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .app-brand-title {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-brand-subtitle {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 575.98px) {
  .app-topbar .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .app-brand {
    max-width: calc(100vw - 120px);
  }

  .app-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .app-brand-title {
    font-size: 0.86rem;
  }

  .app-brand-subtitle {
    display: none;
  }

  .app-nav-toggle {
    min-width: 36px;
    min-height: 36px;
    padding: 0.25rem 0.5rem;
  }
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,.1);
}

.nav-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.login-logo {
  max-height: 80px;
  object-fit: contain;
}