/**
 * Royal Journey CRM — Global Application Shell
 *
 * UI/UX REDESIGN STEP 2 only.
 * Presentation layer for desktop/tablet/mobile navigation, topbar, page headers,
 * quick navigation search, overlays, toast host and shell loading feedback.
 * No backend, route, REST, permission or business-logic behavior lives here.
 */

:root {
	--rjcrm-sidebar-width: 280px;
	--rjcrm-sidebar-collapsed-width: 88px;
	--rjcrm-topbar-height: 72px;
	--rjcrm-mobile-nav-height: 72px;
	--rjcrm-shell-gutter: clamp(18px, 2.2vw, 36px);
}

/* --------------------------------------------------------------------------
   Application frame
   -------------------------------------------------------------------------- */

.rjcrm-app-page {
	min-height: 100vh;
	background: var(--rjcrm-canvas);
}

.rjcrm-app-layout {
	min-height: 100vh;
	display: grid;
	grid-template-columns: var(--rjcrm-sidebar-width) minmax(0, 1fr);
	background: var(--rjcrm-canvas);
	transition: grid-template-columns var(--rjcrm-motion-base) var(--rjcrm-ease-standard);
}

.rjcrm-app-main {
	min-width: 0;
	min-height: 100vh;
}

.rjcrm-content {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 28px var(--rjcrm-shell-gutter) 52px;
}

.rjcrm-content__inner {
	width: min(100%, var(--rjcrm-content-max));
	margin-inline: auto;
}

/* Thin, non-blocking progress indicator for real document navigation. */
.rjcrm-shell-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 10050;
	pointer-events: none;
	opacity: 0;
	overflow: hidden;
	transition: opacity var(--rjcrm-motion-fast) ease;
}

.rjcrm-shell-progress span {
	display: block;
	width: 34%;
	height: 100%;
	background: var(--rjcrm-brand-gold-500);
	transform: translateX(-110%);
}

.rjcrm-shell-progress.is-active {
	opacity: 1;
}

.rjcrm-shell-progress.is-active span {
	animation: rjcrm-shell-progress 1.05s var(--rjcrm-ease-emphasized) infinite;
}

@keyframes rjcrm-shell-progress {
	0% { transform: translateX(-110%); }
	55% { transform: translateX(150%); }
	100% { transform: translateX(310%); }
}

/* --------------------------------------------------------------------------
   Sidebar / tablet rail / mobile drawer
   -------------------------------------------------------------------------- */

.rjcrm-sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100dvh;
	z-index: 45;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--rjcrm-surface);
	border-right: 1px solid var(--rjcrm-border);
	box-shadow: 7px 0 26px rgba(18, 23, 28, 0.025);
	transition: width var(--rjcrm-motion-base) var(--rjcrm-ease-standard), transform var(--rjcrm-motion-base) var(--rjcrm-ease-standard);
}

.rjcrm-sidebar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: var(--rjcrm-topbar-height);
	padding: 12px 14px 12px 16px;
	border-bottom: 1px solid var(--rjcrm-divider);
}

.rjcrm-sidebar__brand-link {
	min-width: 0;
	max-width: 190px;
	overflow: hidden;
}

.rjcrm-sidebar .rjcrm-brand {
	gap: 10px;
	white-space: nowrap;
}

.rjcrm-sidebar .rjcrm-brand__mark {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border-radius: 13px;
	background: var(--rjcrm-charcoal-950);
	color: var(--rjcrm-brand-gold-300);
	box-shadow: var(--rjcrm-shadow-sm);
}

.rjcrm-sidebar .rjcrm-brand__text strong {
	color: var(--rjcrm-charcoal-950);
	font-size: 14px;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-sidebar .rjcrm-brand__text small {
	color: var(--rjcrm-brand-gold-700);
	font-size: 10px;
	letter-spacing: .14em;
}

.rjcrm-sidebar__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.rjcrm-sidebar__collapse {
	display: inline-grid;
	width: 34px;
	height: 34px;
	border-color: transparent;
	background: var(--rjcrm-surface-subtle);
	color: var(--rjcrm-charcoal-600);
}

.rjcrm-sidebar__collapse .rjcrm-icon {
	width: 17px;
	height: 17px;
	transition: transform var(--rjcrm-motion-base) var(--rjcrm-ease-standard);
}

.rjcrm-sidebar__close {
	display: none;
}

.rjcrm-nav {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px 18px;
	scrollbar-width: thin;
	scrollbar-color: var(--rjcrm-charcoal-200) transparent;
}

.rjcrm-nav__group + .rjcrm-nav__group {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--rjcrm-divider);
}

.rjcrm-nav__group-label {
	margin: 0 10px 7px;
	color: var(--rjcrm-charcoal-400);
	font-size: 10px;
	font-weight: var(--rjcrm-weight-extrabold);
	letter-spacing: .09em;
	line-height: 1.2;
	text-transform: uppercase;
	white-space: nowrap;
}

.rjcrm-nav__list {
	gap: 4px;
}

.rjcrm-nav__link {
	position: relative;
	gap: 11px;
	min-height: 44px;
	padding: 9px 11px;
	border: 1px solid transparent;
	border-radius: var(--rjcrm-radius-md);
	color: var(--rjcrm-charcoal-600);
	font-size: 13px;
	font-weight: var(--rjcrm-weight-semibold);
	transition: background var(--rjcrm-motion-fast) ease, border-color var(--rjcrm-motion-fast) ease, color var(--rjcrm-motion-fast) ease, transform var(--rjcrm-motion-fast) ease;
}

.rjcrm-nav__link::before {
	content: "";
	position: absolute;
	left: 0;
	top: 11px;
	bottom: 11px;
	width: 3px;
	border-radius: 0 var(--rjcrm-radius-pill) var(--rjcrm-radius-pill) 0;
	background: transparent;
}

.rjcrm-nav__link:hover {
	background: var(--rjcrm-charcoal-50);
	border-color: var(--rjcrm-charcoal-100);
	color: var(--rjcrm-charcoal-950);
}

.rjcrm-nav__link.is-active {
	background: var(--rjcrm-brand-gold-50);
	border-color: var(--rjcrm-brand-gold-200);
	color: var(--rjcrm-charcoal-950);
	box-shadow: inset 0 0 0 1px rgba(201, 149, 47, .02);
}

.rjcrm-nav__link.is-active::before {
	background: var(--rjcrm-brand-gold-500);
}

.rjcrm-nav__icon {
	width: 22px;
	flex: 0 0 22px;
	color: var(--rjcrm-charcoal-400);
}

.rjcrm-nav__link:hover .rjcrm-nav__icon {
	color: var(--rjcrm-charcoal-700);
}

.rjcrm-nav__link.is-active .rjcrm-nav__icon {
	color: var(--rjcrm-brand-gold-700);
}

.rjcrm-nav__label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rjcrm-sidebar__footer {
	padding: 12px;
	border-top: 1px solid var(--rjcrm-divider);
}

.rjcrm-sidebar__secure {
	min-height: 50px;
	padding: 10px 11px;
	border: 1px solid var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-md);
	background: var(--rjcrm-surface-subtle);
}

.rjcrm-sidebar__secure-mark {
	width: 8px;
	height: 8px;
	box-shadow: 0 0 0 4px var(--rjcrm-success-bg);
}

.rjcrm-sidebar__secure-copy {
	min-width: 0;
}

.rjcrm-sidebar__secure strong {
	color: var(--rjcrm-charcoal-700);
	font-size: 11px;
}

.rjcrm-sidebar__secure small {
	font-size: 10px;
}

/* Persisted desktop/tablet collapse state. */
.rjcrm-sidebar-collapsed .rjcrm-app-layout {
	grid-template-columns: var(--rjcrm-sidebar-collapsed-width) minmax(0, 1fr);
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__header {
	justify-content: center;
	padding-inline: 10px;
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__brand-link {
	max-width: 42px;
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar .rjcrm-brand__text,
.rjcrm-sidebar-collapsed .rjcrm-nav__label,
.rjcrm-sidebar-collapsed .rjcrm-sidebar__secure-copy {
	display: none;
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__header-actions {
	position: absolute;
	right: -16px;
	top: 20px;
	z-index: 2;
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__collapse {
	width: 32px;
	height: 32px;
	border-color: var(--rjcrm-border);
	background: var(--rjcrm-surface);
	box-shadow: var(--rjcrm-shadow-sm);
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__collapse .rjcrm-icon {
	transform: rotate(180deg);
}

.rjcrm-sidebar-collapsed .rjcrm-nav {
	padding-inline: 10px;
}

.rjcrm-sidebar-collapsed .rjcrm-nav__group-label {
	height: 1px;
	margin: 8px 7px;
	overflow: hidden;
	background: var(--rjcrm-divider);
	color: transparent;
}

.rjcrm-sidebar-collapsed .rjcrm-nav__group + .rjcrm-nav__group {
	margin-top: 10px;
	padding-top: 6px;
	border-top: 0;
}

.rjcrm-sidebar-collapsed .rjcrm-nav__link {
	justify-content: center;
	padding-inline: 8px;
}

.rjcrm-sidebar-collapsed .rjcrm-nav__link::before {
	top: 9px;
	bottom: 9px;
}

.rjcrm-sidebar-collapsed .rjcrm-nav__icon {
	width: 24px;
	flex-basis: 24px;
}

.rjcrm-sidebar-collapsed .rjcrm-sidebar__secure {
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent;
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */

.rjcrm-topbar {
	position: sticky;
	top: 0;
	z-index: 35;
	display: grid;
	grid-template-columns: minmax(170px, .8fr) minmax(300px, 560px) minmax(210px, .8fr);
	align-items: center;
	gap: 20px;
	min-height: var(--rjcrm-topbar-height);
	padding: 10px var(--rjcrm-shell-gutter);
	background: rgba(255, 255, 255, .94);
	border-bottom: 1px solid var(--rjcrm-divider);
	box-shadow: 0 1px 0 rgba(18, 23, 28, .015);
	backdrop-filter: blur(14px);
}

.rjcrm-topbar__left,
.rjcrm-topbar__actions {
	gap: 9px;
}

.rjcrm-mobile-menu {
	display: none;
}

.rjcrm-topbar__title > span {
	color: var(--rjcrm-brand-gold-700);
	font-size: 10px;
	font-weight: var(--rjcrm-weight-extrabold);
	letter-spacing: .08em;
}

.rjcrm-topbar__title > strong {
	margin-top: 3px;
	color: var(--rjcrm-charcoal-950);
	font-size: 14px;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-topbar__actions .rjcrm-icon-button {
	width: 40px;
	height: 40px;
	border-color: var(--rjcrm-border);
	background: var(--rjcrm-surface);
	color: var(--rjcrm-charcoal-600);
}

.rjcrm-topbar__actions .rjcrm-icon-button:hover {
	border-color: var(--rjcrm-brand-gold-200);
	background: var(--rjcrm-brand-gold-50);
	color: var(--rjcrm-charcoal-950);
}

/* Quick navigation search (frontend-only, permission-aware). */
.rjcrm-global-search {
	position: relative;
	display: block;
	width: 100%;
	isolation: isolate;
}

.rjcrm-global-search input {
	width: 100%;
	height: 42px;
	padding: 0 72px 0 40px;
	border: 1px solid var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-md);
	background: var(--rjcrm-charcoal-50);
	color: var(--rjcrm-charcoal-800);
	font-size: 12px;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
	transition: border-color var(--rjcrm-motion-fast) ease, background var(--rjcrm-motion-fast) ease, box-shadow var(--rjcrm-motion-fast) ease;
}

.rjcrm-global-search input:hover {
	border-color: var(--rjcrm-border-strong);
	background: var(--rjcrm-surface);
}

.rjcrm-global-search input:focus {
	border-color: var(--rjcrm-brand-gold-400);
	background: var(--rjcrm-surface);
	box-shadow: var(--rjcrm-focus-ring);
}

.rjcrm-global-search__icon {
	position: absolute;
	left: 13px;
	top: 50%;
	z-index: 2;
	width: 17px;
	height: 17px;
	color: var(--rjcrm-charcoal-400);
	transform: translateY(-50%);
	pointer-events: none;
}

.rjcrm-global-search__hint {
	position: absolute;
	right: 9px;
	top: 50%;
	z-index: 2;
	padding: 3px 6px;
	border: 1px solid var(--rjcrm-border);
	border-radius: 6px;
	background: var(--rjcrm-surface);
	color: var(--rjcrm-charcoal-400);
	font-family: var(--rjcrm-font-sans);
	font-size: 9px;
	font-weight: var(--rjcrm-weight-bold);
	line-height: 1.25;
	transform: translateY(-50%);
	box-shadow: var(--rjcrm-shadow-xs);
}

.rjcrm-global-search__results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 95;
	max-height: min(520px, calc(100dvh - var(--rjcrm-topbar-height) - 32px));
	overflow-y: auto;
	padding: 8px;
	border: 1px solid var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-lg);
	background: var(--rjcrm-surface);
	box-shadow: var(--rjcrm-shadow-lg);
}

.rjcrm-global-search__results[hidden] {
	display: none !important;
}

.rjcrm-global-search__results-label {
	padding: 7px 8px 8px;
	color: var(--rjcrm-charcoal-400);
	font-size: 10px;
	font-weight: var(--rjcrm-weight-extrabold);
	letter-spacing: .07em;
	text-transform: uppercase;
}

.rjcrm-global-search__result {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	min-height: 54px;
	padding: 8px 9px;
	border: 1px solid transparent;
	border-radius: var(--rjcrm-radius-md);
	color: inherit;
	text-decoration: none;
}

.rjcrm-global-search__result:hover,
.rjcrm-global-search__result:focus-visible {
	border-color: var(--rjcrm-border);
	background: var(--rjcrm-charcoal-50);
	text-decoration: none;
}

.rjcrm-global-search__result.is-current {
	background: var(--rjcrm-brand-gold-50);
}

.rjcrm-global-search__result-icon {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: var(--rjcrm-surface-muted);
	color: var(--rjcrm-charcoal-600);
}

.rjcrm-global-search__result-icon .rjcrm-icon {
	width: 17px;
	height: 17px;
}

.rjcrm-global-search__result > span:nth-child(2) {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.rjcrm-global-search__result strong {
	color: var(--rjcrm-charcoal-900);
	font-size: 12px;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-global-search__result small {
	overflow: hidden;
	color: var(--rjcrm-muted);
	font-size: 10px;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rjcrm-global-search__result em {
	padding: 3px 6px;
	border-radius: var(--rjcrm-radius-pill);
	background: var(--rjcrm-brand-gold-100);
	color: var(--rjcrm-brand-gold-800);
	font-size: 9px;
	font-style: normal;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-global-search__empty {
	padding: 18px 12px;
	color: var(--rjcrm-muted);
	font-size: 12px;
	text-align: center;
}

/* Notifications. Existing REST behavior is unchanged; this only restyles it. */
.rjcrm-notification-menu {
	position: relative;
}

.rjcrm-notification-badge {
	top: -5px;
	right: -5px;
	min-width: 18px;
	height: 18px;
	padding-inline: 4px;
	border: 2px solid var(--rjcrm-surface);
	background: var(--rjcrm-danger);
	font-size: 9px;
}

.rjcrm-notification-dropdown {
	top: calc(100% + 10px);
	width: min(390px, calc(100vw - 24px));
	padding: 8px;
	border: 1px solid var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-lg);
	background: var(--rjcrm-surface);
	box-shadow: var(--rjcrm-shadow-lg);
}

.rjcrm-notification-dropdown__head {
	padding: 8px 8px 10px;
	border-bottom: 1px solid var(--rjcrm-divider);
}

.rjcrm-notification-dropdown__head > div {
	display: grid;
	gap: 2px;
}

.rjcrm-notification-dropdown__head small {
	color: var(--rjcrm-brand-gold-700);
	font-size: 9px;
	font-weight: var(--rjcrm-weight-extrabold);
	letter-spacing: .07em;
	text-transform: uppercase;
}

.rjcrm-notification-dropdown__head strong {
	font-size: 14px;
}

.rjcrm-notification-dropdown__head a {
	color: var(--rjcrm-brand-gold-700);
	font-size: 10px;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-notification-dropdown__list {
	display: grid;
	gap: 4px;
	padding-top: 6px;
}

.rjcrm-notification-dropdown__item {
	gap: 3px;
	padding: 10px;
	border: 1px solid transparent;
	border-radius: var(--rjcrm-radius-md);
}

.rjcrm-notification-dropdown__item:hover,
.rjcrm-notification-dropdown__item:focus-visible {
	border-color: var(--rjcrm-border);
	background: var(--rjcrm-charcoal-50);
}

/* Profile menu. */
.rjcrm-profile__trigger {
	min-height: 46px;
	max-width: 260px;
	padding: 4px 8px 4px 4px;
	border: 1px solid transparent;
	border-radius: var(--rjcrm-radius-md);
}

.rjcrm-profile__trigger:hover,
.rjcrm-profile__trigger[aria-expanded="true"] {
	border-color: var(--rjcrm-border);
	background: var(--rjcrm-charcoal-50);
}

.rjcrm-avatar {
	width: 36px;
	height: 36px;
	background: var(--rjcrm-charcoal-950);
	color: var(--rjcrm-brand-gold-200);
	font-size: 11px;
	box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.rjcrm-profile__copy strong {
	color: var(--rjcrm-charcoal-900);
	font-size: 11px;
}

.rjcrm-profile__copy small {
	font-size: 9px;
}

.rjcrm-dropdown-menu {
	width: min(310px, calc(100vw - 24px));
	padding: 8px;
	border-color: var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-lg);
	box-shadow: var(--rjcrm-shadow-lg);
}

.rjcrm-profile-card {
	align-items: flex-start;
	padding: 10px;
}

.rjcrm-profile-card__role {
	display: inline-flex;
	width: fit-content;
	margin-top: 6px;
	padding: 3px 7px;
	border: 1px solid var(--rjcrm-brand-gold-200);
	border-radius: var(--rjcrm-radius-pill);
	background: var(--rjcrm-brand-gold-50);
	color: var(--rjcrm-brand-gold-800);
	font-size: 9px;
	font-weight: var(--rjcrm-weight-bold);
}

.rjcrm-profile-availability {
	margin-top: 4px;
	padding: 12px 10px;
	border-top: 1px solid var(--rjcrm-divider);
}

/* --------------------------------------------------------------------------
   Page header and breadcrumbs
   -------------------------------------------------------------------------- */

.rjcrm-page-header {
	align-items: flex-start;
	margin-bottom: 22px;
}

.rjcrm-page-header__main {
	min-width: 0;
}

.rjcrm-breadcrumbs {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-bottom: 10px;
	color: var(--rjcrm-charcoal-400);
	font-size: 10px;
	font-weight: var(--rjcrm-weight-semibold);
}

.rjcrm-breadcrumbs a {
	color: var(--rjcrm-charcoal-500);
	text-decoration: none;
}

.rjcrm-breadcrumbs a:hover {
	color: var(--rjcrm-brand-gold-700);
	text-decoration: none;
}

.rjcrm-breadcrumbs .rjcrm-icon {
	width: 12px;
	height: 12px;
}

.rjcrm-breadcrumbs [aria-current="page"] {
	color: var(--rjcrm-charcoal-700);
}

.rjcrm-page-header__title-row {
	display: flex;
	align-items: flex-start;
	gap: 13px;
}

.rjcrm-page-header__icon {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border: 1px solid var(--rjcrm-brand-gold-200);
	border-radius: var(--rjcrm-radius-md);
	background: var(--rjcrm-brand-gold-50);
	color: var(--rjcrm-brand-gold-700);
}

.rjcrm-page-header__icon .rjcrm-icon {
	width: 20px;
	height: 20px;
}

.rjcrm-page-header h1 {
	margin: 0;
	color: var(--rjcrm-charcoal-950);
	font-size: clamp(22px, 2.4vw, 28px);
	font-weight: var(--rjcrm-weight-bold);
	letter-spacing: -.025em;
	line-height: 1.18;
}

.rjcrm-page-header p {
	max-width: 760px;
	margin-top: 6px;
	color: var(--rjcrm-muted);
	font-size: 12px;
	line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Mobile bottom navigation
   -------------------------------------------------------------------------- */

.rjcrm-mobile-nav {
	display: none;
}

/* --------------------------------------------------------------------------
   Toasts and global feedback
   -------------------------------------------------------------------------- */

.rjcrm-toast-host {
	position: fixed;
	top: calc(var(--rjcrm-topbar-height) + 14px);
	right: 18px;
	z-index: 10020;
	display: grid;
	gap: 9px;
	width: min(380px, calc(100vw - 28px));
	pointer-events: none;
}

.rjcrm-toast {
	display: grid;
	grid-template-columns: 10px minmax(0, 1fr) 32px;
	align-items: center;
	gap: 10px;
	min-height: 54px;
	padding: 10px 10px 10px 12px;
	border: 1px solid var(--rjcrm-border);
	border-radius: var(--rjcrm-radius-lg);
	background: var(--rjcrm-surface);
	box-shadow: var(--rjcrm-shadow-lg);
	pointer-events: auto;
	animation: rjcrm-toast-enter var(--rjcrm-motion-base) var(--rjcrm-ease-emphasized) both;
}

.rjcrm-toast.is-leaving {
	animation: rjcrm-toast-exit var(--rjcrm-motion-fast) ease both;
}

.rjcrm-toast__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--rjcrm-info);
	box-shadow: 0 0 0 4px var(--rjcrm-info-bg);
}

.rjcrm-toast--success .rjcrm-toast__dot { background: var(--rjcrm-success); box-shadow: 0 0 0 4px var(--rjcrm-success-bg); }
.rjcrm-toast--warning .rjcrm-toast__dot { background: var(--rjcrm-warning); box-shadow: 0 0 0 4px var(--rjcrm-warning-bg); }
.rjcrm-toast--error .rjcrm-toast__dot { background: var(--rjcrm-danger); box-shadow: 0 0 0 4px var(--rjcrm-danger-bg); }

.rjcrm-toast__message {
	color: var(--rjcrm-charcoal-700);
	font-size: 12px;
	font-weight: var(--rjcrm-weight-semibold);
	line-height: 1.45;
}

.rjcrm-toast__close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--rjcrm-charcoal-400);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.rjcrm-toast__close:hover {
	background: var(--rjcrm-charcoal-50);
	color: var(--rjcrm-charcoal-800);
}

@keyframes rjcrm-toast-enter {
	from { opacity: 0; transform: translate3d(12px, -4px, 0) scale(.985); }
	to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes rjcrm-toast-exit {
	from { opacity: 1; transform: translate3d(0, 0, 0); }
	to { opacity: 0; transform: translate3d(10px, 0, 0); }
}

/* --------------------------------------------------------------------------
   Tablet — productive rail rather than a mobile drawer
   -------------------------------------------------------------------------- */

@media (min-width: 768px) and (max-width: 1180px) {
	.rjcrm-topbar {
		grid-template-columns: minmax(145px, .75fr) minmax(230px, 1.4fr) minmax(150px, .75fr);
		gap: 12px;
		padding-inline: 18px;
	}

	.rjcrm-profile__copy {
		display: none;
	}

	.rjcrm-profile__trigger {
		padding-right: 4px;
	}

	.rjcrm-profile__chevron {
		display: none;
	}
}

/* Override the legacy <=960 mobile drawer behavior: tablet keeps a rail. */
@media (min-width: 768px) {
	.rjcrm-app-layout {
		display: grid !important;
		grid-template-columns: var(--rjcrm-sidebar-width) minmax(0, 1fr);
	}

	.rjcrm-sidebar-collapsed .rjcrm-app-layout {
		grid-template-columns: var(--rjcrm-sidebar-collapsed-width) minmax(0, 1fr);
	}

	.rjcrm-sidebar {
		position: sticky !important;
		left: auto !important;
		top: 0 !important;
		width: auto !important;
		height: 100dvh !important;
		visibility: visible !important;
		transform: none !important;
		box-shadow: 7px 0 26px rgba(18, 23, 28, 0.025) !important;
	}

	.rjcrm-sidebar__close,
	.rjcrm-mobile-menu,
	.rjcrm-drawer-overlay {
		display: none !important;
	}

	.rjcrm-topbar__center {
		display: block !important;
		grid-column: auto !important;
		grid-row: auto !important;
	}

	.rjcrm-content {
		max-width: none !important;
		padding-top: 26px;
		padding-inline: var(--rjcrm-shell-gutter) !important;
	}
}

/* --------------------------------------------------------------------------
   Mobile — compact app bar + bottom navigation + off-canvas drawer
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	:root {
		--rjcrm-topbar-height: 62px;
		--rjcrm-shell-gutter: 13px;
	}

	.rjcrm-app-layout,
	.rjcrm-sidebar-collapsed .rjcrm-app-layout {
		display: block !important;
	}

	.rjcrm-sidebar {
		position: fixed !important;
		left: 0 !important;
		top: 0 !important;
		width: min(320px, 88vw) !important;
		height: 100dvh !important;
		z-index: 100;
		visibility: hidden !important;
		transform: translateX(-104%) !important;
		box-shadow: var(--rjcrm-shadow-overlay) !important;
	}

	.rjcrm-sidebar.is-open {
		visibility: visible !important;
		transform: translateX(0) !important;
	}

	.rjcrm-sidebar__header,
	.rjcrm-sidebar-collapsed .rjcrm-sidebar__header {
		justify-content: space-between;
		min-height: 68px;
		padding: 11px 12px 11px 14px;
	}

	.rjcrm-sidebar-collapsed .rjcrm-sidebar__brand-link {
		max-width: 190px;
	}

	.rjcrm-sidebar-collapsed .rjcrm-sidebar .rjcrm-brand__text,
	.rjcrm-sidebar-collapsed .rjcrm-nav__label,
	.rjcrm-sidebar-collapsed .rjcrm-sidebar__secure-copy {
		display: flex;
	}

	.rjcrm-sidebar-collapsed .rjcrm-sidebar__secure-copy {
		display: grid;
	}

	.rjcrm-sidebar__collapse {
		display: none;
	}

	.rjcrm-sidebar__close {
		display: inline-grid !important;
	}

	.rjcrm-sidebar-collapsed .rjcrm-sidebar__header-actions {
		position: static;
	}

	.rjcrm-nav,
	.rjcrm-sidebar-collapsed .rjcrm-nav {
		padding: 12px 10px 18px;
	}

	.rjcrm-nav__group-label,
	.rjcrm-sidebar-collapsed .rjcrm-nav__group-label {
		height: auto;
		margin: 0 10px 7px;
		overflow: visible;
		background: transparent;
		color: var(--rjcrm-charcoal-400);
	}

	.rjcrm-nav__group + .rjcrm-nav__group,
	.rjcrm-sidebar-collapsed .rjcrm-nav__group + .rjcrm-nav__group {
		margin-top: 16px;
		padding-top: 14px;
		border-top: 1px solid var(--rjcrm-divider);
	}

	.rjcrm-nav__link,
	.rjcrm-sidebar-collapsed .rjcrm-nav__link {
		justify-content: flex-start;
		min-height: 48px;
		padding-inline: 11px;
	}

	.rjcrm-sidebar-collapsed .rjcrm-sidebar__secure {
		justify-content: flex-start;
		padding: 10px 11px;
		border: 1px solid var(--rjcrm-border);
		background: var(--rjcrm-surface-subtle);
	}

	.rjcrm-drawer-overlay {
		position: fixed !important;
		inset: 0;
		z-index: 95;
		background: rgba(18, 23, 28, .45);
		backdrop-filter: blur(2px);
	}

	.rjcrm-drawer-overlay:not([hidden]) {
		display: block !important;
	}

	.rjcrm-topbar {
		grid-template-columns: minmax(0, 1fr) auto !important;
		gap: 8px;
		min-height: var(--rjcrm-topbar-height);
		padding: 8px 10px 8px 11px !important;
		background: rgba(255, 255, 255, .97);
	}

	.rjcrm-topbar__left {
		gap: 8px;
	}

	.rjcrm-mobile-menu {
		display: inline-grid !important;
		width: 40px;
		height: 40px;
		border: 1px solid var(--rjcrm-border);
		background: var(--rjcrm-surface);
	}

	.rjcrm-topbar__title > span {
		display: none;
	}

	.rjcrm-topbar__title > strong {
		font-size: 13px;
	}

	.rjcrm-topbar__center {
		display: none !important;
	}

	.rjcrm-topbar__actions {
		gap: 5px;
	}

	.rjcrm-topbar__notification {
		display: inline-grid !important;
	}

	.rjcrm-profile__copy,
	.rjcrm-profile__chevron {
		display: none !important;
	}

	.rjcrm-profile__trigger {
		min-height: 40px;
		padding: 1px;
		border-color: transparent;
	}

	.rjcrm-profile__trigger:hover,
	.rjcrm-profile__trigger[aria-expanded="true"] {
		background: transparent;
	}

	.rjcrm-avatar {
		width: 36px;
		height: 36px;
	}

	.rjcrm-dropdown-menu {
		position: fixed;
		top: calc(var(--rjcrm-topbar-height) + 8px);
		right: 10px;
		width: min(310px, calc(100vw - 20px));
	}

	.rjcrm-notification-dropdown {
		position: fixed;
		left: 10px;
		right: 10px;
		top: calc(var(--rjcrm-topbar-height) + 8px);
		width: auto;
		max-height: calc(100dvh - var(--rjcrm-topbar-height) - var(--rjcrm-mobile-nav-height) - 30px);
		overflow-y: auto;
	}

	.rjcrm-content {
		width: 100%;
		max-width: none !important;
		padding: 18px var(--rjcrm-shell-gutter) calc(var(--rjcrm-mobile-nav-height) + env(safe-area-inset-bottom) + 28px) !important;
	}

	.rjcrm-page-header {
		margin-bottom: 16px;
	}

	.rjcrm-breadcrumbs {
		margin-bottom: 8px;
		font-size: 9px;
	}

	.rjcrm-page-header__title-row {
		gap: 10px;
	}

	.rjcrm-page-header__icon {
		width: 38px;
		height: 38px;
		flex-basis: 38px;
		border-radius: 11px;
	}

	.rjcrm-page-header__icon .rjcrm-icon {
		width: 18px;
		height: 18px;
	}

	.rjcrm-page-header h1 {
		font-size: clamp(20px, 6vw, 24px);
	}

	.rjcrm-page-header p {
		font-size: 11px;
		line-height: 1.5;
	}

	.rjcrm-mobile-nav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 80;
		display: block;
		min-height: calc(var(--rjcrm-mobile-nav-height) + env(safe-area-inset-bottom));
		padding-bottom: env(safe-area-inset-bottom);
		border-top: 1px solid var(--rjcrm-border);
		background: rgba(255, 255, 255, .97);
		box-shadow: 0 -10px 30px rgba(18, 23, 28, .06);
		backdrop-filter: blur(16px);
	}

	.rjcrm-mobile-nav__inner {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		align-items: stretch;
		min-height: var(--rjcrm-mobile-nav-height);
		padding: 6px 6px 5px;
	}

	.rjcrm-mobile-nav__item {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		gap: 3px;
		min-width: 0;
		min-height: 56px;
		padding: 5px 2px;
		border: 0;
		border-radius: 12px;
		background: transparent;
		color: var(--rjcrm-charcoal-400);
		font: inherit;
		font-size: 9px;
		font-weight: var(--rjcrm-weight-semibold);
		line-height: 1.15;
		text-align: center;
		text-decoration: none;
		cursor: pointer;
	}

	.rjcrm-mobile-nav__item::after {
		content: "";
		position: absolute;
		left: 50%;
		bottom: 1px;
		width: 20px;
		height: 2px;
		border-radius: var(--rjcrm-radius-pill);
		background: transparent;
		transform: translateX(-50%);
	}

	.rjcrm-mobile-nav__item:hover,
	.rjcrm-mobile-nav__item:focus-visible {
		background: var(--rjcrm-charcoal-50);
		color: var(--rjcrm-charcoal-700);
		text-decoration: none;
	}

	.rjcrm-mobile-nav__item.is-active {
		background: var(--rjcrm-brand-gold-50);
		color: var(--rjcrm-charcoal-950);
	}

	.rjcrm-mobile-nav__item.is-active::after {
		background: var(--rjcrm-brand-gold-500);
	}

	.rjcrm-mobile-nav__icon {
		display: grid;
		place-items: center;
		width: 24px;
		height: 24px;
	}

	.rjcrm-mobile-nav__icon .rjcrm-icon {
		width: 19px;
		height: 19px;
	}

	.rjcrm-mobile-nav__item.is-active .rjcrm-mobile-nav__icon {
		color: var(--rjcrm-brand-gold-700);
	}

	.rjcrm-toast-host {
		top: auto;
		left: 10px;
		right: 10px;
		bottom: calc(var(--rjcrm-mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
		width: auto;
	}

	.rjcrm-toast {
		min-height: 52px;
		border-radius: 14px;
	}
}

@media (max-width: 390px) {
	.rjcrm-topbar__title > strong {
		max-width: 145px;
	}

	.rjcrm-mobile-nav__item {
		font-size: 8px;
	}

	.rjcrm-mobile-nav__icon .rjcrm-icon {
		width: 18px;
		height: 18px;
	}
}

@media (max-width: 340px) {
	.rjcrm-topbar__title > strong {
		max-width: 112px;
	}

	.rjcrm-topbar__actions .rjcrm-icon-button {
		width: 36px;
		height: 36px;
	}

	.rjcrm-mobile-nav__item {
		font-size: 7.5px;
		letter-spacing: -.01em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rjcrm-app-layout,
	.rjcrm-sidebar,
	.rjcrm-sidebar__collapse .rjcrm-icon,
	.rjcrm-toast,
	.rjcrm-shell-progress span {
		transition: none !important;
		animation: none !important;
	}

	.rjcrm-shell-progress.is-active span {
		width: 100%;
		transform: none;
	}
}

/* Configurable shell branding. */
.rjcrm-sidebar .rjcrm-brand--has-main .rjcrm-brand__custom-main {
	width: 172px;
	height: 46px;
}
.rjcrm-sidebar .rjcrm-brand__custom-main img { object-position: left center; }
.rjcrm-sidebar .rjcrm-brand__custom-compact {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	place-items: center;
}
.rjcrm-sidebar .rjcrm-brand__custom-compact img {
	max-width: 38px;
	max-height: 38px;
	margin: auto;
	object-position: center;
}
.rjcrm-sidebar-collapsed .rjcrm-sidebar .rjcrm-brand--has-main .rjcrm-brand__custom-main { display: none; }
.rjcrm-sidebar-collapsed .rjcrm-sidebar .rjcrm-brand--has-compact .rjcrm-brand__custom-compact { display: grid; }
.rjcrm-sidebar-collapsed .rjcrm-sidebar .rjcrm-brand--has-main:not(.rjcrm-brand--has-compact) .rjcrm-brand__fallback-mark { display: grid; }
.rjcrm-topbar__mobile-brand { display: none; }

@media (max-width: 960px) {
	.rjcrm-sidebar .rjcrm-brand--has-main .rjcrm-brand__custom-main { display: none; }
	.rjcrm-sidebar .rjcrm-brand--has-compact .rjcrm-brand__custom-compact { display: grid; }
	.rjcrm-sidebar .rjcrm-brand--has-main:not(.rjcrm-brand--has-compact) .rjcrm-brand__fallback-mark { display: grid; }
	.rjcrm-sidebar__brand-link { max-width: 54px; }
	.rjcrm-topbar__mobile-brand { display: block; width: 30px; flex: 0 0 30px; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand { display: grid; place-items: center; width: 30px; height: 30px; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand__custom-main,
	.rjcrm-topbar__mobile-brand .rjcrm-brand__fallback-text { display: none; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand--has-compact .rjcrm-brand__custom-compact { display: grid; width: 30px; height: 30px; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand--has-compact .rjcrm-brand__fallback-mark { display: none; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand__custom-compact img { max-width: 28px; max-height: 28px; object-position: center; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand__fallback-mark { display: grid; width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
	.rjcrm-topbar__mobile-brand .rjcrm-brand__fallback-mark svg { width: 18px; height: 18px; }
}
