:root {
  --sidebar-bg: #1b2a38;
  --sidebar-bg-active: #24384a;
  --sidebar-text: #c3cdd6;
  --sidebar-text-muted: #7c8b98;
  --accent: #2f5d62;
  --accent-dark: #244749;
  --content-bg: #f2f4f5;
  --border-color: #dfe3e6;
}

body {
  background: var(--content-bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.925rem;
}

.color-field {
  margin-bottom: 0.65rem;
}

.color-field:last-child {
  margin-bottom: 0;
}

.color-field-hex {
  width: 84px;
  font-family: "SFMono-Regular", Consolas, monospace;
  text-transform: lowercase;
}

.color-field-toggle {
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.color-field-advanced {
  margin-top: 0.4rem;
  padding: 0.5rem 0.6rem;
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.cmyk-input {
  width: 48px;
}

.rgb-input {
  width: 48px;
}

.lead-layout-item {
  cursor: grab;
}

.lead-layout-item:active {
  cursor: grabbing;
}

.lead-layout-item .bi-grip-vertical {
  cursor: grab;
}

.province-suggest {
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

.province-suggest a {
  text-decoration: none;
  font-weight: 600;
}

.province-suggest a:hover {
  text-decoration: underline;
}

/* --- Scheda lead/cliente: mattonelle invece di tab ------------------- */
.lead-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 992px) {
  .lead-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .lead-tile-wide {
    grid-column: 1 / -1;
  }
}

.lead-tile .card-header .badge {
  font-weight: 500;
}

.settings-breadcrumb {
  font-size: 0.82rem;
  color: #6b7a86;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.settings-breadcrumb a {
  color: var(--accent-dark);
  text-decoration: none;
}

.settings-breadcrumb a:hover {
  text-decoration: underline;
}

.settings-breadcrumb-sep {
  color: #b7c0c7;
}

.settings-breadcrumb-current {
  color: #6b7a86;
}

/* --- Layout autenticato ---------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}

.app-sidebar .brand {
  padding: 1.2rem 1.3rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.01em;
}

.app-sidebar .brand .brand-logo {
  display: block;
  max-width: 100%;
  max-height: 42px;
}

.app-sidebar .brand small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--sidebar-text-muted);
  margin-top: 0.15rem;
}

.app-sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 0 1.5rem;
}

.app-sidebar .nav-group {
  border-bottom: 1px solid transparent;
}

.app-sidebar .nav-group-header {
  display: flex;
  align-items: center;
}

.app-sidebar .nav-group-title-link,
.app-sidebar .nav-group-title-link.disabled {
  flex: 1;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-muted);
  padding: 0.9rem 0 0.9rem 1.3rem;
  text-decoration: none;
  display: block;
}

.app-sidebar .nav-group-title-link:hover {
  color: #fff;
}

.app-sidebar .nav-group-title-link.disabled {
  pointer-events: none;
  cursor: default;
}

.app-sidebar .nav-group.active > .nav-group-header .nav-group-title-link {
  color: #fff;
}

.app-sidebar .nav-group-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.app-sidebar .nav-group-toggle:hover {
  color: #fff;
}

.app-sidebar .nav-group-toggle i {
  transition: transform 0.15s ease;
  display: inline-block;
}

.app-sidebar .nav-group.expanded .nav-group-toggle i {
  transform: rotate(180deg);
}

.app-sidebar .nav-subgroup {
  overflow: hidden;
  max-height: 0;
}

.app-sidebar .nav-group.expanded .nav-subgroup {
  max-height: none;
}

.app-sidebar .nav-link {
  color: var(--sidebar-text);
  padding: 0.45rem 1.3rem;
  font-size: 0.87rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-left: 3px solid transparent;
}

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.app-sidebar .nav-link.active {
  background: var(--sidebar-bg-active);
  color: #fff;
  border-left-color: var(--accent);
}

.app-sidebar .nav-link.disabled {
  color: var(--sidebar-text-muted);
  pointer-events: none;
}

.app-sidebar .nav-link .badge-soon {
  margin-left: auto;
  font-size: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-content {
  padding: 1.6rem;
  flex: 1;
}

.card {
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(20, 30, 40, 0.04);
  overflow-x: auto; /* una card più larga dello schermo scorre invece di tagliare i contenuti (es. tabelle) */
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--accent-dark);
  border-color: var(--accent-dark);
}

a {
  color: var(--accent-dark);
}

.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7680;
  border-bottom-width: 1px;
}

/* --- Layout ospite (login) --------------------------------------------- */
.guest-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1b2a38 0%, #24384a 55%, #2f5d62 100%);
  padding: 1.5rem;
}

.guest-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(10, 20, 30, 0.25);
  width: 100%;
  max-width: 400px;
  padding: 2.2rem 2rem;
}

.guest-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.guest-card .subtitle {
  color: #6b7680;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* --- Conversazione WhatsApp (stile chat) --------------------------------- */
.chat-thread {
  background: #e9edf0;
  border-radius: 10px;
  padding: 1.2rem;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-bubble {
  max-width: 70%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.chat-bubble.in {
  align-self: flex-start;
  background: #fff;
  border-top-left-radius: 2px;
}

.chat-bubble.out {
  align-self: flex-end;
  background: #d9f2d4;
  border-top-right-radius: 2px;
}

.chat-bubble .meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: #7c8b98;
}

/* Documento proposta (scheda Servizi erogati, sezioni narrative, box Investimento):
   condiviso tra la vista interna (quotes/show) e il partial incluso in quotes/print,
   che essendo una pagina autonoma senza app.css ripete queste regole nel suo <style>. */
.quote-doc-section {
  margin-bottom: 2rem;
}

.quote-doc-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 600;
  border-bottom: 2px solid var(--accent, #0d6efd);
  padding-bottom: 0.5rem;
  margin-bottom: 0.9rem;
}

.quote-doc-section-title .icon {
  font-size: 1.35rem;
  color: var(--accent, #0d6efd);
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.quote-doc-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #333;
}

.quote-doc-content p:last-child {
  margin-bottom: 0;
}

.quote-doc-services-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.quote-doc-services-list li {
  padding: 0.5rem 0 0.5rem 1.7rem;
  position: relative;
  border-bottom: 1px dashed #e5e5e5;
  font-size: 0.95rem;
}

.quote-doc-services-list li:last-child {
  border-bottom: none;
}

.quote-doc-services-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: #198754;
  font-weight: bold;
}

.quote-doc-investment {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.quote-doc-tier {
  border: 2px solid #e2e2e2;
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.quote-doc-tier.is-popular {
  border-color: #198754;
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.18);
  transform: translateY(-6px);
}

.quote-doc-tier-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: #198754;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

.quote-doc-tier h3 {
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.quote-doc-tier .tier-headline {
  font-size: 0.85rem;
  color: #198754;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.quote-doc-tier .tier-desc {
  font-size: 0.85rem;
  color: #555;
  flex-grow: 1;
  margin: 0.4rem 0;
}

.quote-doc-tier .tier-payment {
  font-size: 0.78rem;
  color: #777;
}

.quote-doc-tier .tier-deposit {
  font-size: 0.78rem;
  color: #777;
  margin-bottom: 0.5rem;
}

.quote-doc-tier .tier-price {
  font-size: 1.9rem;
  font-weight: 700;
  margin: 0.5rem 0 0.1rem;
  color: #222;
}

.quote-doc-tier .tier-price-note {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.75rem;
}

.quote-doc-tier .tier-choose {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #555;
}

.quote-section-icon-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.quote-section-icon-picker .icon-preview {
  width: 42px;
  height: 42px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--accent, #0d6efd);
  flex-shrink: 0;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 0.5rem;
}

.icon-picker-grid button {
  border: 1px solid transparent;
  background: #f8f9fa;
  border-radius: 6px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #444;
  cursor: pointer;
}

.icon-picker-grid button:hover {
  background: #e9ecef;
}

.icon-picker-grid button.selected {
  border-color: var(--accent, #0d6efd);
  background: #e7f1ff;
  color: var(--accent, #0d6efd);
}

/* Form Nuova/Modifica proposta: niente più larghezza fissa (era max-width:900px anche su
   schermi larghissimi) — usa lo spazio disponibile fino a un tetto ragionevole, così i campi
   dell'editor di testo nei box Investimento non restano schiacciati su schermi larghi. */
.quote-form {
  width: 100%;
  max-width: 1400px;
}

.quote-form .tox-tinymce {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  .quote-section-icon-picker {
    flex-wrap: wrap;
  }
}

/* Firme in fondo al documento proposta (quotes/show, dentro app.css; quotes/print ripete le
   stesse classi nel proprio <style> perché è una pagina autonoma). */
.quote-doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3.5rem;
}

.sig-block {
  text-align: center;
}

.sig-image {
  max-height: 70px;
  max-width: 100%;
  margin-bottom: 0.3rem;
}

.sig-name {
  font-family: 'Brush Script MT', cursive;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.sig-line {
  border-top: 1px solid #333;
  margin-top: 2.5rem;
}

.sig-label {
  font-size: 0.85rem;
  color: #444;
  margin-top: 0.4rem;
}

/* Trascinamento sezioni/righe nel form Nuova/Modifica proposta: il cursore "grab" compare solo
   sull'intestazione/maniglia, non su tutta la card (altrimenti sembra che si possa trascinare
   anche cliccando dentro un campo di testo). */
.quote-section-block > .card-header {
  cursor: grab;
}

.quote-drag-handle {
  cursor: grab;
}

.service-line-row {
  cursor: grab;
}

.service-line-row .form-control,
.service-line-row button {
  cursor: auto;
}
