/* The login page: a split between who the hospital is and what you came to do.
 *
 * PRODUCT layer. Not one hospital's colours - see setup/login_brand.py.
 *
 * WHY THIS IS CSS OVER FRAPPE'S OWN MARKUP RATHER THAN A FORKED TEMPLATE
 * ---------------------------------------------------------------------
 * Frappe's login.html carries the CSRF handling, the email-link flow, the
 * error banner, the LDAP and social-login branches and the reset-password
 * path. Forking it to move a logo means owning all of that forever and
 * re-merging it at every upgrade, and the first thing to silently break
 * would be a security detail rather than a visual one.
 *
 * So the form is left exactly as Frappe renders it and only re-laid-out.
 * Every selector below targets markup Frappe already produces:
 *
 *   #page-login  .page_content  .for-login  .login-content.page-card
 *   .page-card-head > img.app-logo + h4 + p.page-card-subtitle
 *   form.form-signin > .page-card-body > .form-group   +  .page-card-actions
 *
 * Note the ABSENCE of tag names. An accessibility tree reports roles, not
 * tags, and reading "section" off one put `section.for-login` in this file -
 * a selector that matched nothing at all and was invisible precisely because
 * a CSS rule that matches nothing fails silently.
 *
 * The one piece of new DOM is .gh-brand-panel, added by login.js, which
 * contains no form controls at all. If a future Frappe renames a class the
 * page degrades to Frappe's own stock layout - it does not break.
 *
 * Colours arrive as custom properties set on :root by login.js from Hospital
 * Setting. The values below are only the fallbacks.
 */

:root {
	--gh-brand-primary: #0b5d4e;
	--gh-brand-secondary: #14171a;
	/* The accent - the colour of the primary action and the focus ring - trails
	 * the secondary until a hospital sets one of its own, so a site that has
	 * never heard of this setting looks exactly as it did before it existed.
	 * The ink is chosen for contrast by login.js, never picked by a human. */
	--gh-brand-accent: var(--gh-brand-secondary);
	--gh-brand-accent-ink: #ffffff;
	--gh-login-surface: #f7f5f0;
	--gh-login-card: #ffffff;
	--gh-login-text: #14171a;
	--gh-login-muted: #6b7280;
	--gh-login-line: #e3dfd7;
}

/* ---------------------------------------------------------------- layout -- */

/* Frappe's website shell centres a narrow container and adds page padding.
 * A split screen needs the full viewport, so the shell is unwound here
 * rather than fought with margins further down. */
body.product-page #page-login,
#page-login {
	background: var(--gh-login-surface);
	/* A stacking context of its own, so the ::before and ::after that carry the
	 * artwork and its clear space sit at z-index -1 INSIDE this element: above
	 * the surface colour, below every pane and panel. Without it they would
	 * escape to the root and paint behind the page itself. */
	position: relative;
	z-index: 0;
}

/* THE WHITE FLASH BEFORE THE GREEN
 *
 * The green panel is DOM that login.js inserts. Between the first paint and
 * that script running there is nothing green on the page at all: the form
 * surface fills the whole viewport and the panel then lands on top of it.
 * That is the flash, and no amount of tuning the panel's own CSS can remove
 * it, because the panel does not exist yet when it happens.
 *
 * So the split is painted into the CONTAINER instead, from the stylesheet,
 * which arrives with the first paint. .gh-brand-panel's own background-color
 * covers this exactly when it appears, so nothing moves and nothing changes
 * colour - the green is simply already there.
 *
 * 54% is .gh-brand-panel's flex-basis. If that changes, this changes with it.
 *
 * Only above the narrow breakpoint. Below it the panel becomes a band whose
 * height depends on how long the hospital's name is, and a gradient cannot
 * know that height - guessing would trade a white flash for a mis-sized
 * green one, which is worse because it is wrong rather than merely absent.
 *
 * The colour is the FALLBACK, not necessarily the tenant's: login.js sets
 * --gh-brand-primary on :root from Hospital Setting at the same moment it
 * inserts the panel. A hospital whose primary differs from the default gets
 * a brief default green instead of a brief white page - still the better of
 * the two, and the only way to do better would be to render the colour into
 * the page server-side, which means owning Frappe's login template.
 */
@media (min-width: 901px) {
	#page-login .page_content {
		background-image: linear-gradient(
			to right,
			var(--gh-brand-primary) 0 54%,
			/* transparent, not the surface colour: the surface AND its pattern are
			 * painted by #page-login underneath this, and an opaque right half
			 * here would hide the pattern on the very side that wants it. */
			transparent 54%
		);
	}

	/* Painting the container is not enough on its own, and the mock-up of the
	 * pre-JS DOM is what showed why: Frappe renders ONE pane at a time, so the
	 * single visible pane is the only flex item there is and grows to the full
	 * width - laying its own opaque surface colour straight over the gradient.
	 *
	 * So the pane is held off the left 54% for exactly as long as the panel is
	 * missing. :has() asks the question the situation actually poses - "is the
	 * panel here yet" - rather than timing it or tagging the page from script,
	 * either of which would be a second source of truth about the same thing.
	 *
	 * Nothing moves when the panel lands: the pane is flex 1 1 46% either way,
	 * and 54% of margin is exactly what the panel then occupies.
	 *
	 * A browser without :has() ignores this and sees today's behaviour. */
	#page-login .page_content:not(:has(.gh-brand-panel)) > * {
		margin-left: 54%;
	}
}

#page-login .page-content-wrapper {
	padding: 0;
	margin: 0;
	max-width: none;
}

#page-login main.container,
#page-login .container {
	max-width: none;
	width: 100%;
	padding: 0;
	margin: 0;
}

/* The website navbar and footer are noise on a sign-in screen and, on a
 * hospital system, an invitation to wander. Hidden rather than removed, so
 * nothing depends on markup that is not there. */
#page-login .navbar,
#page-login header.navbar,
#page-login .web-footer,
#page-login footer {
	display: none !important;
}

#page-login .page_content {
	display: flex;
	/* center, not stretch. Frappe shows one pane at a time and toggles the
	 * others itself, so a pane cannot be turned into a flex container here
	 * without fighting whatever mechanism it uses. Centring each pane AS A
	 * FLEX ITEM gets the same result without touching anyone's display. */
	align-items: center;
	min-height: 100vh;
	min-height: 100dvh;
	width: 100%;
}

/* ----------------------------------------------------------- brand panel -- */

.gh-brand-panel {
	flex: 1 1 54%;
	/* The panel keeps full height; only the form panes are centred. */
	align-self: stretch;
	/* A flex item refuses to shrink below its min-content width without this,
	 * and the facility name set large would push the form panel off its 46%. */
	min-width: 0;
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 3.5rem 4rem;
	background-color: var(--gh-brand-primary);
	background-size: cover;
	background-position: center;
	color: #fff;
	overflow: hidden;
}

/* A soft highlight so a flat brand colour still reads as a designed surface
 * rather than as a missing image. Sits under the content, never over it. */
.gh-brand-panel::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(120% 90% at 18% 12%, rgba(255, 255, 255, 0.16), transparent 60%),
		linear-gradient(150deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.32));
	pointer-events: none;
}

/* When the hospital has uploaded a login background, the photograph carries
 * the panel and the colour becomes a scrim over it - otherwise white text on
 * an arbitrary photo is a coin toss. */
.gh-brand-panel[data-has-image="1"]::before {
	background: linear-gradient(
		150deg,
		color-mix(in srgb, var(--gh-brand-primary) 88%, transparent),
		color-mix(in srgb, var(--gh-brand-secondary) 82%, transparent)
	);
}

.gh-brand-panel > * {
	position: relative;
	z-index: 1;
}

.gh-brand-mark {
	display: flex;
	align-items: center;
	gap: 0.85rem;
}

/* A logo is one of two different things and they want opposite treatments.
 *
 * A BADGE is square-ish and wordless. A WORDMARK is wide and already contains
 * the hospital's name. Forcing a wordmark through the badge treatment is what
 * was on screen before this rule changed: a 1096x380 mark rendered at roughly
 * 56x19, inside a 56px white disc, with 7px of padding eating a quarter of the
 * box. The logo became a detail of its own container.
 *
 * The white plate is gone entirely. It existed so that a DARK logo would
 * survive the dark panel - but that is exactly what brand_logo_reversed is
 * for now, and a white disc behind an asset that already carries its own
 * shape reads as a mistake rather than as a frame.
 *
 * login.js tags the container from the image's OWN aspect ratio, so which
 * treatment applies is decided by the asset rather than by a setting nobody
 * would ever find. */
.gh-brand-mark img {
	display: block;
	height: 48px;
	width: auto;
	max-width: 300px;
	object-fit: contain;
}

.gh-brand-mark[data-logo="badge"] img {
	width: 48px;
}

/* A wordmark carries the name already, so printing .gh-brand-markname beside
 * it says the hospital's name twice on one line. */
.gh-brand-mark[data-logo="wordmark"] .gh-brand-markname {
	display: none;
}

/* No logo uploaded: the initials in a ring. A deliberate monogram reads as a
 * choice; a broken image icon reads as a fault. */
.gh-brand-mark .gh-brand-initials {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	border: 2px solid rgba(255, 255, 255, 0.5);
	font-weight: 700;
	font-size: 1.15rem;
	letter-spacing: 0.06em;
}

.gh-brand-mark .gh-brand-markname {
	font-size: 1.02rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.gh-brand-body {
	max-width: 30ch;
	margin: 2rem 0;
}

.gh-brand-eyebrow {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
	margin-bottom: 1.5rem;
}

.gh-brand-eyebrow::after {
	content: "";
	flex: 1;
	height: 1px;
	background: rgba(255, 255, 255, 0.28);
}

.gh-brand-quote {
	font-size: clamp(1.9rem, 3.1vw, 2.9rem);
	line-height: 1.22;
	font-weight: 400;
	letter-spacing: -0.015em;
	margin: 0;
}

/* Only the hospital's OWN motto is set in quotation marks. The fallback -
 * the facility name - is a name, not a quotation, so it is never dressed as
 * one. See login_brand.brand(): no motto is ever invented. */
.gh-brand-quote[data-kind="motto"]::before {
	content: "\201C";
}

.gh-brand-quote[data-kind="motto"]::after {
	content: "\201D";
}

.gh-brand-attribution {
	margin-top: 1.6rem;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.78);
}

.gh-brand-foot {
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.6);
}

/* ------------------------------------------------------------ form panel -- */

/* EVERY pane Frappe can swap in, not only the sign-in one.
 *
 * The tag name is deliberately absent. This said `section.for-login` and
 * matched NOTHING: the pane is a <div>, and I had read "section" off an
 * accessibility tree, where it is a role rather than a tag. So the sign-in
 * pane was never sized to 46% - it fell back to its content width, and the
 * split rendered about 76/24 instead of 54/46.
 *
 * The second half of that mistake was scoping to `.for-login` at all. The
 * forgot-password and email-link panes then had no padding, no background and
 * no centring, so they appeared clipped and ragged the moment they were
 * clicked. Matching every child except the brand panel is what keeps the four
 * panes consistent with each other. */
#page-login .page_content > *:not(.gh-brand-panel) {
	flex: 1 1 46%;
	min-width: 0;
	padding: 3rem 2rem;
	/* Transparent, deliberately. BOTH the surface colour and the pattern are
	 * painted by #page-login at the foot of this file. An opaque colour here
	 * would mask the pattern over precisely the area that is meant to show it -
	 * and, because this pane is only as tall as the form it holds, would mask it
	 * in a band rather than everywhere, which is the bug that sent it here. */
	background-color: transparent;
	/* Superseded by the v2 pattern at the foot of this file, which draws the
	 * same icons roughly twice the size. Parked as a custom property rather
	 * than deleted: the value is 6KB of encoded SVG and removing it in place
	 * means moving 12KB over the wire to change one number. */
	--gh-pattern-v1: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='540' height='540' viewBox='0 0 540 540'%3E%3Cdefs%3E%3Cg id='cross'%3E%3Cpath d='M9.5 3h5v6.5H21v5h-6.5V21h-5v-6.5H3v-5h6.5z'/%3E%3C/g%3E%3Cg id='capsule'%3E%3Crect x='2' y='8' width='20' height='8' rx='4'/%3E%3Cpath d='M12 8v8'/%3E%3C/g%3E%3Cg id='syringe'%3E%3Crect x='6' y='9.5' width='10' height='5' rx='1'/%3E%3Cpath d='M16 12h6M6 12H3M4.5 9v6M9.5 9.5v5M12.5 9.5v5'/%3E%3C/g%3E%3Cg id='stetho'%3E%3Cpath d='M5 3v6a6 6 0 0 0 12 0V3'/%3E%3Ccircle cx='5' cy='2.6' r='1.2'/%3E%3Ccircle cx='17' cy='2.6' r='1.2'/%3E%3Cpath d='M11 15v1.6a4.4 4.4 0 0 0 8.8 0V14'/%3E%3Ccircle cx='19.8' cy='11.6' r='2.4'/%3E%3C/g%3E%3Cg id='heart'%3E%3Cpath d='M12 20.2S4.8 15.3 4.8 10.6A4.1 4.1 0 0 1 12 7.9a4.1 4.1 0 0 1 7.2 2.7c0 4.7-7.2 9.6-7.2 9.6z'/%3E%3C/g%3E%3Cg id='monitor'%3E%3Crect x='2' y='5' width='20' height='14' rx='2.5'/%3E%3Cpath d='M5.5 12h3l1.6-3.2 2.6 6.4 1.5-3.2h3.3'/%3E%3C/g%3E%3Cg id='plaster'%3E%3Crect x='2' y='8.4' width='20' height='7.2' rx='3.6'/%3E%3Crect x='8.4' y='8.4' width='7.2' height='7.2'/%3E%3Ccircle cx='10.6' cy='10.9' r='.45'/%3E%3Ccircle cx='13.4' cy='10.9' r='.45'/%3E%3Ccircle cx='10.6' cy='13.1' r='.45'/%3E%3Ccircle cx='13.4' cy='13.1' r='.45'/%3E%3C/g%3E%3Cg id='flask'%3E%3Cpath d='M9 3h6'/%3E%3Cpath d='M10 3v6.6L5.2 18a2 2 0 0 0 1.7 3h10.2a2 2 0 0 0 1.7-3L14 9.6V3'/%3E%3Cpath d='M7.4 15.2h9.2'/%3E%3C/g%3E%3Cg id='kit'%3E%3Crect x='2.5' y='7' width='19' height='13' rx='2.5'/%3E%3Cpath d='M9 7V5.5A1.5 1.5 0 0 1 10.5 4h3A1.5 1.5 0 0 1 15 5.5V7'/%3E%3Cpath d='M12 10.6v5.8M9.1 13.5h5.8'/%3E%3C/g%3E%3Cg id='thermo'%3E%3Cpath d='M14 14.8V5a2 2 0 1 0-4 0v9.8a4 4 0 1 0 4 0z'/%3E%3Cpath d='M14.2 8h2M14.2 11h2'/%3E%3C/g%3E%3Cg id='board'%3E%3Crect x='4.5' y='4' width='15' height='17' rx='2'/%3E%3Crect x='9' y='2' width='6' height='4' rx='1.2'/%3E%3Cpath d='M12 10.4v6M9 13.4h6'/%3E%3C/g%3E%3Cg id='drop'%3E%3Cpath d='M12 3.4s6.1 7.1 6.1 10.6a6.1 6.1 0 0 1-12.2 0C5.9 10.5 12 3.4 12 3.4z'/%3E%3C/g%3E%3Cg id='bottle'%3E%3Crect x='6' y='8' width='12' height='13' rx='2'/%3E%3Crect x='5' y='3.8' width='14' height='4.2' rx='1.2'/%3E%3Cpath d='M12 11.8v5.4M9.3 14.5h5.4'/%3E%3C/g%3E%3Cg id='tablet'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M6.4 6.4l11.2 11.2'/%3E%3C/g%3E%3C/defs%3E%3Cg fill='none' stroke='%230b5d4e' stroke-opacity='.085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cuse href='%23monitor' transform='translate(31.6 59.9) rotate(47.3) scale(1.06) translate(-12 -12)'/%3E%3Cuse href='%23bottle' transform='translate(113.5 32.0) rotate(-50.6) scale(1.11) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(194.2 29.7) rotate(15.8) scale(1.28) translate(-12 -12)'/%3E%3Cuse href='%23kit' transform='translate(301.6 65.5) rotate(-47.5) scale(1.13) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(399.8 16.7) rotate(43.3) scale(1.32) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(399.8 556.7) rotate(43.3) scale(1.32) translate(-12 -12)'/%3E%3Cuse href='%23capsule' transform='translate(-13.0 48.6) rotate(-42.8) scale(1.3) translate(-12 -12)'/%3E%3Cuse href='%23capsule' transform='translate(527.0 48.6) rotate(-42.8) scale(1.3) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(67.1 165.3) rotate(-38.5) scale(1.0) translate(-12 -12)'/%3E%3Cuse href='%23monitor' transform='translate(130.6 117.3) rotate(-2.1) scale(1.02) translate(-12 -12)'/%3E%3Cuse href='%23bottle' transform='translate(212.0 150.6) rotate(13.5) scale(1.33) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(326.6 145.0) rotate(25.4) scale(1.03) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(437.4 106.8) rotate(-25.8) scale(1.12) translate(-12 -12)'/%3E%3Cuse href='%23syringe' transform='translate(511.5 106.7) rotate(53.0) scale(1.29) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(55.4 232.8) rotate(-7.3) scale(1.26) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(165.1 197.8) rotate(17.9) scale(1.27) translate(-12 -12)'/%3E%3Cuse href='%23syringe' transform='translate(238.7 210.8) rotate(-23.3) scale(1.21) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(322.6 250.0) rotate(-1.1) scale(1.24) translate(-12 -12)'/%3E%3Cuse href='%23heart' transform='translate(404.7 249.7) rotate(-52.1) scale(1.34) translate(-12 -12)'/%3E%3Cuse href='%23capsule' transform='translate(497.0 197.6) rotate(-55.4) scale(1.1) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(60.9 315.6) rotate(47.2) scale(1.34) translate(-12 -12)'/%3E%3Cuse href='%23heart' transform='translate(145.5 305.7) rotate(-18.0) scale(1.09) translate(-12 -12)'/%3E%3Cuse href='%23tablet' transform='translate(212.1 294.9) rotate(56.3) scale(1.04) translate(-12 -12)'/%3E%3Cuse href='%23board' transform='translate(285.6 296.4) rotate(38.5) scale(1.06) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(418.7 302.0) rotate(-16.7) scale(1.12) translate(-12 -12)'/%3E%3Cuse href='%23bottle' transform='translate(493.0 311.7) rotate(50.1) scale(1.12) translate(-12 -12)'/%3E%3Cuse href='%23syringe' transform='translate(69.1 395.6) rotate(24.9) scale(1.18) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(120.7 387.3) rotate(24.8) scale(1.13) translate(-12 -12)'/%3E%3Cuse href='%23flask' transform='translate(220.8 390.5) rotate(-33.4) scale(1.02) translate(-12 -12)'/%3E%3Cuse href='%23kit' transform='translate(328.3 401.9) rotate(-18.5) scale(1.14) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(402.1 381.5) rotate(26.4) scale(1.05) translate(-12 -12)'/%3E%3Cuse href='%23monitor' transform='translate(484.2 377.9) rotate(4.7) scale(1.19) translate(-12 -12)'/%3E%3Cuse href='%23kit' transform='translate(52.0 487.6) rotate(7.6) scale(1.08) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(155.3 512.5) rotate(56.9) scale(1.1) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(223.0 -19.7) rotate(-9.4) scale(1.23) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(223.0 520.3) rotate(-9.4) scale(1.23) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(283.1 469.5) rotate(-38.2) scale(1.17) translate(-12 -12)'/%3E%3Cuse href='%23tablet' transform='translate(375.8 -13.6) rotate(57.1) scale(1.26) translate(-12 -12)'/%3E%3Cuse href='%23tablet' transform='translate(375.8 526.4) rotate(57.1) scale(1.26) translate(-12 -12)'/%3E%3Cuse href='%23monitor' transform='translate(485.7 464.8) rotate(13.0) scale(1.31) translate(-12 -12)'/%3E%3C/g%3E%3C/svg%3E");
	background-repeat: repeat;
	/* The tile is drawn at 540px. Displaying it at 270 halved every icon to
	 * about 13px, which reads as speckle rather than as objects - the shapes
	 * stopped being a stethoscope and a first-aid case and became grey dots.
	 *
	 * 440 puts them near 23px, where they are legible as what they are while
	 * the field still behaves as wallpaper. Larger than about 540 and the
	 * spacing opens up until it looks sparse rather than patterned, on a form
	 * panel that is only ~660px wide. */
	background-size: 440px 440px;
}

#page-login .login-content.page-card {
	width: 100%;
	/* 30rem rather than 27: with a 2.9rem icon gutter, a realistic hospital
	 * address needs the extra room or it ellipsises while still being typed. */
	max-width: 30rem;
	/* auto, because the pane is a plain block and the card centres itself. */
	margin: 0 auto;
	padding: 0;
	border: 0;
	box-shadow: none;
	background: transparent;
}

#page-login .page-card-head {
	text-align: left;
	padding: 0;
	margin-bottom: 2rem;
	border: 0;
}

/* The mark lives on the brand panel. Repeating it over the form is the kind
 * of duplication that makes a page look assembled rather than designed - but
 * on a narrow screen the panel is gone, so it comes back (see @media below). */
#page-login .page-card-head img.app-logo {
	display: none;
}

#page-login .page-card-head h4 {
	font-size: 1.75rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--gh-login-text);
	margin: 0 0 0.4rem;
}

#page-login .page-card-subtitle {
	font-size: 0.93rem;
	color: var(--gh-login-muted);
	margin: 0;
}

#page-login .page-card-body {
	padding: 0;
}

#page-login .form-group {
	margin-bottom: 1.1rem;
}

#page-login .form-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--gh-login-text);
	margin-bottom: 0.4rem;
	display: block;
}

#page-login .form-control,
#page-login input[type="text"],
#page-login input[type="email"],
#page-login input[type="password"] {
	width: 100%;
	height: 3rem;
	/* Horizontal padding is deliberately NOT set. Frappe's login bundle sizes
	 * the inline padding around the icon it renders inside the field, and a
	 * blanket `padding: 0 0.95rem` here removed that room - so the typed value
	 * ran underneath the icon. Height, border, radius and focus ring are ours;
	 * inline spacing stays Frappe's, because Frappe is what draws the icon. */
	padding-top: 0;
	padding-bottom: 0;
	font-size: 0.95rem;
	color: var(--gh-login-text);
	background: var(--gh-login-card);
	border: 1px solid var(--gh-login-line);
	border-radius: 10px;
	box-shadow: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#page-login .form-control:focus,
#page-login input:focus {
	outline: none;
	border-color: var(--gh-brand-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gh-brand-accent) 18%, transparent);
}

/* The real markup, read rather than assumed:
 *
 *   <div class="email-field">
 *     <input class="form-control" placeholder="jane@example.com">
 *     <svg class="field-icon email-icon"><use href="#es-line-email"></use></svg>
 *   </div>
 *
 * The icon comes AFTER the input in source order and is pinned to the LEFT
 * edge by Frappe's login bundle. So the input needs left padding to clear it,
 * and the blanket `padding: 0 0.95rem` I originally set here removed exactly
 * that - putting the caret and the typed value on top of the icon.
 *
 * Both sides are now set explicitly rather than half-inherited. Overriding
 * Frappe's sizing while still depending on Frappe's padding is what produced
 * a broken field twice: either own the box or leave it alone.
 *
 * pointer-events: none on the icon so clicking it focuses the input beneath,
 * which is what a user aiming at the left of a text box expects.
 */
#page-login .email-field,
#page-login .password-field {
	position: relative;
	display: block;
}

#page-login .field-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1rem;
	height: 1rem;
	color: var(--gh-login-muted);
	pointer-events: none;
	z-index: 2;
}

/* Hospital addresses are long - firstname.lastname@healthline.example.gh is
 * an ordinary one. The value gets the whole field minus the icon, and
 * ellipsises rather than clipping mid-character when it overruns. */
/* Doubled up on specificity deliberately. Frappe's login.bundle.css loads
 * AFTER this file, so a rule of equal weight there wins on source order. */
#page-login .email-field .form-control,
#page-login .password-field .form-control,
#page-login .form-control {
	padding-left: 2.9rem;
	/* The password field carries a show/hide eye on the RIGHT, so both sides
	 * need clearing, not just the left. */
	padding-right: 2.9rem;
	text-overflow: ellipsis;
}

#page-login .page-card-actions {
	padding: 0;
	margin-top: 1.6rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* Primary action is a <button>; secondary is an <a>. Element type, not class.
 *
 * Frappe names these inconsistently across panes - .btn-login, .btn-forgot,
 * .btn-signup, .btn-login-with-email-link - and crucially the SAME class,
 * .btn-login-with-email-link, is a secondary text link on the sign-in pane
 * and the PRIMARY SUBMIT BUTTON on the email-link pane. Styling by class
 * therefore dressed that pane's main action as a footnote and promoted
 * "Login with password" to look like the button.
 *
 * It also produced white-on-cream: the old class rule set a green link colour
 * while .btn-primary:hover set color:#fff, so hovering the primary action
 * made its own label disappear.
 *
 * Element type is the thing Frappe is consistent about, so that is what this
 * keys on.
 */
#page-login .page-card-actions button,
#page-login button.btn-login,
#page-login button.btn-primary {
	width: 100%;
	height: 3rem;
	border: 0;
	border-radius: 999px;
	background: var(--gh-brand-accent);
	color: var(--gh-brand-accent-ink);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	transition: transform 0.12s ease, opacity 0.15s ease;
}

#page-login .page-card-actions button:hover,
#page-login button.btn-login:hover,
#page-login button.btn-primary:hover {
	opacity: 0.92;
	background: var(--gh-brand-accent);
	color: var(--gh-brand-accent-ink);
}

#page-login .page-card-actions button:active {
	transform: translateY(1px);
}

/* Frappe ships these disabled until the field validates. A disabled control
 * that looks identical to an enabled one is a user clicking nothing and
 * concluding the system is broken. */
#page-login .page-card-actions button:disabled,
#page-login button.btn-login:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Secondary actions, full width and centred so they stack under the button
 * instead of drifting off to one side. */
#page-login .page-card-actions a,
#page-login .forgot-password-message a,
#page-login a.text-muted {
	display: block;
	width: 100%;
	padding: 0.5rem 0;
	color: var(--gh-brand-primary);
	background: transparent;
	border: 0;
	font-size: 0.87rem;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
}

#page-login .page-card-actions a:hover,
#page-login .forgot-password-message a:hover {
	color: var(--gh-brand-primary);
	background: transparent;
	text-decoration: underline;
}

#page-login .forgot-password-message {
	margin: 0.6rem 0 0;
	font-size: 0.85rem;
}

#page-login .login-error-banner:not(:empty) {
	background: #fdf1f0;
	border: 1px solid #f3c9c4;
	color: #8f2c22;
	border-radius: 10px;
	padding: 0.7rem 0.9rem;
	font-size: 0.87rem;
	margin-bottom: 1rem;
}

/* --------------------------------------------------------------- narrow -- */

/* Below this the split stops being a split. The brand panel becomes a band
 * across the top rather than disappearing, because on a phone it is the only
 * thing telling a nurse she is on her own hospital's system and not a
 * look-alike. */
@media (max-width: 900px) {
	#page-login .page_content {
		flex-direction: column;
		min-height: 100vh;
	}

	.gh-brand-panel {
		flex: 0 0 auto;
		padding: 2rem 1.5rem 2.25rem;
	}

	.gh-brand-body {
		max-width: none;
		margin: 1.25rem 0 0;
	}

	.gh-brand-quote {
		font-size: 1.45rem;
	}

	.gh-brand-attribution,
	.gh-brand-foot {
		display: none;
	}

	#page-login .page_content > *:not(.gh-brand-panel) {
		flex: 1 1 auto;
		padding: 2rem 1.5rem 3rem;
	}

	/* Stacked, so the form is centred horizontally and sits below the brand
	 * band rather than beside it. The cleared space in the pattern has to move
	 * with it, or it clears the wrong part of the page. */
	#page-login {
		--gh-wash-x: 50%;
		--gh-wash-y: 62%;
	}
}

/* Frappe hides the inactive panes itself. This used to do it here, with
 * `section.for-*` selectors that matched nothing and a `:not(.active)` guess
 * at a class Frappe may never set - and guessing at someone else's visibility
 * mechanism is how you end up hiding the pane the user just asked for. */

/* The panel's text is written by login.js. Until it arrives the panel is a
 * plain colour field rather than a flash of half-built layout. */
.gh-brand-panel:not([data-ready="1"]) .gh-brand-body,
.gh-brand-panel:not([data-ready="1"]) .gh-brand-mark,
.gh-brand-panel:not([data-ready="1"]) .gh-brand-foot {
	opacity: 0;
}

.gh-brand-panel[data-ready="1"] .gh-brand-body,
.gh-brand-panel[data-ready="1"] .gh-brand-mark,
.gh-brand-panel[data-ready="1"] .gh-brand-foot {
	opacity: 1;
	transition: opacity 0.25s ease;
}

/* ---------------------------------------------------------------------------
 * Pattern v2 - the same medical line-art, drawn about twice the size.
 *
 * v1 packed 36 icons into the 540px tile at roughly 24px each. Displayed on a
 * form panel that is only ~660px wide, they read as grey speckle rather than as
 * objects - you could not tell a stethoscope from a syringe without leaning in.
 * Enlarging by stretching the tile was the wrong lever: it grows the icons and
 * the gaps between them in equal measure, so the field just gets emptier.
 *
 * v2 draws them larger INSIDE the tile instead - 25 icons at roughly double
 * scale - so they gain size without the pattern thinning out.
 *
 * Alternate rows are offset by half a cell. Bigger icons need more room, which
 * forces the random jitter down, and without the stagger the grid underneath
 * becomes visible as rows and columns.
 *
 * WHY IT SITS ON #page-login AND NOT ON THE FORM PANE
 *
 * It was on the pane, and the pane is CENTRED as a flex item rather than
 * stretched, so it is exactly as tall as the form inside it. The pattern
 * therefore stopped where the form stopped, leaving a plain band above and
 * below it - which is what read as the artwork not covering the whole canvas.
 *
 * Stretching the pane instead would mean making it a flex or grid container to
 * keep the form centred, and `#page-login .page_content > *` outweighs
 * whatever class Frappe hides the three inactive panes with. A `display` of
 * ours could therefore un-hide all of them at once. That is far too much risk
 * to carry for the sake of moving a background.
 *
 * The page root is the honest home for it in any case: the pattern is the
 * surface the page is printed on, not a property of one pane. It tiles the
 * full width, and .gh-brand-panel - opaque - covers the half that must not
 * show it.
 *
 * The selector is doubled to match `body.product-page #page-login` at the top
 * of this file. That rule sets the `background` SHORTHAND, which includes
 * background-image, and its first selector outweighs a bare #page-login no
 * matter how far down the file this sits. Equal specificity plus later source
 * order is what wins here - not distance.
 * ------------------------------------------------------------------------- */
/* THE ARTWORK IS A STENCIL, NOT A PICTURE
 *
 * It used to be a background-image, and the icon colour was written INTO the
 * encoded SVG as #0b5d4e. That is fine for one hospital and wrong for a
 * product: change the brand colour to navy and the panel goes navy while the
 * wallpaper beside it stays green, which looks like a bug because it is one.
 * A data URI cannot read a custom property, so no amount of CSS reaches it.
 *
 * So the SVG is used as a MASK and the colour is ordinary paint underneath it.
 * The icons are cut out of a sheet of --gh-brand-primary, which means they
 * follow the brand wherever it goes, including while it is being changed.
 *
 * The stroke inside the mask is fully opaque; the 8.5% lives here, on the
 * element, because a mask reads alpha and a faint stencil would thin the paint
 * twice over.
 *
 * ::before rather than the element itself: a mask on #page-login would mask
 * the form too. Fixed and z-index -1 puts it behind everything in this
 * stacking context and in front of the page's own surface colour. */
#page-login::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-color: var(--gh-brand-primary);
	opacity: 0.085;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='540' height='540' viewBox='0 0 540 540'%3E%3Cdefs%3E%3Cg id='cross'%3E%3Cpath d='M9.5 3h5v6.5H21v5h-6.5V21h-5v-6.5H3v-5h6.5z'/%3E%3C/g%3E%3Cg id='capsule'%3E%3Crect x='2' y='8' width='20' height='8' rx='4'/%3E%3Cpath d='M12 8v8'/%3E%3C/g%3E%3Cg id='syringe'%3E%3Crect x='6' y='9.5' width='10' height='5' rx='1'/%3E%3Cpath d='M16 12h6M6 12H3M4.5 9v6M9.5 9.5v5M12.5 9.5v5'/%3E%3C/g%3E%3Cg id='stetho'%3E%3Cpath d='M5 3v6a6 6 0 0 0 12 0V3'/%3E%3Ccircle cx='5' cy='2.6' r='1.2'/%3E%3Ccircle cx='17' cy='2.6' r='1.2'/%3E%3Cpath d='M11 15v1.6a4.4 4.4 0 0 0 8.8 0V14'/%3E%3Ccircle cx='19.8' cy='11.6' r='2.4'/%3E%3C/g%3E%3Cg id='heart'%3E%3Cpath d='M12 20.2S4.8 15.3 4.8 10.6A4.1 4.1 0 0 1 12 7.9a4.1 4.1 0 0 1 7.2 2.7c0 4.7-7.2 9.6-7.2 9.6z'/%3E%3C/g%3E%3Cg id='monitor'%3E%3Crect x='2' y='5' width='20' height='14' rx='2.5'/%3E%3Cpath d='M5.5 12h3l1.6-3.2 2.6 6.4 1.5-3.2h3.3'/%3E%3C/g%3E%3Cg id='plaster'%3E%3Crect x='2' y='8.4' width='20' height='7.2' rx='3.6'/%3E%3Crect x='8.4' y='8.4' width='7.2' height='7.2'/%3E%3Ccircle cx='10.6' cy='10.9' r='.45'/%3E%3Ccircle cx='13.4' cy='10.9' r='.45'/%3E%3Ccircle cx='10.6' cy='13.1' r='.45'/%3E%3Ccircle cx='13.4' cy='13.1' r='.45'/%3E%3C/g%3E%3Cg id='flask'%3E%3Cpath d='M9 3h6'/%3E%3Cpath d='M10 3v6.6L5.2 18a2 2 0 0 0 1.7 3h10.2a2 2 0 0 0 1.7-3L14 9.6V3'/%3E%3Cpath d='M7.4 15.2h9.2'/%3E%3C/g%3E%3Cg id='kit'%3E%3Crect x='2.5' y='7' width='19' height='13' rx='2.5'/%3E%3Cpath d='M9 7V5.5A1.5 1.5 0 0 1 10.5 4h3A1.5 1.5 0 0 1 15 5.5V7'/%3E%3Cpath d='M12 10.6v5.8M9.1 13.5h5.8'/%3E%3C/g%3E%3Cg id='thermo'%3E%3Cpath d='M14 14.8V5a2 2 0 1 0-4 0v9.8a4 4 0 1 0 4 0z'/%3E%3Cpath d='M14.2 8h2M14.2 11h2'/%3E%3C/g%3E%3Cg id='board'%3E%3Crect x='4.5' y='4' width='15' height='17' rx='2'/%3E%3Crect x='9' y='2' width='6' height='4' rx='1.2'/%3E%3Cpath d='M12 10.4v6M9 13.4h6'/%3E%3C/g%3E%3Cg id='drop'%3E%3Cpath d='M12 3.4s6.1 7.1 6.1 10.6a6.1 6.1 0 0 1-12.2 0C5.9 10.5 12 3.4 12 3.4z'/%3E%3C/g%3E%3Cg id='bottle'%3E%3Crect x='6' y='8' width='12' height='13' rx='2'/%3E%3Crect x='5' y='3.8' width='14' height='4.2' rx='1.2'/%3E%3Cpath d='M12 11.8v5.4M9.3 14.5h5.4'/%3E%3C/g%3E%3Cg id='tablet'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M6.4 6.4l11.2 11.2'/%3E%3C/g%3E%3C/defs%3E%3Cg fill='none' stroke='%230b5d4e' stroke-opacity='1' stroke-width='1.05' stroke-linecap='round' stroke-linejoin='round'%3E%3Cuse href='%23monitor' transform='translate(43.9 51.7) rotate(-49.8) scale(2.06) translate(-12 -12)'/%3E%3Cuse href='%23bottle' transform='translate(164.4 44.9) rotate(16.7) scale(1.84) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(279.2 34.8) rotate(27.8) scale(1.76) translate(-12 -12)'/%3E%3Cuse href='%23kit' transform='translate(390.3 53.1) rotate(-0.4) scale(1.95) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(491.1 53.4) rotate(41.5) scale(2.13) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(92.7 167.4) rotate(44.8) scale(1.79) translate(-12 -12)'/%3E%3Cuse href='%23monitor' transform='translate(213.0 153.7) rotate(53.2) scale(1.98) translate(-12 -12)'/%3E%3Cuse href='%23bottle' transform='translate(305.7 182.9) rotate(-34.4) scale(1.88) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(430.1 151.5) rotate(-15.9) scale(2.17) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(18.4 174.5) rotate(41.2) scale(1.9) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(558.4 174.5) rotate(41.2) scale(1.9) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(59.9 269.4) rotate(-58.4) scale(2.06) translate(-12 -12)'/%3E%3Cuse href='%23cross' transform='translate(154.2 250.5) rotate(-50.7) scale(1.92) translate(-12 -12)'/%3E%3Cuse href='%23syringe' transform='translate(251.5 248.7) rotate(5.4) scale(2.02) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(365.9 262.9) rotate(-13.2) scale(1.85) translate(-12 -12)'/%3E%3Cuse href='%23heart' transform='translate(496.7 259.3) rotate(-47.1) scale(1.94) translate(-12 -12)'/%3E%3Cuse href='%23stetho' transform='translate(127.3 382.4) rotate(-57.4) scale(1.99) translate(-12 -12)'/%3E%3Cuse href='%23heart' transform='translate(217.6 358.3) rotate(3.1) scale(2.04) translate(-12 -12)'/%3E%3Cuse href='%23tablet' transform='translate(341.1 387.4) rotate(-36.8) scale(2.12) translate(-12 -12)'/%3E%3Cuse href='%23board' transform='translate(418.5 364.7) rotate(15.2) scale(2.02) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(-7.5 367.1) rotate(43.9) scale(2.1) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(532.5 367.1) rotate(43.9) scale(2.1) translate(-12 -12)'/%3E%3Cuse href='%23syringe' transform='translate(41.1 502.3) rotate(11.3) scale(2.16) translate(-12 -12)'/%3E%3Cuse href='%23thermo' transform='translate(142.7 483.3) rotate(-16.8) scale(2.03) translate(-12 -12)'/%3E%3Cuse href='%23flask' transform='translate(258.6 465.7) rotate(42.2) scale(1.97) translate(-12 -12)'/%3E%3Cuse href='%23kit' transform='translate(391.3 486.5) rotate(12.8) scale(1.94) translate(-12 -12)'/%3E%3Cuse href='%23plaster' transform='translate(475.9 505.5) rotate(-10.9) scale(1.91) translate(-12 -12)'/%3E%3C/g%3E%3C/svg%3E");
	mask-repeat: repeat;
	/* 375 rather than 440, and the stroke above cut from 1.5 to 1.05.
	 *
	 * The stroke is the half that actually mattered. It is drawn in tile units,
	 * so the same transform that doubled the icons doubled their line weight with
	 * them - about 2.4px on screen against v1's 1.5px. That is why v2 read as
	 * bold artwork rather than as wallpaper: not the size of the shapes so much
	 * as the weight of the lines describing them.
	 *
	 * 1.05 x the average scale x the display ratio puts the line back at roughly
	 * 1.4px, near v1's weight, while the icons sit at about 33px - still well
	 * above v1's 23px and legible as objects, but faint again.
	 *
	 * The arithmetic, since it is not obvious from any single number here:
	 * 24 icon units x ~1.97 average scale x (375 / 540 tile) = ~33px. */
	mask-size: 375px 375px;
}

/* The clear space behind the words, now that the pattern is a sibling rather
 * than a background layer. ::after paints after ::before at the same z-index,
 * so it lands on top of the artwork without needing a z-index of its own.
 *
 * It is the SURFACE colour, so it tints nothing - it simply stops the stencil
 * showing through where the text is. Text over line-art really is harder to
 * read: the eye gets competing edges at the letterforms, and a descender and a
 * stethoscope tube are drawn at about the same weight.
 *
 * The centre is a custom property because it has to follow the form - the
 * layout stacks below 900px, and Brand Right moves the form to the other
 * side. */
#page-login::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: radial-gradient(
		28rem 22rem at var(--gh-wash-x, 77%) var(--gh-wash-y, 50%),
		var(--gh-login-surface) 0 45%,
		transparent 100%
	);
}

@media (prefers-reduced-motion: reduce) {
	.gh-brand-panel[data-ready="1"] .gh-brand-body,
	.gh-brand-panel[data-ready="1"] .gh-brand-mark,
	.gh-brand-panel[data-ready="1"] .gh-brand-foot {
		transition: none;
	}
}

/* ---------------------------------------------------------------------------
 * LAYOUT PRESETS
 *
 * login.js writes data-login-layout on #page-login from Hospital Setting, via
 * login_brand.LAYOUTS, which has already reduced anything unrecognised to
 * "split". So nothing below has to cope with a value it does not know.
 *
 * Every preset is CSS ONLY. The markup and the script are identical in all of
 * them, which is the property that matters: a layout cannot break the sign-in,
 * because a layout cannot touch the form. The worst a broken preset can do is
 * look wrong.
 *
 * SPLIT HAS NO RULES. It is the design the whole file above already describes.
 * A default that has to be applied is a default that can fail to apply.
 * ------------------------------------------------------------------------- */

/* --- Split, brand on the right ------------------------------------------- */

@media (min-width: 901px) {
	#page-login[data-login-layout="panel-right"] .page_content {
		flex-direction: row-reverse;
		background-image: linear-gradient(
			to left,
			var(--gh-brand-primary) 0 54%,
			transparent 54%
		);
	}

	/* The cleared space in the pattern follows the form across. */
	#page-login[data-login-layout="panel-right"] {
		--gh-wash-x: 23%;
	}

	/* The hold-off that keeps the form out of the panel's space before the
	 * panel exists is a LEFT margin in the split. Mirrored, it has to become a
	 * right one - otherwise the form waits in exactly the place the panel is
	 * about to land, and the page visibly rearranges itself on load. */
	#page-login[data-login-layout="panel-right"] .page_content:not(:has(.gh-brand-panel)) > * {
		margin-left: 0;
		margin-right: 54%;
	}
}

/* --- Centred: the brand becomes the backdrop ------------------------------ */

/* Fixed, so it leaves the flex flow entirely. The one visible pane is then the
 * only item on the line and takes the full width, already centred vertically by
 * the align-items the container has had all along. Nothing here sets `display`
 * on a pane - Frappe hides the inactive ones and that mechanism is not ours. */
#page-login[data-login-layout="centred"] .gh-brand-panel {
	position: fixed;
	inset: 0;
	z-index: 0;
	padding: 2.25rem 2.5rem;
	justify-content: flex-start;
}

/* A pull-quote set at 2.9rem across a whole screen fights the card in front of
 * it. The mark stays: it is the thing that says whose system this is. */
#page-login[data-login-layout="centred"] .gh-brand-body,
#page-login[data-login-layout="centred"] .gh-brand-foot {
	display: none;
}

#page-login[data-login-layout="centred"] .page_content > *:not(.gh-brand-panel) {
	position: relative;
	z-index: 1;
	margin-left: 0;
}

/* The one place in this design where an opaque card is right: the form is over
 * a full-bleed brand colour, so it needs a surface of its own to sit on. */
#page-login[data-login-layout="centred"] .login-content.page-card {
	max-width: 27rem;
	padding: 2.5rem 2.25rem;
	background: var(--gh-login-card);
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
