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

/* ── Base (mobile-first) ──────────────────────────── */

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: #f5f5f5;
	color: #222;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Top bar ──────────────────────────────────────── */

.harvest-header {
	flex-shrink: 0;
	background: #fff;
	border-bottom: 1px solid #e5e7eb;
	padding: 14px 24px;
}

.harvest-header__inner {
	display: flex;
	align-items: center;
	justify-content: center;   /* centered on mobile */
	max-width: 1100px;
	margin: 0 auto;
	gap: 16px;
}

/* Hidden on mobile, shown on desktop */
.harvest-client-name {
	display: none;
	font-weight: 600;
	font-size: 1rem;
	color: #111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.harvest-month-form {
	display: flex;
	align-items: center;
	gap: 10px;
}

.harvest-month-form label {
	font-size: 0.875rem;
	font-weight: 500;
	color: #555;
}

.harvest-month-form select {
	padding: 6px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	background: #fff;
	cursor: pointer;
	appearance: auto;
}

.harvest-month-form select:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 1px;
}

/* ── Main (mobile: normal flow, page scrolls) ─────── */

.harvest-main {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 24px;
}

/* ── Content block ────────────────────────────────── */

.harvest-content {
	display: flex;
	flex-direction: column;
	gap: 32px;
	width: 100%;
	max-width: 860px;
}

.harvest-chart-wrap {
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
}

/* ── Table (mobile: no internal scroll) ──────────── */

.harvest-table-scroll {
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.harvest-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	background: #fff;
}

.harvest-table th,
.harvest-table td {
	padding: 10px 16px;
	text-align: left;
	border-bottom: 1px solid #eee;
}

.harvest-table thead th {
	background: #f7f7f7;
	font-weight: 600;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #555;
}

.harvest-table tbody tr {
	cursor: pointer;
	transition: background-color 0.1s;
}

.harvest-table tbody tr.is-highlighted {
	background-color: #eff6ff;
}

.harvest-table tbody tr:last-child td {
	border-bottom: none;
}

.harvest-table tfoot th {
	background: #f0f0f0;
	border-top: 2px solid #ddd;
	border-bottom: none;
}

/* Dot injected by JS */
.harvest-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 8px;
	vertical-align: middle;
}

/* ── Desktop: no page scroll, list scrolls when tall ─ */

@media (min-width: 1024px) {

	/* Lock the page — no scroll ever */
	html, body {
		height: 100%;
		overflow: hidden;
	}

	/* WordPress admin bar adds margin-top: 32px to html, pushing body 32px below
	   the viewport bottom. Subtract it so the layout stays within the screen. */
	.admin-bar body {
		height: calc(100% - 32px);
	}

	/* Client name on left, month form on right */
	.harvest-header__inner {
		justify-content: space-between;
	}

	.harvest-client-name {
		display: block;
	}

	/*
	 * stretch (not center) so .harvest-content fills the content box exactly —
	 * this makes max-height: 100% on the table resolve to the padded area,
	 * preserving equal spacing at top and bottom.
	 */
	.harvest-main {
		min-height: 0;
		overflow: hidden;
		padding: 40px 48px;
		align-items: stretch;
	}

	/* Side-by-side; align-items: center keeps both columns naturally sized */
	.harvest-content {
		flex-direction: row;
		align-items: center;
		max-width: 1100px;
		gap: 48px;
		min-height: 0;
	}

	/* Chart: naturally sized, centred vertically by parent */
	.harvest-chart-wrap {
		flex: 0 0 55%;
		max-width: none;
		margin: 0;
	}

	/*
	 * Table: shrinks to content when short, grows to fill available space,
	 * then scrolls. max-height: 100% resolves to .harvest-content's height
	 * which equals .harvest-main's content box — padding is respected on
	 * both top and bottom.
	 */
	.harvest-table-scroll {
		flex: 1;
		min-height: 0;
		overflow-y: auto;
		max-height: 100%;
	}

	/* Sticky header/footer only needed when the list can scroll */
	.harvest-table thead th {
		position: sticky;
		top: 0;
		z-index: 1;
	}

	.harvest-table tfoot th {
		position: sticky;
		bottom: 0;
	}
}

/* ── Home page message ────────────────────────────── */

.harvest-home-message {
	max-width: 480px;
	text-align: center;
	font-size: 1rem;
	color: #555;
	line-height: 1.6;
	padding: 0 24px;
}

/* ── Status messages ──────────────────────────────── */

.harvest-notice {
	padding: 14px 18px;
	border-radius: 6px;
	font-size: 0.9rem;
	line-height: 1.5;
	max-width: 600px;
}

.harvest-notice--error {
	background: #fdf2f2;
	border: 1px solid #f5c6cb;
	color: #721c24;
}

.harvest-notice--empty {
	background: #fff8e1;
	border: 1px solid #ffe082;
	color: #5d4037;
}
