/* app-shell.css — the shared app FRAME for every page that mounts app-nav.js (Nov 12, 2026).

   The sidebar + top bar + page-flex layout was duplicated in each page's inline <style>; crm-ui.css
   carries the *visual* skin (colours/sizes via --sw-*) but NOT the structural rules (the flex layout,
   100vh, the box reset). tools.html copied the markup without those rules and shipped unstyled — the
   sidebar collapsed, nav items flowed inline, the shell stacked instead of sitting beside the sidebar.

   This file is that structural frame, lifted verbatim from settings.html (the canonical twin). Load it
   FIRST, before crm-ui.css, so crm-ui keeps winning the visual skin exactly as it did over the inline
   block; a page's own inline <style> still loads after this and can override any rule page-locally. */

:root { --sidebar-w: 240px; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sw-font-ui);
  font-weight: 300;
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
  padding: 3px;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo svg { color: var(--accent); }
.brand-name { font-family: var(--sw-font-display); font-size: 15px; color: var(--text); line-height: 1.2; }
.brand-sub { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-top: 2px; }

.sidebar-nav { padding: 12px 8px; flex: 1; }
.nav-section { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); padding: 8px 10px 6px; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; color: var(--text-dim); cursor: pointer;
  border-radius: var(--radius); transition: all 0.15s;
  font-size: 13px; font-weight: 400;
  border: 1px solid transparent; margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { color: var(--text); background: var(--sw-overlay-1); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-dim); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-user {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 28px; height: 28px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--accent); flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: var(--text); }
.user-role { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Main + top bar ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 52px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: var(--bg2); flex-shrink: 0;
}
.topbar-title { font-family: var(--sw-font-display); font-size: 18px; color: var(--text); }
.topbar-sep { width: 1px; height: 20px; background: var(--border); }

/* ── Mobile: the hamburger + the off-canvas sidebar ── */
.mobile-menu-btn {
  display: none;
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 6px; margin-right: 4px; align-items: center; justify-content: center;
}
.mobile-menu-btn svg { width: 20px; height: 20px; }
.mobile-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; }
.mobile-sidebar-overlay.open { display: block; }
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
}
