body #ednara-portal-loader {
	position: fixed;
	z-index: 100;
	inset: 0;
	display: grid;
	place-items: center;
	background: #f7f5f8;
	color: #6b2fa7;
	font-family: system-ui, sans-serif;
}

body.ednara-portal-shell-active #ednara-portal-loader {
	display: none !important;
}

body.ednara-portal-shell-active {
	--ednara-violet: #6b2fa7;
	--ednara-violet-soft: #f3ebf9;
	--ednara-muted: #6b7280;
	--ednara-border: #ececf0;
	--ednara-surface: #ffffff;
	--ednara-ink: #111111;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

html:has(body.ednara-portal-shell-active) {
	overflow-x: hidden;
	max-width: 100%;
}

body.ednara-portal-shell-active #ednara-portal-shell {
	position: fixed;
	z-index: 50;
	inset: 0;
	pointer-events: none;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.ednara-portal-shell-active .ednara-stock-sidebar-hidden {
	display: none !important;
	width: 0 !important;
	min-width: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
}

body.ednara-portal-shell-active .portal-sidebar {
	display: flex;
	flex-direction: column;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 51;
	width: 280px;
	height: 100vh;
	padding: 28px 18px 20px;
	box-sizing: border-box;
	background: var(--ednara-surface);
	border-right: 1px solid var(--ednara-border);
	pointer-events: auto;
}

body.ednara-portal-shell-active .portal-topbar,
body.ednara-portal-shell-active .portal-tabbar,
body.ednara-portal-shell-active .portal-more-panel {
	display: none;
}

body.ednara-portal-shell-active .portal-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 48px;
	padding: 0 10px 28px;
}

body.ednara-portal-shell-active .portal-brand__logo {
	width: auto;
	max-width: 48px;
	max-height: 40px;
	object-fit: contain;
}

body.ednara-portal-shell-active .portal-brand__mark[hidden],
body.ednara-portal-shell-active .portal-brand__logo[hidden] {
	display: none !important;
}

body.ednara-portal-shell-active .portal-brand__mark {
	display: grid;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	place-items: center;
	border-radius: 12px;
	background: var(--ednara-ink);
	color: #fff;
	font-size: 18px;
	font-weight: 700;
}

body.ednara-portal-shell-active .portal-brand__copy {
	display: grid;
	min-width: 0;
	gap: 2px;
}

body.ednara-portal-shell-active .portal-brand__copy strong {
	overflow-wrap: break-word;
	word-break: break-word;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.3;
	color: var(--ednara-ink);
}

body.ednara-portal-shell-active .portal-brand__copy span {
	overflow-wrap: break-word;
	word-break: break-word;
	color: var(--ednara-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.35;
}

body.ednara-portal-shell-active .portal-nav {
	display: grid;
	gap: 4px;
}

body.ednara-portal-shell-active .portal-nav__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	color: #374151;
	font-size: 14px;
	font-weight: 550;
	text-decoration: none;
	transition: background 140ms ease, color 140ms ease;
}

body.ednara-portal-shell-active .portal-nav__icon,
body.ednara-portal-shell-active .portal-tabbar__link__icon,
body.ednara-portal-shell-active .portal-more-button__icon {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #4b5563;
}

body.ednara-portal-shell-active .portal-nav__icon svg,
body.ednara-portal-shell-active .portal-tabbar__link__icon svg,
body.ednara-portal-shell-active .portal-more-button__icon svg {
	display: block;
	width: 18px;
	height: 18px;
}

body.ednara-portal-shell-active .portal-nav__link:hover {
	background: #f5f5f6;
	color: var(--ednara-ink);
}

body.ednara-portal-shell-active .portal-nav__link:hover .portal-nav__icon {
	background: #ebebee;
	color: var(--ednara-ink);
}

body.ednara-portal-shell-active .portal-nav__link.is-active {
	background: var(--ednara-violet-soft);
	color: var(--ednara-violet);
	font-weight: 650;
}

body.ednara-portal-shell-active .portal-nav__link.is-active .portal-nav__icon {
	background: #fff;
	color: var(--ednara-violet);
}

body.ednara-portal-shell-active .portal-logout {
	margin-top: auto;
	padding: 14px 14px 6px;
	border-top: 1px solid var(--ednara-border);
	color: var(--ednara-muted);
	font-size: 14px;
	font-weight: 550;
	text-decoration: none;
}

body.ednara-portal-shell-active .portal-logout:hover {
	color: var(--ednara-ink);
}

@media (min-width: 769px) {
	body.ednara-portal-shell-active {
		padding-left: 280px;
		box-sizing: border-box;
		width: 100%;
		max-width: 100%;
		overflow-x: hidden;
	}

	/*
	 * Education SPA root is `flex h-screen w-screen` (100vw). With our 280px
	 * sidebar padding that makes the main column ~280px too wide and clips
	 * the right edge. Force the SPA to the remaining column width instead.
	 */
	body.ednara-portal-shell-active #app,
	body.ednara-portal-shell-active #app > div,
	body.ednara-portal-shell-active #app .w-screen,
	body.ednara-portal-shell-active #app .h-screen {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.ednara-portal-shell-active #app {
		overflow-x: hidden;
	}

	body.ednara-portal-shell-active .portal-sidebar {
		width: 280px;
	}
}

/* Stock sidebar is display:none — keep flex children from reserving width */
/* (rules live on .ednara-stock-sidebar-hidden above) */

/* Wide stock tables / calendars: stay inside the content column */
body.ednara-portal-shell-active #app main,
body.ednara-portal-shell-active #app .flex-1,
body.ednara-portal-shell-active #app .page-container,
body.ednara-portal-shell-active #app .layout-main-section,
body.ednara-portal-shell-active #app .fc,
body.ednara-portal-shell-active #app .fc-view-harness,
body.ednara-portal-shell-active #app .fc-scrollgrid,
body.ednara-portal-shell-active #app .fc-scrollgrid-section,
body.ednara-portal-shell-active #app .fc-timegrid,
body.ednara-portal-shell-active #app .fc-daygrid {
	max-width: 100% !important;
	min-width: 0 !important;
	box-sizing: border-box;
}

body.ednara-portal-shell-active #app .fc,
body.ednara-portal-shell-active #app .fc-view-harness,
body.ednara-portal-shell-active #app .fc-scrollgrid {
	width: 100% !important;
}

/* Attendance calendar: Education uses min-w-[600px] which overflows small columns */
body.ednara-portal-shell-active #app .min-w-\[600px\],
body.ednara-portal-shell-active #app [class*="min-w-[600px]"] {
	min-width: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
}

body.ednara-portal-shell-active #app table {
	width: 100% !important;
	max-width: 100%;
	table-layout: auto;
	box-sizing: border-box;
}

body.ednara-portal-shell-active #app table th,
body.ednara-portal-shell-active #app table td {
	word-break: break-word;
	overflow-wrap: anywhere;
	padding: 8px 10px !important;
	vertical-align: middle;
}

/* If a table is still wider than the card, scroll inside the card only */
body.ednara-portal-shell-active #app .px-5.py-4,
body.ednara-portal-shell-active.ednara-portal-fees #app .px-5.py-4 {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	max-width: 100%;
	box-sizing: border-box;
}

@media (max-width: 768px) {
	body.ednara-portal-shell-active {
		padding-top: calc(64px + env(safe-area-inset-top));
		padding-bottom: calc(72px + env(safe-area-inset-bottom));
		padding-left: 0;
	}

	body.ednara-portal-shell-active #app {
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	body.ednara-portal-shell-active .portal-sidebar {
		display: none;
	}

	body.ednara-portal-shell-active .portal-topbar {
		position: fixed;
		inset: 0 0 auto;
		display: block;
		min-height: 64px;
		padding: env(safe-area-inset-top) 14px 0;
		box-sizing: border-box;
		background: var(--ednara-surface);
		border-bottom: 1px solid var(--ednara-border);
		box-shadow: 0 2px 10px rgb(44 35 50 / 8%);
		pointer-events: auto;
	}

	body.ednara-portal-shell-active .portal-topbar .portal-brand {
		min-height: 63px;
		padding: 0;
	}

	body.ednara-portal-shell-active .portal-topbar .portal-brand__logo {
		max-width: 48px;
		max-height: 36px;
	}

	body.ednara-portal-shell-active .portal-topbar .portal-brand__mark {
		flex-basis: 36px;
		width: 36px;
		height: 36px;
		font-size: 18px;
	}

	body.ednara-portal-shell-active .portal-tabbar {
		position: fixed;
		inset: auto 0 0;
		display: grid;
		grid-template-columns: repeat(6, minmax(0, 1fr));
		min-height: calc(64px + env(safe-area-inset-bottom));
		padding: 4px 4px env(safe-area-inset-bottom);
		box-sizing: border-box;
		background: var(--ednara-surface);
		border-top: 1px solid var(--ednara-border);
		box-shadow: 0 -2px 12px rgb(44 35 50 / 9%);
		pointer-events: auto;
	}

	body.ednara-portal-shell-active .portal-tabbar__link,
	body.ednara-portal-shell-active .portal-more-button {
		display: flex;
		min-width: 0;
		min-height: 44px;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		gap: 2px;
		padding: 3px 1px;
		border: 0;
		border-radius: 8px;
		background: transparent;
		color: var(--ednara-muted);
		font: inherit;
		font-size: 10px;
		font-weight: 600;
		line-height: 1.15;
		text-align: center;
		text-decoration: none;
		cursor: pointer;
	}

	body.ednara-portal-shell-active .portal-tabbar__link__icon,
	body.ednara-portal-shell-active .portal-more-button__icon {
		width: 28px;
		height: 28px;
		font-size: 0;
		line-height: 1;
	}

	body.ednara-portal-shell-active .portal-tabbar__link__icon svg,
	body.ednara-portal-shell-active .portal-more-button__icon svg {
		width: 16px;
		height: 16px;
	}

	body.ednara-portal-shell-active .portal-tabbar__link.is-active,
	body.ednara-portal-shell-active .portal-more-button.is-active,
	body.ednara-portal-shell-active .portal-more-button[aria-expanded="true"] {
		background: transparent;
		color: var(--ednara-violet);
	}

	body.ednara-portal-shell-active .portal-tabbar__link.is-active .portal-tabbar__link__icon,
	body.ednara-portal-shell-active .portal-more-button[aria-expanded="true"] .portal-more-button__icon {
		background: var(--ednara-violet-soft);
		color: var(--ednara-violet);
	}

	body.ednara-portal-shell-active .portal-more-panel {
		position: fixed;
		right: 12px;
		bottom: calc(72px + env(safe-area-inset-bottom));
		left: 12px;
		display: grid;
		gap: 6px;
		padding: 10px;
		border: 1px solid var(--ednara-border);
		border-radius: 14px;
		background: var(--ednara-surface);
		box-shadow: 0 12px 32px rgb(44 35 50 / 20%);
		opacity: 0;
		transform: translateY(12px);
		visibility: hidden;
		pointer-events: none;
		transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
	}

	body.ednara-portal-shell-active .portal-more-panel.is-open {
		opacity: 1;
		transform: translateY(0);
		visibility: visible;
		pointer-events: auto;
	}

	body.ednara-portal-shell-active .portal-more-panel__link {
		display: flex;
		min-height: 44px;
		align-items: center;
		gap: 10px;
		padding: 0 12px;
		border-radius: 9px;
		color: #4d4851;
		font-size: 14px;
		font-weight: 600;
		text-decoration: none;
	}

	body.ednara-portal-shell-active .portal-more-panel__link.is-active {
		background: var(--ednara-violet-soft);
		color: var(--ednara-violet);
	}

	body.ednara-portal-shell-active .portal-more-panel__logout {
		border-top: 1px solid var(--ednara-border);
		border-radius: 0 0 9px 9px;
		color: var(--ednara-muted);
	}
}

/* Mondly-style Fees polish (stock SPA under Ednara shell) */
body.ednara-portal-shell-active.ednara-portal-fees {
	background: #f6f5f8;
}

body.ednara-portal-shell-active.ednara-portal-fees #app {
	background: #f6f5f8;
}

body.ednara-portal-shell-active.ednara-portal-fees #app header h3 {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #111;
}

body.ednara-portal-shell-active.ednara-portal-fees #app .px-5.py-4 {
	margin: 16px 20px 28px;
	padding: 10px 14px 18px !important;
	border: 1px solid #ececf0;
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 8px 24px rgb(17 17 17 / 4%);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Prefer fitting Invoice / Pay Now; denser cells + compact actions */
body.ednara-portal-shell-active.ednara-portal-fees #app table {
	width: 100% !important;
	max-width: 100%;
	table-layout: auto;
}

body.ednara-portal-shell-active.ednara-portal-fees #app table th,
body.ednara-portal-shell-active.ednara-portal-fees #app table td {
	padding: 8px 8px !important;
	font-size: 13px;
	white-space: normal;
}

body.ednara-portal-shell-active.ednara-portal-fees #app table button,
body.ednara-portal-shell-active.ednara-portal-fees #app table .btn {
	white-space: nowrap;
	font-size: 12px !important;
	padding: 4px 8px !important;
	min-height: 0 !important;
}

body.ednara-portal-shell-active.ednara-portal-fees #app .px-5.py-4 [class*="Badge"],
body.ednara-portal-shell-active.ednara-portal-fees #app .px-5.py-4 .inline-flex {
	border-radius: 999px;
	white-space: nowrap;
}

@media (max-width: 768px) {
	body.ednara-portal-shell-active.ednara-portal-fees #app .px-5.py-4 {
		margin: 12px 12px 20px;
		padding: 8px 10px 14px !important;
		border-radius: 16px;
	}
}
