/*
 * style.css — Studio Peluso · Portale Portieri e Proprietari di Fabbricati
 * Design system completo
 */

/* ─── RESET & BASE ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colori */
  --accent:       #1f4f82;
  --accent-dark:  #163b63;
  --accent-mid:   #2563a8;
  --accent-lt:    #eaf1f8;
  --accent-line:  #bfdbfe;

  --bg:           #f4f6f9;
  --card:         #ffffff;
  --text:         #1f2937;
  --text-soft:    #374151;
  --muted:        #6b7280;
  --muted-lt:     #9ca3af;
  --line:         #e5e7eb;
  --line-dark:    #d1d5db;

  --green:        #059669;
  --green-lt:     #ecfdf5;
  --green-b:      #6ee7b7;
  --green-t:      #065f46;

  --orange:       #d97706;
  --orange-lt:    #fffbeb;
  --orange-b:     #fcd34d;
  --orange-t:     #92400e;

  --red:          #dc2626;
  --red-lt:       #fef2f2;
  --red-b:        #fca5a5;

  --purple-lt:    #f5f3ff;
  --purple-b:     #ddd6fe;
  --purple-t:     #5b21b6;

  /* Tipografia */
  --font:         system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Spaziatura */
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;

  /* Ombre */
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* ─── TOPBAR ────────────────────────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  box-shadow: 0 2px 8px rgba(31,79,130,.30);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  padding: 0 28px;
  height: 52px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,.15);
  margin-right: 8px;
  flex-shrink: 0;
}
.topbar-brand .topbar-logo {
  height: 36px;
  width: auto;
  display: block;
  /* Il logo ha sfondo trasparente: su topbar scuro si vede bene */
  filter: brightness(0) invert(1); /* rende bianco su sfondo scuro */
}
.topbar-brand .brand-text strong {
  display: block; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.2;
}
.topbar-brand .brand-text span {
  color: rgba(255,255,255,.55); font-size: 10px; line-height: 1;
}

.topbar-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar { display: none; }

.topbar-nav a {
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  letter-spacing: .01em;
}
.topbar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.topbar-nav a.active {
  color: #fff;
  border-bottom-color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.06);
  font-weight: 600;
}
.topbar-nav a .nav-icon {
  margin-right: 6px;
  font-size: 13px;
  opacity: .8;
}

/* ─── HAMBURGER ─────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 7px;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
  transition: background .15s;
}
.hamburger:hover { background: rgba(255,255,255,.18); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
}

/* ─── MOBILE NAV DRAWER ──────────────────────────────────────────────────────── */
.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 88vw);
  height: 100dvh;
  background: #fff;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
}
.mobile-nav.open { transform: translateX(0); }

.mobile-nav-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.mobile-nav-header .mobile-nav-logo {
  height: 32px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.mobile-nav-header span { flex: 1; }
.mobile-nav-close {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.mobile-nav-close:hover { background: rgba(255,255,255,.3); }

.mobile-nav nav {
  padding: 10px 0;
  flex: 1;
}
.mobile-nav nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.mobile-nav nav a:hover {
  background: var(--accent-lt);
  color: var(--accent);
  text-decoration: none;
  border-left-color: var(--accent);
}
.mobile-nav nav a.active {
  background: var(--accent-lt);
  color: var(--accent-dark);
  font-weight: 700;
  border-left-color: var(--accent);
}

.mobile-nav-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.mobile-nav-footer a {
  color: var(--accent);
  text-decoration: none;
}
.mobile-nav-footer a:hover { text-decoration: underline; }

/* Overlay sfondo */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 499;
  opacity: 0;
  transition: opacity .3s;
}
.mobile-overlay.open {
  display: block;
  opacity: 1;
}

/* Blocca scroll body quando menu aperto */
body.menu-open { overflow: hidden; }

.topbar-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-left: 12px;
  gap: 8px;
}
.topbar-actions a {
  color: rgba(255,255,255,.55);
  font-size: 11px;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 5px;
  transition: all .15s;
}
.topbar-actions a:hover {
  border-color: rgba(255,255,255,.6);
  color: #fff;
  text-decoration: none;
}

/* ─── WARNING BANNER ────────────────────────────────────────────────────────── */
.warn-banner {
  background: #7f1d1d;
  color: #fca5a5;
  text-align: center;
  padding: 7px 24px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border-bottom: 1px solid rgba(0,0,0,.15);
}
.warn-banner strong { color: #fff; }

/* ─── PAGE HEADER ───────────────────────────────────────────────────────────── */
.page-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 20px 28px;
}
.page-header .breadcrumb {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-header .breadcrumb a { color: var(--accent); text-decoration: none; }
.page-header .breadcrumb a:hover { text-decoration: underline; }
.page-header .breadcrumb span { color: var(--muted-lt); }
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1.25;
  margin-bottom: 4px;
}
.page-header .sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-header .sub .sep { color: var(--line-dark); }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 28px;
}

/* ─── CARDS ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.card-title .icon { font-size: 14px; }

/* ─── TABLES ────────────────────────────────────────────────────────────────── */

/*
 * .table-wrap: contenitore con scroll orizzontale.
 * Il gradiente a destra suggerisce visivamente che c'è altro contenuto.
 * Funziona sia dentro .card (margine negativo per bordi a filo) sia standalone.
 */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
  /* Scroll-shadow a destra come hint visivo */
  background:
    linear-gradient(to right, white 30%, rgba(255,255,255,0)),
    linear-gradient(to left,  white 30%, rgba(255,255,255,0)) 100% 0,
    radial-gradient(farthest-side at 0   50%, rgba(0,0,0,.10), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.10), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 52px;
}
thead th.r { text-align: right; }
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody td.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #f8faff; }
tr.section td {
  background: #f4f6f9;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding: 5px 12px;
  border-bottom: 1px solid var(--line-dark);
}
tr.row-total td {
  background: var(--accent-lt);
  font-weight: 700;
  border-top: 2px solid var(--accent-line);
  border-bottom: 1px solid var(--accent-line);
}
tr.row-lav td {
  background: var(--green-lt);
  font-weight: 700;
  border-top: 2px solid var(--green-b);
  color: var(--green-t);
}
tr.row-grand td {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border: none;
}
tr.row-orange td {
  background: var(--orange-lt);
  font-weight: 600;
}

/* ─── BADGES & PILLS ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #f8f9fa;
  color: var(--muted);
  white-space: nowrap;
}
.badge-green  { background: var(--green-lt);  border-color: var(--green-b);  color: var(--green-t); }
.badge-warn   { background: var(--orange-lt); border-color: var(--orange-b); color: var(--orange-t); }
.badge-blue   { background: var(--accent-lt); border-color: var(--accent-line); color: var(--accent); }
.badge-red    { background: var(--red-lt);    border-color: var(--red-b);    color: var(--red); }
.badge-purple { background: var(--purple-lt); border-color: var(--purple-b); color: var(--purple-t); }

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  background: var(--accent-lt);
  color: var(--accent-dark);
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 4px;
  font-weight: 500;
}

/* ─── ALERTS ────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info  { background: var(--accent-lt); border: 1px solid var(--accent-line); color: #1e3a6e; }
.alert-warn  { background: var(--orange-lt); border: 1px solid var(--orange-b);    color: var(--orange-t); }
.alert-green { background: var(--green-lt);  border: 1px solid var(--green-b);     color: var(--green-t); }
.alert-red   { background: var(--red-lt);    border: 1px solid var(--red-b);       color: var(--red); }

/* ─── FORM ELEMENTS ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.fl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 5px;
}
.field-note { font-size: 11px; color: var(--muted-lt); margin-top: 4px; line-height: 1.4; }

select, input[type=number], input[type=text] {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,79,130,.12);
}

input[type=range] {
  width: 100%;
  padding: 4px 0;
  cursor: pointer;
  accent-color: var(--accent);
  border: none;
  background: transparent;
  box-shadow: none;
}
.range-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  float: right;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-soft);
}
.check-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  color: var(--text-soft);
}
.radio-row input[type=radio] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  line-height: 1;
  font-family: var(--font);
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary   { background: var(--accent);  color: #fff; box-shadow: 0 1px 3px rgba(31,79,130,.3); }
.btn-secondary { background: #475569; color: #fff; }
.btn-ghost     { background: #fff; color: var(--accent); border: 1px solid var(--line-dark); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-lt); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-bar       { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── METRIC CARDS ──────────────────────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.metric-card .m-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}
.metric-card .m-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}
.metric-card .m-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.metric-card.mc-primary { background: var(--accent); border-color: var(--accent-dark); box-shadow: var(--shadow); }
.metric-card.mc-primary .m-label { color: rgba(255,255,255,.65); }
.metric-card.mc-primary .m-value { color: #fff; font-size: 26px; }
.metric-card.mc-primary .m-sub   { color: rgba(255,255,255,.6); }
.metric-card.mc-green  { background: var(--green-lt); border-color: var(--green-b); }
.metric-card.mc-green .m-label { color: var(--green-t); }
.metric-card.mc-green .m-value { color: var(--green); }
.metric-card.mc-green .m-sub   { color: #166534; opacity: .8; }
.metric-card.mc-warn   { background: var(--orange-lt); border-color: var(--orange-b); }
.metric-card.mc-warn .m-value { color: var(--orange); }

/* ─── INDEX PAGE — CONTRACT CARDS ───────────────────────────────────────────── */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.tool-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card .tc-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
  background: var(--accent-lt);
}
.tool-card .tc-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.tool-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.tool-card p  { font-size: 12px; color: var(--muted); line-height: 1.5; flex: 1; }
.tool-card .tc-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.tool-card .tc-arrow {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── SCROLL AUTOMATICO per tabelle senza .table-wrap ───────────────────────── */
/*
 * Le tabelle con molte colonne usano .tbl-scroll (tabelle.php) o .table-wrap (aliquote.php).
 * Le tabelle corte si adattano naturalmente con il testo che va a capo.
 * Non si applica overflow globale per evitare conflitti con la gestione per-tabella.
 */
.src-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 4px;
}
.src-bar a { color: var(--accent); text-decoration: none; }
.src-bar a:hover { text-decoration: underline; }

/* ─── FILTERS BAR ───────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters-bar .field { margin-bottom: 0; min-width: 140px; }

/* ─── SIMULATORE / COSTO — TWO-COL LAYOUT ───────────────────────────────────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}
.col-sidebar { position: sticky; top: 68px; }

/* ─── CHART BARS ────────────────────────────────────────────────────────────── */
.bar-row { margin-bottom: 11px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-soft); }
.bar-label .bv { font-weight: 700; color: var(--text); }
.bar-track { background: #edf2f7; border-radius: 99px; height: 10px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 99px; transition: width .4s cubic-bezier(.4,0,.2,1); }

/* ─── FOOTER ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--accent-dark);
  color: rgba(255,255,255,.6);
  padding: 18px 28px;
  margin-top: 24px;
  font-size: 11.5px;
}
.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer a { color: rgba(255,255,255,.7); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.site-footer .footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer .footer-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.site-footer .footer-badge {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  color: rgba(255,255,255,.6);
}

/* ─── DIVIDER ───────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Topbar: mostra hamburger, nascondi nav desktop */
  .topbar { padding: 0 14px; height: 52px; }
  .topbar-nav { display: none; }
  .topbar-actions { display: none; }
  .hamburger { display: flex; }

  /* Contenuto */
  .page-header { padding: 14px 16px; }
  .page-header h1 { font-size: 17px; }
  main { padding: 14px 16px; }
  .two-col-layout { grid-template-columns: 1fr; }
  .col-sidebar { position: static; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr; }

  /* Tabelle: font ridotto + padding compatto per massimizzare spazio */
  table { font-size: 11.5px; }
  thead th { font-size: 10px; padding: 7px 9px; top: 52px; }
  tbody td { padding: 6px 9px; }

  /* Assicura che .table-wrap dentro .card non venga clippato dal border-radius */
  .card { overflow: visible; }
  .table-wrap {
    margin: 0 -20px;
    padding: 0 20px;
    border-radius: 0;
  }

}
@media (max-width: 540px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .big-metrics-2 { grid-template-columns: 1fr; }
}

/* ─── PRINT ─────────────────────────────────────────────────────────────────── */
@media print {
  @page { margin: 14mm 12mm; size: A4; }
  .topbar, .warn-banner, form, .btn, .btn-bar,
  .col-sidebar, .filters-bar, .no-print { display: none !important; }
  .print-header, .print-disclaimer { display: block !important; }
  .page-header { border-bottom: 2pt solid var(--accent); padding: 10pt 0; margin-bottom: 12pt; }
  .card { border: 0.5pt solid #ccc; border-radius: 0; padding: 10pt; margin-bottom: 8pt; box-shadow: none; }
  main { padding: 0; max-width: none; }
  .two-col-layout { grid-template-columns: 1fr; }
  thead th { background: #1f4f82 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr.row-total td, tr.row-grand td, tr.row-lav td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .metric-card.mc-primary { background: #1f4f82 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
