body { background: var(--bs-tertiary-bg); }
.navbar-brand i { font-size: 1.2em; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); display: inline-block; }
.live-dot.on { background: #20c997; border-color: #20c997; box-shadow: 0 0 0 0 rgba(32,201,151,.6); animation: livepulse 2s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(32,201,151,.6);} 70% { box-shadow: 0 0 0 8px rgba(32,201,151,0);} 100% { box-shadow: 0 0 0 0 rgba(32,201,151,0);} }
.live-flash { animation: liveflash 1.2s ease-out; }
@keyframes liveflash { from { box-shadow: 0 0 0 3px rgba(13,110,253,.35); } to { box-shadow: 0 0 0 0 rgba(13,110,253,0); } }
.pulse { animation: pulseb 1.6s infinite; }
@keyframes pulseb { 50% { box-shadow: 0 0 0 4px rgba(220,53,69,.25); } }
.kpi:hover { border-color: var(--bs-primary); }
.res-row { cursor: pointer; }
.msg-body { white-space: pre-wrap; word-break: break-word; background: var(--bs-tertiary-bg); padding: .5rem; border-radius: .375rem; }
.toast { min-width: 320px; }

/* stati check-in */
.st-pending { --st: #adb5bd; --st-bg: #f1f3f5; --st-fg: #495057; }
.st-sent { --st: #0dcaf0; --st-bg: #e7f8fc; --st-fg: #055160; }
.st-in_progress { --st: #ffc107; --st-bg: #fff6d6; --st-fg: #664d03; }
.st-submitted { --st: #dc3545; --st-bg: #fbe3e5; --st-fg: #842029; }
.st-approved { --st: #198754; --st-bg: #d9f2e4; --st-fg: #0f5132; }
.st-rejected { --st: #212529; --st-bg: #dee2e6; --st-fg: #212529; }
.legend { padding: .1rem .5rem; border-radius: 1rem; background: var(--st-bg); color: var(--st-fg); border: 1px solid var(--st); }

/* tableau */
.tb-wrap { overflow-x: auto; }
.tb { --label: 190px; min-width: calc(var(--label) + var(--days) * var(--col)); }
.tb-week { --col: 110px; }
.tb-month { --col: 38px; }
.tb-row { display: flex; border-bottom: 1px solid var(--bs-border-color-translucent); min-height: 40px; }
.tb-label { width: var(--label); flex: 0 0 var(--label); padding: .45rem .6rem; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--bs-body-bg); z-index: 3; border-right: 1px solid var(--bs-border-color); }
.tb-track { flex: 1; position: relative; display: grid; grid-template-columns: repeat(var(--days), 1fr); }
.tb-head { position: sticky; top: 0; z-index: 4; background: var(--bs-body-bg); }
.tb-head .tb-label { font-weight: 600; }
.tb-day { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .75rem; color: var(--bs-secondary-color); text-decoration: none; border-left: 1px solid var(--bs-border-color-translucent); padding: .2rem 0; }
.tb-day strong { font-size: .95rem; color: var(--bs-body-color); }
.tb-day.today { background: rgba(13,110,253,.12); }
.tb-day.today strong { color: var(--bs-primary); }
.tb-cell { border-left: 1px solid var(--bs-border-color-translucent); }
.tb-day.weekend, .tb-cell.weekend { background: rgba(0,0,0,.025); }
.tb-cell.today { background: rgba(13,110,253,.06); }
.tb-prop { padding: .35rem .6rem; font-size: .8rem; font-weight: 600; background: var(--bs-secondary-bg); position: sticky; left: 0; border-bottom: 1px solid var(--bs-border-color-translucent); }
.tb-bar { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; padding: 0 .4rem; font-size: .78rem; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
  background: var(--st-bg); color: var(--st-fg); border: 1px solid var(--st); border-left-width: 5px; z-index: 2; transition: transform .1s; }
.tb-bar:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.15); z-index: 5; }
.tb-bar.st-submitted { animation: pulseb 1.6s infinite; font-weight: 600; }
.tb-month .tb-bar { font-size: .7rem; padding: 0 .25rem; }

/* documenti */
.doc-thumb { position: relative; display: block; width: 260px; max-width: 100%; aspect-ratio: 1.585; border-radius: .5rem; overflow: hidden; border: 1px solid var(--bs-border-color); background: #222; }
.doc-thumb img { width: 100%; height: 100%; object-fit: contain; }
.doc-thumb span { position: absolute; left: 0; bottom: 0; right: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; padding: .15rem .4rem; }
.doc-thumb.empty { background: var(--bs-secondary-bg); }
.doc-thumb.empty span { position: static; background: none; color: var(--bs-secondary-color); display: flex; height: 100%; align-items: center; justify-content: center; }
.zoomable { cursor: zoom-in; max-height: 85vh; }
.zoomable.zoomed { max-height: none; max-width: none; width: 200%; cursor: zoom-out; }
#zoomModal .modal-body { overflow: auto; max-height: 90vh; }
.mrz-raw { font-size: .7rem; letter-spacing: .05em; }
.src { font-size: .62rem; padding: 0 .3rem; border-radius: .25rem; vertical-align: 1px; }
.src-mrz { background: #d1e7dd; color: #0f5132; }
.src-ocr { background: #fff3cd; color: #664d03; }
.src-edit { background: #cfe2ff; color: #084298; }
.src-geo { background: #cfe2ff; color: #084298; }
.src-manual { background: #e2e3e5; color: #41464b; }
.qr { width: 110px; flex: 0 0 110px; }
.qr svg { width: 100%; height: auto; }

/* ricerche AJAX */
body.ajax-loading [data-live] { opacity: .55; transition: opacity .15s; }
body.ajax-loading { cursor: progress; }

/* testi dei messaggi */
.tpl-bubble { background: #e7f8ee; border: 1px solid #c9ead6; border-radius: .75rem .75rem .75rem .2rem; padding: .6rem .8rem; white-space: pre-wrap; font-size: .875rem; }
.tpl textarea { resize: vertical; min-height: 9rem; }

/* pallino delle prenotazioni da gestire */
.nav-dot { position: absolute; top: -.2rem; right: -.75rem; width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 50% !important; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px var(--bs-body-bg); animation: dotpop .3s ease-out; }
.nav-dot.wide { width: auto; min-width: 1.5rem; padding: 0 .35rem; border-radius: .75rem !important; }
@keyframes dotpop { from { transform: scale(.4); } to { transform: scale(1); } }
.row-dot { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; background: var(--bs-danger); margin-right: .45rem; vertical-align: -.05rem; box-shadow: 0 0 0 2px rgba(220,53,69,.18); }
@media (max-width: 991.98px) { .nav-dot { position: static; margin-left: .4rem; vertical-align: .05rem; } }
.row-dot-guest { background: #fd7e14; box-shadow: 0 0 0 2px rgba(253,126,20,.2); }

/* conferma di copia sotto il campo */
.copy-feedback { max-height: 0; opacity: 0; overflow: hidden; transition: opacity .2s, max-height .2s, margin .2s; }
.copy-feedback.show { max-height: 3rem; opacity: 1; margin: .3rem 0 .4rem; }

/* legenda prenotazioni */
.res-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; align-items: center; font-size: .82rem; }
.res-legend .grp { display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: center; }
.res-legend .ttl { font-weight: 600; color: var(--bs-secondary-color); }

/* Alloggiati Web */
.aw-preview { white-space: pre; overflow-x: auto; background: var(--bs-tertiary-bg); padding: .5rem; border-radius: .375rem; font-size: .68rem; }
.aw-picker { position: relative; min-width: 200px; }
.aw-results { position: absolute; z-index: 20; left: 0; right: 0; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.aw-results .list-group-item { padding: .25rem .5rem; cursor: pointer; }
.tb-bar.tb-out { --st: #adb5bd; --st-bg: #e9ecef; --st-fg: #6c757d; animation: none; font-weight: 400; }
.tb-bar.tb-out .bi { display: none; }
.tb-bar.tb-over { box-shadow: 0 0 0 2px #dc3545; z-index: 4; }
.rate-matrix .rate-cell { cursor: pointer; background: var(--bs-tertiary-bg); transition: background .15s; }
.rate-matrix .rate-cell.on { background: rgba(25,135,84,.10); }
.rate-matrix .rate-preview { font-weight: 600; min-height: 1.2em; }
.rc-wrap { max-height: 70vh; }
.rc { font-size: .78rem; user-select: none; }
.rc th, .rc td { text-align: center; vertical-align: middle; padding: .25rem .2rem; white-space: nowrap; }
.rc .rc-type { position: sticky; left: 0; z-index: 2; background: var(--bs-body-bg); text-align: left; min-width: 9rem; }
.rc .rc-day { min-width: 3.4rem; font-weight: 400; }
.rc .rc-we { background: var(--bs-tertiary-bg); }
.rc .rc-today { box-shadow: inset 0 -3px 0 var(--bs-primary); }
.rc .rc-cell { cursor: cell; }
.rc .rc-price { font-weight: 600; }
.rc .rc-meta { font-size: .68rem; min-height: 1em; }
.rc .rc-custom .rc-price, .rc-sample.rc-custom { color: #0d6efd; }
.rc .rc-stop, .rc-sample.rc-stop { background: repeating-linear-gradient(45deg, rgba(220,53,69,.12), rgba(220,53,69,.12) 5px, transparent 5px, transparent 10px) !important; }
.rc .rc-stop .rc-price { text-decoration: line-through; color: #dc3545; }
.rc .rc-sel { outline: 2px solid #0d6efd; outline-offset: -2px; background: rgba(13,110,253,.15) !important; }
.rc-sample { display: inline-block; width: 1em; height: 1em; border: 1px solid var(--bs-border-color); vertical-align: -.15em; background: rgba(13,110,253,.25); }
.rc .rc-base > * { border-top: 2px solid var(--bs-border-color); }
.rc .rc-der .rc-type { padding-left: 1.2rem; }
.rc .rc-der .rc-price { font-weight: 400; color: var(--bs-secondary-color); }
.rc .rc-der.rc-custom .rc-price, .rc .rc-der .rc-custom .rc-price { color: #0d6efd; font-weight: 600; }
.rc.rc-hide-der .rc-der { display: none; }
.rc-panel { position: sticky; bottom: .5rem; z-index: 5; box-shadow: 0 -2px 12px rgba(0,0,0,.08); }
@media (max-width: 991.98px) { .rc-panel { position: static; box-shadow: none; } .rc-wrap { max-height: none; } }
.legend.tb-out-legend { --st: #adb5bd; --st-bg: #e9ecef; --st-fg: #6c757d; }
.tb-cell { display: block; }
.tb-cell:hover { background: rgba(13,110,253,.08); cursor: copy; }
.tb-bar.tb-draft { background: repeating-linear-gradient(45deg, #f8f9fa, #f8f9fa 6px, #e9ecef 6px, #e9ecef 12px); color: #495057; border-style: dashed; border-color: #adb5bd; }

/* Conversazione WhatsApp nella scheda prenotazione */
.wa-thread { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; background: var(--bs-tertiary-bg); }
.wa-msg { max-width: 85%; display: flex; flex-direction: column; }
.wa-msg.wa-in { align-self: flex-start; }
.wa-msg.wa-out { align-self: flex-end; align-items: flex-end; }
.wa-bubble { padding: .35rem .6rem; border-radius: .6rem; background: var(--bs-body-bg); word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa-out .wa-bubble { background: #d9fdd3; color: #111; }
.wa-meta { font-size: .7rem; color: var(--bs-secondary-color); margin-top: .1rem; }
