/* ==========================================================================
   KAM CRM — design system: nero + oro (brand KAM Agency)
   ========================================================================== */

:root {
  --black: #111111;
  --black-soft: #1c1a17;
  --gold: #ab8043;
  --gold-dark: #7a5a2e;
  --gold-light: #f5ead9;
  --gold-tint: #faf5ec;

  --bg: #f6f5f2;
  --surface: #ffffff;
  --border: #e6e2d9;
  --border-soft: #f0ede6;

  --text: #201d19;
  --text-muted: #79746a;
  --text-inverse: #fbf9f5;

  --danger: #b3432f;
  --danger-bg: #fbeae6;
  --success: #3f7a5c;
  --success-bg: #e9f3ee;
  --warning: #a9761f;
  --warning-bg: #faf1de;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.06);
  --shadow-md: 0 8px 24px rgba(17, 17, 17, 0.10);
  --shadow-lg: 0 20px 48px rgba(17, 17, 17, 0.18);
  --sidebar-w: 236px;
  --bottom-nav-h: 60px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* --------------------------------------------------------------------- */
/* Layout                                                                 */
/* --------------------------------------------------------------------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--black);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand { padding: 16px 10px 22px; }
.sidebar-brand-plate {
  background: #ffffff; border-radius: var(--radius-sm); padding: 14px 16px; display: flex; justify-content: center;
}
.sidebar-brand-plate img { width: 100%; max-width: 130px; display: block; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: #d9d5cc;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active { background: var(--gold); color: var(--black); font-weight: 700; }
.nav-icon { font-size: 12px; width: 14px; text-align: center; opacity: 0.85; }
.nav-text-short { display: none; }

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 10px;
}
.sidebar-user { font-size: 12.5px; color: #b7b2a6; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.page-title { font-size: 21px; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.back-link { text-decoration: none; color: var(--text-muted); font-size: 14px; margin-right: 4px; }
.back-link:hover { color: var(--gold-dark); }

.topbar-logo { display: none; height: 26px; width: auto; }
.topbar-logout { display: none; margin: 0; }
.btn-icon-logout {
  border: none; background: var(--border-soft); color: var(--text-muted);
  width: 38px; height: 38px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.btn-icon-logout:hover { background: var(--danger-bg); color: var(--danger); }

.content { padding: 28px 32px 60px; flex: 1; }

/* --------------------------------------------------------------------- */
/* Login                                                                  */
/* --------------------------------------------------------------------- */

.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1d1a16 0%, var(--black) 60%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.login-card {
  width: min(380px, 92vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px 32px;
  text-align: center;
}
.login-logo { width: 150px; margin: 0 auto 36px; display: block; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 4px; }
.btn-block { width: 100%; margin-top: 10px; }

/* --------------------------------------------------------------------- */
/* Buttons                                                                */
/* --------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.btn-gold { background: var(--gold); color: var(--black); box-shadow: var(--shadow-sm); }
.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dark); }

.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-bg); }

.btn-text { background: transparent; color: var(--text-muted); }
.btn-text:hover { color: var(--text); }
.btn-text-danger { background: transparent; color: var(--danger); }
.btn-text-danger:hover { text-decoration: underline; }

.btn-link { background: none; border: none; padding: 0; color: var(--gold-dark); font-weight: 600; cursor: pointer; font-size: 13px; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--danger); margin-left: 10px; }

.btn-confirming { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }

.btn-icon-remove {
  border: none; background: var(--border-soft); color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1;
  flex-shrink: 0;
}
.btn-icon-remove:hover { background: var(--danger-bg); color: var(--danger); }

.file-replace-label { cursor: pointer; }
.file-input-hidden { display: none; }

/* --------------------------------------------------------------------- */
/* Forms                                                                  */
/* --------------------------------------------------------------------- */

.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: 0.03em; }
.field-label:first-child { margin-top: 0; }

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(171, 128, 67, 0.18); }
textarea.field-input { resize: vertical; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group + .field-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border-soft); }

.checkbox-label { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; cursor: pointer; }

.search-input { max-width: 340px; }
.filtro-select { max-width: 220px; }

.toolbar { margin-bottom: 18px; }

/* --------------------------------------------------------------------- */
/* Badges & chips                                                         */
/* --------------------------------------------------------------------- */

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-prob-bassa { background: #eef1ee; color: #556b5b; }
.badge-prob-media { background: var(--gold-tint); color: var(--gold-dark); }
.badge-prob-alta { background: var(--gold-light); color: var(--gold-dark); }
.badge-prob-in_chiusura { background: var(--black); color: var(--gold); }
.badge-stato-aperta { background: #eef1ee; color: #556b5b; }
.badge-stato-vinta { background: var(--success-bg); color: var(--success); }
.badge-stato-persa { background: var(--danger-bg); color: var(--danger); }
.badge-attivo { background: var(--success-bg); color: var(--success); }
.badge-archiviato { background: var(--border-soft); color: var(--text-muted); }

.chip {
  display: inline-block;
  background: var(--gold-tint);
  color: var(--gold-dark);
  border: 1px solid var(--gold-light);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}

/* --------------------------------------------------------------------- */
/* Tables                                                                 */
/* --------------------------------------------------------------------- */

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--gold-tint); }
.table-actions { white-space: nowrap; }
.table-link { color: var(--gold-dark); font-weight: 600; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); }

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* --------------------------------------------------------------------- */
/* Pipeline: riepilogo + filtro                                           */
/* --------------------------------------------------------------------- */

.pipeline-summary { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.summary-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 22px; box-shadow: var(--shadow-sm); min-width: 160px;
}
.summary-value { display: block; font-size: 24px; font-weight: 700; color: var(--black); }
.summary-label { font-size: 12px; color: var(--text-muted); }

.segmented-filter { margin-bottom: 16px; }
.segmented-filter .segmented-btn { display: inline-flex; align-items: center; gap: 7px; }
.segmented-filter .segmented-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); opacity: 0.5; }
.segmented-filter .seg-bassa::before { background: #5f7d6c; opacity: 1; }
.segmented-filter .seg-media::before { background: var(--gold); opacity: 1; }
.segmented-filter .seg-alta::before { background: var(--gold-dark); opacity: 1; }
.segmented-filter .seg-in_chiusura::before { background: var(--black); opacity: 1; }
.segmented-filter .segmented-btn.active::before { opacity: 1; }
.seg-count { opacity: 0.7; font-weight: 500; }

.filter-mobile-select { display: none; }

/* Card dedicata alle opportunita' (solo mobile): meno informazioni, piu'
   leggibili, niente etichette di campo ripetute come nella tabella. */
.pipeline-cards { display: none; flex-direction: column; gap: 10px; }
.pipeline-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.pipeline-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.pipeline-card-cliente { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.pipeline-card-categoria { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.pipeline-card-pacchetti { margin-bottom: 12px; }
.pipeline-card-pacchetti:empty { display: none; }
.pipeline-card-footer { display: flex; justify-content: flex-end; }
.pipeline-card-valore { font-weight: 700; font-size: 17px; color: var(--gold-dark); }

/* --------------------------------------------------------------------- */
/* Tabs & segmented control                                               */
/* --------------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; background: var(--border-soft); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.tab-btn { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.tab-btn.active { background: var(--surface); color: var(--black); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented-btn {
  border: 1.5px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-muted);
}
.segmented-btn.active.seg-bassa { background: #e7ebe8; border-color: #c4d0c9; color: #4a6355; }
.segmented-btn.active.seg-media { background: var(--gold-tint); border-color: var(--gold-light); color: var(--gold-dark); }
.segmented-btn.active.seg-alta { background: var(--gold-light); border-color: var(--gold); color: var(--gold-dark); }
.segmented-btn.active.seg-in_chiusura { background: var(--black); border-color: var(--black); color: var(--gold); }

/* --------------------------------------------------------------------- */
/* Autocomplete                                                           */
/* --------------------------------------------------------------------- */

.autocomplete { position: relative; }
.autocomplete-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 220px; overflow-y: auto; z-index: 20;
}
.autocomplete-item { padding: 10px 12px; cursor: pointer; font-size: 13px; }
.autocomplete-item:hover { background: var(--gold-tint); }
.autocomplete-empty { padding: 10px 12px; color: var(--text-muted); font-size: 12.5px; }

.selected-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--gold-tint); border: 1px solid var(--gold-light);
  color: var(--gold-dark); font-weight: 600; padding: 7px 12px; border-radius: 999px; margin-top: 8px; font-size: 13px;
}
.selected-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; }

/* --------------------------------------------------------------------- */
/* Pacchetti rows (form dinamico opportunità)                             */
/* --------------------------------------------------------------------- */

.pacchetti-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pacchetto-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; }
.pacchetti-total { text-align: right; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pacchetti-total strong { color: var(--gold-dark); }

/* --------------------------------------------------------------------- */
/* Modal                                                                  */
/* --------------------------------------------------------------------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 15, 12, 0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-overlay.modal-open { opacity: 1; }
.modal-panel {
  background: var(--surface); border-radius: var(--radius-lg); width: min(520px, 100%);
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.98); transition: transform 0.18s ease;
}
.modal-overlay.modal-open .modal-panel { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 17px; }
.modal-subtitle { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-subtitle:empty { display: none; }
.modal-close { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions-split { justify-content: space-between; align-items: center; }
.modal-actions-left, .modal-actions-right { display: flex; gap: 8px; }

.detail-pacchetti { margin-bottom: 8px; }
.detail-pacchetto-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.detail-total { border-bottom: none; border-top: 1.5px solid var(--border); margin-top: 2px; font-weight: 700; }

/* --------------------------------------------------------------------- */
/* Detail page (cliente)                                                  */
/* --------------------------------------------------------------------- */

.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 16px; }
.def-list { display: grid; grid-template-columns: 90px 1fr; gap: 10px 12px; margin: 0; font-size: 13.5px; }
.def-list dt { color: var(--text-muted); font-weight: 600; }
.def-list dd { margin: 0; }

.storico-list { display: flex; flex-direction: column; gap: 12px; }
.storico-item { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; }
.storico-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.storico-valore { margin-left: auto; color: var(--gold-dark); }

/* --------------------------------------------------------------------- */
/* Toast                                                                  */
/* --------------------------------------------------------------------- */

.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--black); color: var(--text-inverse); padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease; max-width: 320px;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--black); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }

.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--gold-tint); border-bottom: 1px solid var(--gold-light);
  padding: 10px 24px;
}
.install-banner-text { font-size: 12.5px; color: var(--gold-dark); font-weight: 600; }
.install-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* --------------------------------------------------------------------- */
/* Responsive                                                             */
/* --------------------------------------------------------------------- */

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------- */
/* Mobile (<= 720px): topbar con logo + logout, tab bar inferiore fissa,  */
/* tabelle (inclusa la pipeline) come liste di card facili da consultare. */
/* --------------------------------------------------------------------- */

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }

  /* Topbar: riga 1 = logo + titolo (troncato) + logout; riga 2 = azione a piena
     larghezza (se presente), cosi' non si sovrappone mai a nient'altro. */
  .topbar {
    padding: 12px 14px; gap: 8px 10px; flex-wrap: wrap;
    position: sticky; top: 0;
  }
  .install-banner { padding: 10px 14px; flex-wrap: wrap; }
  .install-banner-text { flex: 1 1 100%; }
  .topbar-logo { display: block; order: 1; flex: 0 0 auto; }
  .page-title {
    order: 2; font-size: 16px; gap: 6px; flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar-logout { display: block; order: 3; flex: 0 0 auto; }
  .topbar-actions {
    order: 4; flex: 1 1 100%; display: flex; gap: 8px;
  }
  .topbar-actions:empty { display: none; }
  .topbar-actions .btn { flex: 1; }
  .topbar-actions .filtro-select { max-width: none; flex: 1; }

  .content { padding: 16px 14px calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 20px); }

  /* Sidebar diventa una tab bar fissa in basso: solo i 4 link di navigazione */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: var(--bottom-nav-h); box-sizing: content-box; z-index: 50;
    flex-direction: row; align-items: stretch; padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav-link {
    flex: 1; flex-direction: column; justify-content: center; align-items: center;
    gap: 3px; padding: 6px 2px; text-align: center; font-size: 10.5px;
    line-height: 1; white-space: nowrap;
  }
  .nav-link .nav-icon { font-size: 17px; }
  .nav-text { display: none; }
  .nav-text-short { display: block; }

  /* Filtro pipeline: su mobile una select nativa al posto delle pillole,
     molto piu' compatta e leggibile di una riga di pulsanti. */
  .segmented-filter { display: none; }
  .filter-mobile-select { display: block; margin-bottom: 16px; font-weight: 600; }

  /* Pipeline: card dedicata al posto della tabella generica */
  #pipeline-table-wrap { display: none; }
  .pipeline-cards { display: flex; }

  .pipeline-summary { gap: 10px; }
  .summary-stat { flex: 1 1 auto; min-width: 0; padding: 12px 14px; }
  .summary-value { font-size: 19px; }

  .field-row { grid-template-columns: 1fr; }
  .pacchetto-row { grid-template-columns: 1fr; }
  .modal-actions-split { flex-direction: column; align-items: stretch; gap: 10px; }
  .modal-actions-left, .modal-actions-right { justify-content: center; }
  .modal-panel { max-height: calc(100vh - 2 * env(safe-area-inset-top, 0px)); }

  /* Target touch più ampi */
  .btn, .field-input, .segmented-btn, .tab-btn { min-height: 44px; }
  .btn-icon-remove { width: 36px; height: 36px; }

  /* Tabelle -> liste di "card" etichettate, niente scorrimento orizzontale forzato */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  }
  .data-table tr:last-child { margin-bottom: 0; }
  .data-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--border-soft); text-align: right;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label); font-weight: 600; color: var(--text-muted);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; text-align: left; flex-shrink: 0;
  }
  .data-table td:empty::before { content: none; }
  .table-actions { justify-content: flex-end; }
  .table-wrap { box-shadow: none; border: none; background: none; }
}

@media (max-width: 420px) {
  .pipeline-summary { flex-wrap: wrap; }
  .summary-stat { flex: 1 1 calc(50% - 5px); }
}
