/* The Active Pharm refresh (2026-11-23): AtlasMPS's current shell and Atlas|CM's patterns brought to cdpartner, in
   The Active Pharm's own brand. Loaded last in every layout head (after liquid-glass.css and live-ui.css).
   Important overrides of liquid-glass.css sit in its first layer, lg-controls, whose !important rules outrank the
   others (layered !important beats unlayered !important, and the first layer wins among layers). */

/* ── 1. Avatar menu: Appearance (light/dark), moved here from the top bar ──────────────────────────────────────────
   The menu sits inside .app-header, so the top bar's switch rules (white labels on the brand bar, labels hidden on
   phones) would reach it; these put the switch back in the menu's own colors. */
@layer lg-controls {
	.app-header .sa-dropdown-theme { cursor: pointer; user-select: none; }
	.app-header .sa-dropdown-theme .sa-theme-switch { display: inline-flex !important; align-items: center; gap: 8px !important; }
	.app-header .sa-dropdown-theme .sa-theme-switch__label {
		display: inline !important; font-size: 0.75rem !important; font-weight: 500 !important;
		color: var(--ui-label-3, #5B6B7F) !important; opacity: 1 !important;
	}
	.app-header .sa-dropdown-theme .sa-theme-switch__label.active { color: var(--ui-label-1, #0F1E35) !important; }
	.app-header .sa-dropdown-theme .sa-theme-switch__track { background: #C3CCD8 !important; }
	.app-header .sa-dropdown-theme .sa-theme-switch__track.dark { background: var(--sa-primary-color, #21436C) !important; }
	[data-theme-mode="dark"] .app-header .sa-dropdown-theme .sa-theme-switch__label { color: #9AA7B6 !important; }
	[data-theme-mode="dark"] .app-header .sa-dropdown-theme .sa-theme-switch__label.active { color: #FAFAFA !important; }
	[data-theme-mode="dark"] .app-header .sa-dropdown-theme .sa-theme-switch__track.dark { background: #5B8DEF !important; }
	.app-header .sa-dropdown-theme:focus-visible { outline: 2px solid var(--sa-primary-color, #21436C); outline-offset: -2px; }
}

/* ── 2. Phone menus: solid sheets under the top bar (AtlasMPS 7.0.0 mobile pass) ──────────────────────────────────
   Below 992px the bar is frosted itself, so a frosted menu inside it can't blur the page (the bar is its backdrop
   root) and the page showed through the avatar menu. On phones the menus open full width less a margin, above the
   tab bar, and scroll on their own. */
@layer lg-controls {
	@media (max-width: 991.98px) {
		.app-header .sa-profile-dropdown {
			background: var(--ui-card, #FFFFFF) !important;
			-webkit-backdrop-filter: none !important; backdrop-filter: none !important;
		}
	}
	@media (max-width: 575.98px) {
		.app-header .sa-profile-dropdown.show,
		#notificationDropdown {
			position: fixed !important;
			inset: calc(env(safe-area-inset-top, 0px) + 56px) 8px auto 8px !important;
			transform: none !important; margin: 0 !important;
			width: auto !important; min-width: 0 !important; max-width: none !important;
			max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 150px) !important;
			overflow-y: auto !important; overscroll-behavior: contain;
			background: var(--ui-card, #FFFFFF) !important;
			-webkit-backdrop-filter: none !important; backdrop-filter: none !important;
			border-radius: 14px !important;
			box-shadow: 0 18px 48px rgba(15, 30, 53, 0.22) !important;
		}
	}
}

/* ── 3. Sidebar sections (The Active Pharm's admin nav: Overview, Customers, People, Communication, Settings, Work) ───
   Same quiet sentence-case labels as Atlas|CM's sidebar; the first sits close under the logo. In the collapsed rail
   the labels give way to a hairline between groups, so the icons still read as groups. */
.app-sidebar .ap-sb-label { list-style: none; padding: 14px 20px 4px !important; opacity: 1 !important; line-height: 1.2; }
.app-sidebar .ap-sb-label span { letter-spacing: 0 !important; }
.app-sidebar .main-menu > .ap-sb-label:first-child, .app-sidebar .ap-sb-label:first-of-type { padding-top: 6px !important; }
[data-sa-rail="collapsed"] .app-sidebar .ap-sb-label { padding: 6px 0 !important; margin: 6px 14px; font-size: 0 !important; border-top: 1px solid var(--ui-sep, rgba(15, 23, 42, 0.08)); }
[data-sa-rail="collapsed"] .app-sidebar .ap-sb-label span { display: none; }
[data-sa-rail="collapsed"] .app-sidebar .ap-sb-label:first-of-type { border-top: 0; margin-top: 0; padding: 0 !important; }

/* ── 4. Sidebar footer: compact, and never over the last links ───────────────────────────────────────────────────
   The footer is pinned to the sidebar's foot over the scrolling menu (layouts.php, position: absolute), so the last
   links (Store settings, Parent Labels, Task Manager) slid under it. The legal links share one wrapped line, and the
   menu ends with room for the footer so everything scrolls clear of it. The footer's own glass (inherited, 86%) let
   the links under it read through ("Sett" behind the copyright line): the same glass twice over and a blur hide them. */
@layer lg-controls {
	.app-sidebar .sidebar-footer {
		padding: 9px 14px 10px !important;
		background: linear-gradient(var(--ui-glass-thick), var(--ui-glass-thick)) var(--ui-glass-thick) !important;
		-webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
	}
	.app-sidebar .sidebar-footer .text-center.mt-1 { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 0 10px; margin-top: 2px !important; }
	.app-sidebar .sidebar-footer .text-center.mt-1 > a.d-block { display: inline !important; }
}
.app-sidebar .main-menu { padding-bottom: 96px; }
[data-sa-rail="collapsed"] .app-sidebar .main-menu { padding-bottom: 24px; }

/* ── 5. Consultant and clinic portals ──────────────────────────────────────────────────────────────────────────── */
@layer lg-controls {
	/* A falling number read green: the shared rule painted every change line green, .is-down and .is-flat included. */
	.cp-kpi-tile__change.is-down { color: var(--ui-red, #B91C1C) !important; }
	.cp-kpi-tile__change.is-flat { color: var(--ui-label-3, #5B6B80) !important; }
	/* The old consultant skeleton was black at 4-8%, invisible in dark mode: it takes the live-ui shimmer's colors. */
	.cp-skeleton { background: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) 0 0 / 300% 100% !important; animation: sk-pan var(--sk-speed, 1.5s) linear infinite !important; }
	/* An error or empty message in the account grid spans the whole row instead of one card's cell. */
	.cp-grid > .cp-empty, .cp-kpi-tiles > .cp-empty { grid-column: 1 / -1; }
	/* Numbers keep their width while they roll (only the first consultant stat card set this inline). */
	:is(.cs-stat-card__value, .ap-stat-tile__value, .ap-kpi-tile__value, .cp-stat-tile__value) { font-variant-numeric: tabular-nums; }

	@media (max-width: 575.98px) {
		/* mobile.css shrinks every heading on phones (an h6 to 0.75rem), which left these titles smaller than the text
		   under them. Each gets back a phone size of its own. */
		.cp-account-card__name { font-size: 0.95rem !important; }
		.ap-panel__title { font-size: 0.95rem !important; }
		.cp-page-banner h4 { font-size: 1.15rem !important; }
		:is(.ap-orders-hero__title, .ap-cart-hero__title, .ap-catalog-hero__title) { font-size: 1.35rem !important; }

		/* The consultant banner: one compact line of title on phones, so the accounts start sooner. */
		.cp-page-banner { padding: 0.8rem 1rem !important; margin-bottom: 0.75rem !important; }
		.cp-page-banner::after, .cp-page-banner p { display: none !important; }

		/* The navy summary band: two by two, without the dividers meant for one row. */
		.cp-summary { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; padding: 0.9rem 1rem !important; gap: 0.75rem !important; }
		.cp-summary__stat + .cp-summary__stat { border-left: 0 !important; padding-left: 0 !important; }
		.cp-summary__icon { width: 30px !important; height: 30px !important; font-size: 0.9rem !important; }
		.cp-summary__value { font-size: 1.2rem !important; }

		/* Stat tiles in a row swipe sideways like the clinic portal's, instead of a wall of tiles above the list. */
		/* :not([style*="none"]): the page hides the row with an inline display: none when there are no accounts. */
		:is(.cp-kpi-tiles, .ap-refresh-strip):not([style*="none"]) {
			display: flex !important; flex-wrap: nowrap !important; gap: 10px !important; overflow-x: auto; scroll-snap-type: x mandatory;
			scrollbar-width: none; padding-bottom: 2px;
		}
		:is(.cp-kpi-tiles, .ap-refresh-strip)::-webkit-scrollbar { display: none; }
		:is(.cp-kpi-tiles, .ap-refresh-strip) > * { flex: 0 0 min(72%, 220px) !important; max-width: none !important; scroll-snap-align: start; min-width: 0; }

		/* Account filter chips: one swipeable row; the search box full width. */
		.cp-account-filters { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
		.cp-account-filters::-webkit-scrollbar { display: none; }
		.cp-account-filters > * { flex: none; }
		#cpAccountSearch { max-width: none !important; width: 100% !important; }

		/* The order pipeline shows the three newest on a phone; "View All Orders" in its header has the rest. */
		#cpOrderPipelineBody > tr:nth-child(n + 4) { display: none !important; }

		/* Clinic list pages: the banner keeps its buttons, in one row, without the long description. */
		.ap-cta-banner__desc, .ap-cta-banner__icon { display: none !important; }
		.ap-cta-banner__actions, .ap-cta-banner .ap-cta-banner__actions { flex-direction: row !important; flex-wrap: wrap; }
		.ap-orders-hero__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

		/* Quick View on a phone: one column (the 200px image column left the details 100px wide). */
		.ap-qv-grid { grid-template-columns: 1fr !important; }
		/* A product with no photo doesn't need a tall photo box on a phone. */
		.ap-product-card__media:not(:has(img)) { aspect-ratio: 16 / 9 !important; }
		.ap-pdp-media:not(:has(img)) { max-height: 220px !important; }

		/* The consultant account page: its map shorter on a phone. */
		#cpOverviewMap { height: 180px !important; min-height: 180px !important; }
	}
	/* Touch screens: the Quick View button is invisible until hover, which never comes, yet it took taps in the middle
	   of every product photo. */
	@media (hover: none) { .ap-quickview-btn { display: none !important; } }

	/* Orders as cards on a phone: the actions cell has an empty label, which still reserved 90px before Reorder/PDF. */
	td[data-label=""]::before { display: none !important; }

	/* Small controls get a 40px+ target on touch screens. */
	@media (pointer: coarse) {
		:is(.ap-save-btn, .ap-cart-line__remove, .ap-cart-drawer__line-remove, .ap-search__clear, .ap-home-map__link) { min-width: 40px !important; min-height: 40px !important; }
		:is(.ap-filter-pill, .cp-view-toggle button, .cp-account-filter) { min-height: 40px !important; }
	}
}

/* ── 6. Admin pages ─────────────────────────────────────────────────────────────────────────────────────────────── */
@layer lg-controls {
	/* Stat cards fit their content at every width: mobile.css put the old floor back as 220px and 180px !important. */
	.sa-stats-row .sa-stat-card { min-height: 0 !important; }
	/* Numbers keep their width while they roll. */
	:is(.sa-mini-stat__value, .sa-legend-value, .rr-stat-tile__value, .sa-am-stat__value, .pst-kpi__value, .notif-kpi__val, .actlog-kpi__val, .tsk-kpi__val, .tbi-pace__value, .tb-due__value, .sa-stat-card__breakdown-value) { font-variant-numeric: tabular-nums; }

	@media (max-width: 575.98px) {
		/* A lone stat card (the dashboard's Orders needing attention) takes the row instead of half of it. */
		.sa-stats-row > .sa-stat-card:only-child { flex: 1 1 auto !important; max-width: none !important; width: 100% !important; }
		/* KPI cards readable on a phone: mobile.css made the value 0.88rem and its labels 0.54rem. */
		.sa-kpi-card__value { font-size: 1.15rem !important; }
		:is(.sa-kpi-card__label, .sa-kpi-card__prev, .sa-kpi-card__sub, .sa-kpi-card__change) { font-size: 0.6875rem !important; }
		/* The controls bar: "Updated just now" gives its line to the buttons, which wrap instead of squeezing. */
		.sa-last-updated { display: none !important; }
		.sa-controls-bar > .d-flex { flex-wrap: wrap !important; }
		/* The dashboard's "View Full Analytics" pill: the tab bar already has Analytics on a phone. */
		.page-header-breadcrumb .sa-export-pill[href$="/analytics/"] { display: none !important; }
		/* Charts the phone rules missed (260px and 400px boxes). */
		.sa-chart-card__body div[style*="height:260px"] { height: 160px !important; }
		.sa-chart-card__body div[style*="height:400px"] { height: 200px !important; }
	}
}
/* KPI rows as wide as their cards: a row of three cards had five columns, and two-card rows left half the row empty. */
@media (min-width: 577px) {
	.sa-kpi-row--five:has(> :nth-child(3):last-child), .sa-kpi-row:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
	.sa-kpi-row:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
	.sa-kpi-row--five:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* ── 7. Tabs: Atlas|CM's pill track (soft track, the selected tab a raised white pill), one row that scrolls sideways ──
   Every horizontal tab style the admin and consultant pages use (underlined, justified pills, nav-tabs) gets the one
   look; markup and Bootstrap's tab script are unchanged. Vertical tab lists (flex-column) keep theirs. */
@layer lg-controls {
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) {
		display: inline-flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 0.25rem !important;
		width: auto !important; max-width: 100% !important; overflow-x: auto !important; overflow-y: hidden !important; scrollbar-width: none;
		margin: 0 0 1rem !important; padding: 0.25rem !important; list-style: none !important;
		background: var(--ui-fill, rgba(15, 23, 42, 0.04)) !important; border: 1px solid var(--ui-sep, rgba(15, 23, 42, 0.08)) !important;
		border-radius: 999px !important; box-shadow: none !important;
	}
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6)::-webkit-scrollbar { display: none; }
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) > .nav-item {
		margin: 0 !important; flex: 0 0 auto !important; border: 0 !important; background: none !important;
	}
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link {
		display: inline-flex !important; align-items: center !important; justify-content: center; gap: 0.4rem !important;
		min-height: 34px; margin: 0 !important; padding: 0.4rem 1rem !important; width: auto !important;
		border: 0 !important; border-radius: 999px !important; background: transparent !important; box-shadow: none !important;
		color: var(--ui-label-2, #475569) !important; font-size: 0.86rem !important; font-weight: 600 !important; line-height: 1.25 !important;
		white-space: nowrap !important; opacity: 1 !important; transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
	}
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link::after { content: none !important; }
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link:hover { color: var(--ui-label-1, #0F172A) !important; }
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link.active {
		background: var(--ui-card, #FFFFFF) !important; color: var(--ui-label-1, #0F172A) !important; box-shadow: 0 1px 3px rgba(15, 30, 53, 0.12) !important;
	}
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link:focus-visible {
		outline: 2px solid color-mix(in srgb, var(--sa-primary-color, #21436C) 55%, transparent) !important; outline-offset: 1px;
	}
	/* Icons take the tab's own color (the old filled pills colored the active tab's icon white). */
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link :is(i, .lni, svg) { color: inherit !important; margin-right: 0 !important; }
	/* A count inside a tab: one small pill. */
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link .badge {
		display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.2rem; padding: 0 0.4rem !important; margin: 0 !important;
		border-radius: 999px !important; font-size: 0.72rem !important; font-weight: 700 !important; line-height: 1 !important; font-variant-numeric: tabular-nums;
		background: rgba(15, 30, 53, 0.07) !important; color: var(--ui-label-2, #475569) !important; border: 0 !important;
	}
	:root[data-entity="2000"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link.active .badge {
		background: color-mix(in srgb, var(--sa-primary-color, #21436C) 12%, transparent) !important; color: var(--sa-primary-color, #21436C) !important;
	}
	:root[data-entity="2000"][data-theme-mode="dark"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) {
		background: rgba(255, 255, 255, 0.04) !important; border-color: rgba(255, 255, 255, 0.1) !important;
	}
	:root[data-entity="2000"][data-theme-mode="dark"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link { color: #AAB4C0 !important; }
	:root[data-entity="2000"][data-theme-mode="dark"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link:hover { color: #E8E8E8 !important; }
	:root[data-entity="2000"][data-theme-mode="dark"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link.active { background: #2A2F3A !important; color: #F1F5F9 !important; box-shadow: none !important; }
	:root[data-entity="2000"][data-theme-mode="dark"] :is(.nav.sa-underline-tabs, .nav.sa-tabs, .nav.sa-doc-lib-tabs, .main-content .nav.nav-tabs:not(.flex-column), .main-content .nav.tab-style-6) .nav-link .badge { background: rgba(255, 255, 255, 0.1) !important; color: #AAB4C0 !important; }

	/* The tab card that sits on top of a list card: room under the track. */
	:root[data-entity="2000"] .sa-tab-card-top > .card-body { padding-bottom: 0.25rem !important; }
	/* A tab bar with a single tab (Customers shows only Clinics for The Active Pharm) says nothing: it goes, and the
	   card under it gets its rounded top and border back. */
	:root[data-entity="2000"] .sa-tab-card-top:has(.nav > .nav-item:only-child) { display: none !important; }
	:root[data-entity="2000"] .sa-tab-card-top:has(.nav > .nav-item:only-child) + .tab-content > .tab-pane > .row:first-child .card:first-child,
	:root[data-entity="2000"] .sa-tab-card-top:has(.nav > .nav-item:only-child) + .tab-content > .tab-pane > .card:first-child {
		border-top-left-radius: var(--ui-r-card, 14px) !important; border-top-right-radius: var(--ui-r-card, 14px) !important;
		border-top: 1px solid var(--ui-sep, rgba(15, 23, 42, 0.08)) !important; margin-top: 0 !important;
	}
}

/* ── 8. Charts shimmer until they're drawn ─────────────────────────────────────────────────────────────────────────
   A chart box sat empty and white while its data loaded. Chart.js (3.9 here) puts box-sizing in the canvas's style
   when it builds the chart, so a chart box whose canvas has no such style yet is still waiting: it shimmers in the
   chart's own size, and stops the moment the chart is drawn. Sparklines inside KPI cards are left out. */
.main-content :is(.sa-chart-card__body > div, .sa-chart-canvas-wrap, .tbi-canvas, [class*="chart"] > div[style*="height"], div[style*="height"]:not(.sa-kpi-card__sparkwrap)):has(> canvas:not([style*="box-sizing"])) {
	border-radius: 10px;
	background: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) 0 0 / 300% 100%;
	animation: sk-pan var(--sk-speed, 1.5s) linear infinite;
}
@media (prefers-reduced-motion: reduce) {
	.main-content :is(.sa-chart-card__body > div, .sa-chart-canvas-wrap, .tbi-canvas, [class*="chart"] > div[style*="height"], div[style*="height"]:not(.sa-kpi-card__sparkwrap)):has(> canvas:not([style*="box-sizing"])) { animation: sk-fade 2s ease-in-out infinite; }
}

/* ── 9. Dark mode and phone details ─────────────────────────────────────────────────────────────────────────────── */
/* atlasmps-custom.css paints every [class*="stat-card"] and [class*="kpi-card"] element #202020 in dark mode, which
   reached the parts inside a card (its header, value, label lines), so each line sat on its own grey block. The parts
   are see-through; icons, accents, badges, bars and sparklines keep their own colors. */
@layer lg-controls {
	[data-theme-mode="dark"] :is([class*="stat-card__"], [class*="kpi-card__"]):not([class*="__icon"]):not([class*="__accent"]):not([class*="__badge"]):not([class*="__bar"]):not([class*="__change"]):not([class*="__spark"]):not([class*="__pill"]):not(.sa-stat-card--loading):not(.sa-loading) {
		background-color: transparent !important;
	}
}
@media (max-width: 575.98px) {
	/* KPI rows two to a row on phones: a last card on its own takes the full row instead of half of it. */
	:is(.sa-kpi-row, .sa-kpi-row--five) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Initials in place of a wide logo in the clinic portal's avatar (apAvatarFit() in layouts.php). */
.ap-avatar-initials { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 28px; min-height: 28px; background: var(--sa-primary-color, #21436C); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1; }

/* ── 10. Task panel fields at 16px on a phone (iPhone zooms into a smaller field) ───────────────────────────────────
   task-manager.css (shared byte for byte with AtlasMPS) has this rule in AtlasMPS's first layer, sa-controls, which is
   inert here; this is the same rule in cdpartner's first layer. */
@layer lg-controls {
	@media (max-width: 575.98px) {
		.tm-peek #tmDescription,
		.tm-peek .tm-prop__value--assignee .form-select, .tm-peek .tm-prop__value--repeat .form-select,
		.tm-peek :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea) { font-size: 16px !important; }
	}
}

/* ── 11. Clinic Home on a phone: the quick actions the tab bar already has (Shop, Orders, Cart) step aside, so the
   numbers and Reorder come sooner; Patients stays, across the row. ── */
@media (max-width: 575.98px) {
	.ap-quick-actions > .ap-quick-action:is([href$="/customers/catalog/"], [href$="/customers/orders/"], [href$="/customers/cart/"]) { display: none !important; }
	.ap-quick-actions:has(> .ap-quick-action[href$="/customers/patients/"]) { grid-template-columns: 1fr !important; }
}

/* ── 12. KPI grids as wide as their tiles: the clinic Analytics grid had six columns for five tiles. ── */
@media (min-width: 1100px) {
	.ap-kpi-grid:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
	.ap-kpi-grid:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* ── 13. Every sidebar's section labels read the same: the consultant and clinic portals' collapsible labels were faded
   to half and letter-spaced; they match the admin sidebar's quiet sentence-case labels. ── */
.app-sidebar .sa-sb-section-toggle { opacity: 1 !important; }
.app-sidebar .sa-sb-section-toggle span, .app-sidebar .sa-sb-modules-label span { letter-spacing: 0 !important; }

/* ── 14. A table's "Loading..." row shimmers as that table's rows (samg-loading.js tableRows()): the placeholder row is
   hidden and the skeleton rows have one bar per column of the table's own header. On a phone, three rows of three. ── */
tr.sk-ph-row { display: none !important; }
tr.sk-ph-skel { pointer-events: none; }
table > tbody > tr.sk-ph-skel > td { padding-top: 15px !important; padding-bottom: 15px !important; background: transparent !important; box-shadow: none !important; }
tr.sk-ph-skel .sk { height: 10px; max-width: 220px; }
@media (max-width: 575.98px) {
	tbody > tr.sk-ph-skel ~ tr.sk-ph-skel ~ tr.sk-ph-skel ~ tr.sk-ph-skel { display: none !important; }
	tr.sk-ph-skel > td:nth-child(n + 4) { display: none !important; }
}

/* ── 15. A stat card's smaller figures shimmer with its number: "This month --", "This week --" and a KPI card's change
   pill showed dashes while the number above them shimmered. They follow the number's own loading class, so they stop
   the moment it lands. ── */
@layer lg-controls {
	.sa-stat-card:has(.sa-stat-card--loading) .sa-stat-card__breakdown-value,
	.sa-kpi-card:has(.sa-kpi-card__value.sa-loading) .sa-kpi-card__change {
		display: inline-block; min-width: 2.2em; border-radius: 5px;
		color: transparent !important; -webkit-text-fill-color: transparent !important; border-color: transparent !important;
		background-color: transparent !important; background-repeat: no-repeat !important; background-size: 300% 100% !important;
		background-image: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) !important;
		animation: sk-pan var(--sk-speed, 1.5s) linear infinite;
	}
}

/* ── 16. Ring charts load as a ring, their legend as legend rows: a doughnut card (chart beside an id="...Legend" box the
   script fills) shimmered as a plain square with nothing beside it. While the legend is empty and the canvas undrawn,
   the chart box shimmers in a ring and the legend in three dot-and-label rows. ── */
.sa-chart-card__body .row:has(> [id$="Legend"]:empty) div:has(> canvas:not([style*="box-sizing"])) {
	border-radius: 0;
	-webkit-mask: radial-gradient(circle closest-side, transparent 56%, #000 57%, #000 97%, transparent 100%);
	        mask: radial-gradient(circle closest-side, transparent 56%, #000 57%, #000 97%, transparent 100%);
}
.sa-chart-card__body .row > [id$="Legend"]:empty { position: relative; min-height: 120px; }
.sa-chart-card__body .row > [id$="Legend"]:empty::before {
	content: ""; position: absolute; inset: 6px 8px 0;
	background: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) 0 0 / 300% 100%;
	animation: sk-pan var(--sk-speed, 1.5s) linear infinite;
	--sk-legend: radial-gradient(circle 5px at 6px 9px, #000 96%, transparent 100%), linear-gradient(#000 0 0) 20px 2px / 34% 14px no-repeat, linear-gradient(#000 0 0) 20px 21px / 52% 8px no-repeat,
		radial-gradient(circle 5px at 6px 49px, #000 96%, transparent 100%), linear-gradient(#000 0 0) 20px 42px / 28% 14px no-repeat, linear-gradient(#000 0 0) 20px 61px / 46% 8px no-repeat,
		radial-gradient(circle 5px at 6px 89px, #000 96%, transparent 100%), linear-gradient(#000 0 0) 20px 82px / 30% 14px no-repeat, linear-gradient(#000 0 0) 20px 101px / 40% 8px no-repeat;
	-webkit-mask: var(--sk-legend); mask: var(--sk-legend);
}
@media (prefers-reduced-motion: reduce) { .sa-chart-card__body .row > [id$="Legend"]:empty::before { animation: sk-fade 2s ease-in-out infinite; } }

/* ── 17. The Customers count while the list loads: a short bar where "12 customers" lands. On a phone the toolbar stacks
   and stretched the empty count into a bar the width of the card; it keeps the count's own width there. ── */
@media (max-width: 576px) {
	.sa-customer-cards-count[data-sk]:empty { align-self: center; width: 5.5em; min-width: 0; min-height: 1.2em; }
}

/* ── 18. Email Engine template cards: Edit, Preview and Test share a row a third each, and the button system's padding and
   type left "Preview" too narrow, so its icon wrapped above the word and the buttons grew to two lines. The card's
   own size comes back: smaller type, tight padding, one line. ── */
@layer lg-controls {
	.sa-template-card__actions .btn {
		display: inline-flex !important; align-items: center; justify-content: center;
		padding: 0.375rem 0.5rem !important; font-size: 0.8125rem !important; white-space: nowrap;
	}
}
