/* =====================================================================
   ATELIER · Design System "Couture"
   Lavorazione conto terzi moda — tema chiaro Light + tema Noir (monitor)
   ===================================================================== */

/* ---------- Tema chiaro "Couture" (default) ---------- */
:root,
[data-theme="couture"] {
  --ink:        #1C2541;
  --ink-deep:   #141A2E;
  --bronze:     #B0825A;
  --bronze-soft:#D8B894;
  --mauve:      #8A7090;
  --canvas:     #F7F5F1;
  --paper:      #FFFFFF;
  --linen:      #EFEBE4;
  --hairline:   #E3DDD3;
  --graphite:   #23262F;
  --slate:      #6B7280;

  /* stati semantici */
  --st-bozza:       #9AA3B2;
  --st-lavorazione: #3E78D8;
  --st-appartato:   #7C5CBF;
  --st-seconda:     #C28A4D;
  --st-scarto:      #B0564A;
  --st-ontime:      #3FA66A;
  --st-rischio:     #E0A23B;
  --st-ritardo:     #D85C4A;
  --st-spedito:     #2E9E8F;

  /* gradients */
  --grad-sidebar: linear-gradient(160deg, #1C2541, #141A2E);
  --grad-accent:  linear-gradient(90deg, #B0825A, #D8B894);
  --grad-blob:    radial-gradient(120% 120% at 0% 0%, rgba(176,130,90,.30), rgba(216,184,148,0) 60%);

  /* superfici */
  --bg:        var(--canvas);
  --surface:   var(--paper);
  --surface-2: var(--linen);
  --line:      var(--hairline);
  --text:      var(--graphite);
  --text-dim:  var(--slate);
  --text-strong: var(--ink);

  --radius:    16px;
  --radius-lg: 20px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px -12px rgba(20,26,46,.22), 0 2px 6px -2px rgba(20,26,46,.10);
  --shadow-sm: 0 4px 14px -8px rgba(20,26,46,.30);

  --font-title: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:    "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --sidebar-w: 264px;
}

/* ---------- Tema scuro "Atelier Noir" (monitor kiosk) ---------- */
[data-theme="noir"] {
  --bg:        #0E1320;
  --surface:   #161D2E;
  --surface-2: #11182690;
  --line:      #2A3450;
  --glow:      #2A3450;
  --text:      #F2F0EA;
  --text-dim:  #9AA6C2;
  --text-strong: #F2F0EA;
  --bronze:    #D6A56B;
  --bronze-soft:#E4C194;

  --st-ontime:      #4FD18A;
  --st-rischio:     #FFC24D;
  --st-ritardo:     #FF6B57;
  --st-lavorazione: #5B9BFF;
  --st-appartato:   #A98BFF;
  --st-spedito:     #34D0BD;
  --st-bozza:       #6E7BA0;
  --st-seconda:     #E0A95A;
  --st-scarto:      #FF6B57;

  --grad-sidebar: linear-gradient(160deg, #161D2E, #0E1320);
  --grad-accent:  linear-gradient(90deg, #D6A56B, #E4C194);
  --grad-blob:    radial-gradient(120% 120% at 0% 0%, rgba(214,165,107,.26), rgba(214,165,107,0) 60%);

  --shadow:    0 0 0 1px rgba(42,52,80,.7), 0 18px 40px -20px rgba(0,0,0,.7);
  --shadow-sm: 0 0 0 1px rgba(42,52,80,.6);
}

/* =========================== RESET ============================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-title); font-weight: 600; color: var(--text-strong); letter-spacing: .2px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ======================== APP SHELL ========================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ========================= SIDEBAR =========================== */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--grad-sidebar);
  color: #EAE5DC;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 14px;
  border-right: 1px solid rgba(0,0,0,.25);
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
}
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 22px;
  color: #1C2541;
  background: var(--grad-accent);
  box-shadow: 0 6px 16px -6px rgba(176,130,90,.7);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 3px;
  color: #FBF7F0;
}
.brand-sub {
  font-size: 10.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--bronze-soft);
  opacity: .85;
}

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #C8C4BC;
  font-weight: 500;
  font-size: 13.6px;
  letter-spacing: .2px;
  position: relative;
  transition: background .16s ease, color .16s ease, transform .08s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #FBF7F0; }
.nav-item:active { transform: translateY(1px); }
.nav-ico { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.nav-label { flex: 1; }
.nav-ext { font-size: 11px; opacity: .55; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(176,130,90,.30), rgba(176,130,90,.06));
  color: #FFFFFF;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: var(--grad-accent);
}
.nav-admin { color: var(--bronze-soft); }
.nav-monitor { color: #B7C4DF; }
.nav-sep {
  height: 1px;
  margin: 10px 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,0));
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px 2px;
  font-size: 11px;
  color: #9AA1B4;
  letter-spacing: .3px;
}
.sidebar-foot .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-ontime);
  box-shadow: 0 0 0 3px rgba(63,166,106,.18);
}

/* ======================= MAIN COLUMN ========================= */
.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 22px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.area-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.area-opt {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .2px;
  padding: 6px 14px;
  border-radius: 999px;
  transition: all .16s ease;
}
.area-opt.is-on {
  background: var(--paper, #fff);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  background: var(--grad-accent);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-strong); }

.content { padding: 26px 28px 40px; flex: 1; }

.app-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: .3px;
}
.foot-dim { opacity: .7; font-family: var(--font-title); }

/* ===================== PAGE PRIMITIVES ======================= */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.page-head .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--bronze);
  font-weight: 700;
  margin-bottom: 4px;
}
.page-head h2 { font-size: 30px; line-height: 1.1; }
.page-head .sub { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 4px 0 14px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ========================== CARD ============================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 16px; }

/* ===================== GRID HELPERS ========================== */
.grid { display: grid; gap: 18px; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.cols-2 { grid-template-columns: 1.5fr 1fr; }
@media (max-width: 1180px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* ======================== KPI CARD =========================== */
.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  isolation: isolate;
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-blob);
  z-index: -1;
}
.kpi-card .kpi-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  font-weight: 700;
}
.kpi-card .kpi-value {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 48px;
  line-height: 1.02;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  margin: 8px 0 2px;
}
.kpi-card .kpi-value small { font-size: 22px; color: var(--text-dim); font-weight: 500; }
.kpi-card .kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}
.kpi-card .kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-strong);
}
.kpi-card.accent-bronze::before { background: radial-gradient(120% 120% at 0% 0%, rgba(176,130,90,.34), transparent 60%); }
.kpi-card.accent-blue::before   { background: radial-gradient(120% 120% at 0% 0%, rgba(62,120,216,.26), transparent 60%); }
.kpi-card.accent-ritardo::before{ background: radial-gradient(120% 120% at 0% 0%, rgba(216,92,74,.26), transparent 60%); }
.kpi-card.accent-ontime::before { background: radial-gradient(120% 120% at 0% 0%, rgba(63,166,106,.26), transparent 60%); }
.kpi-card.accent-mauve::before  { background: radial-gradient(120% 120% at 0% 0%, rgba(138,112,144,.26), transparent 60%); }

/* ===================== BADGE STATO (pill) ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.6;
  color: #fff;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.85);
}
.badge.ghost::before { display: none; }

.badge.stato-bozza,       .badge.stato-ricevuta       { background: var(--st-bozza); }
.badge.stato-preventivata { background: var(--mauve); }
.badge.stato-pianificata  { background: #5C6B8C; }
.badge.stato-in_lavorazione, .badge.stato-lavorazione { background: var(--st-lavorazione); }
.badge.stato-pronta_parziale { background: var(--st-rischio); }
.badge.stato-pronta       { background: var(--st-ontime); }
.badge.stato-appartato    { background: var(--st-appartato); }
.badge.stato-seconda      { background: var(--st-seconda); }
.badge.stato-scarto       { background: var(--st-scarto); }
.badge.stato-spedita_parziale,
.badge.stato-spedita,
.badge.stato-spedito      { background: var(--st-spedito); }
.badge.stato-consegnata,
.badge.stato-esportata    { background: var(--st-ontime); }
.badge.stato-annullata,
.badge.stato-chiusa_parziale_accettata { background: var(--graphite); }

.badge.ontime  { background: var(--st-ontime); }
.badge.rischio { background: var(--st-rischio); }
.badge.ritardo { background: var(--st-ritardo); }

/* priorita pill */
.pill-prio {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #fff;
}
.pill-prio.P1 {
  background: var(--st-ritardo);
  box-shadow: 0 0 0 3px rgba(216,92,74,.18);
}
.pill-prio.P2 { background: var(--st-rischio); color: #3a2c10; }
.pill-prio.P3 { background: var(--surface-2); color: var(--text-dim); }

/* ===================== PROGRESS BAR ========================== */
.progress {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress > .bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--grad-accent);
  background-size: 200% 100%;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress > .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.55) 45%, transparent 70%);
  background-size: 220% 100%;
  animation: shine 2.4s linear infinite;
}
@keyframes shine { 0% { background-position: 220% 0; } 100% { background-position: -60% 0; } }
.progress.sm { height: 7px; }
.progress.ok  > .bar { background: linear-gradient(90deg, #3FA66A, #57C98A); }
.progress.warn > .bar { background: linear-gradient(90deg, #E0A23B, #F0BE63); }
.progress.low > .bar { background: linear-gradient(90deg, #C28A4D, #D8B894); }
.progress.ritardo > .bar { background: linear-gradient(90deg, #D85C4A, #EE8472); }

.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-wrap .pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-strong);
  min-width: 38px;
  text-align: right;
}

/* ========================= TABLE ============================= */
.table-wrap { overflow-x: auto; }
table.atelier {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.4px;
}
table.atelier thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0;
}
table.atelier tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.atelier tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--linen) 55%, transparent); }
table.atelier tbody tr:hover td { background: color-mix(in srgb, var(--bronze-soft) 16%, transparent); }
table.atelier tbody tr.row-ritardo td {
  background: linear-gradient(90deg, rgba(216,92,74,.10), transparent 60%);
  box-shadow: inset 3px 0 0 var(--st-ritardo);
}
table.atelier tbody tr:last-child td { border-bottom: none; }
table.atelier .num { text-align: right; font-variant-numeric: tabular-nums; }
table.atelier .cell-strong { font-weight: 700; color: var(--text-strong); }
.cell-dim { color: var(--text-dim); font-size: 12.5px; }

/* ===================== AVANZAMENTO LINEE ===================== */
.linee-list { display: flex; flex-direction: column; gap: 16px; }
.linea-row { display: grid; grid-template-columns: 160px 1fr 56px; gap: 14px; align-items: center; }
.linea-name { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; color: var(--text-strong); }
.linea-swatch { width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 0 1px var(--line) inset; }
.linea-pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.linea-qty { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }

/* ========================= GAUGE ============================ */
.gauge-wrap { position: relative; display: grid; place-items: center; padding: 6px 0; }
.gauge-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.gauge-center .g-num {
  font-family: var(--font-title);
  font-size: 34px;
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.gauge-center .g-lab {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.legend .li { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.legend .li .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ========================= MATRIX =========================== */
.matrix { border-collapse: separate; border-spacing: 3px; }
.matrix th { font-size: 11px; color: var(--text-dim); font-weight: 700; padding: 4px 8px; }
.matrix .rowhead { text-align: right; color: var(--text-strong); font-weight: 600; }
.matrix td.cell {
  width: 52px; height: 42px;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  background: var(--surface-2);
  position: relative;
}
.matrix td.cell .frac { display: block; font-size: 10px; font-weight: 500; color: var(--text-dim); }
.matrix td.cell.has-seconda { box-shadow: inset 0 0 0 2px var(--st-seconda); }
.matrix td.cell.has-scarto  { box-shadow: inset 0 0 0 2px var(--st-scarto); }
.matrix td.cell.done { color: #14532d; }

/* ========================= BUTTONS ========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 13px;
  transition: transform .08s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #F7F5F1; }
.btn-primary:hover { background: var(--ink-deep); }
.btn-bronze { background: var(--grad-accent); border: none; color: #2a1d10; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

/* ========================= UTILITY ========================== */
.muted { color: var(--text-dim); }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; }
.gap-2 { gap: 10px; } .gap-3 { gap: 18px; }
.wrap { flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
  font-size: 11.5px; font-weight: 600;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty .t { font-family: var(--font-title); font-size: 16px; color: var(--text-strong); }

/* lock-friendly: la dashboard amministrazione si nasconde se non in area */
body[data-area="amministrazione"] .only-produzione { opacity: .55; }

/* =====================================================================
   COMPAT / FORM — classi usate dalle pagine operative e supplementari
   ===================================================================== */
.page-title {
  font-family: var(--font-title); font-weight: 600;
  font-size: 27px; line-height: 1.1; color: var(--text-strong); margin: 0;
}
.page-sub { color: var(--text-dim); margin: 4px 0 0; font-size: 14px; }
.card-title { font-family: var(--font-title); font-size: 17px; color: var(--text-strong); margin: 0; }

/* form */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 18px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span, .field__label {
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .03em;
}
.field input[type=text], .field input[type=number], .field input[type=date],
.field select, .field textarea, .select,
form .card input[type=text], form .card input[type=number], form .card input[type=date],
form select, form textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .select:focus, form select:focus {
  outline: none; border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(176,130,90,.18);
}

/* messaggi flash */
.msgs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.msg {
  padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface);
}
.msg-success { background: rgba(63,166,106,.12); border-color: rgba(63,166,106,.4); color: #2f7d50; }
.msg-error, .msg-danger { background: rgba(216,92,74,.12); border-color: rgba(216,92,74,.4); color: #b0463a; }
.msg-info, .msg-warning { background: rgba(224,162,59,.12); border-color: rgba(224,162,59,.4); color: #9a7220; }

/* badge soft + kpi accent + layout helper */
.badge-soft {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
  font-size: 11.5px; font-weight: 600; margin: 1px;
}
.kpi-card.accent { box-shadow: inset 0 0 0 1.5px var(--bronze), var(--shadow-sm); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 1fr; gap: 9px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--text-dim); font-size: 13px; }
.kv b { color: var(--text-strong); font-weight: 600; text-align: right; }
.num.pos { color: #2f7d50; } .num.neg { color: #b0463a; }

/* ===== COMPONENTI VISTE (commesse, scheda, linee, catalogo) ===== */

/* ---- Tipografia di supporto ---- */
.display {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: .2px;
  color: var(--text-strong);
  margin: 2px 0 0;
}
.tabular-nums { font-variant-numeric: tabular-nums; }
.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  font-size: 12.5px;
  color: var(--text-strong);
}
.mono--lg { font-size: 16px; font-weight: 600; }
.mono--sm { font-size: 11px; color: var(--text-dim); }
.micro {
  font-size: 11px;
  letter-spacing: .15px;
  color: var(--text-dim);
}
.lead {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}
.prose { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); margin-top: 8px; }
.dot-sep { color: var(--line); margin: 0 2px; }

/* ---- Eyebrow standalone (fuori da .page-head) ---- */
.eyebrow {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--bronze);
  font-weight: 700;
  margin-bottom: 4px;
}

/* ---- Page head: layout intro + kpi a destra ---- */
.page-head__intro { min-width: 0; }
.page-head__intro .display { margin-top: 2px; }
.page-head__intro .muted { margin: 6px 0 0; font-size: 13.5px; }
.page-head__kpi {
  display: flex;
  gap: 14px;
  flex: 0 0 auto;
  align-items: stretch;
}
.page-head__kpi--row { flex-wrap: wrap; justify-content: flex-end; }
.page-head__kpi .kpi-card { min-width: 130px; }
.page-head--detail {
  position: relative;
  padding-left: 18px;
}
.page-head--detail::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 4px;
  border-radius: 4px;
  background: var(--brand-color, var(--bronze));
}
.page-head__tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* breadcrumb */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.crumbs a { color: var(--bronze); font-weight: 600; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 2px; }
.crumbs span { opacity: .6; }

/* ---- KPI card varianti BEM (commesse/linee/modelli) ---- */
.kpi-card__blob {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-blob);
  z-index: -1;
  pointer-events: none;
}
.kpi-card__blob--alert {
  background: radial-gradient(120% 120% at 0% 0%, rgba(216,92,74,.30), transparent 60%);
}
.kpi-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  font-weight: 700;
}
.kpi-card__value {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.02;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.kpi-card--alert { box-shadow: inset 0 0 0 1.5px rgba(216,92,74,.35), var(--shadow-sm); }
.kpi-card--alert .kpi-card__value { color: var(--st-ritardo); }
.kpi-card--soft {
  background: var(--surface-2);
  box-shadow: none;
}
.kpi-card--soft .kpi-card__value { font-size: 32px; }

/* ---- Toolbar filtri ---- */
.toolbar {
  margin-bottom: 22px;
  padding: 14px 18px;
}
.toolbar__form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px 18px;
}
.toolbar__form .field { margin-bottom: 0; }
.toolbar__count {
  margin-left: auto;
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.field--inline {
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
}
.field--inline input[type=checkbox] {
  width: 17px; height: 17px;
  accent-color: var(--bronze);
  cursor: pointer;
}
.field--inline span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text-strong); background: var(--surface-2); }
.btn--bronze { background: var(--grad-accent); border: none; color: #2a1d10; }
.btn--sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

/* ---- Pill priorita couture (prio-pill + prio-*) ---- */
.prio-pill {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.5;
  color: #fff;
  white-space: nowrap;
}
.prio-pill.prio-urgente {
  background: var(--st-ritardo);
  box-shadow: 0 0 0 3px rgba(216,92,74,.20), 0 2px 8px -2px rgba(216,92,74,.5);
}
.prio-pill.prio-alta { background: var(--st-rischio); color: #3a2c10; }
.prio-pill.prio-normale { background: var(--surface-2); color: var(--text-dim); }
.prio-pill.prio-bassa {
  background: transparent;
  color: var(--text-dim);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---- Progress BEM (barra commesse/scheda/linee) ---- */
.progress__bar {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  background: var(--grad-accent);
  transition: width .5s cubic-bezier(.4,0,.2,1);
  z-index: 1;
}
.progress__bar--bronze { background: var(--grad-accent); }
.progress__shine {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.progress__shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.55) 45%, transparent 70%);
  background-size: 220% 100%;
  animation: shine 2.4s linear infinite;
}
.progress--lg { height: 14px; }
.commessa-card--late .progress__bar { background: linear-gradient(90deg, #D85C4A, #EE8472); }

/* ---- Date chip ---- */
.date-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 78px;
}
.date-chip__label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
  font-weight: 700;
}
.date-chip__val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}
.date-chip--late {
  background: rgba(216,92,74,.10);
  border-color: rgba(216,92,74,.4);
}
.date-chip--late .date-chip__val { color: var(--st-ritardo); }
.late-flag {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--st-ritardo);
}

/* ===================== GRIGLIA COMMESSE ===================== */
.commesse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.commessa-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px 18px 24px;
  overflow: hidden;
  color: var(--text);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease;
}
.commessa-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -16px rgba(20,26,46,.30), 0 4px 10px -4px rgba(20,26,46,.14);
  border-color: color-mix(in srgb, var(--bronze) 40%, var(--line));
}
.commessa-card:active { transform: translateY(-1px); }
.commessa-card__rail {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: 5px 0 0 5px;
  background: var(--st-bozza);
}
/* il rail prende il colore dello stato (classe stato-* applicata sul rail) */
.commessa-card__rail.stato-bozza,
.commessa-card__rail.stato-ricevuta       { background: var(--st-bozza); }
.commessa-card__rail.stato-lavorazione,
.commessa-card__rail.stato-in_lavorazione { background: var(--st-lavorazione); }
.commessa-card__rail.stato-appartato      { background: var(--st-appartato); }
.commessa-card__rail.stato-seconda        { background: var(--st-seconda); }
.commessa-card__rail.stato-scarto         { background: var(--st-scarto); }
.commessa-card__rail.stato-spedito,
.commessa-card__rail.stato-spedita        { background: var(--st-spedito); }
.commessa-card__rail.stato-ontime         { background: var(--st-ontime); }
.commessa-card__rail.stato-rischio        { background: var(--st-rischio); }
.commessa-card__rail.stato-ritardo        { background: var(--st-ritardo); }
.commessa-card--late {
  border-color: rgba(216,92,74,.45);
  box-shadow: inset 0 0 0 1px rgba(216,92,74,.18), var(--shadow);
}
.commessa-card--late .commessa-card__rail { background: var(--st-ritardo); }

.commessa-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.commessa-card__num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
}
.commessa-card__brand {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06) inset;
}
.commessa-card__ref { margin-top: -4px; }
.commessa-card__statusline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.commessa-card__avz {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}
.commessa-card__avz .tabular-nums { font-weight: 700; color: var(--text-strong); }
.commessa-card__perc {
  margin-left: auto;
  font-weight: 800;
  font-size: 14px;
  color: var(--bronze);
}
.commessa-card__dates {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* ===================== SCHEDA COMMESSA ===================== */
/* timeline orizzontale Ordine -> Avviata -> ... -> DDT */
.timeline-card { padding: 22px 24px; }
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0;
}
.timeline__step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  min-width: 0;
}
/* linea di connessione tra i pallini */
.timeline__step::before {
  content: "";
  position: absolute;
  top: 8px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.timeline__step:first-child::before { display: none; }
.timeline__dot {
  position: relative;
  z-index: 1;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line);
  box-shadow: 0 0 0 4px var(--surface);
  transition: all .18s ease;
}
.timeline__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .2px;
}
/* step completati */
.timeline__step.is-done .timeline__dot {
  background: var(--st-ontime);
  border-color: var(--st-ontime);
}
.timeline__step.is-done::before { background: var(--st-ontime); }
.timeline__step.is-done .timeline__label { color: var(--text); }
/* step attivo */
.timeline__step.is-active .timeline__dot {
  background: var(--bronze);
  border-color: var(--bronze);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px rgba(176,130,90,.20);
}
.timeline__step.is-active::before {
  background: linear-gradient(90deg, var(--st-ontime), var(--bronze));
}
.timeline__step.is-active .timeline__label { color: var(--text-strong); font-weight: 700; }

/* riepilogo numerico commessa */
.summary-card { margin-top: 18px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.summary-item__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
  font-weight: 700;
}
.summary-item__val {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
}
.summary-item--seconda { box-shadow: inset 0 0 0 1.5px rgba(194,138,77,.4); }
.summary-item--seconda .summary-item__val { color: var(--st-seconda); }
.summary-item--scarto { box-shadow: inset 0 0 0 1.5px rgba(176,86,74,.4); }
.summary-item--scarto .summary-item__val { color: var(--st-scarto); }

.info-card { margin-top: 18px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-head .section-title { margin: 4px 0 14px; flex: 1; }

/* ---- Matrice taglie x colori (BEM, scheda commessa) ---- */
.matrix-card { margin-top: 18px; }
.matrix-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.matrix-head .section-title { margin: 0 0 6px; }
.matrix-head__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.matrix-head__perc {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 13px;
  white-space: nowrap;
}
.matrix-head__big {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 600;
  color: var(--bronze);
  margin-left: 6px;
}
.matrix-scroll { overflow-x: auto; padding: 6px 0 2px; }
.matrix__corner {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
}
.matrix__th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-strong);
  padding: 4px 8px;
  text-align: center;
}
.matrix__th--tot { color: var(--bronze); }
.matrix__rowhead {
  text-align: left;
  white-space: nowrap;
  padding: 4px 12px 4px 4px;
}
.matrix__colorname {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
}
.color-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,.12) inset;
}
.matrix__cell {
  width: 58px;
  min-width: 52px;
  height: 46px;
  text-align: center;
  border-radius: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  background: var(--surface-2);
  vertical-align: middle;
  padding: 4px;
}
.matrix__cell-main { display: block; font-size: 12.5px; }
.matrix__sep { color: var(--text-dim); font-weight: 500; margin: 0 1px; }
.matrix__cell-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 700;
}
.matrix__cell-sub .tag-2 { color: var(--st-seconda); }
.matrix__cell-sub .tag-x { color: var(--st-scarto); }
.matrix__cell--empty {
  color: var(--text-dim);
  background: transparent;
  font-weight: 400;
  opacity: .5;
}
.matrix__cell--tot,
.matrix__cell--foot {
  background: var(--ink);
  color: #F7F5F1;
  font-size: 12px;
}
.matrix__cell--foot { background: color-mix(in srgb, var(--ink) 85%, var(--bronze)); }
.matrix__cell.esito-seconda { box-shadow: inset 0 0 0 2px var(--st-seconda); }
.matrix__cell.esito-scarto  { box-shadow: inset 0 0 0 2px var(--st-scarto); }

/* legenda heatmap matrice */
.matrix-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.matrix-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}
.matrix-legend__item .swatch {
  width: 13px; height: 13px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--line) inset;
}
.swatch--ok { background: rgba(63,166,106,.55); }
.swatch--2  { background: rgba(194,138,77,.55); }
.swatch--x  { background: rgba(176,86,74,.55); }

/* linea dot (usato in matrix-head e scheda) */
.linea-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
}
.linea-dot--lg { width: 16px; height: 16px; border-radius: 6px; }

/* ===================== LINEE (griglia card) ===================== */
.linee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.linea-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 18px 24px;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .18s ease;
}
.linea-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -18px rgba(20,26,46,.28), var(--shadow-sm);
}
.linea-card__rail {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: 5px 0 0 5px;
  background: var(--linea-color, var(--bronze));
}
.linea-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.linea-card__title { display: flex; align-items: center; gap: 11px; }
.linea-card__name { font-size: 16px; margin: 0 0 2px; }
.linea-card__flags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.linea-card__desc { margin: -4px 0 0; }
.linea-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}
.linea-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.linea-stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  font-weight: 700;
}
.linea-stat__val {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

/* ===================== GALLERIA MODELLI ===================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 20px;
}
.modello-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.modello-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 46px -18px rgba(20,26,46,.32), 0 5px 12px -5px rgba(20,26,46,.16);
  border-color: color-mix(in srgb, var(--brand-color, var(--bronze)) 40%, var(--line));
}
.modello-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--surface-2);
}
.modello-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s cubic-bezier(.2,.6,.2,1);
}
.modello-card:hover .modello-card__media img { transform: scale(1.05); }
.modello-card__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--linen), var(--canvas));
  font-family: var(--font-title);
  font-size: 46px;
  font-weight: 600;
  color: var(--bronze-soft);
  letter-spacing: 2px;
}
.modello-card__overlay {
  position: absolute;
  left: 10px; bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.modello-card__overlay .chip {
  backdrop-filter: blur(6px);
  background: rgba(255,255,255,.82);
  box-shadow: 0 2px 8px -3px rgba(0,0,0,.3);
}
.ribbon {
  position: absolute;
  top: 10px; right: -34px;
  transform: rotate(45deg);
  width: 130px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 0;
  color: #fff;
  box-shadow: 0 2px 6px -2px rgba(0,0,0,.4);
}
.ribbon--off { background: var(--graphite); }
.modello-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}
.modello-card__brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.modello-card__name {
  font-size: 17px;
  line-height: 1.2;
  margin: 0;
}
.modello-card__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---- Chip varianti ---- */
.chip--bronze {
  background: color-mix(in srgb, var(--bronze) 18%, var(--surface));
  color: #7a5630;
  box-shadow: inset 0 0 0 1px rgba(176,130,90,.3);
}
.chip--muted {
  background: var(--surface-2);
  color: var(--text-dim);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ===================== SCHEDA MODELLO (detail) ===================== */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.detail-col { display: flex; flex-direction: column; min-width: 0; }

/* pannello media + gallery foto */
.media-panel { padding: 0; overflow: hidden; position: sticky; top: 84px; }
.media-panel__hero {
  aspect-ratio: 4 / 5;
  background: var(--surface-2);
  overflow: hidden;
}
.media-panel__hero img { width: 100%; height: 100%; object-fit: cover; }
.media-panel__placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--linen), var(--canvas));
  font-family: var(--font-title);
  font-size: 64px;
  font-weight: 600;
  color: var(--bronze-soft);
  letter-spacing: 3px;
}
.media-panel__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.thumb {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  width: 62px;
  transition: border-color .15s ease, transform .1s ease;
}
.thumb:hover { border-color: var(--bronze); transform: translateY(-2px); }
.thumb img { width: 100%; height: 62px; object-fit: cover; }
.thumb figcaption {
  font-size: 9.5px;
  color: var(--text-dim);
  padding: 3px 5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* righe articolo nella scheda modello */
.articolo-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.articolo-row:last-child { border-bottom: none; padding-bottom: 0; }
.articolo-row__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.articolo-row__thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--line);
}
.articolo-row__thumb--ph {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 16px;
  color: var(--bronze);
}
.articolo-row__head > div:not(.articolo-row__thumb) { flex: 1; min-width: 0; }
.articolo-row__head > div .muted { font-size: 12.5px; margin-top: 1px; }
.articolo-row__code { font-size: 14px; font-weight: 700; }
.articolo-row__variants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding-left: 60px;
}
.variant-block { display: flex; flex-direction: column; gap: 6px; }
.variant-block__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-dim);
  font-weight: 700;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.size-pill {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-strong);
}
.color-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.color-pill::before {
  content: "";
  width: 16px; height: 16px;
  border-radius: 50%;
  background: inherit;
  box-shadow: 0 0 0 1px rgba(0,0,0,.12) inset;
}
.color-pill__name {
  color: var(--text-strong);
  font-weight: 600;
  background: var(--surface);
  border-radius: 999px;
}

/* accordion allegati (Alpine) */
.accordion { display: flex; flex-direction: column; gap: 8px; }
.accordion__item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.accordion__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: var(--surface-2);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
}
.accordion__head > span:first-child { flex: 1; }
.accordion__head:hover { background: color-mix(in srgb, var(--bronze-soft) 18%, var(--surface-2)); }
.accordion__chev {
  font-size: 18px;
  line-height: 1;
  color: var(--text-dim);
  transition: transform .2s ease;
}
.accordion__chev.is-open { transform: rotate(90deg); color: var(--bronze); }
.accordion__head.is-open { background: color-mix(in srgb, var(--bronze) 12%, var(--surface)); }
.accordion__body { padding: 4px 14px 12px; }
.allegati-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.allegati-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.allegati-list__item:last-child { border-bottom: none; }
.allegati-list__info { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.allegati-list__title { font-weight: 600; color: var(--text-strong); font-size: 13.5px; }
.ver-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bronze) 16%, var(--surface));
  color: #7a5630;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
  .media-panel { position: static; max-width: 460px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head__kpi--row, .page-head__kpi { justify-content: flex-start; }
  .commesse-grid, .linee-grid, .gallery { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .articolo-row__variants { grid-template-columns: 1fr; padding-left: 0; }
  .toolbar__count { margin-left: 0; }
}
@media (max-width: 560px) {
  .display { font-size: 26px; }
  .summary-grid { grid-template-columns: 1fr; }
  .timeline__label { font-size: 10px; }
  .linea-stats { grid-template-columns: 1fr; }
}


/* ===================== SFONDO PROGRAMMA (dissolvenza) ===================== */
/* Foto couture a tutta pagina, sfumata dietro ai contenuti. Solo tema chiaro. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(247,245,241,.82), rgba(247,245,241,.90)),
    url("../img/sfondo.caa434f40707.jpg");
  background-size: cover, cover;
  background-position: center center, center center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}
.app-shell { position: relative; z-index: 1; }
.topbar { background: color-mix(in srgb, var(--surface) 78%, transparent); }
[data-theme="noir"] body::after { display: none; }


/* bottoncino mini riutilizzabile */
.btn-mini {
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text);
  line-height: 1.4;
  display: inline-block;
}
.btn-mini:hover { background: var(--surface-2); border-color: var(--bronze); }


/* ===== Sfondi diversi per sezione (foto vintage in dissolvenza) ===== */
body[data-page="modelli"]::after {
  background-image:
    linear-gradient(180deg, rgba(247,245,241,.82), rgba(247,245,241,.90)),
    url("../img/sfondo2.d6b40ef726c0.jpg");
}
body[data-page="commesse"]::after,
body[data-page="linee"]::after {
  background-image:
    linear-gradient(180deg, rgba(247,245,241,.82), rgba(247,245,241,.90)),
    url("../img/sfondo3.ed7462202b21.jpg");
}
body[data-page="ddt"]::after {
  background-image:
    linear-gradient(180deg, rgba(247,245,241,.82), rgba(247,245,241,.90)),
    url("../img/sfondo2.d6b40ef726c0.jpg");
}


/* logo Acquasarta nella sidebar */
.brand-mark--logo { background:#fff; padding:4px; }
.brand-mark--logo img { width:100%; height:100%; object-fit:contain; }
