/* ─────────────────────────────────────────────────────────────
   Left nav rail. Primary navigation for ARC.
   ───────────────────────────────────────────────────────────── */

.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Nav rail (left sidebar) ──────────────────────────────── */
.nav-rail {
  width: 260px; min-width: 260px; background: var(--bg-canvas);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width var(--t-base) var(--ease), min-width var(--t-base) var(--ease);
}
.nav-rail.collapsed { width: 64px; min-width: 64px; }
.nav-rail.collapsed .nav-label,
.nav-rail.collapsed .nav-group-title,
.nav-rail.collapsed .nav-rail-footer-text,
.nav-rail.collapsed .tenant-name,
.nav-rail.collapsed .tenant-plan { display: none; }
.nav-rail.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.nav-rail.collapsed .nav-item .nav-icon-wrap { margin-right: 0; }
.nav-rail.collapsed .tenant-selector { padding: 12px 8px; }
.nav-rail.collapsed .tenant-pill { justify-content: center; padding: 8px; }
.nav-rail.collapsed .tenant-pill .tenant-chevron { display: none; }

/* ── Brand header ─────────────────────────────────────────── */
.nav-rail-header {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.brand-lockup { display: flex; align-items: baseline; gap: 8px; }
.brand-name {
  font-family: var(--font-display); font-size: 22px; font-weight: 400;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.brand-product {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--accent-text); letter-spacing: 0.04em;
}
.collapse-btn {
  background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; padding: 4px; border-radius: var(--r-xs);
  transition: color var(--t-instant) var(--ease);
  display: flex; align-items: center; justify-content: center;
}
.collapse-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Tenant selector ──────────────────────────────────────── */
.tenant-selector { padding: 12px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tenant-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--bg-hover); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; width: 100%;
  transition: all var(--t-fast) var(--ease);
}
.tenant-pill:hover { border-color: var(--line-strong); background: var(--bg-active); }
.tenant-avatar {
  width: 28px; height: 28px; border-radius: var(--r-xs);
  background: var(--accent-bg-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: var(--accent-text); flex-shrink: 0;
}
.tenant-info { flex: 1; min-width: 0; }
.tenant-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tenant-plan {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-tertiary); text-transform: uppercase;
}
.tenant-chevron { color: var(--text-quaternary); flex-shrink: 0; }

/* ── Nav groups + items ───────────────────────────────────── */
/* The nav list is the only scrollable region of the rail, so every plane
   (incl. Foundation) stays reachable when the items exceed the viewport. The
   header/tenant/footer are pinned (flex-shrink:0); min-height:0 lets this flex
   child shrink below its content height so overflow-y actually scrolls. */
.nav-section { padding: 8px 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.nav-group-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-quaternary);
  padding: 12px 8px 6px; margin: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: var(--r-sm); color: var(--text-secondary);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all var(--t-instant) var(--ease);
  position: relative; border: none; background: none;
  width: 100%; text-align: left; font-family: var(--font-body);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--accent-text);
}
.nav-icon-wrap { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; display: flex; align-items: center; }
.nav-item.active .nav-icon-wrap { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-full);
  background: var(--danger-bg); color: var(--danger-text);
  font-family: var(--font-mono);
}

/* ── Footer ───────────────────────────────────────────────── */
.nav-rail-footer {
  padding: 12px 20px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}
.nav-rail-footer-text {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-tertiary);
}

/* ── Main area (right of rail) ────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Top bar ──────────────────────────────────────────────── */
.topbar {
  height: 56px; min-height: 56px; background: var(--bg-canvas);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.breadcrumb-item { color: var(--text-tertiary); }
.breadcrumb-sep { color: var(--text-quaternary); font-size: 11px; }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Search */
.search-box {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--bg-app); border: 1px solid var(--line);
  border-radius: var(--r-sm); width: 280px;
  transition: all var(--t-fast) var(--ease); cursor: text;
}
.search-box:hover { border-color: var(--line-strong); }
.search-box:focus-within { border-color: var(--accent-text); box-shadow: var(--ring); }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-body);
  font-size: 13px; width: 100%;
}
.search-box input::placeholder { color: var(--text-quaternary); }
.search-kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 2px 5px; background: var(--bg-hover);
  border: 1px solid var(--line-strong); border-radius: var(--r-xs);
  color: var(--text-tertiary);
}

/* Theme toggle */
.theme-toggle {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-app); border: 1px solid var(--line); border-radius: var(--r-full);
}
.theme-toggle button {
  border: 0; background: transparent; cursor: pointer;
  padding: 5px 10px; border-radius: var(--r-full);
  font-family: var(--font-body); font-size: 11px; font-weight: 500;
  color: var(--text-tertiary); transition: all var(--t-fast) var(--ease);
}
.theme-toggle button:hover { color: var(--text-primary); }
.theme-toggle button.active { background: var(--accent-bg-strong); color: var(--accent-text); font-weight: 600; }

/* User avatar */
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: var(--accent-bg-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--accent-text);
  cursor: pointer; border: 2px solid transparent;
  transition: border-color var(--t-fast) var(--ease);
}
.user-avatar:hover { border-color: var(--accent-border); }

/* Notification bell */
.notif-btn {
  position: relative; background: none; border: none;
  color: var(--text-tertiary); cursor: pointer; padding: 6px;
  border-radius: var(--r-sm); transition: all var(--t-instant) var(--ease);
  display: flex; align-items: center;
}
.notif-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger-text); border: 2px solid var(--bg-canvas);
}

/* ── Content area ─────────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* View header pattern */
.view-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
}
.view-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; color: var(--text-primary); }
.view-subtitle { font-size: 14px; color: var(--text-secondary); margin: 0; }
