/*
 * Verification portal, new look (see config/verify_ui.php). Self-contained: no Bootstrap,
 * no web fonts, no icon kit. Tenant colour arrives as --accent.
 *
 * Built to WCAG 2.1 AA. Every text/background pair below is >= 4.5:1 and
 * every control boundary / focus ring / status icon is >= 3:1. A tenant
 * --accent must be >= 4.5:1 against white (tests/Unit/Verify/
 * VerifyUiConfigTest.php enforces this for config/verify_ui.php).
 */

:root {
	--accent: #1d5c63;
	--ink: #14202b;
	--ink-2: #4a5866;
	--ink-3: #5a6672;
	--control: #7d8894; /* input/radio borders: 3.6:1 on white */
	--line: #e3e8ee;
	--surface: #ffffff;
	--canvas: #f4f6f9;
	--radius: 14px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);

	--success: #0f7a3d; --success-bg: #e8f6ee; --success-line: #b6e2c6;
	--warning: #9a5b00; --warning-bg: #fff5e0; --warning-line: #f5d38f;
	--danger:  #b42318; --danger-bg:  #fdecea; --danger-line:  #f6c1bb;
	--neutral: #475467; --neutral-bg: #eef1f5; --neutral-line: #d5dbe3;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.v-body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--canvas);
	color: var(--ink);
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon--xl { width: 2.5rem; height: 2.5rem; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .75rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

.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;
}

/* One consistent, high-contrast focus ring for every interactive element. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip:focus-visible, .footer :focus-visible { outline-color: #fff; }

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

/* ---- header / footer ------------------------------------------------ */

.topbar {
	background: var(--surface);
	border-top: 4px solid var(--accent);
	border-bottom: 1px solid var(--line);
}
.topbar__inner {
	max-width: 960px;
	margin: 0 auto;
	padding: .75rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .85rem; min-width: 0; color: var(--ink); text-decoration: none; }
.brand__logo { height: 48px; width: auto; max-width: 150px; object-fit: contain; }
.brand__name { font-weight: 600; font-size: .95rem; line-height: 1.25; color: var(--ink-2); }

.pill {
	display: inline-flex; align-items: center; gap: .35rem;
	padding: .3rem .7rem; border-radius: 999px;
	font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.pill--law { margin: 0 0 .75rem; background: #14202b; color: #fff; }

.footer { margin-top: auto; background: #1f2a33; color: #c7d0d8; font-size: .85rem; }
.footer__inner {
	max-width: 960px; margin: 0 auto; padding: 1rem;
	display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ---- page ----------------------------------------------------------- */

.page { width: 100%; max-width: 600px; margin: 0 auto; padding: 2rem 1rem 3rem; }

.intro { margin-bottom: 1.5rem; }
.intro--compact { margin-bottom: 1rem; }
.intro__eyebrow { margin: 0 0 .25rem; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.intro__title { margin: 0; font-size: clamp(1.45rem, 4.5vw, 1.9rem); line-height: 1.2; letter-spacing: -.01em; }
.intro__lede { margin: .5rem 0 0; color: var(--ink-2); }

.panel {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1.25rem;
}
.panel--empty { text-align: center; color: var(--ink-2); padding: 2rem 1.25rem; }
.panel--empty .icon { color: var(--accent); }

.fineprint, .stamp, .searched { color: var(--ink-3); font-size: .85rem; margin: 1rem 0 0; }
.stamp { text-align: center; }
.searched { font-size: .95rem; color: var(--ink-2); }

/* ---- tabs ----------------------------------------------------------- */

.tabs {
	display: flex; gap: .25rem;
	margin: -.25rem -.25rem 1.25rem;
	padding: .25rem;
	background: var(--neutral-bg);
	border-radius: 10px;
}
.tabs__tab {
	flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
	padding: .55rem .5rem; border-radius: 8px;
	font-weight: 600; font-size: .9rem; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.tabs__tab.is-active { background: var(--surface); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent), 0 1px 2px rgba(16, 24, 40, .12); }

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

.form { display: grid; gap: 1.1rem; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field__label { display: block; margin-bottom: .4rem; padding: 0; font-weight: 600; font-size: .92rem; }
.field__opt { font-weight: 400; color: var(--ink-3); }
.field__hint { margin: .35rem 0 0; font-size: .85rem; color: var(--ink-3); }
.field__error { display: flex; align-items: center; gap: .35rem; margin: .4rem 0 0; font-size: .9rem; font-weight: 600; color: var(--danger); }
.field__error[hidden] { display: none; }
.input[aria-invalid="true"], .segmented.is-invalid .segmented__option span { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }

.input {
	width: 100%;
	min-height: 3rem;
	padding: .6rem .9rem;
	border: 1px solid var(--control);
	border-radius: 10px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: 1rem; /* >=16px keeps iOS from zooming on focus */
}
.input--id { font-size: 1.1rem; letter-spacing: .04em; text-transform: uppercase; }
.input--id::placeholder { text-transform: none; letter-spacing: 0; }
.input--narrow { max-width: 10rem; letter-spacing: .2em; }
.input::placeholder { color: #6b7580; opacity: 1; }
.input:focus-visible { border-color: var(--accent); }
.segmented__option input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.segmented {
	display: grid;
	grid-template-columns: repeat(var(--count, 2), minmax(0, 1fr));
	gap: .5rem;
}
@media (max-width: 420px) {
	.segmented { grid-template-columns: repeat(min(var(--count, 2), 2), minmax(0, 1fr)); }
}
.segmented__option { position: relative; }
.segmented__option input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented__option span {
	display: flex; align-items: center; justify-content: center;
	min-height: 2.75rem; padding: .4rem .5rem;
	border: 1px solid var(--control); border-radius: 10px;
	font-weight: 600; font-size: .92rem; text-align: center; color: var(--ink-2);
	cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.segmented__option input:checked + span {
	background: color-mix(in srgb, var(--accent) 10%, #fff);
	border-color: var(--accent);
	color: var(--accent);
	box-shadow: inset 0 0 0 1px var(--accent);
}
/* Selected state isn't carried by colour alone (1.4.1): add a check mark. */
.segmented__option input:checked + span::before {
	content: ""; width: .45rem; height: .8rem; margin: -.2rem .5rem 0 0;
	border: solid currentColor; border-width: 0 .18rem .18rem 0; transform: rotate(45deg);
}

.button {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	width: 100%; min-height: 3rem; padding: .6rem 1.25rem;
	border: 1px solid var(--accent); border-radius: 10px;
	background: var(--accent); color: #fff;
	font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none;
	cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button[disabled] { opacity: .7; cursor: progress; }
.button__busy { display: none; }
.button.is-busy .button__text { display: none; }
.button.is-busy .button__busy { display: inline; }
.button--ghost { background: var(--surface); color: var(--ink); border-color: var(--control); }

.cf-turnstile:empty { display: none; }

/* ---- status banner -------------------------------------------------- */

.status {
	display: flex; align-items: center; gap: 1rem;
	padding: 1rem 1.15rem;
	border: 1px solid;
	border-radius: var(--radius);
	margin-bottom: 1rem;
}
.status__icon {
	display: grid; place-items: center; flex: none;
	width: 3rem; height: 3rem; border-radius: 50%;
	color: #fff;
}
.status__icon .icon { width: 1.6rem; height: 1.6rem; stroke-width: 3; }
.status__label { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.status__summary { margin: .15rem 0 0; font-size: .92rem; }

.status--success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.status--success .status__icon { background: var(--success); }
.status--warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
.status--warning .status__icon { background: var(--warning); }
.status--danger  { background: var(--danger-bg);  border-color: var(--danger-line);  color: var(--danger); }
.status--danger  .status__icon { background: var(--danger); }
.status--neutral { background: var(--neutral-bg); border-color: var(--neutral-line); color: var(--neutral); }
.status--neutral .status__icon { background: #5f6b78; }

/* ---- credential card ------------------------------------------------ */

.credential {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}
.credential--success { border-top: 5px solid var(--success); }
.credential--warning { border-top: 5px solid var(--warning); }
.credential--danger  { border-top: 5px solid var(--danger); }
.credential--neutral { border-top: 5px solid #5f6b78; }

.credential__head {
	display: flex; align-items: center; justify-content: space-between; gap: .75rem;
	padding: .85rem 1.15rem;
	border-bottom: 1px solid var(--line);
	background: #fafbfc;
}
.credential__kind { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

.credential__body { display: flex; gap: 1.15rem; padding: 1.15rem; align-items: flex-start; }
.credential__photo {
	width: 112px; height: 140px; flex: none;
	object-fit: cover; border-radius: 10px;
	border: 1px solid var(--line); background: var(--neutral-bg);
}
.credential__who { min-width: 0; flex: 1; }
.credential__title { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.credential__subtitle { margin: .2rem 0 0; color: var(--ink-2); }
.credential__id { margin-top: .75rem; }
.credential__id span { display: block; font-size: .8rem; color: var(--ink-3); }
.credential__id strong {
	font: 600 1.05rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: .03em; overflow-wrap: anywhere;
}

@media (max-width: 420px) {
	.credential__body.has-photo { flex-direction: column; align-items: center; text-align: center; }
	.credential__body.has-photo .badges { justify-content: center; }
}

.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.section .badges { margin-top: 0; }

.chip {
	display: inline-flex; align-items: center;
	padding: .2rem .6rem; border-radius: 999px; border: 1px solid;
	font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.chip--success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.chip--warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
.chip--danger  { background: var(--danger-bg);  border-color: var(--danger-line);  color: var(--danger); }
.chip--neutral { background: var(--neutral-bg); border-color: var(--neutral-line); color: var(--neutral); }

.fields {
	display: grid; grid-template-columns: 1fr 1fr;
	margin: 0; padding: 0 1.15rem 1.15rem; gap: .9rem 1.25rem;
}
.credential > .fields { border-top: 1px solid var(--line); padding-top: 1rem; }
.section .fields { padding: 0; }
.fields__row { min-width: 0; }
.fields dt { font-size: .8rem; color: var(--ink-3); }
.fields dd { margin: .1rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 420px) { .fields { grid-template-columns: 1fr; } }

.section { padding: 1rem 1.15rem 1.15rem; border-top: 1px solid var(--line); }
.section__title { margin: 0 0 .75rem; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--ink-3); padding: 0 .5rem .4rem 0; border-bottom: 1px solid var(--line); }
.table td { padding: .55rem .5rem .55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 520px) {
	.table thead { display: none; }
	.table, .table tbody, .table tr, .table td { display: block; }
	.table tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
	.table tr:last-child { border-bottom: 0; }
	.table td { display: flex; gap: .75rem; padding: .15rem 0; border: 0; }
	.table td::before { content: attr(data-label); flex: 0 0 40%; font-size: .8rem; color: var(--ink-3); }
}

.alert {
	display: flex; gap: .6rem; margin: 0;
	padding: .75rem .9rem; border-radius: 10px; border: 1px solid;
	font-size: .92rem;
}
.alert .icon { margin-top: .15em; }
.alert--danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.alert--warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }

.actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.actions .button { flex: 1; }
@media (max-width: 380px) { .actions { flex-direction: column; } }

/* ---- print ---------------------------------------------------------- */

@media print {
	body.v-body { background: #fff; }
	.footer, .actions, .skip, .tabs { display: none !important; }
	.credential, .panel { box-shadow: none; }
	.page { padding-top: 1rem; }
}
