.fm-wrapper {
	margin: 1em 0;
	font-size: 15px;
}

.fm-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}

.fm-btn {
	background: #1d6fb8;
	color: #fff;
	border: 0;
	border-radius: 6px;
	padding: 8px 14px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.2;
}

.fm-btn:hover {
	background: #155a96;
}

.fm-share-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	user-select: none;
}

.fm-share-toggle input {
	width: 16px;
	height: 16px;
}

.fm-login-hint {
	color: #555;
	font-size: 13px;
}

.fm-status {
	color: #1d6fb8;
	font-size: 13px;
	min-height: 1em;
}

.fm-map {
	width: 100%;
	min-height: 300px;
	border-radius: 8px;
	overflow: hidden;
	z-index: 0;
}

/* Markør for andre brukere */
.fm-other-icon .fm-dot {
	display: block;
	width: 16px;
	height: 16px;
	background: #e8462c;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.25 );
}

/* Tegnforklaring for spor */
.fm-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 8px;
	font-size: 13px;
	color: #333;
}
.fm-legend:empty { display: none; }
.fm-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.fm-legend-item i {
	width: 18px;
	height: 4px;
	border-radius: 2px;
	display: inline-block;
}

/* GPX-knapp inne i popup */
.fm-gpx-other {
	margin-top: 6px;
	background: #1d6fb8;
	color: #fff;
	border: 0;
	border-radius: 5px;
	padding: 5px 9px;
	cursor: pointer;
	font-size: 12px;
}
.fm-gpx-other:hover { background: #155a96; }

.fm-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Rom-/gjestekontroller */
.fm-room-controls {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}
.fm-room-as {
	font-size: 13px;
	color: #333;
}
.leaflet-tooltip.leaflet-tooltip-top {
	font-size: 12px;
	font-weight: 600;
}

/* Frontend-adminpanel */
.fm-admin-panel { margin-top: 14px; }
.fm-admin-inner {
	border: 1px solid #d6dde3;
	border-radius: 8px;
	padding: 14px 16px;
	background: #f7fafc;
}
.fm-admin-inner h4 { margin: 0 0 8px; font-size: 15px; }
.fm-a-badge { color: #1d6fb8; font-weight: normal; font-size: 13px; }
.fm-a-hint { margin: 0 0 12px; font-size: 13px; color: #555; }
.fm-a-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fm-a-table th, .fm-a-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e3e8ec; vertical-align: middle; }
.fm-a-link { width: 230px; max-width: 40vw; font-size: 12px; padding: 3px 6px; }
.fm-a-addrow, .fm-a-roomrow { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fm-a-pnavn, .fm-a-navn { padding: 6px 8px; border: 1px solid #c4ccd3; border-radius: 5px; font-size: 14px; }
.fm-a-del { background: #b3261e; }
.fm-a-del:hover { background: #8f1d17; }
.fm-admin-inner .fm-btn { padding: 5px 10px; font-size: 13px; }

/* Klikkbar tegnforklaring (sentrer til person) */
.fm-legend-item { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.fm-legend-item:hover { text-decoration: underline; }
/* Sentrer-knapp i popup */
.fm-center {
	margin-top: 6px; background: #3a3f44; color: #fff; border: 0;
	border-radius: 5px; padding: 5px 9px; cursor: pointer; font-size: 12px;
}
.fm-center:hover { background: #25282b; }

/* Fullskjerm-kontroll */
.fm-fs-control a {
	display: flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; color: #333; background: #fff;
}
.fm-fs-control a:hover { background: #f4f4f4; }
.fm-fs-control svg { display: block; }

/* Fullskjerm-visning (ekte API + CSS-fallback for iOS) */
.fm-map.fm-pseudo-fs {
	position: fixed; top: 0; left: 0; right: 0; bottom: 0;
	width: 100% !important; height: 100% !important;
	z-index: 100000; border-radius: 0;
}
.fm-map:-webkit-full-screen { width: 100% !important; height: 100% !important; border-radius: 0; }
.fm-map:fullscreen { width: 100% !important; height: 100% !important; border-radius: 0; }

/* Gesture-handling overlay-tekst – litt penere ramme */
.leaflet-gesture-handling:before { border-radius: 8px; }

/* Ikonknapper (admin + navigasjon) */
.fm-iconbtn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; padding: 0; line-height: 0;
}
.fm-iconbtn svg { display: block; }
.fm-admin-inner .fm-iconbtn { width: 30px; height: 30px; }
.fm-admin-inner .fm-a-add { display: inline-flex; align-items: center; gap: 6px; }
.fm-admin-inner .fm-a-add svg { display: block; }
.fm-a-del.fm-iconbtn { background: #b3261e; }
.fm-a-del.fm-iconbtn:hover { background: #8f1d17; }
.fm-a-copy.fm-copied { background: #1f9e57; }
.fm-a-gpx.fm-empty { opacity: .6; }
/* litt luft mellom handlingsknappene i admin-tabellen */
.fm-a-table td .fm-iconbtn { margin: 0 1px; vertical-align: middle; }

/* Markørnåler + fargevelger i adminpanel */
.fm-pin-icon { background: none; border: 0; }
.fm-pin-icon svg { display: block; filter: drop-shadow( 0 1px 1px rgba(0,0,0,0.35) ); }
.fm-a-color { width: 38px; height: 26px; padding: 0; border: 1px solid #ccc; border-radius: 4px; background: none; cursor: pointer; vertical-align: middle; }
.fm-a-table td .fm-a-color { display: inline-block; }

/* Naviger-kontroll inne i kartet (Sentrer på meg / Vis alle) */
.fm-nav-control a {
	display: flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; color: #333; background: #fff;
}
.fm-nav-control a:hover { background: #f4f4f4; }
.fm-nav-control svg { display: block; }

/* Adminpanel: topplinje + innhold, med overlay/dokket-modus */
.fm-admin-bar {
	display: flex; align-items: center; gap: 6px; padding: 6px 8px;
	background: #1f2a37; color: #fff; border-radius: 8px 8px 0 0;
	-webkit-user-select: none; user-select: none;
}
.fm-admin-grip { display: inline-flex; opacity: .85; }
.fm-admin--overlay .fm-admin-bar { cursor: move; touch-action: none; }
.fm-admin-title { font-weight: 600; font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-admin-bar-actions { display: flex; gap: 2px; }
.fm-admin-bar button {
	background: transparent; border: 0; color: #fff; cursor: pointer;
	padding: 3px; display: inline-flex; align-items: center; border-radius: 4px; line-height: 0;
}
.fm-admin-bar button:hover { background: rgba( 255, 255, 255, .18 ); }
.fm-admin--collapsed .fm-admin-body { display: none; }
.fm-admin--collapsed .fm-admin-bar { border-radius: 8px; }
.fm-admin-panel .fm-admin-inner { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }

/* Overlay: flytende panel inne i kartet (synlig i fullskjerm) */
.fm-admin--overlay {
	position: absolute; z-index: 1100; left: 8px; bottom: 8px;
	width: min( 440px, calc( 100% - 16px ) );
	margin: 0; border-radius: 8px; overflow: hidden;
	box-shadow: 0 8px 28px rgba( 0, 0, 0, .35 );
}
.fm-admin--overlay .fm-admin-bar { border-radius: 8px 8px 0 0; }
.fm-admin--overlay.fm-admin--collapsed .fm-admin-bar { border-radius: 8px; }
.fm-admin--overlay .fm-admin-body { max-height: 46vh; overflow: auto; background: #f7fafc; }
.fm-admin--overlay .fm-admin-inner { border: 0; border-radius: 0; }
.fm-pseudo-fs .fm-admin--overlay .fm-admin-body { max-height: 60vh; }

.fm-admin-panel.fm-fs-active .fm-admin-dock { display: none; }

/* Overlay: midtstilt nederst som standard, og maksimert-modus */
.fm-admin--overlay.fm-admin--center { left: 50%; right: auto; bottom: 8px; top: auto; transform: translateX( -50% ); }
.fm-admin--overlay.fm-admin--max {
	left: 8px; right: 8px; top: 8px; bottom: 8px; width: auto; transform: none;
	display: flex; flex-direction: column;
}
.fm-admin--overlay.fm-admin--max .fm-admin-body { flex: 1; max-height: none; overflow: auto; }

/* Statusikoner for deltakere (med tooltip) */
.fm-status-badge { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.fm-status-badge svg { display: block; }
.fm-status-invitert { color: #1d6fb8; }   /* blå – invitert */
.fm-status-aktiv { color: #1f9e57; }       /* grønn – aktiv */
.fm-status-deaktivert { color: #b3261e; }  /* rød – tilbaketrukket */

/* Deltakere som kort over to linjer (mobilvennlig, tydelig skille) */
.fm-admin-inner h4 { letter-spacing: .2px; }
.fm-a-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.fm-a-card {
	background: #fff;
	border: 1px solid #e4e9ee;
	border-radius: 12px;
	padding: 11px 13px;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, .05 );
}
.fm-a-line1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fm-a-name {
	font-weight: 600; font-size: 14px; color: #1f2a37;
	min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fm-a-name em { font-style: normal; font-weight: 400; font-size: 12px; color: #7a8794; margin-left: 2px; }
.fm-a-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.fm-a-seen { font-size: 12px; color: #7a8794; white-space: nowrap; }
.fm-a-line2 {
	display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
	margin-top: 11px; padding-top: 10px; border-top: 1px solid #eef2f5;
}
.fm-a-line2 .fm-iconbtn { width: 40px; height: 40px; }
.fm-a-line2 .fm-a-color { width: 40px; height: 40px; }
.fm-a-empty { font-size: 13px; color: #7a8794; margin: 6px 0; }
.fm-status-badge svg { width: 20px; height: 20px; }

/* Fargevelger som tydelig, rund knapp i admindelen */
.fm-a-color {
	width: 38px; height: 38px; padding: 0;
	border: 2px solid #fff; border-radius: 50%;
	box-shadow: 0 0 0 1px #cbd5e1, 0 1px 2px rgba( 16, 24, 40, .15 );
	background: none; cursor: pointer; vertical-align: middle; overflow: hidden;
	-webkit-appearance: none; appearance: none;
}
.fm-a-line2 .fm-a-color { width: 38px; height: 38px; }
.fm-a-color::-webkit-color-swatch-wrapper { padding: 0; }
.fm-a-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.fm-a-color::-moz-color-swatch { border: none; border-radius: 50%; }

/* Fargesymbol i admin: stor, rund fargeknapp i stedet for tynn strek */
.fm-a-color {
	-webkit-appearance: none; -moz-appearance: none; appearance: none;
	width: 40px; height: 40px; padding: 0;
	border: none; border-radius: 50%;
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px #c8d2dc;
	cursor: pointer; background: none;
}
.fm-a-color::-webkit-color-swatch-wrapper { padding: 0; }
.fm-a-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.fm-a-color::-moz-color-swatch { border: none; border-radius: 50%; }
.fm-a-line2 .fm-a-color { width: 40px; height: 40px; }

/* Skjul/vis-knapp i adminkort */
.fm-a-hide { opacity: .85; }
.fm-a-hide.fm-a-hidden { opacity: .4; }

/* ---- Mindre ikoner i adminkort (~30 % redusert) ---- */
.fm-iconbtn { width: 24px; height: 24px; }
.fm-admin-inner .fm-iconbtn { width: 21px; height: 21px; }
.fm-a-line2 .fm-iconbtn { width: 28px; height: 28px; }
.fm-a-line2 .fm-iconbtn svg { width: 11px; height: 11px; }
.fm-a-color,
.fm-a-line2 .fm-a-color { width: 28px; height: 28px; }
.fm-status-badge svg { width: 14px; height: 14px; }

/* Romstatus-knapp (Sett inaktiv / Aktiver): ikon + tekst */
.fm-a-toggle { display: inline-flex; align-items: center; gap: 7px; }
.fm-a-toggle svg { display: block; width: 16px; height: 16px; flex: none; }
.fm-a-toggle-off { background: #1f9e57; }       /* grønn = klikk for å aktivere */
.fm-a-toggle-off:hover { background: #1a854a; }

/* ---- PC: fortett deltakerliste til én rad per deltaker (tabell-følelse) ---- */
@media ( min-width: 768px ) {
	.fm-a-list { gap: 6px; }
	.fm-a-card {
		display: flex; align-items: center; gap: 12px;
		padding: 6px 10px; border-radius: 8px;
	}
	.fm-a-line1 { flex: 1; min-width: 0; gap: 10px; }
	.fm-a-name { flex: 1; min-width: 0; font-size: 13px; }
	.fm-a-meta { width: 104px; flex: none; justify-content: flex-end; }
	.fm-a-seen { font-size: 11px; }
	.fm-a-line2 {
		flex: none; margin-top: 0; padding-top: 0; border-top: 0;
		flex-wrap: nowrap; gap: 4px;
	}
	.fm-a-line2 .fm-iconbtn { width: 28px; height: 28px; padding: 0; }
	.fm-a-line2 .fm-iconbtn svg { width: 20px; height: 20px; }
	.fm-a-line2 .fm-a-color { width: 26px; height: 26px; }
}

/* Dele-knapp: nedtrykt/aktiv tilstand når invitasjonslenken er delt/kopiert */
.fm-a-share.fm-a-shared {
	background: #1f9e57;
	box-shadow: inset 0 2px 4px rgba( 0, 0, 0, .35 );
	color: #fff;
}
.fm-a-share.fm-a-shared:hover { background: #1a854a; }

/* Slett-rom-knapp i roomrow */
.fm-a-delroom { display: inline-flex; align-items: center; gap: 7px; }
.fm-a-delroom svg { display: block; width: 16px; height: 16px; flex: none; }

/* ---- Innloggingsknapp ---- */
.fm-login-btn { display: inline-flex; align-items: center; gap: 7px; }
.fm-login-btn svg { display: block; flex: none; }

/* ---- Innloggings-popup ---- */
.fm-login-overlay {
	position: fixed; inset: 0; z-index: 9999;
	background: rgba( 0, 0, 0, .55 );
	display: flex; align-items: center; justify-content: center;
	padding: 16px;
}
.fm-login-overlay[hidden] { display: none; }
.fm-login-box {
	background: #fff; border-radius: 14px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, .3 );
	padding: 32px 28px 24px;
	width: 100%; max-width: 360px;
	position: relative;
}
.fm-login-close {
	position: absolute; top: 14px; right: 14px;
	background: none; border: none; cursor: pointer;
	color: #6b7a8a; padding: 4px; border-radius: 6px;
	display: flex; align-items: center;
}
.fm-login-close:hover { background: #f0f2f5; color: #1a2430; }
.fm-login-title {
	margin: 0 0 20px; font-size: 20px; font-weight: 700;
	color: #1a2430; line-height: 1.2;
}
.fm-login-err {
	background: #fdecea; color: #b3261e;
	border-radius: 8px; padding: 10px 14px;
	font-size: 14px; margin-bottom: 14px;
}
.fm-login-err[hidden] { display: none; }
.fm-login-label {
	display: flex; flex-direction: column; gap: 5px;
	font-size: 14px; font-weight: 500; color: #3a4551;
	margin-bottom: 14px;
}
.fm-login-label input {
	padding: 10px 12px; border: 1.5px solid #d0d7de;
	border-radius: 8px; font-size: 15px; color: #1a2430;
	background: #f7fafc; outline: none; transition: border-color .15s;
}
.fm-login-label input:focus { border-color: #3b7dd8; background: #fff; }
.fm-login-submit {
	width: 100%; padding: 11px; font-size: 15px;
	font-weight: 600; margin-top: 4px;
}
.fm-login-forgot {
	text-align: center; margin: 14px 0 0;
	font-size: 13px; color: #6b7a8a;
}
.fm-login-forgot a { color: #3b7dd8; text-decoration: none; }
.fm-login-forgot a:hover { text-decoration: underline; }

/* Sist-sett-varsler: gul = > 10 min, rød = > 30 min, grå = ukjent */
.fm-stale-warn  { color: #b07d00; font-weight: 600; }
.fm-stale-old   { color: #b3261e; font-weight: 600; }
.fm-stale-unknown { color: #9aa5b1; }

/* Logg ut-knapp i roomrow */
.fm-a-logout { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; margin-left: auto; }
.fm-a-logout svg { display: block; width: 16px; height: 16px; flex: none; }

/* ---- Romvelger (superadmin / admin-gruppe) ---- */
.fm-roompicker .fm-rp-title { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.fm-rp-item {
	display: flex; flex-direction: column; gap: 2px;
	width: 100%; text-align: left; cursor: pointer;
	background: #fff; border: 1.5px solid #d0d7de; border-radius: 8px;
	padding: 10px 12px; margin-bottom: 8px; transition: border-color .15s, background .15s;
}
.fm-rp-item:hover { border-color: #3b7dd8; background: #f5f9ff; }
.fm-rp-main { display: flex; align-items: center; gap: 8px; }
.fm-rp-main strong { font-size: 14px; color: #1a2430; }
.fm-rp-sub { font-size: 12px; color: #6b7a8a; }
.fm-rp-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.fm-rp-badge.green { background: #e6f4ea; color: #1f9e57; }
.fm-rp-badge.grey  { background: #eef0f2; color: #6b7a8a; }
.fm-rp-new { display: flex; gap: 8px; margin-top: 12px; }
.fm-rp-new .fm-a-navn { flex: 1; }

/* Romhode med «Bytt kart» */
.fm-a-roomhead {
	display: flex; align-items: center; justify-content: space-between;
	gap: 10px; margin-bottom: 10px; padding-bottom: 8px;
	border-bottom: 1px solid #e6eaee;
}
.fm-a-roomname { font-weight: 700; font-size: 14px; color: #1a2430; }
.fm-a-switch { padding: 4px 10px; font-size: 12px; }

/* Aktiver GPS-knapp */
.fm-gps-btn { display: inline-flex; align-items: center; gap: 7px; background: #1f9e57; }
.fm-gps-btn:hover { background: #1a854a; }
.fm-gps-btn svg { display: block; flex: none; }

/* ---- Enkel fargevelger (palett) ---- */
.fm-a-colorwrap { position: relative; display: inline-flex; }
.fm-a-colorbtn {
	width: 28px; height: 28px; border-radius: 50%;
	border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25);
	cursor: pointer; padding: 0;
}
.fm-a-palette {
	position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 1200;
	background: #fff; border: 1px solid #d0d7de; border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0,0,0,.2); padding: 10px;
	display: flex; flex-direction: column; gap: 8px; width: max-content;
}
.fm-a-palette[hidden] { display: none; }
.fm-sw-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fm-sw {
	width: 26px; height: 26px; border-radius: 50%;
	border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2);
	cursor: pointer; padding: 0; transition: transform .1s;
}
.fm-sw:hover { transform: scale(1.12); }
.fm-sw-sel { box-shadow: 0 0 0 2px #1a2430; }
.fm-a-colorset { width: 100%; padding: 6px; font-size: 13px; }
