/* ── Layout principale ───────────────────────────────────────────────────────── */

/* App screen */
.app-screen { flex-direction: row; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width .25s ease;
  overflow: hidden;
}

.sidebar.mini { width: var(--sidebar-w-mini); }

/* Logo */
.sb-logo {
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-logo-icon {
  width: 32px; height: 32px;
  background: var(--blue-800);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sb-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
  white-space: nowrap;
}
.sb-logo-sub {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 1px;
  white-space: nowrap;
}

/* User info */
.sb-user {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sb-avatar {
  width: 34px; height: 34px;
  background: var(--blue-700);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.sb-user-name {
  font-size: 12px; font-weight: 600;
  color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-role {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Nav */
.sb-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-section {
  padding: 10px 16px 4px;
  font-size: 10px; font-weight: 700;
  color: var(--gray-600);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  color: var(--gray-500);
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover  { background: rgba(255,255,255,.05); color: var(--white); }
.nav-item.active {
  background: rgba(0,87,168,.25);
  color: var(--white);
  border-left-color: var(--blue-600);
}
.nav-icon  { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-label { font-size: 13px; font-weight: 500; white-space: nowrap; }
.nav-badge {
  margin-left: auto;
  background: var(--red-700);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* Footer sidebar */
.sb-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-footer-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: none; border: none;
  color: var(--gray-500);
  font-size: 13px;
  transition: var(--transition);
  width: 100%;
  white-space: nowrap;
}
.sb-footer-btn:hover { background: rgba(255,255,255,.05); color: var(--white); }

/* Toggle sidebar mini */
.sb-toggle {
  position: absolute;
  right: -12px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  background: var(--blue-800);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 101;
  box-shadow: var(--shadow);
}

/* ── Main content ─────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.main.expanded { margin-left: var(--sidebar-w-mini); }

/* ── Topbar ───────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}
.breadcrumb {
  display: flex; align-items: center;
  gap: 6px; font-size: 13px;
  flex: 1; min-width: 0;
}
.bc-item    { color: var(--gray-400); white-space: nowrap; }
.bc-sep     { color: var(--gray-300); font-size: 10px; }
.bc-current { color: var(--gray-800); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Clock */
.topbar-clock {
  font-size: 12px;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 4px 10px;
  background: var(--gray-100);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

/* ── Monitoring bar ───────────────────────────────────────────────────────────── */
.mon-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  transition: var(--transition);
}
.mon-bar.active {
  background: var(--green-100);
  border-bottom-color: #86efac;
}
.mon-left  { display: flex; align-items: center; gap: 12px; }
.mon-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.toggle {
  width: 44px; height: 24px;
  border-radius: 99px;
  border: none;
  position: relative;
  transition: background .25s;
  flex-shrink: 0;
  padding: 0;
}
.toggle-knob {
  position: absolute;
  top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.int-btn {
  padding: 4px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
}
.int-btn:hover  { border-color: var(--blue-700); color: var(--blue-700); }
.int-btn.active { background: var(--blue-800); color: white; border-color: var(--blue-800); }

/* ── Page content ─────────────────────────────────────────────────────────────── */
.page-content { padding: 20px; flex: 1; }

/* ── Auth screens ─────────────────────────────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(160deg, #003670 0%, #0057A8 50%, #1A6DC4 100%);
  align-items: center;
  justify-content: center;
  padding: 24px;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(255,255,255,.04) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  justify-content: center;
}
.logo-icon {
  width: 48px; height: 48px;
  background: var(--blue-800);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.logo-text { font-size: 26px; font-weight: 700; color: var(--gray-900); letter-spacing: -.5px; }
.auth-title { font-size: 20px; font-weight: 700; color: var(--gray-900); text-align: center; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--gray-500); text-align: center; margin-bottom: 22px; }

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media(max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main    { margin-left: 0 !important; }
}
@media(max-width: 600px) {
  .topbar       { padding: 0 12px; }
  .page-content { padding: 12px; }
  .auth-card    { padding: 24px 18px; }
  .mon-bar      { padding: 10px 12px; }
}
