/* ═══════════════════════════════════════════════
   LAYOUT — App shell, sidebar, topbar, content.
   Handles the top-level structural skeleton only.
   ═══════════════════════════════════════════════ */

/* ─── App Shell ─── */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ══════════════════════════
   SIDEBAR
══════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--abyss);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-sidebar);
  /* Transition for mobile slide-in */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

:root.dark .sidebar { box-shadow: none; }

/* Ambient top-glow decoration */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 300px;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.06) 0%, transparent 70%);
  pointer-events: none;
}
:root:not(.dark) .sidebar::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(154,111,30,0.05) 0%, transparent 70%);
}

/* ─── Brand ─── */
.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold) 0%, #8b6914 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--void);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  padding-left: 42px;
}

/* ─── Nav Sections ─── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section {
  padding: 16px 0 8px;
}

.sidebar-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0 20px;
  margin-bottom: 6px;
}

/* ─── Nav Items ─── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.04); }
:root:not(.dark) .nav-item:hover { background: rgba(0,0,0,0.03); }

.nav-item.active { background: var(--gold-dim); }

/* Active accent bar */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  flex-shrink: 0;
  font-size: 14px;
}

.nav-item.active .nav-icon      { background: var(--gold-dim); color: var(--gold); }
.nav-item:not(.active) .nav-icon { color: var(--text-muted); }

.nav-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  transition: color 0.15s;
}

.nav-item.active .nav-text { color: var(--gold-light); }
.nav-item:hover  .nav-text { color: var(--text-primary); }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* ─── Sidebar Bottom ─── */
.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #2c3e80 0%, #1a2660 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  flex-shrink: 0;
  border: 1px solid var(--gold-dim);
}

.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

/* ─── Mobile Sidebar Toggle (hamburger) ─── */
.sidebar-toggle {
  display: none; /* shown via responsive.css */
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  flex-shrink: 0;
  padding: 0;
}

.sidebar-toggle:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
  background: var(--surface2);
}

/* ─── Mobile Sidebar Overlay ─── */
.sidebar-overlay {
  display: none; /* shown via responsive.css */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ══════════════════════════
   MAIN COLUMN
══════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0; /* prevent flex blow-out */
}

/* ══════════════════════════
   TOPBAR
══════════════════════════ */
.topbar {
  height: var(--header-h);
  background: var(--abyss);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 4px;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; min-width: 0; }

.topbar-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  flex-shrink: 0;
}

.topbar-btn:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
  background: var(--surface2);
}

.topbar-btn.has-alert { position: relative; }
.topbar-btn.has-alert::after {
  content: '';
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  position: absolute;
  top: 6px; right: 6px;
  border: 1.5px solid var(--abyss);
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding: 0 12px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

/* ══════════════════════════
   CONTENT AREA
══════════════════════════ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--void);
  position: relative;
}

/* Decorative radial glow */
.content::before {
  content: '';
  position: fixed;
  top: 0; right: 0;
  width: 600px; height: 600px;
  background: radial-gradient(ellipse at 100% 0%, rgba(201,168,76,0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

:root:not(.dark) .content::before {
  background: radial-gradient(ellipse at 100% 0%, rgba(154,111,30,0.03) 0%, transparent 60%);
}

/* ─── Screens (routed views) ─── */
.screen { display: none; }
.screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
