:root {
  /* Dep 26 Tools — blu come colore d'azione, rosso come accento del marchio */
  --bg: #0f1219;
  --bg2: #141822;
  --panel: #171b26;
  --panel2: #1f2432;
  --line: #272d3c;
  --line2: #363d50;
  --text: #e9ecf4;
  --muted: #9ba3b7;
  --faint: #6d758b;
  --accent: #7095ff;
  --accent-2: #5b82f5;
  --accent-ink: #0a1022;
  --accent-soft: rgba(112, 149, 255, .14);
  --brand-red: #ff5d52;
  --brand-red-soft: rgba(255, 93, 82, .14);
  --pos: #4cc38a;
  --neg: #ff6b5f;
  --pos-soft: rgba(76, 195, 138, .13);
  --neg-soft: rgba(255, 107, 95, .13);
  --info: #a48bff;
  --input: #121620;
  --focus: #7095ff;
  --radius: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg2: #f5f7fc;
  --panel: #ffffff;
  --panel2: #f2f5fb;
  --line: #e3e8f2;
  --line2: #cfd6e4;
  --text: #121726;
  --muted: #586078;
  --faint: #8890a6;
  --accent: #2350d8;
  --accent-2: #3463ea;
  --accent-ink: #ffffff;
  --accent-soft: rgba(35, 80, 216, .08);
  --brand-red: #e0463c;
  --brand-red-soft: rgba(224, 70, 60, .09);
  --pos: #12825a;
  --neg: #cf3328;
  --pos-soft: rgba(18, 130, 90, .09);
  --neg-soft: rgba(207, 51, 40, .08);
  --info: #6a4ad6;
  --input: #ffffff;
  --focus: #2350d8;
  --shadow: 0 10px 30px rgba(20, 30, 60, .10);
  color-scheme: light;
}
:root[data-theme="light"] .card, :root[data-theme="light"] .kpis, :root[data-theme="light"] .ncard, :root[data-theme="light"] .tile { box-shadow: 0 1px 2px rgba(20, 20, 30, .04); }
:root[data-theme="light"] td.pos { background: rgba(35, 80, 216, .045); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.num, .money, td.n, th.n { font-variant-numeric: tabular-nums; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: var(--panel2); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
main { padding: 22px 20px 80px; max-width: 1680px; margin: 0 auto; }

/* ---------- elementi base ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line2);
  background: var(--panel2); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.danger { color: var(--neg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.iconbtn {
  width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--faint);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.iconbtn:hover { color: var(--text); background: var(--panel2); }
.iconbtn.del:hover { color: var(--neg); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; letter-spacing: .02em; }
.inp, select.inp, textarea.inp {
  width: 100%; height: 38px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line2);
  background: var(--input); outline: none;
}
textarea.inp { height: auto; padding: 9px 11px; min-height: 80px; resize: vertical; }
.inp:focus { border-color: var(--focus); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.card-h {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap;
}
.card-h h2 { margin: 0; font-size: 15px; letter-spacing: .03em; text-transform: uppercase; }
.card-h .sp { flex: 1; }
.card-b { padding: 0 16px 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
}
.chip.milk { background: rgba(127, 178, 232, .14); color: var(--info); border-color: transparent; }
.chip.closed { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.chip.open { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.page-h { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h .sp { flex: 1; }
.page-h .sub { color: var(--muted); margin-top: 3px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login {
  width: 100%; max-width: 380px; padding: 30px 28px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login .brand { margin-bottom: 22px; font-size: 18px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login p { color: var(--muted); margin: 0 0 20px; }
.login .btn { width: 100%; height: 42px; margin-top: 6px; }
.errbox { background: var(--neg-soft); color: var(--neg); padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }

/* ---------- lista serate ---------- */
.nights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ncard {
  display: flex; flex-direction: column; padding: 0; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); transition: border-color .15s, transform .15s;
}
.ncard:hover { border-color: var(--line2); transform: translateY(-1px); }
.ncard .d { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ncard .t { font-size: 18px; font-weight: 700; margin: 2px 0 10px; }
.ncard .row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.ncard .row b { color: var(--text); font-weight: 600; }
.ncard .big { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ncard .chips { display: flex; gap: 6px; margin-bottom: 8px; min-height: 22px; }
.month-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; margin: 22px 0 10px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 14px; }

/* ---------- serata ---------- */
.night-h { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.night-h .back { color: var(--muted); font-weight: 600; }
.night-h .title { display: flex; flex-direction: column; min-width: 0; }
.night-h .title .d { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.night-h .title input {
  font-size: 22px; font-weight: 700; background: transparent; border: 1px solid transparent; border-radius: 7px;
  padding: 1px 6px; margin-left: -7px; min-width: 200px; outline: none;
}
.night-h .title input:hover:not(:disabled) { border-color: var(--line); }
.night-h .title input:focus { border-color: var(--focus); background: var(--input); }
.night-h .sp { flex: 1; }
.night-h .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.savestate { font-size: 12px; color: var(--faint); min-width: 90px; text-align: right; }
.savestate.err { color: var(--neg); }

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 18px;
}
.kpi { background: var(--panel); padding: 12px 14px; min-width: 0; }
.kpi .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 21px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--faint); }
.kpi.hl { background: linear-gradient(180deg, var(--accent-soft), transparent), var(--panel); }
.kpi.hl .v { color: var(--accent); }

.grid-night { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1500px) {
  .grid-night { grid-template-columns: minmax(0, 2.1fr) minmax(380px, 1fr); align-items: start; }
  .grid-night .col-r { position: sticky; top: 74px; }
  .grid-night .full { grid-column: 1 / -1; }
}
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.jump { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }

/* ---------- tabelle foglio ---------- */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sheet { width: 100%; border-collapse: separate; border-spacing: 0; }
table.sheet th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700;
  text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.sheet th.n, table.sheet td.n { text-align: right; }
table.sheet td { padding: 2px 3px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); vertical-align: middle; }
table.sheet tr:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
table.sheet tfoot td { border-bottom: 0; border-top: 1px solid var(--line2); padding: 8px 4px; font-weight: 700; }
table.sheet .tot { font-weight: 700; padding-right: 8px; white-space: nowrap; }
table.sheet td.acts { width: 1%; white-space: nowrap; opacity: 0; transition: opacity .1s; }
table.sheet tr:hover td.acts, table.sheet tr:focus-within td.acts { opacity: 1; }
@media (hover: none) { table.sheet td.acts { opacity: 1; } }

.cell {
  width: 100%; height: 32px; padding: 0 7px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; outline: none; min-width: 0;
}
.cell:hover:not(:disabled) { border-color: var(--line); }
.cell:focus { border-color: var(--focus); background: var(--input); }
.cell.n { text-align: right; font-variant-numeric: tabular-nums; }
.cell.bad { color: var(--neg); border-color: var(--neg); }
.cell:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
.cell.name { font-weight: 600; }
.cell.sm { font-size: 12px; color: var(--muted); height: 22px; }
.numwrap { position: relative; }
.numwrap .ev {
  position: absolute; right: 3px; top: 1px; font-size: 10px; color: var(--accent); pointer-events: none;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.numwrap.hasev .cell { color: var(--accent); }
.numwrap.hasev .cell:focus { color: var(--text); padding-bottom: 10px; }
.numwrap.hasev .cell:focus + .ev { top: auto; bottom: 0; right: 8px; }
td.sc { min-width: 56px; width: 62px; }
td.pos { min-width: 80px; width: 88px; background: color-mix(in srgb, var(--info) 5%, transparent); }
td.fis { min-width: 80px; width: 88px; }
td.pname { min-width: 172px; }
.pname-wrap { display: flex; flex-direction: column; }
.catsel {
  height: 20px; border: 0; background: transparent; color: var(--faint); font-size: 11px; padding: 0 4px;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 700; cursor: pointer; width: 96px; flex: none;
}
.catsel:disabled { cursor: default; -webkit-appearance: none; appearance: none; }
th.poscol { color: var(--info); }

.addrow { display: flex; gap: 8px; padding-top: 10px; flex-wrap: wrap; }
.linktag { font-size: 10.5px; color: var(--info); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding-left: 8px; }
.ro { display: block; text-align: right; padding: 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sheet tfoot td { white-space: nowrap; font-size: 13px; }
table.sheet tfoot .ro { padding: 0 4px; }

/* sintesi */
.sum { display: flex; flex-direction: column; gap: 0; }
.sum .r { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.sum .r:last-child { border-bottom: 0; }
.sum .r .k { color: var(--muted); }
.sum .r .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum .r.big { padding: 11px 0; }
.sum .r.big .k { color: var(--text); font-weight: 700; }
.sum .r.big .v { font-size: 19px; color: var(--accent); }
.sum .r.sub .k { padding-left: 14px; }
.formula { font-size: 12px; color: var(--faint); margin: 8px 0 0; }

.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.cat { padding: 10px 12px; border-radius: 10px; background: var(--panel2); }
.cat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cat .v { font-weight: 700; font-size: 16px; }
.cat .s { font-size: 11.5px; color: var(--faint); }

.subh { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 6px; display: flex; align-items: center; gap: 8px; }
.subh .sp { flex: 1; }
.livebox {
  margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--accent-soft);
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
}
.livebox .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.livebox .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.livebox .main { grid-column: 1 / -1; }
.livebox .main .v { font-size: 28px; color: var(--accent); }

/* milk */
.milk-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 900px) { .milk-grid { grid-template-columns: 1fr; } }
.waterfall .r { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.waterfall .r .k { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.waterfall .r .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.waterfall .r.tot .k { color: var(--text); font-weight: 700; }
.waterfall .r.final { border-bottom: 0; padding-top: 12px; }
.waterfall .r.final .k { color: var(--text); font-weight: 800; font-size: 15px; }
.waterfall .r.final .v { color: var(--info); font-size: 24px; }
.mini { width: 74px; height: 28px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line2); background: var(--input); text-align: right; outline: none; }
.mini:focus { border-color: var(--focus); }
.mini:disabled { border-color: transparent; background: transparent; }
.tipo { height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--input); font-size: 12px; padding: 0 4px; }
.tipo:disabled { border-color: transparent; background: transparent; -webkit-appearance: none; appearance: none; }

/* ---------- dialog ---------- */
.ov {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 60; display: grid; place-items: center; padding: 16px;
  animation: fade .12s ease-out;
}
.dlg {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); animation: pop .14s ease-out;
}
.dlg.wide { max-width: 760px; }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.dlg-h h3 { margin: 0; font-size: 17px; flex: 1; }
.dlg-b { padding: 10px 20px 6px; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }

.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.permtab { width: 100%; border-collapse: collapse; }
.permtab td { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.permtab td:last-child { text-align: right; }
.permtab .d { font-size: 12px; color: var(--faint); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

.riep { font-variant-numeric: tabular-nums; }
.riep .sum .r.big .v { font-size: 22px; }
.riep-head { text-align: center; margin-bottom: 8px; }
.riep-head .d { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.riep-head .t { font-size: 20px; font-weight: 800; }

/* storico */
table.list { width: 100%; border-collapse: collapse; }
table.list th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list th.n, table.list td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--panel2); }
table.list tfoot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--line2); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.filters label.f { margin: 0; }
.filters .inp { width: 160px; }

.loglist { font-size: 13px; }
.loglist .e { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.loglist .e .m { color: var(--faint); font-size: 12px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 90;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  transition: all .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--neg); color: #fff; }

.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 40;
}
.menu-pop button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer;
}
.menu-pop button:hover { background: var(--panel2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

@media (max-width: 700px) {
  .top { padding: 8px 12px; gap: 10px; }
  .brand small, .who .uname { display: none; }
  main { padding: 16px 12px 80px; }
  h1 { font-size: 20px; }
  .kpi .v { font-size: 18px; }
  .night-h .title input { font-size: 18px; min-width: 0; width: 100%; }
  .livebox .main .v { font-size: 24px; }
}

@media print {
  .top, .night-h .acts, .jump, td.acts, .addrow, .btn, .iconbtn { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .kpi, .kpis { background: #fff; border-color: #ccc; }
  .ov { position: static; background: none; }
  .dlg { box-shadow: none; border: 0; max-height: none; }
}

@media print { body.print-dlg #app { display: none !important; } body.print-dlg .dlg-f, body.print-dlg .dlg-h button { display: none !important; } }

table.sheet td.acts .iconbtn { width: 22px; height: 24px; font-size: 13px; }
@media (max-width: 700px) { td.pname { min-width: 150px; } .catsel { width: 80px; } }

/* ---------- sottomenu sezione ---------- */
.subnav { border-bottom: 1px solid var(--line); background: var(--bg2); }
.subnav-in { max-width: 1680px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.subnav-t { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 800; margin-right: 10px; }
.subnav a { padding: 10px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--text); }
.subnav a.on { color: var(--text); border-bottom-color: var(--accent); }
@media (max-width: 700px) { .subnav-in { padding: 0 12px; } }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr; } }
.tiles-side { display: grid; gap: 12px; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; color: var(--text); }
a.tile:hover { border-color: var(--line2); }
.tile-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 20px; margin-bottom: 14px; }
.tile-t { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.tile-d { color: var(--muted); margin-top: 4px; max-width: 52ch; }
.tile.small { padding: 16px 18px; }
.tile.small .tile-t { font-size: 15px; }
.tile.small .tile-d { font-size: 13px; }
.tile.soon { border-style: dashed; background: transparent; }
.tile.soon .tile-t { color: var(--muted); }
.tile-stat { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--panel2); }
.tile-stat .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tile-stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile-stat .s { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tile-a { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- menu laterale ---------- */
:root { --s-cash: #4f7ff0; --s-pos: #e8645c; --side-w: 244px; }
:root[data-theme="light"] { --s-cash: #2b59d9; --s-pos: #e0574f; }
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px 0; background: var(--bg2); border-right: 1px solid var(--line); overflow-y: auto; z-index: 40;
}
.side .brand { padding: 4px 8px 0; }
.sn { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sn-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.sn-item svg { width: 19px; height: 19px; flex: none; }
.sn-item:hover { background: var(--panel); color: var(--text); }
.sn-item.on { background: var(--panel2); color: var(--text); }
.sn-item.on svg { color: var(--accent); }
.sn-sub { display: none; flex-direction: column; margin: 2px 0 6px 19px; padding-left: 12px; border-left: 1px solid var(--line); }
.sn-sub.open { display: flex; }
.sn-sub a { padding: 6px 10px; color: var(--muted); border-radius: 7px; font-size: 13.5px; font-weight: 500; }
.sn-sub a:hover { color: var(--text); }
.sn-sub a.on { color: var(--accent); font-weight: 700; }
.sn-group { margin: 18px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.sn-user { display: flex; align-items: center; gap: 10px; margin: 0 -14px; padding: 12px 14px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--bg2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: none; }
.sn-uname { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sn-uname b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-uname span { font-size: 12px; color: var(--faint); }
.sn-user .menu-pop { top: auto; bottom: calc(100% + 6px); left: 10px; right: 10px; min-width: 0; }
.content { min-width: 0; }
.mtop, .scrim { display: none; }
.grid-night .col-r { top: 16px; }
@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: none;
  }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .mtop {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 8px 12px;
    background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .burger { width: 40px; height: 40px; color: var(--text); }
  .burger svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) { .side, .scrim { transition: none; } }

/* ---------- dashboard riepilogativa ---------- */
.dpanel .card-h { padding: 16px 18px 12px; }
.dp-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.dp-ic svg { width: 18px; height: 18px; }
.dpanel .card-b { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.dash-kpis { margin: 0; }
.todaybar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); }
.todaybar .sp { flex: 1; }
.todaybar .go { color: var(--accent); font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--pos); box-shadow: 0 0 0 4px var(--pos-soft); }
.dgrid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 1100px) { .dgrid { grid-template-columns: minmax(0, 1fr); } }
.dgrid .subh { margin-top: 0; }
.legend { display: flex; gap: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s-cash { background: var(--s-cash); }
.sw.s-pos { background: var(--s-pos); }
.chartwrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line2); stroke-width: 1; }
.chart .ax { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .s-cash { fill: var(--s-cash); }
.chart .s-pos { fill: var(--s-pos); }
.chart .hit { fill: transparent; }
.chart .bar { cursor: pointer; outline: none; }
.chart .bar.dim .s-cash, .chart .bar.dim .s-pos { opacity: .45; }
.chart .bar:focus-visible .hit { stroke: var(--focus); stroke-width: 2; }
.ctip {
  position: absolute; top: -8px; transform: translateY(-100%); background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 10px; padding: 8px 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px;
  pointer-events: none; box-shadow: var(--shadow); white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 5;
}
.ctip span { color: var(--muted); }
.rrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px dashed var(--line); color: var(--text); border-radius: 6px; }
.rrow:hover { background: var(--panel2); }
.rd { display: flex; flex-direction: column; line-height: 1.15; }
.rd small { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.rn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.rv { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 76px; }
.milkopt { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.milkopt .check { margin: 0; }
.milkopt-d { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ctip[hidden] { display: none; }

/* indicatori: nessun riquadro vuoto quando vanno a capo */
.kpis { background: var(--panel); gap: 0; }
.kpi { box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }

/* ---------- locali ---------- */
:root { --warn: #f2a65a; --warn-soft: rgba(242, 166, 90, .14); }
:root[data-theme="light"] { --warn: #b4530a; --warn-soft: rgba(180, 83, 10, .09); }
.logo { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo.ini { background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 12px; letter-spacing: .02em; border-color: transparent; }
.logo.xs { width: 22px; height: 22px; border-radius: 6px; font-size: 9px; }
.logo.md { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.logo.lg { width: 52px; height: 52px; border-radius: 13px; font-size: 18px; }
.logo.xl { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
.sn-loc { display: flex; align-items: center; gap: 10px; margin: 14px 4px 6px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.sn-loc-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sn-loc-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-loc-t a { font-size: 12px; color: var(--accent); }
.mtop .brand { gap: 8px; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.lcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-align: left; transition: border-color .15s, transform .15s; }
a.lcard:hover { border-color: var(--line2); transform: translateY(-1px); }
.lcard.off { opacity: .65; }
.lc-top { display: flex; align-items: center; gap: 14px; }
.lc-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lc-t b { font-size: 19px; letter-spacing: -.01em; }
.lc-t span { color: var(--muted); font-size: 13px; }
.lc-today { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--pos); }
.lc-stat { padding: 12px 14px; border-radius: 12px; background: var(--panel2); }
.lc-stat .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.lc-stat .v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lc-stat .s { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.lc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.lc-foot .sp { flex: 1; }
.lc-foot .go { color: var(--accent); font-weight: 700; }
.lcard.add { border-style: dashed; background: transparent; align-items: center; justify-content: center; gap: 4px; cursor: pointer; min-height: 180px; color: var(--muted); font: inherit; }
.lcard.add:hover { border-color: var(--accent); color: var(--text); }
.lcard.add .plus { font-size: 30px; line-height: 1; color: var(--accent); }
.lcard.add span:last-child { font-size: 13px; }
.loc-h { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.loc-h .sp { flex: 1; }
.loc-t h1 { margin: 0; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.lg svg { width: 20px; height: 20px; }
.dpanel + .dpanel { margin-top: 18px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--panel2); color: var(--muted); }
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--neg-soft); color: var(--neg); }
.docsum { display: flex; gap: 6px; flex-wrap: wrap; }
.drow { grid-template-columns: minmax(0, 1fr) auto; }
.drow .rn { display: flex; flex-direction: column; color: var(--text); white-space: normal; }
.drow .rn small { color: var(--faint); font-size: 12px; }
.ftabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ftab { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.ftab b { color: var(--text); margin-left: 3px; }
.ftab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ftab.on b { color: var(--bg); }
.filters .sp { flex: 1; }
.flab { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; letter-spacing: .02em; }
.fileline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 38px; }
.fname { font-weight: 600; word-break: break-all; }
.logo-edit { display: flex; align-items: center; gap: 16px; }
.locrows { display: flex; flex-direction: column; }
.locrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.locrow:last-child { border-bottom: 0; }
.lr-t { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.lr-t span { color: var(--muted); font-size: 13px; }
.chkrow { display: flex; gap: 6px 16px; flex-wrap: wrap; }
.chkrow .check { gap: 7px; }
table.list td .pill { vertical-align: middle; }

@media (min-width: 1024px) { .layout { background: linear-gradient(to right, var(--bg2) var(--side-w), var(--bg) var(--side-w)); } .side { border-right: 0; box-shadow: 1px 0 0 var(--line); } }

/* box ultima serata */
.lc-inc { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }
.lc-inc span { font-weight: 700; color: var(--text); }
.lc-inc b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.lc-rows { display: flex; flex-direction: column; margin-top: 6px; border-top: 1px solid var(--line2); padding-top: 4px; }
.lc-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; font-size: 14px; color: var(--text); }
.lc-rows > div b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-rows small { color: var(--muted); font-size: 12px; }
.lc-rows .minus { border-top: 1px dashed var(--line2); margin-top: 3px; padding-top: 6px; }
.lc-rows .tot { font-weight: 800; }
.lc-rows .tot b { font-size: 16px; font-weight: 800; }
.lc-stat .s { margin-top: 4px; }
.lc-foot .gest { color: var(--muted); font-weight: 600; padding: 4px 8px; border-radius: 7px; }
.lc-foot .gest:hover { background: var(--panel2); color: var(--text); }
/* gestione locali */
.setgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .setgrid { grid-template-columns: minmax(0, 1fr); } }
.lpick { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.lpick:hover { background: var(--panel2); }
.lpick.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.lpick .ord { display: flex; flex-direction: column; }
.lpick .ord .iconbtn { width: 24px; height: 20px; font-size: 12px; }
.lpick .ord .iconbtn:disabled { opacity: .25; cursor: default; }
.ident { display: flex; flex-direction: column; gap: 4px; }
.ident .logo-edit { margin-bottom: 14px; }
.logo-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.logo-btns .faint { flex-basis: 100%; }
#mlogo { display: inline-flex; }

/* tavoli */
.tavtab td.tcod { width: 82px; min-width: 70px; }
.tavtab td.tnom { min-width: 160px; }
.tavtab td.tstr { width: 130px; min-width: 110px; }
.tavtab td.tnum { width: 96px; min-width: 84px; }
.tvcheck { display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); font-size: 13px; color: var(--muted); }
.tvcheck b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .tavtab td.tcod { width: 58px; min-width: 52px; } .tavtab td.tnom { min-width: 120px; } .tavtab td.tstr { min-width: 104px; } .tavtab td.tnum { min-width: 72px; } }

.strsel { font-weight: 700; font-size: 12.5px; letter-spacing: .03em; cursor: pointer; padding-right: 4px; }
.strsel:disabled { cursor: default; -webkit-appearance: none; appearance: none; }
.strsel.s-mike { color: var(--brand-red); }
.strsel.s-evolution { color: var(--accent); }
.tvbase { font-variant-numeric: tabular-nums; color: var(--text); }
.strsel.s-locale { color: var(--pos); }

/* ---------- veste Dep 26 ---------- */
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent); box-shadow: 0 1px 2px rgba(20, 40, 120, .18), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.primary:hover { filter: brightness(1.06); }
.brand { color: var(--text); font-weight: 800; letter-spacing: -.01em; }
.brand small { font-weight: 600; color: var(--muted); }
.brand .b-dot { color: var(--brand-red); }
.sn-item.on { background: var(--accent-soft); color: var(--text); }
.sn-item.on svg { color: var(--accent); }
.sn-sub a.on { color: var(--accent); }
.kpi.hl { background: linear-gradient(180deg, var(--accent-soft), transparent), var(--panel); }
.chip.milk { background: rgba(106, 74, 214, .12); color: var(--info); }
.logo.ini { background: var(--accent-soft); color: var(--accent); }
.dp-ic, .tile-ic { background: var(--accent-soft); color: var(--accent); }
.avatar { background: linear-gradient(135deg, var(--accent), var(--brand-red)); color: #fff; }
/* login */
.login-wrap { background:
  radial-gradient(900px 500px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(700px 420px at 110% 110%, var(--brand-red-soft), transparent 60%), var(--bg); }
.login { border-top: 4px solid var(--accent); position: relative; }
.login::after { content: ""; position: absolute; top: -4px; right: 0; width: 34%; height: 4px; border-top-right-radius: 18px; background: var(--brand-red); }
.login .brand img { width: 34px; height: 34px; }
.login .brand { font-size: 20px; }
.bname { white-space: nowrap; }

/* ---------- caselle compilabili come un foglio ---------- */
:root { --cell-bg: rgba(112, 149, 255, .06); --cell-line: #2f3648; --cell-line-h: #46506a; }
:root[data-theme="light"] { --cell-bg: #f6f8fd; --cell-line: #d5dcea; --cell-line-h: #aab6d0; }
.cell:not(:disabled) { background: var(--cell-bg); border-color: var(--cell-line); }
.cell:not(:disabled):hover { border-color: var(--cell-line-h); }
.cell:not(:disabled):focus { border-color: var(--focus); background: var(--input); box-shadow: 0 0 0 3px var(--accent-soft); }
.cell:disabled { background: transparent; border-color: transparent; }
.cell.sm:not(:disabled) { background: transparent; border-color: transparent; border-bottom: 1px dashed var(--cell-line-h); border-radius: 0; height: 22px; }
.cell.sm:not(:disabled):focus { border: 1px solid var(--focus); border-radius: 6px; background: var(--input); }
.cell.name:not(:disabled) { background: transparent; border-color: transparent; }
.cell.name:not(:disabled):hover { border-color: var(--cell-line); }
.cell.name:not(:disabled):focus { background: var(--input); border-color: var(--focus); }
table.sheet td { padding: 3px 3px; }
.mini:not(:disabled), .tipo:not(:disabled) { background: var(--cell-bg); border-color: var(--cell-line); }
.mini:not(:disabled):focus, .tipo:not(:disabled):focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.strsel:not(:disabled), .catsel:not(:disabled) { background: var(--cell-bg); border: 1px solid var(--cell-line); border-radius: 6px; }
.catsel:not(:disabled) { height: 22px; }
.edit-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.edit-hint i { width: 26px; height: 14px; border-radius: 4px; background: var(--cell-bg); border: 1px solid var(--cell-line); display: inline-block; }

/* ---------- menu sezioni fisso ---------- */
.jump {
  position: sticky; top: 0; z-index: 25; margin: 0 0 14px; padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; transition: border-color .15s;
}
.jump.stuck { border-bottom-color: var(--line); box-shadow: 0 8px 14px -14px rgba(20, 30, 60, .5); }
.jump a.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent); }
.jump .edit-hint { margin-left: auto; white-space: nowrap; }
@media (max-width: 1023px) { .jump { top: 57px; padding: 8px 0; } .jump .edit-hint { display: none; } }
@media (min-width: 1500px) { .grid-night .col-r { top: 70px; } }

/* nuova serata */
.preopt { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.preline { display: flex; align-items: center; gap: 8px; }
.preline .eur { font-weight: 800; color: var(--accent); }
.preline .inp { max-width: 220px; font-size: 18px; font-weight: 700; height: 44px; font-variant-numeric: tabular-nums; }
.preopt .milkopt-d .btn { height: 24px; padding: 0 8px; vertical-align: middle; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; }

.lrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.lrow .lpick { background: var(--panel); border: 1px solid var(--line); padding: 12px; }
.lrow .lpick:hover { border-color: var(--line2); background: var(--panel); }
.lrow .lpick.on { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lpick .ord { flex-direction: row; gap: 2px; }
.lpick .ord .iconbtn { width: 26px; height: 26px; }
#lman { scroll-margin-top: 16px; }
#lman .card-b > .subh { padding-top: 18px; border-top: 1px solid var(--line); margin-top: 22px !important; }
#lman .card-b > .subh:first-child { border-top: 0; padding-top: 0; margin-top: 0 !important; }
[hidden] { display: none !important; }

/* riepilogo serata a destra */
.rbox .card-b { padding-top: 0; }
.rb-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); }
.rb-main span { font-weight: 700; }
.rb-main b { font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.rb-rows { display: flex; flex-direction: column; margin-top: 6px; }
.rb-r { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rb-r b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rb-r.sub span:first-child { padding-left: 12px; color: var(--muted); }
.rb-r.minus { margin-top: 4px; }
.rb-r.tot { border-bottom: 0; font-weight: 800; }
.rb-r.tot b { font-size: 17px; }
@media (min-width: 1500px) {
  .grid-night .col-r { top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 4px; }
  .grid-night .col-r .card + .card { margin-top: 0; }
}

.rvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 22px; }
.rvgroup .check { margin: 6px 0; }
.rsec .subh { margin: 14px 0 2px; color: var(--accent); }
.rsec:first-child .subh { margin-top: 4px; }

.rvhead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--text); margin: 0 0 4px !important; }
.rvitem { padding-left: 24px; }
.rvgrid .check input { flex: none; }
.btn.primary.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.rtab .r { display: grid; grid-template-columns: minmax(0, 1fr) 84px 84px 96px; gap: 10px; }
.rtab .r .v { text-align: right; }
.rtab .r .k { overflow-wrap: anywhere; }
.rtab .r.hd { padding: 2px 0 4px; }
.rtab .r.hd .v { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.rtab .r.big .v { font-size: 15px; color: var(--text); }
.rtab .r.big .v:last-child { font-size: 19px; color: var(--accent); }
.rtab .r.rh .k { color: var(--text); font-weight: 700; padding-top: 6px; }
@media (max-width: 560px) { .rtab .r { grid-template-columns: minmax(0, 1fr) 62px 62px 74px; gap: 6px; font-size: 12.5px; } .rtab .r.big .v:last-child { font-size: 16px; } }
.riep .rtab .r.big .v { font-size: 15px; color: var(--text); }
.riep .rtab .r.big .v:last-child { font-size: 19px; color: var(--accent); }
@media (max-width: 560px) { .riep .rtab .r.big .v { font-size: 13px; } .riep .rtab .r.big .v:last-child { font-size: 15px; } }

/* ---------- testata serata fissa (titolo, indicatori, menu sezioni) ---------- */
.nhead {
  position: sticky; top: 0; z-index: 25; margin: 0 -2px 14px; padding: 0 2px;
  background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.nhead .jump { position: static; margin: 0; padding: 0 0 10px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; box-shadow: none; }
.nhead .kpis { margin-bottom: 12px; }
.nhead.stuck { padding-top: 8px; border-bottom: 1px solid var(--line); box-shadow: 0 8px 14px -14px rgba(20, 30, 60, .5); }
.nhead.stuck .night-h { margin-bottom: 8px; }
.nhead.stuck .night-h .title input { font-size: 17px; }
.nhead.stuck .kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(128px, 1fr); overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
.nhead.stuck .kpis::-webkit-scrollbar { display: none; }
.nhead.stuck .kpi { padding: 7px 12px; }
.nhead.stuck .kpi .l { font-size: 10.5px; }
.nhead.stuck .kpi .v { font-size: 17px; margin-top: 0; }
.nhead.stuck .kpi .s { display: none; }
.nhead.stuck .jump { padding-bottom: 8px; }
@media (max-width: 1023px) { .nhead { top: 57px; } .nhead.stuck .night-h .back, .nhead.stuck .night-h .chip, .nhead.stuck .savestate { display: none; } }
@media (min-width: 1500px) { .grid-night .col-r { top: calc(var(--nh, 70px) + 12px); max-height: calc(100vh - var(--nh, 70px) - 28px); } }
@media print { .nhead { position: static; box-shadow: none; border: 0; } }
@media (max-width: 700px) {
  .nhead.stuck .night-h { flex-wrap: nowrap; gap: 8px; }
  .nhead.stuck .night-h .title { flex: 1; }
  .nhead.stuck .night-h .title .d { font-size: 11px; }
  .nhead.stuck .night-h .title input { font-size: 15px; }
  .nhead.stuck .night-h .sp { display: none; }
  .nhead.stuck .night-h .acts { flex-wrap: nowrap; gap: 6px; }
  .nhead.stuck .night-h .acts .btn { height: 32px; padding: 0 10px; font-size: 12.5px; }
}

.mapgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; margin-top: 4px; }

.ncard-l { display: block; padding: 16px 16px 12px; color: inherit; flex: 1; }
.nexp { display: flex; gap: 8px; padding: 10px 16px 14px; border-top: 1px dashed var(--line); }
.nexp .btn { flex: 1; }

.lockbar { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--neg-soft, rgba(224, 70, 60, .08)); border: 1px solid color-mix(in srgb, var(--neg) 35%, transparent); color: var(--text); font-size: 13.5px; }
.lockbar b { color: var(--neg); }
.dlg .err { color: var(--neg); font-weight: 600; margin: 6px 0 0; }

.closedrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2, rgba(127,127,127,.06)); color: var(--muted); font-size: 13px; }
.closedrow span { flex: 1; min-width: 0; }
tr.pclosed td { opacity: .55; }
tr.pclosed td.pname { opacity: 1; }
tr.pclosed .catsel { color: var(--neg); }

.ndel { flex: 0 0 auto !important; width: 38px; padding: 0 !important; justify-content: center; }
.lgfilt { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; align-items: end; }
.lgfilt .lgq { grid-column: span 2; }
.lgfilt #lgreset { margin-bottom: 14px; }
.lgwrap { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.lgtab { font-size: 13px; }
.lgtab th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.lgtab td { vertical-align: top; }
.lgtab .lw { white-space: nowrap; color: var(--muted); }
.lgtab .lcosa { min-width: 280px; }
.lgarea { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.lgfoot { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 10px; }
@media (max-width: 700px) { .lgfilt .lgq { grid-column: auto; } }

.cassesel { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.cassesel select { height: 30px; border-radius: 8px; border: 1px solid var(--cell-line); background: var(--cell-bg); color: var(--text); padding: 0 6px; font-weight: 700; }

.cassel { height: 24px; max-width: 150px; min-width: 0; flex: 1; border: 0; border-bottom: 1px dashed var(--line2); background: transparent; color: var(--text); font-size: 12px; font-weight: 600; padding: 0 2px; margin-left: 6px; border-radius: 0; }
.cassel.vuota { color: var(--faint); font-weight: 500; }
.cassel:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.thcas { display: block; font-size: 10px; letter-spacing: .02em; color: var(--accent); text-transform: none; font-weight: 700; margin-top: 1px; }
.cat .s .neg { color: var(--neg); font-weight: 700; }

.megasw { font-size: 14.5px; }
.sum .v.neg { color: var(--neg); }

.megatree { display: grid; gap: 6px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; }
.megatree div { display: grid; grid-template-columns: minmax(170px, auto) 1fr; gap: 4px 14px; }
.megatree b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--accent); }
.megatree span { color: var(--muted); }
@media (max-width: 640px) { .megatree div { grid-template-columns: 1fr; } }

.megaf { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
