:root {
	--brand-primary: #235e7b;
	--brand-primary-dark: #173e50;
	--brand-secondary: #7da744;
	--brand-secondary-dark: #5e832d;
	--brand-bg-light: #f4f8f6;
}

html {
	height: 100%;
}

body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	color: #222;
	background-color: #fff;
}

body > main {
	flex: 1 0 auto;
}

body > .site-header,
body > .site-footer {
	flex-shrink: 0;
}

/* Header */

.site-header {
	background-color: var(--brand-primary-dark);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
	position: relative;
	z-index: 10;
}

.site-header .navbar {
	padding-top: .6rem;
	padding-bottom: .6rem;
}

.site-logo {
	height: 44px;
	width: auto;
}

.user-menu-toggle {
	color: #fff;
	border: none;
	background: transparent;
	font-weight: 500;
}

.user-menu-toggle:hover,
.user-menu-toggle:focus {
	color: #fff;
	opacity: .85;
}

.user-menu-toggle svg {
	width: 26px;
	height: 26px;
}

.site-header .nav-link {
	font-weight: 500;
}

.site-header .nav-link.active {
	color: #fff;
	font-weight: 600;
}

.site-header .navbar-collapse {
	gap: 1rem;
}

@media (max-width: 991.98px) {
	.site-header .navbar-collapse {
		padding-top: .75rem;
		align-items: flex-start;
	}

	.site-header .dropdown {
		align-self: stretch;
	}
}

.flag-icon {
	width: 24px;
	height: 18px;
	object-fit: cover;
	border-radius: 2px;
	margin-right: .5rem;
}

/* Hero */

.hero {
	background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
	color: #fff;
	padding: 4.5rem 1rem;
}

.hero h1 {
	font-weight: 700;
}

.hero .lead {
	max-width: 640px;
	margin: 0 auto 1.75rem;
}

.btn-cta {
	background-color: var(--brand-secondary);
	border-color: var(--brand-secondary);
	color: #fff;
	font-weight: 600;
}

.btn-cta:hover,
.btn-cta:focus {
	background-color: var(--brand-secondary-dark);
	border-color: var(--brand-secondary-dark);
	color: #fff;
}

/* Features */

.features {
	background-color: var(--brand-bg-light);
}

.features-title {
	color: var(--brand-primary);
	font-weight: 700;
	text-align: center;
	margin-bottom: 2.5rem;
}

.feature-card {
	background: #fff;
	border-radius: .75rem;
	padding: 2rem 1.5rem;
	text-align: center;
	box-shadow: 0 4px 16px rgba(35, 94, 123, .08);
	transition: transform .15s ease, box-shadow .15s ease;
}

.feature-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(35, 94, 123, .14);
}

.feature-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: rgba(125, 167, 68, .14);
	color: var(--brand-secondary-dark);
}

.feature-card h3 {
	color: var(--brand-primary);
	font-weight: 600;
	font-size: 1.15rem;
}

/* CTA section */

.cta-section h2 {
	color: var(--brand-primary);
	font-weight: 700;
	margin-bottom: 1.5rem;
}

/* Devices */

.devices-title {
	color: var(--brand-primary);
	font-weight: 700;
	margin-bottom: 1.5rem;
}

.devices-empty {
	color: #555;
}

.devices-table {
	background: #fff;
	box-shadow: 0 4px 16px rgba(35, 94, 123, .08);
	border-radius: .5rem;
	overflow: hidden;
}

.devices-table thead th {
	color: var(--brand-primary);
	font-weight: 600;
	border-bottom-width: 1px;
	white-space: nowrap;
}

.devices-table .text-mono,
.events-table .text-mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .9em;
	white-space: nowrap;
}

.device-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6rem;
}

.gps-link {
	display: inline-flex;
	color: var(--brand-primary);
}

.gps-link:hover {
	color: var(--brand-secondary-dark);
}

.config-btn,
.remote-open-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	padding: 0;
	color: var(--brand-primary);
	cursor: pointer;
}

.config-btn:hover,
.remote-open-btn:hover {
	color: var(--brand-secondary-dark);
}

.status-dot {
	display: inline-block;
	width: .6rem;
	height: .6rem;
	border-radius: 50%;
	margin-right: .4rem;
}

.status-dot.status-ONLINE {
	background-color: var(--brand-secondary);
}

.status-dot.status-WARNING {
	background-color: #e0a300;
}

.status-dot.status-OFFLINE {
	background-color: #c0392b;
}

.devices-toolbar {
	margin-bottom: 1rem;
}

.devices-search {
	max-width: 320px;
}

.devices-table thead th[data-sort-key] {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.25rem;
}

.devices-table thead th[data-sort-key]::after {
	content: "\2195";
	position: absolute;
	right: .5rem;
	opacity: .35;
}

.devices-table thead th[data-sort-key].sort-asc::after {
	content: "\2191";
	opacity: 1;
}

.devices-table thead th[data-sort-key].sort-desc::after {
	content: "\2193";
	opacity: 1;
}

/* Events */

.events-title {
	color: var(--brand-primary);
	font-weight: 700;
	margin-bottom: 1.5rem;
}

.events-filter {
	background: #fff;
	border-radius: .75rem;
	box-shadow: 0 4px 16px rgba(35, 94, 123, .08);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

.events-filter-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.filter-group {
	display: flex;
	flex-direction: column;
	gap: .4rem;
	min-width: 160px;
}

.filter-group-list {
	flex: 0 0 220px;
	width: 220px;
}

.filter-date-range {
	display: flex;
	flex-wrap: nowrap;
	gap: .75rem;
	flex: 0 0 auto;
}

.filter-group-date {
	flex: 0 0 145px;
	width: 145px;
}

.filter-group-date .form-control {
	width: 145px;
}

.filter-group-grow {
	flex: 1 1 180px;
	min-width: 180px;
}

.filter-group-label {
	font-weight: 600;
	color: var(--brand-primary);
	font-size: .9rem;
}

.filter-checklist {
	height: 160px;
	overflow-y: auto;
	border: 1px solid #dde4e7;
	border-radius: .5rem;
	padding: .6rem .75rem;
	background: var(--brand-bg-light);
}

.filter-checklist .form-check {
	margin-bottom: .3rem;
}

.filter-checklist .form-check:last-child {
	margin-bottom: 0;
}

.events-filter-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 1.5rem;
	margin-top: 1.25rem;
}

.events-live-switch {
	display: flex;
	align-items: center;
	gap: .5rem;
}

.events-live-switch .form-check-input {
	width: 2.5rem;
	height: 1.4rem;
	cursor: pointer;
}

.events-live-switch .form-check-input:checked {
	background-color: var(--brand-secondary);
	border-color: var(--brand-secondary);
}

.events-live-switch .form-check-label {
	font-weight: 600;
	color: var(--brand-primary);
	cursor: pointer;
}

.events-table thead th[data-sort-key] {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.25rem;
}

.events-table thead th[data-sort-key]::after {
	content: "\2195";
	position: absolute;
	right: .5rem;
	opacity: .35;
}

.events-table thead th[data-sort-key].sort-asc::after {
	content: "\2191";
	opacity: 1;
}

.events-table thead th[data-sort-key].sort-desc::after {
	content: "\2193";
	opacity: 1;
}

.events-table {
	background: #fff;
	box-shadow: 0 4px 16px rgba(35, 94, 123, .08);
	border-radius: .5rem;
	overflow: hidden;
}

.events-table thead th {
	color: var(--brand-primary);
	font-weight: 600;
	border-bottom-width: 1px;
	white-space: nowrap;
}

.events-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 1rem;
}

.events-pagination-nav {
	display: flex;
	align-items: center;
	gap: .75rem;
}

.events-pagination-total {
	color: #555;
	font-size: .9rem;
}

/* Auth pages (login, email verification) */

.auth-section {
	background-color: var(--brand-bg-light);
	height: 100%;
	display: flex;
	align-items: center;
}

.auth-section .container {
	width: 100%;
}

.auth-card {
	max-width: 420px;
	background: #fff;
	border-radius: .75rem;
	padding: 2.5rem;
	box-shadow: 0 4px 16px rgba(35, 94, 123, .08);
}

.auth-card-wide {
	max-width: 720px;
}

.auth-section-title {
	color: var(--brand-primary);
	font-weight: 600;
	font-size: 1.05rem;
	margin-top: 1.75rem;
	margin-bottom: 1rem;
	padding-bottom: .4rem;
	border-bottom: 1px solid #e5eaec;
}

.auth-section-title:first-of-type {
	margin-top: 0;
}

.form-control-readonly,
.form-control-readonly:focus {
	background-color: var(--brand-bg-light);
	color: #666;
	cursor: not-allowed;
}

.auth-title {
	color: var(--brand-primary);
	font-weight: 700;
	font-size: 1.5rem;
	text-align: center;
	margin-bottom: 1.5rem;
}

.auth-description {
	color: #444;
	text-align: center;
	margin-bottom: 1.5rem;
}

.form-control:focus {
	border-color: var(--brand-primary);
	box-shadow: 0 0 0 .25rem rgba(35, 94, 123, .15);
}

.auth-divider {
	margin: 1.5rem 0;
}

.auth-links {
	text-align: center;
	font-size: .95rem;
	margin-bottom: .5rem;
}

.auth-links span {
	color: #555;
	margin-right: .35rem;
}

.auth-links a {
	color: var(--brand-primary);
	font-weight: 600;
	text-decoration: none;
}

.auth-links a:hover {
	color: var(--brand-secondary-dark);
	text-decoration: underline;
}

/* Footer */

.site-footer {
	background-color: var(--brand-primary-dark);
	color: #eef3f0;
}

.site-footer a {
	color: #eef3f0;
	text-decoration: none;
}

.site-footer a:hover {
	color: var(--brand-secondary);
	text-decoration: underline;
}

.footer-copy {
	font-size: .9rem;
	opacity: .85;
}

/* Responsive */

@media (max-width: 576px) {
	.hero {
		padding: 3rem 1rem;
	}

	.site-logo {
		height: 36px;
	}

	.footer-links {
		flex-wrap: wrap;
		justify-content: center;
	}
}
