:root {
	--bg: #f3f6fb;
	--bg-deep: #e9eff7;
	--surface: #ffffff;
	--surface-2: #f7f9fc;
	--ink: #223247;
	--ink-soft: #4b5f75;
	--muted: #7d8da1;
	--line: #e3eaf3;
	--accent: #1582fd;
	--accent-dark: #0b62c4;
	--accent-soft: #e8f2ff;
	--green: #1e9d72;
	--green-soft: #e6f7f0;
	--orange: #e08a1e;
	--orange-soft: #fff3df;
	--red: #d64545;
	--red-soft: #fdeaea;
	--violet: #7459e8;
	--violet-soft: #efecff;
	--shadow: 0 14px 40px rgba(24, 55, 92, 0.08);
	--shadow-soft: 0 4px 16px rgba(24, 55, 92, 0.06);
	--radius: 18px;
	--radius-sm: 12px;
	--sidebar: 250px;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	font-family:
		'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
		'Helvetica Neue', sans-serif;
	background:
		radial-gradient(circle at 100% 0%, rgba(21, 130, 253, 0.08), transparent 34rem),
		radial-gradient(circle at 0% 100%, rgba(116, 89, 232, 0.06), transparent 30rem),
		var(--bg);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
	font: inherit;
}

button {
	cursor: pointer;
}

a {
	color: inherit;
	text-decoration: none;
}

svg {
	display: block;
}

/* ------------------------------------------------------------------ */
/* Structure                                                          */
/* ------------------------------------------------------------------ */
.app {
	display: flex;
	min-height: 100vh;
}

.sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--sidebar);
	display: flex;
	flex-direction: column;
	gap: 22px;
	padding: 22px 18px;
	background: rgba(255, 255, 255, 0.94);
	border-right: 1px solid var(--line);
	backdrop-filter: blur(14px);
	z-index: 60;
	transition: transform 0.25s ease;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 8px;
}

.brand img {
	height: 40px;
	width: auto;
}

.brand-copy {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
}

.brand-copy strong {
	font-size: 18px;
	letter-spacing: 0.08em;
	color: var(--accent);
}

.brand-copy small {
	font-size: 10.5px;
	color: var(--muted);
	letter-spacing: 0.02em;
}

.nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	overflow-y: auto;
	padding-right: 2px;
}

.nav-section-label {
	margin: 10px 12px 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: #9aa9bb;
}

.nav a {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 10px 12px;
	border-radius: 11px;
	color: var(--ink-soft);
	font-size: 13.5px;
	font-weight: 600;
	transition: background 0.16s ease, color 0.16s ease;
}

.nav a:hover {
	background: var(--surface-2);
	color: var(--accent);
}

.nav a.active {
	background: var(--accent-soft);
	color: var(--accent-dark);
}

.nav a svg {
	width: 19px;
	height: 19px;
	flex: 0 0 19px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nav .nav-count {
	margin-left: auto;
	min-width: 22px;
	padding: 1px 7px;
	border-radius: 999px;
	background: var(--bg-deep);
	color: var(--muted);
	font-size: 11px;
	text-align: center;
}

.nav a.active .nav-count {
	background: #fff;
	color: var(--accent);
}

.sidebar-footer {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.backend-chip {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 12px;
	border-radius: 13px;
	background: var(--surface-2);
	border: 1px solid var(--line);
}

.backend-chip .dot {
	width: 9px;
	height: 9px;
	margin-top: 4px;
	border-radius: 50%;
	background: var(--green);
	box-shadow: 0 0 0 4px rgba(30, 157, 114, 0.13);
	flex: 0 0 9px;
}

.backend-chip.is-mock .dot {
	background: var(--orange);
	box-shadow: 0 0 0 4px rgba(224, 138, 30, 0.14);
}

.backend-chip.is-offline .dot {
	background: var(--red);
	box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.13);
}

.backend-chip strong {
	display: block;
	font-size: 12px;
}

.backend-chip small {
	display: block;
	margin-top: 3px;
	font-size: 10.5px;
	line-height: 1.35;
	color: var(--muted);
}

.sidebar-footer .legacy-link {
	text-align: center;
	font-size: 11px;
	color: var(--muted);
	padding: 6px;
	border-radius: 8px;
}

.sidebar-footer .legacy-link:hover {
	color: var(--accent);
	background: var(--surface-2);
}

.main {
	flex: 1;
	min-width: 0;
	margin-left: var(--sidebar);
	display: flex;
	flex-direction: column;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 40;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 20px;
	padding: 26px 30px 18px;
	background: linear-gradient(to bottom, rgba(243, 246, 251, 0.97) 60%, rgba(243, 246, 251, 0));
}

.page-heading {
	display: flex;
	gap: 14px;
	align-items: flex-start;
}

.page-heading h1 {
	margin: 0;
	font-size: 27px;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.page-heading p {
	margin: 5px 0 0;
	font-size: 12.5px;
	color: var(--muted);
	max-width: 720px;
}

.menu-toggle {
	display: none;
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 10px;
	width: 38px;
	height: 38px;
	align-items: center;
	justify-content: center;
	color: var(--ink);
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.clock-block {
	text-align: right;
}

.clock-block strong {
	display: block;
	font-size: 16px;
	font-variant-numeric: tabular-nums;
}

.clock-block small {
	font-size: 10.5px;
	color: var(--muted);
}

.live-badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 11px;
	border-radius: 999px;
	background: var(--green-soft);
	color: var(--green);
	font-size: 11px;
	font-weight: 700;
}

.live-badge::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
	animation: pulse 1.8s infinite;
}

.live-badge.offline {
	background: var(--red-soft);
	color: var(--red);
}

@keyframes pulse {
	0%,
	100% {
		opacity: 1;
		transform: scale(1);
	}
	50% {
		opacity: 0.35;
		transform: scale(0.8);
	}
}

.view-root {
	padding: 4px 30px 48px;
	width: 100%;
	max-width: 1560px;
}

/* ------------------------------------------------------------------ */
/* Composants                                                         */
/* ------------------------------------------------------------------ */
.card {
	background: var(--surface);
	border: 1px solid rgba(227, 234, 243, 0.85);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	padding: 20px;
	min-width: 0;
}

.card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	margin-bottom: 16px;
}

.card-head h2 {
	margin: 0;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.card-head p {
	margin: 4px 0 0;
	font-size: 11.5px;
	color: var(--muted);
}

.card-head .card-tools {
	display: flex;
	gap: 8px;
	align-items: center;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--ink-soft);
	padding: 9px 14px;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 650;
	transition: 0.16s ease;
	white-space: nowrap;
}

.btn svg {
	width: 15px;
	height: 15px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.btn:hover {
	border-color: #c9d6e6;
	background: var(--surface-2);
}

.btn.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	box-shadow: 0 8px 18px rgba(21, 130, 253, 0.24);
}

.btn.primary:hover {
	background: var(--accent-dark);
	border-color: var(--accent-dark);
}

.btn.danger {
	background: var(--red);
	border-color: var(--red);
	color: #fff;
	box-shadow: 0 8px 18px rgba(214, 69, 69, 0.22);
}

.btn.danger:hover {
	background: #b93636;
	border-color: #b93636;
}

.btn.ghost-danger {
	color: var(--red);
	border-color: #f2caca;
	background: var(--red-soft);
}

.btn.ghost-danger:hover {
	background: #fbdcdc;
}

.btn.small {
	padding: 6px 10px;
	font-size: 11.5px;
	border-radius: 8px;
}

.btn.icon-only {
	padding: 7px;
	width: 32px;
	height: 32px;
}

.btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 9px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 700;
	background: var(--surface-2);
	color: var(--muted);
	white-space: nowrap;
}

.pill::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.pill.moving,
.pill.flying,
.pill.mission {
	background: var(--accent-soft);
	color: var(--accent);
}

.pill.idle,
.pill.ready,
.pill.holding {
	background: var(--green-soft);
	color: var(--green);
}

.pill.charging {
	background: var(--orange-soft);
	color: var(--orange);
}

.pill.estop,
.pill.offline,
.pill.landing {
	background: var(--red-soft);
	color: var(--red);
}

.tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 8px;
	border-radius: 6px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	background: var(--surface-2);
	color: var(--muted);
}

.tag.publish {
	background: var(--violet-soft);
	color: var(--violet);
}

.tag.subscribe {
	background: var(--green-soft);
	color: var(--green);
}

.tag.service {
	background: var(--orange-soft);
	color: var(--orange);
}

/* Formulaires */
.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 11.5px;
	font-weight: 650;
	color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
	width: 100%;
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 9px;
	padding: 9px 11px;
	font-size: 13px;
	color: var(--ink);
	outline: none;
	transition: border 0.16s ease, box-shadow 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(21, 130, 253, 0.12);
}

.field textarea {
	min-height: 92px;
	resize: vertical;
	font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
	font-size: 12px;
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 13px;
}

.form-grid .span-2 {
	grid-column: span 2;
}

/* ------------------------------------------------------------------ */
/* Vue d'ensemble                                                     */
/* ------------------------------------------------------------------ */
.kpi-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-bottom: 18px;
}

.kpi {
	position: relative;
	padding: 18px 19px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid rgba(227, 234, 243, 0.85);
	box-shadow: var(--shadow-soft);
	overflow: hidden;
}

.kpi::after {
	content: '';
	position: absolute;
	right: -26px;
	top: -26px;
	width: 92px;
	height: 92px;
	border-radius: 50%;
	background: var(--accent-soft);
	opacity: 0.8;
}

.kpi.k-green::after {
	background: var(--green-soft);
}
.kpi.k-orange::after {
	background: var(--orange-soft);
}
.kpi.k-red::after {
	background: var(--red-soft);
}

.kpi .kpi-icon {
	position: relative;
	z-index: 1;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	background: var(--accent-soft);
	color: var(--accent);
	margin-bottom: 13px;
}

.kpi.k-green .kpi-icon {
	background: var(--green-soft);
	color: var(--green);
}
.kpi.k-orange .kpi-icon {
	background: var(--orange-soft);
	color: var(--orange);
}
.kpi.k-red .kpi-icon {
	background: var(--red-soft);
	color: var(--red);
}

.kpi .kpi-icon svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.kpi strong {
	position: relative;
	z-index: 1;
	display: block;
	font-size: 25px;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
}

.kpi small {
	position: relative;
	z-index: 1;
	display: block;
	margin-top: 2px;
	font-size: 11.5px;
	color: var(--muted);
}

.overview-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
	gap: 18px;
	margin-bottom: 18px;
}

.overview-bottom {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
	gap: 18px;
}

/* Carte du port */
.port-map {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: 14px;
	overflow: hidden;
	background: #eaf0f7;
	border: 1px solid var(--line);
}

.port-map > svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.map-markers {
	position: absolute;
	inset: 0;
}

.map-marker {
	position: absolute;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	gap: 3px;
	border: 0;
	background: transparent;
	padding: 0;
	transition: left 0.55s linear, top 0.55s linear, opacity 0.2s;
	z-index: 2;
}

.map-marker .marker-bubble {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--marker-color, var(--accent));
	color: #fff;
	box-shadow: 0 3px 10px rgba(20, 40, 70, 0.28), 0 0 0 3px rgba(255, 255, 255, 0.9);
	transition: transform 0.16s ease;
}

.map-marker:hover .marker-bubble {
	transform: scale(1.16);
}

.map-marker .marker-bubble svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.map-marker .marker-tag {
	padding: 2px 5px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.92);
	color: #40536a;
	font-size: 8.5px;
	font-weight: 800;
	box-shadow: 0 2px 6px rgba(20, 40, 70, 0.12);
}

.map-marker.is-offline {
	opacity: 0.4;
}

.map-marker.is-estop .marker-bubble {
	background: var(--red);
}

.map-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 13px;
}

.map-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: var(--muted);
	font-weight: 600;
}

.map-legend i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--dot);
}

/* Journal */
.event-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-height: 380px;
	overflow: auto;
	padding-right: 3px;
}

.event-item {
	display: grid;
	grid-template-columns: 10px 1fr;
	gap: 10px;
	padding: 10px 6px;
	border-bottom: 1px dashed var(--line);
}

.event-item:last-child {
	border-bottom: 0;
}

.event-item .event-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-top: 4px;
	background: var(--accent);
}

.event-item.warning .event-dot {
	background: var(--orange);
}
.event-item.error .event-dot {
	background: var(--red);
}
.event-item.success .event-dot {
	background: var(--green);
}

.event-item p {
	margin: 0;
	font-size: 12px;
	line-height: 1.42;
	color: var(--ink-soft);
}

.event-item small {
	display: block;
	margin-top: 3px;
	font-size: 10px;
	color: var(--muted);
}

/* Tableaux */
.table-wrap {
	overflow: auto;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
}

thead th {
	text-align: left;
	padding: 0 10px 9px;
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 700;
	white-space: nowrap;
}

tbody td {
	padding: 10px;
	border-top: 1px solid var(--line);
	color: var(--ink-soft);
	vertical-align: middle;
}

tbody tr:hover td {
	background: var(--surface-2);
}

.cell-robot {
	display: flex;
	align-items: center;
	gap: 9px;
	font-weight: 650;
	color: var(--ink);
	white-space: nowrap;
}

.robot-dot {
	width: 26px;
	height: 26px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	background: var(--dot-bg, var(--accent-soft));
	color: var(--dot, var(--accent));
	flex: 0 0 26px;
}

.robot-dot svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.battery {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 92px;
}

.battery .battery-bar {
	width: 48px;
	height: 6px;
	border-radius: 99px;
	background: var(--bg-deep);
	overflow: hidden;
}

.battery .battery-bar i {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--green);
	transition: width 0.4s ease;
}

.battery.low .battery-bar i {
	background: var(--orange);
}
.battery.critical .battery-bar i {
	background: var(--red);
}

.battery span {
	font-size: 11px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Cartes robots                                                      */
/* ------------------------------------------------------------------ */
.view-hero {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 18px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.view-hero .hero-copy h2 {
	margin: 0;
	font-size: 17px;
}

.view-hero .hero-copy p {
	margin: 6px 0 0;
	max-width: 740px;
	font-size: 12.5px;
	color: var(--muted);
	line-height: 1.5;
}

.robot-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.robot-card {
	background: var(--surface);
	border: 1px solid rgba(227, 234, 243, 0.9);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	padding: 17px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	position: relative;
	overflow: hidden;
}

.robot-card::before {
	content: '';
	position: absolute;
	inset: 0 auto 0 0;
	width: 4px;
	background: var(--robot-color, var(--accent));
	opacity: 0.85;
}

.robot-card-head {
	display: flex;
	align-items: center;
	gap: 11px;
}

.robot-avatar {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	display: grid;
	place-items: center;
	background: color-mix(in srgb, var(--robot-color, var(--accent)) 13%, white);
	color: var(--robot-color, var(--accent));
	flex: 0 0 40px;
}

.robot-avatar svg {
	width: 21px;
	height: 21px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.robot-card-head h3 {
	margin: 0;
	font-size: 14px;
	letter-spacing: -0.01em;
}

.robot-card-head small {
	display: block;
	margin-top: 2px;
	font-size: 10.5px;
	color: var(--muted);
}

.robot-card-head .pill {
	margin-left: auto;
}

.robot-metrics {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.metric {
	background: var(--surface-2);
	border-radius: 10px;
	padding: 9px 10px;
	min-width: 0;
}

.metric span {
	display: block;
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--muted);
}

.metric strong {
	display: block;
	margin-top: 3px;
	font-size: 13.5px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.speed-control {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.speed-control .speed-label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 11px;
	color: var(--muted);
	font-weight: 650;
}

.speed-control .speed-label strong {
	color: var(--ink);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

input[type='range'].range {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--bg-deep), var(--accent-soft));
	outline: none;
}

input[type='range'].range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--surface);
	border: 4px solid var(--accent);
	box-shadow: 0 2px 7px rgba(21, 130, 253, 0.35);
	cursor: grab;
}

input[type='range'].range::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--surface);
	border: 4px solid var(--accent);
	cursor: grab;
}

.robot-actions {
	display: flex;
	gap: 7px;
	flex-wrap: wrap;
}

.robot-actions .btn {
	flex: 1;
}

.robot-note {
	font-size: 10.5px;
	color: var(--muted);
}

/* Aiguillages */
.switch-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
	gap: 18px;
}

.switch-map {
	position: relative;
	width: 100%;
	border-radius: 13px;
	overflow: hidden;
	border: 1px solid var(--line);
	background: #f8fafc;
}

.switch-map img {
	display: block;
	width: 100%;
	height: auto;
}

.switch-hotspot {
	position: absolute;
	transform: translate(-50%, -50%);
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid #fff;
	background: var(--green);
	color: #fff;
	font-size: 0;
	box-shadow: 0 3px 9px rgba(20, 40, 70, 0.25);
	transition: transform 0.15s ease, background 0.15s ease;
}

.switch-hotspot::after {
	content: attr(data-label);
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	font-size: 8px;
	font-weight: 800;
}

.switch-hotspot.is-b {
	background: var(--orange);
}

.switch-hotspot:hover {
	transform: translate(-50%, -50%) scale(1.18);
}

.switch-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
	gap: 10px;
}

.switch-card {
	border: 1px solid var(--line);
	background: var(--surface-2);
	border-radius: 11px;
	padding: 11px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	transition: 0.16s ease;
}

.switch-card:hover {
	border-color: #c8d8ea;
	background: #fff;
}

.switch-card strong {
	display: block;
	font-size: 11.5px;
}

.switch-card small {
	display: block;
	margin-top: 2px;
	font-size: 9.5px;
	color: var(--muted);
}

.switch-toggle {
	position: relative;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	border: 0;
	background: var(--orange);
	transition: 0.18s ease;
	flex: 0 0 44px;
}

.switch-toggle::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	transition: transform 0.18s ease;
}

.switch-toggle.is-a {
	background: var(--green);
}

.switch-toggle.is-a::after {
	transform: translateX(20px);
}

/* Grue */
.crane-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 16px;
}

.axis-row {
	display: grid;
	grid-template-columns: 100px 1fr auto;
	gap: 10px;
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px dashed var(--line);
}

.axis-row:last-child {
	border-bottom: 0;
}

.axis-row > label {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--ink-soft);
}

.axis-buttons {
	display: flex;
	gap: 6px;
	align-items: center;
}

.axis-buttons input {
	width: 58px;
	text-align: center;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 6px;
	font-size: 12px;
	outline: none;
}

.axis-value {
	min-width: 58px;
	text-align: right;
	font-size: 15px;
	font-weight: 750;
	font-variant-numeric: tabular-nums;
}

.magnet-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	padding: 12px;
	border-radius: 11px;
	background: var(--surface-2);
	border: 1px solid var(--line);
}

.magnet-toggle strong {
	font-size: 12px;
}

.magnet-toggle small {
	display: block;
	margin-top: 2px;
	font-size: 10.5px;
	color: var(--muted);
}

/* AGV / drones */
.mission-form {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 8px;
	align-items: end;
	margin-top: 4px;
}

.mission-form .field {
	gap: 4px;
}

.mission-form input {
	padding: 7px 9px;
	font-size: 12px;
}

.progress {
	height: 5px;
	border-radius: 99px;
	background: var(--bg-deep);
	overflow: hidden;
	margin-top: 7px;
}

.progress i {
	display: block;
	height: 100%;
	background: var(--accent);
	border-radius: inherit;
	transition: width 0.4s ease;
}

.drone-card .altitude {
	display: flex;
	align-items: baseline;
	gap: 4px;
}

.drone-card .altitude strong {
	font-size: 22px;
}

.drone-card .altitude span {
	font-size: 11px;
	color: var(--muted);
}

/* Topics */
.topic-side {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

[data-view="topics"] > * + * {
	margin-top: 18px;
}

.topic-table {
	font-size: 11.5px;
}

.topic-table th,
.topic-table td {
	padding-left: 5px;
	padding-right: 5px;
	vertical-align: top;
}

.topic-table th:nth-child(4) {
	width: 44%;
}

.topic-table th:nth-child(5) {
	width: 118px;
}

.topic-table td:nth-child(4) {
	max-width: 230px;
}

.topic-table code {
	font-size: 10.5px;
	padding: 2px 6px;
	border-radius: 5px;
	background: var(--surface-2);
	color: var(--violet);
	white-space: nowrap;
}

.topic-table .last-payload {
	max-width: 120px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
	font-size: 10px;
	color: var(--muted);
}

.publish-form {
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.command-log {
	display: flex;
	flex-direction: column;
	gap: 7px;
	max-height: 430px;
	overflow: auto;
}

.command-entry {
	padding: 9px 11px;
	border-radius: 9px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	font-size: 11px;
}

.command-entry header {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	align-items: center;
	margin-bottom: 3px;
}

.command-entry code {
	font-size: 10.5px;
	color: var(--violet);
}

.command-entry p {
	margin: 0;
	color: var(--muted);
	font-size: 10.5px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.command-entry .ok {
	color: var(--green);
}
.command-entry .ko {
	color: var(--red);
}

/* État vide */
.empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 34px 16px;
	color: var(--muted);
	text-align: center;
	font-size: 12px;
}

.empty svg {
	width: 30px;
	height: 30px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.6;
	opacity: 0.6;
}

/* ------------------------------------------------------------------ */
/* Toasts et modales                                                  */
/* ------------------------------------------------------------------ */
.toast-stack {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 120;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: min(360px, calc(100vw - 40px));
}

.toast {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 13px 14px;
	border-radius: 12px;
	background: var(--surface);
	border: 1px solid var(--line);
	box-shadow: var(--shadow);
	animation: toast-in 0.22s ease;
}

.toast .toast-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--accent);
	margin-top: 5px;
	flex: 0 0 8px;
}

.toast.success .toast-dot {
	background: var(--green);
}
.toast.error .toast-dot {
	background: var(--red);
}
.toast.warning .toast-dot {
	background: var(--orange);
}

.toast p {
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
}

@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 110;
	background: rgba(20, 36, 56, 0.42);
	backdrop-filter: blur(3px);
	display: grid;
	place-items: center;
	padding: 20px;
	animation: fade 0.16s ease;
}

@keyframes fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.modal {
	width: min(470px, 100%);
	max-height: calc(100vh - 40px);
	overflow: auto;
	background: var(--surface);
	border-radius: 18px;
	box-shadow: 0 30px 80px rgba(14, 33, 56, 0.3);
	padding: 22px;
}

.modal h2 {
	margin: 0;
	font-size: 17px;
}

.modal .modal-sub {
	margin: 5px 0 18px;
	font-size: 11.5px;
	color: var(--muted);
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 9px;
	margin-top: 20px;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 1180px) {
	.overview-grid,
	.overview-bottom,
	.topic-side,
	.switch-layout {
		grid-template-columns: minmax(0, 1fr);
	}
	.kpi-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.sidebar {
		transform: translateX(-103%);
		box-shadow: 20px 0 60px rgba(20, 40, 70, 0.16);
	}
	.sidebar.open {
		transform: translateX(0);
	}
	.main {
		margin-left: 0;
	}
	.menu-toggle {
		display: inline-flex;
	}
	.topbar {
		padding: 18px 18px 12px;
	}
	.view-root {
		padding: 2px 18px 40px;
	}
	.page-heading h1 {
		font-size: 22px;
	}
}

@media (max-width: 640px) {
	.kpi-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.topbar-actions {
		width: 100%;
		justify-content: space-between;
	}
	.clock-block {
		display: none;
	}
	.form-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.form-grid .span-2 {
		grid-column: auto;
	}
	.robot-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.mission-form {
		grid-template-columns: 1fr 1fr;
	}
	.mission-form .btn {
		grid-column: span 2;
	}
}

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