/* ============ Magazzino: farmaci, vaccini e materiali ============ */

/* ---------- contatori e filtri ---------- */
.sk-kpis .kpi { cursor: pointer; }
.sk-kpis .kpi.on { border-color: color-mix(in srgb, var(--c) 70%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent), var(--shadow-sm); }
.sk-kpis .kpi.sk-alert b { color: var(--red-dark); }
.sk-kpis .kpi.sk-warn b { color: var(--sun-dark); }
[data-theme="dark"] .sk-kpis .kpi.sk-alert b { color: var(--red); }
[data-theme="dark"] .sk-kpis .kpi.sk-warn b { color: var(--sun); }
.sk-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -4px 0 14px; }
.sk-filters .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.sk-filters .seg::-webkit-scrollbar { display: none; }
.sk-filters .seg button { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.sk-filters .seg .emoji { font-size: 15px; }
.sk-seg-n { background: var(--line); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.sk-count { margin: 0; }
.sk-toolbar .pick-chip .count { background: var(--line); border-radius: 99px; padding: 0 7px; font-size: 12px; }

/* ---------- elenco: tabella sul computer, schede sul telefono ---------- */
.sk-table th:nth-child(2) { width: 230px; }
.sk-table th:nth-child(3) { width: 190px; }
.sk-table th:nth-child(5) { width: 1%; }
.sk-row td:first-child { box-shadow: inset 5px 0 0 var(--c); }
.sk-row.is-low td { background: color-mix(in srgb, var(--red) 6%, var(--card-2)); }
.sk-row.is-archived { opacity: .72; }
.sk-row:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.sk-name { display: flex; gap: 12px; align-items: center; min-width: 0; }
.sk-name b { font: 600 15.5px/1.25 var(--font-display); }
.sk-sub { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sk-ic {
  --c: var(--brand); width: 40px; height: 40px; min-width: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 21px;
  background: color-mix(in srgb, var(--c) 20%, var(--card)); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--c) 30%, transparent); transition: transform .2s;
}
.sk-row:hover .sk-ic { animation: wiggle .5s ease; }
.sk-qty { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sk-qty b { font: 700 19px/1.1 var(--font-display); }
.sk-qty .chip { font-size: 11.5px; padding: 2px 8px; }
.sk-bar { position: relative; height: 8px; border-radius: 99px; background: var(--line); margin: 6px 0 3px; max-width: 220px; }
.sk-bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--mint); transition: width .45s cubic-bezier(.2, .8, .3, 1); }
.sk-bar.mid > span { background: var(--sun); }
.sk-bar.low > span, .sk-bar.out > span { background: var(--red); }
.sk-bar > i { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink-2); opacity: .5; }
.sk-expired-note { margin-top: 5px; color: var(--red-dark); font-weight: 800; }
[data-theme="dark"] .sk-expired-note { color: var(--red); }
.sk-acts { display: flex; gap: 6px; justify-content: flex-end; }
.sk-acts .btn { gap: 5px; }
.sk-empty .big-emoji { font-size: 60px; }
.sk-empty p { max-width: 520px; margin-left: auto; margin-right: auto; }

@media (max-width: 1100px) { .sk-bl { display: none; } }
@media (max-width: 760px) {
  .sk-card { background: transparent; box-shadow: none; padding: 0; }
  .sk-card .table-wrap { overflow: visible; }
  .sk-table thead { display: none; }
  .sk-table, .sk-table tbody { display: block; }
  .sk-table tr.sk-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "qty exp" "act act"; gap: 10px 12px;
    background: var(--card); border: 2px solid var(--line); border-left: 6px solid var(--c); border-radius: 20px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  }
  .sk-table tr.sk-row.is-low { background: color-mix(in srgb, var(--red) 6%, var(--card)); }
  .sk-table tr.sk-row td, .sk-table tr.sk-row:hover td { display: block; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .sk-table tr.sk-row:hover { border-color: var(--line-2); }
  .sk-c-name { grid-area: name; }
  .sk-c-qty { grid-area: qty; min-width: 0; }
  .sk-c-exp { grid-area: exp; text-align: right; }
  .sk-c-exp .sk-expired-note { text-align: right; }
  .sk-table td.sk-c-val { display: none; }
  .sk-c-act { grid-area: act; }
  .sk-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sk-acts .btn { min-height: 40px; font-size: 14px; }
  .sk-bl { display: inline; }
  .sk-bar { max-width: none; }
}

/* ---------- scheda articolo ---------- */
.sk-sum { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 20px; background: color-mix(in srgb, var(--c) 12%, var(--card)); border: 2px solid color-mix(in srgb, var(--c) 30%, var(--line)); }
.sk-sum-qty { text-align: center; min-width: 96px; }
.sk-sum-qty b { display: block; font: 700 38px/1 var(--font-display); }
.sk-sum-qty span { font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.sk-sum .sk-bar { max-width: none; height: 10px; }
.sk-sum-chips { gap: 6px; margin-top: 8px; }
.sk-detail-acts { gap: 8px; margin: 14px 0; align-items: center; }
.sk-arch-note { flex: 1; min-width: 220px; padding: 9px 12px; }
.sk-kv { background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 0; }
.sk-lots td { padding: 9px 10px; }
.sk-empty-lot td { opacity: .6; }
.sk-count-edit { display: inline-flex; gap: 6px; align-items: center; }
.sk-count-in { width: 92px; min-height: 36px; padding: 6px 10px; text-align: right; }
.sk-lot-acts { white-space: nowrap; text-align: right; }
.sk-lot-acts .btn + .btn { margin-left: 4px; }
.sk-moves { display: flex; flex-direction: column; gap: 6px; }
.sk-move { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 14px; background: var(--card-2); border: 2px solid var(--line); }
.sk-move > .chip { flex: none; min-width: 104px; justify-content: center; }
.sk-plus { color: var(--mint-dark); }
.sk-minus { color: var(--ink); }
[data-theme="dark"] .sk-plus { color: var(--mint); }
.sk-pat { font-weight: 800; }
.sk-after { font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .sk-sum { flex-direction: column; align-items: stretch; text-align: left; }
  .sk-sum-qty { text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .sk-move { flex-wrap: wrap; }
  .sk-move > .chip { min-width: 0; }
  .sk-lots .sk-lot-acts { white-space: normal; }
}

/* ---------- moduli (carico, scarico, articolo) ---------- */
.sk-picked .sk-ic { width: 36px; height: 36px; min-width: 36px; font-size: 19px; }
.sk-qty-in { gap: 8px; }
.sk-qty-in .input { flex: 1; min-width: 0; }
.sk-plan { align-items: center; }
.sk-topup { align-items: center; }
.sk-first { margin-top: 2px; }
.sk-species .pick-chip { padding: 6px 11px; font-size: 13px; }
.sk-species .pick-chip .emoji { font-size: 16px; }

/* ---------- selettore dei lotti (es. nella vaccinazione in cartella) ---------- */
.sk-lp { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sk-lp-row { display: flex; align-items: center; gap: 8px; }
.sk-lp-row > .emoji { font-size: 19px; flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-2); transition: background .2s, transform .25s; }
.sk-lp.has-lot .sk-lp-row > .emoji { background: var(--mint-soft); transform: rotate(-8deg); }
.sk-lp .select { flex: 1; min-width: 0; font-size: 14px; text-overflow: ellipsis; }
.sk-lp-hint { padding-left: 44px; line-height: 1.35; min-height: 1.35em; }

/* ---------- inventario stampato: foglio sempre chiaro, come fatture, ricette e libretto ---------- */
.sk-print { display: none; }
@media print {
  body.sk-printing > *:not(.sk-print) { display: none !important; }
  body.sk-printing .sk-print { display: block !important; position: static !important; }
  .sk-print { color: #1d1830; background: #fff; font: 500 10.5pt/1.4 var(--font); }
  .skp-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 2.5px solid #FF7A45; margin-bottom: 12px; }
  .skp-brand { font: 700 15pt var(--font-display); }
  .skp-doc { text-align: right; }
  .skp-doc b { font: 700 14pt var(--font-display); color: #E2571F; }
  .skp-small { font-size: 8.5pt; color: #5d5673; }
  .skp-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .skp-table th, .skp-table td { padding: 4px 6px; border-bottom: 1px solid #ddd6ea; text-align: left; vertical-align: top; }
  .skp-table thead { display: table-header-group; }
  .skp-table thead th { font-size: 8pt; text-transform: uppercase; letter-spacing: .04em; color: #5d5673; border-bottom: 2px solid #b9b3c6; }
  .skp-table .num { text-align: right; white-space: nowrap; }
  .skp-table tr { break-inside: avoid; page-break-inside: avoid; }
  .skp-group th { background: #f4f1f8; font-size: 10pt; padding-top: 7px; }
  .skp-sub td { font-weight: 800; border-bottom: 2px solid #b9b3c6; }
  .skp-table tfoot td { font-weight: 800; font-size: 11pt; border-top: 2.5px solid #1d1830; border-bottom: 0; padding-top: 8px; }
  .skp-count { width: 22mm; border-left: 1px dashed #b9b3c6; }
  .skp-bad { color: #c21f3a; font-size: 8pt; }
  .skp-sign { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; font-size: 9.5pt; break-inside: avoid; }
  .skp-foot { margin-top: 12px; text-align: center; }
}
