/* Ropa De Gorila — Gestionale. Linguaggio visivo ispirato alle app Apple (base: NIMA Gestionale) */

:root {
  --bg: #F2F2F7;
  --bg-elev: #FFFFFF;
  --bg-side: #F7F7F9;
  --fill: #EEEEF0;
  --fill-2: #E5E5EA;
  --sep: #E5E5EA;
  --sep-soft: #F0F0F3;
  --label: #1D1D1F;
  --label-2: #6E6E73;
  --label-3: #8A8A8E;
  --ink: #1D1D1F;
  --on-ink: #FFFFFF;
  --link: #0A64D6;
  --green: #1F7A37;
  --green-bg: #E6F6EA;
  --red: #C4221B;
  --red-fill: #FF3B30;
  --red-bg: #FFECEB;
  --warn: #A64B00;
  --warn-bg: #FFF2E0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
  --radius-card: 22px;
  --radius-row: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1C1C1E;
    --bg-side: #121214;
    --fill: #2C2C2E;
    --fill-2: #3A3A3C;
    --sep: #38383A;
    --sep-soft: #2C2C2E;
    --label: #F5F5F7;
    --label-2: #A1A1A6;
    --label-3: #8E8E93;
    --ink: #F5F5F7;
    --on-ink: #000000;
    --link: #4DA3FF;
    --green: #4CD964;
    --green-bg: rgba(52, 199, 89, 0.18);
    --red: #FF6961;
    --red-bg: rgba(255, 59, 48, 0.18);
    --warn: #FFB340;
    --warn-bg: rgba(255, 159, 10, 0.16);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
  html .period[aria-pressed='true'] .pill.up, html .inv .pill.up { color: #1F7A37; background: #E6F6EA; }
  html .period[aria-pressed='true'] .pill.down, html .inv .pill.down { color: #C4221B; background: #FFECEB; }
  html .period[aria-pressed='true'] .pill.flat, html .inv .pill.flat { color: #6E6E73; background: #E5E5EA; }
  html .date-btn.past { color: #FFB340; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* iPhone: niente zoom con il doppio tocco su frecce e pulsanti, né quando si apre una tendina */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, label, select, input, .period, .chip { touch-action: manipulation; }
@media (pointer: coarse) {
  input, select, textarea { font-size: max(16px, 1em) !important; }
  .seg button { min-height: 40px; }
  .card-h a, .card-h .btn-plain, .list-head .btn-plain { min-height: 40px; display: inline-flex; align-items: center; }
  .entry-head .muted a { display: inline-flex; align-items: center; min-height: 40px; }
  a.rank-name { padding: 10px 0; margin: -10px 0; }
}
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: var(--link); text-decoration: none; }
:focus-visible { outline: 3px solid rgba(10, 100, 214, 0.55); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--label-2); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hidden, [hidden] { display: none !important; }
.only-mobile { display: none !important; }

/* ---------- Struttura ---------- */

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.nav {
  width: 264px; flex-shrink: 0; background: var(--bg-side); border-right: 1px solid var(--sep);
  padding: calc(18px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 16px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px; background: #000; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.brand-mark img { height: 68%; width: auto; display: block; }
.brand-mark-lg { width: 76px; height: 76px; border-radius: 18px; font-size: 32px; margin-bottom: 4px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 0.14em; }
.brand-sub { font-size: 13px; color: var(--label-2); }
.nav-section { font-size: 13px; font-weight: 600; color: var(--label-2); padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--label); font-size: 16px; font-weight: 500; text-align: left; width: 100%;
  transition: background-color 120ms ease;
}
.nav-item:active { background: var(--fill); }
.nav-item[aria-current='page'] { background: var(--bg-elev); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav-item .badge { margin-left: auto; font-size: 13px; color: var(--label-2); font-weight: 500; }
.tile {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff;
}
.tile svg { width: 17px; height: 17px; }
.nav-foot { margin-top: auto; padding: 10px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label-2); border: 0; background: none; text-align: left; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.page {
  flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior-x: none;
  padding: calc(22px + env(safe-area-inset-top)) 30px calc(30px + env(safe-area-inset-bottom));
}
.page-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-inner > * { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 15px; font-weight: 600; color: var(--label-2); }
.page-head h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -0.022em; }
.page-head .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 17px; border: 0; background: none; color: var(--link); padding: 0; align-self: flex-start; }
.back svg { width: 11px; height: 18px; flex-shrink: 0; }

.tabbar { display: none; }

/* ---------- Card e griglie ---------- */

.card { background: var(--bg-elev); border-radius: var(--radius-card); padding: 18px 20px; min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-h h2, .card h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.card h3 { margin: 0; font-size: 17px; font-weight: 600; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-fit { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
.g-detail { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.huge { font-size: 34px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.1; }

/* Riquadri periodo */
.period {
  background: var(--bg-elev); border: 0; border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
  text-align: left; color: var(--label); width: 100%; transition: transform 100ms ease-out;
}
.period:active { transform: scale(0.98); }
.period .p-top { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 6px; }
.period .p-label { font-size: 15px; font-weight: 600; color: var(--label-2); }
.period .p-sub { font-size: 14px; color: var(--label-2); }
.period[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); }
.period[aria-pressed='true'] .p-label, .period[aria-pressed='true'] .p-sub { color: color-mix(in srgb, var(--on-ink) 72%, transparent); }

.pill { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.pill svg { width: 11px; height: 11px; }
.pill.up { color: var(--green); background: var(--green-bg); }
.pill.down { color: var(--red); background: var(--red-bg); }
.pill.flat { color: var(--label-2); background: var(--fill); }
.pill.conv { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.period[aria-pressed='true'] .pill.up { color: #7EE29A; background: rgba(52, 199, 89, 0.2); }
.period[aria-pressed='true'] .pill.down { color: #FF8A84; background: rgba(255, 69, 58, 0.2); }
.period[aria-pressed='true'] .pill.flat { color: inherit; background: rgba(127, 127, 127, 0.25); }
.period[aria-pressed='true'] .pill.conv { background: transparent; }

.split { display: flex; gap: 2px; width: 100%; height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; background: var(--fill); }
.split > span { height: 100%; border-radius: 3px; }

.catdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.catlabel { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; }
.tag { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tag.ok { color: var(--green); background: var(--green-bg); }
.tag.warn { color: #B25000; background: #FFF4E5; }
.tag.bad { color: var(--red); background: var(--red-bg); }
.tag.gray { color: var(--label-2); background: var(--fill); }

/* ---------- Pulsanti ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 0; font-size: 16px; font-weight: 600; background: var(--fill-2); color: var(--label);
  transition: transform 100ms ease-out, opacity 100ms ease-out; white-space: nowrap;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 17px; }
.btn-block { width: 100%; border-radius: 14px; min-height: 54px; font-size: 17px; }
.btn-plain { background: transparent; color: var(--link); padding: 0 8px; font-weight: 500; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger-solid { background: var(--red-fill); color: #fff; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--fill); color: var(--link);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:active { opacity: 0.7; }
.icon-btn svg { width: 18px; height: 18px; }

/* Controllo segmentato */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg button[aria-pressed='true'] { background: var(--bg-elev); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); font-weight: 600; }
.seg.lg button { min-height: 40px; font-size: 15px; }
@media (max-width: 360px) { .seg button { padding: 0 9px; } .seg.lg button { font-size: 14px; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--fill); font-size: 15px; font-weight: 500; }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* Navigazione periodo */
.pnav { display: inline-flex; align-items: center; gap: 6px; }
.pnav .pnav-label { min-width: 150px; text-align: center; font-size: 16px; font-weight: 600; }

/* ---------- Liste ---------- */

.list { background: var(--bg-elev); border-radius: 16px; overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; width: 100%; border: 0; background: transparent;
  text-align: left; color: var(--label); position: relative;
}
.list-row + .list-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--sep-soft); }
button.list-row:active, a.list-row:active { background: var(--fill); }
.list-row .chev { color: var(--label-3); width: 9px; height: 14px; flex-shrink: 0; }
.zone-row { gap: 10px; }
.zone-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: none; border: 0; padding: 6px 0; min-height: 44px; justify-content: center; }
.zone-main .row-title { overflow-wrap: anywhere; }
button.zone-chev { background: none; border: 0; padding: 0; width: 32px; height: 44px; margin-right: -8px; display: flex; align-items: center; justify-content: center; }
button.zone-chev svg { width: 9px; height: 14px; }
.row-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.list-row > .grow { min-width: 0; }
.list-row.wrap-sm { flex-wrap: wrap; }
@media (max-width: 760px) { .list-row.wrap-sm > .grow { flex: 1 1 calc(100% - 60px); } .list-row.wrap-sm > .btn { margin-left: 50px; } }
.row-sub { font-size: 13px; color: var(--label-2); }
.list-head { font-size: 15px; font-weight: 600; color: var(--label-2); margin: 6px 4px 6px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; }
.list-head .catlabel { flex-wrap: wrap; row-gap: 4px; }
.empty { padding: 28px 16px; text-align: center; color: var(--label-2); font-size: 15px; }
.empty strong { display: block; color: var(--label); font-size: 17px; margin-bottom: 4px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #C7C7CC; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; flex-shrink: 0; letter-spacing: 0.02em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 23px; background: var(--ink); color: var(--on-ink); }
.avatar.md { width: 56px; height: 56px; font-size: 20px; background: var(--ink); color: var(--on-ink); }

.rank { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--sep-soft); }
.rank:first-of-type { border-top: 0; }
.rank .n { font-size: 14px; font-weight: 600; color: var(--label-2); }
.bar5 { display: flex; gap: 2px; height: 5px; margin-top: 5px; }
.bar8 { display: flex; height: 8px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: var(--fill); }
.bar8 span { display: block; height: 100%; }
.donut { position: relative; flex-shrink: 0; }
.donut svg { display: block; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-c strong { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.donut-c span { font-size: 12px; color: var(--label-2); }
.month-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-bar select.input { width: auto; height: 40px; font-size: 16px; font-weight: 600; padding: 0 30px 0 12px; background-position: right 11px center; }
@media (max-width: 760px) {
  .month-bar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 92px 40px; gap: 6px; }
  .month-bar select.input { width: 100%; min-width: 0; }
  .month-bar .btn { grid-column: 1 / -1; justify-self: start; }
}
.month-bar .icon-btn { width: 40px; height: 40px; }
.mix { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.mix-legend { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.mix-row { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.rank-z { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--sep-soft); color: inherit; }
.rank-z:first-of-type { border-top: 0; }
.rank-z .n { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--fill); color: var(--label-2); }
.rank-z .n.gold { background: #E61E1E; color: #fff; }
.rank-z .n.top { background: var(--ink); color: var(--on-ink); }
.rank-z .row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* La zona va sotto il nome (una riga, puntini se lunga): a destra solo importo e pezzi, così il nome ha sempre spazio. */
.rank-z .rank-zone { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.rank-z .right { white-space: nowrap; }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--label-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.bar5 > span { border-radius: 3px; }

/* ---------- Grafici ---------- */

.chart { display: flex; flex-direction: column; gap: 6px; }
.chart-area { display: flex; gap: 10px; }
.chart-bars { flex: 1; position: relative; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--sep); }
.chart-bars .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--sep); pointer-events: none; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.chart-col > span { border-radius: 3px 3px 1px 1px; min-height: 0; }
.chart-axis { width: 52px; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--label-2); }
.chart-x { display: flex; gap: 10px; }
.chart-x > div:first-child { flex: 1; display: flex; gap: 4px; }
.chart-x span { flex: 1; text-align: center; font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: visible; }
.chart-x span.today { color: var(--label); font-weight: 700; }
.chart-pair { flex: 1; height: 100%; display: flex; align-items: flex-end; gap: 2px; }
.chart-pair > span { flex: 1; border-radius: 3px 3px 0 0; }

/* ---------- Inserimento vendite ---------- */

.split-view { display: flex; height: 100%; min-height: 0; }
.picker {
  width: 304px; flex-shrink: 0; background: var(--bg-elev); border-right: 1px solid var(--sep);
  padding: calc(22px + env(safe-area-inset-top)) 0 14px; display: flex; flex-direction: column; gap: 14px; min-height: 0;
}
.picker h1 { margin: 0; padding: 0 18px; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.picker .chips { padding: 0 18px; }
.picker-tools { display: flex; gap: 8px; padding: 0 18px; align-items: center; }
.picker-tools select.input { flex: 1; min-width: 0; height: 44px; font-size: 16px; font-weight: 600; }
.filter-btn { position: relative; width: 44px; height: 44px; flex: none; }
.filter-btn svg { width: 20px; height: 20px; }
.filter-btn.on { background: var(--ink); color: var(--on-ink); }
.badge-n { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: #E61E1E; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.filter-note { margin: -4px 18px 0; font-size: 13px; color: var(--label-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-note .btn-plain { font-size: 13px; padding: 0; min-height: 0; }
.pick-head { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--label-2); padding: 14px 10px 4px; position: sticky; top: 0; background: var(--bg-elev); z-index: 1; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
@media (min-width: 761px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile-big { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 132px; padding: 16px; border-radius: 22px; border: 0; color: #fff; text-align: left; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14); transition: transform 120ms ease; }
.tile-big:active { transform: scale(0.97); }
.tile-big .tb-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, 0.22); display: flex; align-items: center; justify-content: center; }
.tile-big .tb-icon svg { width: 22px; height: 22px; }
.tile-big .tb-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-big strong { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.tile-big .tb-text > span { font-size: 13px; opacity: 0.88; line-height: 1.25; display: flex; align-items: center; gap: 6px; }
.tile-sync { background: var(--bg-elev); color: var(--label); box-shadow: none; border: 1px solid var(--sep); }
.tile-sync .tb-icon { background: var(--fill); }
.tile-sync .tb-text > span { color: var(--label-2); opacity: 1; }
.bio-btn { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: rgba(127, 127, 127, 0.18); color: inherit; font-size: 16px; font-weight: 600; }
.bio-btn svg { width: 22px; height: 22px; }
.pick-check { width: 18px; height: 18px; color: #34C759; display: flex; flex: none; }
.picker-list { flex: 1; overflow-y: auto; padding: 0 10px; }
.pick {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--label); text-align: left; width: 100%;
}
.pick .pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 11px 0; border-bottom: 1px solid var(--sep-soft); }
.pick:last-child .pick-text { border-bottom: 0; }
.pick[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); }
.pick[aria-pressed='true'] .pick-text { border-bottom-color: transparent; }
.pick[aria-pressed='true'] .row-sub { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.pick[aria-pressed='true'] .avatar { background: #48484A; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; border-radius: 10px; background: var(--fill); padding: 0 10px; color: var(--label-2);
}
.search input { border: 0; background: transparent; font-size: 16px; outline: none; width: 100%; height: 100%; color: var(--label); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; }

.entry { flex: 1; min-width: 0; overflow-y: auto; padding: calc(22px + env(safe-area-inset-top)) 28px calc(22px + env(safe-area-inset-bottom)); position: relative; }
.entry-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 0 16px; position: relative; }
.qty-row + .qty-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--sep-soft); }
.qty-row label { font-size: 18px; font-weight: 500; }
.qty-row .delta { font-size: 13px; font-weight: 600; color: var(--green); }
.qty-row .delta.neg { color: var(--red); }
.qty-row .price-special { font-size: 13px; font-weight: 600; color: var(--link); }
.stepper { display: flex; align-items: center; height: 52px; border-radius: 14px; background: var(--fill); padding: 4px; flex-shrink: 0; }
.stepper button { width: 52px; height: 44px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; }
.stepper button:active { background: rgba(127, 127, 127, 0.18); }
.stepper button svg { width: 20px; height: 20px; }
.stepper input {
  width: 76px; height: 44px; border: 0; border-radius: 10px; background: var(--bg-elev); box-shadow: var(--shadow-sm);
  text-align: center; font-size: 22px; font-weight: 700; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.date-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--fill-2); color: var(--link); font-size: 16px; font-weight: 600; position: relative; overflow: hidden; }
.date-btn input[type='date'] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.date-btn svg { width: 18px; height: 18px; }
.date-btn.past { background: color-mix(in srgb, #FF9500 22%, var(--bg-elev)); color: #B25000; }
.date-warn { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, #FF9500 14%, var(--bg-elev)); color: var(--label); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.date-warn svg { width: 18px; height: 18px; color: #FF9500; flex-shrink: 0; }
.entry-head .grow { flex: 1 1 220px; min-width: 0; }
.entry-head .grow h2 { overflow-wrap: anywhere; }
.nw { white-space: nowrap; }
.save-bar { margin-top: auto; display: flex; gap: 10px; padding-top: 6px; }
.save-bar .btn-block { flex: 1; width: auto; min-width: 0; white-space: normal; line-height: 1.2; }
.save-bar .btn-lg { min-height: 54px; border-radius: 14px; }
.prow { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.prow > span:last-child { white-space: nowrap; }

/* ---------- Form ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--label-2); }
.input, select.input {
  height: 48px; border-radius: 12px; border: 0; background: var(--fill); padding: 0 14px; font-size: 17px; width: 100%; color: var(--label); outline: none;
}
.input:focus { box-shadow: 0 0 0 3px rgba(10, 100, 214, 0.35); }
select.input {
  -webkit-appearance: none; appearance: none; padding-right: 34px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px;
}
.input.money { font-weight: 700; font-size: 20px; }
.hint { font-size: 13px; color: var(--label-2); }
.err { font-size: 14px; color: var(--red); font-weight: 500; }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background-color 200ms ease; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 250ms cubic-bezier(0.3, 1.2, 0.5, 1); }
.switch input:checked + .track { background: #34C759; }
.switch input:checked ~ .knob { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(10, 100, 214, 0.55); outline-offset: 2px; }

/* ---------- Fogli e avvisi ---------- */

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.32); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: opacity 200ms ease; }
.scrim.in { opacity: 1; }
.sheet {
  width: min(560px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); background: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; transform: translateY(24px) scale(0.98); transition: transform 320ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.scrim.in .sheet { transform: none; }
.sheet.wide { width: min(760px, 100%); }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 56px; padding: 0 8px; background: var(--bg-elev); border-bottom: 1px solid var(--sep); }
.sheet-bar h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-bar .l { justify-self: start; }
.sheet-bar .r { justify-self: end; }
.sheet-bar .r .btn-plain { font-weight: 600; }
.sheet-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.sheet-body > * { flex-shrink: 0; }
html.sheet-open .page, html.sheet-open [data-scroll] { overflow: hidden !important; }
.scrim { overscroll-behavior: contain; }
.alert { width: min(300px, 100%); background: var(--bg-elev); border-radius: 16px; overflow: hidden; text-align: center; box-shadow: var(--shadow-lg); transform: scale(1.06); transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1); }
.scrim.in .alert { transform: none; }
.alert .a-body { padding: 20px 18px 16px; }
.alert h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.alert p { margin: 0; font-size: 14px; color: var(--label-2); line-height: 1.35; }
.alert .a-btns { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--sep); }
.alert .a-btns button { min-height: 46px; border: 0; background: transparent; font-size: 17px; color: var(--link); }
.alert .a-btns button + button { border-left: 1px solid var(--sep); }
.alert .a-btns .destructive { color: var(--red-fill); font-weight: 600; }
.alert .a-btns .bold { font-weight: 600; }

.toast {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -20px); opacity: 0; z-index: 60;
  display: flex; align-items: center; gap: 8px; background: #1D1D1F; color: #fff; border-radius: 999px; padding: 11px 18px;
  font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); transition: transform 300ms cubic-bezier(0.2, 0.9, 0.3, 1), opacity 200ms ease;
  pointer-events: none;
  /* Niente sfocatura dello sfondo (backdrop-filter): su iPhone, sopra una pagina che scorre, fa diventare
     nere o vuote parti della pagina. Per lo stesso motivo il messaggio viene tolto quando sparisce. */
}
@media (prefers-color-scheme: dark) { .toast { background: #3A3A3C; } }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 18px; height: 18px; }

/* Riga scorrevole con azioni */
.swipe { position: relative; overflow: hidden; }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.swipe-actions button { width: 84px; border: 0; color: #fff; font-size: 14px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.swipe-actions svg { width: 20px; height: 20px; }
.swipe-content { position: relative; background: var(--bg-elev); transition: transform 300ms cubic-bezier(0.2, 0.9, 0.3, 1); touch-action: pan-y; }
.swipe-content.dragging { transition: none; }

/* Blocco PIN */
.lock { position: fixed; inset: 0; background: var(--bg); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lock-box { width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.lock-box h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.lock-box p { margin: 0; color: var(--label-2); font-size: 15px; }
.pin-dots { display: flex; gap: 16px; height: 18px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--label); }
.pin-dots span.on { background: var(--label); }
.pin-dots.shake { animation: shake 400ms; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 24px; }
.keypad button { width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--fill-2); font-size: 30px; font-weight: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.keypad button:active { background: var(--label-3); color: #fff; }
.keypad button.ghost { background: transparent; font-size: 16px; color: var(--link); }
.keypad button.ghost:active { background: transparent; opacity: 0.6; color: var(--link); }
.keypad button svg { width: 14px; height: 24px; }

/* Tabelle */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-size: 13px; font-weight: 600; color: var(--label-2); text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--sep); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table td { padding: 10px; border-bottom: 1px solid var(--sep-soft); text-align: right; white-space: nowrap; }
.table td:first-child { white-space: normal; }
.table tr.total td { font-weight: 700; border-bottom: 0; background: var(--fill); }
.table tr.total td:first-child { border-radius: 10px 0 0 10px; }
.table tr.total td:last-child { border-radius: 0 10px 10px 0; }
.table-wrap { overflow-x: auto; }
.sm-only { display: none; }
.rank-cell { display: flex; gap: 10px; align-items: baseline; }
.rank-n { width: 20px; flex: none; }
.rank-name { min-width: 0; overflow-wrap: break-word; word-break: normal; }
a.rank-name { display: block; color: inherit; padding: 6px 0; margin: -6px 0; }
.rank-name .sm-only { margin-top: 1px; }
.best-table { table-layout: fixed; }
.best-table th, .best-table td { text-align: left !important; white-space: normal !important; vertical-align: top; }
.best-table th:first-child, .best-table td:first-child { width: 28%; }
.best-table .bm-name { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.best-table .bm-val { display: block; font-size: 13px; margin-top: 2px; }
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .sm-only { display: block; }
  span.sm-only { display: inline; }
  .rank-name .sm-only { display: block; }
  .rank-table td, .rank-table th { padding: 9px 6px; }
  .rank-table td:first-child { white-space: normal; }
  .year-table[data-metric="c"] .m-q, .year-table[data-metric="q"] .m-c { display: none; }
  .year-table td, .year-table th { padding: 9px 6px; }
}
@media (max-width: 760px) { .best-table { font-size: 14px; } .best-table td, .best-table th { padding: 9px 6px; } }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-h { font-size: 12px; font-weight: 600; color: var(--label-2); text-align: center; padding-bottom: 2px; }
.cal-d {
  min-height: 64px; border-radius: 12px; border: 0; background: var(--fill); padding: 6px 6px 8px; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: space-between; text-align: left; color: var(--label);
}
.cal-d.out { visibility: hidden; }
.cal-d .cd-n { font-size: 15px; font-weight: 600; }
.cal-d .cd-v { font-size: 12px; font-weight: 600; color: var(--label-2); }
.cal-d.has { background: color-mix(in srgb, #0A70F5 12%, var(--bg-elev)); }
.cal-d.today .cd-n { color: #fff; background: var(--red-fill); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; margin: -2px; }
.cal-d[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); }
.cal-d[aria-pressed='true'] .cd-v { color: color-mix(in srgb, var(--on-ink) 75%, transparent); }

.ring-wrap { display: flex; align-items: center; gap: 20px; }
.legend-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }

.banner { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border-radius: 18px; padding: 12px 14px; color: var(--label); min-height: 44px; border: 0; width: 100%; text-align: left; }

/* ---------- Schede di Analisi riordinabili ---------- */

.widgets { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.w { position: relative; min-width: 0; display: flex; flex-direction: column; }
.w-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.w-body > .card { flex: 1; }
.w-tools { display: flex; align-items: center; gap: 6px; padding: 0 2px 8px; }
.w-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-btn { width: 38px; height: 38px; border-radius: 19px; border: 0; background: var(--fill); color: var(--label); display: grid; place-items: center; flex: none; }
.w-btn svg { width: 18px; height: 18px; }
.w-btn:disabled { opacity: .35; }
.w-handle { touch-action: none; cursor: grab; background: var(--link); color: #fff; }
.editing .w { padding: 0; border-radius: calc(var(--radius-card) + 6px); outline: 2px dashed color-mix(in srgb, var(--link) 45%, transparent); outline-offset: 5px; }
.editing .w-body { animation: wiggle .32s ease-in-out infinite alternate; }
.editing .w:nth-child(even) .w-body { animation-delay: -.16s; }
.editing .w-body { pointer-events: none; user-select: none; -webkit-user-select: none; }
.editing .w.dragging .w-body { animation: none; }
.editing .w.dragging { z-index: 5; background: var(--bg); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); outline-style: solid; transition: none; }
.edit-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--bg-elev); border-radius: 16px; padding: 10px 12px; box-shadow: 0 6px 22px rgba(0, 0, 0, .16); font-size: 15px; }
.edit-bar .grow { min-width: 160px; }
.eb-grip { display: inline-flex; width: 18px; height: 18px; vertical-align: -3px; color: var(--link); }
.eb-grip svg { width: 18px; height: 18px; }
.layout-btn { align-self: center; gap: 8px; color: var(--label-2); }
.layout-btn svg { width: 18px; height: 18px; }
@keyframes wiggle { from { transform: rotate(-.35deg); } to { transform: rotate(.35deg); } }
@media (prefers-reduced-motion: reduce) { .editing .w-body { animation: none; } }
@media (min-width: 1181px) {
  .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; }
  .w-full { grid-column: 1 / -1; }
}

/* ---------- Schede: ritmo, giro negozi, crescita, calendario ---------- */

.pace-bar { position: relative; height: 12px; border-radius: 6px; background: var(--fill); overflow: visible; }
.pace-bar .pb-proj, .pace-bar .pb-cur { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.pace-bar .pb-proj { background: color-mix(in srgb, var(--link) 30%, transparent); }
.pace-bar .pb-cur { background: var(--link); }
.pace-bar .pb-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--label); }
.pace-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--label-2); }
.pace-legend strong { color: var(--label); }
.pace-legend .dot, .cov-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 5px; margin-right: 6px; }
.pace-legend .tick { display: inline-block; width: 3px; height: 12px; border-radius: 2px; background: var(--label); margin-right: 6px; vertical-align: -1px; }
.cov { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cov-legend { display: grid; gap: 2px; font-size: 15px; color: var(--label-2); }
.cov-legend button { display: flex; align-items: center; min-height: 36px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.cov-legend button svg { width: 7px; height: 12px; margin-left: 8px; color: var(--label-3); }
.cov-all { border: 0; background: none; color: var(--link); font: inherit; font-size: 15px; min-height: 36px; padding: 0; cursor: pointer; }
.cov-legend strong { color: var(--label); margin-left: 4px; }
.todo-row, .mv-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--sep); color: var(--label); min-height: 44px; }
.todo-row:last-child, .mv-row:last-child { border-bottom: 0; }
.todo-days { font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 10px; background: var(--fill); color: var(--label-2); white-space: nowrap; }
.todo-days.late { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.mv-ic { width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.mv-ic svg { width: 15px; height: 15px; }
.mv-ic.up { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.mv-ic.down { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.mv-row .row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-row .right { text-align: right; }
.cal-w, .cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-w span { text-align: center; font-size: 12px; font-weight: 600; color: var(--label-3); }
.cal-c { aspect-ratio: 1; max-height: 52px; border-radius: 9px; background: var(--fill); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.cal-c.empty { background: none; }
.cal-c.future { opacity: .45; }
.cal-c.today { outline: 2px solid var(--label); outline-offset: -2px; }
.cal-scale { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--label-3); }
.cal-scale i { width: 11px; height: 11px; border-radius: 3px; background: var(--link); display: inline-block; }
.cal-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--label-2); }
.cal-foot strong { color: var(--label); }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .g-main, .g-detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1060px) {
  .nav { width: 76px; padding-left: 10px; padding-right: 10px; align-items: center; }
  .nav .brand > div:last-child, .nav .nav-label, .nav .nav-section, .nav .badge, .nav-foot .nf-text { display: none; }
  .nav .brand { padding: 2px 0 14px; }
  .nav-item { justify-content: center; padding: 0; width: 52px; }
  .nav-foot { justify-content: center; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .picker { width: 270px; }
  .entry { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 760px) {
  .only-mobile { display: inline-flex !important; }
  .nav { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg-elev) 97%, transparent);
    border-top: 1px solid var(--sep); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--label-3); min-height: 44px; }
  .tabbar button svg { width: 24px; height: 24px; }
  .tabbar button { --tab: var(--link); }
  .tabbar .tab-chart { --tab: #007AFF; }
  .tabbar .tab-plus { --tab: #28A745; }
  .tabbar .tab-store { --tab: #F08C00; }
  .tabbar .tab-more { --tab: #AF52DE; }
  .tabbar .tab-wallet { --tab: #E5332A; }
  .x-actions .btn-primary { flex: 1; justify-content: center; }
  .tabbar button svg { color: var(--tab); opacity: .9; }
  .tabbar button[aria-current='page'] { color: var(--tab); font-weight: 700; }
  .tabbar button[aria-current='page'] svg { opacity: 1; }
  .page { padding: calc(14px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 30px; }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .period { padding: 14px; }
  .big { font-size: 24px; }
  .split-view { flex-direction: column; }
  .split-view.show-entry .picker { display: none; }
  .split-view:not(.show-entry) .entry { display: none; }
  .picker { width: 100%; border-right: 0; padding-bottom: 96px; flex: 1 1 auto; min-height: 0; }
  .entry { padding: calc(14px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom)); }
  .qty-row { padding: 10px 12px; min-height: 68px; }
  .qty-row label { font-size: 16px; }
  .stepper button { width: 44px; }
  .stepper input { width: 58px; font-size: 20px; }
  .sheet { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .scrim { align-items: flex-end; padding: 12px; }
  .ring-wrap { flex-direction: column; align-items: flex-start; }
  .pnav .pnav-label { min-width: 120px; }
  .g3.counts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .g3.counts .card { padding: 12px; }
  .g3.counts .huge { font-size: 26px; }
  .g3.counts .small { display: none; }
  .cal { gap: 4px; }
  .cal-d { min-height: 46px; padding: 5px; }
  .cal-d .cd-v { display: none; }
  .cal-d.has::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #0A70F5; }
  .cal-d[aria-pressed='true'].has::after { background: currentColor; }
  .entry-head { row-gap: 10px !important; }
  .entry-head .grow { flex: 1 1 0; }
  .entry-head > .row-flex:last-child { width: 100%; }
  .entry-head .date-btn { flex: 1; justify-content: center; }
  .seg button { min-height: 40px; }
  .search { height: 44px; }
  .entry-head .muted a { display: inline-flex; align-items: center; min-height: 40px; }
  .card-h a, .card-h .btn-plain, .list-head .btn-plain { min-height: 40px; display: inline-flex; align-items: center; }
  .entry-head h2 { font-size: 24px !important; }
  .list-row:has(.input) { flex-wrap: wrap; }
  .list-row .input:not([type=number]):not(.input-inline) { width: 100% !important; }
  .list-row:has(.input[type=number]), .list-row:has(.input-inline) { flex-wrap: nowrap; }
  .page-head .actions { width: 100%; }
  .card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

@media print {
  .nav, .tabbar { display: none; }
}

@media (prefers-color-scheme: dark) {
  .tabbar .tab-chart { --tab: #0A84FF; }
  .tabbar .tab-plus { --tab: #30D158; }
  .tabbar .tab-store { --tab: #FF9F0A; }
  .tabbar .tab-more { --tab: #BF5AF2; }
  .tabbar .tab-wallet { --tab: #FF453A; }
}

/* ---------- Uscite ---------- */
.x-amount { font-size: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0 4px; }
.x-amount .x-eur { font-size: 34px; font-weight: 700; color: var(--label-3); }
.x-amount input, .sheet .x-amount input { width: 100%; height: auto; box-shadow: none; max-width: 260px; border: 0; background: none; font: inherit; font-size: 1em; font-weight: 700; letter-spacing: -0.02em; color: var(--label); text-align: left; padding: 0; outline: none; font-variant-numeric: tabular-nums; }
.x-amount input::placeholder { color: var(--label-3); }
.x-amount:focus-within { box-shadow: 0 2px 0 var(--link); }
.chip-add { display: inline-flex; align-items: center; gap: 4px; color: var(--link); }
.chip-add svg { width: 14px; height: 14px; }
.x-badge { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.x-stats { display: flex; flex-direction: column; background: var(--bg); border-radius: 14px; padding: 2px 14px; }
.x-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sep); min-width: 0; }
.x-stats > div:last-child { border-bottom: 0; }
.x-stats span { font-size: 15px; color: var(--label-2); font-weight: 500; }
.x-stats strong { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.x-stats .x-profit span { color: var(--label); font-weight: 700; }
.x-stats .x-profit strong { color: var(--green); font-size: 19px; }
.x-stats .x-profit.neg strong { color: var(--red); }
.x-day { display: flex; justify-content: space-between; padding: 14px 2px 4px; font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .03em; }
.x-day:first-child { padding-top: 8px; }
.x-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: inherit; text-align: left; padding: 10px 2px; min-height: 56px; border-bottom: 1px solid var(--sep); font: inherit; cursor: pointer; }
.x-row:last-child, .x-row:has(+ .x-day) { border-bottom: 0; }
.x-row .grow { min-width: 0; }
.x-row .row-title, .x-row .row-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.x-cat .mix-row { margin-bottom: 6px; align-items: baseline; }
.x-cat .catlabel { min-width: 0; }
.x-cat .x-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-cat .mix-row > span:last-child { white-space: nowrap; }
.profit-link { display: inline-flex; align-items: center; min-height: 40px; }
.profit-big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.profit-eq { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.profit-eq > div { min-width: 0; }
.profit-eq .op { color: var(--label-3); font-weight: 700; font-size: 18px; }

/* ---------- Contatori cliccabili ed elenchi di negozi ---------- */
.count-card { border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; display: block; width: 100%; }
.count-card:active, .kpi-btn:active { transform: scale(.98); }
.kpi-btn { border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.rl-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 56px; color: inherit; border-bottom: 1px solid var(--sep); }
.rl-row:last-child { border-bottom: 0; }
.rl-row .grow { min-width: 0; }
.rl-row .row-title, .rl-row .row-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-row .chev { display: flex; width: 8px; color: var(--label-3); flex: none; }
.rl-badge { flex: none; font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-badge.red { background: var(--red-bg); color: var(--red); }
.rl-badge.green { background: var(--green-bg); color: var(--green); }
.mix-tap { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-align: left; }
.legend-inline:has(.mix-tap) { row-gap: 0; margin-top: 0 !important; }
.mix-row:has(.mix-tap) { align-items: center; }
.catlabel.mix-tap svg { width: 7px; height: 12px; color: var(--label-3); margin-left: 2px; }
.legend-inline .mix-tap { gap: 0; }
.legend-inline .mix-tap .catdot { margin-right: 6px; }
.legend-inline .mix-tap strong { margin-left: 5px; }
button.cal-c { border: 0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; width: 100%; }
button.cal-c:active { transform: scale(.92); }
.chart-pair.tap { cursor: pointer; border-radius: 6px; }
.chart-pair.tap:active { background: var(--fill); }
.rank-tap { border: 0; background: none; font: inherit; color: inherit; width: 100%; text-align: left; cursor: pointer; padding-left: 0; padding-right: 0; }
button.x-cat { border: 0; background: none; padding: 4px 0; min-height: 44px; font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; display: block; }
.x-cat.dim { opacity: .38; }
.x-cat.on .x-name { text-decoration: underline; text-underline-offset: 3px; }
/* Uscite fisse da completare (senza importo). */
.todo { color: var(--warn); font-weight: 600; }
.x-todo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px; background: var(--warn-bg); font-size: 15px; line-height: 1.4; }
.x-todo strong { color: var(--warn); }
.x-filter { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 2px 4px; font-size: 15px; }

/* Righe degli elenchi: freccia in CSS e disegno isolato per riga (meno lavoro mentre si scorre). */
.chev-css { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--label-3); border-top: 2px solid var(--label-3); transform: rotate(45deg); margin: 0 4px 0 2px; border-radius: 1px; }
.list-row, .rl-row { contain: layout paint style; }
/* Classifiche: su iPad in verticale una sotto l'altra, così i nomi hanno spazio. */
@media (max-width: 1180px) { .rank-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Ropa De Gorila: schermate nuove ---------- */
.kpis .kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpis .kpi .big { font-size: 28px; }
.kpi .p-sub { font-size: 14px; color: var(--label-2); line-height: 1.35; }
.kpi .p-sub a { color: var(--link); text-decoration: none; }
.neg { color: var(--red); }
.cmp-lines { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--label-2); }
.cmp-lines > span { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.split-cash { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--fill); }
.split-cash span { display: block; height: 100%; }
.tbl { display: flex; flex-direction: column; overflow-x: auto; }
.tbl .tr { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(84px, 1fr); grid-template-columns: minmax(150px, 1.6fr); gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--sep-soft); font-size: 15px; text-align: right; background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; width: 100%; font: inherit; }
.tbl .tr > span:first-child { text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .tr.th { font-size: 13px; color: var(--label-2); font-weight: 600; }
.tbl button.tr { cursor: pointer; }
.tbl button.tr:active { background: var(--fill); }
.tbl .tr:last-child { border-bottom: 0; }
.rank-row { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.rank-row .mix-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bday-list { display: flex; flex-wrap: wrap; gap: 8px; }
.bday-list a { text-decoration: none; color: inherit; background: var(--fill); border-radius: 99px; padding: 6px 12px; font-size: 14px; }
.bday-list a.today { background: #FFF4E5; color: #8A3D00; font-weight: 600; }
.closing-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.closing-row .field { min-width: 200px; }
.warn-text { color: #B25000; font-weight: 600; margin: 0; font-size: 14px; line-height: 1.4; }
.sale-row .s-time { width: 48px; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--label-2); font-size: 14px; }
.sale-row .row-sub .tag { margin-left: 4px; font-size: 12px; padding: 1px 8px; }
.x-row.dim { opacity: .5; text-decoration: line-through; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.staff-btn { border: 0; border-radius: 16px; color: #fff; text-align: left; padding: 14px; min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; cursor: pointer; font: inherit; }
.staff-btn b { font-size: 19px; }
.staff-btn span { font-size: 13px; opacity: .85; }
.staff-btn.off { opacity: .45; }
.color-chip[aria-pressed='true'] { outline: 2px solid var(--ink); }
.pair-code { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; background: var(--bg); border-radius: 16px; padding: 18px; margin-top: 8px; }
.pair-code > b { font-size: 36px; letter-spacing: .12em; font-family: ui-monospace, Menlo, monospace; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--bg-elev); border-radius: 18px; padding: 16px; border: 1px solid var(--sep); }
.qr-card a { font-size: 12px; overflow-wrap: anywhere; color: var(--link); }
.qr-img { width: 180px; background: #fff; padding: 6px; border-radius: 12px; }
.qr-img svg { display: block; width: 100%; height: auto; }
.prods { display: flex; flex-direction: column; gap: 8px; }
.prod-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.search-input { min-height: 48px; font-size: 17px; }
@media (max-width: 760px) {
  .kpis .kpi .big { font-size: 22px; }
  .prod-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .prod-row input:first-child { grid-column: 1 / -1; }
}
@media print {
  body * { visibility: hidden; }
  .scrim .sheet-body, .scrim .sheet-body * { visibility: visible; }
  .scrim .sheet-body { position: absolute; left: 0; top: 0; width: 100%; }
  .qr-card { break-inside: avoid; border: 1px solid #ccc; }
}
/* Tabelle larghe e intestazioni con più pulsanti: mai più larghe dello schermo */
.card, .stack > * { min-width: 0; }
.tbl { max-width: 100%; }
.card-h { flex-wrap: wrap; gap: 8px; }
/* Grafici con molte colonne (es. 31 giorni): le etichette non allargano la pagina */
.chart-x > div:first-child { min-width: 0; }
.chart-x span { min-width: 0; overflow: visible; }
.chart-bars { min-width: 0; gap: 2px; }

/* Sicurezza: un'icona messa direttamente in una riga non può mai diventare enorme. */
.list-row > svg { width: 9px; height: 14px; flex-shrink: 0; color: var(--label-3); }
.pair-code .muted b { overflow-wrap: anywhere; }

/* Contorno chiaro leggero su tasti e pallini dei commessi: senza, un colore scuro (es. Gorilla, nero)
   sparisce sullo sfondo scuro. */
.staff-btn { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.color-chip .catdot { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
@media (prefers-color-scheme: dark) {
  .catdot { box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); }
}

/* Spia nella Home: tablet con vendite ferme, backup non riuscito... */
.health h2 { display: flex; align-items: center; gap: 8px; }
.health h2 svg { width: 20px; height: 20px; }
.health.bad { background: color-mix(in srgb, #FF3B30 10%, var(--bg-elev)); }
.health.bad h2 svg { color: #FF3B30; }
.health.warn { background: color-mix(in srgb, #FF9500 12%, var(--bg-elev)); }
.health.warn h2 svg { color: #FF9500; }
.health ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.4; }
.health li.bad { font-weight: 600; }
.dev-issue { color: #D70015; font-weight: 600; }
.dev-issue.warn { color: #B25000; }

/* ---------- Panoramica e grafici interattivi ---------- */
:root { --fill-3: #D1D1D6; --sel: rgba(10, 132, 255, .12); }
@media (prefers-color-scheme: dark) { :root { --fill-3: #48484A; --sel: rgba(10, 132, 255, .22); } }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; gap: 4px; }

/* Schede in alto: oggi, settimana, mese, anno, da sempre (scegliendone una cambia il periodo) */
.pulse { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pulse-t { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; text-align: left; border: 0; border-radius: 18px; padding: 14px 14px 10px; background: var(--bg-elev); color: var(--label); cursor: pointer; transition: transform .12s ease, background .15s ease; }
.pulse-t:active { transform: scale(.98); }
.pulse-t[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); }
.pulse-l { font-size: 13px; font-weight: 600; color: var(--label-2); }
.pulse-t[aria-pressed='true'] .pulse-l, .pulse-t[aria-pressed='true'] .pulse-s { color: inherit; opacity: .8; }
.pulse-v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.pulse-s { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: hidden; max-width: 100%; }
.pulse-s .pill { font-size: 12px; padding: 2px 6px; }
.pulse-t[aria-pressed='true'] .pill.up { color: #0B5D25; background: #B9F0C8; }
.pulse-t[aria-pressed='true'] .pill.down { color: #9A1A14; background: #FFD0CD; }
.pulse-t[aria-pressed='true'] .pill.flat { color: inherit; background: rgba(127, 127, 127, .3); }
.spark { display: block; width: 100%; margin-top: 4px; }
.spark-none { border-bottom: 1px dashed var(--sep); margin-bottom: 2px; }
@media (max-width: 1060px) { .pulse { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .pulse { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; gap: 10px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .pulse::-webkit-scrollbar { display: none; }
  .pulse-t { flex: 0 0 44%; scroll-snap-align: start; padding: 12px 12px 8px; }
  .pulse-v { font-size: 19px; }
}

/* Frase di sintesi colorata */
.verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--fill); }
.verdict strong { display: block; font-size: 18px; letter-spacing: -.01em; line-height: 1.25; }
.verdict div > span { display: block; font-size: 14px; color: var(--label-2); margin-top: 2px; line-height: 1.35; }
.verdict-ic { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #fff; background: var(--label-3); }
.verdict.up { background: var(--green-bg); } .verdict.up .verdict-ic { background: #34C759; }
.verdict.down { background: var(--red-bg); } .verdict.down .verdict-ic { background: #FF3B30; }
.verdict.info .verdict-ic { background: var(--ink); color: var(--on-ink); }

/* Barre di confronto tra periodi */
.cmpb { display: grid; gap: 7px; }
.cmpb-row { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; color: var(--label-2); }
.cmpb-row.strong { color: var(--label); font-weight: 600; }
.cmpb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmpb-bar { height: 12px; border-radius: 6px; background: var(--fill); overflow: hidden; }
.cmpb-bar span { display: block; height: 100%; border-radius: 6px; }
.cmpb-v { text-align: right; min-width: 78px; font-variant-numeric: tabular-nums; }
.mini-h { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--label-2); }

/* Colonne interattive */
.ch { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ch-empty { align-items: center; text-align: center; padding: 34px 12px; color: var(--label-2); gap: 4px; }
.ch-empty strong { color: var(--label); }
.ch-read { min-height: 64px; }
.ch-r { display: flex; flex-direction: column; gap: 6px; }
.ch-r[hidden] { display: none; }
.ch-r-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ch-r-title { font-size: 14px; font-weight: 600; color: var(--label-2); }
.ch-r-val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.ch-r-val small { font-size: 13px; font-weight: 500; color: var(--label-2); }
.ch-r-parts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--label-2); }
.ch-r-parts i, .ch-legend i, .rk-name i, .pay-l i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.ch-r-parts b { color: var(--label); font-weight: 600; }
.ch-r-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; min-height: 34px; }
.ch-r-cmp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-hint { color: var(--label-3); }
.ch-go { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.ch-plot { position: relative; }
.ch-grid { position: absolute; inset: 0; pointer-events: none; }
.ch-grid span { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--sep); }
.ch-grid span:last-child { border-top: 1px solid var(--sep); }
.ch-grid em { position: absolute; right: 0; top: 2px; font-style: normal; font-size: 11px; color: var(--label-3); background: var(--bg-elev); padding: 0 0 0 4px; }
.ch-cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.ch-col { flex: 1 1 0; min-width: 0; height: 100%; padding: 0 2px; border: 0; background: transparent; display: flex; align-items: flex-end; cursor: pointer; border-radius: 6px; }
.ch-cols.dense .ch-col { padding: 0 1px; }
.ch-col:not(.off):hover, .ch-col[aria-pressed='true'] { background: var(--sel); }
.ch-col:focus-visible { outline: 2px solid #0A84FF; outline-offset: -2px; }
.ch-stack { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 1px 1px; overflow: hidden; transition: opacity .15s ease; }
.ch-stack span { display: block; min-height: 0; }
.ch-col.hl .ch-stack { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 3.5px var(--label-3); }
.has-sel .ch-col:not([aria-pressed='true']) .ch-stack { opacity: .45; }
.ch-cmp { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ch-cmp polyline { fill: none; stroke: var(--label-2); stroke-width: 1.6; stroke-dasharray: 4 4; stroke-linejoin: round; }
.ch-x { display: flex; }
.ch-x span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--label-2); white-space: nowrap; overflow: visible; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--label-2); }
.ch-legend i.dash { width: 16px; height: 0; border-top: 2px dashed var(--label-2); border-radius: 0; vertical-align: 3px; }

/* Classifiche (negozi, commessi, anni) */
.rk { display: flex; flex-direction: column; gap: 2px; }
.rk-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; margin: 0 -8px; border: 0; background: transparent; text-align: left; color: inherit; border-radius: 12px; width: calc(100% + 16px); }
.rk-row.tap { cursor: pointer; }
.rk-row.tap:hover { background: var(--fill); }
.rk-row.tap:active { transform: scale(.99); }
.rk-pos { flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--label-2); }
.rk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.rk-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rk-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-val { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rk-val b { font-size: 16px; }
.rk-bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.rk-bar span { display: block; height: 100%; border-radius: 4px; }
.rk-sub { font-size: 13px; color: var(--label-2); line-height: 1.35; }
.rk-chev { font-size: 22px; color: var(--label-3); line-height: 1; }
.share-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.share-bar span { display: block; min-width: 0; }

/* Mappa di calore giorni × ore */
.hm { display: grid; gap: 3px; align-items: center; }
.hm-d, .hm-h { font-size: 11px; color: var(--label-2); text-align: center; }
.hm-d { text-align: left; }
.hm-c { height: clamp(18px, 4.2vw, 26px); border: 0; padding: 0; border-radius: 5px; cursor: pointer; background: color-mix(in srgb, #0A84FF var(--a), var(--fill)); }
.hm-c[aria-pressed='true'] { outline: 2px solid var(--ink); outline-offset: 1px; }
.hm-c:hover { outline: 2px solid var(--label-3); outline-offset: 1px; }

/* Pagamenti */
.pay { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pay-l { flex: 1; min-width: 220px; display: grid; gap: 10px; }
.pay-l > div > span:first-child { white-space: nowrap; }
.pay-l > div { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; font-size: 15px; }
.pay-l .muted { text-align: right; font-size: 13px; }

/* Numeri chiave cliccabili */
.kpi-link { text-decoration: none; color: inherit; transition: transform .12s ease; }
.kpi-link:hover { background: color-mix(in srgb, var(--ink) 4%, var(--bg-elev)); }
.kpi-link:active { transform: scale(.98); }
.kpi-link .p-sub b { color: var(--label); }

/* Record di sempre */
.records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.records > * { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 16px; border: 0; background: var(--fill); color: inherit; text-decoration: none; cursor: pointer; font: inherit; }
.records span { font-size: 12px; font-weight: 600; color: var(--label-2); }
.records b { font-size: 18px; }
.records em { font-style: normal; font-size: 13px; color: var(--label-2); }
@media (max-width: 560px) { .records { grid-template-columns: minmax(0, 1fr); } }

/* Pagina del commesso */
.person-dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
@media (prefers-color-scheme: dark) { .person-dot[style*='var(--ink)'] { color: #000; } }
.seg-sm button { min-height: 30px; padding: 0 10px; font-size: 13px; }
@media (max-width: 760px) {
  .cmpb-row { grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; font-size: 13px; }
  .cmpb-v { min-width: 64px; }
  .ch-r-val { font-size: 20px; }
  .verdict strong { font-size: 16px; }
  .card-h .seg-sm { width: 100%; }
}
.verdict-ic svg { width: 17px; height: 17px; }

.kpi .p-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.ch-col.off { cursor: default; }

/* ---------- Ritocchi di impaginazione (telefono, tablet, computer) ---------- */
/* Schede in alto: cinque in fila anche sui tablet; la cifra si adatta alla larghezza */
@media (min-width: 761px) and (max-width: 1060px) {
  .pulse { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .pulse-t { padding: 12px 10px 8px; border-radius: 16px; }
  .pulse-v { font-size: clamp(15px, 1.75vw, 20px); }
  .pulse-s span:not(.pill) { display: none; }
}
/* Classifiche: numero e nome sulla stessa riga, freccia al centro */
.rk-row { align-items: flex-start; }
.rk-pos { margin-top: 1px; }
.rk-chev { align-self: center; }
/* Tasti piccoli comunque comodi col dito */
.seg-sm button { min-height: 36px; }
@media (pointer: coarse) { .seg-sm button { min-height: 40px; } }
.x-stats a { display: inline-flex; align-items: center; min-height: 36px; }
/* Chiusura: contati, nota e tasto sulla stessa riga al computer, uno sotto l'altro al telefono */
.closing-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.closing-row .field { min-width: 0; }
@media (max-width: 760px) {
  .closing-row { grid-template-columns: minmax(0, 1fr); }
  /* Filtri (negozi, consensi): una sola riga che scorre di lato invece di andare a capo */
  .page-inner > .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; scroll-padding-inline: 16px; }
  .page-inner > .chips::-webkit-scrollbar { display: none; }
  .page-inner > .chips .chip { flex-shrink: 0; }
}
/* Tabelle al telefono: colonne più strette; il riepilogo del mese mostra giorno, contanti, carta e totale
   (per un negozio solo si usa il filtro in alto) */
@media (max-width: 600px) {
  .tbl .tr { grid-template-columns: minmax(84px, 1.3fr); grid-auto-columns: minmax(58px, 1fr); gap: 6px; font-size: 14px; padding: 10px 2px; }
  .tbl .tr.th { font-size: 12px; }
  .tbl .c-shop { display: none; }
}
/* Elenchi di cifre (label a sinistra, cifra a destra): su schermi larghi vanno su più colonne invece di
   una riga lunghissima con la cifra lontana dal suo nome. Al telefono restano una colonna. */
.x-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 32px; }
.list-row > a[href^='tel:'] { display: inline-flex; align-items: center; min-height: 40px; padding: 0 2px; }
