/* Preventivi (js/quotes.js) */
.q-b-draft { background: rgba(143,154,146,.16); color: var(--muted); }
.q-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.q-right b { font-size: 15px; font-variant-numeric: tabular-nums; }
.q-exp { color: var(--late); }
.q-sum { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.q-opt { font-weight: 400; opacity: .8; }
.q-hint { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.q-hint a { color: var(--accent); }
.q-link { display: inline; background: none; border: 0; padding: 0; min-height: 0; border-radius: 0; color: var(--accent); font-size: 13px; font-weight: 600; }
.q-ex { margin-top: 8px; }
.q-gap { margin-top: 16px; }
.q-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.q-three label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* evita che il campo in cui scrivi finisca sotto il riquadro dei totali */
html:has(.q-editor) { scroll-padding-bottom: 190px; }

/* i bottoni hanno display esplicito: senza questa regola l'attributo hidden non li nasconde */
.q-editor [hidden] { display: none !important; }

/* voci */
.q-line { background: var(--panel); border-radius: var(--radius); padding: 10px 10px 10px 12px; margin-bottom: 8px; }
.q-line input, .q-line textarea { background: var(--bg); min-height: 40px; padding: 8px 10px; border-radius: 10px; }
.q-line-top { display: flex; gap: 4px; align-items: flex-start; }
.q-desc { flex: 1; min-width: 0; min-height: 40px; resize: none; overflow: hidden; font-weight: 600; line-height: 1.35; }
.q-x { flex: none; background: none; min-height: 40px; width: 38px; padding: 0; color: var(--muted); font-size: 22px; font-weight: 400; }
.q-line-code { margin: 4px 0 0 2px; line-height: 1; }
.q-line-code .code { font-size: 11px; }
.q-line-grid { display: grid; grid-template-columns: 1fr 1.45fr 1fr; gap: 8px; margin-top: 6px; padding-right: 2px; }
.q-line-grid label { margin: 0; font-size: 11.5px; }
.q-line-grid input { margin-top: 3px; text-align: right; font-variant-numeric: tabular-nums; }
.q-line-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-right: 2px; }
.q-pill { min-height: 34px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: transparent; border: 1px solid var(--line); color: var(--muted); }
.q-pill.on { background: rgba(127,178,255,.15); border-color: transparent; color: var(--booked); }
.q-costbtn { min-height: 34px; padding: 5px 6px; font-size: 12.5px; font-weight: 500; background: none; color: var(--muted); white-space: nowrap; }
.q-lt { margin-left: auto; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-cost { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.q-cost .grow { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.q-cost .grow b { display: block; font-weight: 600; }
.q-cost .grow span { color: var(--muted); font-size: 12px; }
.q-cost input { flex: none; width: 108px; text-align: right; border-style: dashed; font-variant-numeric: tabular-nums; }
.q-undo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* regime fiscale nell'editor */
.q-editor .seg + .q-hint { margin: 8px 0 2px; }
.q-private { color: var(--out); letter-spacing: .04em; }

/* costi interni (mai nel PDF): stessa scheda delle voci, bordo tratteggiato per ricordare che sono "solo vostri" */
.q-cline { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 10px 10px 12px; margin-bottom: 8px; }
.q-cline input, .q-cline select { background-color: var(--bg); min-height: 40px; padding: 8px 10px; border-radius: 10px; }
.q-cline select { padding-right: 30px; font-size: 14px; }
.q-cdesc { flex: 1; min-width: 0; font-weight: 600; }
.q-cgrid { display: grid; grid-template-columns: 1fr 108px; gap: 8px; margin-top: 8px; padding-right: 2px; }
.q-cgrid input { text-align: right; font-variant-numeric: tabular-nums; }
.q-cempty { margin: 0 0 10px; }

/* conti interni: dal totale cliente al margine */
.q-conti { background: var(--panel); border-radius: var(--radius); padding: 6px 14px; }
.q-cr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; font-size: 14px; color: var(--muted); }
.q-cr span { min-width: 0; }
.q-cr small { display: block; font-size: 12px; opacity: .8; margin-top: 1px; }
.q-cr b { flex: none; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-cr-sum { border-top: 1px solid var(--line); color: var(--text); font-weight: 600; }
.q-cr-sum b { font-weight: 700; font-size: 15px; }
.q-cr.q-pos b { color: var(--accent); }
.q-cr.q-neg b { color: var(--late); }
.q-conti .q-hint { margin: 2px 0 8px; }

/* totali sempre visibili sopra la barra delle schede */
.q-sticky { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); margin-top: 18px; z-index: 5; }
.q-totbox { display: flex; gap: 12px; align-items: flex-end; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(34,39,35,.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.q-rows { flex: 1; min-width: 0; display: grid; grid-template-columns: auto auto; gap: 2px 10px; align-content: end;
  font-size: 12.5px; color: var(--muted); }
.q-rows span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-rows span:nth-child(even) { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.q-rows .q-pos:nth-child(even) { color: var(--accent); }
.q-rows .q-neg:nth-child(even) { color: var(--late); }
.q-totmain { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.q-totmain span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.q-totmain b { font-size: 22px; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.q-totmain .small-btn { margin-top: 6px; min-width: 104px; }

/* voce libera: preset */
.q-preset { width: 100%; border-radius: 0; background: transparent; justify-content: flex-start; text-align: left; color: var(--text); }
.q-preset:active { background: var(--panel-2); }
.q-preset .title, .q-preset .sub { display: block; }
.q-preset .sub { font-weight: 400; margin-top: 1px; }

/* PDF pronto */
.q-file { display: flex; gap: 12px; align-items: center; background: var(--bg); border-radius: 12px; padding: 12px; }
.q-file .grow { flex: 1; min-width: 0; }
.q-file .title { font-weight: 600; overflow-wrap: anywhere; }
.q-file .sub { font-size: 13px; color: var(--muted); }
.q-file-ic { flex: none; width: 40px; height: 50px; border-radius: 6px; background: #fff; color: #c8372d; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; letter-spacing: .04em; }
.q-check { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; font-size: 15px; color: var(--text); cursor: pointer; }
.q-check input { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); }

@media (max-width: 360px) {
  .q-three { grid-template-columns: 1fr 1fr; }
  .q-totmain b { font-size: 19px; }
}

/* iOS Safari ingrandisce la pagina sui campi con testo < 16px: li teniamo a 16px */
#view input, #view select, #view textarea, #sheet input, #sheet select, #sheet textarea { font-size: 16px; }
