/* Post-vendita, pagine pubbliche: form di richiesta e pagina della pratica.
 *
 * Stessa grafica del gestionale c4shopper: barra scura in alto, fondo
 * #f1f4f7, superfici bianche, blu #30a5ff per le azioni, raggio 4 px,
 * Montserrat. Problema e Intervento usano il giallo (#ffb53e) e il verde
 * (#8ad919) dei tasti del tema, scuriti per i testi.
 *
 * Testi sempre scuri: la gerarchia la fa il peso.
 */

:root {
    --pv-ink: #23272b;
    --pv-ink-2: #3b4148;
    --pv-line: #d5dce4;
    --pv-field: #6b7480;
    --pv-ground: #f1f4f7;
    --pv-bar: #222;
    --pv-blue: #30a5ff;
    --pv-blue-ink: #1677c9;
    --pv-blue-soft: #e6f3fe;
    --pv-problem: #a35a00;
    --pv-problem-rule: #ffb53e;
    --pv-problem-soft: #fff6e5;
    --pv-fix: #457a0c;
    --pv-fix-rule: #8ad919;
    --pv-fix-soft: #f2fbe6;
    --pv-red: #d0182f;
    --pv-red-soft: #fdecea;
    --pv-violet: #6b3fb8;
    --pv-brown: #7a5a12;
}

* { box-sizing: border-box; }
/* Un elemento nascosto resta nascosto anche se la sua classe gli da' un display */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
.as-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pv-ground);
    color: var(--pv-ink);
    font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
.as-body p { margin: 0; }
a { color: var(--pv-blue-ink); font-weight: 600; }
a:hover { color: #0f5a99; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ─── Barra in alto, come il gestionale ────────────────────────────── */
.as-topbar {
    background: var(--pv-bar);
    color: #fff;
    min-height: 60px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 8px 20px;
}
.as-brand { color: #fff !important; font-size: 19px; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.as-brand span { color: var(--pv-blue); font-weight: 600; }
.as-topbar-spacer { flex: 1; }
.as-topbar-phone { color: #fff; font-size: 14px; font-weight: 600; }

/* ─── Impaginazione ────────────────────────────────────────────────── */
.as-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 16px 56px; }
.as-main--narrow { max-width: 860px; }
.as-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.as-col-main { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.as-col-side { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.as-footer { margin-top: auto; padding: 16px 20px; font-size: 14px; color: var(--pv-ink-2); text-align: center; }

/* ─── Testi ────────────────────────────────────────────────────────── */
.as-h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.as-lead { font-size: 16px; color: var(--pv-ink-2); }
.as-h2 { margin: 0; font-size: 19px; font-weight: 700; }
.as-h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.as-muted { color: var(--pv-ink-2); font-size: 14px; }

/* ─── Superfici ────────────────────────────────────────────────────── */
.as-card { background: #fff; border: 1px solid var(--pv-line); border-radius: 4px; padding: 20px; }
.as-card--problem { border-top: 4px solid var(--pv-problem-rule); }
.as-card--ok { border-top: 4px solid var(--pv-fix-rule); }
@media (min-width: 720px) { .as-card { padding: 22px 24px; } }

/* ─── Passi del form (sono una sequenza: numerati) ─────────────────── */
.as-step { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.as-step-num {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: var(--pv-blue); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700;
}
.as-section--locked { opacity: .5; pointer-events: none; }

/* ─── Campi ────────────────────────────────────────────────────────── */
.as-label { display: block; font-size: 15px; font-weight: 700; color: var(--pv-ink); margin-bottom: 6px; }
.as-input, .as-select, .as-textarea {
    width: 100%; height: 46px; padding: 0 12px;
    border: 2px solid var(--pv-field); border-radius: 4px;
    background: #fff; color: var(--pv-ink);
    font: inherit; font-size: 16px;
}
.as-input::placeholder, .as-textarea::placeholder { color: #5d6670; }
.as-textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; }
.as-input:focus, .as-select:focus, .as-textarea:focus { outline: none; border-color: var(--pv-blue); box-shadow: 0 0 0 3px rgba(48, 165, 255, .3); }
.as-grid-2, .as-grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 640px) {
    .as-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .as-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.as-field { margin-top: 14px; }
.as-honeypot { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Aiuto «?» locale (il form non usa il partial del gestionale) */
.as-help { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; padding: 0; border: 1px solid #9aa5b1; border-radius: 50%; background: #fff; color: #3b4148; font: inherit; font-size: 12px; font-weight: 700; vertical-align: middle; cursor: pointer; }
.as-help:hover, .as-help:focus-visible { border-color: var(--pv-blue); color: var(--pv-blue-ink); outline: none; }
.as-help-text { display: none; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--pv-line); border-radius: 4px; background: #fff; font-size: 14px; box-shadow: 0 6px 18px rgba(20, 30, 40, .12); }
.as-help-text.is-open { display: block; }

/* Scelte a scheda */
.as-choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
@media (min-width: 640px) { .as-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.as-choice { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 12px; border: 2px solid var(--pv-field); border-radius: 4px; background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.as-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--pv-blue); }
.as-choice.is-selected { border-color: var(--pv-blue); background: var(--pv-blue-soft); }
.as-choice:focus-within { box-shadow: 0 0 0 3px rgba(48, 165, 255, .3); }

/* Ordine trovato */
.as-found { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 4px; background: var(--pv-fix-soft); border-left: 4px solid var(--pv-fix-rule); font-size: 15px; }
.as-found svg { flex: none; margin-top: 3px; }
.as-found p + p { margin-top: 2px; }

/* Caricamento file */
.as-drop {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 24px 16px;
    border: 2px dashed var(--pv-field); border-radius: 4px;
    background: #fafbfc; text-align: center; cursor: pointer;
}
.as-drop.is-over, .as-drop:focus-within { border-color: var(--pv-blue); background: var(--pv-blue-soft); }
.as-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.as-drop strong { font-size: 16px; }
.as-files { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.as-file { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.as-file-thumb { width: 46px; height: 36px; flex: none; border-radius: 4px; background: #e7eaee; object-fit: cover; display: flex; align-items: center; justify-content: center; }
.as-file-thumb--video { background: #3b4148; }
.as-file-body { flex: 1; min-width: 0; }
.as-file-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-bar { height: 6px; margin-top: 6px; border-radius: 3px; background: #e2e7ec; overflow: hidden; }
.as-bar > span { display: block; width: 0; height: 100%; background: var(--pv-blue); transition: width .2s; }
.as-bar.is-done > span { background: var(--pv-fix-rule); }
.as-file-state { font-size: 14px; font-weight: 700; white-space: nowrap; }
.as-file-state--ok { color: var(--pv-fix); }
.as-file-state--error { color: var(--pv-red); }
.as-file-remove { width: 40px; height: 40px; border: 1px solid var(--pv-line); border-radius: 4px; background: #fff; color: var(--pv-ink); font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; }

/* ─── Tasti (come il gestionale) ───────────────────────────────────── */
.as-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px;
    border: 1px solid transparent; border-radius: 4px;
    background: #e9ecf2; color: var(--pv-ink) !important;
    font: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.as-btn:hover { background: #dde2ea; }
.as-btn:focus-visible { outline: 3px solid rgba(48, 165, 255, .55); outline-offset: 2px; }
.as-btn--primary { background: var(--pv-blue); color: #fff !important; }
.as-btn--primary:hover { background: #1f93ec; }
.as-btn--block { width: 100%; }
.as-btn[disabled] { opacity: .5; cursor: default; }
.as-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.as-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-size: 15px; }
.as-check input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--pv-blue); }

/* ─── Messaggi di esito ────────────────────────────────────────────── */
.as-alert { padding: 12px 14px; border-radius: 4px; font-size: 15px; font-weight: 600; }
.as-alert--error { background: var(--pv-red-soft); color: var(--pv-red); border-left: 4px solid var(--pv-red); }
.as-alert--ok { background: var(--pv-fix-soft); color: var(--pv-fix); border-left: 4px solid var(--pv-fix-rule); }

/* Lista «cosa succede dopo» (e' una sequenza) */
.as-next { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.as-next li { display: flex; gap: 12px; }

/* ─── Pagina della pratica ─────────────────────────────────────────── */
.as-ref { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 15px; font-weight: 700; }
.as-order-line { font-size: 15px; color: var(--pv-ink-2); }
.as-order-line strong { color: var(--pv-ink); }

.pv-status { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.pv-status--new { background: var(--pv-blue); color: #fff; }
.pv-status--acknowledged, .pv-status--in_progress { background: var(--pv-blue-soft); color: var(--pv-blue-ink); }
.pv-status--waiting_customer { background: #f1ebfb; color: var(--pv-violet); }
.pv-status--waiting_supplier { background: #f7f0de; color: var(--pv-brown); }
.pv-status--resolved { background: var(--pv-fix-soft); color: var(--pv-fix); }
.pv-status--closed { background: #e4e8ed; color: var(--pv-ink-2); }
.pv-status--rejected { background: var(--pv-red-soft); color: var(--pv-red); }

/* Avanzamento: cinque tappe in fila */
.as-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 20px 0 0; padding: 0; list-style: none; }
.as-track li { position: relative; padding-top: 30px; text-align: center; font-size: 13px; line-height: 1.3; }
.as-track li::before { content: ""; position: absolute; top: 10px; left: -50%; right: 50%; height: 3px; background: var(--pv-line); }
.as-track li:first-child::before { display: none; }
.as-track-dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--pv-line); background: #fff; display: flex; align-items: center; justify-content: center; z-index: 1; }
.as-track-name { display: block; font-weight: 700; }
.as-track-date { display: block; color: var(--pv-ink-2); font-variant-numeric: tabular-nums; }
.as-track li.is-done::before, .as-track li.is-current::before, .as-track li.is-warn::before { background: var(--pv-fix-rule); }
.as-track li.is-done .as-track-dot { background: var(--pv-fix-rule); border-color: var(--pv-fix-rule); }
.as-track li.is-current .as-track-dot { border-color: var(--pv-blue); box-shadow: 0 0 0 4px var(--pv-blue-soft); }
.as-track li.is-current .as-track-name { color: var(--pv-blue-ink); }
.as-track li.is-warn .as-track-dot { border-color: var(--pv-problem-rule); background: var(--pv-problem-rule); }
.as-track li.is-warn .as-track-name { color: var(--pv-problem); }
.as-track li.is-stop .as-track-dot { border-color: var(--pv-red); background: var(--pv-red); }
.as-track li.is-stop .as-track-name { color: var(--pv-red); }
.as-track li.is-off .as-track-name { font-weight: 600; color: var(--pv-ink-2); }

/* «Adesso»: la frase su cosa succede ora */
.as-now { margin-top: 18px; padding: 12px 16px; border-radius: 4px; background: #fff; border: 1px solid var(--pv-line); border-left: 4px solid var(--pv-blue); font-size: 16px; }
.as-now strong { font-weight: 700; }
.as-now--you { border-left-color: var(--pv-problem-rule); background: var(--pv-problem-soft); }
.as-now--done { border-left-color: var(--pv-fix-rule); background: var(--pv-fix-soft); }

/* Il foglio: problema a sinistra, cosa abbiamo fatto a destra */
.as-sheet { display: grid; grid-template-columns: minmax(0, 1fr); background: #fff; border: 1px solid var(--pv-line); border-radius: 4px; box-shadow: 0 2px 6px rgba(20, 30, 40, .06); margin-top: 18px; }
@media (min-width: 760px) { .as-sheet { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.as-half { padding: 18px 20px 20px; min-width: 0; }
.as-half--problem { border-top: 4px solid var(--pv-problem-rule); }
.as-half--fix { border-top: 4px solid var(--pv-fix-rule); }
@media (min-width: 760px) { .as-half--fix { border-left: 1px solid var(--pv-line); } }
.as-half-head { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.as-half--problem .as-half-head { color: var(--pv-problem); }
.as-half--fix .as-half-head { color: var(--pv-fix); }
.as-cat { display: inline-block; padding: 3px 9px; border-radius: 4px; background: var(--pv-problem-soft); color: #7a4300; font-size: 14px; font-weight: 700; }
.as-product { margin-top: 10px !important; font-weight: 700; }
.as-desc { margin-top: 10px !important; padding: 12px 14px; border-radius: 4px; background: var(--pv-problem-soft); white-space: pre-line; }

.as-report { padding: 12px 14px; border-radius: 4px; background: var(--pv-fix-soft); margin-bottom: 12px; }
.as-report-outcome { font-size: 16px; font-weight: 700; color: var(--pv-fix); }
.as-report-text { margin-top: 6px !important; white-space: pre-line; }
.as-report-cause { margin-top: 6px !important; font-size: 14px; }

.as-log { list-style: none; margin: 0; padding: 0; }
.as-log li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #edf0f3; font-size: 15px; }
.as-log li:last-child { border-bottom: 0; }
.as-log-at { font-size: 14px; font-weight: 600; color: var(--pv-ink-2); font-variant-numeric: tabular-nums; }
.as-log-text { font-weight: 700; }
.as-log-quote { display: block; margin-top: 2px; white-space: pre-line; }
.as-log li.is-fix .as-log-text { color: var(--pv-fix); }
.as-log li.is-ask .as-log-text { color: var(--pv-violet); }
.as-log li.is-wait .as-log-text { color: var(--pv-brown); }
.as-log li.is-reopen .as-log-text { color: var(--pv-red); }
.as-log-empty { padding: 12px 14px; border: 2px dashed var(--pv-problem-rule); border-radius: 4px; }

/* Conversazione */
.as-msgs { display: flex; flex-direction: column; gap: 10px; }
.as-msg { max-width: 90%; padding: 10px 12px; border-radius: 4px; background: var(--pv-ground); font-size: 15px; }
.as-msg p { white-space: pre-line; }
.as-msg--mine { margin-left: auto; background: var(--pv-blue-soft); }
.as-msg-meta { margin-bottom: 4px !important; font-size: 14px; color: var(--pv-ink-2); }
.as-msg-meta strong { color: var(--pv-ink); }
.as-reply { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 20px; }
.as-file-pick { display: inline-flex; align-items: center; gap: 8px; }
.as-file-pick input { font-size: 15px; }

details.as-details > summary { cursor: pointer; font-size: 16px; font-weight: 700; }
details.as-details > summary:focus-visible { outline: 3px solid rgba(48, 165, 255, .55); outline-offset: 2px; }

/* Miniature */
.as-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (min-width: 640px) { .as-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.as-thumb { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 4px; overflow: hidden; background: #e7eaee; border: 1px solid var(--pv-line); color: var(--pv-ink) !important; font-size: 12px; text-decoration: none; }
.as-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-thumb--video { background: #3b4148; }
.as-thumb-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .92); display: flex; align-items: center; justify-content: center; }
.as-thumb-label { position: absolute; left: 6px; right: 6px; bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255, 255, 255, .92); border-radius: 3px; padding: 1px 6px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { .as-bar > span { transition: none; } }
/* Foto o video cancellato dopo la chiusura della pratica */
.as-thumb--purged { display: flex; align-items: center; justify-content: center; background: #f6f7f9; border-style: dashed; border-color: #b9c0c8; }
.as-thumb--purged .as-thumb-label { position: static; background: transparent; color: #4a525b; white-space: normal; text-align: center; }
.as-media-note { margin: 10px 0 0 !important; font-size: 14px; color: #3c434a !important; }
/* Anteprima di staging del sottodominio (AFTER_SALES_PREVIEW_PATH) */
.as-preview-bar { background: #ffb53e; color: #23272b !important; font-size: 13px; line-height: 1.4; text-align: center; padding: 6px 16px; }
.as-preview-bar strong { color: #23272b; }
