:root {
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--primary-light: #eff6ff;
	--text: #1e293b;
	--text-muted: #64748b;
	--bg: #ffffff;
	--bg-subtle: #f8fafc;
	--border: #e2e8f0;
	--radius: 12px;
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Typography */

body {
	font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--text);
	background-color: var(--bg-subtle);
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
	font-family: 'Source Sans Pro', sans-serif;
	font-weight: 700;
	color: var(--text);
	letter-spacing: -0.02em;
}

h4 {
	font-family: 'Source Sans Pro', sans-serif;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 0.5rem;
}

p {
	font-family: 'Source Sans Pro', sans-serif;
	font-size: 16px;
	line-height: 1.7;
	color: var(--text-muted);
}

a {
	color: var(--primary);
	text-decoration: none;
}

a:hover {
	color: var(--primary-hover);
	text-decoration: none;
}

/*
 * Icons come from the vendored Lucide sprite. The symbols use stroke="currentColor",
 * so colour still cascades from the surrounding rule; only sizing moved from
 * font-size to a box, which --icon-size sets per context.
 */
.icon {
	flex: none;
	width: var(--icon-size, 20px);
	height: var(--icon-size, 20px);
	vertical-align: middle;
}

.error {
	border-color: #ef4444;
}

.field-validation-error {
	min-height: 1.1rem;
	margin-top: 4px;
	font-size: 0.78rem;
	line-height: 1.35;
	color: #b91c1c;
}

.field-validation-error:empty {
	display: none;
}

/* Account and authentication */

.account-shell {
	display: flex;
	justify-content: center;
	width: 100%;
	padding: 3.5rem 1.25rem 5rem;
}

.account-shell-wide {
	padding-top: 2rem;
}

.account-card {
	width: min(100%, 480px);
	padding: 2rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow);
}

.account-shell-wide .account-card {
	width: min(100%, 760px);
}

.account-card-centered {
	text-align: center;
}

.account-card h2 {
	margin: 0 0 0.75rem;
	font-size: 1.8rem;
}

.account-eyebrow {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--primary);
}

.account-form {
	display: grid;
	gap: 0.65rem;
	margin-top: 1.5rem;
}

.account-form label {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text);
}

.account-form input[type="email"] {
	width: 100%;
	height: 46px;
	padding: 0 0.85rem;
	font: inherit;
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 9px;
}

.account-form input[type="email"]:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.account-form input[aria-invalid="true"] {
	border-color: #dc2626;
}

.account-form-error {
	margin: 0;
	font-size: 0.85rem;
	color: #b91c1c;
}

.account-primary,
.account-secondary-button,
.account-link-button,
.account-danger-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0.7rem 1rem;
	font: 600 0.95rem 'Source Sans Pro', sans-serif;
	border-radius: 9px;
	cursor: pointer;
}

.account-primary {
	color: #fff;
	background: var(--primary);
	border: 1px solid var(--primary);
}

.account-primary:hover {
	color: #fff;
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

.account-inline-button {
	margin-top: 0.5rem;
}

.account-secondary-button {
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border);
}

.account-secondary-button:hover {
	color: var(--primary);
	border-color: var(--primary);
}

.account-link-button {
	color: var(--text-muted);
	background: transparent;
	border: 1px solid transparent;
}

.account-link-button:hover {
	color: #b91c1c;
}

.account-danger-button {
	color: #fff;
	background: #b91c1c;
	border: 1px solid #b91c1c;
}

.account-danger-button:hover {
	color: #fff;
	background: #991b1b;
	border-color: #991b1b;
}

.account-fine-print {
	margin: 1.25rem 0 0;
	font-size: 0.82rem;
	line-height: 1.5;
}

.account-status-icon {
	display: block;
	margin: 0 auto 1rem;
	--icon-size: 42px;
	color: var(--primary);
}

.account-status-icon-error {
	color: #b91c1c;
}

.account-status-icon-spinning {
	animation: account-spinner 1s linear infinite;
}

.account-secondary-link {
	display: inline-block;
	margin-top: 0.75rem;
	font-weight: 600;
}

.account-heading-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.account-badge {
	padding: 0.35rem 0.65rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: #1d4ed8;
	background: var(--primary-light);
	border-radius: 999px;
}

.account-empty-state {
	margin: 1.75rem 0;
	padding: 2rem 1.25rem;
	text-align: center;
	background: var(--bg-subtle);
	border: 1px dashed var(--border);
	border-radius: 12px;
}

.account-empty-state > .icon {
	--icon-size: 36px;
	color: var(--primary);
}

.account-empty-state h3 {
	margin: 0.5rem 0 0.25rem;
}

.account-empty-state p {
	max-width: 520px;
	margin: 0 auto 0.75rem;
}

.account-session-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}

.account-session-actions form {
	margin: 0;
}

.account-notice {
	margin: 1.25rem 0;
	padding: 0.85rem 1rem;
	color: #166534;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 10px;
}

.account-section-heading {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 1.75rem;
}

.account-section-heading h3,
.account-claim-card h3 {
	margin: 0;
	font-size: 1.2rem;
}

.account-section-heading p {
	margin: 0.2rem 0 0;
	font-size: 0.9rem;
}

.account-route-list,
.account-claim-list,
.account-trash-list {
	margin: 1rem 0 1.75rem;
	padding: 0;
	list-style: none;
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
}

.account-route-list li + li,
.account-claim-list li + li,
.account-trash-list li + li {
	border-top: 1px solid var(--border);
}

.account-route-list a {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.9rem 1rem;
	color: var(--text);
}

.account-route-list a:hover {
	background: var(--bg-subtle);
}

.account-route-icon {
	color: var(--primary);
}

.account-route-copy {
	display: grid;
	flex: 1;
	min-width: 0;
}

.account-route-copy strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.account-route-copy small,
.account-claim-list small,
.account-visibility-form small {
	display: block;
	color: var(--text-muted);
}

.account-claim-card {
	margin: 2rem 0;
	padding: 1.35rem;
	background: var(--primary-light);
	border: 1px solid #bfdbfe;
	border-radius: 12px;
}

.account-claim-card > p {
	margin: 0.45rem 0 0;
}

.account-claim-list {
	background: #fff;
}

.account-claim-list li {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.85rem 1rem;
}

.account-claim-list label {
	display: flex;
	align-items: flex-start;
	flex: 1;
	gap: 0.75rem;
	margin: 0;
	cursor: pointer;
}

.account-claim-list input {
	margin-top: 0.25rem;
}

.account-back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	margin-bottom: 1.5rem;
	font-weight: 600;
}

.account-back-link .icon {
	--icon-size: 18px;
}

.account-route-detail-heading {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.account-visibility-badge {
	padding: 0.35rem 0.65rem;
	font-size: 0.78rem;
	font-weight: 700;
	color: #1d4ed8;
	background: var(--primary-light);
	border-radius: 999px;
	white-space: nowrap;
}

.account-visibility-badge.is-private {
	color: #475569;
	background: #f1f5f9;
}

.account-route-meta {
	font-size: 0.86rem;
}

.account-route-distance {
	font-weight: 700;
	color: var(--text);
}

.account-route-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.5rem 0;
}

.account-visibility-form {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
}

.account-visibility-form fieldset,
.save-route-visibility {
	display: grid;
	gap: 0.65rem;
	margin: 0 0 1rem;
	padding: 0;
	border: 0;
}

.account-visibility-form legend,
.save-route-visibility legend {
	margin-bottom: 0.5rem;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--text);
}

.account-visibility-form label,
.save-route-visibility label {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	margin: 0;
	padding: 0.75rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: 9px;
	cursor: pointer;
}

.account-visibility-form input,
.save-route-visibility input {
	margin-top: 0.25rem;
}

.account-visibility-form strong,
.save-route-visibility strong {
	display: block;
	color: var(--text);
}

.account-trash-row {
	display: flex;
	justify-content: flex-end;
	margin: -0.75rem 0 1.75rem;
}

.account-trash-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 40px;
	padding: 0.45rem 0.65rem;
	font-weight: 600;
	color: var(--text-muted);
	border-radius: 8px;
}

.account-trash-link:hover {
	color: var(--primary);
	background: var(--bg-subtle);
}

.account-trash-link .icon {
	--icon-size: 19px;
}

.account-trash-link .account-trash-chevron {
	--icon-size: 17px;
}

.account-trash-list li {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
}

.account-trash-list .account-route-copy {
	flex: 1;
}

.account-trash-list form {
	margin: 0;
}

.account-expired-label {
	max-width: 170px;
	font-size: 0.8rem;
	line-height: 1.3;
	text-align: right;
	color: var(--text-muted);
}

.account-route-danger {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid #fecaca;
}

.account-route-danger h3 {
	margin: 0 0 0.3rem;
	font-size: 1rem;
	color: #991b1b;
}

.account-route-danger p {
	margin-bottom: 0.8rem;
	font-size: 0.9rem;
}

.account-danger-link-row {
	margin-top: 1rem;
	text-align: right;
}

.account-danger-link-row a {
	font-size: 0.85rem;
	color: #b91c1c;
}

.account-delete-icon {
	display: block;
	margin-bottom: 0.75rem;
	--icon-size: 38px;
	color: #b91c1c;
}

.account-confirm-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

@keyframes account-spinner {
	to { transform: rotate(360deg); }
}

/* Utility */

.noma { margin: 0; }
.nopa { padding: 0; }
.xsmall-tm { margin-top: 5px; }
.small-tm { margin-top: 10px; }

/* Site header */

.site-header {
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	padding: 0.75rem 1.5rem;
	margin-bottom: 1rem;
	box-shadow: var(--shadow-sm);
	position: sticky;
	top: 0;
	z-index: 1000;
}

.site-header h1 {
	font-family: 'Poiret One', sans-serif;
	font-size: 1.6rem;
	margin: 0;
}

.site-header h1 a {
	color: var(--text);
	text-decoration: none;
}

.site-header h1 a:hover {
	color: var(--primary);
}

.logo-image {
	animation: rotation-logo 30s infinite;
	height: 36px;
	width: 36px;
	margin-right: 10px;
	vertical-align: middle;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.site-nav a {
	color: var(--text-muted);
	font-size: 0.9rem;
	font-weight: 500;
	padding: 0.4rem 0.75rem;
	border-radius: 8px;
	transition: all 0.15s ease;
}

.site-nav a:hover {
	color: var(--primary);
	background-color: var(--primary-light);
}

/* Navbar search area */

.navbar-distansen {
	margin: 15px 0 25px 0;
	padding: 0;
}

/* Search controls */

.search-bar {
	background-color: var(--bg);
	border: 1px solid var(--border);
	border-right: none;
	width: 85%;
	height: 44px;
	padding: 5px 5px 5px 16px;
	margin: 0;
	font-size: 14px;
	border-radius: var(--radius) 0 0 var(--radius);
	float: left;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-bar:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-button {
	background-color: var(--bg);
	border: 1px solid var(--border);
	border-left: none;
	height: 44px;
	padding: 5px 10px 5px 5px;
	margin: 0;
	font-size: 14px;
	border-radius: 0 var(--radius) var(--radius) 0;
	cursor: pointer;
	float: left;
	color: var(--text-muted);
	transition: color 0.15s ease;
}

.search-button:hover {
	color: var(--primary);
}

.search-button:focus {
	outline: none;
}

.head-button {
	background-color: var(--primary);
	color: white;
	height: 44px;
	line-height: 44px;
	margin: 0;
	padding-left: 16px;
	padding-right: 16px;
	font-size: 14px;
	font-weight: 500;
	border-radius: var(--radius);
	text-align: center;
	cursor: pointer;
	float: left;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.head-button:hover {
	background-color: var(--primary-hover);
	transform: translateY(-1px);
}

.copy-button {
	background-color: var(--primary);
	color: white;
	height: 40px;
	font-size: 14px;
	font-weight: 500;
	line-height: 40px;
	padding-left: 16px;
	padding-right: 16px;
	border-radius: 8px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.copy-button:hover {
	background-color: var(--primary-hover);
}

.save-button {
	background-color: var(--primary);
	font: 500 16px 'Source Sans Pro', sans-serif;
	color: #fff;
	height: 44px;
	margin: 0;
	line-height: 44px;
	padding-left: 20px;
	padding-right: 20px;
	border-radius: 8px;
	margin-bottom: 12px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.save-button:hover {
	background-color: var(--primary-hover);
}

.visible {
	display: block;
}

/* Map canvas and controls */

.map_canvas {
	height: 500px;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
}

/* The distance is a readout, not a control, so it sits centred above the map. */
#LabelControl {
	position: absolute;
	z-index: 2;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	overflow: hidden;
	box-shadow: var(--shadow-md);
	background-color: white;
	border: none;
	border-radius: 999px;
	cursor: default;
	text-align: center;
	pointer-events: none;
	/* Width is set in px from the mirror below, because auto cannot be transitioned. */
	transition: width 260ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.distansen-distance-value {
	font: 600 16px 'Source Sans Pro', sans-serif;
	color: var(--text);
	padding: 9px 18px;
	white-space: nowrap;
}

/*
 * An unclamped copy of the value, laid out but never painted. The visible one is
 * inside a pill whose width is being animated, so it cannot measure its own target.
 */
.distansen-distance-mirror {
	position: absolute;
	top: 0;
	left: 0;
	visibility: hidden;
	pointer-events: none;
}

@keyframes distansen-distance-bump {
	0% { transform: translateX(-50%) scale(1); }
	40% { transform: translateX(-50%) scale(1.07); }
	100% { transform: translateX(-50%) scale(1); }
}

/* A whole new kilometre is worth more than a nudge. */
@keyframes distansen-distance-milestone {
	0% { transform: translateX(-50%) scale(1) rotate(0); }
	28% { transform: translateX(-50%) scale(1.16) rotate(-1.4deg); }
	58% { transform: translateX(-50%) scale(0.97) rotate(0.7deg); }
	100% { transform: translateX(-50%) scale(1) rotate(0); }
}

@keyframes distansen-distance-flash {
	0%, 100% { color: var(--text); }
	35% { color: var(--primary); }
}

#LabelControl.label-animation {
	animation: distansen-distance-bump 300ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

#LabelControl.label-milestone {
	animation: distansen-distance-milestone 520ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

#LabelControl.label-milestone #LabelControlText {
	animation: distansen-distance-flash 520ms ease;
}

@media (prefers-reduced-motion: reduce) {
	#LabelControl {
		transition: none;
	}

	#LabelControl.label-animation,
	#LabelControl.label-milestone,
	#LabelControl.label-milestone #LabelControlText {
		animation: none;
	}
}

#LocationControl, #FitRouteControl, #ResetControl, #UndoControl, #LoopControl, #FlagControl {
	color: #333;
}

.map-button-icon {
	--icon-size: 22px;
}

#LoopControl.active, #FlagControl.active {
	color: var(--primary);
	background-color: var(--primary-light);
}

.distansen-map-actions {
	display: block;
}

.mapboxgl-ctrl-group.distansen-map-actions button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--map-control-size, 40px);
	height: var(--map-control-size, 40px);
}

.mapboxgl-ctrl-group.distansen-map-actions button + button {
	border-top: 1px solid var(--border);
}

.mapboxgl-ctrl-group.distansen-map-actions button:disabled {
	color: #b6bfcc;
	cursor: default;
}

/* Nollställ is destructive: separated from the toggles above it and confirmed before it fires. */
#ResetControl:not(:disabled):hover {
	color: #dc2626;
	background-color: #fef2f2;
}

.mapboxgl-ctrl-group.distansen-basemap-control {
	display: flex;
}

.mapboxgl-ctrl-group.distansen-basemap-control button {
	width: auto;
	min-width: 52px;
	height: 29px;
	padding: 0 9px;
	font: 600 13px 'Source Sans Pro', sans-serif;
	color: #333;
}

.mapboxgl-ctrl-group.distansen-basemap-control button.active {
	color: var(--primary);
	background-color: #eff6ff;
}

/* The map's primary action sits in one slot, whichever of the three it currently is. */
.distansen-map-save,
.distansen-map-edit {
	position: absolute;
	z-index: 2;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	border: 0;
}

.distansen-map-edit,
.distansen-map-edit:hover {
	color: #fff;
	text-decoration: none;
}

.distansen-map-save.is-disabled {
	color: #64748b;
	background: #e2e8f0;
	box-shadow: none;
}

.distansen-save-hint {
	position: absolute;
	z-index: 3;
	left: 50%;
	bottom: 84px;
	transform: translateX(-50%);
	width: max-content;
	max-width: calc(100% - 32px);
	padding: 9px 12px;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	text-align: center;
	background: rgba(15, 23, 42, 0.94);
	border-radius: 9px;
	box-shadow: var(--shadow-md);
	pointer-events: none;
}

.route-marker {
	z-index: 2;
	cursor: grab;
	user-select: none;
}

.route-marker:active {
	cursor: grabbing;
}

.route-marker svg {
	display: block;
}

.kilometer-marker {
	position: absolute;
	z-index: 1;
	display: inline-block;
	width: max-content;
	min-width: 0;
	padding: 3px 8px;
	box-sizing: border-box;
	border: 1px solid #333;
	border-radius: 4px;
	background: white;
	box-shadow: var(--shadow-sm);
	font: 700 11px 'Source Sans Pro', sans-serif;
	color: #333;
	text-align: center;
	white-space: nowrap;
	pointer-events: none;
	user-select: none;
}

.kilometer-marker::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 100%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #333;
}

.mapboxgl-popup-content {
	font-family: 'Source Sans Pro', sans-serif;
}

/* Content sections */

.content-section {
	background: var(--bg);
	border-radius: var(--radius);
	padding: 2.5rem;
	margin-bottom: 1.5rem;
	box-shadow: var(--shadow-sm);
	border: 1px solid var(--border);
}

.content-section h4 {
	margin-top: 1.5rem;
}

.content-section h4:first-child {
	margin-top: 0;
}

/* Page content */

.page-content {
	max-width: 720px;
	margin: 2rem auto;
	padding: 0 1rem;
}

.page-content h2 {
	font-size: 2rem;
	margin-bottom: 0.5rem;
}

.page-content .lead {
	font-size: 1.15rem;
	color: var(--text-muted);
	line-height: 1.7;
	margin-bottom: 2rem;
}

.page-content h4 {
	margin-top: 2rem;
	margin-bottom: 0.5rem;
}

.page-content p {
	margin-bottom: 1rem;
}

/* Feature cards */

.feature-cards {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.feature-card {
	display: block;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
	text-decoration: none;
	color: var(--text);
	transition: box-shadow 0.15s, border-color 0.15s;
}

.feature-card:hover {
	border-color: var(--primary);
	box-shadow: var(--shadow-sm);
	text-decoration: none;
	color: var(--text);
}

.feature-card .icon {
	--icon-size: 28px;
	color: var(--primary);
	margin-bottom: 0.5rem;
}

.feature-card h4 {
	font-size: 1rem;
	margin: 0 0 0.4rem 0;
}

.feature-card p {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin: 0;
	line-height: 1.4;
}

@media (max-width: 768px) {
	.feature-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.feature-cards {
		grid-template-columns: 1fr;
	}
}

/* Calculator tools */

.calculator-card {
	background: var(--primary-light);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
	margin-bottom: 2rem;
}

.calculator-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.calculator-field {
	display: flex;
	flex-direction: column;
}

.calculator-field.full-width {
	grid-column: 1 / -1;
}

.calculator-field label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 0.25rem;
}

.calculator-field input,
.calculator-field select {
	height: 44px;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 14px;
	font-family: 'Source Sans Pro', sans-serif;
	background: var(--bg);
	color: var(--text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calculator-field input:focus,
.calculator-field select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calculator-btn {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.7rem 2rem;
	background: var(--primary);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	font-family: 'Source Sans Pro', sans-serif;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.calculator-btn:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
}

.calculator-result {
	margin-top: 1.5rem;
	padding: 1.5rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.result-value {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--primary);
	margin-bottom: 0.25rem;
}

.result-detail {
	font-size: 0.9rem;
	color: var(--text-muted);
	margin-bottom: 0;
}

.result-error {
	color: #dc2626;
	margin-bottom: 0;
}

.met-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 0.75rem;
	font-size: 0.9rem;
}

.met-table th {
	text-align: left;
	font-weight: 600;
	color: var(--text);
	padding: 0.5rem 0.75rem;
	border-bottom: 2px solid var(--border);
}

.met-table td {
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid var(--border);
	color: var(--text-muted);
}

.met-table tr:last-child td {
	border-bottom: none;
}

/* Nav dropdown */

.nav-dropdown {
	position: relative;
	display: inline-block;
}

.nav-dropdown-toggle {
	color: var(--text-muted);
	font-size: 0.9rem;
	font-weight: 500;
	padding: 0.4rem 0.75rem;
	border-radius: 8px;
	transition: all 0.15s ease;
	cursor: pointer;
}

.nav-dropdown-toggle:hover {
	color: var(--primary);
	background-color: var(--primary-light);
}

.nav-dropdown-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	padding: 0.5rem 0;
	min-width: 220px;
	z-index: 1001;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
	display: block;
}

.nav-dropdown-menu a {
	display: block;
	padding: 0.5rem 1rem;
	font-size: 0.85rem;
	color: var(--text-muted);
	border-radius: 0;
}

.nav-dropdown-menu a:hover {
	background-color: var(--primary-light);
	color: var(--primary);
}

.page-content ul {
	color: var(--text-muted);
	line-height: 1.7;
	padding-left: 1.5rem;
}

.page-content li {
	margin-bottom: 0.5rem;
}

/* FAQ */

.faq-item {
	border-bottom: 1px solid var(--border);
	padding: 1.25rem 0;
}

.faq-item:last-child {
	border-bottom: none;
}

.faq-item h4 {
	margin-top: 0;
	font-size: 1.05rem;
}

.faq-item p {
	margin-bottom: 0;
}

/* Trails page */

.trails-toolbar {
	display: flex;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.trails-toolbar .search-bar {
	flex: 1;
}

.trail-select {
	height: 40px;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 14px;
	font-family: 'Source Sans Pro', sans-serif;
	background: var(--bg);
	color: var(--text);
}

.trails-layout {
	display: flex;
	gap: 1rem;
	margin-bottom: 2rem;
}

.trails-list {
	width: 340px;
	min-width: 280px;
	max-height: 600px;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}

.trails-map-wrap {
	flex: 1;
	min-width: 0;
}

.trails-map {
	width: 100%;
	height: 600px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
}

.trail-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.6rem 1rem;
	border-bottom: 1px solid var(--border);
	cursor: pointer;
	transition: background-color 0.1s ease;
}

.trail-item:last-child {
	border-bottom: none;
}

.trail-item:hover {
	background-color: var(--primary-light);
}

.trail-item.active {
	background-color: var(--primary);
	color: white;
}

.trail-item.active .trail-km {
	color: rgba(255, 255, 255, 0.8);
}

.trail-name {
	font-size: 0.9rem;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-right: 0.5rem;
	color: inherit;
	text-decoration: none;
}

a.trail-name:hover {
	text-decoration: underline;
}

.trail-km {
	font-size: 0.8rem;
	color: var(--text-muted);
	white-space: nowrap;
	flex-shrink: 0;
}

.trails-loading,
.trails-empty {
	padding: 2rem;
	text-align: center;
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* Trail detail page */

.trail-breadcrumb {
	margin: 1rem 0 0.5rem;
	font-size: 0.9rem;
}

.trail-breadcrumb a {
	color: var(--primary);
}

.trail-title {
	font-size: 1.75rem;
	margin-bottom: 0.5rem;
}

.trail-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.trail-badge {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	background: var(--primary-light);
	border: 1px solid var(--border);
	border-radius: 20px;
	font-size: 0.85rem;
	color: var(--text);
}

.trail-badge:first-child {
	background: var(--primary);
	color: white;
	border-color: var(--primary);
	font-weight: 600;
}

a.trail-badge-link {
	text-decoration: none;
	cursor: pointer;
}
a.trail-badge-link:hover {
	background: var(--border);
}

.race-sport {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 0.2rem 0.6rem;
	border-radius: 20px;
	font-size: 0.8rem;
	font-weight: 600;
}
.race-sport .icon {
	--icon-size: 16px;
}
.sport-running { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.sport-cycling { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.sport-skiing { background: #eff6ff; color: #2563eb; border: 1px solid #93c5fd; }

.race-icon {
	display: inline-flex;
	align-items: center;
	margin-right: 4px;
}
.race-icon .icon {
	--icon-size: 18px;
}

.trail-detail-map {
	width: 100%;
	height: 500px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
}

.map-search-error {
	margin: 0.75rem 0 0;
	color: #b91c1c;
	font-size: 0.9rem;
}

/* Footer */

.site-footer {
	border-top: 1px solid var(--border);
	padding: 2rem 0;
	margin-top: 3rem;
	background: var(--bg);
}

.site-footer p {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin: 0;
}

.site-footer a {
	color: var(--text-muted);
}

.site-footer a:hover {
	color: var(--primary);
}

/* Animations */

@keyframes rotation-logo {
	0%   { transform: rotate(0deg); }
	25%  { transform: rotate(-50deg); }
	50%  { transform: rotate(10deg); }
	75%  { transform: rotate(-32deg); }
	100% { transform: rotate(0deg); }
}

/* Save route dialog */

.save-route-dialog {
	max-width: 520px;
}

.save-route-modal {
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 18px;
	box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.save-route-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 17px 20px 14px;
	border-bottom: 1px solid var(--border);
}

.save-route-header h2 {
	margin: 0;
	font-size: 1.35rem;
	line-height: 1.2;
}

.save-route-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	padding: 0;
	color: var(--text-muted);
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: 10px;
	cursor: pointer;
}

.save-route-close:hover {
	color: var(--text);
	background: #f1f5f9;
}

.save-route-close .icon {
	--icon-size: 20px;
}

.save-route-body {
	padding: 17px 20px 19px;
}

.save-route-account-summary {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	margin: 4px 0 16px;
	background: var(--primary-light);
	border: 1px solid #bfdbfe;
	border-radius: 11px;
}

.save-route-account-summary > .icon {
	--icon-size: 22px;
	color: var(--primary);
}

.save-route-account-summary strong,
.save-route-account-summary span {
	display: block;
}

.save-route-account-summary strong {
	font-size: 0.9rem;
	color: var(--text);
}

.save-route-account-summary span {
	margin-top: 1px;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--text-muted);
}

.save-route-field {
	margin-bottom: 12px;
}

.save-route-field label,
.save-route-success label {
	display: block;
	margin: 0 0 6px;
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--text);
}

.save-route-field label span {
	font-weight: 400;
	color: var(--text-muted);
}

.save-route-field input,
.save-route-field textarea,
.save-route-success input {
	display: block;
	width: 100%;
	padding: 10px 12px;
	font: 400 0.95rem 'Source Sans Pro', sans-serif;
	line-height: 1.4;
	color: var(--text);
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.save-route-field input {
	height: 44px;
}

.save-route-field textarea {
	min-height: 64px;
	resize: vertical;
}

.save-route-field input:focus,
.save-route-field textarea:focus,
.save-route-success input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.save-route-field input.error {
	border-color: #ef4444;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.save-route-field-help {
	margin: 1px 0 0;
	font-size: 0.78rem;
	line-height: 1.35;
}

.save-route-url-preview {
	display: flex;
	align-items: baseline;
	gap: 7px;
	min-width: 0;
	margin-top: 5px;
	font-size: 0.78rem;
	line-height: 1.35;
	color: var(--text-muted);
}

.save-route-url-preview[hidden] {
	display: none;
}

.save-route-url-preview span {
	flex: 0 0 auto;
}

.save-route-url-preview strong {
	min-width: 0;
	overflow-wrap: anywhere;
	font-weight: 600;
	color: var(--primary);
}

.save-route-visibility {
	gap: 0.45rem;
	margin-top: 0.7rem;
	margin-bottom: 0.75rem;
}

.save-route-visibility legend {
	margin-bottom: 0.25rem;
}

.save-route-visibility label {
	padding: 0.55rem 0.65rem;
}

.save-route-visibility label:has(input:checked) {
	background: var(--primary-light);
	border-color: #93c5fd;
	box-shadow: 0 0 0 1px #bfdbfe;
}

.save-route-visibility strong {
	display: flex;
	align-items: center;
	gap: 4px;
}

.save-route-visibility strong .icon {
	--icon-size: 15px;
	color: var(--text-muted);
}

.save-route-visibility small {
	display: block;
	color: var(--text-muted);
}

.save-route-email-option {
	margin: 2px 0 12px;
}

.save-route-toggle {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	margin: 0;
	cursor: pointer;
}

.save-route-toggle > span {
	display: flex;
	align-items: baseline;
	gap: 5px;
}

.save-route-toggle strong {
	font-size: 0.88rem;
	color: var(--text);
}

.save-route-toggle small {
	font-size: 0.78rem;
	font-weight: 400;
	color: var(--text-muted);
}

.save-route-toggle input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.save-route-toggle i {
	position: relative;
	flex: 0 0 auto;
	width: 42px;
	height: 24px;
	background: #cbd5e1;
	border-radius: 999px;
	transition: background 0.15s ease;
}

.save-route-toggle i::after {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	content: '';
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
	transition: transform 0.15s ease;
}

.save-route-toggle input:checked + i {
	background: var(--primary);
}

.save-route-toggle input:checked + i::after {
	transform: translateX(18px);
}

.save-route-toggle input:focus-visible + i {
	outline: none;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.save-route-email-field {
	margin: 8px 0 0;
	padding: 0;
	background: transparent;
	border: 0;
}

.save-route-email-disabled-help {
	margin: 9px 0 0;
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--text-muted);
}

.save-route-error {
	padding: 9px 11px;
	margin-top: 4px;
	font-size: 0.84rem;
	line-height: 1.35;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 9px;
}

.save-route-actions,
.save-route-success-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 14px;
}

.save-route-primary,
.save-route-secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 44px;
	padding: 9px 16px;
	font: 700 0.9rem 'Source Sans Pro', sans-serif;
	border-radius: 10px;
	cursor: pointer;
}

.save-route-primary {
	color: #fff;
	background: var(--primary);
	border: 1px solid var(--primary);
	box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}

.save-route-primary:hover {
	color: #fff;
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

.save-route-primary:disabled {
	cursor: wait;
	opacity: 0.65;
}

.save-route-secondary {
	color: var(--text);
	background: #fff;
	border: 1px solid #cbd5e1;
}

.save-route-secondary:hover {
	color: var(--primary);
	background: var(--primary-light);
	border-color: #bfdbfe;
}

.save-route-primary .icon,
.save-route-secondary .icon {
	--icon-size: 18px;
}

.save-route-success {
	text-align: center;
}

.save-route-success-icon {
	--icon-size: 48px;
	color: #16a34a;
}

.save-route-success h3 {
	margin: 8px 0 4px;
	font-size: 1.35rem;
}

.save-route-success > p {
	margin: 0 auto 18px;
	max-width: 390px;
	font-size: 0.92rem;
	line-height: 1.5;
}

.save-route-success label {
	text-align: left;
}

.save-route-success input {
	height: 44px;
	font-size: 0.84rem;
	background: var(--bg-subtle);
}

.save-route-success-actions {
	justify-content: center;
	margin-top: 14px;
}

.save-route-success-utilities {
	margin-top: 10px;
}

.save-route-share-status {
	min-height: 21px;
	margin: 8px 0 2px !important;
	font-size: 0.82rem !important;
	color: #15803d !important;
}

.save-route-view-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 6px;
	font-size: 0.88rem;
	font-weight: 700;
}

.save-route-view-link .icon {
	--icon-size: 17px;
}

/* Responsive */

@media (max-width: 768px) {
	.account-shell {
		padding: 1rem 0.75rem 3rem;
	}

	.account-card {
		padding: 1.4rem;
	}

	.account-session-actions {
		align-items: stretch;
		flex-direction: column;
	}

	.account-session-actions button {
		width: 100%;
	}

	.site-header {
		padding: 0.5rem 1rem;
	}

	.site-nav a {
		font-size: 0.8rem;
		padding: 0.3rem 0.5rem;
	}

	.map_canvas {
		height: 350px;
		border-radius: 8px;
	}

	.content-section {
		padding: 1.5rem;
	}

	.page-content {
		margin: 1rem auto;
	}

	.page-content h2 {
		font-size: 1.5rem;
	}

	.calculator-grid {
		grid-template-columns: 1fr;
	}

	.nav-dropdown-menu {
		position: fixed;
		left: 0;
		right: 0;
		top: auto;
		border-radius: 0 0 var(--radius) var(--radius);
	}

	.trails-layout {
		flex-direction: column;
	}

	.trails-list {
		width: 100%;
		max-height: 250px;
	}

	.trails-map {
		height: 400px;
	}

	.trails-toolbar {
		flex-direction: column;
	}

	#saveModal {
		padding-right: 0 !important;
	}

	.save-route-dialog {
		display: flex;
		align-items: flex-end;
		width: 100%;
		max-width: none;
		min-height: 100%;
		margin: 0;
	}

	.save-route-modal {
		width: 100%;
		max-height: calc(100dvh - 18px);
		overflow-y: auto;
		border-right: 0;
		border-bottom: 0;
		border-left: 0;
		border-radius: 18px 18px 0 0;
	}

	.save-route-header {
		padding: 18px 18px 15px;
	}

	.save-route-body {
		padding: 18px;
		padding-bottom: calc(18px + env(safe-area-inset-bottom));
	}

	.save-route-actions,
	.save-route-success-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}

	.save-route-primary,
	.save-route-secondary {
		width: 100%;
	}
}

/* Responsive navigation */

.site-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.site-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	color: var(--text);
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 10px;
	cursor: pointer;
}

/* Full-screen route editor */

body.map-workspace-page {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
}

.map-workspace {
	--panel-width: 420px;
	--map-control-size: 40px;
	position: fixed;
	inset: 0;
	overflow: hidden;
	background: #dbe3ea;
}

.map-workspace-map.map_canvas {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: var(--panel-width);
	width: calc(100% - var(--panel-width));
	height: 100%;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: left 240ms ease, width 240ms ease;
}

.map-workspace-panel {
	position: absolute;
	z-index: 30;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	width: var(--panel-width);
	background: rgba(255, 255, 255, 0.98);
	border-right: 1px solid var(--border);
	box-shadow: 8px 0 28px rgba(15, 23, 42, 0.12);
	transform: translateX(0);
	transition: transform 240ms ease;
}

.map-workspace.panel-closed .map-workspace-panel {
	transform: translateX(-100%);
}

.map-workspace.panel-closed .map-workspace-map {
	left: 0;
	width: 100%;
}

.map-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 68px;
	padding: 12px 16px 12px 20px;
	border-bottom: 1px solid var(--border);
}

.map-panel-brand {
	display: inline-flex;
	align-items: center;
	font: 400 1.65rem 'Poiret One', sans-serif;
	color: var(--text);
}

.map-panel-brand:hover {
	color: var(--primary);
}

.map-panel-brand .logo-image {
	width: 34px;
	height: 34px;
	margin-right: 9px;
}

.map-panel-close,
.map-panel-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	color: #333;
	background: #fff;
	border: 0;
	border-radius: 8px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.16);
	cursor: pointer;
}

.map-panel-close:hover,
.map-panel-toggle:hover {
	color: var(--primary);
	background: var(--primary-light);
}

/*
 * One button in two shapes. placeSearchControl() decides which container it sits in,
 * and the container decides how it looks: a plain group button in the tool stack, a
 * labelled bar beside the menu. The label only shows in the bar form.
 */
.map-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	color: #333;
	background: #fff;
	border: 0;
	cursor: pointer;
}

.map-search-toggle:hover {
	color: var(--primary);
	background: var(--primary-light);
}

.map-search-toggle-label {
	display: none;
}

.map-panel-content {
	flex: 1;
	min-height: 0;
	padding: 24px 24px 18px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.map-panel-content > h1 {
	margin: 0 0 6px;
	font-size: 1.5rem;
	line-height: 1.2;
}

.map-panel-intro {
	margin: 0 0 20px;
	font-size: 0.98rem;
	line-height: 1.5;
}

/* Instant replacement for the native title tooltip; see static/js/tooltip.js */

.distansen-tooltip {
	position: fixed;
	z-index: 60;
	max-width: 240px;
	padding: 7px 10px;
	font: 600 0.8rem 'Source Sans Pro', sans-serif;
	line-height: 1.3;
	color: #fff;
	text-align: center;
	background: rgba(15, 23, 42, 0.94);
	border-radius: 8px;
	box-shadow: var(--shadow-md);
	pointer-events: none;
}

.distansen-tooltip[hidden] {
	display: none;
}

/* Owner-editable name and description in the saved-route panel */

.map-panel-route-details {
	margin: 0 0 18px;
}

.map-panel-route-label {
	display: block;
	margin: 0 0 5px;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--text);
}

.map-panel-route-label span {
	font-weight: 400;
	color: var(--text-muted);
}

.map-panel-route-title,
.map-panel-route-description {
	display: block;
	width: 100%;
	padding: 9px 11px;
	color: var(--text);
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 9px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.map-panel-route-title {
	margin-bottom: 12px;
	font: 700 1.25rem 'Source Sans Pro', sans-serif;
	letter-spacing: -0.02em;
}

.map-panel-route-description {
	font: 400 0.92rem 'Source Sans Pro', sans-serif;
	line-height: 1.45;
	resize: vertical;
}

.map-panel-route-title:focus,
.map-panel-route-description:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.map-panel-route-title::placeholder,
.map-panel-route-description::placeholder {
	font-weight: 400;
	color: #94a3b8;
}

.map-panel-route-update {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 44px;
	margin-top: 12px;
	padding: 0 14px;
	font: 700 0.95rem 'Source Sans Pro', sans-serif;
	color: #fff;
	background: var(--primary);
	border: 1px solid var(--primary);
	border-radius: 9px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.map-panel-route-update:hover {
	color: #fff;
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

.map-panel-route-update.is-disabled {
	color: #64748b;
	background: #e2e8f0;
	border-color: #e2e8f0;
}

.map-panel-route-update .icon {
	--icon-size: 19px;
}

.map-panel-route-details-help {
	margin: 8px 2px 0;
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--text-muted);
}

.map-panel-route-details-help strong {
	font-weight: 600;
	color: var(--text);
	word-break: break-all;
}

/* Destructive confirmation dialog */

.confirm-dialog {
	max-width: 400px;
	margin-top: 12vh;
}

.confirm-modal {
	padding: 26px 24px 22px;
	text-align: center;
	border: 0;
	border-radius: 16px;
	box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22);
}

/*
 * Bootstrap makes .modal-content a flex column, so the surrounding text-align does
 * not position this: it is a flex item and needs auto side margins to centre.
 */
.confirm-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: 0 auto 14px;
	color: #dc2626;
	background: #fef2f2;
	border-radius: 50%;
}

.confirm-icon .icon {
	--icon-size: 25px;
}

.confirm-modal h2 {
	margin: 0 0 6px;
	font-size: 1.25rem;
}

.confirm-modal p {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.45;
}

.confirm-note {
	margin-top: 4px !important;
	font-size: 0.84rem !important;
	color: var(--text-muted);
}

.confirm-actions {
	display: flex;
	gap: 10px;
	margin-top: 20px;
}

.confirm-actions > * {
	flex: 1;
	justify-content: center;
}

.confirm-danger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	font: 700 0.95rem 'Source Sans Pro', sans-serif;
	color: #fff;
	background: #dc2626;
	border: 1px solid #dc2626;
	border-radius: 9px;
	cursor: pointer;
}

.confirm-danger:hover {
	color: #fff;
	background: #b91c1c;
	border-color: #b91c1c;
}

/* Place search dialog */

.search-place-dialog {
	max-width: 460px;
	margin-top: 8vh;
}

.search-place-modal {
	padding: 20px;
	border: 0;
	border-radius: 16px;
	box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22);
}

.search-place-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.search-place-header h2 {
	margin: 0;
	font-size: 1.2rem;
}

.search-place-form {
	margin: 0;
}

.search-place-control {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	height: 50px;
	padding: 4px 6px 4px 12px;
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	box-shadow: var(--shadow-sm);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-place-control:focus-within {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.search-place-control-icon {
	--icon-size: 19px;
	color: var(--text-muted);
}

.search-place-control input {
	min-width: 0;
	flex: 1;
	height: 40px;
	padding: 0;
	font: 400 1rem 'Source Sans Pro', sans-serif;
	color: var(--text);
	background: transparent;
	border: 0;
}

.search-place-control input:focus {
	outline: none;
}

.search-place-control input::placeholder {
	color: #94a3b8;
}

.search-place-control input::-webkit-search-cancel-button {
	display: none;
}

.search-place-clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--text-muted);
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

.search-place-clear[hidden] {
	display: none;
}

.search-place-clear:hover {
	color: var(--text);
	background: var(--bg-subtle);
}

.search-place-clear .icon {
	--icon-size: 18px;
}

.search-place-help {
	margin: 8px 2px 0;
	font-size: 0.8rem;
	line-height: 1.35;
	color: var(--text-muted);
}

.search-place-form .map-search-error {
	margin: 10px 0 0;
	padding: 9px 11px;
	font-size: 0.85rem;
	line-height: 1.35;
	color: #b91c1c;
	background: #fef2f2;
	border-radius: 9px;
}

.search-place-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 18px;
}

/* Min plats stays a one-tap map control; this is only a convenience while typing. */
.search-place-secondary {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 44px;
	padding: 0 12px;
	font: 600 0.92rem 'Source Sans Pro', sans-serif;
	color: var(--primary);
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 9px;
	cursor: pointer;
}

.search-place-secondary:hover {
	color: var(--primary-hover);
	background: var(--primary-light);
	border-color: var(--primary);
}

.search-place-secondary .icon {
	--icon-size: 19px;
}

.map-panel-location,
.map-panel-primary-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 42px;
	padding: 8px 14px;
	font-weight: 600;
	color: var(--primary);
	background: var(--primary-light);
	border: 1px solid #bfdbfe;
	border-radius: 10px;
	cursor: pointer;
}

.map-panel-location .icon,
.map-panel-primary-link .icon {
	--icon-size: 19px;
}

.map-panel-location:hover,
.map-panel-primary-link:hover {
	color: #fff;
	background: var(--primary);
	border-color: var(--primary);
}

.map-panel-route-actions {
	display: grid;
	gap: 10px;
	/* Whatever follows keeps the same rhythm as the buttons inside the group. */
	margin: 0 0 10px;
}

.map-panel-steps {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 0;
	margin: 24px 0 20px;
	list-style: none;
}

.map-panel-steps li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.map-panel-steps li > span {
	display: inline-flex;
	flex: 0 0 28px;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	font-weight: 700;
	color: var(--primary);
	background: var(--primary-light);
	border-radius: 50%;
}

.map-panel-steps p {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.35;
}

.map-panel-steps strong {
	display: block;
	margin-bottom: 2px;
	color: var(--text);
}

.map-panel-hint,
.map-panel-saved-route {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px;
	margin: 0 0 18px;
	font-size: 0.84rem;
	line-height: 1.45;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: 10px;
}

.map-panel-hint .icon,
.map-panel-saved-route .icon {
	--icon-size: 19px;
	color: var(--primary);
}

.map-panel-saved-route p {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.45;
}

.map-panel-eyebrow {
	display: block;
	margin-bottom: 8px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--primary);
}

.map-panel-more {
	margin-top: 18px;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.map-panel-more summary {
	font-weight: 600;
	color: var(--text);
	cursor: pointer;
}

.map-panel-more p {
	margin: 10px 0 0;
	font-size: 0.88rem;
	line-height: 1.55;
}

.map-panel-seo-copy {
	padding-top: 4px;
	margin-top: 22px;
	border-top: 1px solid var(--border);
}

.map-panel-seo-copy h2,
.map-panel-related h2 {
	margin: 22px 0 7px;
	font-size: 1.08rem;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.map-panel-seo-copy p {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.58;
}

.map-panel-related {
	padding-top: 2px;
	margin-top: 22px;
	border-top: 1px solid var(--border);
}

.map-panel-related a {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px;
	margin-bottom: 9px;
	color: var(--text-muted);
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: 10px;
}

.map-panel-related a:hover {
	color: var(--text-muted);
	background: var(--primary-light);
	border-color: #bfdbfe;
}

.map-panel-related .icon {
	flex: 0 0 auto;
	margin-top: 1px;
	--icon-size: 21px;
	color: var(--primary);
}

.map-panel-related span {
	font-size: 0.84rem;
	line-height: 1.4;
}

.map-panel-related strong {
	display: block;
	margin-bottom: 2px;
	font-size: 0.9rem;
	color: var(--text);
}

.map-panel-meta-links {
	display: flex;
	flex-wrap: wrap;
	gap: 7px 14px;
	padding: 18px 0 8px;
}

.map-panel-meta-links a {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.map-panel-meta-links a:hover {
	color: var(--primary);
}

.map-panel-nav {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	border-top: 1px solid var(--border);
}

.map-panel-nav a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 11px 2px 10px;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--text-muted);
}

.map-panel-nav a:hover {
	color: var(--primary);
	background: var(--primary-light);
}

.map-panel-nav .icon {
	--icon-size: 20px;
}

.map-panel-toggle {
	position: absolute;
	z-index: 20;
	top: 14px;
	left: 14px;
}

.map-workspace .mapboxgl-ctrl-top-left {
	display: flex;
	align-items: flex-start;
}

.map-workspace .mapboxgl-ctrl-top-left .map-panel-toggle {
	position: static;
	flex: 0 0 auto;
	width: var(--map-control-size, 40px);
	height: var(--map-control-size, 40px);
	margin: 10px 0 0 10px;
	pointer-events: auto;
}

.map-workspace.panel-open .map-panel-toggle {
	display: none;
}

/* The bar form: only offered at widths where it clears the centred distance readout. */
.map-workspace .mapboxgl-ctrl-top-left .map-search-toggle {
	position: static;
	flex: 0 0 auto;
	gap: 9px;
	justify-content: flex-start;
	width: auto;
	min-width: 264px;
	height: var(--map-control-size, 40px);
	padding: 0 14px;
	margin: 10px 0 0 10px;
	font: 400 0.95rem 'Source Sans Pro', sans-serif;
	color: var(--text-muted);
	border-radius: 8px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.16);
	pointer-events: auto;
}

.map-workspace .mapboxgl-ctrl-top-left .map-search-toggle .icon {
	color: #333;
}

.map-workspace .mapboxgl-ctrl-top-left .map-search-toggle .map-search-toggle-label {
	display: inline;
}

/* Account control: heads the top-right stack, above the tool groups. */
.map-workspace .mapboxgl-ctrl-top-right .map-account {
	position: relative;
	margin: 10px 10px 0;
	pointer-events: auto;
}

/*
 * Mapbox gives every corner container `position: absolute; z-index: 2`, so each one is its own
 * stacking context and the later siblings paint over this one. The open menu has to lift the
 * whole container, not just itself.
 */
.map-workspace .mapboxgl-ctrl-top-right.map-account-stack-raised {
	z-index: 40;
}

.map-account-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--map-control-size, 40px);
	height: var(--map-control-size, 40px);
	padding: 0;
	font: 700 15px 'Source Sans Pro', sans-serif;
	color: #fff;
	background: var(--primary);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0, 0, 0, 0.26);
	cursor: pointer;
}

.map-account-avatar:hover {
	background: var(--primary-hover);
	color: #fff;
}

.map-account-signin {
	color: #333;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.16);
}

.map-account-signin:hover {
	color: var(--primary);
	background: var(--primary-light);
}

.map-account-signin .icon {
	--icon-size: 22px;
}

.map-account-menu {
	position: absolute;
	z-index: 40;
	top: calc(var(--map-control-size, 40px) + 8px);
	right: 0;
	min-width: 224px;
	padding: 6px;
	background: #fff;
	border-radius: 10px;
	box-shadow: var(--shadow-md), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.map-account-identity {
	margin: 0;
	padding: 8px 10px 10px;
	font-size: 0.82rem;
	line-height: 1.35;
	border-bottom: 1px solid var(--border);
}

.map-account-identity span {
	display: block;
	color: var(--text-muted);
}

.map-account-identity strong {
	display: block;
	overflow: hidden;
	color: var(--text);
	text-overflow: ellipsis;
}

.map-account-menu a,
.map-account-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin-top: 2px;
	padding: 10px;
	font: 600 0.92rem 'Source Sans Pro', sans-serif;
	color: var(--text);
	text-align: left;
	background: none;
	border: 0;
	border-radius: 7px;
	cursor: pointer;
}

.map-account-menu a:hover,
.map-account-menu button:hover {
	color: var(--primary);
	background: var(--primary-light);
}

.map-account-menu .icon {
	--icon-size: 20px;
	color: var(--text-muted);
}

.map-account-menu a:hover .icon,
.map-account-menu button:hover .icon {
	color: var(--primary);
}

.map-panel-backdrop {
	display: none;
}

.map-workspace-page .modal {
	z-index: 1050;
}

@media (min-width: 769px) and (max-width: 1050px) {
	.map-workspace {
		--panel-width: 360px;
	}
}

@media (max-width: 768px) {
	.site-header {
		display: block !important;
		align-items: stretch !important;
	}

	.site-header-row {
		width: 100%;
	}

	.site-nav-toggle {
		display: inline-flex;
	}

	.site-nav {
		display: none;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		padding-top: 10px;
	}

	.site-header.site-nav-open .site-nav {
		display: flex;
	}

	.site-nav a {
		width: 100%;
		font-size: 0.95rem;
		padding: 0.65rem 0.75rem;
	}

	.site-nav .nav-dropdown,
	.site-nav .nav-dropdown-toggle {
		width: 100%;
	}

	.site-nav .nav-dropdown-toggle {
		display: block;
	}

	.site-nav .nav-dropdown-menu {
		position: static;
		width: 100%;
		margin: 2px 0 4px;
		box-shadow: none;
		border-radius: 8px;
	}

	.map-workspace {
		--panel-width: min(88vw, 340px);
		--map-control-size: 44px;
	}

	/* The readout must clear the panel toggle on the left and the avatar on the right. */
	#LabelControl {
		max-width: calc(100% - 2 * (var(--map-control-size) + 24px));
	}

	/* Both copies, or the mirror would measure a width the visible pill never has. */
	.distansen-distance-value {
		font-size: 15px;
		padding: 9px 14px;
	}

	#LabelControlText {
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.map-account-menu {
		max-width: calc(100vw - 20px);
	}

	.map-workspace-map.map_canvas,
	.map-workspace.panel-closed .map-workspace-map,
	.map-workspace.panel-open .map-workspace-map {
		left: 0;
		width: 100%;
		height: 100%;
	}

	.map-workspace-panel {
		transform: translateX(-100%);
	}

	.map-workspace.panel-open .map-workspace-panel {
		transform: translateX(0);
	}

	.map-workspace.panel-open .map-panel-backdrop {
		position: absolute;
		z-index: 25;
		inset: 0;
		display: block;
		padding: 0;
		background: rgba(15, 23, 42, 0.38);
		border: 0;
	}

	.map-panel-content {
		padding: 20px 20px 16px;
	}

	.map-panel-header {
		min-height: 64px;
	}

	.map-panel-content > h1 {
		font-size: 1.35rem;
	}

	.map-workspace .mapboxgl-ctrl-top-left {
		flex-direction: column;
		align-items: flex-start;
	}

	.mapboxgl-ctrl-group.distansen-basemap-control {
		flex-direction: column;
	}

	.search-place-dialog {
		margin-top: 4vh;
	}

	.search-place-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.search-place-actions > * {
		justify-content: center;
	}
}
