/* ──────────────────────────────────────────────────────────────
   Velour — Layout (shell, topbar, sidebar, content)
   ────────────────────────────────────────────────────────────── */

.app-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
}
.topbar-brand {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--primary);
  white-space: nowrap;
}
.topbar-left  { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-signout-form { display: inline; margin: 0; }
.btn-topbar-signout {
  color: var(--danger) !important;
  border-color: var(--danger-border) !important;
  background: transparent !important;
  font-weight: 600;
}
.btn-topbar-signout:hover {
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
}

.topbar-sep   { width: 1px; height: 1.25rem; background: var(--border); flex-shrink: 0; }
.topbar-role  {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6875rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.topbar-ctx   {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.notif-btn {
  position: relative;
  width: 2.25rem; height: 2.25rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem; color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.notif-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: var(--accent); color: var(--accent-fg);
  font-size: 0.625rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}

/* ── Main body layout ────────────────────────────────────────── */
.app-body { display: flex; flex: 1; min-height: 0; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}
.sidebar-nav { padding: 1.25rem 0.75rem; flex: 1; }
.nav-group-label {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 0 0.875rem;
  margin: 1rem 0 0.5rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-input);
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active {
  color: var(--primary);
  background: var(--primary-bg);
  font-weight: 600;
}
.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0; opacity: 0.4;
}
.nav-item.active .nav-dot { opacity: 1; background: var(--primary); }
.nav-notif-count {
  margin-left: auto;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-fg);
  font-size: 0.625rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

/* ── Content area ────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 2.5rem 2.5rem 3rem;
  overflow-y: auto;
  max-width: 100%;
  min-width: 0;
}
.content-inner { max-width: var(--content-max); margin: 0 auto; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.page-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    display: none;
    position: fixed; top: var(--topbar-height); left: 0;
    width: 260px; height: calc(100vh - var(--topbar-height));
    z-index: 90;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { display: flex; }

  .topbar-brand { font-size: 1rem; letter-spacing: 0.16em; }
  .topbar-ctx { display: none; }
  .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .topbar-left  { gap: 0.5rem; }
  .topbar-right { gap: 0.375rem; }
  .topbar-role  { padding: 0.2rem 0.5rem; font-size: 0.625rem; }

  .content { padding: 1.25rem 1.25rem 2rem; }

  .menu-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--surface); cursor: pointer;
    color: var(--muted); font-size: 1rem;
  }
}

@media (min-width: 769px) {
  .menu-toggle { display: none; }
  .sidebar-overlay { display: none !important; }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 89;
  background: rgba(20, 25, 22, 0.35);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }
