/* ==========================================================================
   Allied Portal
   ========================================================================== */

:root {
	--ap-accent: #54C634;
	--ap-link-hover: #54c634;
	--ap-accent-ink: #fff;
	--ap-sidebar: #292938;
	--ap-sidebar-active: #3F444B;
	--ap-sidebar-text: #fff;
	--ap-bg: #F5F3EF;
	--ap-surface: #fff;
	--ap-surface-2: #FAFAFA;
	--ap-border: #E4E4E4;
	--ap-ink: #16181C;
	--ap-body: #4a4a4a;
	--ap-muted: #959295;
	--ap-radius: 20px;
	--ap-radius-sm: 8px;
	--ap-sidebar-w: 250px;
	--ap-gutter: 45px;
	--ap-logo-w: 120px;
	--ap-font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* ---------- Base ---------- */
body.ap-portal {
	margin: 0;
	background: var(--ap-bg);
	color: var(--ap-body);
	font-family: var(--ap-font);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
.ap-portal h1, .ap-portal h2, .ap-portal h3 { color: var(--ap-ink); font-family: var(--ap-font); line-height: 1.2; margin: 0; }
.ap-portal a { color: inherit; }
.ap-portal a:hover, .ap-portal a:focus-visible, .ap-portal a:active { color: var(--ap-link-hover); }
.ap-portal img { max-width: 100%; height: auto; }
.ap-icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: middle; }

.screen-reader-text {
	border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}
.ap-skip-link:focus {
	clip: auto; clip-path: none; height: auto; width: auto; margin: 0;
	left: 12px; top: 12px; z-index: 1000; padding: 10px 16px;
	background: #fff; color: var(--ap-ink); border-radius: 6px;
}
.ap-portal :focus-visible { outline: 2px solid var(--ap-accent); outline-offset: 2px; }

/* ---------- Shell ---------- */
.ap-shell { min-height: 100vh; }
.ap-main {
	margin-left: var(--ap-sidebar-w);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
.ap-content { flex: 1; padding: var(--ap-gutter); }
.ap-page { width: 100%; max-width: none; display: flex; flex-direction: column; gap: 24px; }
.ap-footer { padding: 20px var(--ap-gutter) 28px; color: var(--ap-muted); font-size: 13px; }

/* ---------- Sidebar ---------- */
.ap-sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--ap-sidebar-w);
	background: var(--ap-sidebar);
	color: var(--ap-sidebar-text);
	padding: 20px;
	overflow-y: auto;
	z-index: 50;
	box-sizing: border-box;
}
.ap-sidebar__head { display: flex; align-items: center; justify-content: center; margin: 4px 0 24px; min-width: 0; }
.ap-sidebar__logo { display: block; text-align: center; text-decoration: none; }
.ap-sidebar__logo .ap-logo { width: var(--ap-logo-w); max-width: 100%; height: auto; display: block; margin: 0 auto; }
.ap-logo-text { display: block; font-size: 20px; font-weight: 700; line-height: 1.3; color: #fff; }
.ap-sidebar__close { display: none; }

/* Keep the sidebar below the WordPress admin bar when logged in. */
.admin-bar .ap-sidebar { top: 32px; }
@media (max-width: 782px) { .admin-bar .ap-sidebar { top: 46px; } }

.ap-sidebar__heading {
	margin: 24px 0 6px;
	color: var(--ap-accent);
	font-size: 20px;
	font-weight: 600;
}

.ap-menu, .ap-menu ul { list-style: none; margin: 0; padding: 0; }
.ap-menu > li { margin-bottom: 2px; }
.ap-menu a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-radius: 4px;
	color: var(--ap-sidebar-text);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background .2s, color .2s;
}
.ap-menu a:hover, .ap-menu a:focus-visible { background: rgba(255,255,255,.06); color: var(--ap-link-hover); }
.ap-menu .current-menu-item > a,
.ap-menu .current_page_item > a { background: var(--ap-sidebar-active); color: var(--ap-link-hover); }
.ap-menu .menu-item-has-children > a::after {
	content: "";
	width: 7px; height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform .25s;
	opacity: .8;
}
.ap-menu .menu-item-has-children.is-open > a::after { transform: rotate(-135deg) translateY(-2px); }
.ap-menu .sub-menu { display: none; padding: 2px 0 4px; }
.ap-menu .is-open > .sub-menu { display: block; animation: ap-drop .25s ease; }
.ap-menu .sub-menu a { padding-left: 28px; font-weight: 400; color: rgba(255,255,255,.82); }
.ap-menu .sub-menu .current-menu-item > a { color: var(--ap-link-hover); background: var(--ap-sidebar-active); }
@keyframes ap-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile top bar ---------- */
.ap-topbar { display: none; }
.ap-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }

@media (max-width: 1024px) {
	:root { --ap-gutter: 24px; }
	.ap-main { margin-left: 0; }
	.ap-topbar {
		position: sticky; top: 0; z-index: 30;
		display: flex; align-items: center; justify-content: space-between;
		padding: 10px 16px;
		background: var(--ap-sidebar);
	}
	.ap-topbar__logo .ap-logo { height: 40px; width: auto; display: block; }
	.ap-topbar__toggle, .ap-sidebar__close {
		background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; line-height: 0;
	}
	.ap-topbar__toggle .ap-icon, .ap-sidebar__close .ap-icon { width: 26px; height: 26px; }
	.ap-sidebar { transform: translateX(-100%); transition: transform .3s ease; width: min(300px, 85vw); }
	.ap-sidebar.is-open { transform: none; }
	.ap-sidebar__head { justify-content: space-between; }
	.ap-sidebar__close { display: block; }
	.ap-sidebar__logo .ap-logo { width: min(var(--ap-logo-w), 140px); margin: 0; }
}

/* ---------- Shared pieces ---------- */
.ap-card {
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	padding: 24px 28px;
}
.ap-card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ap-card__title { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ap-card__text { margin: 8px 0 0; color: var(--ap-body); max-width: 90ch; }
.ap-label {
	font-size: 13px !important;
	font-weight: 500 !important;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ap-muted) !important;
	margin: 0 0 12px !important;
}
.ap-muted { color: var(--ap-muted); margin: 0; }
.ap-eyebrow { color: var(--ap-accent); font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.ap-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ap-section-title { font-size: 24px; font-weight: 600; }
.ap-badge {
	font-size: 12px; font-weight: 600; letter-spacing: .03em;
	padding: 4px 10px; border-radius: 999px;
	background: #ECF8E9; color: #2f7f16;
}
.ap-btn {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--ap-accent); color: var(--ap-accent-ink) !important;
	font-weight: 600; font-size: 14px;
	padding: 10px 20px; border-radius: 6px;
	text-decoration: none; white-space: nowrap;
	border: 1px solid var(--ap-accent);
	transition: filter .2s, background .2s, color .2s;
}
.ap-btn:hover { filter: brightness(.94); }
.ap-btn--ghost { background: #fff; color: var(--ap-accent) !important; }
.ap-btn--ghost:hover { background: var(--ap-accent); color: #fff !important; filter: none; }
.ap-btn--disabled { background: #f0f0f0; border-color: #f0f0f0; color: var(--ap-muted) !important; cursor: default; }
.ap-empty { color: var(--ap-muted); margin: 16px 0 0; }

/* ---------- Page head ---------- */
.ap-page-head { display: flex; flex-direction: column; gap: 10px; }
.ap-crumb {
	align-self: flex-start;
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 14px; color: var(--ap-muted) !important; text-decoration: none;
}
.ap-crumb:hover { color: var(--ap-link-hover) !important; }
.ap-page-title { font-size: 40px; font-weight: 600; }
.ap-page-intro { margin: 0; color: var(--ap-muted); max-width: 90ch; }
.ap-tabs { display: flex; gap: 28px; align-items: baseline; flex-wrap: wrap; }
.ap-tab { font-size: 40px; font-weight: 600; line-height: 1.2; color: #c9c6c9 !important; text-decoration: none; margin: 0; }
.ap-tab:hover { color: var(--ap-link-hover) !important; }
.ap-tab.is-current { color: var(--ap-link-hover) !important; }

/* ---------- Dashboard ---------- */
.ap-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; }
.ap-hero__title { font-size: 40px; font-weight: 600; max-width: 24ch; }
.ap-hero__intro { margin: 14px 0 0; color: var(--ap-muted); font-size: 15px; max-width: 60ch; }
.ap-hero__logo { flex: 0 0 auto; max-width: 200px; }
.ap-hero__logo img { max-height: 120px; width: auto; display: block; }

.ap-recent { padding: 20px 24px; }
.ap-recent__list { list-style: none; margin: 0; padding: 0; }
.ap-recent__item + .ap-recent__item { border-top: 1px solid var(--ap-border); }
.ap-recent__link {
	display: flex; align-items: center; gap: 14px;
	padding: 12px 6px; text-decoration: none; border-radius: 10px;
	transition: background .2s;
}
.ap-recent__link:hover { background: var(--ap-surface-2); }
.ap-recent__icon {
	width: 40px; height: 40px; border-radius: 10px; flex: none;
	display: grid; place-items: center;
	background: #ECF8E9; color: var(--ap-accent);
}
.ap-recent__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ap-recent__title { font-size: 17px; font-weight: 600; color: var(--ap-ink); }
.ap-recent__meta { font-size: 13px; color: var(--ap-muted); }
.ap-recent__arrow { color: var(--ap-muted); transition: transform .2s, color .2s; }
.ap-recent__link:hover .ap-recent__arrow { color: var(--ap-accent); transform: translateX(3px); }
.ap-recent__empty { margin: 0; color: var(--ap-muted); }

.ap-spaces__grid {
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	grid-template-rows: auto auto;
	gap: 16px;
}
.ap-space {
	position: relative;
	display: flex; flex-direction: column; gap: 8px;
	padding: 24px;
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	text-decoration: none;
	overflow: hidden;
	transition: transform .2s, box-shadow .2s;
}
.ap-space:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(22,24,28,.08); }
.ap-space__icon { color: var(--ap-ink); line-height: 0; margin-bottom: 8px; }
.ap-space__icon .ap-icon { width: 40px; height: 40px; }
.ap-space__title { font-size: 22px; font-weight: 600; color: var(--ap-ink); }
.ap-space__text { font-size: 14px; color: var(--ap-muted); max-width: none; padding-right: 8px; }
.ap-space__go { position: absolute; top: 24px; right: 24px; color: var(--ap-muted); transition: transform .2s, color .2s; }
.ap-space:hover .ap-space__go { color: var(--ap-accent); transform: translateX(3px); }

.ap-space--feature {
	grid-row: span 2;
	justify-content: flex-end;
	min-height: 320px;
	border: 0;
	--ap-space-fade: linear-gradient(180deg, rgba(41,41,56,.15) 0%, rgba(41,41,56,.92) 75%);
	background:
		var(--ap-space-fade),
		var(--ap-space-image, linear-gradient(135deg, #3a3a50, #292938)) var(--ap-space-pos, center) / cover no-repeat,
		var(--ap-sidebar);
}
.ap-space--feature .ap-space__icon,
.ap-space--feature .ap-space__title,
.ap-space--feature .ap-space__go { color: #fff; }
.ap-space--feature .ap-space__text { color: rgba(255,255,255,.85); }
.ap-space--feature[data-overlay="none"]   { --ap-space-fade: linear-gradient(transparent, transparent); }
.ap-space--feature[data-overlay="none"] .ap-space__title,
.ap-space--feature[data-overlay="none"] .ap-space__text { text-shadow: 0 1px 6px rgba(0,0,0,.55); }
.ap-space--feature[data-overlay="light"]  { --ap-space-fade: linear-gradient(180deg, rgba(41,41,56,0) 30%, rgba(41,41,56,.7) 100%); }
.ap-space--feature[data-overlay="strong"] { --ap-space-fade: linear-gradient(180deg, rgba(41,41,56,.45) 0%, rgba(41,41,56,.95) 65%); }

@media (max-width: 767px) {
	.ap-hero { flex-direction: column-reverse; gap: 16px; }
	.ap-hero__title, .ap-page-title, .ap-tab { font-size: 30px; }
	.ap-spaces__grid { grid-template-columns: 1fr; }
	.ap-space--feature { grid-row: auto; min-height: 240px; }
	.ap-card { padding: 20px; }
}

/* ---------- Reports ---------- */
.ap-chips { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ap-chip {
	padding: 6px 14px; border-radius: 999px;
	background: var(--ap-surface-2); border: 1px solid var(--ap-border);
	font-size: 13px; font-weight: 500; color: var(--ap-ink);
}
.ap-assessment.is-soon .ap-chip { color: var(--ap-muted); }
.ap-next90 .yr-accordion { margin-top: 20px; }

.ap-downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.ap-download { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.ap-download__icon {
	width: 44px; height: 44px; border-radius: 12px; flex: none;
	display: grid; place-items: center;
	background: #ECF8E9; color: var(--ap-accent);
}
.ap-download__body { flex: 1 1 180px; }
.ap-download .ap-card__title { font-size: 18px; }
.ap-download .ap-card__text { font-size: 14px; color: var(--ap-muted); }
.ap-download .ap-btn { margin-left: auto; align-self: center; }

.ap-report__meta { margin: -8px 0 0; color: var(--ap-muted); font-size: 14px; }
.ap-report { max-width: none; }
.ap-report__content { background: var(--ap-surface); border-radius: var(--ap-radius); border: 1px solid var(--ap-border); padding: 28px; overflow-x: auto; }
@media (max-width: 767px) { .ap-report__content { padding: 16px; } }

/* ---------- Yearly report accordion (ported from snippet) ---------- */
.yr-accordion { --yr-green: var(--ap-accent); --yr-speed: .35s; }
.yr-item { border-top: 0 solid #e5e5e5; }
.yr-toggle {
	all: unset; box-sizing: border-box; width: 100%;
	display: flex; justify-content: space-between; align-items: center;
	padding: 20px 40px; cursor: pointer; margin-bottom: 10px;
	background: #FAFAFA; border-radius: 10px;
	transition: background .2s;
}
.yr-title { font-size: 20px; font-weight: 700; color: #1a1a1a; transition: color .2s; }
.yr-toggle:hover, .yr-toggle:focus-visible, .is-open > .yr-toggle { background: var(--ap-accent); }
.is-open > .yr-toggle .yr-title, .yr-toggle:hover .yr-title, .yr-toggle:focus-visible .yr-title { color: #fff; }
.is-open > .yr-toggle .yr-icon::before, .yr-toggle:hover .yr-icon::before, .yr-toggle:focus-visible .yr-icon::before,
.is-open > .yr-toggle .yr-icon::after, .yr-toggle:hover .yr-icon::after, .yr-toggle:focus-visible .yr-icon::after { background: #fff; }
.yr-icon { position: relative; width: 14px; height: 14px; }
.yr-icon::before, .yr-icon::after {
	content: ""; position: absolute; left: 0; top: 50%;
	width: 14px; height: 3px; margin-top: -1.5px;
	background: #1a1a1a; transition: transform var(--yr-speed) ease;
}
.yr-icon::after { transform: rotate(90deg); }
.yr-item.is-open > .yr-toggle .yr-icon::after { transform: rotate(0deg); }
.yr-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--yr-speed) ease; }
.yr-item.is-open > .yr-panel { grid-template-rows: 1fr; }
.yr-panel-inner { overflow: hidden; min-height: 0; }
.yr-panel-content {
	padding: 0 40px 28px; opacity: 0; transform: translateY(-8px);
	transition: opacity var(--yr-speed) ease, transform var(--yr-speed) ease;
}
.yr-item.is-open > .yr-panel > .yr-panel-inner > .yr-panel-content { opacity: 1; transform: none; }
.yr-row {
	display: flex; justify-content: space-between; align-items: center; gap: 16px;
	background: #f0f0f0; border-radius: 6px; padding: 10px 10px 10px 12px;
}
.yr-row + .yr-row { margin-top: 10px; }
.yr-row-title { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.yr-open {
	background: #fff; color: var(--yr-green) !important; font-weight: 600; font-size: 14px;
	padding: 10px 24px; border-radius: 6px; text-decoration: none; white-space: nowrap;
	transition: background .2s, color .2s;
}
.yr-open:hover { background: var(--yr-green); color: #fff !important; }
@media (max-width: 767px) {
	.yr-toggle { padding: 20px 16px; }
	.yr-panel-content { padding: 0 0 20px; }
}

/* ---------- Resources ---------- */
.ap-resources { display: flex; flex-direction: column; gap: 28px; }
.ap-resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.ap-resource {
	display: flex; flex-direction: column;
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	overflow: hidden;
	transition: transform .2s, box-shadow .2s;
}
.ap-resource:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(22,24,28,.08); }
.ap-resource__media {
	height: 150px;
	display: grid; place-items: center;
	background: var(--ap-accent) center / cover no-repeat;
	color: #fff;
}
.ap-resource__media .ap-icon { width: 76px; height: 76px; stroke-width: 1.6; }
.ap-resource__body { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px 22px; flex: 1; }
.ap-resource__title { font-size: 20px !important; font-weight: 600; }
.ap-resource__meta { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; color: #a9a6a9; }
.ap-dot { width: 6px; height: 6px; border-radius: 50%; background: #cecece; display: inline-block; }
.ap-resource__text { margin: 2px 0 0; font-size: 14px; color: var(--ap-muted); }
.ap-resource__actions { margin-top: auto; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.ap-resource__actions .ap-rbtn { flex: 1 1 auto; }
.ap-rbtn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px; border-radius: 10px;
	font-size: 15px; font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap;
	border: 1px solid var(--ap-border);
	transition: background .2s, color .2s, border-color .2s, filter .2s;
}
.ap-rbtn .ap-icon { width: 16px; height: 16px; stroke-width: 2.2; }
.ap-rbtn--primary { background: #5151D6; border-color: #5151D6; color: #fff !important; }
.ap-rbtn--primary:hover { filter: brightness(1.1); color: #fff !important; }
.ap-rbtn--ghost { background: #FBF9F7; color: var(--ap-ink) !important; }
.ap-rbtn--ghost:hover { background: var(--ap-accent); border-color: var(--ap-accent); color: #fff !important; }
.ap-rbtn--wide { flex-basis: 100%; }
.ap-empty-state { display: flex; align-items: center; gap: 16px; color: var(--ap-muted); }
.ap-empty-state p { margin: 0; max-width: none; flex: 1; }
.ap-empty-state__icon { color: #c9c6c9; line-height: 0; }
.ap-empty-state__icon .ap-icon { width: 36px; height: 36px; }

.ap-resource-single__actions { display: flex; gap: 12px; }
.ap-resource-single__pdf { width: 100%; height: 80vh; border: 1px solid var(--ap-border); border-radius: var(--ap-radius); background: #fff; }

/* ---------- PDF viewer ---------- */
.ap-viewer {
	width: min(1200px, 96vw); height: 92vh; max-width: none; max-height: none;
	padding: 0; border: 0; border-radius: 14px; overflow: hidden;
	background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.ap-viewer[open] { display: flex; flex-direction: column; }
.ap-viewer::backdrop { background: rgba(22,24,28,.7); }
.ap-viewer__bar {
	display: flex; align-items: center; gap: 6px;
	padding: 10px 12px 10px 20px;
	background: var(--ap-sidebar); color: #fff;
}
.ap-viewer__title { flex: 1; margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-viewer__btn {
	display: inline-flex; align-items: center; gap: 6px;
	background: none; border: 0; color: #fff !important; cursor: pointer;
	padding: 8px 10px; border-radius: 6px; font: inherit; font-size: 14px; text-decoration: none;
}
.ap-viewer__btn:hover { background: rgba(255,255,255,.1); }
.ap-viewer__frame { flex: 1; width: 100%; border: 0; background: #f4f4f4; }
@media (max-width: 767px) {
	.ap-viewer { width: 100vw; height: 100dvh; border-radius: 0; }
	.ap-viewer__download span { display: none; }
}

/* ---------- Generic content ---------- */
.ap-generic .entry-content > *:first-child { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
	.ap-portal *, .ap-portal *::before, .ap-portal *::after { transition: none !important; }
}

/* ---------- Link hover / active colour ---------- */
.ap-recent__link:hover .ap-recent__title,
.ap-resource:hover .ap-resource__title,
.ap-space:not(.ap-space--feature):hover .ap-space__title,
.yr-row:hover .yr-row-title { color: var(--ap-link-hover); }
.ap-menu .menu-item-has-children.current-menu-ancestor > a,
.ap-menu .menu-item-has-children.current-menu-parent > a { color: var(--ap-link-hover); }
