/* ============ Preventivi: elenco, editor (fratello della fattura), pagina del cliente ============ */

/* ---------- elenco ---------- */
#qt-kpis button.kpi { font: inherit; text-align: left; cursor: pointer; width: 100%; }
#qt-kpis button.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.qt-rate { height: 7px; margin-top: 8px; }
.qt-rate > span { background: linear-gradient(90deg, var(--grape), var(--mint)); }
.qt-toolbar { align-items: flex-start; }
.qt-filters { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; flex: 1; min-width: 0; }
.qt-filters .pick-chip { flex: none; padding: 7px 12px; font-size: 13px; }
.qt-filters .pick-chip .emoji { font-size: 16px; }
.qt-table-card { padding: 6px 8px; }
.qt-table td { vertical-align: middle; }
.qt-table th.num, .qt-table td.num { text-align: right; white-space: nowrap; }
.qt-title-cell { font-weight: 800; line-height: 1.3; max-width: 360px; }
.qt-who { gap: 10px; }
.qt-who .pet-av.sm { --s: 32px; font-size: 18px; }
.qt-valid { font-weight: 800; font-size: 13.5px; }
.qt-valid.warn { color: #9A6A00; }
.qt-valid.bad { color: var(--red-dark); }
.qt-valid.ok { color: var(--mint-dark); }
[data-theme="dark"] .qt-valid.warn { color: var(--sun); }
/* sul telefono le schede, sul computer la tabella */
.qt-cards { display: none; flex-direction: column; gap: 10px; }
.qt-card {
  display: flex; flex-direction: column; gap: 10px; background: var(--card); border-radius: 18px; padding: 12px 14px; border: 2px solid var(--line);
  border-left: 6px solid var(--c, var(--line-2)); color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow-sm);
}
.qt-card-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.qt-card-top .grow { display: flex; flex-direction: column; min-width: 0; }
.qt-card-foot { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.qt-card-foot .qt-valid { font-size: 12.5px; }
.qt-card-total { margin-left: auto; font: 600 17px var(--font-display); }
.qt-empty { padding: 34px 20px; }
.qt-empty p { max-width: 560px; margin: 0 auto 12px; }
.qt-flow { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; counter-reset: qf; }
.qt-flow li { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; background: var(--bg-2); font: 600 14px var(--font-display); }
.qt-flow li + li::before { content: '→'; color: var(--muted); margin-right: 4px; }

/* ---------- editor ---------- */
.qt-head-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qt-steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0 0 18px; }
.qt-step { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); min-width: 0; position: relative; }
.qs-dot { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: var(--bg-2); filter: grayscale(1); opacity: .55; }
.qs-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.qs-txt b { font: 600 13.5px var(--font-display); }
.qs-txt small { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-step.done { border-color: color-mix(in srgb, var(--mint) 45%, var(--line)); background: color-mix(in srgb, var(--mint-soft) 45%, var(--card)); }
.qt-step.done .qs-dot { filter: none; opacity: 1; background: var(--mint-soft); }
.qt-step.done.no { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: color-mix(in srgb, var(--red-soft) 45%, var(--card)); }
.qt-step.done.no .qs-dot { background: var(--red-soft); }
.qt-step.next { border-style: dashed; border-color: var(--sky); }
.qt-step.next .qs-dot { opacity: .9; filter: none; animation: ho-pulse-q 2s ease-in-out infinite; }
.qt-step.late { border-style: dashed; border-color: var(--sun); background: color-mix(in srgb, var(--sun-soft) 45%, var(--card)); }
.qt-step.skip { opacity: .6; }
@keyframes ho-pulse-q { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.qt-stale { align-items: center; }
.qt-sub { font: 800 12px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.qt-sub:first-child { margin-top: 0; }
.qt-bundles .pick-chip { padding: 8px 14px; }
.qt-bundles .pick-chip.bump, .price-chip.bump { animation: pop .4s ease; }
.qt-mini { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 2px dashed var(--line); }
.qt-mini b { font: 600 18px var(--font-display); }
.qt-valid-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qt-valid-row .input { max-width: 180px; }
.qt-valid-chips .pick-chip, .qt-note-chips .pick-chip { padding: 6px 11px; font-size: 13px; }
.qt-note-chips { margin-top: 8px; }
.qt-reach { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.qt-hist-card summary { cursor: pointer; margin: 0; list-style: none; }
.qt-hist-card summary::-webkit-details-marker { display: none; }
.qt-hist-card[open] summary { margin-bottom: 12px; }
.qt-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.qt-history li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.qt-history li:first-child { border-top: 0; }
.qt-history .emoji { font-size: 17px; width: 24px; text-align: center; flex: none; }
.qt-actions-2 { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; width: 100%; }
.inv-actions .btn.lg { flex: 1 1 200px; }

/* carta del preventivo */
.qt-paper .paper-doc b { color: #6C49E6; }
.qt-paper::before { background: linear-gradient(90deg, var(--grape), var(--sky), var(--mint)); }
.qt-paper-title { font: 600 16px var(--font-display); margin: -4px 0 12px; }
.qt-paper-notes { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #FFF7EE; white-space: pre-line; }
.qt-paper-notes small { display: block; color: #8C84A3; font-weight: 800; font-size: 10.5px; text-transform: uppercase; }
.qt-paper-accept { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding: 12px; border: 2px dashed #E8D6BF; border-radius: 14px; }
.qt-paper-qr { flex: none; width: 96px; line-height: 0; }
.qt-paper-qr svg { width: 96px; height: 96px; }
.qt-paper-link { display: block; margin-top: 4px; font-family: ui-monospace, Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; color: #6B6485; }
.qt-sign { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-top: 26px; }
.qt-sign span { border-top: 1.5px solid #2A2140; padding-top: 4px; font-size: 10.5px; color: #8C84A3; }
.qt-paper-ok { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #DBF5E8; color: #17603E; font-size: 13px; }

/* esito (accettato, rifiutato, fatturato) */
.qt-locked { align-items: start; }
.qt-decided { border: 2px solid var(--line); }
.qt-decided.ok { border-color: color-mix(in srgb, var(--mint) 55%, var(--line)); background: color-mix(in srgb, var(--mint-soft) 35%, var(--card)); }
.qt-decided.no { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: color-mix(in srgb, var(--red-soft) 30%, var(--card)); }
.qt-decided.inv { border-color: color-mix(in srgb, var(--grape) 45%, var(--line)); background: color-mix(in srgb, var(--grape-soft) 35%, var(--card)); }
.qt-who-card { display: flex; flex-direction: column; gap: 6px; }
.qt-who-link { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; color: var(--ink); text-decoration: none !important; }
.qt-who-link:hover { background: var(--bg-2); }
.qt-who-link .grow { display: flex; flex-direction: column; }
.qt-who-link svg { width: 18px; height: 18px; color: var(--muted); }

/* invio al cliente */
.qt-send-sum { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--bg-2); margin-bottom: 16px; }
.qt-send-tot { font: 600 20px var(--font-display); }
.qt-send-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.qt-off { opacity: .55; }
.qt-share { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qt-share .copy-field { width: 100%; }

/* ---------- pagina del cliente ---------- */
.qp-page { max-width: 640px; }
.qp-hero { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 14px; border-top: 5px solid var(--c, var(--brand)); }
.qp-hero .pet-av.lg { --s: 64px; font-size: 34px; flex: none; }
.qp-hero-txt h1 { font-size: clamp(19px, 5vw, 24px); margin: 2px 0; line-height: 1.2; }
.qp-label { font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.qp-total { flex: none; text-align: right; display: flex; flex-direction: column; line-height: 1.15; }
.qp-total small { color: var(--muted); font-size: 11px; font-weight: 800; }
.qp-total b { font: 600 22px var(--font-display); color: var(--mint-dark); }
.qp-decide { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; border: 2px solid color-mix(in srgb, var(--mint) 45%, var(--line)); }
.qp-decide-head { display: flex; gap: 12px; align-items: center; }
.qp-decide-head .emoji { font-size: 30px; }
.qp-decide-head b { font: 600 18px var(--font-display); }
.qp-state { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--bg-2); }
.qp-state > .emoji { font-size: 30px; }
.qp-state b { font: 600 17px var(--font-display); }
.qp-state.ok { background: var(--mint-soft); }
.qp-state.no { background: var(--bg-2); }
.qp-state.late { background: var(--sun-soft); }
.qp-lines { display: flex; flex-direction: column; }
.qp-line { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 2px dashed var(--line); }
.qp-line:first-child { border-top: 0; padding-top: 0; }
.qp-kind { font-size: 11px; vertical-align: 1px; }
.qp-amt { flex: none; font-variant-numeric: tabular-nums; }
.qp-totals { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--line); font-size: 14px; }
.qp-totals > div { display: flex; justify-content: space-between; gap: 10px; }
.qp-totals .grand { margin-top: 6px; padding-top: 8px; border-top: 2px solid var(--ink); font-size: 16px; }
.qp-totals .grand b { font: 600 20px var(--font-display); }
.qp-notes { white-space: pre-line; margin: 0; line-height: 1.5; }
.qp-valid { display: flex; gap: 12px; align-items: center; }
.qp-valid > .emoji { font-size: 26px; }
.qp-decide-mini { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; }
.qp-err-emoji { font-size: 70px; display: block; }

/* ---------- schermi piccoli ---------- */
@media (max-width: 1100px) {
  .qt-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .qt-table-card { display: none; }
  .qt-cards { display: flex; }
  .qt-send-grid { grid-template-columns: minmax(0, 1fr); }
  .qt-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .qp-hero { flex-wrap: wrap; }
  .qp-total { text-align: left; width: 100%; flex-direction: row; align-items: baseline; gap: 8px; }
  .qt-sign { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .qt-step.next .qs-dot { animation: none; } }

/* ---------- stampa ---------- */
@media print {
  .qp-noprint { display: none !important; }
  .qp-page .pp-sec, .qp-page .qp-hero, .qp-page .qp-state { box-shadow: none; border: 1px solid #ddd; }
}
