// Questo file fa parte di MyTown.
// MyTown è software libero: puoi ridistribuirlo e/o modificarlo secondo
// i termini della GNU Affero General Public License come pubblicata dalla
// Free Software Foundation, versione 3.
// Distribuito senza ALCUNA GARANZIA; vedi la GNU AGPL v3 per i dettagli.
// Copyright (C) Kondor Consulting & Services S.r.l.
// SPDX-License-Identifier: AGPL-3.0-or-later

// ============================================================
// DESIGN TOKENS
// ============================================================

:host {
	--hero-h: 240px;
	--card-radius: 20px;
	--item-radius: 14px;
	--spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

// ============================================================
// BARRA COMPATTA MANAGER (header collapsed)
// ============================================================

.mgr-collapsed-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	background: var(--ion-color-primary);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);

	.mgr-collapsed-bar-info {
		display: flex;
		align-items: center;
		gap: 8px;
		min-width: 0;

		ion-icon {
			font-size: 18px;
			flex-shrink: 0;
			opacity: 0.92;
		}
	}

	.mgr-collapsed-bar-name {
		font-size: 15px;
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.mgr-collapsed-bar-action {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		font-size: 12px;
		font-weight: 500;
		opacity: 0.92;
		flex-shrink: 0;

		ion-icon {
			font-size: 16px;
		}
	}

	&:active {
		opacity: 0.85;
	}
}

// ============================================================
// HERO
// ============================================================

.hero-section {
	position: relative;
	width: 100%;
	height: var(--hero-h);
	overflow: hidden;

	.hero-image-bg {
		position: absolute;
		inset: 0;
		background-size: cover;
		background-position: center;
		transform: scale(1.04);
	}

	.hero-dark-overlay {
		position: absolute;
		inset: 0;
		background: linear-gradient(
			to bottom,
			rgba(0, 0, 0, 0.04) 0%,
			rgba(0, 0, 0, 0.12) 40%,
			rgba(0, 0, 0, 0.52) 100%
		);
		pointer-events: none;
	}

	.hero-favorite-btn {
		position: absolute;
		top: 10px;
		right: 10px;
		z-index: 10;
		--background: rgba(255, 255, 255, 0.2);
		--background-hover: rgba(255, 255, 255, 0.35);
		--border-radius: 50%;
		--padding-start: 8px;
		--padding-end: 8px;
		--box-shadow: none;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		border: 1px solid rgba(255, 255, 255, 0.28);

		ion-icon {
			font-size: 22px;
			color: #fff;
			filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));

			&.is-favorite {
				color: #ff3b30;
			}
		}
	}

	.hero-collapse-btn {
		position: absolute;
		top: 10px;
		left: 10px;
		z-index: 10;
		--background: rgba(0, 0, 0, 0.35);
		--background-hover: rgba(0, 0, 0, 0.5);
		--border-radius: 50%;
		--padding-start: 8px;
		--padding-end: 8px;
		--box-shadow: none;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		border: 1px solid rgba(255, 255, 255, 0.28);

		ion-icon {
			font-size: 22px;
			color: #fff;
			filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
		}
	}

	&.hero-fallback {
		background: linear-gradient(135deg,
			var(--ion-color-primary, #1c6ea4) 0%,
			var(--ion-color-primary-shade, #0f4d80) 55%,
			#06335a 100%);

		.hero-image-fallback {
			display: flex;
			align-items: center;
			justify-content: center;
			background:
				radial-gradient(ellipse at 20% 30%, rgba(255, 255, 255, 0.18) 0%, transparent 50%),
				radial-gradient(ellipse at 80% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
				radial-gradient(circle at 50% 110%, rgba(255, 255, 255, 0.25) 0%, transparent 45%);
			transform: none;
		}

		.hero-fallback-icon {
			font-size: 96px;
			color: rgba(255, 255, 255, 0.92);
			filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.28));
			animation: heroIconIn 0.5s var(--spring) both;
		}
	}
}

@keyframes heroIconIn {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.9);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

// ============================================================
// HOME CONTAINER
// ============================================================

.home-container {
	padding: 0;
	background: var(--ion-background-color, #f8f8f8);

	&.has-hero {
		margin-top: -24px;
		position: relative;
		border-radius: 24px 24px 0 0;
		background: var(--ion-background-color, #f8f8f8);
		box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.14);
		z-index: 1;
	}
}

// ============================================================
// COMPANY HEADER
// ============================================================

.company-header {
	padding: 22px 20px 16px;
}

.company-name {
	font-size: 26px;
	font-weight: 800;
	letter-spacing: -0.6px;
	color: var(--ion-color-dark, #1c1c1e);
	margin: 0 0 5px;
	line-height: 1.1;
}

.company-desc {
	font-size: 13px;
	line-height: 1.55;
	color: var(--ion-color-medium);
	margin: 0 0 14px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.info-chips-row {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

.info-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: var(--ion-color-light, #f4f5f8);
	border-radius: 20px;
	padding: 5px 10px 5px 7px;
	font-size: 12px;
	font-weight: 500;
	color: var(--ion-color-dark-shade);
	cursor: pointer;

	ion-icon {
		font-size: 13px;
		color: var(--ion-color-primary);
		flex-shrink: 0;
	}

	span {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 170px;
	}
}

// ============================================================
// ACTION BUTTONS
// ============================================================

.action-row {
	display: flex;
	gap: 6px;
	padding: 0 16px 20px;
	overflow-x: auto;
	scrollbar-width: none;

	&::-webkit-scrollbar {
		display: none;
	}
}

.action-pill {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	flex-shrink: 0;
	min-width: 60px;

	span {
		font-size: 11px;
		font-weight: 500;
		color: var(--ion-color-dark-shade);
		white-space: nowrap;
		letter-spacing: 0.1px;
	}
}

.action-pill-icon {
	width: 54px;
	height: 54px;
	border-radius: 16px;
	background: rgba(var(--ion-color-primary-rgb), 0.07);
	border: 1.5px solid rgba(var(--ion-color-primary-rgb), 0.14);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.14s var(--spring), background 0.14s ease;

	ion-icon {
		font-size: 22px;
		color: var(--ion-color-primary);
	}

	.action-pill:active & {
		transform: scale(0.9);
		background: rgba(var(--ion-color-primary-rgb), 0.16);
	}
}

// Tutte le pillole hanno lo stesso stile, come nel target biz-appointments.

// ============================================================
// SEGMENT NAV
// ============================================================

.segment-wrap {
	padding: 0 16px 0;
	border-bottom: 1.5px solid var(--ion-color-light-shade, #e5e6ea);
}

.home-segment {
	--background: transparent;

	ion-segment-button {
		--color: var(--ion-color-medium);
		--color-checked: var(--ion-color-primary);
		--indicator-color: var(--ion-color-primary);
		--indicator-height: 2.5px;
		--border-radius: 0;
		font-size: 10px;
		font-weight: 700;
		letter-spacing: 0.2px;
		min-height: 40px;
		text-transform: uppercase;

		ion-label {
			display: inline-flex;
			align-items: center;
			gap: 6px;
		}
	}
}

.seg-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 16px;
	padding: 0 5px;
	border-radius: 8px;
	font-size: 9px;
	font-weight: 800;
	background: rgba(var(--ion-color-primary-rgb), 0.12);
	color: var(--ion-color-primary);
	letter-spacing: 0.3px;
}

// ============================================================
// SECTION HEADER
// ============================================================

.tab-content {
	min-height: 200px;
}

.bookings-section {
	padding: 0;
}

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 16px 12px;
}

.section-title {
	font-size: 17px;
	font-weight: 800;
	letter-spacing: -0.4px;
	color: var(--ion-color-dark, #1c1c1e);
	margin: 0;
}

.section-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 22px;
	border-radius: 11px;
	background: var(--ion-color-primary);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 0 8px;
	letter-spacing: 0.2px;
}

// ============================================================
// LOADING + EMPTY STATE
// ============================================================

.loading-wrap {
	display: flex;
	justify-content: center;
	padding: 40px 16px;
}

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 48px 16px 32px;

	.empty-icon-wrap {
		width: 68px;
		height: 68px;
		border-radius: 22px;
		background: var(--ion-color-light, #f4f5f8);
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 16px;

		ion-icon {
			font-size: 32px;
			color: var(--ion-color-medium);
		}
	}

	p {
		font-size: 14px;
		color: var(--ion-color-medium);
		margin: 0;
		text-align: center;
		font-weight: 500;
	}
}

// ============================================================
// BOOKING CARD
// ============================================================

.booking-list {
	padding: 0 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.booking-card {
	display: flex;
	background: var(--ion-card-background, #fff);
	border-radius: var(--item-radius);
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
	cursor: pointer;
	transition: transform 0.13s var(--spring), box-shadow 0.2s ease;

	&:active {
		transform: scale(0.985);
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.03);
	}

	&.is-cancelled {
		opacity: 0.65;
	}
}

.bc-accent {
	width: 4px;
	align-self: stretch;
	flex-shrink: 0;
}

.bc-body {
	flex: 1;
	min-width: 0;
	padding: 14px 14px 12px;
}

.bc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.bc-resource {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.bc-resource-icon {
	font-size: 20px;
	color: var(--ion-color-primary);
	flex-shrink: 0;
}

.bc-resource-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--ion-color-dark);
	letter-spacing: -0.2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bc-status-badge {
	flex-shrink: 0;
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	padding: 4px 9px;
	border-radius: 8px;
	letter-spacing: 0.3px;
	text-transform: uppercase;
}

.bc-info-row {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	color: var(--ion-color-medium-shade);
	font-weight: 500;
	margin-bottom: 6px;

	ion-icon {
		font-size: 14px;
		color: var(--ion-color-medium);
		flex-shrink: 0;
	}
}

.bc-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 4px;
	padding-top: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.bc-amount {
	font-size: 17px;
	font-weight: 800;
	color: var(--ion-color-dark);
	letter-spacing: -0.4px;
}

.bc-pay-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	padding: 4px 8px 4px 6px;
	border-radius: 8px;

	ion-icon {
		font-size: 12px;
	}

	&.is-paid {
		background: rgba(var(--ion-color-success-rgb), 0.12);
		color: var(--ion-color-success-shade);
	}

	&.is-partial {
		background: rgba(255, 152, 0, 0.15);
		color: #b26a00;
	}

	&.is-unpaid {
		background: rgba(var(--ion-color-warning-rgb), 0.15);
		color: var(--ion-color-warning-shade);
	}

	&.is-none {
		background: rgba(var(--ion-color-medium-rgb), 0.15);
		color: var(--ion-color-medium-shade);
	}
}

.bc-amount--none {
	color: var(--ion-color-medium) !important;
	font-weight: 600 !important;
	font-size: 15px !important;
}

.bc-amount--secondary {
	font-size: 15px !important;
	font-weight: 700 !important;
	color: var(--ion-color-dark) !important;

	small {
		font-size: 10px;
		font-weight: 600;
		color: var(--ion-color-medium);
		margin-left: 4px;
		text-transform: uppercase;
		letter-spacing: 0.3px;
	}
}

.bc-pay-progress {
	height: 4px;
	background: var(--ion-color-light, #f4f5f8);
	border-radius: 4px;
	overflow: hidden;
	margin-top: 8px;
}

.bc-pay-bar {
	height: 100%;
	background: linear-gradient(90deg, var(--ion-color-success), var(--ion-color-success-shade));
	border-radius: 4px;
	transition: width 0.4s var(--ease-out);
	min-width: 4px;
}

.bc-actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

.bc-action-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 10px;
	border: 1px solid rgba(var(--ion-color-primary-rgb), 0.18);
	background: rgba(var(--ion-color-primary-rgb), 0.05);
	color: var(--ion-color-primary);
	border-radius: 10px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.2px;
	cursor: pointer;
	transition: transform 0.12s var(--spring), background 0.12s ease;

	ion-icon {
		font-size: 15px;
	}

	&:active {
		transform: scale(0.96);
		background: rgba(var(--ion-color-primary-rgb), 0.12);
	}

	&.bc-action-btn-accent {
		border-color: rgba(var(--ion-color-tertiary-rgb, 110, 80, 220), 0.22);
		background: rgba(var(--ion-color-tertiary-rgb, 110, 80, 220), 0.06);
		color: var(--ion-color-tertiary, #6e50dc);

		&:active {
			background: rgba(var(--ion-color-tertiary-rgb, 110, 80, 220), 0.14);
		}
	}
}

// ============================================================
// CHAT INIT MODAL
// ============================================================

.chat-init-modal {
	--border-radius: 28px 28px 0 0;
	--backdrop-opacity: 0.5;

	ion-backdrop {
		--backdrop-opacity: 0.5;
		backdrop-filter: blur(4px);
	}
}

.chat-modal-wrap {
	display: flex;
	flex-direction: column;
	padding: 0 0 calc(env(safe-area-inset-bottom) + 16px);
	background: #ffffff;
	border-radius: 28px 28px 0 0;
	min-height: 100%;
	animation: modalSlideUp 0.35s var(--spring) both;
}

@keyframes modalSlideUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.modal-handle-bar {
	width: 40px;
	height: 5px;
	background: #e0e0e0;
	border-radius: 3px;
	margin: 14px auto 0;
	flex-shrink: 0;
}

.chat-modal-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 24px 24px 0;
	animation: fadeUp 0.4s 0.08s var(--ease-out) both;
}

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.company-avatar-ring {
	flex-shrink: 0;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	padding: 2px;
	background: linear-gradient(135deg, #f0f0f0, #d8d8d8);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
}

.company-avatar-circle {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid rgba(255, 255, 255, 0.6);

	span {
		font-size: 20px;
		font-weight: 700;
		color: #ffffff;
		letter-spacing: -0.5px;
		text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	}
}

.chat-modal-company-info {
	flex: 1;
	min-width: 0;
}

.chat-company-name {
	font-size: 18px;
	font-weight: 700;
	color: #111;
	margin: 0 0 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	letter-spacing: -0.3px;
}

.chat-company-sub {
	font-size: 13px;
	color: #888;
	margin: 0;
	font-weight: 400;
}

.chat-modal-divider {
	height: 1px;
	background: linear-gradient(to right, transparent, #e8e8e8 20%, #e8e8e8 80%, transparent);
	margin: 20px 24px 0;
	animation: fadeUp 0.4s 0.12s var(--ease-out) both;
}

.chat-textarea-wrap {
	padding: 16px 20px 0;
	position: relative;
	animation: fadeUp 0.4s 0.16s var(--ease-out) both;

	.chat-textarea {
		--background: #f7f7f9;
		--border-radius: 16px;
		--padding-top: 14px;
		--padding-bottom: 14px;
		--padding-start: 16px;
		--padding-end: 16px;
		--placeholder-color: #aaa;
		--placeholder-opacity: 1;
		font-size: 15px;
		color: #111;
		border-radius: 16px;
		border: 1.5px solid transparent;
		transition: border-color 0.2s ease, box-shadow 0.2s ease;

		&:focus-within,
		&.has-focus {
			border-color: rgba(0, 122, 255, 0.3);
			box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
		}
	}
}

.char-counter {
	text-align: right;
	font-size: 11px;
	color: #bbb;
	padding: 6px 4px 0;
	font-variant-numeric: tabular-nums;
}

.chat-modal-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 20px 20px 8px;
	animation: fadeUp 0.4s 0.2s var(--ease-out) both;
}

.chat-send-btn {
	width: 100%;
	padding: 16px;
	border: none;
	border-radius: 16px;
	background: linear-gradient(135deg, var(--ion-color-primary), var(--ion-color-primary-shade));
	color: white;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.2px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 4px 16px rgba(var(--ion-color-primary-rgb), 0.35), 0 1px 4px rgba(var(--ion-color-primary-rgb), 0.2);
	transition: transform 0.15s var(--spring), box-shadow 0.15s ease, opacity 0.15s ease;

	ion-icon {
		font-size: 18px;
	}

	&:active:not(:disabled) {
		transform: scale(0.97);
		box-shadow: 0 2px 8px rgba(var(--ion-color-primary-rgb), 0.25);
	}

	&.sending {
		opacity: 0.85;
		box-shadow: none;
	}

	&:disabled {
		cursor: default;
	}

	.btn-label {
		display: flex;
		align-items: center;
		gap: 8px;
	}

	.btn-loading {
		display: flex;
		align-items: center;
	}
}

.chat-cancel-btn {
	width: 100%;
	padding: 12px;
	border: none;
	background: transparent;
	color: #888;
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
	border-radius: 12px;
	transition: color 0.15s ease, background 0.15s ease;

	&:active:not(:disabled) {
		color: #555;
		background: #f0f0f0;
	}

	&:disabled {
		opacity: 0.4;
		cursor: default;
	}
}

// ────────────────────────────────────────────────────────────────
// VISTA MANAGER
// ────────────────────────────────────────────────────────────────
.manager-segment {
	--background: transparent;

	// Compatta i 4 tab per farli entrare senza scroll
	ion-segment-button {
		min-width: 0;
		flex: 1 1 0;
		--padding-start: 4px;
		--padding-end: 4px;

		ion-label {
			font-size: 11px !important;
			font-weight: 700;
			letter-spacing: 0.2px;
			text-transform: uppercase;
			white-space: nowrap;
		}
	}

	.seg-count {
		margin-left: 4px;
		min-width: 16px;
		height: 14px;
		font-size: 9px;
		padding: 0 4px;
	}
}

.seg-count--warn {
	background: var(--ion-color-warning, #ffc409) !important;
	color: #fff !important;
}

.mgr-filters {
	padding: 0 12px 8px;
	background: var(--ion-background-color, #fff);
}

.mgr-filter-row {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	flex-wrap: wrap;
}

.mgr-filter-field {
	flex: 1 1 90px;
	min-width: 90px;
	display: flex;
	flex-direction: column;

	label {
		font-size: 10px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.4px;
		color: var(--ion-color-medium-shade);
		margin-bottom: 2px;
	}

	input, select {
		font-size: 13px;
		padding: 7px 8px;
		border: 1px solid var(--ion-color-light-shade, #d7d8da);
		border-radius: 8px;
		background: #fff;
		color: var(--ion-color-dark);
	}
}

.mgr-filter-clear {
	margin-bottom: 2px;
	--padding-start: 6px;
	--padding-end: 6px;
}

.mgr-card {
	cursor: pointer;
}

.mgr-card--warn {
	border: 1.5px solid var(--ion-color-warning, #ffc409);
}

.mgr-customer {
	font-weight: 600;
}

.bc-status-badge--warn {
	background: var(--ion-color-warning, #ffc409) !important;
	color: #fff !important;
	font-weight: 700;
	letter-spacing: 0.4px;
}

.da-assegnare-hint {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(56, 128, 255, 0.08);
	border-left: 3px solid var(--ion-color-primary);
	padding: 10px 12px;
	border-radius: 6px;
	margin: 8px 12px;
	font-size: 13px;
	line-height: 1.35;
}

// ── Tab Ordini ────────────────────────────────────────────
// Filtro stato ordini — grid 4 colonne, sempre una riga
.ordini-status-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	padding: 4px 12px 2px;
}

.ordini-status-btn {
	all: unset;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 6px 2px;
	border: 1.5px solid var(--ion-color-light-shade, #d7d8da);
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
	color: var(--ion-color-medium-shade);
	min-width: 0;

	.ordini-status-icon {
		font-size: 18px;
		color: var(--ion-color-medium);
		transition: color 0.12s;
	}

	.ordini-status-label {
		font-size: 10px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.2px;
		line-height: 1;
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.ordini-status-count {
		font-size: 10px;
		font-weight: 600;
		opacity: 0.7;
		line-height: 1;
	}

	&:active {
		transform: scale(0.97);
	}

	&.selected {
		color: #fff;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);

		.ordini-status-icon { color: #fff; }
		.ordini-status-count { opacity: 1; }

		&[data-color="medium"]   { background: var(--ion-color-medium);   border-color: var(--ion-color-medium); }
		&[data-color="warning"]  { background: var(--ion-color-warning);  border-color: var(--ion-color-warning); color: #fff; }
		&[data-color="tertiary"] { background: var(--ion-color-tertiary); border-color: var(--ion-color-tertiary); }
		&[data-color="success"]  { background: var(--ion-color-success);  border-color: var(--ion-color-success); }
	}
}

.ordini-status-hint {
	margin: 2px 12px 6px;
	font-size: 10px;
	color: var(--ion-color-medium);
	font-style: italic;
}

.ordini-type-toggle {
	display: flex;
	gap: 6px;
	padding: 4px 12px 8px;
	flex-wrap: wrap;

	ion-chip {
		--background: #fff;
		--color: var(--ion-color-medium-shade);
		border: 1.5px solid var(--ion-color-light-shade, #d7d8da);
		font-weight: 600;
		font-size: 12px;
		min-height: 30px;
		margin: 0;
		transition: background 0.15s, border-color 0.15s, color 0.15s;

		ion-icon {
			font-size: 16px;
			margin-right: 4px;
		}

		.chip-count {
			background: var(--ion-color-light-shade, #d7d8da);
			color: var(--ion-color-medium-shade);
			border-radius: 10px;
			padding: 1px 6px;
			margin-left: 6px;
			font-size: 10px;
			font-weight: 700;
		}

		&.selected {
			--background: var(--ion-color-primary);
			--color: #fff;
			border-color: var(--ion-color-primary);

			.chip-count {
				background: rgba(255, 255, 255, 0.25);
				color: #fff;
			}
		}
	}
}

.ordini-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 0 12px 12px;
}

.ordine-card {
	display: flex;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	cursor: pointer;
	transition: transform 0.05s, box-shadow 0.15s;

	&:active {
		transform: scale(0.99);
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
	}
}

.oc-accent {
	width: 4px;
	flex-shrink: 0;
}

.oc-body {
	flex: 1 1 auto;
	padding: 10px 12px;
	min-width: 0;
}

.oc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
	gap: 8px;
}

.oc-resource {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	font-size: 13px;
	color: var(--ion-color-dark);
	min-width: 0;
	overflow: hidden;

	.oc-icon {
		font-size: 16px;
		color: var(--ion-color-medium);
		flex-shrink: 0;
	}

	.oc-resource-name {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

.oc-item-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 4px;
	font-size: 14px;

	.oc-qty {
		font-weight: 700;
		color: var(--ion-color-primary);
		background: rgba(56, 128, 255, 0.10);
		padding: 1px 6px;
		border-radius: 6px;
		font-size: 12px;
	}

	.oc-item-name {
		flex: 1 1 auto;
		color: var(--ion-color-dark);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.oc-item-total {
		font-weight: 700;
		color: var(--ion-color-dark);
		font-size: 13px;
	}
}

.oc-meta-row {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 11px;
	color: var(--ion-color-medium);
	flex-wrap: wrap;

	.oc-meta-chip {
		background: var(--ion-color-light, #f4f5f8);
		padding: 1px 6px;
		border-radius: 6px;
		font-weight: 600;
	}

	.oc-meta-customer,
	.oc-meta-time {
		display: inline-flex;
		align-items: center;
		gap: 3px;

		ion-icon { font-size: 12px; }
	}
}

.mgr-filters--ordini {
	padding-top: 8px;
}

// ── Ordini raggruppati ────────────────────────────────────
.ordine-group {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	margin-bottom: 8px;
}

.og-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--ion-color-light, #f4f5f8);
	border-left: 4px solid var(--ion-color-primary);
	border-bottom: 1px solid var(--ion-color-light-shade, #e6e6e6);
}

.og-header-main {
	flex: 1 1 auto;
	min-width: 0;
	cursor: pointer;
}

.og-resource {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 700;
	font-size: 14px;
	color: var(--ion-color-dark);

	.og-icon {
		font-size: 18px;
		color: var(--ion-color-medium);
		flex-shrink: 0;
	}

	.og-resource-name {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.og-send-seq {
		font-size: 10px;
		font-weight: 600;
		color: var(--ion-color-medium);
		background: rgba(0, 0, 0, 0.06);
		padding: 1px 5px;
		border-radius: 6px;
	}
}

.og-meta {
	display: flex;
	gap: 12px;
	font-size: 11px;
	color: var(--ion-color-medium-shade);
	margin-top: 4px;
	flex-wrap: wrap;

	.og-customer,
	.og-time {
		display: inline-flex;
		align-items: center;
		gap: 3px;

		ion-icon { font-size: 12px; }
	}
}

.og-header-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	flex-shrink: 0;

	.og-total {
		font-weight: 800;
		font-size: 15px;
		color: var(--ion-color-dark);
	}

	ion-button {
		margin: 0;
		--padding-start: 8px;
		--padding-end: 8px;
		font-size: 11px;
	}
}

.og-items {
	display: flex;
	flex-direction: column;
}

.og-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-top: 1px solid var(--ion-color-light, #f4f5f8);
	cursor: pointer;
	transition: background 0.1s;

	&:first-child { border-top: none; }
	&:active      { background: rgba(0, 0, 0, 0.03); }

	.oc-qty {
		font-weight: 700;
		color: var(--ion-color-primary);
		background: rgba(56, 128, 255, 0.10);
		padding: 1px 6px;
		border-radius: 6px;
		font-size: 12px;
		flex-shrink: 0;
	}
}

.og-item-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;

	.og-item-name {
		font-size: 13px;
		font-weight: 600;
		color: var(--ion-color-dark);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.og-item-meta {
		display: flex;
		gap: 6px;
		flex-wrap: wrap;
		align-items: center;
	}

	.og-item-cat {
		font-size: 10px;
		color: var(--ion-color-medium);
		text-transform: uppercase;
		letter-spacing: 0.3px;
	}

	.og-item-method {
		display: inline-flex;
		align-items: center;
		gap: 3px;
		font-size: 10px;
		font-weight: 600;
		color: var(--ion-color-primary);
		background: rgba(56, 128, 255, 0.10);
		padding: 1px 6px;
		border-radius: 6px;

		ion-icon { font-size: 11px; }
	}
}

.og-item-badge {
	font-size: 9px;
	flex-shrink: 0;
}

.og-item-price {
	font-weight: 700;
	font-size: 12px;
	color: var(--ion-color-dark);
	flex-shrink: 0;
	min-width: 56px;
	text-align: right;
}

// ── Tab Mappa ────────────────────────────────────────────
.mappa-legend {
	display: flex;
	gap: 14px;
	padding: 6px 14px 8px;
	font-size: 11px;
	color: var(--ion-color-medium-shade);

	.mappa-legend-item {
		display: inline-flex;
		align-items: center;
		gap: 5px;
	}

	.legend-dot {
		width: 10px;
		height: 10px;
		border-radius: 50%;
		display: inline-block;

		&.free    { background: var(--ion-color-success); }
		&.pending { background: var(--ion-color-warning); }
		&.busy    { background: var(--ion-color-danger); }
	}
}

// .mappa-grid / .mappa-cell rimossi — sostituiti dal componente <app-resource-map>
