/* ── APP SHELL ── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
.sidebar-brand {
  padding: 1.2rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-brand .brand-logo { font-size: 22px; margin-bottom: .3rem; }
.sidebar-brand h2 { font-size: 15px; font-weight: 700; white-space: nowrap; }
.sidebar-brand .role-badge {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 99px; margin-top: .3rem;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.8);
}
.sidebar-nav { flex: 1; padding: .6rem 0; overflow-y: auto; }
.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: rgba(255,255,255,.3); padding: .75rem 1.25rem .3rem;
  text-transform: uppercase; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 1.25rem; font-size: 13.5px; font-weight: 500;
  color: rgba(255,255,255,.72); cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent; white-space: nowrap;
  user-select: none;
}
.nav-item:hover  { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; border-left-color: #60a5fa; }
.nav-item .ni    { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: .9rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-footer .sf-name  { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .sf-email { font-size: 11px; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.btn-logout {
  margin-top: .7rem; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.75); cursor: pointer; transition: all var(--transition);
}
.btn-logout:hover { background: rgba(220,38,38,.3); border-color: rgba(220,38,38,.4); color: #fff; }

/* ── MAIN CONTENT ── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h); flex-shrink: 0;
}
.topbar-left .tb-title { font-size: 17px; font-weight: 700; color: var(--primary-dark); }
.topbar-left .tb-sub   { font-size: 11.5px; color: var(--gray-400); margin-top: 1px; }
.topbar-right { display: flex; gap: .5rem; align-items: center; }
.page-body { flex: 1; padding: 1.5rem; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a3558 0%, #2563a8 100%);
  padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 16px;
  padding: 2.5rem 2rem; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card .lc-brand { text-align: center; margin-bottom: 2rem; }
.login-card .lc-brand .lc-ico { font-size: 44px; }
.login-card .lc-brand h1 { font-size: 21px; font-weight: 700; color: var(--primary-dark); margin-top: .4rem; }
.login-card .lc-brand p  { font-size: 13px; color: var(--gray-400); margin-top: .25rem; }
.login-footer { text-align: center; font-size: 11.5px; color: var(--gray-400); margin-top: 1.25rem; }
.login-footer b { color: var(--gray-500); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 58px; }
  .sidebar-brand h2,
  .nav-item span:not(.ni),
  .nav-group-label,
  .sidebar-footer .sf-name,
  .sidebar-footer .sf-email,
  .btn-logout span { display: none; }
  .nav-item { justify-content: center; padding: 12px; border-left-width: 0; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: #60a5fa; border-left: none; }
  .sidebar-brand { padding: .9rem .7rem; text-align: center; }
  .sidebar-footer { padding: .6rem .4rem; }
  .btn-logout { padding: 7px; }
  .page-body { padding: 1rem .75rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}