/* Tenant sign-in page (/login). The left half is a site hoarding: the royal-blue board that fences a
   construction site and names the project (the customer's company) and the builder (our badge),
   with panel joints and the site tape. The right half is one quiet card: logo, one main button,
   and the supplier form folded away. Colours from the logo; Inter, which Frappe already loads.
   Scoped to the login page; tcs_login.js adds the hoarding and the classes used here. */

body[data-path="login"] {
	--tcs-royal: #0342cd;
	--tcs-royal-deep: #022f94;
	--tcs-sky: #2992ff;
	--tcs-sky-wash: #e6f0ff;
	--tcs-amber: #ffa10e;
	--tcs-navy: #0e1629;
	--tcs-ink: #26324a;
	--tcs-muted: #5b6475;
	--tcs-paper: #f4f7fc;
	--tcs-line: #d9e1ee;
	--tcs-danger: #b42318;
	--tcs-ok: #127a43;
	color-scheme: light;
	background: var(--tcs-paper);
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-feature-settings: "cv11", "ss01";
	color: var(--tcs-ink);
}

/* Visually hidden live region for screen-reader announcements. */
body.tcs-login .tcs-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Two halves: hoarding left, card right. */
body.tcs-login .page-content-wrapper {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	grid-template-rows: minmax(100dvh, auto);
	min-height: 100dvh;
	padding-top: 0; /* Frappe leaves room for a navbar the login page does not have */
}
body.tcs-login .page-breadcrumbs { display: none; }
body.tcs-login .page-content-wrapper > main.container {
	grid-column: 2;
	grid-row: 1;
	align-self: center;
	width: 100%;
	max-width: 30rem;
	margin: 0 auto;
	padding: 3rem 1.5rem;
}
body.tcs-login .page-header-wrapper { display: none; }

/* The hoarding */
@keyframes tcs-hoarding-enter {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}
@keyframes tcs-wire-travel {
	from { stroke-dashoffset: 64; }
	to { stroke-dashoffset: -120; }
}
@keyframes tcs-beacon-pulse {
	0%, 100% { transform: scale(1); opacity: 0.9; }
	50% { transform: scale(1.35); opacity: 0.45; }
}

body.tcs-login .tcs-hoarding {
	grid-column: 1;
	grid-row: 1;
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	padding: 2.25rem 2.75rem 0;
	color: #fff;
	background-color: var(--tcs-royal);
	/* Architectural blueprint grid + vertical hoarding panel seams. */
	background-image:
		repeating-linear-gradient(90deg, transparent 0 158px, rgba(255, 255, 255, 0.09) 158px 160px),
		linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
	background-size: 160px 100%, 40px 40px, 40px 40px;
	overflow: hidden;
}
body.tcs-login .tcs-hoarding-top {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	font-weight: 650;
	font-size: 1rem;
	animation: tcs-hoarding-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.tcs-login .tcs-badge {
	display: grid; place-items: center;
	flex: none;
	width: 3.5rem; height: 3.5rem; border-radius: 12px;
	background: #fff;
	box-shadow: 0 6px 18px -8px rgba(3, 18, 60, 0.6);
}
body.tcs-login .tcs-badge img { width: 2.5rem; height: 2.5rem; }
body.tcs-login .tcs-hoarding-body {
	margin: auto 0;
	padding: 1.25rem 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}
body.tcs-login .tcs-company {
	margin: 0;
	font-size: clamp(2.4rem, 4.6vw, 4.25rem);
	font-weight: 850;
	line-height: 1.02;
	letter-spacing: -0.035em;
	color: #fff;
	text-wrap: balance;
	overflow-wrap: anywhere;
	animation: tcs-hoarding-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}
body.tcs-login .tcs-host {
	display: inline-block;
	margin: 0.9rem 0 0;
	padding: 0.3rem 0.8rem;
	border: 1.5px solid rgba(255, 255, 255, 0.45);
	border-radius: 6px;
	font-size: 0.92rem;
	font-weight: 550;
	color: #e6efff;
	overflow-wrap: anywhere;
	animation: tcs-hoarding-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

/* Interactive Site-to-Ledger flow panel on the hoarding */
body.tcs-login .tcs-flow {
	width: 100%;
	max-width: 34rem;
	margin-top: 1.65rem;
	padding: 1rem 1.1rem;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(10, 22, 56, 0.48);
	box-shadow: 0 20px 40px -28px rgba(3, 14, 48, 0.8);
	animation: tcs-hoarding-enter 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}
body.tcs-login .tcs-flow-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}
body.tcs-login .tcs-flow-title {
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: #e6efff;
}
body.tcs-login .tcs-flow-pause {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: -8px -8px -8px 0;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: rgba(255, 255, 255, 0.08);
	color: #e6efff;
	cursor: pointer;
	touch-action: manipulation;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
body.tcs-login .tcs-flow-pause:hover {
	background: rgba(255, 255, 255, 0.18);
	border-color: rgba(255, 255, 255, 0.45);
	color: #fff;
}
body.tcs-login .tcs-flow-stage {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) 72px minmax(0, 0.95fr);
	align-items: center;
	gap: 0;
}
body.tcs-login .tcs-flow-lanes {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}
body.tcs-login .tcs-lane-btn {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	min-height: 44px;
	padding: 0.45rem 0.7rem;
	border-radius: 9px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.06);
	color: #dbe8ff;
	text-align: left;
	cursor: pointer;
	touch-action: manipulation;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
body.tcs-login .tcs-lane-btn:hover {
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.36);
	transform: translateX(2px);
}
body.tcs-login .tcs-lane-btn.is-active {
	background: rgba(255, 255, 255, 0.16);
	border-color: var(--tcs-amber);
	color: #fff;
}
body.tcs-login .tcs-lane-dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.45);
	transition: background-color 0.15s ease, transform 0.15s ease;
}
body.tcs-login .tcs-lane-btn.is-active .tcs-lane-dot {
	background: var(--tcs-amber);
	transform: scale(1.2);
}
body.tcs-login .tcs-lane-copy {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
body.tcs-login .tcs-lane-name {
	font-size: 0.82rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
body.tcs-login .tcs-lane-meta {
	font-size: 0.72rem;
	color: #b7ceff;
	line-height: 1.25;
}
body.tcs-login .tcs-flow-wires {
	width: 100%;
	height: 156px;
	display: block;
}
body.tcs-login .tcs-wire-base {
	fill: none;
	stroke: rgba(255, 255, 255, 0.22);
	stroke-width: 1.75;
	transition: stroke 0.2s ease, stroke-width 0.2s ease;
}
body.tcs-login .tcs-wire-base.is-active {
	stroke: rgba(255, 255, 255, 0.55);
	stroke-width: 2.25;
}
body.tcs-login .tcs-wire-pulse {
	fill: none;
	stroke: #7ec2ff;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-dasharray: 22 140;
	animation: tcs-wire-travel 3.2s linear infinite;
}
body.tcs-login .tcs-wire-pulse.is-active {
	stroke: var(--tcs-amber);
	stroke-width: 3;
	animation-duration: 2.4s;
}
body.tcs-login .tcs-flow.is-paused .tcs-wire-pulse,
body.tcs-login .tcs-flow.is-paused .tcs-flow-beacon {
	animation-play-state: paused;
}
body.tcs-login .tcs-flow-hub {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.28rem;
	padding: 0.85rem 0.9rem;
	border-radius: 11px;
	border: 1px solid rgba(255, 255, 255, 0.26);
	background: var(--tcs-navy);
	color: #fff;
}
body.tcs-login .tcs-flow-beacon {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--tcs-amber);
	margin-bottom: 0.15rem;
	animation: tcs-beacon-pulse 2.6s ease-in-out infinite;
}
body.tcs-login .tcs-flow-hub-title {
	font-size: 0.95rem;
	font-weight: 800;
	letter-spacing: -0.015em;
	line-height: 1.2;
}
body.tcs-login .tcs-flow-hub-sub {
	font-size: 0.78rem;
	color: #b7ceff;
	line-height: 1.3;
}
body.tcs-login .tcs-flow-hub-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin-top: 0.35rem;
}
body.tcs-login .tcs-hub-pill {
	padding: 0.16rem 0.45rem;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.1);
	font-size: 0.68rem;
	font-weight: 600;
	color: #dbe8ff;
}
body.tcs-login .tcs-flow-detail {
	margin: 0.75rem 0 0;
	padding-top: 0.65rem;
	border-top: 1px solid rgba(255, 255, 255, 0.14);
	font-size: 0.82rem;
	line-height: 1.45;
	color: #dbe8ff;
	min-height: 2.5em;
}

body.tcs-login .tcs-hoarding-foot {
	margin: 0 0 1.25rem;
	max-width: 26rem;
	color: #cfe0ff;
	font-size: 0.95rem;
	line-height: 1.5;
	text-wrap: pretty;
}
body.tcs-login .tcs-tape {
	height: 18px;
	margin: 0 -2.75rem;
	background: repeating-linear-gradient(-45deg, var(--tcs-amber) 0 18px, var(--tcs-navy) 18px 36px);
}

/* The card */
@keyframes tcs-card-enter {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}
body.tcs-login .page-card {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 2.25rem 2.25rem 2rem;
	background: #fff;
	border: 1px solid var(--tcs-line);
	border-radius: 18px;
	box-shadow: 0 24px 48px -32px rgba(3, 30, 90, 0.45);
	animation: tcs-card-enter 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.tcs-login .page-card-head { gap: 1.4rem; }
body.tcs-login .page-card-head img.app-logo.tcs-logo {
	height: 2.75rem;
	max-height: none;
	width: auto;
	max-width: 100%;
	aspect-ratio: 905 / 240;
}
body.tcs-login .page-card-head h2,
body.tcs-login .page-card-head h4 {
	font-family: inherit;
	font-size: 1.7rem;
	font-weight: 820;
	letter-spacing: -0.022em;
	line-height: 1.15;
	color: var(--tcs-navy);
	text-wrap: balance;
	overflow-wrap: anywhere;
}
body.tcs-login .page-card-subtitle { color: var(--tcs-muted); font-size: 1rem; line-height: 1.55; }

/* The main action: company account. */
body.tcs-login .tcs-company-signin { display: flex; flex-direction: column; }
body.tcs-login .btn-keycloak.tcs-primary {
	display: flex; align-items: center; justify-content: center;
	min-height: 3.25rem;
	padding: 0 1.25rem;
	border-radius: 10px;
	background: var(--tcs-royal);
	border: 2px solid var(--tcs-royal);
	color: #fff;
	font-weight: 700;
	font-size: 1.02rem;
	text-decoration: none;
	touch-action: manipulation;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
body.tcs-login .btn-keycloak.tcs-primary:hover {
	background: var(--tcs-royal-deep);
	border-color: var(--tcs-royal-deep);
	color: #fff;
}

/* Supplier sign-in, folded away until asked for. */
body.tcs-login .tcs-supplier-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	margin-top: -0.25rem;
	padding: 0.75rem 0.5rem 0.35rem;
	border: 0;
	border-top: 1px solid var(--tcs-line);
	background: transparent;
	color: var(--tcs-royal);
	font: inherit;
	font-weight: 600;
	font-size: 0.95rem;
	text-align: center;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	touch-action: manipulation;
	transition: color 0.15s ease;
}
body.tcs-login .tcs-supplier-toggle:hover {
	color: var(--tcs-royal-deep);
	text-decoration-thickness: 2px;
}
body.tcs-login .tcs-supplier-toggle[hidden] { display: none; }
body.tcs-login form.tcs-folded { display: none; }
body.tcs-login .tcs-company-signin ~ form { padding-top: 1.25rem; border-top: 1px solid var(--tcs-line); }

/* Form fields & actions (shared across .for-login, .for-forgot, .for-signup, .for-login-with-email-link). */
body.tcs-login .page-card .form-group label { color: var(--tcs-navy); font-weight: 600; font-size: 0.92rem; }
body.tcs-login .page-card .page-card-body input.form-control {
	min-height: 2.9rem;
	height: auto;
	padding: 0.55rem 0.85rem;
	border-radius: 10px;
	border: 1.5px solid var(--tcs-line);
	background: #fff;
	color: var(--tcs-navy);
	font-size: 1rem;
	transition: border-color 0.15s ease;
}
body.tcs-login .page-card .page-card-body .password-field input.form-control {
	padding-right: 3.15rem;
}
body.tcs-login .page-card .page-card-body .password-field .toggle-password {
	box-sizing: border-box;
	right: 2px;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	padding: 13px;
	border-radius: 8px;
	stroke: var(--tcs-muted);
	touch-action: manipulation;
	transition: stroke 0.15s ease, background-color 0.15s ease;
}
body.tcs-login .page-card .page-card-body .password-field .toggle-password:hover {
	stroke: var(--tcs-navy);
	background: var(--tcs-sky-wash);
}
body.tcs-login .page-card .page-card-body input.form-control:focus:not(:focus-visible) {
	outline: none;
	border-color: var(--tcs-royal);
	box-shadow: none;
}
body.tcs-login .page-card .page-card-body input.form-control:focus-visible {
	border-color: var(--tcs-royal);
	box-shadow: none;
}
body.tcs-login .page-card .field-error {
	color: var(--tcs-danger);
	font-size: 0.875rem;
}

body.tcs-login .page-card-actions button[type="submit"],
body.tcs-login .page-card-actions .es-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	padding: 0 1.25rem;
	border-radius: 10px;
	font-weight: 700;
	font-size: 1rem;
	text-decoration: none;
	touch-action: manipulation;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Primary submit on .for-forgot, .for-login-with-email-link, .for-signup, or .for-login without SSO. */
body.tcs-login .page-card-actions button[type="submit"] {
	background: var(--tcs-royal);
	color: #fff;
	border: 2px solid var(--tcs-royal);
}
body.tcs-login .page-card-actions button[type="submit"]:hover:not(:disabled) {
	background: var(--tcs-royal-deep);
	border-color: var(--tcs-royal-deep);
	color: #fff;
}
body.tcs-login .page-card-actions button[type="submit"]:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* When SSO is primary, the folded supplier submit stays secondary outlined. */
body.tcs-login .tcs-company-signin ~ form .page-card-actions button[type="submit"] {
	background: #fff;
	color: var(--tcs-royal);
	border: 2px solid var(--tcs-royal);
}
body.tcs-login .tcs-company-signin ~ form .page-card-actions button[type="submit"]:hover:not(:disabled) {
	background: var(--tcs-sky-wash);
	border-color: var(--tcs-royal-deep);
	color: var(--tcs-royal-deep);
}

body.tcs-login .page-card a[href="#forgot"] {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 4px;
	color: var(--tcs-muted);
	text-decoration: none;
	touch-action: manipulation;
	transition: color 0.15s ease;
}
body.tcs-login .page-card a[href="#forgot"]:hover {
	color: var(--tcs-navy);
	text-decoration: underline;
	text-underline-offset: 3px;
}

body.tcs-login .btn-login-with-email-link,
body.tcs-login .page-card-actions .btn-login-option {
	background: transparent;
	color: var(--tcs-ink);
	border: 1.5px solid var(--tcs-line);
	font-weight: 600;
}
body.tcs-login .btn-login-with-email-link:hover,
body.tcs-login .page-card-actions .btn-login-option:hover {
	background: var(--tcs-sky-wash);
	border-color: var(--tcs-royal);
	color: var(--tcs-royal-deep);
}

body.tcs-login .sign-up-message {
	color: var(--tcs-muted);
	font-size: 0.95rem;
}
body.tcs-login .sign-up-message a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 6px;
	color: var(--tcs-royal);
	font-weight: 600;
	text-underline-offset: 3px;
	touch-action: manipulation;
	transition: color 0.15s ease;
}
body.tcs-login .sign-up-message a:hover {
	color: var(--tcs-royal-deep);
	text-decoration: underline;
}

/* Keyboard focus: always visible, using :focus-visible without :focus collisions. */
body[data-path="login"] a:focus-visible,
body[data-path="login"] button:focus-visible,
body[data-path="login"] input:focus-visible,
body[data-path="login"] [tabindex]:focus-visible {
	outline: 3px solid var(--tcs-sky);
	outline-offset: 2px;
}
body.tcs-login .tcs-hoarding a:focus-visible,
body.tcs-login .tcs-hoarding button:focus-visible { outline-color: #fff; }

@media (max-width: 1150px) and (min-width: 901px) {
	body.tcs-login .tcs-hoarding { padding: 1.75rem 1.75rem 0; }
	body.tcs-login .tcs-tape { margin: 0 -1.75rem; }
	body.tcs-login .tcs-flow-stage { grid-template-columns: minmax(0, 1.15fr) 42px minmax(0, 0.95fr); }
	body.tcs-login .tcs-flow-hub { padding: 0.7rem; }
}

@media (max-height: 760px) and (min-width: 901px) {
	body.tcs-login .tcs-hoarding { padding-top: 1.5rem; }
	body.tcs-login .tcs-hoarding-body { padding: 0.75rem 0; }
	body.tcs-login .tcs-company { font-size: clamp(2rem, 3.8vw, 3.25rem); }
	body.tcs-login .tcs-flow { margin-top: 1.1rem; padding: 0.8rem 0.95rem; }
	body.tcs-login .tcs-flow-wires { height: 142px; }
	body.tcs-login .tcs-hoarding-foot { margin-bottom: 0.85rem; font-size: 0.88rem; }
}

/* Phones and narrow windows: the hoarding becomes a compact band above the card. */
@media (max-width: 900px) {
	body.tcs-login .page-content-wrapper {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		align-content: start;
	}
	body.tcs-login .tcs-hoarding {
		grid-row: auto;
		position: static;
		height: auto;
		padding: 1.5rem max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
	}
	body.tcs-login .tcs-hoarding-body { margin: 0; padding: 1.5rem 0 1.25rem; }
	body.tcs-login .tcs-company { font-size: clamp(2rem, 9vw, 2.8rem); }
	body.tcs-login .tcs-flow,
	body.tcs-login .tcs-hoarding-foot { display: none; }
	body.tcs-login .tcs-tape {
		height: 12px;
		margin: 0 calc(-1 * max(1.25rem, env(safe-area-inset-right))) 0 calc(-1 * max(1.25rem, env(safe-area-inset-left)));
	}
	body.tcs-login .page-content-wrapper > main.container {
		grid-column: 1;
		grid-row: 2;
		padding: 1.5rem max(1rem, env(safe-area-inset-right)) max(2.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
	}
	body.tcs-login .page-card {
		padding: 1.5rem 1.25rem;
		min-height: 0;
		border: 1px solid var(--tcs-line);
		border-radius: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	body[data-path="login"] * {
		animation: none !important;
		transition: none !important;
	}
}
