/*
 * Customer portal.
 *
 * Everything is scoped to .hkp so it cannot leak into the theme. The brand colour comes from
 * Settings → Portal and is set as --hkp-accent; every tint and shade below is derived from it.
 */

.hkp {
	--hkp-accent: #4f46e5;
	--hkp-accent-dark: #4338ca;
	--hkp-accent-soft: #eef2ff;
	--hkp-accent-ring: rgba(79, 70, 229, 0.22);
	--hkp-ink: #101828;
	--hkp-border: #e4e7ec;
	--hkp-border-strong: #cfd4dc;
	--hkp-muted: #667085;
	--hkp-surface: #fff;
	--hkp-soft: #f7f8fb;
	--hkp-good: #067647;
	--hkp-good-bg: #e7f7ee;
	--hkp-warn: #b54708;
	--hkp-warn-bg: #fff4e0;
	--hkp-bad: #b42318;
	--hkp-bad-bg: #fdecea;
	--hkp-info: #3538cd;
	--hkp-info-bg: #eef2ff;
	--hkp-radius: 16px;
	--hkp-radius-sm: 12px;
	--hkp-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -14px rgba(16, 24, 40, 0.18);
	--hkp-shadow-lift: 0 2px 4px rgba(16, 24, 40, 0.05), 0 18px 36px -16px rgba(16, 24, 40, 0.28);

	box-sizing: border-box;
	max-width: 980px;
	margin: 0 auto;
	color: var(--hkp-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

/* Tints and shades follow the brand colour wherever the browser can mix colours. */
@supports (color: color-mix(in srgb, red, blue)) {
	.hkp {
		--hkp-accent-dark: color-mix(in srgb, var(--hkp-accent) 82%, #000);
		--hkp-accent-soft: color-mix(in srgb, var(--hkp-accent) 9%, #fff);
		--hkp-accent-ring: color-mix(in srgb, var(--hkp-accent) 26%, transparent);
		--hkp-info: var(--hkp-accent-dark);
		--hkp-info-bg: var(--hkp-accent-soft);
	}
}

.hkp *,
.hkp *::before,
.hkp *::after {
	box-sizing: inherit;
}

/* Neutralise theme typography so the portal looks the same in every theme. */
.hkp :is(p, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, figure) {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
}

.hkp a {
	color: var(--hkp-accent);
	text-underline-offset: 3px;
}

.hkp.hkp-login {
	max-width: 420px;
	text-align: center;
}

/* Header: avatar, greeting and the order button. */
.hkp .hkp-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
	padding: 20px 24px;
	color: #fff;
	background: linear-gradient(135deg, var(--hkp-accent) 0%, var(--hkp-accent-dark) 100%);
	border-radius: var(--hkp-radius);
	box-shadow: var(--hkp-shadow-lift);
}

.hkp .hkp-who {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.hkp .hkp-avatar {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	color: #fff;
	font-size: 1.05em;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
}

.hkp .hkp-hello {
	margin: 0;
	color: #fff;
	overflow: hidden;
	font-size: 1.3em;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hkp .hkp-sub {
	margin: 2px 0 0;
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.9em;
}

.hkp .hkp-head .hkp-button--ghost {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.5);
	box-shadow: none;
}

.hkp .hkp-head .hkp-button--ghost:hover {
	background: rgba(255, 255, 255, 0.26);
	transform: none;
}

/* Menu: a segmented control that scrolls sideways on small screens. */
.hkp .hkp-nav {
	display: flex;
	gap: 4px;
	margin-bottom: 24px;
	padding: 5px;
	overflow-x: auto;
	background: var(--hkp-soft);
	border: 1px solid var(--hkp-border);
	border-radius: var(--hkp-radius-sm);
	scrollbar-width: none;
}

.hkp .hkp-nav::-webkit-scrollbar {
	display: none;
}

.hkp .hkp-nav a {
	flex: 0 0 auto;
	padding: 9px 16px;
	color: var(--hkp-muted);
	font-size: 0.95em;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	border-radius: 9px;
	transition: color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.hkp .hkp-nav a:hover {
	color: var(--hkp-ink);
	background: rgba(16, 24, 40, 0.05);
}

.hkp .hkp-nav a[aria-current="page"] {
	color: var(--hkp-accent);
	background: var(--hkp-surface);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 0 0 1px var(--hkp-border);
}

.hkp .hkp-nav__out {
	margin-left: auto;
}

/* Headings and text. */
.hkp .hkp-h1 {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0 0 6px;
	color: var(--hkp-ink);
	font-size: 1.65em;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.02em;
}

.hkp .hkp-h1 + .hkp-muted {
	margin: 0 0 20px;
}

.hkp .hkp-h2 {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
	color: var(--hkp-ink);
	font-size: 1.05em;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.hkp .hkp-h1 a,
.hkp .hkp-h2 a {
	color: inherit;
	text-decoration: none;
}

.hkp .hkp-h1 a:hover,
.hkp .hkp-h2 a:hover {
	color: var(--hkp-accent);
}

.hkp .hkp-title {
	margin-top: 0;
}

.hkp .hkp-muted {
	color: var(--hkp-muted);
	font-size: 0.92em;
}

.hkp .hkp-note {
	margin: 14px 0 0;
	padding-top: 14px;
	color: var(--hkp-muted);
	font-size: 0.85em;
	border-top: 1px dashed var(--hkp-border);
}

.hkp .hkp-pre {
	white-space: pre-line;
}

/* Cards. */
.hkp .hkp-card {
	margin: 0 0 20px;
	padding: 24px;
	background: var(--hkp-surface);
	border: 1px solid var(--hkp-border);
	border-radius: var(--hkp-radius);
	box-shadow: var(--hkp-shadow);
}

.hkp .hkp-empty {
	padding: 40px 24px;
	color: var(--hkp-muted);
	text-align: center;
	background: var(--hkp-soft);
	border-style: dashed;
	box-shadow: none;
}

.hkp .hkp-empty p {
	margin: 0 0 14px;
}

.hkp .hkp-cards {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.hkp .hkp-cards .hkp-card {
	margin: 0;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hkp .hkp-cards .hkp-card:hover {
	border-color: var(--hkp-border-strong);
	box-shadow: var(--hkp-shadow-lift);
	transform: translateY(-2px);
}

/* Stat tiles. */
.hkp .hkp-stats {
	display: grid;
	gap: 14px;
	margin-bottom: 20px;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.hkp .hkp-stat {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 18px 20px 18px 24px;
	overflow: hidden;
	background: var(--hkp-surface);
	border: 1px solid var(--hkp-border);
	border-radius: var(--hkp-radius);
	box-shadow: var(--hkp-shadow);
}

.hkp .hkp-stat::before {
	position: absolute;
	top: 14px;
	bottom: 14px;
	left: 0;
	width: 4px;
	background: var(--hkp-accent);
	border-radius: 0 4px 4px 0;
	content: "";
}

.hkp .hkp-stat--warn {
	background: linear-gradient(180deg, var(--hkp-warn-bg), #fff);
	border-color: #f9d9a8;
}

.hkp .hkp-stat--warn::before {
	background: #f79009;
}

.hkp .hkp-stat__label {
	color: var(--hkp-muted);
	font-size: 0.82em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hkp .hkp-stat__value {
	font-size: 1.7em;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

/* Lists, facts and pills. */
.hkp .hkp-list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hkp .hkp-list li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	padding: 13px 0;
	border-top: 1px solid var(--hkp-border);
}

.hkp .hkp-list li:first-child {
	border-top: 0;
}

.hkp .hkp-list__end {
	margin-left: auto;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* Facts: a small label above its value, in tiles. */
.hkp .hkp-dl {
	display: grid;
	gap: 14px 20px;
	margin: 0;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.hkp .hkp-dl > div {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	padding: 12px 14px;
	background: var(--hkp-soft);
	border-radius: var(--hkp-radius-sm);
}

.hkp .hkp-dl dt {
	color: var(--hkp-muted);
	font-size: 0.78em;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.hkp .hkp-dl dd {
	margin: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.hkp .hkp-dl dd .hkp-muted {
	font-weight: 400;
}

.hkp .hkp-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 11px 2px 9px;
	color: var(--hkp-muted);
	font-size: 0.76em;
	font-weight: 600;
	line-height: 1.7;
	white-space: nowrap;
	background: var(--hkp-soft);
	border-radius: 999px;
}

.hkp .hkp-pill::before {
	width: 6px;
	height: 6px;
	background: currentcolor;
	border-radius: 50%;
	content: "";
}

.hkp .hkp-pill--good {
	color: var(--hkp-good);
	background: var(--hkp-good-bg);
}

.hkp .hkp-pill--warn {
	color: var(--hkp-warn);
	background: var(--hkp-warn-bg);
}

.hkp .hkp-pill--bad {
	color: var(--hkp-bad);
	background: var(--hkp-bad-bg);
}

/* Messages. */
.hkp .hkp-alert {
	margin: 0 0 20px;
	padding: 14px 18px;
	font-weight: 500;
	border: 1px solid transparent;
	border-radius: var(--hkp-radius-sm);
}

.hkp .hkp-alert--good {
	color: var(--hkp-good);
	background: var(--hkp-good-bg);
	border-color: #b7e4cc;
}

.hkp .hkp-alert--bad {
	color: var(--hkp-bad);
	background: var(--hkp-bad-bg);
	border-color: #f4c3be;
}

.hkp .hkp-notice {
	position: relative;
	margin: 0 0 20px;
	padding: 16px 48px 16px 20px;
	background: var(--hkp-info-bg);
	border: 1px solid transparent;
	border-left: 4px solid var(--hkp-accent);
	border-radius: var(--hkp-radius-sm);
}

.hkp .hkp-notice--warning {
	background: var(--hkp-warn-bg);
	border-left-color: #f79009;
}

.hkp .hkp-notice--danger {
	background: var(--hkp-bad-bg);
	border-left-color: #f04438;
}

.hkp .hkp-notice--success {
	background: var(--hkp-good-bg);
	border-left-color: #12b76a;
}

.hkp .hkp-notice p {
	margin: 4px 0 0;
	white-space: pre-line;
}

.hkp .hkp-notice__close {
	position: absolute;
	top: 10px;
	right: 10px;
	margin: 0;
}

.hkp .hkp-notice__close button {
	width: 32px;
	height: 32px;
	padding: 0;
	color: inherit;
	font-size: 1.4em;
	line-height: 1;
	cursor: pointer;
	background: transparent;
	border: 0;
	border-radius: 8px;
	transition: background-color 0.15s;
}

.hkp .hkp-notice__close button:hover {
	background: rgba(16, 24, 40, 0.08);
}

/* Tables. */
.hkp .hkp-table-wrap {
	margin: 0 0 20px;
	overflow-x: auto;
	background: var(--hkp-surface);
	border: 1px solid var(--hkp-border);
	border-radius: var(--hkp-radius);
	box-shadow: var(--hkp-shadow);
}

.hkp .hkp-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
}

.hkp .hkp-table th,
.hkp .hkp-table td {
	padding: 14px 20px;
	text-align: left;
	vertical-align: middle;
	border: 0;
	border-top: 1px solid var(--hkp-border);
}

.hkp .hkp-table thead th {
	padding-top: 12px;
	padding-bottom: 12px;
	color: var(--hkp-muted);
	font-size: 0.74em;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: var(--hkp-soft);
	border-top: 0;
}

.hkp .hkp-table tbody tr {
	transition: background-color 0.12s;
}

.hkp .hkp-table tbody tr:hover {
	background: var(--hkp-soft);
}

.hkp .hkp-table tbody tr:first-child td {
	border-top: 0;
}

.hkp .hkp-table td a {
	font-weight: 600;
	text-decoration: none;
}

.hkp .hkp-table td a:hover {
	text-decoration: underline;
}

.hkp .hkp-num {
	text-align: right !important;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.hkp .hkp-total th,
.hkp .hkp-total td {
	font-size: 1.05em;
	font-weight: 700;
	background: var(--hkp-soft);
}

.hkp .hkp-pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 20px;
	color: var(--hkp-muted);
}

/* Forms: tall, rounded, with clear focus and error states. */
.hkp .hkp-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
	max-width: 580px;
}

.hkp .hkp-grid {
	display: grid;
	gap: 18px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.hkp .hkp-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.hkp .hkp-field label {
	font-size: 0.9em;
	font-weight: 600;
}

.hkp .hkp-field input[type="text"],
.hkp .hkp-field input[type="tel"],
.hkp .hkp-field input[type="email"],
.hkp .hkp-field input[type="password"],
.hkp .hkp-field select,
.hkp .hkp-field textarea {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 11px 14px;
	color: inherit;
	font: inherit;
	line-height: 1.4;
	background-color: var(--hkp-surface);
	border: 1px solid var(--hkp-border-strong);
	border-radius: var(--hkp-radius-sm);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	transition: border-color 0.15s, box-shadow 0.15s;
	appearance: none;
}

.hkp .hkp-field select {
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.hkp .hkp-field textarea {
	min-height: 120px;
	resize: vertical;
}

.hkp .hkp-field input:hover,
.hkp .hkp-field select:hover,
.hkp .hkp-field textarea:hover {
	border-color: #98a2b3;
}

.hkp .hkp-field input:focus,
.hkp .hkp-field select:focus,
.hkp .hkp-field textarea:focus {
	border-color: var(--hkp-accent);
	outline: 0;
	box-shadow: 0 0 0 4px var(--hkp-accent-ring);
}

.hkp .hkp-field.has-error input,
.hkp .hkp-field.has-error select,
.hkp .hkp-field.has-error textarea {
	border-color: var(--hkp-bad);
}

.hkp .hkp-field.has-error input:focus,
.hkp .hkp-field.has-error select:focus,
.hkp .hkp-field.has-error textarea:focus {
	box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.18);
}

.hkp .hkp-error {
	color: var(--hkp-bad);
	font-size: 0.88em;
}

/* Buttons. */
.hkp .hkp-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	min-height: 46px;
	padding: 10px 24px;
	color: #fff !important;
	font: inherit;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
	background: linear-gradient(180deg, var(--hkp-accent), var(--hkp-accent-dark));
	border: 0;
	border-radius: var(--hkp-radius-sm);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 8px 18px -8px var(--hkp-accent);
	transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.hkp .hkp-button:hover {
	filter: brightness(1.06);
	box-shadow: 0 2px 4px rgba(16, 24, 40, 0.14), 0 14px 24px -10px var(--hkp-accent);
	transform: translateY(-1px);
}

.hkp .hkp-button:active {
	transform: translateY(0);
}

.hkp .hkp-button:focus-visible,
.hkp .hkp-nav a:focus-visible,
.hkp a:focus-visible {
	outline: 3px solid var(--hkp-accent-ring);
	outline-offset: 2px;
}

.hkp .hkp-button--ghost {
	color: var(--hkp-accent) !important;
	background: var(--hkp-surface);
	border: 1px solid var(--hkp-accent);
	box-shadow: none;
}

.hkp .hkp-button--ghost:hover {
	background: var(--hkp-accent-soft);
	filter: none;
	box-shadow: none;
}

.hkp .hkp-hp {
	position: absolute;
	left: -9999px;
}

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

	.hkp .hkp-cards .hkp-card:hover,
	.hkp .hkp-button:hover {
		transform: none;
	}
}

/* Tablets and phones. */
@media (max-width: 760px) {
	.hkp .hkp-head {
		padding: 18px;
	}

	.hkp .hkp-card {
		padding: 20px;
	}
}

@media (max-width: 640px) {
	.hkp .hkp-head {
		flex-direction: column;
		align-items: stretch;
	}

	.hkp .hkp-head .hkp-button {
		align-self: stretch;
	}

	.hkp .hkp-hello {
		white-space: normal;
	}

	.hkp .hkp-h1 {
		font-size: 1.45em;
	}

	/* Tables become stacked cards. */
	.hkp .hkp-table-wrap {
		background: transparent;
		border: 0;
		box-shadow: none;
		overflow: visible;
	}

	.hkp .hkp-table thead {
		position: absolute;
		left: -9999px;
	}

	.hkp .hkp-table,
	.hkp .hkp-table tbody,
	.hkp .hkp-table tfoot,
	.hkp .hkp-table tr,
	.hkp .hkp-table td,
	.hkp .hkp-table th {
		display: block;
		width: 100%;
	}

	.hkp .hkp-table tbody tr {
		margin-bottom: 12px;
		padding: 8px 0;
		background: var(--hkp-surface);
		border: 1px solid var(--hkp-border);
		border-radius: var(--hkp-radius-sm);
		box-shadow: var(--hkp-shadow);
	}

	.hkp .hkp-table td {
		display: flex;
		justify-content: space-between;
		gap: 16px;
		padding: 7px 16px;
		text-align: right;
		border: 0;
	}

	.hkp .hkp-table td::before {
		color: var(--hkp-muted);
		font-weight: 600;
		text-align: left;
		content: attr(data-label);
	}

	.hkp .hkp-table tfoot {
		background: var(--hkp-surface);
		border: 1px solid var(--hkp-border);
		border-radius: var(--hkp-radius-sm);
	}

	.hkp .hkp-table tfoot tr {
		display: flex;
		justify-content: space-between;
		padding: 8px 16px;
		border-top: 1px solid var(--hkp-border);
	}

	.hkp .hkp-table tfoot tr:first-child {
		border-top: 0;
	}

	.hkp .hkp-table tfoot th,
	.hkp .hkp-table tfoot td {
		display: block;
		width: auto;
		padding: 0;
		background: transparent;
		border: 0;
	}

	.hkp .hkp-dl {
		grid-template-columns: 1fr;
	}

	.hkp .hkp-form {
		max-width: none;
	}

	.hkp .hkp-button {
		align-self: stretch;
	}
}
