:root {
  --primary: #2f6541;
  --primary-d: color-mix(in srgb, var(--primary) 82%, #000);
  --primary-l: color-mix(in srgb, var(--primary) 10%, #fff);
  --primary-ll: color-mix(in srgb, var(--primary) 5%, #fff);
  --bg: #f4f6f5;
  --card: #fff;
  --text: #1b2a25;
  --muted: #64736d;
  --border: #e2e8e5;
  --danger: #c62828;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 30, .05), 0 4px 16px rgba(16, 40, 30, .06);
  --hour-h: 96px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--primary); }
small, .muted { color: var(--muted); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Controlli ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f1f4f3; border-color: #cfd8d4; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, .appt:focus-visible, .nav a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 1px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, #fff); }
.btn-danger:hover { background: #fdecec; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .87rem; border-radius: 8px; }
.btn-lg { min-height: 50px; padding: 12px 26px; font-size: 1rem; letter-spacing: .03em; }
.btn-icon { padding: 8px; min-width: 40px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; font-weight: 600; color: #3d4b46; min-width: 0; }
label.field > span i { color: var(--danger); font-style: normal; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #cfd8d4; border-radius: 10px; background: #fff; font-weight: 400; }
textarea { min-height: 76px; resize: vertical; }
input[type=color] { width: 54px; height: 42px; padding: 3px; border: 1px solid #cfd8d4; border-radius: 10px; background: #fff; }
input:disabled, select:disabled, textarea:disabled { background: #f3f5f4; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; }
.row > .fit { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; flex: none; }
.seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font-weight: 600; min-height: 38px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: #fff; }

/* ---------- Struttura ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.brand img { width: 60px; height: 60px; object-fit: contain; border-radius: 10px; flex: none; }
.brand b { font-size: .95rem; line-height: 1.15; letter-spacing: .02em; color: var(--primary-d); display: block; }
.brand small { font-size: .74rem; }
.nav { padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: #33423d; text-decoration: none; font-weight: 600; font-size: .93rem; }
.nav a:hover { background: #f1f4f3; }
.nav a.on { background: var(--primary-l); color: var(--primary-d); }
.nav .sep { margin: 10px 12px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side-foot { margin-top: auto; padding: 12px 18px 16px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b7c2bd; margin-right: 6px; }
.live.on { background: #22a565; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(244, 246, 245, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.top .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { padding-left: 38px; border-radius: 999px; }
.search > .icon { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px; z-index: 40; }
.search-res h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 10px 4px; }
.search-res button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-res button:hover, .search-res button:focus { background: var(--primary-l); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-btn { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-l); color: var(--primary-d); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.menu { position: absolute; right: 24px; top: 58px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-width: 210px; z-index: 40; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: #f1f4f3; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cols-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); }
.note { padding: 10px 14px; border-radius: 10px; background: var(--primary-ll); border: 1px solid color-mix(in srgb, var(--primary) 20%, #fff); font-size: .9rem; }
.note.warn { background: #fff7e6; border-color: #f3d9a4; color: #7a4a05; }
.note.err { background: #fdecec; border-color: #f2b8b8; color: #8e1c1c; }

/* ---------- Statistiche ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 1.85rem; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--primary); border-color: var(--primary); color: #fff; }
.stat.hl span { color: rgba(255, 255, 255, .85); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr 44px; gap: 10px; align-items: center; font-size: .88rem; }
.bar-track { height: 12px; border-radius: 6px; background: #eef2f0; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--c, var(--primary)); min-width: 2px; }
.vbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 190px; padding-top: 18px; }
.vbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: .72rem; color: var(--muted); min-width: 0; }
.vbar i { display: block; width: 70%; max-width: 34px; border-radius: 5px 5px 0 0; background: var(--primary); min-height: 2px; }
.vbar b { font-size: .75rem; color: var(--text); }

/* ---------- Stati ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: #eef2f0; color: #40504a; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.st-prenotato { --sc: #1d4ed8; background: #e4ecfd; color: #1d4ed8; }
.st-confermato { --sc: #0f7a43; background: #dff4e8; color: #0f7a43; }
.st-da-richiamare { --sc: #b45309; background: #fdf0d8; color: #b45309; }
.st-completato { --sc: #475569; background: #e8edf2; color: #475569; }
.st-annullato { --sc: #b91c1c; background: #fde5e5; color: #b91c1c; }
.st-assente { --sc: #7e22ce; background: #f1e4fb; color: #7e22ce; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #999); flex: none; }

/* ---------- Liste e tabelle ---------- */
.arow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; border-radius: 8px; }
.arow:last-child { border-bottom: 0; }
.arow:hover { background: var(--primary-ll); }
.arow-time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 46px; }
.arow-time small { display: block; font-weight: 500; font-size: .74rem; }
.arow-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.arow-main { flex: 1; min-width: 0; }
.arow-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fafbfa; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--primary-ll); }
.tbl th.right, .tbl td.right { text-align: right; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > * { flex: 1 1 150px; max-width: 260px; }
.filters > .grow { flex: 2 1 220px; max-width: 420px; }
.filters > .fit { flex: 0 0 auto; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 700; font-size: .84rem; letter-spacing: .02em; }
.tab:hover { border-color: #c5d0cb; }
.tab.on { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: #fff; }
.tab.on .dot { background: #fff; }

/* ---------- Calendario ---------- */
.cal-toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav, .cal-ctrl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cal-nav h2 { margin: 0 6px; text-transform: capitalize; }
.cal-ctrl select { width: auto; min-height: 40px; }
.cal-nav input[type=date] { width: auto; min-height: 40px; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: .8rem; color: #40504a; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tg { overflow: auto; max-height: calc(100vh - 250px); min-height: 380px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; position: relative; }
.tg-head, .tg-grid { display: grid; grid-template-columns: 54px repeat(var(--n), minmax(var(--colw, 128px), 1fr)); }
.tg-head { position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--border); }
.tg-dayhead { padding: 8px 6px; text-align: center; font-weight: 700; font-size: .86rem; border-left: 1px solid var(--border); text-transform: capitalize; cursor: pointer; min-width: 0; }
.tg-dayhead small { display: block; font-weight: 500; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; }
.tg-dayhead.today { color: var(--primary-d); background: var(--primary-l); }
.tg-dayhead.closed small { color: var(--danger); }
.tg-gutter { position: sticky; left: 0; z-index: 5; background: #fff; }
.tg-head .tg-gutter { z-index: 7; }
.tg-hour { position: absolute; right: 6px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.tg-hour.first { transform: translateY(3px); }
#bk-phonehint:empty, #bk-linked:empty, #bk-suggest:empty { display: none; }
.tg-col { position: relative; border-left: 1px solid var(--border); cursor: cell;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(#f0f3f2 1px, transparent 1px);
  background-size: 100% var(--hour-h), 100% calc(var(--hour-h) / 2); }
.tg-col.closed { background-image: repeating-linear-gradient(135deg, #f4f5f5 0 10px, #eceeed 10px 20px); cursor: not-allowed; }
.tg-offz { position: absolute; left: 0; right: 0; background: rgba(105, 120, 113, .12); pointer-events: none; }
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: #e11d48; z-index: 4; pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #e11d48; }
.appt { position: absolute; z-index: 3; border: 0; border-left: 4px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 15%, #fff); color: #16231f; text-align: left; padding: 2px 6px; font-size: .78rem; line-height: 1.25; overflow: hidden; cursor: pointer; box-shadow: 0 0 0 1px #fff; }
.appt:hover { background: color-mix(in srgb, var(--c) 26%, #fff); z-index: 5; }
.appt b { font-weight: 700; }
.appt .l1, .appt .l2 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .l2 { color: #4a5a54; }
.appt .sdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); margin-right: 4px; }
.appt.st-annullato { opacity: .55; background: repeating-linear-gradient(135deg, #f6f6f6 0 6px, #ececec 6px 12px); color: #555; }
.appt.st-annullato .l1 { text-decoration: line-through; }
.appt.st-completato { background: color-mix(in srgb, var(--c) 7%, #f3f5f4); }
.slot-free { position: absolute; left: 3px; right: 3px; z-index: 2; border: 1.5px dashed color-mix(in srgb, var(--c) 55%, #fff); border-radius: 6px; background: color-mix(in srgb, var(--c) 5%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); font-size: .76rem; font-weight: 700; cursor: pointer; text-align: left; padding: 1px 6px; overflow: hidden; }
.slot-free:hover { background: color-mix(in srgb, var(--c) 16%, #fff); border-style: solid; }
.slot-busy { position: absolute; left: 3px; right: 3px; z-index: 1; border-radius: 6px; background: repeating-linear-gradient(135deg, #f1f2f2 0 6px, #e7e9e8 6px 12px); color: #8a9590; font-size: .7rem; padding: 1px 6px; overflow: hidden; pointer-events: none; }
.month { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head div { padding: 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; text-align: center; border-bottom: 1px solid var(--border); background: #fafbfa; }
.mcell { min-height: 116px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 5px; cursor: cell; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell.other { background: #fafbfa; }
.mcell.other .mday { color: #a5b0ab; }
.mcell.closed { background: repeating-linear-gradient(135deg, #f7f8f8 0 10px, #f0f2f1 10px 20px); }
.mcell-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.mday { border: 0; background: transparent; font-weight: 700; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.mday:hover { background: #e9eeec; }
.mcell.today .mday { background: var(--primary); color: #fff; }
.mfree { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mchip { display: block; width: 100%; border: 0; border-left: 3px solid var(--c); border-radius: 4px; background: color-mix(in srgb, var(--c) 14%, #fff); font-size: .74rem; text-align: left; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mchip.st-annullato { opacity: .5; text-decoration: line-through; }
.mmore { border: 0; background: transparent; font-size: .74rem; color: var(--primary-d); font-weight: 700; text-align: left; cursor: pointer; padding: 0 5px; }

/* ---------- Finestre ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 30, 24, .45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 14px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); display: flex; flex-direction: column; margin-bottom: 4vh; }
.modal.wide { max-width: 980px; }
.modal.mid { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 16px 16px; }
.modal-foot .spacer { flex: 1; }
.bk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.bk-grid section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bk-grid h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-d); }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow: auto; padding: 4px; }
.suggest-list button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest-list button:hover, .suggest-list button:focus { background: var(--primary-l); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid #cfd8d4; background: #fff; border-radius: 9px; padding: 7px 0; width: 66px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.chip:hover { border-color: var(--primary); background: var(--primary-ll); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip[disabled] { background: #f1f3f2; color: #a9b3ae; border-color: #e3e8e6; cursor: not-allowed; text-decoration: line-through; font-weight: 500; }
.history { display: flex; flex-direction: column; gap: 8px; font-size: .86rem; }
.history li { list-style: none; padding: 8px 10px; border-left: 3px solid var(--primary-l); background: #fafbfa; border-radius: 0 8px 8px 0; }
.history ul { margin: 0; padding: 0; display: contents; }
details > summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }

/* ---------- Disponibilità ---------- */
.wd-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.wd-row:last-child { border-bottom: 0; }
.wd-row > b { padding-top: 9px; }
.wd-ranges { display: flex; flex-direction: column; gap: 8px; }
.wd-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wd-range input { width: 120px; }
.svc-card { border-top: 4px solid var(--c); }
.svc-card h3 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.svc-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 10px 0; font-size: .9rem; }
.svc-meta b { font-variant-numeric: tabular-nums; }

/* ---------- Accesso ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--primary-l), var(--bg) 55%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 30px 28px; box-shadow: 0 12px 40px rgba(16, 40, 30, .12); display: flex; flex-direction: column; gap: 14px; }
.login-card img { width: 150px; height: 150px; object-fit: contain; margin: 0 auto; border-radius: 16px; }
.login-card h1 { text-align: center; color: var(--primary-d); font-size: 1.25rem; letter-spacing: .03em; }
.login-card p { margin: 0; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Notifiche ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #1b2a25; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .92rem; }
.toast.ok { background: #0f7a43; } .toast.err { background: #b91c1c; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 30, 24, .4); z-index: 25; }
  .top { padding: 10px 14px; }
  .top .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 70px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .menu { right: 14px; }
}
@media (max-width: 760px) {
  .bk-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .user-btn span, .btn .lbl-wide { display: none; }
  .tg { max-height: calc(100vh - 290px); --colw: 110px; }
  .mcell { min-height: 70px; padding: 3px; }
  .mchip { font-size: 0; height: 7px; padding: 0; border-left-width: 0; background: var(--c); border-radius: 4px; }
  .mfree { display: none; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .wd-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .wd-row > b { padding-top: 0; }
  .backdrop { padding: 0; }
  .modal, .modal.wide, .modal.mid { max-width: none; min-height: 100vh; border-radius: 0; margin: 0; }
  .modal-foot { border-radius: 0; }
  .modal-foot .btn-lg { flex: 1 1 100%; order: -1; }
  .bar-row { grid-template-columns: minmax(90px, 130px) 1fr 36px; }
  .stat b { font-size: 1.5rem; }
  .cal-nav h2 { font-size: 1rem; flex-basis: 100%; order: 5; margin: 0; }
}
@media print {
  .side, .top, .btn, .filters, .tabs { display: none !important; }
  .app { display: block; } .card { box-shadow: none; }
}
