diff --git a/docs/ui/navigation-patterns.md b/docs/ui/navigation-patterns.md
index acf0a5f..fd561ce 100644
--- a/docs/ui/navigation-patterns.md
+++ b/docs/ui/navigation-patterns.md
@@ -7,8 +7,16 @@ Use one of two patterns for every new interaction:
## Application shell
-- Desktop uses one fixed role navigation: `15rem` expanded and `4rem`
- collapsed. Collapse preference persists.
+- Desktop uses one fixed role navigation: `260px` expanded and a `56px`
+ icon rail collapsed. Collapse preference persists. The collapse toggle sits
+ in the sidebar footer beside the account chip (stacked above the avatar on
+ the rail), off the pointer's path from the nav to the page.
+- The rail: 36px square hit areas with centred icons, a label tooltip on the
+ right for every control, a hairline instead of section headers, and the
+ active item marked by its tint plus a bar on the rail's outer edge. The
+ sidebar's logo row matches the top header (49px) so their hairlines meet.
+- The school name opens the top header as account context, "School / Page",
+ muted and truncated; the sidebar names it only in the logo's tooltip.
- Everything comes from `src/components/layout/nav-items.ts`: a group tree
per role (`ADMIN_GROUPS` for manager and admin, `TEACHER_GROUPS`,
`STUDENT_GROUPS`, `PARENT_GROUPS`), filtered by role (`minRole`,
diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx
index 0886ae8..bcb1b62 100644
--- a/src/components/layout/app-shell.tsx
+++ b/src/components/layout/app-shell.tsx
@@ -15,7 +15,9 @@ import { ShellMessagesButton } from "@/components/layout/shell-messages-button";
import { MobileNavSheet } from "@/components/layout/mobile-nav-sheet";
import { SideNav } from "@/components/layout/side-nav";
import { SidebarAccount } from "@/components/layout/sidebar-account";
-import { IconPanelLeft, IconSparkles } from "@/components/ui/icons";
+import { IconSparkles } from "@/components/ui/icons";
+import { TooltipTrigger } from "@/components/ui/tooltip";
+import { RailTip } from "@/components/layout/rail-tip";
import { Toaster } from "@/components/ui/toast";
import { useAuth } from "@/stores/auth-context";
import { useModules } from "@/stores/modules-context";
@@ -30,7 +32,8 @@ import { createMediaQuery } from "@/lib/create-media-query";
import { ModuleGate } from "@/components/layout/module-gate";
const SIDEBAR_EXPANDED = "w-[260px]";
-const SIDEBAR_COLLAPSED = "w-24";
+// 56px: the icon rail, in the 48–56px band Linear and shadcn's icon mode use.
+const SIDEBAR_COLLAPSED = "w-14";
export function AppShell(props: ParentProps) {
const auth = useAuth();
@@ -42,6 +45,7 @@ export function AppShell(props: ParentProps) {
const [mobileOpen, setMobileOpen] = createSignal(false);
const [profileOpen, setProfileOpen] = createSignal(false);
const collapsed = () => prefs.sidebarCollapsed();
+ const brandLabel = () => (school.name() ? `${t("app.name")} · ${school.name()}` : t("app.name"));
const location = useLocation();
const fullScreen = () => location().pathname.startsWith("/exam-room/");
// Below lg the header gives way to the floating action button. Chosen in
@@ -105,29 +109,34 @@ export function AppShell(props: ParentProps) {
collapsed() ? SIDEBAR_COLLAPSED : SIDEBAR_EXPANDED,
)}
>
+ {/* Same box as the top header (49px, pt-1.5, border-border/70), so
+ the two hairlines run as one line across the page in both
+ sidebar states. */}
@@ -138,21 +147,7 @@ export function AppShell(props: ParentProps) {
/>
-
-
- {/* Collapse toggle rides the corner where the sidebar's right edge
- meets the header's bottom border. */}
-
-
+ prefs.toggleSidebar()} />
@@ -171,7 +166,18 @@ export function AppShell(props: ParentProps) {
-
+
+ {/* Account context first, Cloudflare-style: "School / Page". */}
+
+ {(name) => (
+ <>
+
+ {name()}
+
+ /
+ >
+ )}
+
{/* The page's h1 unless the page renders its own. */}
) {
+ return (
+ // `open={false}` as well as `disabled`: a tip already open when the rail
+ // expands (the collapse toggle, clicked) must close, not linger.
+
+ {props.children}
+ {props.label}
+
+ );
+}
diff --git a/src/components/layout/side-nav.tsx b/src/components/layout/side-nav.tsx
index ba5486c..0b2af59 100644
--- a/src/components/layout/side-nav.tsx
+++ b/src/components/layout/side-nav.tsx
@@ -3,6 +3,8 @@ import { Link, useNavigate, useRouterState } from "@tanstack/solid-router";
import { HOME_ITEM, routeNavItem, visibleNavGroups, type NavGroup, type NavItem } from "@/components/layout/nav-items";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { IconChevronRight } from "@/components/ui/icons";
+import { TooltipTrigger } from "@/components/ui/tooltip";
+import { RailTip } from "@/components/layout/rail-tip";
import { cn } from "@/lib/cn";
import { useAuth } from "@/stores/auth-context";
import { useModules } from "@/stores/modules-context";
@@ -11,6 +13,15 @@ import { useT } from "@/stores/preferences-context";
const FOLDED_KEY = "hezarfen.navFolded";
+// The collapsed rail: one square hit area per control, icon dead centre, and
+// the active control marked twice — the tinted square plus a bar on the rail's
+// outer edge — because an icon alone carries no label to read the state from.
+const RAIL_ITEM =
+ "relative mx-auto flex size-9 shrink-0 items-center justify-center rounded-lg outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring";
+const RAIL_ACTIVE =
+ "bg-primary/10 text-primary-text before:absolute before:-left-2.5 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-primary";
+const RAIL_IDLE = "text-muted-foreground hover:bg-muted/70 hover:text-foreground";
+
function readFolded(): Record {
try {
const parsed: unknown = JSON.parse(localStorage.getItem(FOLDED_KEY) ?? "{}");
@@ -81,26 +92,40 @@ export function SideNav(props: {
{(item) => {
const active = () => current()?.id === item.id;
return (
- props.onNavigate?.()}
- title={t(item.labelKey)}
- aria-current={active() ? "page" : undefined}
- class={cn(
- "relative flex h-[34px] items-center rounded-lg text-[13px] font-medium outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring",
- props.collapsed ? "mx-auto h-10 w-12 justify-center px-0" : "gap-3 px-3",
- active()
- ? "bg-primary/10 text-primary-text"
- : "text-muted-foreground hover:bg-muted/70 hover:text-foreground",
- )}
- >
-
- {t(item.labelKey)}
-
+
+ props.onNavigate?.()}
+ title={props.collapsed ? undefined : t(item.labelKey)}
+ aria-label={props.collapsed ? t(item.labelKey) : undefined}
+ aria-current={active() ? "page" : undefined}
+ class={cn(
+ props.collapsed
+ ? cn(RAIL_ITEM, active() ? RAIL_ACTIVE : RAIL_IDLE)
+ : cn(
+ "relative flex h-[34px] items-center gap-3 rounded-lg px-3 text-[13px] font-medium outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring",
+ active()
+ ? "bg-primary/10 text-primary-text"
+ : "text-muted-foreground hover:bg-muted/70 hover:text-foreground",
+ ),
+ )}
+ >
+
+
+ {t(item.labelKey)}
+
+
+
);
}}
+ {/* The rail has no section headers to read, so a hairline separates
+ Home from the section menus instead. */}
+ 0}>
+
+
{(group) => {
const active = () => group.items.some((item) => current()?.id === item.id);
@@ -176,20 +201,16 @@ export function SideNav(props: {
}
>
-
-
-
-
-
+
+
+
+
+
+
{t(group.labelKey)}
diff --git a/src/components/layout/sidebar-account.tsx b/src/components/layout/sidebar-account.tsx
index 4c97ae9..25aee99 100644
--- a/src/components/layout/sidebar-account.tsx
+++ b/src/components/layout/sidebar-account.tsx
@@ -8,24 +8,51 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { IconChevronRight, IconLogout } from "@/components/ui/icons";
+import { IconChevronRight, IconLogout, IconPanelLeft } from "@/components/ui/icons";
+import { TooltipTrigger } from "@/components/ui/tooltip";
+import { RailTip } from "@/components/layout/rail-tip";
import { accountDisplayName, createAccountMenu } from "@/components/layout/account-menu";
import { ThemeModeControl } from "@/components/layout/theme-mode-control";
import { UserAvatar } from "@/components/users/user-avatar";
import { useT } from "@/stores/preferences-context";
import { cn } from "@/lib/cn";
-/** Desktop sidebar footer: the account chip and its dropdown. Phones reach
- * the same actions as a view inside the menu sheet (MobileAccountPanel). */
+/** Desktop sidebar footer: the account chip and its dropdown, plus the
+ * sidebar's collapse toggle. Phones reach the same account actions as a view
+ * inside the menu sheet (MobileAccountPanel).
+ *
+ * The toggle lives in its own bottom row on purpose. It used to float on the
+ * sidebar's right edge at the header line — on the pointer's path from the
+ * logo and the nav to the page — and got hit by accident. The bottom corner
+ * is off that path yet still one click away in both states. */
export function SidebarAccount(props: {
collapsed?: boolean;
onLogout: () => void | Promise;
+ onToggleCollapse?: () => void;
}) {
const t = useT();
const [profileOpen, setProfileOpen] = createSignal(false);
const menu = createAccountMenu({ onLogout: props.onLogout, onOpenSettings: () => setProfileOpen(true) });
const actions = () => menu.actions().filter((action) => action.id !== "logout");
const logout = () => menu.actions().find((action) => action.id === "logout");
+ const toggleLabel = () => (props.collapsed ? t("nav.expand") : t("nav.collapse"));
+ // A quiet square alone in the sidebar's last row, under the account block,
+ // in both states (the Cloudflare dashboard pattern): the rail keeps a way
+ // back out, and nothing else sits close enough to hit it by mistake.
+ const collapseToggle = () => (
+
+ props.onToggleCollapse?.()}
+ >
+
+
+
+ );
return (
<>
@@ -33,15 +60,23 @@ export function SidebarAccount(props: {
{(u) => {
const name = () => accountDisplayName(u());
return (
-