/* Nervesa – Schede prodotto */
.nsp {
	--nsp-accent: #6a2433;
	--nsp-accent-ink: #fff;
	--nsp-ink: #1d1d1b;
	--nsp-muted: #6b6b68;
	--nsp-line: #e3e1dc;
	--nsp-bg: #faf9f7;
	--nsp-card: #fff;
	--nsp-ok: #2f6b3a;
	--nsp-warn: #8a5a00;
	--nsp-err: #a1262a;
	max-width: 920px;
	margin: 0 auto 60px;
	color: var(--nsp-ink);
	font-size: 15px;
	line-height: 1.5;
	text-align: left;
}
.nsp *, .nsp *::before, .nsp *::after { box-sizing: border-box; }
.nsp h2, .nsp h3 { letter-spacing: .01em; }

.nsp-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin: 0 0 20px; }
.nsp-head__actions { display: flex; gap: 16px; align-items: center; }
.nsp-title { margin: 4px 0 0; font-size: 26px; font-weight: 700; }
.nsp-sub { margin: 4px 0 0; color: var(--nsp-muted); }

.nsp-box { background: var(--nsp-card); border: 1px solid var(--nsp-line); border-radius: 6px; padding: 22px; margin: 0 0 18px; }
.nsp-box h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.nsp-box h3 > span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--nsp-accent); color: var(--nsp-accent-ink); font-size: 13px; }
.nsp-box h3 small { font-weight: 400; color: var(--nsp-muted); font-size: 13px; }
.nsp-empty { text-align: center; color: var(--nsp-muted); padding: 40px 22px; }

.nsp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.nsp-field { display: block; margin: 0 0 16px; }
.nsp-field--wide { grid-column: 1 / -1; }
.nsp-field > span { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
.nsp-field > span small { font-weight: 400; color: var(--nsp-muted); }
.nsp input[type=text], .nsp input[type=number], .nsp input[type=password], .nsp select, .nsp textarea {
	width: 100%; padding: 10px 12px; border: 1px solid #cfccc5; border-radius: 4px; background: #fff;
	font: inherit; color: var(--nsp-ink); min-height: 44px;
}
.nsp textarea { min-height: 0; resize: vertical; }
.nsp input:focus, .nsp select:focus, .nsp textarea:focus { outline: 2px solid var(--nsp-accent); outline-offset: 1px; border-color: var(--nsp-accent); }
.nsp select + input { margin-top: 8px; }
.nsp-hint { color: var(--nsp-muted); font-size: 13px; margin: 0 0 14px; font-style: normal; }
.nsp-hidden { display: none !important; }

/* pulsanti */
.nsp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border: 1px solid var(--nsp-ink); border-radius: 4px; background: #fff; color: var(--nsp-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.nsp-btn:hover { background: var(--nsp-bg); color: var(--nsp-ink); }
.nsp-btn--primary { background: var(--nsp-accent); border-color: var(--nsp-accent); color: var(--nsp-accent-ink); }
.nsp-btn--primary:hover { background: #551c29; color: #fff; }
.nsp-btn:disabled { opacity: .5; cursor: wait; }
.nsp-link { background: none; border: 0; padding: 0; color: var(--nsp-accent); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }

/* avvisi */
.nsp-alert { padding: 14px 16px; border-radius: 4px; margin: 0 0 18px; border-left: 4px solid; }
.nsp-alert ul { margin: 6px 0 0 18px; padding: 0; }
.nsp-alert--ok { background: #eef6ef; border-color: var(--nsp-ok); }
.nsp-alert--error { background: #fbeeee; border-color: var(--nsp-err); }

/* elenco schede */
.nsp-list { border: 1px solid var(--nsp-line); border-radius: 6px; background: #fff; }
.nsp-row { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--nsp-line); }
.nsp-row:first-child { border-top: 0; }
.nsp-row__img { width: 56px; height: 56px; border-radius: 4px; background: var(--nsp-bg); overflow: hidden; }
.nsp-row__img img { width: 100%; height: 100%; object-fit: cover; }
.nsp-row__main strong { display: block; }
.nsp-row__main span { color: var(--nsp-muted); font-size: 13px; }
.nsp-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.nsp-badge--draft { background: #efeee9; color: #4a4a47; }
.nsp-badge--pending { background: #fff3d6; color: var(--nsp-warn); }
.nsp-badge--publish { background: #e3f1e5; color: var(--nsp-ok); }

/* taglie */
.nsp-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nsp-chip { position: relative; cursor: pointer; }
.nsp-chip input { position: absolute; opacity: 0; pointer-events: none; }
.nsp-chip span { display: inline-block; padding: 8px 12px; border: 1px solid #cfccc5; border-radius: 4px; font-size: 13px; background: #fff; min-height: 40px; line-height: 22px; }
.nsp-chip input:checked + span { background: var(--nsp-ink); border-color: var(--nsp-ink); color: #fff; }
.nsp-chip input:focus-visible + span { outline: 2px solid var(--nsp-accent); outline-offset: 2px; }

/* colori */
.nsp-color { border: 1px solid var(--nsp-line); border-radius: 6px; padding: 16px; margin: 0 0 14px; background: var(--nsp-bg); }
.nsp-color__head { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.nsp-color__head .nsp-field { margin: 0; }
.nsp-color__n { align-self: center; font-size: 14px; white-space: nowrap; }
.nsp-color__remove { align-self: center; color: var(--nsp-err); }
.nsp-color__qty { margin: 14px 0; }
.nsp-qty__label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
.nsp-qty { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.nsp-qty__cell { display: block; text-align: center; }
.nsp-qty__cell span { display: block; font-size: 12px; color: var(--nsp-muted); margin-bottom: 3px; }
.nsp-qty__cell input { text-align: center; padding: 8px 4px; }

.nsp-drop { position: relative; border: 2px dashed #cfccc5; border-radius: 6px; padding: 18px; text-align: center; background: #fff; color: var(--nsp-muted); transition: border-color .15s, background .15s; }
.nsp-drop.is-over { border-color: var(--nsp-accent); background: #f8f0f1; }
.nsp-drop p { margin: 0; }
.nsp-drop strong { color: var(--nsp-ink); }
.nsp-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.nsp-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.nsp-photos:empty { display: none; }
.nsp-photo { position: relative; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: #fff; border: 1px solid var(--nsp-line); cursor: grab; }
.nsp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nsp-photo:first-child::after { content: "Prima"; position: absolute; left: 6px; bottom: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; background: var(--nsp-accent); color: #fff; border-radius: 3px; }
.nsp-photo.is-drag { opacity: .4; }
.nsp-photo__x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; line-height: 28px; padding: 0; cursor: pointer; }
.nsp-photo.is-loading { display: flex; flex-direction: column; justify-content: flex-end; padding: 8px; cursor: default; }
.nsp-photo.is-loading::after { display: none; }
.nsp-photo__bar { position: absolute; left: 0; top: 0; height: 4px; width: 0; background: var(--nsp-accent); transition: width .2s; }
.nsp-photo__name { font-size: 11px; color: var(--nsp-muted); word-break: break-all; }

/* lavaggio */
.nsp-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 0 0 16px; }
.nsp-checks label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.nsp-checks input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--nsp-accent); }

/* azioni */
.nsp-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; padding: 14px 0; background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0)); z-index: 5; }
.nsp-uploading { color: var(--nsp-warn); font-size: 13px; }
.nsp-form.is-saving .nsp-actions button { opacity: .5; pointer-events: none; }

/* editor */
.nsp .wp-editor-wrap { border: 1px solid #cfccc5; border-radius: 4px; overflow: hidden; }
.nsp .mce-tinymce { box-shadow: none !important; }

/* login */
.nsp #loginform p { margin: 0 0 14px; }
.nsp #loginform label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.nsp #loginform .login-remember label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.nsp #loginform input[type=submit] { min-height: 44px; padding: 10px 22px; border: 0; border-radius: 4px; background: var(--nsp-accent); color: #fff; font-weight: 600; cursor: pointer; }

@media (max-width: 680px) {
	.nsp-box { padding: 16px; }
	.nsp-grid, .nsp-checks { grid-template-columns: 1fr; }
	.nsp-color__head { grid-template-columns: 1fr auto; }
	.nsp-color__head .nsp-field { grid-column: 1 / -1; }
	.nsp-color__n { grid-row: 1; }
	.nsp-color__remove { grid-row: 1; grid-column: 2; }
	.nsp-row { grid-template-columns: 48px 1fr; }
	.nsp-row__img { width: 48px; height: 48px; }
	.nsp-badge, .nsp-row__act { grid-column: 2; justify-self: start; }
	.nsp-actions { justify-content: stretch; }
	.nsp-actions .nsp-btn { flex: 1 1 auto; }
}

/* categorie multiple */
.nsp-cats { display: flex; flex-direction: column; gap: 10px; }
.nsp-cats__group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nsp-cats__group strong { width: 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--nsp-muted); }

/* tag */
.nsp-tags-sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.nsp-tags-sugg small { color: var(--nsp-muted); margin-right: 4px; }
.nsp-tag { border: 1px solid #cfccc5; background: #fff; border-radius: 20px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--nsp-ink); min-height: 32px; }
.nsp-tag.is-on { background: var(--nsp-ink); border-color: var(--nsp-ink); color: #fff; }

/* immagine principale e galleria */
.nsp-slot .nsp-drop { padding: 14px; }
.nsp-slot[data-slot="gallery"] .nsp-photo:first-child::after { display: none; }

/* magazzino */
.nsp-stock { width: 100%; border-collapse: collapse; }
.nsp-stock th, .nsp-stock td { border-bottom: 1px solid var(--nsp-line); padding: 8px 6px; text-align: center; font-size: 14px; }
.nsp-stock th:first-child, .nsp-stock td:first-child { text-align: left; }
.nsp-stock input { max-width: 80px; text-align: center; }
.nsp-stock-wrap { overflow-x: auto; }

/* v1.1.1: altre categorie e tag */
.nsp-more { border: 1px solid var(--nsp-line); border-radius: 4px; padding: 10px 14px; }
.nsp-more summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.nsp-more summary small { font-weight: 400; color: var(--nsp-muted); }
.nsp-catlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; margin-top: 12px; }
.nsp-catlist label { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.nsp-catlist input { width: 16px; height: 16px; accent-color: var(--nsp-accent); position: static; opacity: 1; }
.nsp-catlist input:disabled + * , .nsp-catlist label:has(input:disabled) { color: var(--nsp-muted); }
.nsp-tagbox { display: flex; gap: 8px; }
.nsp-tagbox input { flex: 1 1 auto; }
.nsp-tagbox .nsp-btn { flex: 0 0 auto; }
.nsp-tags-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nsp-tags-list:empty { display: none; }
.nsp-tagchip { display: inline-flex; align-items: center; gap: 6px; background: var(--nsp-ink); color: #fff; border-radius: 20px; padding: 4px 6px 4px 12px; font-size: 13px; }
.nsp-tagchip button { border: 0; background: rgba(255,255,255,.2); color: #fff; width: 22px; height: 22px; border-radius: 50%; line-height: 22px; padding: 0; cursor: pointer; font-size: 15px; }

/* v1.2.0: ricerca, gestione schede pubblicate */
.nsp-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; padding: 14px; background: #fff; border: 1px solid var(--nsp-line); border-radius: 6px; }
.nsp-filter label { margin: 0; }
.nsp-filter__q { flex: 1 1 260px; }
.nsp-filter select { width: auto; min-width: 170px; }
.nsp-count { color: var(--nsp-muted); font-size: 13px; margin: 0 0 8px; }
.nsp-pages { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; color: var(--nsp-muted); font-size: 14px; }
.nsp-badge--archived { background: #e8e6f2; color: #4b3f7a; }
.nsp-sub .nsp-badge { vertical-align: middle; }
.nsp-alert--warn { background: #fff7e0; border-color: var(--nsp-warn); }
.nsp-box__foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.nsp-photo--fixed { cursor: default; }
.nsp-photo--fixed::after { display: none !important; }
#nsp-extra .nsp-photo:first-child::after { display: none; }
#nsp-extra .nsp-drop { margin-top: 6px; }
.nsp-photo.is-loading img { opacity: .4; }
.nsp-confirm { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 14px; cursor: pointer; }
.nsp-confirm input { width: 16px; height: 16px; accent-color: var(--nsp-err); }
.nsp-btn--danger { border-color: var(--nsp-err); color: var(--nsp-err); }
.nsp-btn--danger:hover { background: #fbeeee; color: var(--nsp-err); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
@media (max-width: 680px) {
	.nsp-filter select { flex: 1 1 140px; min-width: 0; }
	.nsp-filter .nsp-btn { flex: 1 1 auto; }
}
