:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #111111;
  --muted: #5b5b5b;
  --line: #e6e6e6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 268px 1fr;
}
aside {
  background: #0f0f10;
  color: #f3f3f3;
  border-right: 1px solid #1c1c1c;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; flex-direction: column; gap: 8px; }
.brand-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.brand img { width: 168px; height: auto; display: block; }
.nav-close { display: none; }
.brand span { color: #9a9a9a; font-size: 12px; }
aside .brand img { background: #fff; border-radius: 8px; padding: 8px; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-lab {
  margin: 14px 4px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #8a8a8a;
}
.nav-lab:first-of-type { margin-top: 0; }
nav button, .ghost, .primary { border: 0; cursor: pointer; font: inherit; }
nav button {
  text-align: left; padding: 11px 12px; border-radius: 8px;
  background: transparent; color: #ececec; font-weight: 500;
}
nav button.on, nav button:hover { background: #fff; color: #111; }
.aside-foot { margin-top: auto; font-size: 12px; color: #9a9a9a; line-height: 1.5; }
main { padding: 0 28px 40px; overflow: auto; }
.topbar {
  background: #111; color: #fff; margin: 0 -28px 18px;
  padding: 10px 28px; font-size: 13px; display: grid;
  grid-template-columns: 1fr auto auto; gap: 16px; align-items: center;
}
.user-menu { position: relative; justify-self: end; }
.user-btn { background: transparent; color: #fff; border: 0; cursor: pointer; font: inherit; padding: 0; }
.user-drop {
  position: absolute; right: 0; top: 130%; background: #fff; color: #111;
  border: 1px solid var(--line); border-radius: 10px; min-width: 210px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 40; padding: 6px;
}
.user-drop button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit;
}
.user-drop button:hover { background: #f4f5f7; }
.top { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.top-title { display: flex; flex-direction: column; }
.kicker { margin: 0; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-size: 11px; font-weight: 700; }
h1 { margin: 4px 0 0; font-size: 30px; font-weight: 700; }
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px;
}
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 600; margin: 0; }
.filters #mese { width: 150px; min-width: 150px; }
.filters #anno { width: 96px; min-width: 96px; }
.filters #nr { width: 110px; min-width: 110px; }
.filters #suff { width: 100px; min-width: 100px; }
.filters #reload { height: 40px; padding: 0 18px; white-space: nowrap; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 500; }
input, select {
  background: #fff; border: 1px solid #d8d8d8; color: var(--ink);
  border-radius: 8px; padding: 9px 10px; font: inherit; min-width: 88px; height: 40px;
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi b { display: block; font-size: 22px; margin-top: 6px; }
.kpi span { color: var(--muted); font-size: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 0 8px; margin-bottom: 16px; }
.panel-h { padding: 16px 20px 12px; display: flex; justify-content: space-between; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.panel-h h2 { margin: 0; font-size: 18px; }
.panel-body { padding: 0 20px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hint { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.sdd { background: #e8f7fb; color: #0a6b7c; }
.bon { background: #f1f1f1; color: #333; }
.riba { background: #fff3dd; color: #8a5a00; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; padding: 8px 20px 20px; }
.wide { grid-column: 1 / -1; }
.primary { background: #111; color: #fff; font-weight: 700; padding: 11px 18px; border-radius: 8px; }
.ghost { background: #fff; color: #111; padding: 10px 14px; border-radius: 8px; border: 1px solid #111; }
.actions { display: flex; gap: 8px; }
.log { margin: 0; flex: 1 1 100%; white-space: pre-wrap; color: #333; font-size: 14px; background: #f7f7f8; border-radius: 10px; padding: 12px 14px; min-height: 0; }
.log:empty { display: none; }
.gate { position: fixed; inset: 0; background: #fff; z-index: 80; display: grid; place-items: center; }
.gate.hidden { display: none !important; }
.gate-card {
  width: min(400px, 92vw); background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
.gate-card h2 { margin: 0; }
.gate-card input { min-width: 0; }
.gate-card .logo-img { width: 180px; height: auto; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
}

.notice{margin:12px 24px 0;padding:12px 16px;background:#111;color:#fff;border-radius:12px;font-size:14px}
.notice.hidden{display:none!important}
.notice button{margin-left:8px;background:#fff;color:#111}

#notifBadge{display:inline-block;margin-left:6px;background:#fff;color:#111;border-radius:10px;padding:1px 7px;font-size:11px}
.cards { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.card strong { display: block; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.card-side b { font-size: 16px; }
.asseg { background: #111; color: #fff; }
#anagCerca { min-width: 220px; padding: 8px 12px; border: 1px solid #e6e6e6; border-radius: 10px; height: 40px; }
.burger { display: none; background: transparent; color: #fff; border: 0; font-size: 22px; padding: 4px 8px; cursor: pointer; }
.nav-scrim { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  .burger { display: inline-flex; }
  .topbar {
    grid-template-columns: auto 1fr auto;
    margin: 0 -16px 14px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .topbar-title { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 0 16px 88px; }
  h1 { font-size: 22px; }
  aside {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px);
    height: 100dvh; max-height: 100dvh;
    z-index: 90; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: none;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: env(safe-area-inset-bottom);
    flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    overflow: hidden;
  }
  aside.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.18); }
  .nav-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 0; background: #f1f1f1; color: #111;
    border-radius: 20px; font-size: 24px; line-height: 1; cursor: pointer; flex-shrink: 0;
  }
  .nav-scrim {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 85;
  }
  nav { flex-direction: column; width: 100%; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
  nav button { padding: 14px 12px; font-size: 16px; }
  .aside-foot { font-size: 11px; flex-shrink: 0; margin-top: 8px; padding-bottom: 8px; }
  .filters { padding: 12px; gap: 10px; }
  .filters label { flex: 1 1 42%; min-width: 0; }
  .filters #mese, .filters #anno, .filters #nr, .filters #suff {
    width: 100%; min-width: 0;
  }
  .filters #reload { width: 100%; height: 44px; }
  input, select { min-width: 0; width: 100%; height: 44px; font-size: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 18px; }
  .panel-h { flex-direction: column; align-items: stretch; padding: 14px 14px 8px; }
  .grid-form { grid-template-columns: 1fr; padding: 8px 14px 20px; }
  .wide { grid-column: 1; }
  th, td { padding: 10px 12px; font-size: 13px; }
  .primary, .ghost { min-height: 44px; }
  .gate-card { width: min(420px, 94vw); padding: 22px 18px; }
  .notice { margin: 8px 0 0; }
  #anagCerca { width: 100%; min-width: 0; }
  .cards { padding: 8px 12px 16px; }
  .card { align-items: flex-start; }
  .kpis .kpi:nth-child(n+3) { display: none; }
}
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal.hidden { display: none !important; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: min(560px, 96vw); max-height: 86vh; overflow: auto; }
.sdd-row { display: grid; gap: 6px; margin: 12px 0; }
.sdd-row input { width: 100%; min-width: 0; }
.card-lotto { align-items: flex-start; }
.extra-box { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.extra-line { display: flex; gap: 6px; align-items: center; }
.extra-line input { height: 36px; min-width: 0; }
.extra-line .ex-nome { flex: 1; }
.extra-line .ex-netto { width: 90px; }
.extra-line .ex-del { padding: 0 10px; height: 36px; }
.wiki { padding: 8px 20px 28px; max-width: 720px; line-height: 1.55; font-size: 15px; }
.wiki h3 { margin: 22px 0 8px; font-size: 17px; }
.wiki ol, .wiki ul { padding-left: 20px; }
.wiki code { background: #f1f1f1; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.wiki img { width: 100%; max-width: 420px; border-radius: 14px; border: 1px solid var(--line); margin: 10px 0 16px; display: block; }
