/* Estalyt — interfaccia, identità 2.0
   Convenzione dei piani di costruzione: grafite = esistente, rosso = progetto.
   Il rosso è riservato al potenziale e al marchio; gli errori usano un rosso scuro
   con icona e testo. Le classi sono le stesse della versione precedente. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-vf.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-italic-vf.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #23282e;          /* grafite */
  --ink-hover: #3a4047;
  --red: #cc1f2d;          /* rosso progetto */
  --red-on-ink: #f0484f;
  --yellow: #f2c230;       /* da rivedere */
  --yellow-soft: #fff4cc;
  --yellow-ink: #5c4500;
  --canvas: #f2f3f3;       /* lucido */
  --paper: #ffffff;        /* carta */
  --muted: #5f666e;        /* pietra */
  --line: #d6d9dc;
  --line-soft: #e8eaec;
  --line-strong: #b9bec4;
  --ok: #1e6b45;
  --ok-soft: #e6f2eb;
  --error: #9f1d1d;
  --error-soft: #fbeaea;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --radius: 4px;
  --radius-field: 3px;
  /* compatibilità con nomi precedenti */
  --navy: var(--ink); --blue: var(--ink); --teal: var(--ok); --text: var(--ink);
  --border: var(--line); --white: var(--paper); --shadow: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; font-stretch: 112%; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; font-stretch: 106%; letter-spacing: -0.01em; }
h3 { font-size: 14.5px; line-height: 1.4; font-weight: 650; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

/* Navigazione */
.sidebar {
  width: 248px; position: fixed; inset: 0 auto 0 0; z-index: 30;
  background: var(--paper); border-right: 1px solid var(--line);
  padding: 26px 16px 22px; display: flex; flex-direction: column;
}
.brand { display: block; margin: 0 10px 30px; text-decoration: none; }
.brand img { width: 150px; height: auto; display: block; }
.workspace-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 22px 12px 6px; }
.sidebar nav a {
  color: var(--ink); text-decoration: none; padding: 9px 12px; margin: 2px 0;
  display: flex; align-items: center; gap: 12px; border-radius: var(--radius-field); font-size: 13.5px;
}
.sidebar nav a .icon { color: var(--muted); }
.sidebar nav a:hover { background: var(--canvas); }
.sidebar nav a.active { background: var(--ink); color: var(--paper); font-weight: 600; }
.sidebar nav a.active .icon { color: var(--paper); }
.sidebar nav a.active .pill-count { background: var(--paper); color: var(--ink); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 10px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.sidebar-bottom strong { color: var(--ink); font-size: 13px; display: block; margin-bottom: 2px; font-stretch: 112%; }

.shell { margin-left: 248px; }
.topbar {
  height: 64px; padding: 0 36px; background: var(--paper); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topbar .crumb { font-size: 13px; color: var(--muted); }
.topbar .crumb strong { color: var(--ink); font-weight: 600; }
.topbar .actions { display: flex; align-items: center; gap: 14px; }
.topbar .actions > a { color: var(--ink); display: inline-flex; }
.topbar select {
  max-width: 240px; padding: 7px 10px; font-size: 13px; background: var(--paper);
  border: 1px solid var(--line-strong); border-radius: var(--radius-field);
}
.avatar {
  width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 32px;
  border-radius: var(--radius-field); background: var(--canvas); border: 1px solid var(--line);
  color: var(--ink); font-weight: 700; font-size: 13px;
}
.main { padding: 32px 36px 48px; max-width: 1640px; margin: 0 auto; }

/* Intestazioni di pagina */
.pagehead { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.subtitle { color: var(--muted); margin-top: 10px; font-size: 14px; max-width: 72ch; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Pulsanti */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 14px; line-height: 1.3;
  background: var(--paper); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius-field);
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn.danger { color: var(--error); border-color: #e0b4b4; }
.btn.compact { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.btn.link { border: 0; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.menu-toggle { display: none; }

/* Indicatori */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px; }
.metric .label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.metric .label .icon { color: var(--line-strong); }
.metric strong {
  display: block; font-size: 38px; line-height: 1.2; margin: 6px 0 4px;
  font-weight: 700; font-stretch: 112%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.metric p { font-size: 12.5px; color: var(--muted); }
.metric p a { color: var(--ink); }

/* Pannelli */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panelhead { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.panelhead a { font-size: 13px; }
.two-col { display: grid; grid-template-columns: 1.65fr 1fr; gap: 20px; }
.equal-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stack { display: grid; gap: 20px; }

/* Etichette di stato: sempre testo, mai solo colore */
.badge {
  display: inline-flex; gap: 5px; align-items: center; white-space: nowrap;
  padding: 2px 7px; border-radius: 2px; font-size: 11.5px; font-weight: 600; line-height: 1.5;
  background: var(--canvas); color: var(--ink); border: 1px solid var(--line);
}
.badge.teal { background: var(--ok-soft); color: var(--ok); border-color: #bcdcc9; }
.badge.amber { background: var(--yellow-soft); color: var(--yellow-ink); border-color: #ecd27a; }
.badge.grey { background: var(--canvas); color: var(--muted); border-color: var(--line); }
.badge.red { background: var(--error-soft); color: var(--error); border-color: #e8c3c3; }
.badge.outline { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.pill-count { font-size: 11px; font-weight: 700; background: var(--ink); color: var(--paper); padding: 0 6px; border-radius: 2px; font-variant-numeric: tabular-nums; }

.message {
  padding: 12px 16px; margin-bottom: 18px; font-size: 13.5px;
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: var(--radius-field);
}
.message.error { border-left-color: var(--error); color: var(--error); }
.message.warning { border-left-color: var(--yellow); }
.notice {
  padding: 12px 16px; margin-bottom: 20px; font-size: 13px; line-height: 1.6; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-field);
}
.notice.amber { background: var(--yellow-soft); border-color: #ecd27a; border-left-color: var(--yellow); }
.notice strong { font-weight: 650; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .icon { width: 26px; height: 26px; color: var(--line-strong); margin-bottom: 12px; }
.empty h3 { margin-bottom: 6px; color: var(--ink); }

/* Tabelle */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.table th { font-weight: 600; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td strong { font-size: 13px; display: block; }
.table td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.table td.amount { white-space: nowrap; font-weight: 600; text-align: right; }

/* Attività e cronologia */
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.activity-item:last-child { border: 0; }
.dot { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 6px; border: 2px solid var(--ink); background: var(--paper); }
.activity-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.task-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.task-item:last-child { border: 0; }
.task-item .task-text { flex: 1; font-size: 13px; }
.task-item small { color: var(--muted); display: block; margin-top: 2px; font-size: 12px; }
.task-check {
  width: 20px; height: 20px; display: grid; place-items: center; cursor: pointer; padding: 0;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 2px;
}
.task-check.done { background: var(--ok); border-color: var(--ok); color: var(--paper); }
.task-check .icon { width: 14px; }

/* Filtri e catalogo */
.filterbar { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.filterbar input { flex: 1; min-width: 160px; }
.filterbar input, .filterbar select { padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); font-size: 13px; background: var(--paper); }
.filterbar input[type=number] { max-width: 150px; }
.property-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.property-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.property-card:hover { border-color: var(--ink); }
.property-art { height: 140px; position: relative; overflow: hidden; background: var(--canvas); border-bottom: 1px solid var(--line); }
.property-art svg { height: 100%; width: 100%; display: block; }
.property-art .badge { position: absolute; top: 12px; left: 12px; background: var(--paper); }
.property-body { padding: 18px; }
.property-location { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.property-body h3 { line-height: 1.45; min-height: 42px; font-size: 14.5px; }
.property-body h3 a { color: var(--ink); text-decoration: none; }
.property-body h3 a:hover { text-decoration: underline; }
.property-meta { font-size: 12.5px; color: var(--muted); margin: 10px 0; }
.property-price { font-size: 22px; font-weight: 700; font-stretch: 112%; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.property-foot { border-top: 1px solid var(--line-soft); margin-top: 16px; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.property-foot small { font-size: 12px; color: var(--muted); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 18px 0; font-size: 13.5px; }

/* Pipeline */
.kanban { display: flex; gap: 14px; overflow: auto; padding: 2px 1px 18px; align-items: flex-start; }
.kanban-column { background: #e8eaeb; border-radius: var(--radius); min-width: 272px; width: 272px; padding: 12px; flex-shrink: 0; min-height: 430px; }
.kanban-heading { display: flex; justify-content: space-between; padding: 2px 4px 12px; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kanban-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-field); padding: 14px 15px; margin-bottom: 10px; }
.kanban-card:hover { border-color: var(--ink); }
.kanban-card h3 { font-size: 14px; line-height: 1.4; margin: 6px 0 8px; }
.kanban-card h3 a { color: var(--ink); text-decoration: none; }
.kanban-card .row { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* Schede del dossier */
.tabs { display: flex; gap: 26px; overflow: auto; border-bottom: 1px solid var(--line); margin: 22px 0 24px; white-space: nowrap; }
.tabs a { font-size: 13.5px; padding: 11px 0; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-color: var(--ink); font-weight: 650; }
.tabs a:hover { color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 24px; }
.fact small { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.fact strong { font-size: 18px; font-weight: 650; font-stretch: 106%; font-variant-numeric: tabular-nums; }

/* Moduli */
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  display: block; width: 100%; padding: 9px 11px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-field);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.field input[type=checkbox] { width: auto; display: inline-block; accent-color: var(--ink); }
.field .helptext { font-size: 12px; color: var(--muted); margin-top: 5px; display: block; }
.field .errorlist, .errorlist { color: var(--error); list-style: none; padding: 0; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-grid .field:has(textarea) { grid-column: 1 / -1; }
.form-shell { max-width: 900px; }
.form-actions { display: flex; gap: 10px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--line); }
.form-shell .field { margin-bottom: 16px; }

/* Discussione */
.comment-compose textarea { min-height: 96px; width: 100%; padding: 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); resize: vertical; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.comment:last-child { border: 0; }
.comment-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.comment-meta small { margin-left: auto; color: var(--muted); font-size: 12px; }
.comment p { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.checklist-tags { display: flex; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 18px; }

/* Evidenze: il passaggio citato è evidenziato come su un documento */
.evidence { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 12px; }
.evidence-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.evidence .value { font-size: 19px; font-weight: 650; font-stretch: 106%; margin: 8px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.evidence .meta { font-size: 12.5px; color: var(--muted); }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
details .evidence-body { padding: 14px 0 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
blockquote {
  margin: 12px 0; padding: 10px 14px; font-size: 13px; color: var(--ink); white-space: pre-wrap;
  background: var(--yellow-soft); border-left: 3px solid var(--yellow);
}

/* Scenari */
.scenario-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.scenario-layout .sticky { position: sticky; top: 20px; }
.result { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 26px 28px; }
.result .eyebrow { color: #c9cdd1; }
.result .big { font-size: 56px; line-height: 1.1; font-weight: 700; font-stretch: 112%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.result .result-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid #ffffff2e; padding-top: 18px; margin-top: 22px; }
.result small { color: #c9cdd1; font-size: 12px; display: block; }
.result strong { font-size: 21px; font-weight: 650; font-stretch: 106%; font-variant-numeric: tabular-nums; }
.result .caption { font-size: 12.5px; color: #c9cdd1; margin-top: 6px; }
/* Il prezzo sostenibile è il potenziale: la sagoma rossa del marchio */
.scenario-layout .sticky .result + .panel { position: relative; border: 2px solid var(--red); margin-top: 6px; margin-right: 10px; }
.scenario-layout .sticky .result + .panel::before,
.scenario-layout .sticky .result + .panel::after { content: ""; position: absolute; background: var(--red); }
.scenario-layout .sticky .result + .panel::before { top: -2px; right: -12px; width: 10px; height: 2px; }
.scenario-layout .sticky .result + .panel::after { top: -12px; right: -2px; width: 2px; height: 10px; }
.scenario-layout .sticky .result + .panel h2 { color: var(--red); font-size: 32px !important; font-weight: 700; font-stretch: 112%; font-variant-numeric: tabular-nums; }
.scenario-card { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 14px; }
.scenario-numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 18px 0; }
.scenario-numbers strong { display: block; font-size: 21px; font-weight: 700; font-stretch: 112%; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.scenario-numbers small { color: var(--muted); font-size: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.inline-form input, .inline-form select, .inline-form textarea { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); font-size: 13px; background: var(--paper); }
.inline-form input[type=text] { flex: 1; min-width: 160px; }
.audit-json { font: 12px/1.6 ui-monospace, "SFMono-Regular", Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-width: 720px; color: var(--muted); }

/* Accesso */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); }
.auth-story { background: var(--ink); color: var(--paper); padding: 52px 60px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-story img { width: 170px; height: auto; position: relative; z-index: 1; }
.auth-story h1 { font-size: 48px; line-height: 1.08; letter-spacing: -0.03em; max-width: 520px; margin-top: auto; z-index: 1; }
.auth-story p { color: #c9cdd1; font-size: 16px; margin-top: 20px; max-width: 430px; z-index: 1; }
.auth-story .foot { font-size: 12.5px; color: #9aa1a8; margin-top: auto; padding-top: 72px; z-index: 1; }
.auth-pattern { position: absolute; right: -40px; top: 56px; width: 380px; height: 380px; z-index: 0; }
.auth-pattern svg { width: 100%; height: 100%; display: block; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 50px; }
.auth-form { width: 100%; max-width: 390px; }
.auth-form h2 { font-size: 28px; font-stretch: 112%; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.auth-form .field { margin-top: 18px; }
.auth-form .btn { width: 100%; margin-top: 20px; padding: 12px; }
.auth-form .divider { display: flex; align-items: center; gap: 15px; font-size: 12px; color: var(--muted); margin: 20px 0 0; }
.auth-form .divider:before, .auth-form .divider:after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-form .legal { font-size: 12px; color: var(--muted); margin-top: 28px; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.recovery-codes code { padding: 8px; background: var(--canvas); border: 1px solid var(--line); font-size: 12.5px; text-align: center; }
.qr { width: 210px; height: 210px; display: block; margin: 15px auto; }

/* Varie */
.pagination { display: flex; justify-content: center; gap: 18px; margin: 28px; font-size: 13px; }
.footer { font-size: 12px; color: var(--muted); margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
#catalog-map { height: 420px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; z-index: 1; }
.hidden { display: none !important; }
.search-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.brand-block { font-size: 13px; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 24px; position: relative; }
.brand-block h2 { font-size: 21px; margin-bottom: 10px; }
.brand-block p { color: #c9cdd1; font-size: 13px; max-width: 380px; }
.brand-block a { color: var(--paper); }
.workspace-card {
  display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 18px 20px; margin: 10px 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left;
}
.workspace-card:hover { border-color: var(--ink); }
.mobile-only { display: none; }

@media (min-width: 1550px) { .property-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1150px) {
  .sidebar { width: 216px; }
  .shell { margin-left: 216px; }
  .main { padding: 26px 24px; }
  .topbar { padding: 0 24px; }
  .two-col { grid-template-columns: 1.2fr 1fr; }
  .property-grid { grid-template-columns: repeat(2, 1fr); }
  .metrics { gap: 10px; }
  .metric { padding: 16px; }
  .scenario-numbers { grid-template-columns: 1fr 1fr; }
  .topbar .crumb { display: none; }
  .auth-story { padding: 40px; }
  .auth-story h1 { font-size: 38px; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 248px; }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 40px #23282e33; }
  .shell { margin-left: 0; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { height: 60px; padding: 0 16px; }
  .topbar .actions { gap: 10px; }
  .topbar select { max-width: 170px; }
  .main { padding: 22px 16px; }
  .pagehead { align-items: flex-start; flex-direction: column; gap: 16px; }
  .pagehead .actions { width: 100%; }
  h1 { font-size: 25px; }
  .two-col, .equal-col, .scenario-layout { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .scenario-layout .sticky { position: static; }
  .auth-body { grid-template-columns: 1fr; }
  .auth-story { min-height: 260px; padding: 28px; }
  .auth-story h1 { font-size: 30px; margin-top: 30px; }
  .auth-story p { display: none; }
  .auth-story .foot { padding-top: 20px; margin-top: 0; }
  .auth-pattern { width: 260px; height: 260px; top: 40px; right: -70px; opacity: .5; }
  .auth-main { padding: 36px 22px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .mobile-only { display: block; }
  .topbar .logout-label { display: none; }
}
@media (max-width: 540px) {
  .property-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .metric strong { font-size: 30px; }
  .metric { padding: 14px; }
  .metrics { gap: 10px; }
  .tabs { gap: 18px; }
  .tabs a { font-size: 13px; }
  .panel { padding: 18px; }
  .topbar .avatar { display: none; }
  .topbar select { max-width: 150px; }
  .filterbar input { min-width: 130px; }
  .scenario-numbers { gap: 14px; }
  .main { padding-bottom: 30px; }
  .auth-story { min-height: 230px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media print {
  .sidebar, .topbar, .actions, .btn, .filterbar, .footer { display: none !important; }
  .shell { margin: 0; }
  .main { padding: 0; }
  .panel { break-inside: avoid; }
  .tabs { display: none; }
}

/* Correzioni di layout: gli elementi di griglia non devono allargare la pagina su mobile */
.two-col > *, .equal-col > *, .stack > *, .scenario-layout > *, .property-grid > * { min-width: 0; }
.inline-form select { max-width: 100%; min-width: 0; flex: 1 1 200px; }
/* Link negli elenchi: meno rumore, sottolineatura al passaggio */
.table td a, .task-text a, .activity-item a, .kanban-card a, .property-body a { text-decoration: none; font-weight: 600; }
.table td a:hover, .task-text a:hover, .activity-item a:hover { text-decoration: underline; }

/* Version 2.0 workflows — identity 2.0 preserved. */
.sidebar { overflow-y:auto; }
.spaced { margin-top:20px; }
.preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; }
.source-line { font-size:13px; margin:12px 0; overflow-wrap:anywhere; }
.config-example { background:var(--canvas); padding:14px; white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
.loss-row { background:var(--yellow-soft); }
.date-metric { font-size:24px!important; }
.neighborhood-map { height:390px; border:1px solid var(--line); border-radius:4px; margin-bottom:12px; z-index:1; }
.mention-suggestions { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0; }
.kanban-card[draggable=true] { cursor:grab; }
.kanban-card.dragging { opacity:.55; }
.kanban-column.dragover { outline:2px solid var(--ink); outline-offset:3px; }
.toast { position:fixed; right:24px; bottom:24px; max-width:440px; background:var(--ink); color:white; padding:16px 22px; z-index:2000; border-radius:4px; box-shadow:0 3px 18px #0003; }
.secondary-nav { margin-top:12px; }
.secondary-nav a { font-size:12px!important; padding:6px 12px!important; }
.panel form p { margin:12px 0; }
.panel form p input:not([type=checkbox]),.panel form p select,.panel form p textarea { display:block; width:100%; padding:10px; border:1px solid var(--line-strong); border-radius:3px; }
.panel form p .helptext { display:block; font-size:12px; color:var(--muted); }
@media(max-width:540px){.neighborhood-map{height:300px}.toast{left:16px;right:16px;bottom:16px}.secondary-nav a{padding:8px 12px!important}}

/* Horizontal dossier tabs must not create a vertical scroll rail. */
.tabs { overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.metric > small, .metric > span { display:block; color:var(--muted); font-size:12px; line-height:1.5; }

.weight-grid { display:grid; grid-template-columns:repeat(2,minmax(150px,1fr)); gap:12px; margin-top:12px; }
.weight-grid label { display:flex; flex-direction:column; gap:6px; font-size:12px; }
.weight-grid input { width:90px; }
