/**
 * United User Menu
 *
 * Front-end styles for the unified sidebar menu.
 * CSS prefix: .ut-nav-
 *
 * The sidebar renders in the UT theme's object-menu slot or the separate
 * Kadence after-header integration. Breakpoints:
 * - Fixed sidebar: from 1121px in the UT slot frame, from 761px in Kadence.
 *   UT-theme geometry is theme-owned (B141); Kadence geometry is isolated
 *   in kadence.css.
 * - Below each frame's fixed-sidebar breakpoint: the trigger opens and closes
 *   the menu. UT slot geometry is theme-owned; Kadence keeps an in-flow panel.
 *
 * DOM order:
 *   <div.ut-nav-header-bar><button.ut-nav-trigger>   (narrow screens only)
 *   <aside.ut-nav-sidebar>
 *     <button.ut-nav-toggle>          (inline, first item in sidebar)
 *     <div.ut-nav-context-header>
 *     <nav.ut-nav-nav>
 *     <div.ut-nav-footer>
 *
 * @package UnitedTech\Navigation
 * @since   0.1.0
 * @since   0.8.0 Unified context classes replace user/org-specific classes.
 * @since   0.9.0 Icons, badges, tooltips, collapsed icon-only mode, role dot.
 * @since   0.18.0 Toggle moved inside sidebar; external trigger for mobile/tablet.
 * @since   0.54.0 Slot frame: overlay, scroll lock, old Kadence geometry removed.
 */

/* ==========================================================================
   Sidebar container â€” base
   Below each frame's fixed-sidebar breakpoint: hidden until the header-bar
   trigger opens it. The UT theme turns it into a bounded drawer. Above it:
   fixed column; width,
   top position and the <main> push are owned by unitedtech-theme (B141) in
   slot mode, or by this plugin's kadence.css in Kadence mode. State uses body classes
   (ut-nav-has-sidebar / ut-nav-slot-mode / ut-nav-sidebar-collapsed /
   ut-nav-sidebar-open).
   ========================================================================== */

.ut-nav-sidebar {
	position: static;
	display: none;
	width: 100%;
	height: auto;
	background: var(--ut-surface, #ffffff);
	flex-direction: column;
	overflow-x: hidden;
}

.ut-nav-sidebar.is-open {
	display: flex;
}

@media (min-width: 761px) {
	body.ut-nav-kadence-mode .ut-nav-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		display: flex;
		height: 100vh;
		box-shadow:
			4px 0 16px rgba(0, 0, 0, 0.08),
			1px 0 0 rgba(15, 23, 42, 0.06);
		transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	}
}

@media (min-width: 1121px) {
	body.ut-nav-slot-mode .ut-nav-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		display: flex;
		height: 100vh;
		/* Dual-layer shadow (B064): soft spread for depth + 1px hairline edge. */
		box-shadow:
			4px 0 16px rgba(0, 0, 0, 0.08),
			1px 0 0 rgba(15, 23, 42, 0.06);
		transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	}
}

/* ==========================================================================
   Sidebar trigger â€” below each frame's fixed-sidebar breakpoint
   Hamburger pill-knapp som Ã¥pner sidebar-drawer. Fra v0.32.0 rendret inne i
   `.ut-nav-header-bar` (plugin-rendret container i temaets object-menu-plass)
   istedenfor fixed-position. Bar-parent gir posisjonering; trigger beholder
   kun pill-visuals og state-overrides (se B048 / B052).
   Skjult pÃ¥ desktop via bar-parent (media-query i bunnen av filen).
   @since 0.18.0
   @since 0.32.0 Fixed-position fjernet; rendret inne i .ut-nav-header-bar.
   ========================================================================== */

.ut-nav-trigger {
	min-height: 44px;
	padding: 8px 14px 8px 12px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	background: var(--ut-surface, #ffffff);
	color: var(--ut-content, #1f2937);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.2;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

/*
 * State overrides â€” ALL interactive states must explicitly reset background
 * and color. Themes may ship `button:hover, button:focus, button:active`
 * rules that set `background: var(--global-palette-btn-bg-hover)` (orange in
 * most iSandnes.net palettes). Those rules have specificity (0,1,1); our
 * `.ut-nav-trigger:<state>` rules at (0,2,1) always win, but only when the
 * state is explicitly listed below. Leaving `:focus` / `:active` unhandled
 * caused an orange flash on mobile tap in v0.31.0 (see Fase 5b-8 Chrome
 * test report, Oppgave A5).
 */
.ut-nav-trigger:hover,
.ut-nav-trigger:focus,
.ut-nav-trigger:focus-visible,
.ut-nav-trigger:active {
	background: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-content, #1f2937);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.ut-nav-trigger:focus-visible {
	outline: var(--ut-focus-ring-width, 2px) solid var(--ut-focus-ring-color, #2563eb);
	outline-offset: var(--ut-focus-ring-offset, 2px);
}

.ut-nav-trigger-icon {
	width: 18px;
	height: 18px;
	color: currentColor;
	flex-shrink: 0;
}

.ut-nav-trigger-label {
	color: currentColor;
	white-space: nowrap;
}

/*
 * B054 (1) + B055 â€” flat trigger override inside `.ut-nav-header-bar`.
 * Pill-visuals (background, border, box-shadow, border-radius) from B048
 * are removed when trigger lives in the bar â€” the bar itself provides
 * visual grounding, so a container pill on top of a container bar
 * produced a "boks inni boks"-effect after v0.32.0 deploy. Placement
 * stays left-aligned (B055 â€” consistency with `.ut-nav-toggle` inside
 * drawer; B054 (2) right-alignment was rejected after visual mockup
 * testing).
 *
 * Scope-limited: standalone `.ut-nav-trigger` (hypothetical future
 * contexts outside the bar) retains B048 pill-styling.
 *
 * State-override pattern (B049): `:hover, :focus, :focus-visible,
 * :active` are all listed in a single block to defeat theme
 * `button:<state>` rules that would otherwise bleed through. The
 * pill's shadow/border resets inside the override block because the
 * flat design must not re-acquire B048 visuals on any state.
 *
 * Hover-padding (`8px 10px`) is intentionally wider than rest
 * (`8px 0`) so the subtle highlight wraps the icon + label with a
 * small amount of breathing room â€” this produces a tiny horizontal
 * "pop" at the left edge on hover, which visually signals the
 * affordance without reintroducing a permanent pill.
 *
 * @since 0.32.1
 */
.ut-nav-header-bar .ut-nav-trigger {
	background: transparent;
	border: 0;
	box-shadow: none;
	padding: 8px 0;
	border-radius: 0;
	min-height: 36px;
	/* gap: 8px inherited from .ut-nav-trigger base (B048) â€” do not override */
}

.ut-nav-header-bar .ut-nav-trigger:hover,
.ut-nav-header-bar .ut-nav-trigger:focus,
.ut-nav-header-bar .ut-nav-trigger:focus-visible,
.ut-nav-header-bar .ut-nav-trigger:active {
	background: rgba(15, 23, 42, 0.04);
	border-radius: 6px;
	padding: 8px 10px;
	box-shadow: none;
	color: var(--ut-content, #1f2937);
}

.ut-nav-header-bar .ut-nav-trigger:focus-visible {
	outline: var(--ut-focus-ring-width, 2px) solid var(--ut-focus-ring-color, #2563eb);
	outline-offset: var(--ut-focus-ring-offset, 2px);
}

/* ==========================================================================
   Header-bar (v0.32.0) â€” plugin-rendret container med trigger-knappen
   Rendres i temaets object-menu-plass rett over sidebaren, kun pÃ¥ sider der
   sidebaren gjelder (gatet av `Header_Bar::maybe_render_bar()`) og kun pÃ¥
   smale skjermer (skjult ved rammens desktopgrense i sidebar-desktop.css). Baren stÃ¥r
   synlig ogsÃ¥ mens draweren er Ã¥pen: trigger-knappen er lukkekontrollen.
   Temaet skjuler baren (`hidden`) mens stedspanelet er Ã¥pent (B105).
   @since 0.32.0
   @since 0.54.0 Slot frame only; the Kadence-era white bar and disclosure rule removed.
   ========================================================================== */

.ut-nav-header-bar {
	display: flex;
	align-items: center;
	min-height: 40px;            /* B055 â€” bar-hÃ¸yde styrt av trigger (36px) + align */
	padding: 0;
	background: transparent;
	position: relative;
	z-index: 100;
}

.ut-nav-header-bar[hidden] {
	display: none;
}

/* ==========================================================================
   Inline toggle â€” inside sidebar, first element in content flow
   Styled like a menu item: icon + label in expanded, icon-only in collapsed.
   @since 0.18.0
   ========================================================================== */

/*
 * B048 Â§ 3 â€” white pill matching `.ut-nav-trigger` for visual consistency.
 * Same state-override pattern as trigger: all interactive states explicitly
 * listed to defeat theme `button:hover, button:focus, button:active`
 * (see `.ut-nav-trigger` comment above). `align-self: flex-end` right-aligns
 * the pill in the sidebar column (B060 â€” close-button convention for
 * drawers/sheets) while preserving intrinsic pill width; desktop-collapsed
 * mode overrides to centered icon-only square (see sidebar-desktop.css).
 */
.ut-nav-toggle {
	display: inline-flex;
	align-items: center;
	align-self: flex-end; /* v0.32.3 â€” B060 (endret fra flex-start for hoyreplassering) */
	gap: 8px;
	min-height: 44px;
	padding: 8px 14px 8px 12px;
	margin: 0 0 12px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	background: var(--ut-surface, #ffffff);
	color: var(--ut-content, #1f2937);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	font-size: 0.875rem;
	font-family: inherit;
	font-weight: 500;
	line-height: 1.2;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
	position: relative;
}

.ut-nav-toggle:hover,
.ut-nav-toggle:focus,
.ut-nav-toggle:focus-visible,
.ut-nav-toggle:active {
	background-color: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-content, #1f2937);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
	outline: none;
}

.ut-nav-toggle:focus-visible {
	outline: var(--ut-focus-ring-width, 2px) solid var(--ut-focus-ring-color, #2563eb);
	outline-offset: var(--ut-focus-ring-offset, 2px);
}

.ut-nav-toggle-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: currentColor;
}

/* Mobile/tablet: show close (X) icon, hide collapse chevron */
.ut-nav-icon-collapse {
	display: none;
}

.ut-nav-icon-close {
	display: block;
}

/* Toggle tooltip â€” hidden by default, shown in collapsed desktop mode */
.ut-nav-toggle .ut-nav-tooltip {
	position: absolute;
	left: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
}

/* ==========================================================================
   Sidebar content
   ========================================================================== */

.ut-nav-sidebar-content {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow-y: auto;
	padding: 16px 16px 24px;
}

/* ==========================================================================
   Context header â€” unified for all contexts (user, org, project, property)
   @since 0.8.0
   @since 0.9.0 Added back-link in header, role dot, updated sizing.
   @since 0.18.0 Back-link restyled as inline menu item with icon + label.
   ========================================================================== */

.ut-nav-context-header {
	padding: 8px 0 16px;
	border-bottom: 1px solid var(--ut-border, #f1f5f9);
}

/* Header back link â€” styled like a menu item (icon + label) */
.ut-nav-header-back {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	margin-bottom: 8px;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--ut-content-muted, #64748b);
	text-decoration: none;
	border-radius: 8px;
	transition: all 0.15s ease;
	position: relative;
}

.ut-nav-header-back:hover,
.ut-nav-header-back:focus-visible {
	background-color: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-selected, #0369a1);
}

/* C1 context-switching links â€” "All [type]" and "My [type]" above header */
.ut-nav-c1-links {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 8px;
}

.ut-nav-c1-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 12px;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--ut-content-muted, #64748b);
	text-decoration: none;
	border-radius: 8px;
	transition: all 0.15s ease;
	position: relative;
}

.ut-nav-c1-link:hover,
.ut-nav-c1-link:focus-visible {
	background-color: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-selected, #0369a1);
}

.ut-nav-context-identity {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 12px;
}

.ut-nav-context-image {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Entity contexts (org, project, property) use rounded-square logo */
.ut-nav-sidebar-org .ut-nav-context-image,
.ut-nav-sidebar-project .ut-nav-context-image,
.ut-nav-sidebar-property .ut-nav-context-image {
	border-radius: 12px;
}

.ut-nav-context-initials {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background-color: var(--ut-brand-strong, var(--global-palette1, #0073aa));
	color: var(--ut-on-brand, #ffffff);
	font-weight: 700;
	font-size: 0.875rem;
	flex-shrink: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Entity contexts use rounded-square initials */
.ut-nav-sidebar-org .ut-nav-context-initials,
.ut-nav-sidebar-project .ut-nav-context-initials,
.ut-nav-sidebar-property .ut-nav-context-initials {
	border-radius: 12px;
}

.ut-nav-context-details {
	display: flex;
	flex-direction: column;
	min-width: 0;
	transition: opacity 0.15s ease;
}

.ut-nav-context-name {
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.3;
	color: var(--ut-content, #0f172a);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ut-nav-context-role {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.3;
}

/* B-FP-484: retain the full organization name in the expanded identity. */
.ut-nav-sidebar-org .ut-nav-context-name {
	white-space: normal;
	overflow: visible;
	text-overflow: clip;
	overflow-wrap: anywhere;
}
.ut-nav-sidebar-org .ut-ui-icon-tile { flex-shrink: 0; }

/* Role dot â€” pulsating indicator per context */
.ut-nav-role-dot {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	animation: ut-nav-pulse-dot 2s ease-in-out infinite;
}

@keyframes ut-nav-pulse-dot {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
	.ut-nav-role-dot {
		animation: none;
	}
}

/* Role colors per context */
.ut-nav-sidebar-user .ut-nav-context-role {
	color: #0284c7;
}

.ut-nav-sidebar-user .ut-nav-role-dot {
	background-color: #0ea5e9;
}

.ut-nav-sidebar-org .ut-nav-context-role {
	color: #15803d;
}

.ut-nav-sidebar-org .ut-nav-role-dot {
	background-color: #22c55e;
}

.ut-nav-sidebar-project .ut-nav-context-role {
	color: #7c3aed;
}

.ut-nav-sidebar-project .ut-nav-role-dot {
	background-color: #8b5cf6;
}

.ut-nav-sidebar-property .ut-nav-context-role {
	color: #b45309;
}

.ut-nav-sidebar-property .ut-nav-role-dot {
	background-color: #f59e0b;
}

/* ==========================================================================
   Icon base styles
   @since 0.9.0
   ========================================================================== */

.ut-nav-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.ut-nav-icon-sm {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

/* ==========================================================================
   Navigation
   @since 0.9.0 Updated with icon support, badge, tooltip.
   ========================================================================== */

.ut-nav-nav {
	flex: 1;
	padding: 12px 0;
	overflow-y: auto;
}

/* Scrollbar styling */
.ut-nav-nav::-webkit-scrollbar {
	width: 4px;
}

.ut-nav-nav::-webkit-scrollbar-track {
	background: transparent;
}

.ut-nav-nav::-webkit-scrollbar-thumb {
	background: var(--ut-border-strong, #cbd5e1);
	border-radius: 100px;
}

.ut-nav-nav::-webkit-scrollbar-thumb:hover {
	background: var(--ut-content-subtle, #94a3b8);
}

.ut-nav-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ut-nav-menu li {
	margin: 0;
	position: relative;
}

.ut-nav-menu a {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 44px;
	gap: 12px;
	padding: 10px 12px;
	color: var(--ut-content-muted, #475569);
	text-decoration: none;
	border-radius: 8px;
	border: 1px solid transparent;
	font-size: 0.875rem;
	line-height: 1.4;
	transition: all 0.15s ease;
	margin-bottom: 2px;
}

.ut-nav-menu a:hover,
.ut-nav-menu a:focus-visible {
	background-color: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-content, #0f172a);
}

/* ==========================================================================
   Event management menu (0.58.0): external app link and locked feature
   ========================================================================== */

.ut-nav-menu .ut-nav-external-icon,
.ut-nav-menu .ut-nav-lock-icon {
	margin-left: auto;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	opacity: 0.7;
}

/* Shown, not a link: the feature exists for this organizer type but this
   event lacks something. The reason is text, never colour alone. */
.ut-nav-locked-item {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 44px;
	gap: 12px;
	padding: 10px 12px;
	color: var(--ut-content-muted, #64748b);
	border-radius: 8px;
	border: 1px dashed var(--ut-border-strong, #cbd5e1);
	font-size: 0.875rem;
	line-height: 1.4;
	margin-bottom: 2px;
	cursor: not-allowed;
}

.ut-nav-locked-reason {
	display: block;
	font-size: 0.75rem;
	color: var(--ut-content-muted, #64748b);
	margin-top: 2px;
}

.ut-nav-menu .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Label wrapper â€” hides in collapsed via CSS */
.ut-nav-label {
	transition: opacity 0.15s ease;
}

/* Active menu item â€” unified for all contexts */
.ut-nav-menu-item.ut-nav-active > a {
	background-color: var(--ut-selected-surface, #f0f9ff);
	color: var(--ut-selected, #0369a1);
	font-weight: 500;
	border-color: var(--ut-brand, #bae6fd);
}

/* ==========================================================================
   Child pages under the active item (B-FP-475 point 1): a line on the left,
   the count on the right. Hidden in the collapsed desktop sidebar.
   @since 0.79.0
   ========================================================================== */

.ut-nav-subnav {
	list-style: none;
	margin: 2px 0 6px 22px;
	padding: 0 0 0 8px;
	border-left: 2px solid var(--ut-border, #e2e8f0);
}

.ut-nav-menu .ut-nav-subnav-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 10px;
	margin-bottom: 1px;
	border: 0;
	border-radius: 6px;
	color: var(--ut-content-muted, #475569);
	font-size: 0.875rem;
}

.ut-nav-menu .ut-nav-subnav-link[aria-current="page"] {
	background-color: var(--ut-selected-surface, #f0f9ff);
	color: var(--ut-selected, #0369a1);
	font-weight: 600;
}

.ut-nav-subnav-count {
	font-size: 0.75rem;
	font-weight: 600;
	color: inherit;
}

/* ==========================================================================
   Badge â€” count indicator
   @since 0.9.0
   ========================================================================== */

.ut-nav-badge {
	margin-left: auto;
	font-size: 0.75rem;
	font-weight: 500;
	background: var(--ut-hover-surface, #f1f5f9);
	color: var(--ut-content-muted, #64748b);
	padding: 2px 8px;
	border-radius: 9999px;
	transition: opacity 0.15s ease;
}

/* ==========================================================================
   Tooltip â€” visible only in collapsed mode
   @since 0.9.0
   ========================================================================== */

.ut-nav-tooltip {
	position: absolute;
	left: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
	white-space: nowrap;
	background: var(--ut-content, #1e293b);
	color: var(--ut-on-brand, #ffffff);
	font-size: 0.75rem;
	padding: 4px 10px;
	border-radius: 6px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	z-index: 100;
	display: none; /* Hidden by default, shown in collapsed mode via ancestor class. */
}

.ut-nav-tooltip::before {
	content: '';
	position: absolute;
	right: 100%;
	top: 50%;
	transform: translateY(-50%);
	border: 4px solid transparent;
	border-right-color: var(--ut-content, #1e293b);
}

/* Show tooltips in collapsed mode (display: block needed, opacity handled per-item on hover). */
.ut-nav-sidebar-collapsed .ut-nav-tooltip {
	display: block;
}

/* ==========================================================================
   Menu group labels
   @since 0.8.0
   @since 0.9.0 Updated font size and color.
   ========================================================================== */

.ut-nav-group-label {
	font-size: 0.6875rem;
	line-height: 1.4;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--ut-content-muted, #64748b);
	padding: 12px 12px 4px;
	margin: 0;
}

/* First group label needs no top padding */
.ut-nav-nav > .ut-nav-group-label:first-child {
	padding-top: 0;
}

/* Visual separator between consecutive menu groups without labels.
   Adjacent <ul> elements get a subtle border to distinguish groups. */
.ut-nav-nav > .ut-nav-menu + .ut-nav-menu {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid var(--ut-border, #e2e8f0);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.ut-nav-footer {
	margin-top: auto;
	padding: 16px 0 0;
	border-top: 1px solid var(--ut-border, #f1f5f9);
}

.ut-nav-logout {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	color: var(--ut-content-muted, #64748b);
	text-decoration: none;
	border-radius: 8px;
	font-size: 0.875rem;
	transition: all 0.15s ease;
}

.ut-nav-logout:hover,
.ut-nav-logout:focus-visible {
	background-color: #fef2f2;
	color: #dc2626;
}

/* ==========================================================================
   Back link â€” entity contexts (org, project, property) â€” footer version
   ========================================================================== */

.ut-nav-back-link {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	color: var(--ut-content-muted, #64748b);
	text-decoration: none;
	border-radius: 8px;
	font-size: 0.875rem;
	transition: all 0.15s ease;
}

.ut-nav-back-link:hover,
.ut-nav-back-link:focus-visible {
	background-color: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-content, #374151);
}

.ut-nav-back-icon {
	flex-shrink: 0;
}

/* ==========================================================================
   Sub-menu
   ========================================================================== */

.ut-nav-menu .ut-nav-submenu {
	list-style: none;
	margin: 0;
	padding: 0 0 0 16px;
}

/* ==========================================================================
   Narrow screens â€” the header-bar trigger is the only close control.
   ========================================================================== */

@media (max-width: 760px) {
	.ut-nav-toggle {
		display: none;
	}
}

@media (min-width: 761px) and (max-width: 1120px) {
	body.ut-nav-slot-mode .ut-nav-toggle {
		display: none;
	}
}

/* Compact rows for mouse-driven desktop use. Heights remain minimums so
   wrapped labels, badges and locked-item explanations can grow naturally.
   Touch-capable computers keep the larger targets even with a mouse attached. */
@media (min-width: 761px) and (hover: hover) and (pointer: fine) {
	.ut-nav-menu a,
	.ut-nav-locked-item {
		min-height: 40px;
		padding-top: 8px;
		padding-bottom: 8px;
	}

	.ut-nav-menu .ut-nav-subnav-link {
		min-height: 40px;
		padding-top: 6px;
		padding-bottom: 6px;
	}
}

@media (any-pointer: coarse) {
	.ut-nav-menu a,
	.ut-nav-menu .ut-nav-subnav-link,
	.ut-nav-locked-item {
		min-height: 44px;
	}
}

/* Fixed-sidebar rules (collapse, tooltips, header-bar hidden) live in
   sidebar-desktop.css, enqueued at the active frame's own breakpoint. */

/* Felles fokusfarger for lenker, uten Ã¥ endre menyens geometri. */
.ut-nav-menu a:focus-visible,
.ut-nav-c1-link:focus-visible,
.ut-nav-header-back:focus-visible {
	outline: var(--ut-focus-ring-width, 2px) solid var(--ut-focus-ring-color, #2563eb);
	outline-offset: var(--ut-focus-ring-offset, 2px);
}

/* Approved identity-first header (alternative A, 2026-10-15). Frame geometry
remains with the theme; shortcuts reuse the builder's resolved links. */
.ut-nav-context-header {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	padding: 0 0 12px;
	flex-shrink: 0;
}
.ut-nav-context-identity {
	flex: 1;
	min-width: 0;
	gap: 9px;
	padding: 0;
}
.ut-nav-context-image,.ut-nav-context-initials {
	width: 40px;
	height: 40px;
}
.ut-nav-context-kind {
	font-size: 0.6875rem;
	line-height: 1.4;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ut-content-muted, #64748b);
	margin-bottom: 3px;
	overflow-wrap: anywhere;
}
.ut-nav-context-type-icon {
	border-radius: 9px;
	background: var(--ut-hover-surface, #f8fafc);
	color: var(--ut-content-muted, #64748b);
}
.ut-nav-context-name {
	white-space: normal;
	overflow: visible;
	text-overflow: clip;
	overflow-wrap: anywhere;
}
.ut-nav-context-header .ut-nav-toggle {
	width: 36px;
	min-width: 36px;
	min-height: 40px;
	padding: 0;
	margin: 0;
	gap: 0;
	align-self: flex-start;
	border: 0;
	border-radius: 6px;
	box-shadow: none;
}
.ut-nav-shortcuts {
	position: relative;
	flex-shrink: 0;
	margin-top: 9px;
}
/* Very short viewports may scroll the whole sidebar. Keep at least two touch
   rows inside the menu's own scroll area even below a long identity. */
.ut-nav-nav {
	min-height: 112px;
}
.ut-nav-c1-links {
	margin: 0;
}
/* Shortcuts are plain direct links; no disclosure list (0.83.0). */
.ut-nav-shortcuts .ut-nav-c1-link {
	min-height: 36px;
	border: 1px solid var(--ut-border, #e2e8f0);
}
.ut-nav-c1-link {
	gap: 8px;
	min-height: 40px;
	padding: 8px;
	overflow-wrap: anywhere;
}
.ut-nav-c1-link .ut-nav-label {
	min-width: 0;
}
@media (max-width:1120px) {
	body.ut-nav-slot-mode .ut-nav-shortcuts .ut-nav-c1-links .ut-nav-c1-link {
		min-height: 44px;
	}
}
@media (max-width:760px),(any-pointer:coarse) {
	.ut-nav-shortcuts .ut-nav-c1-links .ut-nav-c1-link {
		min-height: 44px;
	}
	.ut-nav-context-header .ut-nav-toggle {
		min-width: 44px;
		min-height: 44px;
	}
}
