:root {
  --ink: #14213d;
  --ink-2: #263859;
  --accent: #fca311;
  --accent-ink: #3a2500;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e2e5ea;
  --muted: #6b7280;
  --text: #1c2230;
  --ok: #1f8a4c;
  --ok-bg: #e3f4ea;
  --warn: #a15c00;
  --warn-bg: #fff2d6;
  --bad: #b42318;
  --bad-bg: #fde8e7;
  --info: #1d4ed8;
  --info-bg: #e5edff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 2px 8px rgba(20, 33, 61, .05);
  --nav-w: 210px;
  --top-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
a { color: var(--info); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; min-height: 38px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(252, 163, 17, .45); border-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--ink); vertical-align: middle; }
input[readonly] { background: #f3f4f6; color: #4b5563; }
label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--text); font-size: 15px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 500; min-height: 38px; }
label.check input { margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd4dc; background: #fff;
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; min-height: 38px; text-decoration: none; color: var(--text);
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: #f1b8b3; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: transparent; border: 0; color: inherit; cursor: pointer; font-size: 16px; padding: 6px 8px; border-radius: 8px; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--ink); }
.login-box { background: #fff; padding: 28px 24px; border-radius: 14px; width: 100%; max-width: 360px; display: grid; gap: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h1 { font-size: 20px; text-align: center; color: var(--ink); }
.login-logo { text-align: center; }
.login-logo img { width: 64px; height: 64px; }
.login-err { color: var(--bad); margin: 0; min-height: 1em; text-align: center; font-size: 14px; }

/* shell */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; flex: 1; min-width: 0; }
.brand img { width: 30px; height: 30px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: 42px; background: #fff; color: var(--text); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); min-width: 180px; overflow: hidden; }
.dropdown button { display: block; width: 100%; text-align: left; padding: 11px 14px; background: none; border: 0; cursor: pointer; }
.dropdown button:hover { background: var(--bg); }
.menu-btn { display: none; }
.sidenav {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w); background: #fff; border-right: 1px solid var(--line);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; z-index: 15;
}
.sidenav a, .tabbar a { text-decoration: none; color: var(--text); }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.sidenav a span { width: 22px; text-align: center; }
.sidenav a:hover { background: var(--bg); }
.sidenav a.active { background: var(--ink); color: #fff; }
.main { margin-left: var(--nav-w); padding: calc(var(--top-h) + 18px) 22px 40px; max-width: 1400px; }
.tabbar { display: none; }

/* page */
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { flex: 1; min-width: 160px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card > h3 { margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { flex: 1 1 150px; max-width: 260px; }
.filters .grow { flex: 2 1 220px; max-width: none; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; background: #fff; position: sticky; top: 0; }
table.list td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #f8f9fb; }
table.list tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list tr.dim td { color: #9aa1ad; }
table.list tr.dim td .badge { opacity: .8; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-grey { background: #eceef2; color: #4b5563; }

/* agenda */
.datenav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.datenav input[type=date] { width: auto; }
.day-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 18px 0 8px; text-transform: capitalize; display: flex; gap: 8px; align-items: center; }
.day-title .count { font-weight: 600; color: var(--muted); font-size: 13px; text-transform: none; }
.svc-list { display: grid; gap: 8px; }
.svc {
  display: grid; grid-template-columns: 30px 70px 1fr auto; gap: 12px; align-items: start;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; cursor: pointer; border-left: 4px solid var(--accent);
}
.svc:hover { box-shadow: 0 2px 12px rgba(20,33,61,.12); }
.svc.annullato { border-left-color: var(--bad); opacity: .65; }
.svc.fatturato { border-left-color: var(--ok); }
.svc.ricevuta { border-left-color: var(--info); }
.svc .sel { padding-top: 4px; }
.svc .time { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.svc .time small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.svc .route { font-weight: 700; }
.svc .route .arrow { color: var(--accent); margin: 0 4px; }
.svc .meta { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.svc .notes { font-size: 13px; margin-top: 4px; color: #374151; white-space: pre-line; }
.svc .side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.svc .amount { font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; background: #fff; border-radius: var(--radius); border: 1px dashed #cfd4dc; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; min-width: 130px; }
.stat b { display: block; font-size: 20px; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* righe importi */
table.righe { width: 100%; border-collapse: collapse; font-size: 14px; }
table.righe th { font-size: 12px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px 6px; }
table.righe td { padding: 4px 4px; vertical-align: middle; }
table.righe input, table.righe select { min-height: 34px; padding: 5px 8px; }
table.righe td.calc { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 8px; }
.totbox { display: flex; justify-content: flex-end; gap: 22px; margin-top: 10px; flex-wrap: wrap; font-size: 15px; }
.totbox b { font-size: 18px; color: var(--ink); }
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--info-bg); color: var(--info); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 14px 0 6px; z-index: 5; }

/* fatturazione */
.group { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.group-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.group-head .name { font-weight: 700; flex: 1; min-width: 180px; }
.group-body { border-top: 1px solid var(--line); padding: 12px 14px; background: #fbfbfc; }

/* tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 12px; border-radius: 99px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 13.5px; }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 80; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-weight: 600; max-width: 90vw; }
.toast.err { background: var(--bad); }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.print-root { display: none; }

/* scheda servizio: caratteri piu' piccoli */
.main.compatto { font-size: 13px; }
.main.compatto .page-head h2 { font-size: 17px; }
.main.compatto .card { padding: 12px 14px; margin-bottom: 10px; }
.main.compatto .card > h3, .main.compatto h3 { font-size: 12px; margin-bottom: 8px; }
.main.compatto .grid { gap: 8px 10px; }
.main.compatto label { font-size: 11.5px; }
.main.compatto label > input, .main.compatto label > select, .main.compatto label > textarea { font-size: 13px; margin-top: 2px; }
.main.compatto input, .main.compatto select, .main.compatto textarea { font-size: 13px; padding: 5px 8px; min-height: 31px; }
.main.compatto textarea { min-height: 48px; }
.main.compatto label.check { font-size: 13px; min-height: 30px; }
.main.compatto .btn { font-size: 13px; padding: 6px 11px; min-height: 32px; }
.main.compatto table.righe { font-size: 13px; }
.main.compatto table.righe th { font-size: 11px; }
.main.compatto table.righe input, .main.compatto table.righe select { min-height: 30px; padding: 4px 6px; }
.main.compatto .totbox { font-size: 13px; }
.main.compatto .totbox b { font-size: 15px; }
.main.compatto .banner { padding: 8px 12px; font-size: 13px; }
.main.compatto p.small, .main.compatto .small { font-size: 12px; }
.main.compatto table.list { font-size: 12.5px; }
.main.compatto table.list th { font-size: 10.5px; padding: 5px 6px; }
.main.compatto table.list td { padding: 4px 6px; }
.main.compatto table.list td input { min-height: 28px; padding: 3px 6px; }
.main.compatto .btn.small { font-size: 12px; padding: 3px 8px; min-height: 26px; }
.main.compatto .mt { margin-top: 8px; }

/* responsive */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
  .c2 { grid-column: span 3; } .c3 { grid-column: span 3; } .c4, .c5, .c6, .c8, .c9, .c12 { grid-column: span 6; }
}
@media (max-width: 760px) {
  :root { --top-h: 52px; }
  .menu-btn { display: inline-block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .sidenav.open { transform: none; }
  .main { margin-left: 0; padding: calc(var(--top-h) + 12px) 12px calc(76px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; text-align: center; padding: 7px 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .tabbar a span { display: block; font-size: 19px; }
  .tabbar a.active { color: var(--ink); }
  .brand span { font-size: 15px; }
  #userName { display: none; }
  .svc { grid-template-columns: 24px 58px 1fr; }
  .svc .side { grid-column: 2 / 4; justify-items: start; text-align: left; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .svc .time { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .c2, .c3 { grid-column: span 1; } .c4, .c5, .c6, .c8, .c9, .c12 { grid-column: span 2; }
  .filters label { max-width: none; flex: 1 1 140px; }
  table.list.responsive thead { display: none; }
  table.list.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.list.responsive td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 4px; text-align: right; }
  table.list.responsive td::before { content: attr(data-l); font-weight: 600; color: var(--muted); font-size: 12px; text-align: left; }
  table.list.responsive td.num { justify-content: space-between; }
  table.list.responsive tfoot { display: block; }
  table.list.responsive tfoot tr { display: flex; flex-wrap: wrap; }
  table.list.responsive tfoot td:empty { display: none; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .page-head h2 { font-size: 18px; }
}

/* ---------------- STAMPA ---------------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; }
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; }
}
.doc { font: 11pt/1.35 "Segoe UI", Arial, sans-serif; color: #111; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 2px solid #14213d; padding-bottom: 10px; margin-bottom: 14px; }
.doc .doc-head img { max-height: 70px; max-width: 220px; }
.doc .az { font-size: 9.5pt; text-align: right; }
.doc .az b { font-size: 12pt; }
.doc h1 { font-size: 16pt; margin: 6px 0 12px; color: #14213d; }
.doc table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.doc th { background: #eef0f4; text-align: left; padding: 5px 6px; border-bottom: 1px solid #999; font-size: 8.5pt; text-transform: uppercase; }
.doc td { padding: 5px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
.doc td.num, .doc th.num { text-align: right; white-space: nowrap; }
.doc .boxes { display: flex; gap: 14px; margin-bottom: 14px; }
.doc .box { border: 1px solid #bbb; border-radius: 6px; padding: 8px 10px; flex: 1; font-size: 10pt; }
.doc .box .lbl { font-size: 8pt; text-transform: uppercase; color: #555; font-weight: 700; margin-bottom: 3px; }
.doc .kv { width: 100%; font-size: 11pt; }
.doc .kv td { padding: 8px 6px; border-bottom: 1px solid #ccc; }
.doc .kv td:first-child { width: 32%; font-weight: 700; color: #333; }
.doc .totali { margin-left: auto; width: 55%; margin-top: 10px; }
.doc .totali td { border: 0; padding: 3px 6px; }
.doc .totali tr.big td { font-size: 13pt; font-weight: 800; border-top: 2px solid #14213d; padding-top: 6px; }
.doc .foot { margin-top: 18px; font-size: 9pt; color: #333; }
.doc .firma { margin-top: 40px; display: flex; justify-content: space-between; gap: 40px; }
.doc .firma div { flex: 1; border-top: 1px solid #555; padding-top: 4px; font-size: 9pt; text-align: center; }
.doc .page-break { page-break-after: always; }
.doc .small { font-size: 8.5pt; }
.doc tr { page-break-inside: avoid; }

/* ---- Home ---- */
.main.home { display: flex; }
.home-box { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: calc(100vh - 140px); padding: 16px; }
.home-logo { max-width: min(520px, 90%); max-height: 60vh; object-fit: contain; }
.home-icon { width: 96px; height: 96px; opacity: .8; }
.home-nologo h2 { margin: 14px 0 6px; }
a.brand { text-decoration: none; color: inherit; flex: 0 1 auto; margin-right: auto; }
.logo-prev { width: 180px; height: 110px; border: 1px dashed var(--line, #ccc); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
.logo-prev img { max-width: 170px; max-height: 100px; object-fit: contain; }
.brand img.logo-att { width: auto; height: 36px; max-width: 140px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
@media (max-width: 760px) { .brand img.logo-att { height: 30px; max-width: 90px; } }

/* ---- Calendario autisti (stile Outlook) ---- */
.cal-bar .row { align-items: flex-end; }
.cal-modes { display: flex; gap: 0; }
.cal-modes .btn { border-radius: 0; margin-left: -1px; }
.cal-modes .btn:first-child { border-radius: 8px 0 0 8px; }
.cal-modes .btn:last-child { border-radius: 0 8px 8px 0; }
.cal-nav { align-items: center; margin-top: 10px; gap: 6px; }
.cal-title { margin: 0 0 0 8px; font-size: 18px; text-transform: capitalize; color: var(--ink); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 8px; }
.cal-legend:empty { display: none; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 360px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.cal-tg { display: grid; position: relative; }
.cal-th { position: sticky; top: 0; z-index: 3; background: #fff; border: 0; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px 4px; text-align: center; cursor: pointer; font: inherit; color: var(--text); }
.cal-th small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.cal-th b { font-size: 20px; font-weight: 600; }
.cal-th.oggi b { background: var(--ink); color: #fff; border-radius: 50%; display: inline-block; width: 34px; height: 34px; line-height: 34px; }
.cal-corner { cursor: default; border-left: 0; left: 0; z-index: 4; }
.cal-allday-l { font-size: 10px; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); text-align: right; }
.cal-allday { border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px; min-height: 24px; }
.cal-hours { border-right: 0; }
.cal-hours div { position: relative; font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; }
.cal-hours span { position: relative; top: -7px; }
.cal-hours div:first-child span { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); }
.cal-col.oggi { background-color: #f5f8ff; }
.cal-ev { position: absolute; overflow: hidden; background: color-mix(in srgb, var(--c) 14%, #fff); border-left: 4px solid var(--c); border-radius: 5px; padding: 2px 5px; font-size: 11px; line-height: 1.2; cursor: pointer; color: #1f2937; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cal-ev:hover { z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.2); height: auto !important; min-height: 45px; }
.cal-ev-d { font-size: 10px; color: #4b5563; }
.cal-num { color: #6b7280; font-weight: 600; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #dc2626; z-index: 1; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #dc2626; }
.cal-chip { display: flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 4px; margin: 1px 0; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--c) 12%, #fff); }
.cal-chip i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cal-chip:hover { background: color-mix(in srgb, var(--c) 25%, #fff); }
.cal-month { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-mhead, .cal-mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mhead div { padding: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line); text-align: center; }
.cal-mcell { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px 3px; min-width: 0; }
.cal-mcell:nth-child(7n) { border-right: 0; }
.cal-mcell.fuori { background: #f8f9fb; }
.cal-mcell.fuori .cal-mday { color: #9ca3af; }
.cal-mday { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 5px; border-radius: 12px; color: var(--text); }
.cal-mcell.oggi .cal-mday { background: var(--ink); color: #fff; }
.cal-more { border: 0; background: none; font-size: 12px; color: var(--accent, #2563eb); cursor: pointer; padding: 1px 4px; }
@media (max-width: 760px) {
  .cal-title { font-size: 15px; margin-left: 4px; }
  .cal-scroll { max-height: none; min-height: 0; height: 62vh; }
  .cal-bar { padding: 10px; }
  .cal-bar label { font-size: 0; }
  .cal-bar .row { gap: 6px; }
  .cal-modes { width: 100%; }
  .cal-modes .btn { flex: 1; }
  .cal-nav { margin-top: 6px; flex-wrap: nowrap; }
  .cal-nav input[type=date] { display: none; }
  .cal-legend { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; font-size: 11px; }
  .cal-th b { font-size: 16px; }
  .cal-th.oggi b { width: 28px; height: 28px; line-height: 28px; }
  .cal-mcell { min-height: 64px; padding: 1px; }
  .cal-chip { font-size: 9px; padding: 0 2px; gap: 2px; }
  .cal-chip .cal-num { display: none; }
  .cal-chip b { font-weight: 600; }
}

/* ---- accesso ospite: sola visualizzazione ---- */
body.ospite [data-new], body.ospite [data-save], body.ospite [data-savenew], body.ospite [data-del], body.ospite [data-dup],
body.ospite [data-ret], body.ospite [data-add], body.ospite [data-rem], body.ospite [data-crea], body.ospite [data-refcli],
body.ospite [data-ricalc], body.ospite [data-fromtot], body.ospite [data-addriga], body.ospite [data-pay], body.ospite [data-unpay],
body.ospite [data-outlook], body.ospite [data-send], body.ospite .assegna, body.ospite a[href="#/fattura/nuova"],
body.ospite [data-delriga], body.ospite .righe .del { display: none !important; }
body.ospite .main:not(.home)::before { content: "👁 Accesso ospite: sola visualizzazione"; display: block; font-size: 12px; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 8px; padding: 4px 10px; margin-bottom: 10px; width: fit-content; }
body.ospite form input:disabled, body.ospite form select:disabled, body.ospite form textarea:disabled, body.ospite [data-righe] input:disabled { background: #f8f9fb; color: #374151; opacity: 1; cursor: default; }
