/* /assets/css/app.css — stili di modulo per accesso, amministrazione e back-office (solo token --hd-*) */

.pv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Accesso e setup */
.pv-auth { background: var(--hd-bg); }
.pv-auth__box { min-height: 100dvh; display: grid; place-items: center; padding: var(--hd-s6) var(--hd-s4); }
.pv-auth__card { width: 100%; max-width: 380px; padding: var(--hd-s8) var(--hd-s6); display: flex; flex-direction: column; gap: var(--hd-s5); }
.pv-auth__card--wide { max-width: 620px; }
.pv-auth__brand { display: flex; flex-direction: column; align-items: center; gap: var(--hd-s3); text-align: center; }
.pv-auth__brand .hd-brand__mark { width: 44px; height: 44px; border-radius: var(--hd-r); font-size: var(--hd-t-base); }
.pv-plain { margin: 0; padding-left: var(--hd-s5); color: var(--hd-text-2); display: grid; gap: var(--hd-s1); }

/* Avvisi e note */
.pv-alert { padding: var(--hd-s3) var(--hd-s4); border-radius: var(--hd-r); font-size: var(--hd-t-sm); line-height: 1.45; }
.pv-alert--danger { background: var(--hd-danger-soft); color: var(--hd-danger); }
.pv-alert--warning { background: var(--hd-warning-soft); color: var(--hd-text); }
.pv-alert--success { background: var(--hd-success-soft); color: var(--hd-text); }
.pv-note { margin-top: var(--hd-s4); color: var(--hd-text-2); font-size: var(--hd-t-sm); display: grid; gap: var(--hd-s2); }
.pv-note p { margin: 0; }
.pv-code { margin: 0; padding: var(--hd-s4); background: var(--hd-fill); border-radius: var(--hd-r-sm); font: var(--hd-t-xs)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; }
.pv-input-sm { width: 88px; text-align: right; }

/* Righe cliccabili */
.pv-rowlink { cursor: pointer; }
.pv-rowlink:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }
.pv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--hd-accent); margin-left: var(--hd-s2); }

/* Dettaglio preventivo */
.pv-back { display: inline-flex; align-items: center; gap: var(--hd-s1); color: var(--hd-accent); font-size: var(--hd-t-sm); text-decoration: none; margin-bottom: var(--hd-s3); }
.pv-kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: var(--hd-s2) var(--hd-s4); margin: 0; font-size: var(--hd-t-sm); }
.pv-kv dt { color: var(--hd-text-2); }
.pv-kv dd { margin: 0; word-break: break-word; }
.pv-linkbox { display: flex; gap: var(--hd-s2); align-items: center; }
.pv-linkbox .hd-input { font-size: var(--hd-t-xs); }
.pv-checks { display: grid; gap: var(--hd-s2); }
.pv-checks label { display: flex; gap: var(--hd-s2); align-items: flex-start; font-size: var(--hd-t-sm); }
.pv-checks input { margin-top: 3px; accent-color: var(--hd-accent); }
.pv-stack-lg { display: grid; gap: var(--hd-s5); }

/* Conversazione e cronologia */
.pv-thread { display: flex; flex-direction: column; gap: var(--hd-s3); max-height: 420px; overflow: auto; padding: var(--hd-s1); }
.pv-msg { max-width: 86%; padding: var(--hd-s2) var(--hd-s3); border-radius: var(--hd-r); background: var(--hd-fill); font-size: var(--hd-t-sm); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.pv-msg--mine { align-self: flex-end; background: var(--hd-accent-soft); }
.pv-msg__meta { display: block; margin-top: var(--hd-s1); font-size: var(--hd-t-xs); color: var(--hd-text-3); }
.pv-msg__kind { display: block; font-weight: 600; margin-bottom: 2px; }
.pv-reply { display: grid; gap: var(--hd-s2); margin-top: var(--hd-s3); }
.pv-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--hd-s3); }
.pv-timeline li { display: grid; grid-template-columns: 10px 1fr; gap: var(--hd-s3); font-size: var(--hd-t-sm); align-items: baseline; }
.pv-timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hd-text-3); transform: translateY(-1px); }
.pv-timeline time { display: block; font-size: var(--hd-t-xs); color: var(--hd-text-3); }

/* Editor del catalogo */
.pv-editor { display: grid; gap: var(--hd-s5); }
@media (min-width: 1280px) { .pv-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.pv-json { width: 100%; min-height: 520px; resize: vertical; font: var(--hd-t-xs)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; white-space: pre; overflow: auto; }
.pv-errors { margin: 0; padding-left: var(--hd-s5); display: grid; gap: var(--hd-s1); }
.pv-help summary { cursor: pointer; color: var(--hd-accent); font-size: var(--hd-t-sm); }
.pv-help table { width: 100%; border-collapse: collapse; font-size: var(--hd-t-xs); margin-top: var(--hd-s3); }
.pv-help td { padding: var(--hd-s1) var(--hd-s2); border-top: 0.5px solid var(--hd-sep); vertical-align: top; }
.pv-help td:first-child { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--hd-text-2); }
.pv-preview { position: sticky; top: 72px; display: grid; gap: var(--hd-s4); }
.pv-swatch { width: 44px; height: 36px; padding: 2px; border: 0.5px solid var(--hd-border); border-radius: var(--hd-r-sm); background: var(--hd-surface); }

/* Card con testata non a filo: la testata sta dentro il padding della card */
.hd-card:not(.hd-card--flush) > .hd-card__head { padding: 0 0 var(--hd-s3); justify-content: space-between; }
.hd-split .hd-card:not(.hd-form), .pv-editor .hd-card { display: grid; gap: var(--hd-s4); align-content: start; min-width: 0; }
@media (min-width: 768px) { .hd-table td[data-actions] { white-space: nowrap; } }
.hd-table td[data-actions] .hd-btn + .hd-btn { margin-left: var(--hd-s1); }

/* Libreria delle immagini */
.pv-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--hd-s3); }
.pv-asset { display: flex; flex-direction: column; gap: var(--hd-s3); padding: var(--hd-s3); }
.pv-asset__img { aspect-ratio: 4 / 3; border-radius: var(--hd-r); overflow: hidden; background: var(--hd-fill); }
.pv-asset__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-asset__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pv-asset__name { font-weight: 600; overflow-wrap: anywhere; }
.pv-asset .hd-row { justify-content: space-between; }
.pv-thumb { flex: none; width: 44px; height: 44px; border-radius: var(--hd-r-sm, 8px); overflow: hidden; background: var(--hd-fill); }
.pv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-imgsel { flex: 0 0 44%; width: 44%; min-width: 0; }
.pv-editor > *, #img-panel, #img-panel .hd-list__body { min-width: 0; }
#img-panel .hd-list { margin-top: var(--hd-s3); }
.pv-asset__body .hd-badge { align-self: flex-start; }
