:root,
[data-theme="light"],
[data-theme="dark"] {
	--psy-primary: #0b4f7c;
	--psy-primary-hover: #083e62;
	--psy-primary-pressed: #062f4c;
	--psy-primary-disabled: #56748c;
	--psy-focus: #ffb547;
	--btn-primary: var(--psy-primary);
	--border-primary: var(--psy-primary);
}

/* Frappe's primary action remains the semantic owner. PSY only supplies a
 * coherent brand colour across Desk and website surfaces. */
.btn.btn-primary {
	border-color: var(--psy-primary) !important;
	background-color: var(--psy-primary) !important;
	color: #fff !important;
}

.btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]):hover {
	border-color: var(--psy-primary-hover) !important;
	background-color: var(--psy-primary-hover) !important;
	color: #fff !important;
}

.btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]):active,
.btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]).active {
	border-color: var(--psy-primary-pressed) !important;
	background-color: var(--psy-primary-pressed) !important;
	color: #fff !important;
}

.btn.btn-primary:focus-visible {
	outline: 3px solid var(--psy-focus) !important;
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--psy-primary-pressed) !important;
}

.btn.btn-primary:disabled,
.btn.btn-primary.disabled,
.btn.btn-primary[aria-disabled="true"] {
	border-color: var(--psy-primary-disabled) !important;
	background-color: var(--psy-primary-disabled) !important;
	color: #fff !important;
	opacity: .72;
}

/* The standalone manual uses a semantic primary-action class instead of
 * Bootstrap's button class, so it consumes the same brand states directly. */
.primary-action {
	border-color: var(--psy-primary) !important;
	background: var(--psy-primary) !important;
	color: #fff !important;
}

.primary-action:hover {
	border-color: var(--psy-primary-hover) !important;
	background: var(--psy-primary-hover) !important;
	color: #fff !important;
}

.primary-action:active {
	border-color: var(--psy-primary-pressed) !important;
	background: var(--psy-primary-pressed) !important;
	color: #fff !important;
}

.primary-action:focus-visible {
	outline: 3px solid var(--psy-focus) !important;
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--psy-primary-pressed) !important;
}

/* Frappe's native website navbar consumes Website Settings.brand_html. Keep
 * the same complete lockup legible on authenticated portal pages. */
.navbar .navbar-brand .psy-website-logo {
	display: block;
	width: 14rem;
	max-width: min(14rem, calc(100vw - 10rem));
	height: auto;
	max-height: none;
	object-fit: contain;
}

/* The account page has no client footer content. Its unused newsletter signup
 * is disabled in Website Settings; remove the remaining framework credit row. */
body[data-path="me"] .web-footer {
	display: none !important;
}

/* Login stays native Frappe markup. These route-scoped rules remove the
 * unrelated website chrome and give the approved lockup a measured slot. */
body[data-path="login"] {
	background: #eef5fa;
}

body[data-path="login"] .navbar,
body[data-path="login"] .web-footer {
	display: none !important;
}

body[data-path="login"] .page-content-wrapper {
	min-height: 100vh;
	background: #eef5fa;
}

body[data-path="login"] #page-login main.container {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	padding-top: clamp(1.5rem, 5vh, 3.5rem);
	padding-bottom: 2rem;
}

body[data-path="login"] #page-login section > .page-card-head {
	padding: 0 0 1.75rem;
}

body[data-path="login"] #page-login section > .page-card-head img.app-logo {
	display: block;
	width: 19rem;
	max-width: calc(100vw - 3rem);
	height: auto;
	max-height: none;
	margin: 0 auto;
	object-fit: contain;
}

body[data-path="login"] #page-login .for-login > .page-card-head h4 {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

body[data-path="login"] #page-login .login-content.page-card {
	max-width: 26rem;
	padding: 2.75rem 1.25rem;
	border: 1px solid #c9d7e2;
	background: #fff;
	box-shadow: 0 1rem 2.25rem rgba(16, 42, 67, .12);
}

@media (max-width: 35rem) {
	.navbar .navbar-brand .psy-website-logo {
		width: 11rem;
		max-width: calc(100vw - 8rem);
	}

	body[data-path="login"] #page-login main.container {
		padding-top: 1.5rem;
	}

	body[data-path="login"] #page-login section > .page-card-head {
		padding-bottom: 1.35rem;
	}

	body[data-path="login"] #page-login section > .page-card-head img.app-logo {
		width: 15rem;
	}

	body[data-path="login"] #page-login .login-content.page-card {
		padding: 2.25rem 1rem;
		box-shadow: 0 .75rem 1.75rem rgba(16, 42, 67, .11);
	}
}

.shortcut-widget-box .widget-head {
	flex-wrap: wrap;
	column-gap: .35rem;
	row-gap: .25rem;
}

.shortcut-widget-box .widget-title {
	max-width: 100%;
	min-width: 0;
}

.shortcut-widget-box .widget-control {
	max-width: 100%;
	flex-shrink: 0;
}

.shortcut-widget-box .widget-control.psy-navigation-count-control {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: .35rem;
	justify-content: flex-end;
}

.shortcut-widget-box[data-psy-navigation-count-state]:not([data-psy-navigation-count-state="ready"]) .widget-head {
	flex-wrap: wrap;
	gap: .25rem;
	max-width: 100%;
}

.shortcut-widget-box[data-psy-navigation-count-state]:not([data-psy-navigation-count-state="ready"]) .psy-navigation-count-control {
	justify-content: flex-start;
	max-width: 100%;
}

.shortcut-widget-box[data-psy-navigation-count-state]:not([data-psy-navigation-count-state="ready"]) .psy-navigation-count-control > .indicator-pill {
	flex-shrink: 0;
}

.shortcut-widget-box .psy-navigation-count-retry {
	line-height: 1.2;
	white-space: nowrap;
}

.shortcut-widget-box.psy-snapshot-count .widget-head {
	flex-wrap: wrap;
	gap: .35rem;
}

.shortcut-widget-box.psy-snapshot-count .psy-navigation-count-control {
	justify-content: flex-start;
	max-width: 100%;
}

.shortcut-widget-box.psy-snapshot-count .psy-navigation-count-explanation {
	flex-basis: 100%;
	white-space: normal;
}

.shortcut-widget-box .psy-navigation-count-explanation {
	flex-basis: 100%;
	white-space: normal;
}
