/* Azoty: style własne (mobile-first), uzupełnienie Pico CSS */
:root {
	--pico-font-size: 100%;
	--azoty-green: #2e7d32;
	--azoty-red: #c62828;
	--azoty-yellow: #f9a825;
}

button,
[role="button"],
input[type="submit"],
select {
	min-height: 44px;
}

.small {
	font-size: 0.875rem;
}

button.small,
[role="button"].small {
	padding: 0.4rem 0.7rem;
	font-size: 0.875rem;
}

.narrow {
	max-width: 32rem;
}

.site-header nav {
	flex-wrap: wrap;
}

.site-header .nav-links {
	flex-wrap: wrap;
}

.brand {
	font-size: 1.25rem;
}

.inline-form {
	display: inline;
	margin: 0;
}

.inline-form button {
	margin: 0;
	width: auto;
}

.flash {
	padding: 0.75rem 1rem;
	border-radius: var(--pico-border-radius);
	border-left: 0.35rem solid;
}

.flash-ok {
	border-color: var(--azoty-green);
	background: rgba(46, 125, 50, 0.08);
}

.flash-error {
	border-color: var(--azoty-red);
	background: rgba(198, 40, 40, 0.08);
}

.flash-warn {
	border-color: var(--azoty-yellow);
	background: rgba(249, 168, 37, 0.12);
}

.badge {
	display: inline-block;
	padding: 0.1rem 0.5rem;
	border-radius: 1rem;
	font-size: 0.8rem;
	background: var(--pico-muted-border-color);
	white-space: nowrap;
}

.badge-green {
	background: rgba(46, 125, 50, 0.18);
}

.badge-red {
	background: rgba(198, 40, 40, 0.2);
}

.badge-yellow {
	background: rgba(249, 168, 37, 0.3);
}

button.danger {
	background: var(--azoty-red);
	border-color: var(--azoty-red);
}

.site-footer {
	margin-top: 3rem;
	padding-bottom: 2rem;
	border-top: 1px solid var(--pico-muted-border-color);
}

.disclaimer {
	font-size: 0.9rem;
	font-style: italic;
}

.table-wrap {
	overflow-x: auto;
}

table td.num,
table th.num {
	text-align: right;
	white-space: nowrap;
}

.actions {
	white-space: nowrap;
}

.tiles {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}

.tiles li {
	list-style: none;
}

.tiles a {
	display: block;
	padding: 1rem;
	border: 1px solid var(--pico-muted-border-color);
	border-radius: var(--pico-border-radius);
	text-decoration: none;
	min-height: 44px;
}

@media (min-width: 768px) {
	.tiles {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* menu gospodarstwa */
.farm-nav {
	border-bottom: 1px solid var(--pico-muted-border-color);
	margin-bottom: 1rem;
	display: block;
}

.farm-nav-title {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
}

.farm-nav ul {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 0.25rem;
	padding: 0;
	margin: 0.5rem 0 0;
}

.farm-nav li {
	list-style: none;
	padding: 0;
}

.farm-nav a {
	display: inline-block;
	padding: 0.6rem 0.8rem;
	white-space: nowrap;
	min-height: 44px;
	text-decoration: none;
	border-bottom: 3px solid transparent;
}

.farm-nav a.active {
	border-bottom-color: var(--pico-primary);
	font-weight: bold;
}

.season-form {
	margin: 0;
}

.season-form label {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin: 0;
}

.season-form select {
	margin: 0;
	width: auto;
}

/* pulpit */
.kpis {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.kpi {
	padding: 0.75rem;
	border: 1px solid var(--pico-muted-border-color);
	border-radius: var(--pico-border-radius);
}

.kpi .value {
	font-size: 1.4rem;
	font-weight: bold;
	display: block;
}

.kpi .label {
	font-size: 0.85rem;
}

.kpi.ok {
	border-left: 0.35rem solid var(--azoty-green);
}

.kpi.warn {
	border-left: 0.35rem solid var(--azoty-yellow);
}

.kpi.bad {
	border-left: 0.35rem solid var(--azoty-red);
}

@media (min-width: 768px) {
	.kpis {
		grid-template-columns: repeat(4, 1fr);
	}
}

.warnings li.red::marker {
	color: var(--azoty-red);
}

.warnings li.yellow::marker {
	color: var(--azoty-yellow);
}

.warn-red {
	color: var(--azoty-red);
	font-weight: bold;
}

.warn-yellow {
	color: #8a6d00;
	font-weight: bold;
}

.meter {
	height: 0.8rem;
	background: var(--pico-muted-border-color);
	border-radius: 0.4rem;
	overflow: hidden;
}

.meter > span {
	display: block;
	height: 100%;
	background: var(--azoty-green);
}

.meter.over > span {
	background: var(--azoty-red);
}

/* mapa */
.map-layout {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

#map {
	height: 60vh;
	min-height: 320px;
	border-radius: var(--pico-border-radius);
	z-index: 0;
}

.map-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.map-tools button,
.map-tools [role="button"] {
	width: auto;
	margin: 0;
}

.side-panel {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 60vh;
	overflow-y: auto;
	background: var(--pico-background-color);
	border-top: 2px solid var(--pico-primary);
	padding: 1rem;
	z-index: 1000;
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.side-panel[hidden] {
	display: none;
}

.side-panel .close {
	float: right;
	width: auto;
}

@media (min-width: 1024px) {
	.map-layout {
		flex-direction: row;
	}

	.map-layout .map-col {
		flex: 3;
	}

	.map-layout .list-col {
		flex: 2;
		max-height: 80vh;
		overflow-y: auto;
	}

	#map {
		height: 75vh;
	}

	.side-panel {
		left: auto;
		top: 5rem;
		bottom: auto;
		right: 1rem;
		width: 26rem;
		max-height: 80vh;
		border: 1px solid var(--pico-muted-border-color);
		border-radius: var(--pico-border-radius);
	}
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	font-size: 0.85rem;
	margin: 0.5rem 0;
	padding: 0;
}

.legend li {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.swatch {
	display: inline-block;
	width: 1rem;
	height: 1rem;
	border-radius: 0.2rem;
	border: 1px solid rgba(0, 0, 0, 0.3);
	vertical-align: middle;
}

.field-label {
	background: rgba(255, 255, 255, 0.85);
	border: none;
	box-shadow: none;
	font-size: 0.75rem;
	padding: 0.1rem 0.3rem;
	line-height: 1.2;
	text-align: center;
	color: #111;
}

.map-message {
	padding: 0.5rem 0.75rem;
}

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.filters input,
.filters select {
	width: auto;
	margin: 0;
}

th[data-sort] {
	cursor: pointer;
	user-select: none;
}

th[data-sort]::after {
	content: " ⇅";
	font-size: 0.75em;
	opacity: 0.5;
}

tfoot td {
	font-weight: bold;
}

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

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

	.grid-form .full {
		grid-column: 1 / -1;
	}
}

.crops-table input,
.crops-table select {
	margin: 0;
	min-width: 6rem;
	padding: 0.4rem;
}

.temp-password {
	font-size: 1.1rem;
	user-select: all;
}

.hint {
	font-size: 0.85rem;
	color: var(--pico-muted-color);
}

.status-ok {
	color: var(--azoty-green);
	font-weight: bold;
}

.status-bad {
	color: var(--azoty-red);
	font-weight: bold;
}

.status-warn {
	color: #8a6d00;
	font-weight: bold;
}
