/* Progetti: "Parlami del tuo progetto" nella pagina Inizia e chat con lo studio (area riservata e app studio). */

.ml-project-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  column-gap: 16px;
}
.ml-project-form .ml-check { align-items: flex-start; }
.ml-project-form .ml-check input { flex-shrink: 0; margin-top: 2px; }
.ml-project-form .ml-check a { color: var(--ml-blue); font-weight: 600; }
.ml-project-form > .ml-btn { margin-bottom: 18px; }
.ml-project-form .ml-step-note a { color: var(--ml-blue); font-weight: 700; }
.ml-project-error { margin: 0 0 14px; color: #A53E10; font-weight: 600; font-size: 14px; }
.ml-project-error:empty { display: none; }
.ml-project-sent { text-align: center; padding: 8px 0 4px; }
.ml-project-sent .ml-success-icon { margin: 0 auto 16px; }
.ml-project-sent p { max-width: 560px; margin: 8px auto 22px; color: var(--ml-text); }
.ml-project-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
@media (max-width: 640px) {
  .ml-project-grid { grid-template-columns: minmax(0, 1fr); }
  .ml-project-actions .ml-btn { width: 100%; }
}

/* Barra dei passaggi con "Primo contatto": 6 voci (ordine) o 5 (progetto) */
@media (min-width: 992px) {
  .ml-progress { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ml-progress-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ml-progress-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Stato del progetto */
.ml-project-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--ml-font-display);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(242, 161, 69, 0.18);
  color: #B4560F;
}
.ml-project-badge-ordered { background: rgba(46, 160, 90, 0.14); color: #1E7A43; }
.ml-project-badge-closed { background: rgba(28, 28, 28, 0.07); color: #6B6E73; }

/* Chat con lo studio */
.ml-chat {
  list-style: none;
  margin: 18px 0 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--ml-line);
  border-radius: 18px;
  background: rgba(244, 246, 251, 0.7);
}
.ml-chat-msg.is-new { animation: ml-chat-in .25s ease; }
@keyframes ml-chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ml-chat-note { margin-bottom: 0; }
.ml-chat-form .ml-field { margin-bottom: 10px; }
.ml-chat-form textarea { min-height: 80px; }
@media (max-width: 640px) {
  .ml-chat { height: 55vh; min-height: 300px; }
}
.ml-chat-msg { max-width: 85%; align-self: flex-start; }
.ml-chat-msg.is-mine { align-self: flex-end; text-align: right; }
.ml-chat-bubble {
  display: inline-block;
  text-align: left;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(66, 133, 230, 0.1);
  color: var(--ml-ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ml-chat-msg.is-mine .ml-chat-bubble { border-radius: 18px 18px 6px 18px; background: var(--ml-blue); color: #fff; }
.ml-chat-msg small { display: block; margin-top: 6px; font-size: 12px; color: var(--ml-muted); }
.ml-chat-form { margin-top: 8px; }

/* Area riservata: elenco dei progetti */
.ml-project-unread {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ml-orange);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

/* App studio: dettagli della richiesta */
.ml-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.ml-dl dt { color: var(--ml-muted); font-size: 14px; }
.ml-dl dd { margin: 0; font-weight: 600; color: var(--ml-ink); }

/* Area riservata: "Scegli il servizio" dentro il progetto */
.ml-project-services { display: grid; gap: 16px; margin-top: 18px; }
.ml-project-service {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--ml-line);
  border-radius: 18px;
  background: #fff;
}
.ml-project-service img { width: 100%; height: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; }
.ml-project-service .ml-h3 { margin: 2px 0 6px; font-size: 20px; }
.ml-project-service p { margin: 0 0 10px; color: var(--ml-text); font-size: 15px; }
.ml-project-service .ml-features { margin: 0 0 14px; }
.ml-price-from { margin-left: 6px; font-size: 15px; font-weight: 700; color: var(--ml-orange-dark); white-space: nowrap; }
@media (max-width: 640px) {
  .ml-project-service { grid-template-columns: minmax(0, 1fr); }
  .ml-project-service img { max-height: 160px; }
  .ml-project-service .ml-btn { width: 100%; }
}

/* Progetto: i primi due passaggi sono le schede della pagina */
.ml-progress li a { display: flex; align-items: center; gap: 10px; width: 100%; color: inherit; text-decoration: none; }
.ml-progress li.is-viewing { outline: 2px solid var(--ml-blue); outline-offset: -2px; }
.ml-progress li a:hover { color: var(--ml-blue); }

/* Riquadro laterale "Prossimi passi": spazio tra testo e pulsante */
.ml-project-next .ml-muted { margin-bottom: 18px; }
.ml-project-next p + .ml-btn { margin-top: 4px; }
.ml-project-next .ml-btn + p { margin-top: 18px; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

/* Progetto concluso: "Ordine effettuato" */
.ml-project-done { text-align: center; }
.ml-project-done .ml-success-icon { margin: 4px auto 16px; }
.ml-project-done > p { max-width: 520px; margin: 8px auto 22px; color: var(--ml-text); }
.ml-project-order {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--ml-line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}
.ml-project-order > span { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ml-project-origin { margin: -8px 0 20px; color: var(--ml-muted); font-size: 14px; }
.ml-project-origin a { color: var(--ml-blue); font-weight: 700; }
@media (max-width: 640px) {
  .ml-progress-3 { grid-template-columns: minmax(0, 1fr); }
  .ml-project-order .ml-btn { width: 100%; }
}

/* Chat del cliente: pulsante e indicazione "Invio per inviare" */
.ml-chat-send { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.ml-chat-hint { color: var(--ml-muted); font-size: 13px; }
@media (pointer: coarse) { .ml-chat-hint { display: none; } }

/* Area riservata: titolo "I tuoi progetti" con il pulsante "Nuovo progetto" */
.ml-section-head-action { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.ml-section-head-action .ml-h2 { margin: 0; }
@media (max-width: 640px) { .ml-section-head-action .ml-btn { width: 100%; } }

/* Nome del progetto nel modulo e nell'app studio */
.ml-project-form .ml-field > span em { font-style: normal; font-weight: 600; color: var(--ml-muted); }
.ml-project-title-line { margin: 2px 0 4px; font-family: var(--ml-font-display); font-weight: 700; font-size: 18px; color: var(--ml-ink); }

/* ---- Preventivi ---------------------------------------------------------- */
.ml-quote-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--ml-font-display);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(66, 133, 230, 0.12);
  color: #2559A6;
}
.ml-quote-draft { background: rgba(28, 28, 28, 0.07); color: #6B6E73; }
.ml-quote-sent { background: rgba(242, 161, 69, 0.18); color: #B4560F; }
.ml-quote-paid { background: rgba(46, 160, 90, 0.14); color: #1E7A43; }
.ml-quote-expired, .ml-quote-cancelled { background: rgba(200, 60, 60, 0.1); color: #A52B2B; }

/* Pagina del preventivo (cliente) */
.ml-quote-intro { margin: 0 0 18px; color: var(--ml-text); line-height: 1.55; }
.ml-quote-table { width: 100%; border-collapse: collapse; }
.ml-quote-table th { text-align: left; font-size: 13px; color: var(--ml-muted); font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--ml-line); }
.ml-quote-table td { padding: 12px 8px; border-bottom: 1px solid var(--ml-line); vertical-align: top; color: var(--ml-ink); }
.ml-quote-table th:not(:first-child), .ml-quote-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.ml-quote-table td small { display: block; margin-top: 3px; color: var(--ml-muted); font-size: 13px; }
.ml-quote-totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; margin: 18px 0 0 auto; max-width: 360px; }
.ml-quote-totals dt { color: var(--ml-muted); text-align: right; }
.ml-quote-totals dd { margin: 0; text-align: right; font-weight: 600; color: var(--ml-ink); }
.ml-quote-totals .ml-quote-total { font-family: var(--ml-font-display); font-size: 20px; font-weight: 800; color: var(--ml-ink); padding-top: 8px; border-top: 1px solid var(--ml-line); }
.ml-quote-totals dd.ml-quote-total { color: var(--ml-orange-dark); }
.ml-quote-terms { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 26px 0 0; }
.ml-quote-terms dt { font-weight: 700; color: var(--ml-ink); }
.ml-quote-terms dd { margin: 0; color: var(--ml-text); }
.ml-quote-legal, .ml-quote-small { margin: 22px 0 0; font-size: 13px; color: var(--ml-muted); }
.ml-quote-pdf-btn { margin-top: 12px; }
@media (max-width: 640px) {
  .ml-quote-terms { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ml-quote-terms dd { margin-bottom: 10px; }
  .ml-quote-totals { max-width: none; }
}

/* App studio: clienti */
.ml-new-client > summary { list-style: none; cursor: pointer; }
.ml-new-client > summary::-webkit-details-marker { display: none; }
.ml-new-client[open] > summary { margin-bottom: 16px; }
.ml-search { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 0 14px; border-radius: 14px; background: #fff; border: 1px solid var(--ml-line); }
.ml-search i { color: var(--ml-muted); }
.ml-search input { flex: 1; border: 0; padding: 12px 0; font: inherit; background: transparent; outline: none; }
.ml-invite-box p { margin: 0 0 12px; color: var(--ml-text); }
.ml-invite-box i { color: var(--ml-blue); }

/* App studio: editor del preventivo */
.ml-quote-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 14px; }
.ml-quote-head a { color: var(--ml-blue); font-weight: 700; text-decoration: none; }
.ml-quote-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ml-quote-form fieldset[disabled] { opacity: 0.75; }
.ml-billing { margin-top: 6px; }
.ml-billing > summary { cursor: pointer; font-weight: 700; color: var(--ml-blue); margin-bottom: 12px; }
.ml-billing > summary em { font-style: normal; font-weight: 600; color: var(--ml-muted); }
.ml-quote-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 14px; }
.ml-quote-add select { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--ml-line); font: inherit; background: #fff; }
.ml-quote-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ml-quote-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 110px 92px 36px;
  grid-template-areas: "desc qty unit total remove" "details details details details details";
  gap: 8px 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--ml-line);
  border-radius: 14px;
  background: #fff;
}
.ml-quote-item input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--ml-line); font: inherit; box-sizing: border-box; }
.ml-qi-desc { grid-area: desc; font-weight: 600; }
.ml-qi-details { grid-area: details; font-size: 14px; }
.ml-qi-num span { display: block; font-size: 12px; color: var(--ml-muted); margin-bottom: 4px; }
.ml-qi-num:nth-of-type(1) { grid-area: qty; }
.ml-qi-num:nth-of-type(2) { grid-area: unit; }
.ml-qi-total { grid-area: total; text-align: right; padding-bottom: 10px; }
.ml-qi-remove { grid-area: remove; border: 0; background: none; color: #A52B2B; font-size: 16px; padding: 10px 0; cursor: pointer; }
.ml-quote-form .ml-quote-totals { margin-top: 14px; }
.ml-quote-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 16px; }
.ml-quote-secondary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.ml-quote-secondary form { margin: 0; }
.ml-btn-danger { color: #A52B2B !important; }
@media (max-width: 640px) {
  .ml-quote-add { grid-template-columns: minmax(0, 1fr); }
  .ml-quote-item {
    grid-template-columns: 1fr 1fr 36px;
    grid-template-areas: "desc desc remove" "details details details" "qty unit unit" "total total total";
  }
  .ml-quote-actions { grid-template-columns: minmax(0, 1fr); }
}
