/* Agenda salone: stile della base. Il colore principale (--brand) arriva da salone.json. */
@font-face { font-family: 'Bricolage Grotesque'; src: url(fonts/bricolage-grotesque.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(fonts/figtree.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }
:root {
  --brand: #1F2E4A;
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --ink: #1C2424;
  --ink-2: #5A6563;
  --ink-3: #8A9492;
  --line: #DCE1DD;
  --line-2: #ECEFEC;
  --off: #EEF0ED;
  --ok: #2F7A55;
  --warn: #9A5A1C;
  --bad: #B03A33;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, white);
  --brand-mid: color-mix(in srgb, var(--brand) 22%, white);
  --r-s: 8px; --r-m: 12px; --r-l: 18px;
  --ff-d: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --ff: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side: 236px;
  --shadow: 0 1px 2px rgba(28, 36, 36, .06), 0 8px 24px -12px rgba(28, 36, 36, .18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--ff); font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--ff-d); margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ink-2); }
.r { text-align: right; justify-content: flex-end; }
.sp { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.loading { display: grid; place-items: center; min-height: 100vh; color: var(--ink-2); }
.warn { color: var(--warn); font-size: 13.5px; font-weight: 500; }
.warn-t { color: var(--warn); }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.link { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }

/* ---------- pulsanti e campi ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 15px; border-radius: 999px; font-weight: 600; font-size: 14.5px; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s; text-decoration: none; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.wide { width: 100%; justify-content: center; min-height: 46px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 86%, black); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover, .btn.ghost.on { border-color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger-t { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.btn .count { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 12px; margin-left: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn:disabled { opacity: .3; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.f-l { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.f-h { font-size: 12.5px; color: var(--ink-3); }
input, select { height: 42px; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px !important; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6563' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-mid); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--ink-2); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); margin: 0; }
input[type=file] { padding: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.consents { border: 1px solid var(--line); border-radius: var(--r-m); padding: 6px 14px 8px; margin: 0 0 12px; }
.consents legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--ink-3); }
.search input { border: 0; padding-left: 0; background: transparent; box-shadow: none !important; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-mid); }
.grow { flex: 1; min-width: 220px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg.wide { display: flex; margin-bottom: 16px; } .seg.wide button { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip small { color: inherit; opacity: .7; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-style: normal; }
.tag.ok { background: color-mix(in srgb, var(--ok) 14%, white); color: var(--ok); }
.tag .ic { width: 14px; height: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.big { width: 14px; height: 14px; }

/* ---------- struttura ---------- */
#app { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { display: block; font-family: var(--ff-d); font-size: 16px; line-height: 1.2; }
.brand div span { font-size: 12.5px; color: var(--ink-2); }
.mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; font: 700 19px var(--ff-d); flex: none; }
.mark.big { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; margin-bottom: 14px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-items a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; color: var(--ink-2); }
.nav-items a:hover { background: var(--bg); color: var(--ink); }
.nav-items a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-items .badge { margin-left: auto; background: var(--brand); color: #fff; font-size: 12px; border-radius: 999px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 8px; font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; }
.made { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.made img { width: 18px; height: 18px; border-radius: 5px; }
.made em { font-style: normal; }
.auth-card .made { justify-content: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); }
#syncst { display: flex; align-items: center; gap: 7px; }
#syncst i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
#syncst em { font-style: normal; display: none; }
#syncst[data-st=ok] .s-ok, #syncst[data-st=wait] .s-wait, #syncst[data-st=off] .s-off { display: inline; }
#syncst[data-st=wait] i { background: var(--warn); }
#syncst[data-st=off] i { background: var(--bad); }
.main { margin-left: var(--side); min-height: 100vh; }
.page { padding: 22px 24px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--ink-2); margin-top: 7px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select { width: auto; border-radius: 999px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 10px 14px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--brand); }
.page-tabs { margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 34px; }
.card-h h3 { font-size: 18px; }
.ds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: stretch; }
.sec { font-family: var(--ff); font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 0 8px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; } .sec-row .sec { margin-bottom: 8px; }
.empty { text-align: center; padding: 56px 20px; max-width: 440px; margin: 0 auto; }
.empty h3 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin-bottom: 18px; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.li.off { opacity: .55; }
.li-t { flex: 1; min-width: 180px; } .li-t b { display: block; } .li-t span { font-size: 13px; color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.plain { padding-left: 18px; margin: 12px 0 18px; } .plain li { margin-bottom: 8px; }
.roles { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line-2); }
.roles dt { font-weight: 600; } .roles dd { margin: 0; color: var(--ink-2); }

/* tabelle */
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.tr { display: grid; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line-2); width: 100%; text-align: left; }
.tr > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tr.th { border-top: 0; background: var(--bg); font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding-top: 9px; padding-bottom: 9px; }
button.tr:hover { background: var(--brand-soft); }
.tr.low { background: color-mix(in srgb, var(--warn) 7%, white); }
.tr.off { opacity: .5; }
.cli-table .tr { grid-template-columns: 2fr 1.3fr 1fr 1.4fr; }
.stock-table .tr { grid-template-columns: 2.4fr 1.1fr .9fr .8fr .8fr .8fr .8fr; }
.moves-table .tr { grid-template-columns: .9fr 1.6fr 2fr .7fr 1fr 1fr; }
.orders-table .tr { grid-template-columns: 1fr 2fr .8fr 1.4fr 1fr; }
.svc-table .tr { grid-template-columns: 2.4fr .9fr .8fr .8fr 1fr 1fr; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.more { margin: 14px auto 0; display: flex; }
.tag.st-bozza { background: color-mix(in srgb, var(--warn) 14%, white); color: var(--warn); }
.tag.st-inviato { background: var(--brand-soft); color: var(--brand); }

/* ---------- planning ---------- */
.planning { padding: 22px 24px 20px; display: flex; flex-direction: column; height: 100vh; height: 100svh; }
.v-settimana, .v-mese { height: auto; min-height: 100vh; }
.pl-head { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 16px; }
.pl-title h1, .page-head h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1; font-weight: 700; letter-spacing: -.025em; font-variation-settings: 'opsz' 96; }
.pl-title p { color: var(--ink-2); margin-top: 7px; }
.pl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-tools .btn.primary { margin-left: auto; }
.page-sub { color: var(--ink-2); margin: -8px 0 14px; max-width: 70ch; }
.nav-arrows { display: flex; align-items: center; gap: 2px; }
.dpop { position: fixed; z-index: 70; width: 292px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 18px 40px -16px rgba(20, 28, 28, .35); }
.dp-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-h b { font: 600 17px var(--ff-d); text-transform: capitalize; }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow span { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 4px 0; }
.dp-grid button { height: 36px; border-radius: 10px; font-weight: 500; }
.dp-grid button:hover { background: var(--brand-soft); }
.dp-grid button.now { box-shadow: 0 0 0 1.5px var(--brand) inset; color: var(--brand); font-weight: 700; }
.dp-grid button.sel { background: var(--brand); color: #fff; box-shadow: none; }
.dp-f { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.dp-f .btn { flex: 1; justify-content: center; }
.clip-bar { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 10px 12px 10px 16px; border-radius: var(--r-m); margin-bottom: 12px; }
.clip-bar span { flex: 1; } .clip-bar .btn { color: var(--ink); }

.day-wrap { display: flex; gap: 16px; flex: 1; min-height: 0; }
.grid-wrap { flex: 1; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); position: relative; min-height: 0; }
.grid { display: grid; grid-template-columns: 58px repeat(var(--cols), minmax(150px, 1fr)); min-width: min-content; }
.g-colhead { position: sticky; top: 0; z-index: 4; height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.g-colhead b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-n { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.g-times { position: sticky; left: 0; z-index: 5; background: var(--surface); border-right: 1px solid var(--line-2); }
.g-times .g-colhead { z-index: 6; }
.g-tbody { position: relative; }
.g-time { position: absolute; right: 8px; transform: translateY(-50%); font-size: 12px; color: var(--ink-3); }
.g-time:first-child { transform: none; }
.g-col { border-left: 1px solid var(--line-2); min-width: 0; }
.g-col:nth-child(2) { border-left: 0; }
.g-body { position: relative; cursor: cell;
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line-2) 55%, transparent) 1px, transparent 1px);
  background-size: 100% calc(var(--px) * 4), 100% var(--px); background-position: 0 calc(var(--px) * 2), 0 0; }
.g-body.clipping { cursor: copy; background-color: color-mix(in srgb, var(--brand) 4%, white); }
.g-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(-45deg, var(--off) 0 5px, color-mix(in srgb, var(--off) 55%, white) 5px 10px); pointer-events: none; }
.g-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.g-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* il blocco: la parte piena è il lavoro dell'operatrice, la parte a righe è la posa */
.ap, .blk { position: absolute; z-index: 2; text-align: left; border-radius: 8px; padding: 4px 8px 4px 10px; overflow: hidden; display: flex; flex-direction: column; font-size: 13px; line-height: 1.25; }
.ap { --tint: color-mix(in srgb, var(--svc) 62%, white); --pale: color-mix(in srgb, var(--svc) 24%, white);
  background: linear-gradient(to bottom, var(--tint) var(--work), transparent var(--work)), repeating-linear-gradient(-45deg, var(--pale) 0 6px, color-mix(in srgb, var(--svc) 38%, white) 6px 12px);
  border-left: 3px solid color-mix(in srgb, var(--svc) 70%, black); color: var(--ink); }
.ap:hover, .blk:hover { box-shadow: 0 0 0 2px var(--ink) inset; z-index: 3; }
.ap b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-t { font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--ink) 75%, transparent); display: flex; align-items: center; gap: 3px; }
.ap-s { font-size: 12px; color: color-mix(in srgb, var(--ink) 72%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-ok { width: 13px; height: 13px; color: var(--ok); stroke-width: 2.4; }
.ap.short { flex-direction: row; gap: 6px; align-items: center; padding-top: 0; padding-bottom: 0; }
.ap.short .ap-s { display: none; }
.ap.st-arrivato { border-left-color: var(--ok); }
.ap.st-noshow { opacity: .5; } .ap.st-noshow b { text-decoration: line-through; }
.ap.from-app::after { content: 'App'; position: absolute; top: 4px; right: 5px; font-size: 10px; font-weight: 700; background: rgba(255, 255, 255, .8); border-radius: 4px; padding: 0 4px; }
.blk { background: var(--surface); border: 1px dashed var(--ink-3); color: var(--ink-2); }
.blk b { font-weight: 600; }
.blk-pausa { background: repeating-linear-gradient(-45deg, #f2f2ef 0 5px, #fafaf8 5px 10px); }
.blk-assenza { border-color: var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, white); }
.blk-nota { border-style: solid; border-color: #d8c37a; background: #fbf4dc; color: #6b5a1e; }

.day-closed { flex: 1; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }

.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; }
.w-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); min-height: 320px; display: flex; flex-direction: column; min-width: 0; }
.w-day.is-closed { background: transparent; border-style: dashed; }
.w-head { display: flex; align-items: baseline; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; }
.w-head span { color: var(--ink-2); font-size: 13px; } .w-head b { font: 600 22px var(--ff-d); } .w-head em { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.w-day.is-today .w-head b { color: var(--brand); }
.w-list { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.w-ap { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; text-align: left; padding: 5px 7px; border-radius: 7px; background: color-mix(in srgb, var(--svc) 30%, white); border-left: 3px solid var(--st); font-size: 12.5px; }
.w-ap:hover { box-shadow: 0 0 0 1.5px var(--ink) inset; }
.w-t { font-weight: 600; } .w-n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-s { grid-column: 2; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-ap.st-noshow { opacity: .5; }
.w-closed { color: var(--ink-3); font-size: 13px; padding: 8px 6px; }

.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px; }
.m-dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 4px 6px 8px; }
.m-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.m-cell { min-height: 92px; border-radius: 10px; background: var(--bg); padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.m-cell:hover { box-shadow: 0 0 0 1.5px var(--ink) inset; }
.m-cell.pad { background: transparent; pointer-events: none; }
.m-cell.is-closed { background: transparent; border: 1px dashed var(--line); }
.m-cell.is-today .m-n { background: var(--brand); color: #fff; border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; margin: -3px; }
.m-n { font: 600 15px var(--ff-d); }
.m-c { font: 600 20px var(--ff-d); margin-top: auto; }
.m-dots { display: flex; gap: 3px; flex-wrap: wrap; } .m-dots i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- finestre ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 28, .38); display: grid; place-items: start center; padding: 6vh 20px 20px; z-index: 50; overflow: auto; opacity: 0; transition: opacity .15s; }
.modal-back.in { opacity: 1; }
.modal { background: var(--surface); border-radius: 20px; width: min(520px, 100%); max-height: calc(100vh - 6vh - 20px); overflow: auto; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .35); display: flex; flex-direction: column; transform: translateY(8px); transition: transform .18s; }
.modal-back.in .modal { transform: none; }
.modal.wide { width: min(880px, 100%); }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 4px 24px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.m-head h2 { font-size: 22px; line-height: 1.2; }
.m-sub { color: var(--ink-2); margin-top: 3px; font-size: 14px; }
.m-sub a { color: var(--brand); font-weight: 600; }
.m-body { padding: 14px 24px 18px; }
.m-narrow { max-width: 520px; }
.modal > .tabs { padding: 0 20px; }
.m-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: var(--surface); }
.confirm-t { font-size: 16px; padding-top: 10px; }
.ap-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; }
.ap-grid .sec:first-child { margin-top: 0; }
.cli-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--brand-soft); border-radius: var(--r-m); padding: 10px 12px 10px 14px; }
.cli-pick b { display: block; } .cli-pick span { font-size: 13px; color: var(--ink-2); }
.cli-new { background: var(--bg); border-radius: var(--r-m); padding: 12px 12px 8px; }
.cli-res { display: flex; flex-direction: column; margin-top: 6px; max-height: 260px; overflow: auto; }
.cli-r { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; text-align: left; }
.cli-r:hover { background: var(--bg); }
.cli-r span { color: var(--ink-2); font-size: 13.5px; }
.cli-r.new { justify-content: flex-start; align-items: center; color: var(--brand); gap: 6px; }
.line { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 12px 4px; margin-bottom: 10px; }
.line-f { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.line-f .icon-btn { margin-bottom: 14px; }
.line-info { font-size: 12.5px; color: var(--ink-2); margin: -6px 0 8px; }
.line .warn { margin-bottom: 8px; }
.sugg .chips { margin-top: 6px; }
.sugg .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.det-svc { border-left: 4px solid var(--svc); background: color-mix(in srgb, var(--svc) 18%, white); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.det-svc b { display: block; font-size: 16px; } .det-svc span { font-size: 13.5px; color: var(--ink-2); }
.det { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.det > * { align-self: stretch; } .det .link, .det .row { align-self: flex-start; }
.det-st { font-weight: 600; font-size: 14px; }
.det-st.st-arrivato { color: var(--ok); } .det-st.st-noshow, .det-st.st-cancellato { color: var(--bad); }
.det-note { background: #fbf4dc; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.det-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpis div { background: var(--bg); border-radius: var(--r-m); padding: 12px 14px; }
.kpis b { display: block; font: 600 22px var(--ff-d); } .kpis span { font-size: 13px; color: var(--ink-2); }
.v-row { display: grid; grid-template-columns: 1.1fr 1.6fr 1fr .9fr; gap: 10px; width: 100%; text-align: left; padding: 9px 4px; border-top: 1px solid var(--line-2); font-size: 14px; }
.v-row.static { grid-template-columns: 1fr 2fr .6fr; }
button.v-row:hover { background: var(--bg); }
.hair-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.hair-log { display: grid; gap: 10px; }
.hl { border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 14px; }
.hl-h { display: flex; align-items: center; gap: 10px; } .hl-h span { color: var(--ink-2); font-size: 13px; } .hl-h .icon-btn { margin-left: auto; }
.hl dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 8px 0 0; font-size: 14px; }
.hl dt { color: var(--ink-2); } .hl dd { margin: 0; }
.imp { margin-top: 14px; padding: 14px; background: var(--bg); border-radius: var(--r-m); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.imp-prev { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; } .imp-prev span { color: var(--ink-2); margin-left: 8px; }
.mv-lines { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.mv-l { display: grid; grid-template-columns: 1fr auto 90px auto; gap: 10px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.mv-l input { min-height: 36px; padding: 4px 8px; text-align: right; }
.copy-box summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 8px 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { cursor: pointer; } .swatches input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatches i { display: block; width: 32px; height: 32px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08) inset; }
.swatches input:checked + i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.swatches input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 4px; }

/* promemoria */
.off-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 26px; }
.off-card h3 { font-size: 21px; margin-bottom: 8px; }
.off-card p, .off-card ul { max-width: 75ch; }
.rem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.rem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rem.done { background: transparent; }
.rem-h { display: flex; justify-content: space-between; gap: 10px; } .rem-h b { display: block; } .rem-h span { color: var(--ink-2); font-size: 13.5px; }
.rem-msg { background: #e9f3ea; border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: 14px; flex: 1; }
.rem.done .rem-msg { opacity: .6; }

/* disponibilità */
.staff-chips { margin-bottom: 16px; }
.week-ed { display: flex; flex-direction: column; }
.we-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
.we-row:first-child { border-top: 0; }
.we-d { font-weight: 600; }
.we-r { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.we-range { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 10px; padding: 3px 4px 3px 6px; }
.we-range input { width: 96px; min-height: 34px; padding: 4px 6px; }
.mini-cal .m-dow { padding: 0 0 6px; text-align: center; }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mc { aspect-ratio: 1; border-radius: 8px; font-weight: 600; font-size: 13.5px; display: grid; place-items: center; }
.mc.work, .lg.work { background: color-mix(in srgb, var(--ok) 16%, white); }
.mc.rest, .lg.rest { background: var(--off); color: var(--ink-3); }
.mc.ferie, .lg.ferie { background: #f6dfb6; }
.mc.assenza, .lg.assenza { background: color-mix(in srgb, var(--bad) 20%, white); }
.mc.orario, .lg.orario { background: color-mix(in srgb, #3E6FA8 20%, white); }
.mc.is-today { box-shadow: 0 0 0 2px var(--ink) inset; }
.mc:hover { box-shadow: 0 0 0 2px var(--brand) inset; }

/* accesso */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px 28px; }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-f { margin-top: 22px; }

/* avvisi */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 14px 11px 18px; border-radius: 999px; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.bad { background: var(--bad); }
.t-undo { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- tablet e telefono ---------- */
@media (max-width: 1020px) {
  :root { --side: 76px; }
  .brand div, .nav-items a span, .side-foot em { display: none !important; }
  .side-foot { align-items: center; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .nav-items a { justify-content: center; position: relative; padding: 12px; }
  .nav-items .badge { position: absolute; top: 4px; right: 6px; margin: 0; }
  .side-foot { display: flex; justify-content: center; }
  }
@media (max-width: 760px) {
  body { font-size: 15px; }
  .side { inset: auto 0 0 0; width: auto; height: calc(62px + env(safe-area-inset-bottom)); flex-direction: row; padding: 0 4px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .side-foot { display: none; }
  /* con tante sezioni il menu scorre di lato */
  .nav-items { flex-direction: row; flex: 1; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .nav-items::-webkit-scrollbar { display: none; }
  .nav-items a { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 11px; flex: 1 0 66px; }
  .nav-items a span { display: block !important; white-space: nowrap; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .page { padding: 14px 12px 40px; }
  .planning { padding: 14px 12px 10px; height: calc(100svh - 62px - env(safe-area-inset-bottom)); }
  .pl-head { align-items: flex-start; }
  .pl-title h1, .page-head h1 { font-size: 28px; }
  .pl-title p { margin-top: 4px; font-size: 14px; }
  .pl-head { margin-bottom: 10px; gap: 10px; }
  .pl-tools { gap: 4px; width: 100%; }
  .pl-tools .btn span { display: none; }
  .pl-tools .btn.primary { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; min-height: 54px; padding: 0 20px; box-shadow: 0 10px 24px -8px rgba(0,0,0,.4); }
  .pl-tools .btn.primary span { display: inline; }
  .ap.from-app::after { display: none; }
  .grid { grid-template-columns: 46px repeat(var(--cols), minmax(132px, 1fr)); }
  .week { grid-template-columns: 1fr; } .w-day { min-height: 0; }
  .m-cell { min-height: 60px; padding: 5px; } .m-c { font-size: 15px; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .m-head { padding: 18px 14px 4px 18px; } .m-body { padding: 12px 18px 16px; }
  .ap-grid { grid-template-columns: 1fr; gap: 0; }
  .line-f { grid-template-columns: 1fr 1fr; } .line-f .field:first-child { grid-column: 1 / -1; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .cli-table .tr { grid-template-columns: 1.4fr 1fr; } .cli-table .tr > span:nth-child(n+3) { display: none; }
  .stock-table .tr { grid-template-columns: 1fr auto auto; } .stock-table .tr > span:nth-child(2), .stock-table .tr > span:nth-child(3), .stock-table .tr > span:nth-child(5), .stock-table .tr > span:nth-child(7) { display: none; }
  .moves-table .tr { grid-template-columns: .8fr 1.6fr .6fr; } .moves-table .tr > span:nth-child(2), .moves-table .tr > span:nth-child(5), .moves-table .tr > span:nth-child(6) { display: none; }
  .orders-table .tr { grid-template-columns: 1fr 1.6fr 1fr; } .orders-table .tr > span:nth-child(3), .orders-table .tr > span:nth-child(5) { display: none; }
  .svc-table .tr { grid-template-columns: 1.6fr .7fr .8fr; } .svc-table .tr > span:nth-child(2), .svc-table .tr > span:nth-child(4), .svc-table .tr > span:nth-child(6) { display: none; }
  .v-row { grid-template-columns: 1fr 1.4fr; } .v-row > span:nth-child(3) { display: none; }
  .we-row { grid-template-columns: 1fr; gap: 4px; }
  .ds-grid, .rem-list { grid-template-columns: 1fr; }
  .kpis b { font-size: 18px; }
  #toast { bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .side, .pl-tools, .clip-bar,   .main { margin: 0; } .planning { padding: 0; height: auto; }
  .grid-wrap { max-height: none; overflow: visible; border: 0; }
  .g-colhead, .g-times { position: static; }
  body { background: #fff; }
}

/* scheda cliente: app e codice per nuova password */
.app-box { display: flex; align-items: center; gap: 12px; background: var(--brand-soft); border-radius: var(--r-m); padding: 12px 14px; margin: 0 0 12px; }
.app-box > .ic { color: var(--brand); flex: none; }
.app-box div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-box span { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.code-box { display: flex; flex-direction: column; gap: 14px; }
.code { font-family: var(--ff-d); font-size: 44px; font-weight: 700; letter-spacing: .08em; text-align: center; margin: 6px 0; color: var(--brand); font-variant-numeric: tabular-nums; }
.svc-state { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 4px 0 0; font-size: 14px; }
.svc-state dt { font-weight: 600; }
.svc-state dd { margin: 0; color: var(--ink-2); }

/* ---------- statistiche ---------- */
.st-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-lbl { font: 600 16px var(--ff-d); min-width: 132px; text-align: center; }
.stats-page > .card, .stats-page > .ds-grid { margin-bottom: 16px; }
.st-hero { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 28px; align-items: center; }
.st-cap { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.st-big { display: block; font: 700 clamp(40px, 5vw, 60px)/1 var(--ff-d); letter-spacing: -.03em; color: var(--brand); margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.st-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.st-k { background: var(--bg); border-radius: var(--r-m); padding: 14px; display: flex; flex-direction: column; gap: 3px; }
.st-k b { font: 600 24px var(--ff-d); font-variant-numeric: tabular-nums; }
.st-k span { font-size: 13px; color: var(--ink-2); }
.st-k em { font-style: normal; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; height: 220px; align-items: end; padding-top: 8px; }
.bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bar i { width: 100%; max-width: 46px; background: var(--brand-mid); border-radius: 6px 6px 2px 2px; }
.bar.on i { background: var(--brand); }
.bar.future i { background: var(--line-2); }
.bar-v { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0; }
.bar.on .bar-v, .bar:hover .bar-v { opacity: 1; color: var(--ink); font-weight: 600; }
.bar-l { font-size: 12.5px; color: var(--ink-2); text-transform: capitalize; }
.bar.on .bar-l { color: var(--ink); font-weight: 700; }
.st-rows { display: flex; flex-direction: column; gap: 14px; }
.st-r { display: flex; flex-direction: column; gap: 6px; }
.st-r-h { display: flex; justify-content: space-between; gap: 12px; }
.st-r-h span { font-variant-numeric: tabular-nums; font-weight: 600; }
.meter { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.lost { display: flex; flex-direction: column; margin-top: 8px; }
.st-foot { margin-top: 4px; max-width: 70ch; }
@media (max-width: 900px) { .st-hero { grid-template-columns: 1fr; gap: 16px; } .st-kpis { grid-template-columns: repeat(2, 1fr); } .bars { gap: 4px; height: 180px; } .bar-v { display: none; } }

/* ---------- aiuto ---------- */
.help { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.help-i { padding: 0; }
.help-i summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.help-i summary::-webkit-details-marker { display: none; }
.help-i summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform .2s; margin-top: -4px; }
.help-i[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.help-i summary:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--r-l); }
.help-b { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 10px; line-height: 1.6; max-width: 72ch; }
.help-b ol, .help-b ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.help-foot { margin-top: 18px; }
@media (prefers-reduced-motion: reduce) { .help-i summary::after { transition: none; } }
@media (max-width: 600px) { .st-tools { width: 100%; gap: 6px; } .st-lbl { flex: 1; min-width: 0; font-size: 15px; } .st-kpis { gap: 8px; } .st-k { padding: 12px; } .st-k b { font-size: 20px; } }
.mark.logo { object-fit: cover; background: none; padding: 0; }
.logo-set { display: flex; gap: 16px; align-items: flex-start; }
.logo-set .mark.big { margin: 0; }
.logo-set > div { display: flex; flex-direction: column; gap: 10px; }
