/* Black Star Preventivi & Cantieri — UI dark professional */

:root {
	--bspc-bg: #0a0d12;
	--bspc-bg-2: #0e1218;
	--bspc-panel: #141a23;
	--bspc-panel-2: #1a212c;
	--bspc-panel-3: #212a37;
	--bspc-line: #2a3340;
	--bspc-line-soft: #1f2731;
	--bspc-line-strong: #3a4555;
	--bspc-txt: #eef3f8;
	--bspc-txt-soft: #cfd6df;
	--bspc-muted: #8a96a4;
	--bspc-muted-2: #6e7886;

	--bspc-accent: #e11d48;
	--bspc-accent-soft: rgba(225, 29, 72, .14);
	--bspc-blue: #2563eb;
	--bspc-blue-soft: rgba(37, 99, 235, .14);
	--bspc-blue-2: #3b82f6;
	--bspc-ok: #22c55e;
	--bspc-ok-soft: rgba(34, 197, 94, .14);
	--bspc-warn: #f59e0b;
	--bspc-warn-soft: rgba(245, 158, 11, .14);
	--bspc-danger: #ef4444;

	--bspc-chip: #1f2731;
	--bspc-input-bg: #0c1119;
	--bspc-input-bg-focus: #0a0f17;
	--bspc-input-border: #303a48;

	/* Layered surfaces (cantiere -> area -> comparto -> opzione -> articolo) */
	--bspc-area-bg: rgba(37, 99, 235, .035);
	--bspc-area-head-bg: linear-gradient(180deg, #1c2533 0%, #161d28 100%);
	--bspc-comparto-bg: rgba(37, 99, 235, .075);
	--bspc-comparto-head-bg: linear-gradient(180deg, rgba(37, 99, 235, .22) 0%, rgba(37, 99, 235, .10) 100%);
	--bspc-comparto-excluded-bg: rgba(245, 158, 11, .055);
	--bspc-comparto-excluded-head-bg: linear-gradient(180deg, rgba(245, 158, 11, .22) 0%, rgba(245, 158, 11, .08) 100%);
	--bspc-opzione-bg: rgba(255, 255, 255, .015);
	--bspc-opzione-selected-bg: rgba(34, 197, 94, .055);
	--bspc-item-bg: #131922;
	--bspc-item-client-bg: rgba(255, 255, 255, .028);

	--bspc-radius: 10px;
	--bspc-radius-lg: 14px;
	--bspc-radius-sm: 6px;

	--bspc-shadow-sm: 0 1px 0 rgba(0, 0, 0, .35);
	--bspc-shadow: 0 8px 22px rgba(0, 0, 0, .42);
	--bspc-shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);

	--bspc-fs-12: 12px;
	--bspc-fs-13: 13px;
	--bspc-fs-14: 14px;
	--bspc-fs-16: 16px;
	--bspc-fs-18: 18px;
}

.bspc-app,
.bspc-app * {
	box-sizing: border-box;
}

.bspc-app {
	background: var(--bspc-bg);
	color: var(--bspc-txt);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: var(--bspc-fs-14);
	line-height: 1.45;
	min-height: 72vh;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-lg);
	width: min(calc(100vw - 24px), 1600px);
	margin-left: 50%;
	transform: translateX(-50%);
	position: relative;
	overflow: visible;
	contain: layout style;
	letter-spacing: .01em;
}

.bspc-app.bspc-modal-portal {
	background: transparent;
	border: 0;
	border-radius: 0;
	contain: none;
	margin: 0;
	min-height: 0;
	overflow: visible;
	position: static;
	transform: none;
	width: auto;
}

.bspc-app.presentation-mode .bspc-sensitive-internal,
.bspc-app.presentation-mode .bspc-cost-field,
.bspc-app.presentation-mode .bspc-margin-field,
.bspc-app.presentation-mode .bspc-internal-note {
	display: none;
}

.bspc-app h1,
.bspc-app h2,
.bspc-app h3,
.bspc-app h4 {
	color: var(--bspc-txt);
	margin: 0;
	letter-spacing: -.01em;
}

/* ---- Buttons ---- */
.bspc-app button {
	cursor: pointer;
	border: 1px solid var(--bspc-line);
	background: var(--bspc-panel-2);
	color: var(--bspc-txt);
	padding: 8px 12px;
	border-radius: var(--bspc-radius-sm);
	font-size: var(--bspc-fs-13);
	font-weight: 600;
	line-height: 1.2;
	transition: background .15s ease, border-color .15s ease, transform .04s ease, box-shadow .15s ease;
}

.bspc-app button:hover {
	background: var(--bspc-panel-3);
	border-color: var(--bspc-line-strong);
}

.bspc-app button:active {
	transform: translateY(1px);
}

.bspc-app button:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, .55);
}

.bspc-app button.primary {
	background: var(--bspc-accent);
	border-color: var(--bspc-accent);
	color: #fff;
}

.bspc-app button.primary:hover {
	background: #f43f5e;
	border-color: #f43f5e;
}

.bspc-app button.blue {
	background: var(--bspc-blue);
	border-color: var(--bspc-blue);
	color: #fff;
}

.bspc-app button.blue:hover {
	background: var(--bspc-blue-2);
	border-color: var(--bspc-blue-2);
}

.bspc-app button.ghost {
	background: transparent;
}

.bspc-app button.ghost:hover {
	background: rgba(255, 255, 255, .045);
}

.bspc-app button.bspc-presentation-toggle.active {
	background: rgba(37, 99, 235, .18);
	border-color: rgba(96, 165, 250, .72);
	color: #dbeafe;
}

.bspc-app button.danger {
	color: #fda4af;
	border-color: rgba(244, 63, 94, .35);
}

.bspc-app button.danger:hover {
	background: rgba(244, 63, 94, .14);
	color: #fecdd3;
	border-color: rgba(244, 63, 94, .55);
}

.bspc-app button:disabled {
	cursor: not-allowed;
	opacity: .45;
}

/* ---- Layout ---- */
.bspc-shell {
	display: block;
	width: 100%;
	min-height: 72vh;
}

.bspc-header {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 12px 18px;
	background: linear-gradient(180deg, #161d28 0%, #11161e 100%);
	border-bottom: 1px solid var(--bspc-line);
	border-top-left-radius: var(--bspc-radius-lg);
	border-top-right-radius: var(--bspc-radius-lg);
	backdrop-filter: blur(8px);
}

.bspc-logo {
	font-weight: 800;
	letter-spacing: .6px;
	font-size: 15px;
	color: var(--bspc-txt);
}

.bspc-logo b {
	color: var(--bspc-accent);
}

.bspc-spacer {
	flex: 1;
}

.bspc-main {
	padding: 22px 26px 32px;
	width: 100%;
}

/* ---- Sidebar (cantieri picker) ---- */
.bspc-sidebar {
	position: absolute;
	top: 70px;
	left: 14px;
	z-index: 25;
	display: none;
	width: min(380px, calc(100% - 28px));
	max-height: min(640px, calc(100vh - 120px));
	opacity: 0;
	transform: translateY(-10px) scale(.98);
	transform-origin: top left;
	transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
	background: var(--bspc-panel);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	padding: 14px;
	overflow: auto;
	box-shadow: var(--bspc-shadow);
}

.bspc-sidebar.open {
	display: block;
	opacity: 1;
	transform: translateY(0) scale(1);
	box-shadow: var(--bspc-shadow-lg);
}

.bspc-sidebar-backdrop {
	position: absolute;
	inset: 0;
	z-index: 24;
	background: rgba(0, 0, 0, .42);
	border-radius: var(--bspc-radius-lg);
}

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

.bspc-search {
	display: block;
	margin: 0 0 10px;
}

.bspc-cant-item {
	display: block;
	padding: 10px 12px;
	border-radius: var(--bspc-radius-sm);
	border: 1px solid transparent;
	margin-bottom: 6px;
	cursor: pointer;
	transition: background .12s ease, border-color .12s ease;
	position: relative;
}

.bspc-cant-item:hover {
	background: var(--bspc-panel-2);
	border-color: var(--bspc-line);
}

.bspc-cant-item.active {
	background: var(--bspc-panel-2);
	border-color: var(--bspc-accent);
	box-shadow: inset 3px 0 0 var(--bspc-accent);
}

.bspc-c-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.bspc-c-row .bspc-c-text {
	min-width: 0;
	flex: 1;
}

.bspc-c-name {
	font-weight: 700;
	color: var(--bspc-txt);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bspc-c-sub {
	color: var(--bspc-muted);
	font-size: var(--bspc-fs-12);
	margin-top: 2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bspc-c-actions {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.bspc-c-actions button {
	padding: 4px 7px;
	font-size: 11px;
	min-height: 0;
}

/* ---- Panel / Section ---- */
.bspc-panel {
	background: var(--bspc-panel);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	padding: 18px;
	margin-bottom: 16px;
	box-shadow: var(--bspc-shadow-sm);
}

.bspc-panel + .bspc-panel {
	margin-top: 0;
}

.bspc-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	align-items: flex-start;
}

.bspc-row > .field {
	flex: 1;
	min-width: min(220px, 100%);
}

.bspc-row > .field.wide {
	flex: 2;
}

/* ---- Forms ---- */
.bspc-app label {
	display: block;
	font-size: 11px;
	color: var(--bspc-muted);
	margin: 0 0 4px;
	text-transform: uppercase;
	letter-spacing: .6px;
	font-weight: 600;
}

.bspc-app input,
.bspc-app select,
.bspc-app textarea {
	background: var(--bspc-input-bg);
	border: 1px solid var(--bspc-input-border);
	color: var(--bspc-txt) !important;
	-webkit-text-fill-color: var(--bspc-txt);
	caret-color: #fff;
	color-scheme: dark;
	border-radius: var(--bspc-radius-sm);
	padding: 9px 11px;
	font-size: var(--bspc-fs-13);
	font-family: inherit;
	width: 100%;
	min-height: 40px;
	max-width: 100%;
	transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.bspc-app textarea {
	resize: vertical;
	min-height: 64px;
	line-height: 1.45;
}

.bspc-app input::placeholder,
.bspc-app textarea::placeholder {
	color: var(--bspc-muted) !important;
	-webkit-text-fill-color: var(--bspc-muted);
	opacity: .85;
}

.bspc-app select option {
	background: var(--bspc-input-bg);
	color: var(--bspc-txt);
}

.bspc-app input[type="checkbox"],
.bspc-app input[type="radio"] {
	width: auto;
	min-height: auto;
	padding: 0;
	accent-color: var(--bspc-blue);
}

.bspc-app input:focus,
.bspc-app select:focus,
.bspc-app textarea:focus {
	outline: none;
	border-color: var(--bspc-blue);
	background: var(--bspc-input-bg-focus);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}

.bspc-app input.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.bspc-readonly {
	display: block;
	padding: 9px 11px;
	color: var(--bspc-txt);
	background: rgba(255, 255, 255, .035);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-sm);
	min-height: 40px;
	font-variant-numeric: tabular-nums;
}

/* ---- Area ---- */
.bspc-area {
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	margin-bottom: 18px;
	background: var(--bspc-area-bg);
	overflow: clip;
	box-shadow: var(--bspc-shadow-sm);
}

.bspc-area-head {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 12px 16px;
	background: var(--bspc-area-head-bg);
	cursor: pointer;
	border-bottom: 1px solid var(--bspc-line);
	user-select: none;
}

.bspc-area-head strong {
	font-size: 15px;
	color: var(--bspc-txt);
}

.bspc-area-body {
	padding: 16px;
}

/* ---- Comparto (strong visual separation) ---- */
.bspc-app .bspc-comparto {
	border: 1px solid rgba(37, 99, 235, .42);
	border-left: 4px solid var(--bspc-blue);
	border-radius: var(--bspc-radius);
	padding: 0;
	margin: 18px 0;
	background: var(--bspc-comparto-bg);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
	overflow: hidden;
}

.bspc-app .bspc-comparto + .bspc-comparto {
	margin-top: 26px;
}

.bspc-app .bspc-comparto::before {
	content: "";
	display: block;
	height: 2px;
	background: linear-gradient(90deg, var(--bspc-blue) 0%, rgba(37, 99, 235, .25) 70%, transparent 100%);
}

.bspc-comparto.excluded {
	border-color: rgba(245, 158, 11, .45);
	border-left-color: var(--bspc-warn);
	background: var(--bspc-comparto-excluded-bg);
}

.bspc-comparto.excluded::before {
	background: linear-gradient(90deg, var(--bspc-warn) 0%, rgba(245, 158, 11, .25) 70%, transparent 100%);
}

.bspc-comparto-title {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 12px 14px;
	background: var(--bspc-comparto-head-bg);
	border-bottom: 1px solid rgba(37, 99, 235, .25);
	margin: 0;
}

.bspc-comparto.excluded .bspc-comparto-title {
	background: var(--bspc-comparto-excluded-head-bg);
	border-bottom-color: rgba(245, 158, 11, .3);
}

.bspc-comparto-title > strong:first-child {
	display: inline-flex;
	align-items: center;
	font-size: 10px;
	letter-spacing: 1.4px;
	text-transform: uppercase;
	color: #93c5fd;
	background: rgba(37, 99, 235, .18);
	border: 1px solid rgba(37, 99, 235, .42);
	border-radius: 4px;
	padding: 3px 8px;
	font-weight: 800;
}

.bspc-comparto.excluded .bspc-comparto-title > strong:first-child {
	color: #fde68a;
	background: rgba(245, 158, 11, .14);
	border-color: rgba(245, 158, 11, .42);
}

.bspc-comparto-body {
	padding: 14px 16px 16px;
}

.bspc-comparto-title input[data-update] {
	flex: 1;
	min-width: 180px;
	max-width: 360px;
	background: rgba(0, 0, 0, .25);
	border-color: rgba(37, 99, 235, .35);
	font-weight: 700;
}

/* ---- Opzione / Lotto ---- */
.bspc-opzione {
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	padding: 12px 14px;
	margin: 10px 0 0;
	background: var(--bspc-opzione-bg);
	transition: border-color .14s ease, background .14s ease;
}

.bspc-opzione:first-of-type {
	margin-top: 0;
}

.bspc-opzione.selected {
	border-width: 2px;
	border-color: var(--bspc-ok);
	background: var(--bspc-opzione-selected-bg);
	box-shadow: inset 4px 0 0 var(--bspc-ok);
	padding-left: 12px;
}

.bspc-opzione.locked {
	opacity: .65;
	background: rgba(255, 255, 255, .01);
}

.bspc-opzione-title {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.bspc-opzione-title strong {
	font-size: 14px;
}

.bspc-excluded-note {
	border: 1px solid rgba(245, 158, 11, .42);
	background: rgba(245, 158, 11, .1);
	color: #fed7aa;
	border-radius: var(--bspc-radius-sm);
	padding: 9px 12px;
	font-size: var(--bspc-fs-12);
	margin: 0 0 10px;
}

/* ---- Tables ---- */
.bspc-app table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--bspc-fs-13);
}

.bspc-app th,
.bspc-app td {
	padding: 9px 10px;
	border-bottom: 1px solid var(--bspc-line);
	text-align: left;
	vertical-align: top;
}

.bspc-app th {
	font-size: 11px;
	color: var(--bspc-muted);
	text-transform: uppercase;
	letter-spacing: .6px;
	font-weight: 700;
	background: var(--bspc-panel-2);
}

.bspc-app td input,
.bspc-app td textarea,
.bspc-app td select {
	padding: 5px 8px;
	font-size: var(--bspc-fs-12);
	min-height: 32px;
}

.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* ---- Chips & Pills ---- */
.bspc-chip {
	display: inline-flex;
	align-items: center;
	background: var(--bspc-chip);
	border: 1px solid var(--bspc-line);
	border-radius: 999px;
	padding: 3px 9px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--bspc-muted);
	white-space: nowrap;
}

.bspc-chip.rec {
	color: #fff;
	background: var(--bspc-accent);
	border-color: var(--bspc-accent);
}

.bspc-chip.ok {
	color: #bbf7d0;
	background: var(--bspc-ok-soft);
	border-color: rgba(34, 197, 94, .55);
}

.bspc-chip.warn {
	color: #fed7aa;
	background: var(--bspc-warn-soft);
	border-color: rgba(245, 158, 11, .55);
}

.bspc-chip.blue {
	color: #bfdbfe;
	background: var(--bspc-blue-soft);
	border-color: rgba(37, 99, 235, .55);
}

.bspc-save-status {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--bspc-line);
	border-radius: 999px;
	background: rgba(255, 255, 255, .03);
	color: var(--bspc-muted);
	font-size: var(--bspc-fs-12);
	font-weight: 600;
	min-height: 30px;
	padding: 5px 10px;
	white-space: nowrap;
}

.bspc-save-status::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--bspc-ok);
	margin-right: 7px;
}

.bspc-save-status.dirty {
	color: #fed7aa;
	border-color: rgba(245, 158, 11, .55);
}

.bspc-save-status.dirty::before {
	background: var(--bspc-warn);
}

.bspc-save-status.saving {
	color: #bfdbfe;
	border-color: rgba(37, 99, 235, .6);
}

.bspc-save-status.saving::before {
	background: var(--bspc-blue);
	animation: bspc-pulse 1.1s ease-in-out infinite;
}

@keyframes bspc-pulse {
	0%, 100% { opacity: .4; }
	50% { opacity: 1; }
}

.bspc-notice {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(34, 197, 94, .5);
	border-radius: 999px;
	background: var(--bspc-ok-soft);
	color: #bbf7d0;
	font-size: var(--bspc-fs-12);
	font-weight: 600;
	min-height: 30px;
	max-width: min(420px, 100%);
	overflow: hidden;
	padding: 5px 11px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bspc-total-pill,
.bspc-option-total {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
	border: 1px solid rgba(34, 197, 94, .55);
	border-radius: var(--bspc-radius-sm);
	background: var(--bspc-ok-soft);
	color: #dcfce7;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	padding: 6px 10px;
	white-space: nowrap;
	font-size: var(--bspc-fs-13);
}

.bspc-total-pill.small {
	font-size: var(--bspc-fs-12);
	padding: 4px 8px;
}

.bspc-total-pill small,
.bspc-option-total small {
	font-size: 10px;
	font-weight: 600;
	color: var(--bspc-muted);
}

.bspc-option-total {
	border-color: rgba(37, 99, 235, .65);
	background: var(--bspc-blue-soft);
	color: #dbeafe;
	font-size: var(--bspc-fs-14);
	padding: 6px 11px;
}

.bspc-margin-pill {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(245, 158, 11, .55);
	border-radius: 999px;
	background: var(--bspc-warn-soft);
	color: #fde68a;
	font-size: 11px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	padding: 3px 9px;
	white-space: nowrap;
}

.bspc-pill-internal {
	display: inline-flex;
	align-items: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .4px;
	background: rgba(244, 63, 94, .12);
	color: #fca5a5;
	border: 1px solid rgba(244, 63, 94, .4);
	border-radius: 4px;
	padding: 1px 6px;
	margin-left: 6px;
	text-transform: uppercase;
}

.bspc-pill-client {
	display: inline-flex;
	align-items: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .4px;
	background: var(--bspc-ok-soft);
	color: #bbf7d0;
	border: 1px solid rgba(34, 197, 94, .45);
	border-radius: 4px;
	padding: 1px 6px;
	margin-left: 6px;
	text-transform: uppercase;
}

.bspc-pill-installazione {
	display: inline-flex;
	align-items: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .4px;
	background: rgba(59, 130, 246, .14);
	color: #93c5fd;
	border: 1px solid rgba(59, 130, 246, .38);
	border-radius: 4px;
	padding: 1px 6px;
	margin-left: 6px;
	text-transform: uppercase;
}

.bspc-client-note {
	border: 1px solid rgba(34, 197, 94, .4);
	border-radius: var(--bspc-radius-sm);
	background: var(--bspc-ok-soft);
	padding: 11px 13px;
	margin: 0 0 12px;
	overflow-wrap: anywhere;
}

.bspc-client-note .bspc-pill-client {
	margin: 0 7px 0 0;
}

.bspc-client-note strong {
	color: #dcfce7;
}

.bspc-client-note p {
	margin: 6px 0 0;
	color: var(--bspc-txt);
	line-height: 1.5;
	white-space: pre-wrap;
}

.bspc-project-note-field {
	margin-top: 10px;
}

.bspc-project-note-field textarea {
	min-height: 132px;
}

.bspc-project-public-note {
	margin-top: 10px;
	margin-bottom: 0;
}

.bspc-client-item-note {
	border-left: 3px solid var(--bspc-ok);
	color: #d1fae5;
	background: rgba(34, 197, 94, .06);
	font-size: var(--bspc-fs-13);
	line-height: 1.5;
	margin: 0 0 10px;
	padding: 6px 10px;
	border-radius: 0 var(--bspc-radius-sm) var(--bspc-radius-sm) 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.bspc-article-notes-row {
	display: grid;
	grid-template-columns: repeat(3, minmax(210px, 1fr));
	gap: 14px;
	margin-top: 14px;
}

.bspc-article-notes-row > .field,
.bspc-article-notes-row > .field.wide {
	flex: none;
	min-width: 0;
}

.bspc-article-notes-row textarea {
	min-height: 82px;
}

.bspc-article-notes-row .bspc-status-field {
	grid-column: 1 / -1;
	max-width: none;
}

.bspc-install-note {
	border-left: 3px solid #3b82f6;
	color: #dbeafe;
	background: rgba(59, 130, 246, .08);
	font-size: var(--bspc-fs-13);
	line-height: 1.5;
	margin: 0 0 10px;
	padding: 6px 10px;
	border-radius: 0 var(--bspc-radius-sm) var(--bspc-radius-sm) 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.bspc-install-note .bspc-pill-installazione {
	margin: 0 7px 0 0;
}

.bspc-install-note strong {
	color: #dbeafe;
}

.bspc-install-note p {
	margin: 6px 0 0;
	color: var(--bspc-txt);
	line-height: 1.5;
	white-space: pre-wrap;
}

/* ---- Status box / Check lines ---- */
.bspc-statusbox {
	display: grid;
	grid-template-columns: repeat(5, minmax(104px, 1fr));
	gap: 8px;
	align-items: center;
}

.bspc-statusbox label,
.bspc-checkline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-transform: none;
	letter-spacing: 0;
	font-size: calc(var(--bspc-fs-12) * 1.1);
	font-weight: 600;
	color: var(--bspc-txt);
	cursor: pointer;
	min-height: 36px;
	width: auto;
	border: 1px solid var(--bspc-line);
	border-radius: 999px;
	background: rgba(255, 255, 255, .025);
	padding: 6px 13px;
	white-space: nowrap;
	margin: 0;
	transition: background .14s ease, border-color .14s ease;
}

.bspc-statusbox label {
	justify-content: flex-start;
	width: 100%;
}

.bspc-statusbox label:hover,
.bspc-checkline:hover {
	background: rgba(255, 255, 255, .055);
}

.bspc-statusbox label.bspc-status-active,
.bspc-statusbox label:has(input:checked) {
	border-color: rgba(34, 197, 94, .75);
	background: rgba(34, 197, 94, .22);
	color: #f0fdf4;
	box-shadow: inset 0 0 0 1px rgba(187, 247, 208, .16);
}

.bspc-statusbox label.bspc-status-active:hover,
.bspc-statusbox label:has(input:checked):hover {
	background: rgba(34, 197, 94, .30);
}

.bspc-checkline.strong {
	border-color: rgba(34, 197, 94, .42);
	background: var(--bspc-ok-soft);
	color: #bbf7d0;
}

.bspc-lotto-select {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: auto;
	min-height: 36px;
	border: 1px solid rgba(147, 197, 253, .7);
	border-radius: 999px;
	background: var(--bspc-blue);
	color: #fff !important;
	cursor: pointer;
	font-size: var(--bspc-fs-12);
	font-weight: 800;
	letter-spacing: .4px;
	line-height: 1.15;
	padding: 8px 13px;
	text-transform: uppercase;
	white-space: nowrap;
	box-shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 18px rgba(37, 99, 235, .28);
	transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.bspc-lotto-select:hover,
.bspc-lotto-select:focus-within {
	background: var(--bspc-blue-2);
	border-color: rgba(191, 219, 254, .95);
}

.bspc-lotto-select.active {
	background: linear-gradient(180deg, #2563eb 0%, #1e40af 100%);
	border-color: rgba(34, 197, 94, .9);
	box-shadow: 0 0 0 2px rgba(34, 197, 94, .28), 0 8px 18px rgba(37, 99, 235, .22);
}

.bspc-lotto-select.disabled {
	cursor: not-allowed;
	opacity: .55;
}

.bspc-lotto-select input {
	accent-color: #fff;
}

/* ---- Bigger totals strip ---- */
.bspc-tot-big {
	display: flex;
	justify-content: flex-end;
	gap: 24px;
	margin-top: 14px;
	font-size: var(--bspc-fs-16);
	font-variant-numeric: tabular-nums;
	flex-wrap: wrap;
}

.bspc-tot-big .v {
	color: var(--bspc-ok);
}

.bspc-tot-big .m {
	color: var(--bspc-warn);
}

.bspc-vat-note {
	margin-top: 12px;
	color: var(--bspc-muted);
	font-size: var(--bspc-fs-12);
	line-height: 1.5;
}

/* ---- Summary card ---- */
.bspc-summary {
	background: linear-gradient(180deg, #161d28 0%, #11161e 100%);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	padding: 18px;
	margin: 18px 0;
	box-shadow: var(--bspc-shadow);
}

.bspc-summary.compact {
	background: rgba(255, 255, 255, .025);
	margin: 14px 0 0;
	padding: 14px;
	box-shadow: none;
}

.bspc-summary-title {
	font-weight: 800;
	font-size: var(--bspc-fs-14);
	letter-spacing: .3px;
	color: var(--bspc-txt);
	margin-bottom: 12px;
	text-transform: uppercase;
}

.bspc-summary-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(140px, 1fr));
	gap: 12px;
}

.bspc-summary-grid > div {
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-sm);
	padding: 12px 14px;
	background: rgba(8, 11, 16, .55);
}

.bspc-summary-grid span {
	display: block;
	color: var(--bspc-muted);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .6px;
	font-weight: 600;
}

.bspc-summary-grid strong {
	display: block;
	margin-top: 4px;
	font-size: 18px;
	font-variant-numeric: tabular-nums;
	color: var(--bspc-txt);
	font-weight: 800;
}

.bspc-summary-grid .grand {
	border-color: rgba(34, 197, 94, .6);
	background: var(--bspc-ok-soft);
}

.bspc-summary-grid .grand strong {
	color: #bbf7d0;
	font-size: 22px;
}

/* ---- Records (rapportini / pagamenti) ---- */
.bspc-records h2 {
	font-size: var(--bspc-fs-16);
	margin: 0;
	font-weight: 800;
}

.bspc-record-card {
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	background: rgba(14, 17, 22, .55);
	padding: 14px;
	margin-top: 10px;
	overflow-wrap: anywhere;
}

.bspc-record-head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 9px;
}

.bspc-record-meta {
	color: var(--bspc-muted);
	font-size: var(--bspc-fs-12);
	margin-bottom: 6px;
}

.bspc-record-text {
	color: var(--bspc-txt);
	line-height: 1.5;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.bspc-record-grid {
	display: grid;
	grid-template-columns: minmax(220px, 2fr) minmax(130px, .7fr) minmax(220px, 1.6fr) minmax(88px, .45fr) minmax(88px, .45fr) minmax(110px, .65fr) auto auto;
	gap: 10px;
	align-items: end;
}

.bspc-record-grid.payments {
	grid-template-columns: minmax(260px, 2fr) minmax(130px, .6fr) minmax(120px, .6fr) minmax(150px, .8fr) auto;
}

/* ---- Items / Articles ---- */
.bspc-items {
	display: grid;
	gap: 12px;
}

.bspc-item-card {
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	padding: 14px;
	background: var(--bspc-item-bg);
	box-shadow: var(--bspc-shadow-sm);
	transition: border-color .14s ease;
}

.bspc-item-card:hover {
	border-color: var(--bspc-line-strong);
}

.bspc-item-card.client {
	background: var(--bspc-item-client-bg);
}

.bspc-item-head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.bspc-item-head strong {
	min-width: 0;
	overflow-wrap: anywhere;
}

.bspc-item-grid {
	display: grid;
	grid-template-columns: minmax(220px, 2fr) minmax(44px, .25fr) minmax(140px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(105px, .75fr) minmax(105px, .75fr) minmax(112px, .75fr);
	gap: 12px;
	align-items: end;
}

.bspc-item-grid .field.qty {
	width: 56px;
	min-width: 56px;
	max-width: 56px;
}

.bspc-item-grid .field.qty input {
	padding-left: 4px;
	padding-right: 4px;
	text-align: center;
}

.bspc-item-grid .field,
.bspc-client-grid > div {
	min-width: 0;
}

.bspc-client-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(130px, 1fr));
	gap: 12px;
	align-items: start;
}

.bspc-image-preview {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 92px;
	height: 72px;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-sm);
	background: #07090d;
	overflow: hidden;
	margin: 0 0 10px;
	padding: 0;
	color: inherit;
	cursor: zoom-in;
	box-shadow: none;
	vertical-align: top;
	appearance: none;
	-webkit-appearance: none;
}

.bspc-image-preview:hover {
	border-color: rgba(147, 197, 253, .65);
	background: #090d14;
}

.bspc-image-preview img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bspc-variants {
	margin-top: 14px;
	padding: 12px;
	border: 1px dashed rgba(147, 197, 253, .32);
	border-radius: var(--bspc-radius);
	background: rgba(37, 99, 235, .045);
}

.bspc-variant-head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.bspc-variant-head > strong {
	color: #bfdbfe;
}

.bspc-variant-card {
	border: 1px solid rgba(147, 197, 253, .22);
	border-radius: var(--bspc-radius);
	background: rgba(8, 12, 18, .46);
	margin-top: 10px;
	padding: 12px;
}

.bspc-variant-card.selected {
	border-color: rgba(34, 197, 94, .65);
	background: rgba(34, 197, 94, .06);
	box-shadow: inset 3px 0 0 var(--bspc-ok);
}

.bspc-client-variants {
	display: grid;
	gap: 8px;
	margin: 10px 0 12px;
}

.bspc-client-variant {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-sm);
	background: rgba(255, 255, 255, .025);
	color: var(--bspc-txt);
	padding: 9px 11px;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}

.bspc-client-variant.selected {
	border-color: rgba(34, 197, 94, .65);
	background: rgba(34, 197, 94, .10);
}

.bspc-client-variant input {
	margin-top: 3px;
	flex-shrink: 0;
}

.bspc-client-variant span {
	min-width: 0;
	flex: 1;
}

.bspc-client-variant strong,
.bspc-client-variant small {
	display: block;
	overflow-wrap: anywhere;
}

.bspc-client-variant small {
	color: var(--bspc-muted);
	font-size: var(--bspc-fs-12);
	line-height: 1.45;
	margin-top: 3px;
	white-space: pre-wrap;
}

.bspc-client-variant em {
	color: #bbf7d0;
	font-style: normal;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---- Logs ---- */
.bspc-logs {
	max-height: 260px;
	overflow: auto;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-sm);
}

.bspc-logs table {
	font-size: var(--bspc-fs-12);
}

/* ---- Actions / Order ---- */
.bspc-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.bspc-order-actions {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-wrap: nowrap;
}

.bspc-icon-btn {
	width: 32px;
	height: 32px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	min-height: 0;
}

/* ---- Empty / Loading / Error ---- */
.bspc-muted {
	color: var(--bspc-muted);
}

.bspc-small {
	font-size: var(--bspc-fs-12);
}

.bspc-empty,
.bspc-loading {
	color: var(--bspc-muted);
	text-align: center;
	padding: 48px 24px;
}

.bspc-empty.compact {
	padding: 18px;
}

.bspc-error {
	margin: 0 0 12px;
	padding: 11px 14px;
	border: 1px solid rgba(225, 29, 72, .6);
	border-radius: var(--bspc-radius-sm);
	background: rgba(225, 29, 72, .12);
	color: #fecdd3;
	font-weight: 600;
}

/* ---- Modal ---- */
.bspc-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(0, 0, 0, .72);
	backdrop-filter: blur(2px);
}

.bspc-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	z-index: 9999;
	width: min(560px, calc(100vw - 28px));
	max-height: calc(100vh - 28px);
	overflow: auto;
	transform: translate(-50%, -50%);
	background: var(--bspc-panel);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-lg);
	box-shadow: var(--bspc-shadow-lg);
	padding: 22px;
}

.bspc-modal h2 {
	font-size: var(--bspc-fs-18);
	margin: 0 0 14px;
	font-weight: 800;
}

.bspc-modal p {
	color: var(--bspc-txt-soft);
	line-height: 1.55;
	margin: 0 0 12px;
	overflow-wrap: anywhere;
}

.bspc-modal p strong {
	color: var(--bspc-txt);
}

.bspc-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 18px;
}

.bspc-image-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	z-index: 9999;
	width: min(920px, calc(100vw - 28px));
	max-height: calc(100vh - 28px);
	transform: translate(-50%, -50%);
	background: var(--bspc-panel);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-lg);
	box-shadow: var(--bspc-shadow-lg);
	padding: 14px;
	display: grid;
	gap: 10px;
}

.bspc-image-modal img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 118px);
	width: auto;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
	background: #05070b;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
}

.bspc-image-modal .bspc-image-close {
	justify-self: end;
}

/* ---- Links ---- */
.bspc-link {
	color: #93c5fd;
	text-decoration: none;
	font-weight: 600;
}

.bspc-link:hover {
	text-decoration: underline;
}

/* ---- Login ---- */
.bspc-login-required {
	background: var(--bspc-panel);
	color: var(--bspc-txt);
	padding: 18px;
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius);
	font-family: ui-sans-serif, system-ui, sans-serif;
}

.bspc-login-screen {
	display: grid;
	place-items: center;
	min-height: 520px;
	padding: 22px;
}

.bspc-login-card {
	width: min(100%, 440px);
	background: var(--bspc-panel);
	border: 1px solid var(--bspc-line);
	border-radius: var(--bspc-radius-lg);
	padding: 26px;
	box-shadow: var(--bspc-shadow);
}

.bspc-login-card h2 {
	font-size: 22px;
	margin: 14px 0 6px;
	font-weight: 800;
}

.bspc-login-card p {
	margin: 0 0 18px;
	color: var(--bspc-muted);
}

.bspc-login-form {
	display: grid;
	gap: 12px;
}

.bspc-login-form button {
	width: 100%;
	margin-top: 6px;
	min-height: 44px;
	font-size: var(--bspc-fs-14);
}

/* ---- Responsive ---- */
@media (max-width: 1180px) {
	.bspc-main {
		padding: 16px 16px 24px;
	}

	.bspc-article-notes-row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspc-item-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspc-item-grid .field.wide {
		grid-column: 1 / -1;
	}

	.bspc-client-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspc-summary-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspc-record-grid,
	.bspc-record-grid.payments {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 680px) {
	.bspc-app {
		width: calc(100vw - 12px);
		border-radius: var(--bspc-radius);
	}

	.bspc-header {
		padding: 10px 12px;
	}

	.bspc-main {
		padding: 12px;
	}

	.bspc-panel {
		padding: 14px;
	}

	.bspc-area-body,
	.bspc-comparto-body {
		padding: 12px;
	}

	.bspc-opzione,
	.bspc-item-card {
		padding: 12px;
	}

	.bspc-row {
		display: grid;
		grid-template-columns: 1fr;
	}

	.bspc-article-notes-row {
		grid-template-columns: 1fr;
	}

	.bspc-article-notes-row .bspc-status-field {
		max-width: none;
	}

	.bspc-statusbox {
		grid-template-columns: repeat(5, minmax(92px, 1fr));
		overflow-x: auto;
	}

	.bspc-row > .field,
	.bspc-row > .field.wide,
	.bspc-item-grid,
	.bspc-client-grid,
	.bspc-summary-grid,
	.bspc-record-grid,
	.bspc-record-grid.payments {
		grid-template-columns: 1fr;
		min-width: 0;
	}

	.bspc-tot-big {
		justify-content: flex-start;
		gap: 10px;
		font-size: var(--bspc-fs-14);
	}

	.bspc-modal-actions {
		display: grid;
		grid-template-columns: 1fr;
	}

	.bspc-modal {
		padding: 18px;
	}

	.bspc-app table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}
}
