/* Earnesto Host — dashboard del locale. Palette AMG: blu #183153, nodo arancio #E2763A. Mobile-first; dal tablet in su barra laterale. */
:root {
  --bg: #F4F6F9; --card: #fff; --line: #E3E7EC; --line2: #EDF0F4; --ink: #14202E; --ink2: #344255; --mute: #5B6B80;
  --brand: #183153; --brand-d: #0F2038; --brand-soft: #E6EDF6; --accent: #E2763A;
  --ok: #2E9E5B; --wait: #8A94A3; --warn: #D9731A; --warn-bg: #FFF4E5; --warn-line: #F0C98F; --warn-ink: #7A4B10;
  --off: #B7C0CC; --err: #B42318; --err-bg: #FEF3F2;
  --r: 14px; --r-s: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.4 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-d); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 800; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout */
.shell { min-height: 100vh; display: flex; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: 0 0 160px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px; font-size: 11px; font-weight: 700; color: #66768A; position: relative; }
.tabbar a.on { color: var(--brand); }
.tabbar .count { position: absolute; top: 4px; left: calc(50% + 6px); }
@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; gap: 4px; width: 236px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
  .tabbar { display: none; }
  .main { padding: 8px 12px 48px; }
  .wrap { padding: 0 16px; }
}
.side .brand { padding: 4px 12px 16px; display: flex; flex-direction: column; }
.side .nav { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--r-s); font-weight: 700; font-size: 14px; color: var(--ink2); }
.side .nav.on { background: var(--brand-soft); color: var(--brand); }
.side .nav .count { margin-left: auto; }
.side .grow { flex: 1; }
.side .who { padding: 8px 12px; font-size: 12px; color: var(--mute); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.count { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.eyebrow { font-size: 11px; font-weight: 800; color: var(--mute); letter-spacing: .04em; text-transform: uppercase; }

/* intestazione pagina */
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 0 12px; margin-bottom: 14px; }
@media (min-width: 900px) { .top { background: transparent; border: 0; padding: 16px 0 4px; } }
.top .row1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.daynav { display: flex; align-items: center; gap: 8px; }
.daynav h1 { font-size: 22px; }
@media (min-width: 900px) { .daynav h1 { font-size: 24px; } }

/* bottoni */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid #D6DCE4; background: #fff; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #C2CAD5; color: var(--ink); }
.btn.sq { width: 40px; padding: 0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); color: #fff; }
.btn.ghost { background: transparent; }
.btn.outline { border-color: var(--brand); color: var(--brand); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; min-height: 48px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
form.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }

/* segmenti servizio */
.seg { display: flex; background: #EDF0F4; border-radius: 12px; padding: 4px; gap: 4px; margin-top: 12px; overflow-x: auto; }
.seg a { flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--mute); white-space: nowrap; }
.seg a.on { background: #fff; color: var(--ink); font-weight: 800; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .closed { font-weight: 700; color: var(--err); font-size: 12px; }
@media (min-width: 900px) { .seg { display: inline-flex; margin-top: 0; } .seg a { flex: none; } }

/* kpi */
.kpis { display: flex; gap: 10px; margin: 0 -16px 14px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.kpis::-webkit-scrollbar { display: none; }
.kpis .kpi { flex: 0 0 auto; min-width: 128px; }
@media (min-width: 640px) { .kpis { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 14px; padding: 0; overflow: visible; } .kpis .kpi { min-width: 0; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 22px; font-weight: 800; }
.kpi .v small { font-size: 14px; color: var(--mute); }
.kpi .l { font-size: 12px; font-weight: 700; color: var(--mute); }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.kpi.warn .v, .kpi.warn .l { color: var(--warn-ink); }

/* griglia contenuti */
.cols { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 1100px) { .cols { flex-direction: row; align-items: flex-start; } .cols > .wide { flex: 1 1 auto; min-width: 0; } .cols > .narrow { flex: 0 0 340px; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.card .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .hd h2 { font-size: 15px; }
.card .hd .meta { font-size: 13px; font-weight: 700; color: var(--mute); }
.card .bd { padding: 12px 16px; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.card.warn .hd { border-color: var(--warn-line); }
.card.warn h2, .card.warn .hd a { color: var(--warn-ink); }
.empty { padding: 22px 16px; color: var(--mute); font-size: 14px; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* righe prenotazione */
.bk { display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.bk:last-child { border-bottom: 0; }
.bk .t { font-weight: 800; font-size: 16px; }
.bk .t.none { color: var(--off); }
.bk .who { min-width: 0; }
.bk .nm { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk .sub { font-size: 13px; color: var(--mute); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.bk .pax { font-weight: 800; font-size: 18px; text-align: right; }
.bk .acts { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.bk.st-warn { background: #FFFBF3; }
.bk.st-off .nm, .bk.st-off .t, .bk.st-off .pax { color: var(--off); text-decoration: line-through; }
.bk.st-done .nm, .bk.st-done .t, .bk.st-done .pax { color: var(--mute); }
@media (min-width: 900px) {
  .bk { grid-template-columns: 56px minmax(0, 1fr) 44px 250px; }
  .bk .acts { grid-column: auto; margin-top: 0; justify-content: flex-end; }
}
@media (min-width: 1500px) { .bk { grid-template-columns: 56px minmax(0, 1fr) 44px 160px 250px; } }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--off); }
.dot.ok { background: var(--ok); } .dot.wait { background: var(--wait); } .dot.warn { background: var(--warn); }
.dot.done { background: var(--brand); } .dot.off { background: var(--off); }
.st-col { display: none; }
@media (min-width: 1500px) { .st-col { display: block; } .st-inline { display: none; } }

/* chip canale e tag */
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; letter-spacing: .02em; }
.ch-tel { background: var(--brand-soft); color: var(--brand); }
.ch-wa { background: #E0F0E6; color: #1E6B3A; }
.ch-web { background: #E6E9F3; color: #2F3F7A; }
.ch-staff { background: #ECECEC; color: #4A4A4A; }
.ch-ext { background: #F3E8D8; color: #8A5A1E; }
.tag { display: inline-flex; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: #EEF1F5; color: var(--ink2); }

/* da gestire */
.todo { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--warn-line); }
.todo:last-child { border-bottom: 0; }
.todo .tx { flex: 1; min-width: 0; }
.todo .tt { font-weight: 700; font-size: 14px; }
.todo .ts { font-size: 12px; color: var(--warn-ink); margin-top: 2px; }

/* flash e form */
.flash { margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; background: var(--brand-soft); color: var(--brand); }
.flash.err { background: var(--err-bg); color: var(--err); }
.banner { background: #14202E; color: #fff; font-size: 13px; font-weight: 700; padding: 8px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.banner form { margin: 0; }
.banner button { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 4px 10px; font-weight: 700; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 800; color: var(--ink2); }
.input { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid #CDD4DE; background: #fff; font-size: 16px; width: 100%; }
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.input.code { font-size: 26px; font-weight: 800; letter-spacing: .35em; text-align: center; }
.hint { font-size: 13px; color: var(--mute); }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login .box { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; }
.login h1 { font-size: 22px; margin: 6px 0 4px; }
.login p { margin: 0 0 18px; color: var(--mute); font-size: 14px; }
.devcode { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: #FFF8E6; color: var(--warn-ink); font-size: 13px; font-weight: 700; }
.kitchen { font-size: 14px; line-height: 1.7; color: var(--ink2); }
.htmx-request .btn, .btn.htmx-request { opacity: .6; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* nome cliccabile */
.bk a.nm { display: block; color: var(--ink); }
.bk a.nm:hover { color: var(--brand); text-decoration: underline; }

/* bottone flottante */
.fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15; min-height: 52px; padding: 0 18px; border-radius: 16px; background: var(--brand); color: #fff; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; box-shadow: 0 6px 16px rgba(24,49,83,.3); }
.fab:hover { color: #fff; background: var(--brand-d); }
@media (min-width: 900px) { .fab { bottom: 24px; right: 28px; } }

/* settimana */
.legend { display: flex; gap: 14px; font-size: 12px; font-weight: 700; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; background: #EDF0F4; border: 1px solid #D6DCE4; display: inline-block; }
.sw.fill { background: var(--brand); border-color: var(--brand); }
.week { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.wday .hd h2 a { color: var(--ink); }
.wday.today { border-color: var(--brand); }
.wday.past { opacity: .6; }
.pill { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); vertical-align: middle; }
.state { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.s-aperto { background: var(--brand-soft); color: var(--brand); }
.s-pieno { background: var(--warn-bg); color: var(--warn-ink); }
.s-chiuso { background: #ECECEC; color: #4A4A4A; }
.wday .bd { display: flex; flex-direction: column; gap: 8px; }
.svc { display: flex; align-items: center; gap: 10px; position: relative; }
.svc .lbl { width: 58px; flex: none; font-size: 13px; font-weight: 700; color: var(--mute); }
.bar { flex: 1; height: 14px; border-radius: 7px; background: #EDF0F4; overflow: hidden; position: relative; }
.fillbar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px; background: var(--brand); }
.fillbar.hot { background: var(--warn); }
.num { width: 64px; flex: none; text-align: right; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.closedtxt { flex: 1; font-size: 13px; color: var(--mute); }
.note { font-size: 12px; font-weight: 700; color: var(--mute); }
.note.warn { color: var(--warn-ink); }
details.more { flex: none; }
details.more summary { list-style: none; width: 36px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid #D6DCE4; cursor: pointer; font-weight: 800; color: var(--ink2); }
details.more summary::-webkit-details-marker { display: none; }
details.more .menu { position: absolute; right: 0; top: 38px; z-index: 10; width: 220px; background: #fff; border: 1px solid #D6DCE4; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
details.more .menu form { margin: 0; }
.btn.sm.block { min-height: 40px; font-size: 14px; }

/* form prenotazione */
.formcard { max-width: 720px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field .opt { font-weight: 600; color: var(--mute); }
.input.area { min-height: 72px; padding: 10px 14px; resize: vertical; }
select.input { appearance: auto; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.field legend { font-size: 13px; font-weight: 800; color: var(--ink2); margin-bottom: 6px; padding: 0; width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid #D6DCE4; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; background: #fff; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* dettaglio */
.summary { display: flex; gap: 18px; align-items: flex-start; }
.summary .big { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.summary .big .v { font-size: 34px; font-weight: 800; line-height: 1; }
.summary .big .l { font-size: 12px; font-weight: 700; color: var(--mute); }
.summary .facts { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.acts-row { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); }
.reminder-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); }
.tl { display: grid; grid-template-columns: 82px 1fr; gap: 2px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line2); font-size: 13px; }
.tl:last-child { border-bottom: 0; }
.tl .when { color: var(--mute); font-weight: 700; }
.tl .by { grid-column: 2; font-size: 11px; color: var(--mute); }
details.danger summary { padding: 14px 16px; font-weight: 700; color: var(--err); cursor: pointer; }
.btn.danger { border-color: var(--err); color: var(--err); }
fieldset.field { flex-direction: row; }
.grid2 > * { min-width: 0; }
.grid2 .input { min-width: 0; }
@media (max-width: 899px) { .top { margin: 0 -16px 14px; padding: 14px 16px 12px; } }

/* conversazioni */
.conv { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 1100px) { .conv { flex-direction: row; align-items: flex-start; } .conv .list { flex: 0 0 380px; } .conv .detail { flex: 1; min-width: 0; } }
@media (max-width: 1099px) { .conv.has-sel .list { display: none; } }
@media (min-width: 1100px) { .back-m { display: none; } }
.filters { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.f { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #D6DCE4; display: inline-flex; align-items: center; font-weight: 700; font-size: 13px; color: var(--ink); background: #fff; }
.f.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.f.f-warn:not(.on) { border-color: var(--warn); color: var(--warn-ink); }
.it { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line2); color: var(--ink); }
.it:hover { background: #F9FAFC; color: var(--ink); }
.it.sel { background: #F1F5FA; box-shadow: inset 3px 0 0 var(--brand); }
.itx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.itx .row { display: flex; justify-content: space-between; gap: 8px; }
.itx .who { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itx .when { font-size: 12px; font-weight: 700; color: #66768A; white-space: nowrap; }
.itx .out { font-size: 13px; color: var(--ink2); margin-top: 2px; }
.res { align-self: flex-start; display: inline-flex; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-top: 5px; }
.r-ok { background: var(--brand-soft); color: var(--brand); } .r-warn { background: var(--warn-bg); color: var(--warn-ink); } .r-info { background: #ECECEC; color: #4A4A4A; }
.det-hd { flex-wrap: wrap; align-items: flex-start; }
.det-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.sumbox { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--line); background: #F9FAFC; }
.sumbox.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.linked { border-bottom: 1px solid var(--line); font-size: 14px; }
.msgs { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.m-c { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-top-left-radius: 4px; }
.m-a { background: var(--brand-soft); align-self: flex-end; border-top-right-radius: 4px; }
.msg .mt { display: block; font-size: 11px; color: var(--mute); margin-top: 4px; }
.center { text-align: center; }
.after { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.tl2 { display: flex; gap: 10px; font-size: 13px; align-items: flex-start; }
.tl2 .d { width: 10px; height: 10px; border-radius: 50%; background: var(--off); margin-top: 4px; flex: none; }
.tl2 .d.ok { background: var(--ok); }
.reply { border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.reply .input { flex: 1; }
.pad { padding: 0 16px 14px; margin: 0; }
.todo a.tt { color: var(--ink); display: block; }
.todo a.tt:hover { color: var(--brand); }
.it .chip, .todo .chip { align-self: flex-start; margin-top: 2px; }

/* impostazioni */
.setgrid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .setgrid { grid-template-columns: 1fr 1fr; align-items: start; } }
.sec { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line2); color: var(--ink); }
.sec:last-child { border-bottom: 0; }
a.sec:hover { background: #F9FAFC; color: var(--ink); }
.sec .sx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sec .t { font-weight: 700; font-size: 15px; }
.sec .d { font-size: 13px; color: var(--mute); margin-top: 2px; }
.sec .chev { font-size: 22px; color: var(--mute); }
.live { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 12px; }
.live.none { background: #EEF1F5; color: var(--mute); }
.li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.li:last-child { border-bottom: 0; }
.li.past { opacity: .55; }
.li .lx { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.li .lacts { display: flex; gap: 6px; flex-wrap: wrap; }
.li .input.sm { min-height: 40px; flex: 1; min-width: 160px; font-size: 15px; }
.check.day { min-width: 58px; justify-content: center; }
.filters.bare { border: 0; padding: 0 0 12px; }
pre.prompt { margin: 0; padding: 14px 16px; white-space: pre-wrap; font: 500 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink2); max-height: 70vh; overflow: auto; }
fieldset.field { align-items: flex-start; align-content: flex-start; } .grid2 { align-items: start; }

/* piano e consumi */
.usage { display: flex; flex-direction: column; gap: 14px; }
.ur { display: flex; flex-direction: column; gap: 6px; }
.ul { display: flex; justify-content: space-between; font-size: 14px; }
.li.cur { background: var(--brand-soft); }
@media (min-width: 640px) { .formcard .kpis { grid-template-columns: repeat(3, 1fr); } }
.ur .bar { flex: none; width: 100%; }

/* calendario per scegliere il giorno */
.pickform { position: relative; margin: 0; display: inline-flex; }
.pickinput { position: absolute; left: 0; bottom: 0; width: 40px; height: 40px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.daynav { flex-wrap: wrap; }
.intro { margin: 0 0 14px; color: var(--ink2); font-size: 14px; }
.explain { margin: 0; padding: 10px 16px; font-size: 13px; color: var(--mute); border-bottom: 1px solid var(--line2); background: #F9FAFC; }

/* capienza del giorno */
.capform { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line2); margin-bottom: 4px !important; }
.capform label { font-size: 12px; font-weight: 800; color: var(--ink2); }
.caprow { display: flex; gap: 6px; }
.caprow .input.sm { min-height: 40px; width: 90px; flex: none; font-size: 15px; padding: 0 10px; }
.capmore { position: relative; }
.capmore .menu { right: 0; left: auto; }
.meta-sum { list-style: none; cursor: pointer; display: inline-flex; gap: 8px; align-items: baseline; }
.meta-sum::-webkit-details-marker { display: none; }
details.capmore > summary.meta-sum { width: auto; height: auto; border: 0; padding: 0; }
.lk { font-size: 13px; font-weight: 800; color: var(--brand); text-decoration: underline; }
/* i menu a tendina (⋯, Cambia) non devono essere tagliati dal bordo della card */
.card:has(details.more[open]) { overflow: visible; position: relative; z-index: 6; }
.capform:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0 !important; }

/* logo del locale */
.side .brand .tname { font-size: 16px; font-weight: 800; }
.side .brand .tname.sm { font-size: 12px; font-weight: 700; color: var(--mute); margin-top: 6px; }
.tlogo { display: block; max-width: 100%; max-height: 64px; width: auto; height: auto; object-fit: contain; object-position: left center; }
.tlogo-m { display: block; height: 28px; width: auto; max-width: 170px; object-fit: contain; object-position: left center; margin-bottom: 4px; }
@media (min-width: 900px) { .tlogo-m { display: none; } }
.logoprev { display: flex; gap: 16px; flex-wrap: wrap; }
.logoprev .lp-box { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px; background: #fff; display: flex; flex-direction: column; min-width: 200px; }
.logoprev .lp-side .lp-box { width: 236px; }
.logoprev .lp-side img { max-width: 208px; max-height: 64px; width: auto; height: auto; object-fit: contain; object-position: left center; }
.logoprev .lp-side .tname { font-size: 12px; font-weight: 700; color: var(--mute); margin-top: 6px; }
.logoprev .lp-mob img { height: 28px; width: auto; max-width: 170px; object-fit: contain; object-position: left center; margin-bottom: 4px; }
.logoprev .lp-mob strong { font-size: 20px; font-weight: 800; }
.muted { color: var(--mute); margin: 0; }
.input.file { padding: 10px; min-height: 48px; }

/* marchio del servizio */
.lockup { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.lockup img { width: 44px; height: auto; }
.wm { font-size: 24px; font-weight: 800; letter-spacing: -0.035em; color: var(--brand); line-height: 1; }
.wm span { font-weight: 500; }
.signed { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line2); font-size: 12px; font-weight: 600; color: var(--mute); }
.signed img { height: 24px; width: auto; }
.side .by { display: flex; align-items: center; gap: 8px; padding: 10px 12px 2px; border-top: 1px solid var(--line2); font-size: 12px; font-weight: 600; color: var(--mute); }
.side .by img { width: 22px; height: auto; }
.side .by b { font-weight: 800; color: var(--ink); }

/* conversazioni per persona */
.it .chips { display: flex; flex-direction: column; gap: 4px; align-self: flex-start; margin-top: 2px; }
.it .chips .chip { margin-top: 0; }
.itx .meta-row { display: flex; align-items: center; gap: 8px; }
.itx .meta-row .n { font-size: 11px; font-weight: 700; color: var(--mute); margin-top: 5px; }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; background: #FAFBFD; }
@media (max-width: 1099px) { .thread { max-height: none; } }
.daysep { display: flex; justify-content: center; margin: 6px 0 2px; }
.daysep span { font-size: 11px; font-weight: 800; color: var(--mute); background: var(--line2); padding: 2px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.callcard { align-self: stretch; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.callcard.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.cc-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.cc-hd .mt { font-size: 12px; color: var(--mute); font-weight: 700; }
.cc-hd .res { margin-top: 0; margin-left: auto; }
.cc-sum { font-size: 14px; color: var(--ink2); }
.cc-tr summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--brand); }
.cc-tr .msgs { margin-top: 8px; }
.sysline { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink2); padding: 4px 2px; }
.sysline .d { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--ok); }
.sysline .d.w { background: var(--warn); }
.sysline.warn { color: var(--warn-ink); }
.hl { outline: 2px solid var(--brand-soft); outline-offset: 2px; }

/* Oggi: viste Elenco / Distinta / Lista d'attesa */
.seg.views { margin: 0; }
.seg.views a { padding: 0 8px; }
@media (max-width: 600px) { .seg.views .lg { display: none; } }
.seg.views .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
a.kpi { color: inherit; }
.tblwrap { overflow-x: auto; }
table.dist { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dist th { text-align: left; font-size: 12px; font-weight: 800; color: var(--mute); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dist td { padding: 10px 16px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.dist .n { text-align: center; width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.dist td.big { font-size: 18px; font-weight: 800; }
table.dist tfoot td { font-weight: 800; border-bottom: 0; background: #F7F9FB; }
.dchip { display: inline-block; margin: 0 6px 6px 0; padding: 3px 9px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px; }
.dchip small { font-weight: 600; }
.dnote { display: inline-block; margin: 0 6px 6px 0; padding: 3px 9px; border-radius: 8px; background: #EEF1F5; color: var(--ink2); font-size: 13px; }
.wl-intro { margin: 0; border-bottom: 1px solid var(--line2); }
.wl { display: grid; grid-template-columns: 32px 1fr; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.wl .pos { width: 28px; height: 28px; border-radius: 999px; background: #EDF0F4; color: var(--ink2); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.wl .nm { font-weight: 700; font-size: 16px; }
.wl .tel { font-size: 14px; }
.wl .sub { font-size: 13px; color: var(--mute); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.wl-acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
details.wlcall summary { list-style: none; cursor: pointer; }
details.wlcall summary::-webkit-details-marker { display: none; }
details.wlcall[open] { flex-basis: 100%; order: 3; }
.wl-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.wl-form label { width: 100%; font-size: 13px; font-weight: 800; color: var(--ink2); }
.wl-form .input { flex: 1; min-width: 180px; }
.wl-add { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; background: #F7F9FB; }
.wl-add .field { flex: 1 1 160px; }
.wl-add .field.narrowf { flex: 0 0 90px; }
.wl-add .btn { margin-bottom: 14px; }

/* anteprima messaggio WhatsApp */
.wa-preview { max-width: 360px; background: #E7F6E1; border-radius: 4px 14px 14px 14px; padding: 10px 12px 6px; font-size: 14px; line-height: 1.45; color: #111B21; }
.wa-preview p { margin: 0 0 6px; }
.wa-preview .ft { font-size: 12.5px; color: #667781; }
.wa-preview .btns { display: grid; gap: 1px; margin: 8px -12px -6px; border-top: 1px solid #CFE3C8; }
.wa-preview .btns span { text-align: center; padding: 9px; color: #027EB5; font-weight: 600; background: #E7F6E1; border-bottom: 1px solid #CFE3C8; }
.wa-preview .btns span:last-child { border-bottom: 0; border-radius: 0 0 14px 14px; }

/* avvisi */
.acts-inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.snippet { background: #F4F6F9; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* interruttore (notifiche sul dispositivo) */
.swrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; margin-bottom: 10px; }
.swtxt { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.swstate { font-size: 13px; font-weight: 600; color: var(--mute); }
.swstate.ok { color: var(--ok); }
.swstate.warn { color: var(--warn); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: #CBD2DC; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .55; cursor: default; }
.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* telefono/tablet: il calendario si apre toccando direttamente il campo data, steso sopra l'icona
   (iOS non apre il selettore di un campo nascosto da codice: showPicker lì non funziona) */
@media (pointer: coarse) {
  .pickinput { -webkit-appearance: none; appearance: none; pointer-events: auto; z-index: 2; min-width: 0; font-size: 16px; top: 0; height: 100%; }
}

/* assistente: saluti a scelta e regole dell'assistenza in sola lettura */
.check.opt-line { display: flex; width: 100%; align-items: flex-start; padding: 10px 12px; margin-bottom: 8px; min-height: 0; font-weight: 600; }
.check.opt-line input { margin-top: 2px; flex: none; }
.check.opt-line .hint { font-weight: 500; }
.field .label { display: block; font-size: 13px; font-weight: 800; color: var(--ink2); margin-bottom: 6px; }
ul.plain { margin: 0; padding-left: 18px; }

/* note del giorno (le righe a 0 coperti di MV) */
.daynotes { padding: 4px 16px; }
.daynotes.has { background: var(--warn-bg); border-color: var(--warn-line); }
.dn { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--warn-line); }
.dn-ic { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.dn-tx { flex: 1; font-weight: 700; color: var(--warn-ink); min-width: 0; overflow-wrap: anywhere; }
.dn-tx small { font-weight: 500; color: var(--mute); }
.dn-add { padding: 8px 0; }
.dn-add summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--brand); list-style: none; }
.dn-add summary::-webkit-details-marker { display: none; }
.dn-form { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0 6px; }
@media (min-width: 720px) { .dn-form { grid-template-columns: 1fr 190px auto; } }
.voice-opt audio { width: 100%; max-width: 320px; height: 36px; margin-top: 6px; }
.ob-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.ob-list { margin: 8px 0 12px; padding-left: 18px; list-style: disc; display: grid; gap: 6px; }
.ob-sos { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: var(--r-s); background: #FFF8F2; }
.ob-sos summary { cursor: pointer; }
.ob-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r-s); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
