*, *::before, *::after {
	box-sizing: border-box;
}

html, body {
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	font-family: system-ui, sans-serif;
	font-size: 14px;
	background: #fff;
	color: #222;
}

#main {
	height: 100%;
	display: flex;
	flex-direction: row;
}

#map {
	flex: 1;
	height: 100%;
}

#sidebar {
	width: 340px;
	max-width: 40%;
	height: 100%;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	border-left: 1px solid #ddd;
}

#sidebar h2 { margin: 0; font-size: 18px; }
#sidebar h3 { margin: 12px 0 4px; font-size: 14px; }
#sidebar p { margin: 4px 0; }
#sidebar ul { margin: 0; padding-left: 0; list-style: none; }
#sidebar li { padding: 3px 0; }
#sidebar small { color: #666; }
#sidebar a { color: #0b57d0; }

#content { flex: 1; }

#error {
	background: #fde8e8;
	color: #8a1111;
	border: 1px solid #f3b4b4;
	padding: 8px;
	border-radius: 4px;
}

#problems {
	background: #fff6e0;
	border: 1px solid #f0d48a;
	padding: 6px 8px;
	border-radius: 4px;
	font-size: 12px;
}
#problems ul { padding-left: 16px !important; list-style: disc !important; }
#problems summary { cursor: pointer; font-weight: 600; }

/* editor */
#editor-bar { display: flex; flex-direction: column; gap: 4px; }
.editor-login, .editor-active { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.editor-login input { flex: 1; min-width: 0; }
.editor-active { background: #e8f0fe; border: 1px solid #b6cdf8; border-radius: 4px; padding: 6px 8px; }
.editor-active strong { flex: 1; }

#sidebar button {
	font: inherit;
	font-size: 13px;
	padding: 3px 10px;
	border: 1px solid #b9c0c8;
	border-radius: 4px;
	background: #f6f7f9;
	cursor: pointer;
}
#sidebar button:hover { background: #eceef2; }
#sidebar button.small { font-size: 12px; padding: 1px 6px; }
#sidebar button.primary { background: #0b57d0; border-color: #0b57d0; color: #fff; }
#sidebar button.danger { color: #b3121f; border-color: #e3a1a7; }

.link-form { display: flex; flex-direction: column; gap: 4px; }
.link-form label { font-size: 12px; font-weight: 600; margin-top: 8px; }
.link-form label.checkbox { font-weight: normal; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.link-form input, .link-form select { font: inherit; font-size: 13px; padding: 3px 5px; min-width: 0; }
.link-form .row { display: flex; gap: 4px; }
.link-form .row input { flex: 1; }
/* výběr portu: zařízení na prvním řádku, port pod ním */
.port-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 4px; padding: 4px; background: #f6f7f9; border-radius: 4px; }
.port-row input { grid-column: 1; }
.port-row select { grid-column: 1; }
.port-row button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.ports { display: flex; flex-direction: column; gap: 4px; }
.link-form .buttons { display: flex; gap: 6px; margin-top: 12px; }
.form-message { color: #8a1111; font-size: 12px; min-height: 1em; }

#controls {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

#filter-info:empty { display: none; }
#filter-info { color: #666; font-size: 12px; }

#legend, #legend-widths { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; align-items: center; }
#legend-widths i { width: 18px; }
.legend-title { color: #666; }
#legend i, #legend-widths i, .swatch {
	display: inline-block;
	width: 14px;
	height: 3px;
	margin-right: 4px;
	vertical-align: middle;
}

.hint { color: #888; font-size: 12px; }

#status { color: #888; font-size: 12px; }

.status {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: 6px;
}
.status.up { background: #2e9e44; }
.status.down { background: #d4111e; }

/* popisky provozu na spojích */
.traffic-label {
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid #b9c0c8;
	border-radius: 3px;
	padding: 0 3px;
	font-weight: 600;
	white-space: nowrap;
}

/* popisky markerů */
.label {
	background-color: rgba(0, 0, 0, 0.75);
	padding: 1px 4px;
	border-radius: 3px;
	white-space: nowrap;
}
.label-down {
	background-color: rgba(212, 17, 30, 0.9);
}

@media (max-width: 700px) {
	#main { flex-direction: column; }
	#map { height: 60%; flex: none; }
	#sidebar { width: 100%; max-width: none; height: 40%; border-left: 0; border-top: 1px solid #ddd; }
}
