/**
 * GSTL Staff Dashboard — matches the UX prototype's layout: a branded
 * topbar, KPI stat cards, a 2-week Mon–Fri production calendar with crew
 * selectors and job cards, tabular order/lead lists, and a go-live
 * checklist. Shared, unscoped variable names so the same rules apply
 * identically inside wp-admin (wrapped in `.gstl-staff-dashboard` inside
 * `.wrap`) and on the front-end shortcode (same wrapper class).
 */
.gstl-staff-dashboard {
	--gstl-green-900: #123822;
	--gstl-green-800: #1a4d2e;
	--gstl-green-700: #22622e;
	--gstl-green-600: #2e7d32;
	--gstl-green-500: #3f9142;
	--gstl-green-100: #e7f3e6;
	--gstl-green-50: #f3f9f1;
	--gstl-ink-900: #1c2321;
	--gstl-ink-700: #3d4a44;
	--gstl-ink-500: #647169;
	--gstl-ink-300: #a6b0aa;
	--gstl-line: #dde5df;
	--gstl-bg: #f6f8f5;
	--gstl-amber: #b3690a;
	--gstl-amber-bg: #fdf2e3;
	--gstl-red: #b3261e;
	--gstl-red-bg: #fbeceb;
	--gstl-blue: #1a5bab;
	--gstl-blue-bg: #eaf1fb;
	--gstl-radius: 12px;
	--gstl-shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 4px 16px rgba(20, 30, 25, 0.05);

	max-width: 1280px;
	color: var(--gstl-ink-900);
	line-height: 1.45;
}

.gstl-staff-dashboard * {
	box-sizing: border-box;
}

.gstl-dashboard-notice {
	background: var(--gstl-amber-bg);
	border: 1px solid #f0d9b5;
	color: #7a4a08;
	border-radius: 8px;
	padding: 12px 14px;
	max-width: 480px;
}

.gstl-dashboard-hint {
	font-size: 12.5px;
	color: var(--gstl-ink-500);
	margin: 0 0 12px;
}

/* Toolbar (print button, etc.) */
.gstl-dashboard-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 14px;
}

/* Topbar */
.gstl-topbar {
	background: var(--gstl-green-800);
	color: #fff;
	padding: 12px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	border-radius: var(--gstl-radius);
	margin-bottom: 18px;
	box-shadow: var(--gstl-shadow);
}

.gstl-topbar-brand {
	font-weight: 700;
	font-size: 15px;
}

.gstl-topbar-tabs {
	display: flex;
	gap: 6px;
	background: rgba(255, 255, 255, 0.12);
	padding: 4px;
	border-radius: 10px;
	overflow-x: auto;
	max-width: 100%;
}

.gstl-topbar-tabs a,
.gstl-topbar-tabs span {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	color: #e9f2e8;
	text-decoration: none;
}

.gstl-topbar-tabs a:hover {
	background: rgba(255, 255, 255, 0.15);
}

.gstl-topbar-tabs span.active {
	background: #fff;
	color: var(--gstl-green-800);
}

/* KPI cards */
.gstl-dashboard-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 18px;
}

.gstl-kpi-card {
	background: #fff;
	border: 1px solid var(--gstl-line);
	border-radius: var(--gstl-radius);
	padding: 14px 16px;
	box-shadow: var(--gstl-shadow);
	text-align: center;
}

.gstl-kpi-value {
	font-size: 24px;
	font-weight: 800;
	color: var(--gstl-green-800);
}

.gstl-kpi-label {
	font-size: 11px;
	color: var(--gstl-ink-500);
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 700;
}

.gstl-kpi-card.gstl-kpi-warn .gstl-kpi-value {
	color: var(--gstl-amber);
}

.gstl-kpi-card.gstl-kpi-warn {
	border-color: #f0d9b5;
	background: var(--gstl-amber-bg);
}

/* Cards + tables */
.gstl-dashboard-card {
	background: #fff;
	border: 1px solid var(--gstl-line);
	border-radius: var(--gstl-radius);
	padding: 18px;
	margin-bottom: 18px;
	box-shadow: var(--gstl-shadow);
}

.gstl-dashboard-card h2 {
	font-size: 16px;
	margin: 0 0 8px;
}

.gstl-dashboard-flex-between {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.gstl-dashboard-flex-between h2 {
	margin: 0;
}

.gstl-dashboard-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.gstl-dashboard-table th,
.gstl-dashboard-table td {
	text-align: left;
	padding: 8px 10px;
	border-bottom: 1px solid var(--gstl-line);
	vertical-align: top;
}

.gstl-dashboard-table th {
	color: var(--gstl-ink-500);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 700;
}

.gstl-dashboard-table tr:last-child td {
	border-bottom: none;
}

.gstl-dashboard-empty {
	color: var(--gstl-ink-500);
	font-size: 13px;
	padding: 10px 0;
}

/* Status / lead badges */
.gstl-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

.gstl-badge-processing,
.gstl-badge-completed {
	background: var(--gstl-green-100);
	color: var(--gstl-green-800);
}

.gstl-badge-on-hold,
.gstl-badge-pending {
	background: var(--gstl-amber-bg);
	color: var(--gstl-amber);
}

.gstl-badge-cancelled,
.gstl-badge-refunded,
.gstl-badge-failed {
	background: var(--gstl-red-bg);
	color: var(--gstl-red);
}

.gstl-badge-lead {
	background: var(--gstl-blue-bg);
	color: var(--gstl-blue);
	margin-left: 6px;
}

/* The freight-review badge is a <button>, not a <span> — reset button
   chrome so it still reads as a pill badge, but stays obviously clickable. */
.gstl-badge-freight-review {
	display: inline-block;
	margin-left: 6px;
	margin-top: 4px;
	border: 1px solid var(--gstl-amber);
	background: var(--gstl-amber-bg);
	color: var(--gstl-amber);
	cursor: pointer;
	font-family: inherit;
}

.gstl-badge-freight-review:hover,
.gstl-badge-freight-review:focus {
	background: var(--gstl-amber);
	color: #fff;
}

.gstl-mark-paid {
	white-space: nowrap;
}

/* Block-out toggle button */
.gstl-toggle-block {
	font-size: 11px;
	font-weight: 700;
	text-decoration: none;
	color: var(--gstl-ink-700);
	background: #fff;
	border: 1px solid var(--gstl-line);
	border-radius: 6px;
	padding: 2px 8px;
	white-space: nowrap;
	cursor: pointer;
}

.gstl-toggle-block:hover {
	border-color: var(--gstl-red);
	color: var(--gstl-red);
}

.gstl-toggle-block.is-blocked {
	background: var(--gstl-red-bg);
	border-color: #f0c9c6;
	color: var(--gstl-red);
}

.gstl-toggle-block:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Per-cell print button */
.gstl-cal-print-btn {
	font-size: 11px;
	background: #fff;
	border: 1px solid var(--gstl-line);
	border-radius: 6px;
	padding: 1px 6px;
	cursor: pointer;
	line-height: 1.5;
	margin-left: 4px;
}

.gstl-cal-print-btn:hover {
	border-color: var(--gstl-green-500);
}

/* Production calendar */
.gstl-cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
	gap: 10px;
	flex-wrap: wrap;
}

.gstl-cal-range-label {
	font-weight: 700;
	font-size: 14px;
}

.gstl-cal-nav {
	background: var(--gstl-green-50);
	border: 1px solid var(--gstl-line);
	border-radius: 7px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--gstl-green-800);
	text-decoration: none;
	white-space: nowrap;
}

.gstl-cal-nav:hover {
	border-color: var(--gstl-green-500);
}

.gstl-cal-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
}

.gstl-cal-dow {
	font-size: 10.5px;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--gstl-ink-500);
	text-align: center;
	padding-bottom: 4px;
}

/* Hidden by default (the .gstl-cal-dow header row above already names the
   weekday); shown inline per-cell once that header row is hidden in the
   single-column mobile agenda layout — see the max-width: 768px block. */
.gstl-cal-dow-inline {
	display: none;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--gstl-ink-500);
	margin-right: 4px;
}

.gstl-cal-cell {
	border: 1.5px solid var(--gstl-line);
	border-radius: 8px;
	padding: 8px;
	font-size: 12px;
	background: #fff;
}

.gstl-crew-cell {
	min-height: 220px;
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.gstl-cell-blocked {
	background: repeating-linear-gradient(
		45deg,
		var(--gstl-red-bg),
		var(--gstl-red-bg) 10px,
		#f5d9d7 10px,
		#f5d9d7 20px
	);
}

.gstl-cal-closed-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 800;
	color: var(--gstl-red);
	background: #fff;
	border: 1px solid var(--gstl-red);
	border-radius: 5px;
	padding: 2px 6px;
}

.gstl-cal-cell-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 4px;
}

.gstl-cal-dnum {
	font-weight: 700;
	font-size: 12.5px;
}

.gstl-day-total {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	color: var(--gstl-ink-700);
	background: var(--gstl-bg);
	border: 1px solid var(--gstl-line);
	border-radius: 5px;
	padding: 1px 6px;
	margin-left: 4px;
	white-space: nowrap;
}

.gstl-crew-select {
	background: var(--gstl-green-50);
	border: 1px solid var(--gstl-line);
	border-radius: 6px;
	font-size: 10px;
	font-weight: 700;
	color: var(--gstl-green-800);
	cursor: pointer;
	line-height: 1.4;
	padding: 3px 4px;
	flex: none;
	max-width: 92px;
}

.gstl-crew-select:hover {
	border-color: var(--gstl-green-500);
}

.gstl-crew-badge {
	font-size: 10px;
	font-weight: 700;
	color: var(--gstl-green-800);
	background: var(--gstl-green-100);
	border-radius: 5px;
	padding: 2px 6px;
	display: inline-block;
}

.gstl-crew-badge.muted {
	color: var(--gstl-ink-500);
	background: var(--gstl-bg);
}

.gstl-crew-job {
	background: var(--gstl-green-50);
	border-radius: 5px;
	padding: 4px 6px;
	font-size: 10.5px;
	line-height: 1.3;
}

.gstl-crew-job.warn {
	background: var(--gstl-amber-bg);
	color: #7a4a08;
}

.gstl-crew-job-fulfilment {
	font-size: 9px;
	font-weight: 700;
	color: var(--gstl-ink-700);
	margin-top: 2px;
}

.gstl-crew-job-status {
	font-size: 9px;
	opacity: 0.8;
	margin-top: 1px;
}

.gstl-cal-cell-foot {
	margin-top: auto;
	padding-top: 4px;
}

/* Go-live checklist */
.gstl-checklist {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gstl-checklist li {
	padding: 6px 0 6px 26px;
	position: relative;
	font-size: 13px;
	border-bottom: 1px solid var(--gstl-line);
}

.gstl-checklist li:last-child {
	border-bottom: none;
}

.gstl-checklist li::before {
	content: "○";
	position: absolute;
	left: 2px;
	color: var(--gstl-ink-300);
}

.gstl-checklist li.is-ok::before {
	content: "✅";
	left: 0;
}

.gstl-checklist li.is-pending::before {
	content: "⏳";
	left: 0;
}

/* Buttons */
.gstl-btn-secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 14px;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	background: #fff;
	color: var(--gstl-green-800);
	border: 1.5px solid var(--gstl-green-700);
	text-decoration: none;
	white-space: nowrap;
}

.gstl-btn-secondary:hover {
	background: var(--gstl-green-50);
}

/* Freight review modal */
.gstl-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 30, 25, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	z-index: 10000;
}

.gstl-modal-overlay[hidden] {
	display: none;
}

.gstl-modal {
	background: #fff;
	border-radius: var(--gstl-radius);
	box-shadow: var(--gstl-shadow);
	padding: 24px;
	max-width: 440px;
	width: 100%;
	position: relative;
}

.gstl-modal h2 {
	margin: 0 0 14px;
	font-size: 17px;
	color: var(--gstl-amber);
}

.gstl-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--gstl-ink-500);
	padding: 4px;
}

.gstl-freight-modal-details {
	margin: 0 0 16px;
	font-size: 13px;
}

.gstl-freight-modal-details dt {
	color: var(--gstl-ink-500);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 700;
	margin-top: 8px;
}

.gstl-freight-modal-details dd {
	margin: 2px 0 0;
}

#gstl-freight-modal-form label {
	display: block;
	font-size: 12.5px;
	font-weight: 700;
	margin-bottom: 6px;
}

#gstl-freight-modal-cost {
	width: 100%;
	padding: 10px;
	border: 1.5px solid var(--gstl-line);
	border-radius: 8px;
	font-size: 15px;
	margin-bottom: 10px;
}

.gstl-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 10px;
}

/* ---------------------------------------------------------------------
 * Responsive polish
 * ------------------------------------------------------------------- */

/* Orders / Extra-service leads tables: scroll horizontally rather than
   compressing columns into unreadable widths. Not gated to a breakpoint —
   harmless at any width (no scrollbar appears unless the table is actually
   wider than its container, which in practice only happens on narrow
   viewports). */
.gstl-table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.gstl-table-responsive .gstl-dashboard-table {
	min-width: 760px;
}

@media (max-width: 860px) {
	.gstl-cal-grid {
		grid-template-columns: repeat(5, minmax(90px, 1fr));
		overflow-x: auto;
	}
}

@media (max-width: 768px) {
	/* Calendar header toolbar: range label left, prev/next grouped right. */
	.gstl-cal-head {
		justify-content: flex-start;
	}
	.gstl-cal-range-label {
		order: 1;
	}
	.gstl-cal-nav:first-of-type {
		order: 2;
		margin-left: auto;
	}
	.gstl-cal-nav:last-of-type {
		order: 3;
	}

	/* Production calendar: a single-column agenda feed instead of a 5-wide
	   grid — each weekday is shown as its own full-width, spacious card.
	   The Mon–Fri header row is hidden since it no longer lines up with
	   anything; each cell's day number already carries its own weekday
	   abbreviation (see GSTL_Staff_Dashboard::render_crew_cell()). */
	.gstl-cal-grid {
		grid-template-columns: 1fr;
		overflow-x: visible;
	}
	.gstl-cal-dow {
		display: none;
	}
	.gstl-cal-dow-inline {
		display: inline;
	}
	.gstl-crew-cell {
		min-height: 0;
		padding: 14px;
	}
	.gstl-crew-select {
		padding: 8px;
		font-size: 14px;
	}
	.gstl-cal-cell-foot .gstl-toggle-block,
	.gstl-cal-cell-foot .gstl-cal-print-btn {
		padding: 8px 12px;
		font-size: 13px;
	}
}

@media (max-width: 700px) {
	.gstl-dashboard-table {
		font-size: 12px;
	}
	.gstl-dashboard-table th,
	.gstl-dashboard-table td {
		padding: 6px;
	}
}

/* ---------------------------------------------------------------------
 * Printable daily harvest cut-sheet
 *
 * Each .gstl-print-sheet is a complete, self-contained A4 sheet for one
 * day, rendered once per visible calendar cell plus one for "today" (see
 * class-gstl-staff-dashboard.php). Hidden on screen always; the one the
 * customer picked gets `.is-printing` added by staff-dashboard.js right
 * before window.print(), and is the only thing visible in that print pass.
 * ------------------------------------------------------------------- */
.gstl-print-sheet {
	display: none;
}

@media print {
	@page {
		size: A4;
		margin: 15mm;
	}

	body * {
		visibility: hidden;
	}

	.gstl-print-sheet.is-printing,
	.gstl-print-sheet.is-printing * {
		visibility: visible;
	}

	.gstl-print-sheet.is-printing {
		display: block !important;
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		color: #000;
		background: #fff;
	}

	.gstl-print-sheet h1 {
		font-size: 18px;
		margin: 0 0 10px;
		border-bottom: 2px solid #000;
		padding-bottom: 6px;
		color: #000;
	}

	.gstl-print-header {
		width: 100%;
		border-collapse: collapse;
		margin-bottom: 14px;
		font-size: 12px;
	}

	.gstl-print-header th {
		text-align: left;
		padding: 3px 14px 3px 0;
		font-weight: 700;
		white-space: nowrap;
		color: #000;
	}

	.gstl-print-header td {
		padding: 3px 0;
		color: #000;
	}

	.gstl-print-table {
		width: 100%;
		border-collapse: collapse;
		font-size: 11px;
	}

	.gstl-print-table th,
	.gstl-print-table td {
		border: 1px solid #000;
		padding: 4px 6px;
		text-align: left;
		color: #000;
	}

	.gstl-print-table tr.gstl-print-unpaid td {
		font-weight: 800;
	}
}
