/* ---------- Layout app ---------- */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e1b4b 0%, #171442 100%);
  color: #c7d2fe;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.open { transform: none; }
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: #fff;
  flex: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .4);
}
.sidebar .brand-text { min-width: 0; }
.sidebar .brand-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar .brand-sub { font-size: 11px; color: #818cf8; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 10px; }
.sidebar nav .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #c7d2fe;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  position: relative;
  transition: background .15s, color .15s;
}
.sidebar nav .nav-item::before {
  content: '';
  position: absolute;
  left: -10px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #818cf8, #a78bfa);
  opacity: 0;
  transition: opacity .15s;
}
.sidebar nav .nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav .nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .35), rgba(99, 102, 241, .12));
  color: #fff; font-weight: 600;
}
.sidebar nav .nav-item.active::before { opacity: 1; }
.sidebar nav .nav-item .nav-ico {
  width: 20px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  color: #818cf8;
}
.sidebar nav .nav-item.active .nav-ico { color: #fff; }
.sidebar .nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #818cf8;
  padding: 14px 12px 6px;
}

.sidebar .sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .06);
  margin-bottom: 6px;
}
.sidebar .user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.sidebar .user-meta { overflow: hidden; }
.sidebar .user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-role { font-size: 11px; color: #818cf8; }
.sidebar .btn {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  color: #c7d2fe;
  border-color: transparent;
}
.sidebar .btn:hover { background: rgba(220, 38, 38, .25); color: #fff; }

.main {
  margin-left: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mob-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.mob-topbar .menu-btn {
  display: flex;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; color: var(--text);
}
.mob-topbar .menu-btn:hover { background: var(--surface-2); }
.mob-topbar .mob-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.content { flex: 1; padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head p { color: var(--text-2); margin-top: 2px; }

.scrim {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity .2s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(99, 102, 241, .18), transparent),
    radial-gradient(800px 400px at -10% 100%, rgba(139, 92, 246, .15), transparent),
    var(--bg);
}
.login-deco { position: absolute; inset: 0; pointer-events: none; }
.login-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, .12);
}
.login-ring.r1 { width: 520px; height: 520px; top: -180px; right: -120px; }
.login-ring.r2 { width: 380px; height: 380px; bottom: -140px; left: -100px; border-color: rgba(139, 92, 246, .12); }
.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.login-sub { color: var(--text-2); margin: 2px 0 18px; font-size: 13.5px; }
.login-card .btn { margin-top: 4px; }
.error-msg {
  display: none;
  background: var(--danger-050);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, .2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.error-msg.show { display: block; }

/* ---------- Responsive ---------- */
@media (min-width: 900px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--sidebar-w); }
  .mob-topbar { display: none; }
  .scrim { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 14px; }
  .page-head h1 { font-size: 18px; }
  .mob-topbar { padding: 0 12px; }
}
