/* SignIt Online signed-out pages: sign in, register, forgot username/password,
   reset password, signed out (views/auth/*) and Terms & Privacy (auth/terms_v).

   Uses the app theme ("Command layout, Bento look") from css/app_theme.css,
   which these pages load first: every colour is a --si-* token, so light and
   dark ("Midnight") follow the same switch as the app (localStorage si-theme). */

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }

body.auth-body {
	margin: 0;
	background: var(--si-bg);
	color: var(--si-text);
	font-family: var(--si-font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
body.auth-body::before { /* faint azure wash behind the top of the page */
	content: "";
	position: fixed;
	inset: 0 0 auto 0;
	height: 420px;
	background: radial-gradient(900px 340px at 70% -80px, color-mix(in srgb, var(--si-accent) 12%, transparent), transparent 70%);
	pointer-events: none;
	z-index: 0;
}

/* ---------- Top bar (mirrors the app's .si-nav) ---------- */
.auth-top {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 62px;
	padding: 8px 24px;
	background: color-mix(in srgb, var(--si-surface) 88%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--si-line);
}
.auth-top__logo { display: block; line-height: 0; margin-right: auto; }
.auth-top__logo img { width: 92px; height: auto; filter: var(--si-logo-filter); }
.auth-top__text { color: var(--si-muted); font-size: 13.5px; }

.auth-ibtn {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border: 1px solid var(--si-line);
	border-radius: 12px;
	background: var(--si-surface);
	color: var(--si-muted);
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
.auth-ibtn:hover { color: var(--si-text); background: var(--si-soft); }
.auth-ibtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--si-ring); }
.auth-ibtn svg { width: 17px; height: 17px; }
.auth-ibtn .si-sun { display: none; }
html[data-theme="dark"] .auth-ibtn .si-moon { display: none; }
html[data-theme="dark"] .auth-ibtn .si-sun { display: block; }

.auth-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 38px;
	padding: 0 14px;
	border-radius: 12px;
	background: var(--si-accent);
	color: var(--si-on-accent) !important;
	font: 700 13.5px var(--si-font);
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color .15s;
}
.auth-cta:hover { background: var(--si-accent-hover); }
.auth-cta:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--si-ring); }
.auth-cta--ghost { background: var(--si-soft); color: var(--si-text) !important; }
.auth-cta--ghost:hover { background: var(--si-line); }

/* ---------- Page stage: form tile + Bento showcase ---------- */
.auth-stage {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1120px;
	margin: 0 auto;
	padding: 40px 24px 24px;
	display: grid;
	grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
	gap: 18px;
	align-items: stretch;
	min-height: calc(100vh - 62px - 64px);
}

.auth-panel {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 40px 40px 32px;
	background: var(--si-surface);
	border: 1px solid var(--si-line);
	border-radius: var(--si-r);
	box-shadow: var(--si-shadow);
}

/* Bento showcase (decorative; hidden from assistive tech) */
.auth-bento {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: auto auto auto;
	gap: 14px;
	align-content: stretch;
}
.ab-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	padding: 18px 20px;
	background: var(--si-surface);
	border: 1px solid var(--si-line);
	border-radius: var(--si-r);
	box-shadow: var(--si-shadow);
	color: var(--si-text);
	overflow: hidden;
}
.ab-big {
	grid-column: span 2;
	padding: 24px 24px 22px;
	background: linear-gradient(160deg, color-mix(in srgb, var(--si-accent) 12%, var(--si-surface)), var(--si-surface) 64%);
}
.ab-accent { background: var(--si-accent); border-color: transparent; color: var(--si-on-accent); }
.ab-accent .ab-lbl, .ab-accent .ab-sub { color: color-mix(in srgb, var(--si-on-accent) 78%, transparent); }
.ab-wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 14px; }

.ab-lbl { color: var(--si-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ab-title { margin: 2px 0 0; font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; max-width: 420px; }
.ab-h { margin: 4px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.ab-sub { color: var(--si-muted); font-size: 13.5px; margin: 0; }
.ab-ic {
	width: 40px; height: 40px; flex: 0 0 40px;
	display: grid; place-items: center;
	border-radius: 12px;
	background: var(--si-accent-soft);
	color: var(--si-accent);
}
.ab-accent .ab-ic { background: color-mix(in srgb, var(--si-on-accent) 18%, transparent); color: var(--si-on-accent); }
.ab-ic svg { width: 20px; height: 20px; }

/* big tile: mini docket card + completion ring */
.ab-hero { display: flex; align-items: center; gap: 18px; margin-top: 18px; }
.ab-doc {
	flex: 1 1 auto;
	min-width: 0;
	padding: 14px 16px 12px;
	background: var(--si-surface);
	border: 1px solid var(--si-line);
	border-radius: var(--si-r-sm);
	box-shadow: var(--si-shadow-pop);
	transform: rotate(-1.5deg);
}
.ab-doc__head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--si-line); }
.ab-doc__icon { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 8px; background: var(--si-soft); color: var(--si-text); }
.ab-doc__name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--si-ok-bg); color: var(--si-ok); white-space: nowrap; }
.ab-doc__lines { display: grid; gap: 7px; padding: 12px 0 4px; }
.ab-doc__lines i { display: block; height: 6px; border-radius: 3px; background: var(--si-soft); }
.ab-doc__sig { display: block; width: 140px; height: 38px; color: var(--si-accent); }
.ab-doc__foot { display: flex; justify-content: space-between; border-top: 1px dashed var(--si-line-strong); padding-top: 6px; font-size: 10.5px; color: var(--si-faint); text-transform: uppercase; letter-spacing: .04em; }
.ab-ring { width: 104px; height: 104px; flex: 0 0 auto; }
.ab-ring__bg { fill: none; stroke: var(--si-soft); stroke-width: 9; }
.ab-ring__fg { fill: none; stroke: var(--si-accent); stroke-width: 9; stroke-linecap: round; }
.ab-ring text { fill: var(--si-text); font: 800 20px var(--si-font); }
.ab-ring text.ab-ring__s { fill: var(--si-muted); font: 600 9.5px var(--si-font); letter-spacing: .06em; }

/* track tile: Sent -> Viewed -> Signed */
.ab-steps { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 10px; font-size: 12px; font-weight: 700; }
.ab-steps span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ab-steps i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .55; }
.ab-steps span:last-child i { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.ab-steps b { flex: 1 1 12px; min-width: 8px; height: 2px; border-radius: 2px; background: currentColor; opacity: .35; }

/* ---------- Form content ---------- */
.auth-title { margin: 0 0 6px; font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; color: var(--si-text); }
.auth-subtitle { margin: 0 0 26px; color: var(--si-muted); font-size: 15px; }
.auth-eyebrow { margin: 0 0 10px; color: var(--si-accent); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.auth-form { display: grid; gap: 16px; }
.auth-field { display: grid; gap: 6px; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.auth-label { font-size: 13px; font-weight: 700; color: var(--si-text); }
.auth-hint { font-size: 12.5px; color: var(--si-muted); margin: 0; }

.auth-input {
	width: 100%;
	height: 46px;
	padding: 0 14px;
	font: 500 15px var(--si-font);
	color: var(--si-text);
	background: var(--si-surface-2);
	border: 1px solid var(--si-line-strong);
	border-radius: var(--si-r-sm);
	outline: none;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
	-webkit-appearance: none;
	appearance: none;
}
.auth-input::placeholder { color: var(--si-faint); }
.auth-input:hover { border-color: color-mix(in srgb, var(--si-accent) 35%, var(--si-line-strong)); }
.auth-input:focus { background: var(--si-surface); border-color: var(--si-accent); box-shadow: 0 0 0 4px var(--si-ring); }
.auth-input[aria-invalid="true"] { border-color: var(--si-bad); }
.auth-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--si-bad) 22%, transparent); }
/* keep autofilled fields on theme (Chrome paints them yellow/blue otherwise) */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
	-webkit-text-fill-color: var(--si-text);
	-webkit-box-shadow: 0 0 0 1000px var(--si-accent-soft) inset;
	caret-color: var(--si-text);
	transition: background-color 9999s;
}

.auth-input-wrap { position: relative; }
.auth-input-wrap .auth-input { padding-right: 48px; }
.auth-reveal {
	position: absolute;
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--si-muted);
	cursor: pointer;
}
.auth-reveal:hover { color: var(--si-text); background: var(--si-soft); }
.auth-reveal:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--si-ring); }
.auth-reveal .icon-hide { display: none; }
.auth-reveal[aria-pressed="true"] .icon-show { display: none; }
.auth-reveal[aria-pressed="true"] .icon-hide { display: block; }

.auth-field-error, .auth-field-error p { margin: 0; font-size: 13px; font-weight: 500; color: var(--si-bad); }
.auth-field-error:empty { display: none; }

.auth-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--si-text); cursor: pointer; }
.auth-check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--si-accent); flex: 0 0 16px; }

.auth-btn {
	width: 100%;
	height: 48px;
	margin-top: 4px;
	border: 0;
	border-radius: var(--si-r-sm);
	background: var(--si-accent);
	color: var(--si-on-accent);
	font: 700 15px var(--si-font);
	cursor: pointer;
	box-shadow: 0 6px 16px color-mix(in srgb, var(--si-accent) 28%, transparent);
	transition: background-color .15s, box-shadow .15s, transform .05s;
}
.auth-btn:hover { background: var(--si-accent-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--si-ring); }
.auth-btn[disabled] { opacity: .65; cursor: progress; box-shadow: none; }
.auth-btn-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.auth-btn-link:hover, .auth-btn-link:focus { color: var(--si-on-accent); text-decoration: none; }

.auth-link { color: var(--si-accent); font-weight: 700; text-decoration: none; }
.auth-link:hover { color: var(--si-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.auth-link-sm { font-size: 13px; font-weight: 600; color: var(--si-accent); text-decoration: none; }
.auth-link-sm:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth-alt { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--si-line); text-align: center; color: var(--si-muted); font-size: 14px; }
.auth-alt p { margin: 0; }
.auth-alt p + p { margin-top: 8px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; }

.auth-alert {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0 0 18px;
	padding: 12px 14px;
	border-radius: var(--si-r-sm);
	font-size: 14px;
	font-weight: 500;
}
.auth-alert svg { flex: 0 0 18px; margin-top: 1px; }
.auth-alert a { color: inherit; font-weight: 700; }
.auth-alert--error { color: var(--si-bad); background: var(--si-bad-bg); }
.auth-alert--ok { color: var(--si-ok); background: var(--si-ok-bg); }

.auth-secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 2px 0 0; font-size: 12px; color: var(--si-muted); }
.auth-secure svg { flex: 0 0 14px; }

.auth-status-icon {
	width: 56px;
	height: 56px;
	display: grid;
	place-items: center;
	margin: 0 0 20px;
	border-radius: 16px;
	background: var(--si-accent-soft);
	color: var(--si-accent);
}

.auth-footer { position: relative; z-index: 1; padding: 18px 16px 26px; font-size: 12.5px; color: var(--si-muted); text-align: center; }
.auth-footer a { color: var(--si-muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-footer a:hover { color: var(--si-text); }

.auth-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Register bot trap: off-screen rather than display:none, which some bots skip */
.auth-hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
	.auth-stage { grid-template-columns: minmax(0, 480px); justify-content: center; min-height: 0; padding-top: 28px; }
	.auth-bento { display: none; }
}
@media (max-width: 560px) {
	.auth-top { padding: 8px 16px; }
	.auth-top__text { display: none; }
	.auth-stage { padding: 16px 12px 12px; }
	.auth-panel { padding: 28px 20px 24px; }
	.auth-title { font-size: 24px; }
}

/* ======================================================================
   Terms & Privacy (End User Licence Agreement): views/auth/terms_v.php
   ====================================================================== */
.terms-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
body.terms-body::before { display: none; }

.terms-hero { position: relative; z-index: 1; background: linear-gradient(170deg, color-mix(in srgb, var(--si-accent) 10%, var(--si-bg)), var(--si-bg) 70%); border-bottom: 1px solid var(--si-line); padding: 52px 0 36px; }
.terms-eyebrow { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--si-accent); }
.terms-hero h1 { margin: 0 0 12px; font-size: 38px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; color: var(--si-text); }
.terms-lede { margin: 0; max-width: 640px; font-size: 16px; color: var(--si-muted); }
.terms-actions { display: flex; gap: 10px; margin-top: 22px; }
.terms-action { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--si-line); border-radius: 12px; background: var(--si-surface); color: var(--si-text); font: 700 13.5px var(--si-font); text-decoration: none; cursor: pointer; }
.terms-action:hover { background: var(--si-soft); }

.terms-layout { position: relative; z-index: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; padding-top: 32px; padding-bottom: 56px; }

.terms-toc { position: sticky; top: 82px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; padding: 16px 14px; background: var(--si-surface); border: 1px solid var(--si-line); border-radius: var(--si-r); box-shadow: var(--si-shadow); }
.terms-toc-title { margin: 0 0 8px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--si-muted); }
.terms-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.terms-toc a { display: flex; gap: 10px; padding: 6px 8px; border-radius: 9px; font-size: 13.5px; line-height: 1.4; color: var(--si-muted); text-decoration: none; }
.terms-toc a span { min-width: 18px; color: var(--si-faint); font-variant-numeric: tabular-nums; }
.terms-toc a:hover { color: var(--si-text); background: var(--si-soft); }
.terms-toc a.is-active { color: var(--si-on-accent); background: var(--si-accent); font-weight: 700; }
.terms-toc a.is-active span { color: inherit; opacity: .8; }

.terms-doc { min-width: 0; padding: 32px 36px; background: var(--si-surface); border: 1px solid var(--si-line); border-radius: var(--si-r); box-shadow: var(--si-shadow); font-size: 15.5px; line-height: 1.75; color: var(--si-text); }
.terms-doc p { margin: 0 0 14px; }
.terms-preamble { padding: 18px 20px; margin-bottom: 32px; background: var(--si-accent-soft); border-radius: var(--si-r-sm); }
.terms-preamble p:last-child { margin-bottom: 0; }
.terms-section { padding-top: 8px; margin-bottom: 32px; scroll-margin-top: 80px; max-width: 760px; }
.terms-section h2 { display: flex; gap: 10px; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--si-line); font-size: 21px; line-height: 1.35; font-weight: 800; letter-spacing: -.02em; color: var(--si-text); }
.terms-snum { color: var(--si-accent); font-variant-numeric: tabular-nums; }
.terms-clause { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px; margin-bottom: 14px; scroll-margin-top: 80px; }
.terms-cnum { font-weight: 700; color: var(--si-text); font-variant-numeric: tabular-nums; }
.terms-cbody > p:first-child { margin-bottom: 10px; }
.terms-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.terms-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr); }
.terms-label { color: var(--si-muted); font-weight: 700; }
.terms-defs { display: grid; gap: 10px; padding: 16px 18px; border-left: 3px solid var(--si-accent); background: var(--si-surface-2); border-radius: 0 12px 12px 0; }
.terms-defs p { margin: 0; }
.terms-defs strong { color: var(--si-text); font-weight: 700; }
.terms-paras p, .terms-para { margin: 0 0 12px; }

.terms-end { margin-top: 40px; padding: 22px 24px; border-radius: var(--si-r-sm); background: var(--si-soft); display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; max-width: 760px; }
.terms-end p { margin: 0; }
.terms-end-btn { width: auto; padding: 0 22px; margin: 0; }

@media (max-width: 900px) {
	.terms-layout { grid-template-columns: 1fr; gap: 18px; padding-top: 20px; }
	.terms-toc { position: static; max-height: none; }
	.terms-toc ol { grid-template-columns: 1fr 1fr; }
	.terms-hero { padding: 34px 0 26px; }
	.terms-hero h1 { font-size: 30px; }
	.terms-doc { padding: 24px 20px; }
}
@media (max-width: 560px) {
	.terms-wrap { padding: 0 12px; }
	.terms-toc ol { grid-template-columns: 1fr; }
	.terms-clause { grid-template-columns: 1fr; }
	.terms-cnum { margin-bottom: 2px; }
	.terms-doc { font-size: 15px; }
}
@media print {
	.auth-top, .terms-actions, .terms-toc, .terms-end, .auth-footer { display: none !important; }
	body.auth-body { background: #fff; color: #000; }
	.terms-layout { display: block; padding: 0; }
	.terms-hero { background: none; border: 0; padding: 0 0 16px; }
	.terms-doc { border: 0; box-shadow: none; padding: 0; font-size: 11pt; }
}
