/* Centrale Operativa CRI v2 */
:root {
  --cri: #CC1F1F; --cri-d: #A31515; --bg: #F3F5F8; --card: #fff; --line: #E3E8EF; --line2: #EEF1F5;
  --tx: #17202E; --mu: #627084; --ok: #2E9E5B; --warn: #E08A00; --ko: #D62828; --blu: #2F6FDB;
  --r: 10px; --sh: 0 1px 2px rgba(16,24,40,.05), 0 2px 8px rgba(16,24,40,.04); --top: 56px;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--tx); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; }
.mu { color: var(--mu); } .xs { font-size: .74rem; } .min-w-0 { min-width: 0; }
.up, .up-text { text-transform: uppercase; }
.up::placeholder { text-transform: none; }
.env-band { background: repeating-linear-gradient(45deg, #FFE08A, #FFE08A 12px, #FFD45C 12px, #FFD45C 24px); color: #5A4300; font-weight: 700; font-size: .75rem; text-align: center; padding: 3px 8px; }
.cross { width: 26px; height: 26px; position: relative; flex: none; display: inline-block; background: #fff; border-radius: 6px; }
.cross::before, .cross::after { content: ""; position: absolute; background: var(--cri); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.cross::before { width: 16px; height: 5px; } .cross::after { width: 5px; height: 16px; }

/* pagine semplici */
.page-plain { min-height: 100vh; background: linear-gradient(160deg, #F8E3E3 0%, var(--bg) 45%); }
.plain-card { max-width: 520px; margin: 7vh auto 30px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(16,24,40,.08); }

/* barra superiore */
.topbar { position: sticky; top: 0; z-index: 1030; background: var(--cri); color: #fff; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 14px; box-shadow: 0 2px 10px rgba(120,0,0,.25); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; white-space: nowrap; }
.topbar .brand small { display: block; font-weight: 500; opacity: .85; font-size: .7rem; }
.topbar .spacer { flex: 1; }
.tb-btn { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: .82rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tb-btn:hover { background: rgba(255,255,255,.22); }
.tb-btn.warn { background: #FFC83D; border-color: #FFC83D; color: #3D2B00; }
.tb-btn.warn:hover { background: #FFD66B; }
.tb-btn.on { background: #FFC83D; color: #3D2B00; border-color: #FFC83D; }
.flotta-w { display: flex; align-items: center; gap: 14px; background: #fff; color: var(--tx); border: 0; border-radius: 9px; padding: 3px 14px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.flotta-w span { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.flotta-w small { white-space: nowrap; font-size: .62rem; color: var(--mu); font-weight: 700; letter-spacing: .04em; }
.flotta-w b { color: #fff; border-radius: 6px; min-width: 30px; padding: 1px 7px; font-size: .98rem; margin-top: 2px; }
.flotta-w b.ko { background: var(--ko); } .flotta-w b.ok { background: #1D8A4E; }
.flotta-w i { width: 1px; align-self: stretch; background: var(--line); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(0,0,0,.2); border-radius: 8px; padding: 5px 10px; }
.op-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px; padding: 4px 11px 4px 5px; font-size: .8rem; font-weight: 700; max-width: 220px; }
.op-chip .av { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--cri); display: grid; place-items: center; font-weight: 800; font-size: .7rem; flex: none; }
.op-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessbar { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; background: #FFC107; color: #000; padding: 8px; text-align: center; font-weight: 700; }
.sessbar button { margin-left: 10px; padding: 3px 12px; font-weight: 800; border: 1px solid #000; background: #fff; border-radius: 6px; }

/* indicatori */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 12px 14px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--sh); display: flex; gap: 10px; align-items: center; text-align: left; min-width: 0; }
.kpi:hover { border-color: #CBD3DE; }
.kpi > span:last-child { display: block; min-width: 0; flex: 1; }
.kpi .ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.kpi .n { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .l { display: block; font-size: .72rem; color: var(--mu); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { display: block; font-size: .74rem; color: var(--mu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.alarm { border-color: var(--ko); background: #FFF6F6; } .kpi.alarm .n { color: var(--ko); }
.kpi.attn { border-color: #F1D670; background: #FFFBEA; }

/* schede */
.tabs { display: flex; gap: 2px; padding: 0 14px; margin-top: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: sticky; top: var(--top); z-index: 20; background: var(--bg); }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 11px 12px 9px; font-weight: 700; color: var(--mu); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--tx); }
.tab.on { color: var(--cri); border-bottom-color: var(--cri); }
.tab .cnt { background: var(--line2); color: var(--mu); border-radius: 999px; font-size: .7rem; padding: 1px 7px; font-weight: 800; }
.tab .cnt.hot { background: var(--ko); color: #fff; }
.wrap { padding: 14px; }
.pane { display: none; } .pane.on { display: block; }
.card-x { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 14px; }
.h-x { font-weight: 800; font-size: .92rem; display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: var(--tx); }
.h-x i { color: var(--cri); }
.btn-cri { background: var(--cri); border-color: var(--cri); color: #fff; font-weight: 700; }
.btn-cri:hover, .btn-cri:focus { background: var(--cri-d); border-color: var(--cri-d); color: #fff; }
.btn-xs { padding: 2px 8px; font-size: .76rem; border-radius: 6px; font-weight: 600; }
.chips { display: inline-flex; flex-wrap: wrap; background: var(--line2); border-radius: 8px; padding: 2px; gap: 1px; }
.chips button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: .78rem; color: var(--mu); }
.chips button.on { background: #fff; color: var(--tx); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.bdg { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px; font-size: .7rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.bdg.ok { background: #E3F4EA; color: #1D6E3E; } .bdg.ko { background: var(--ko); color: #fff; } .bdg.warn { background: #FFF4CC; color: #7A5B00; } .bdg.gray { background: var(--line2); color: var(--mu); } .bdg.blu { background: #E6EEFC; color: #1D4FA8; }
.info-box { background: #F6F8FA; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: .88rem; }

/* turno e note */
.note-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.note-cols { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.bacheca { position: sticky; top: calc(var(--top) + 60px); }
.op-badge { display: inline-flex; align-items: center; gap: 7px; background: var(--tx); color: #fff; border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 700; font-size: .8rem; }
.op-badge small { opacity: .7; font-weight: 500; }
.op-badge button { border: 0; background: rgba(255,255,255,.15); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.op-badge button:hover { background: var(--ko); }
.list { display: flex; flex-direction: column; gap: 6px; }
.nota { border: 1px solid var(--line); border-left: 4px solid #B8C2D0; border-radius: 8px; padding: 7px 10px; }
.nota.c-CONSEGNA { border-left-color: var(--blu); } .nota.c-CORTESIA { border-left-color: var(--ok); } .nota.c-SERVIZIO { border-left-color: #7C4DFF; } .nota.c-MEZZI { border-left-color: var(--warn); }
.nota.prom { background: #FFFBEA; border-left-color: var(--ko); }
.nota .hd { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: .76rem; color: var(--mu); }
.nota .hd b { color: var(--tx); }
.nota .tx { white-space: pre-wrap; word-break: break-word; margin-top: 3px; text-transform: uppercase; }
.avviso { border-left: 5px solid; border-radius: 8px; padding: 9px 11px; margin-bottom: 9px; background: #fff; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.avviso.Alta { border-left-color: var(--ko); background: #FFF5F5; } .avviso.Media { border-left-color: #FD7E14; background: #FFF9F2; } .avviso.Bassa { border-left-color: var(--blu); background: #F0F7FF; }
.avviso .t { font-weight: 800; } .avviso .m { white-space: pre-wrap; margin: 4px 0; color: #374151; font-size: .88rem; }
.avviso .f { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; color: var(--mu); border-top: 1px solid rgba(0,0,0,.06); padding-top: 4px; }

/* flotta */
.prenot { color: #1D4FA8; background: #EEF3FD; border-radius: 6px; padding: 2px 6px; } .prenot.ora { color: #7A3E00; background: #FFF1DB; font-weight: 700; }
.dimenticate { border-color: #F1D670; background: #FFFDF3; }
.flotta { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 10px; }
.mz { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; border-top: 4px solid var(--ok); background: #fff; display: flex; flex-direction: column; gap: 4px; }
.mz.fuori { border-top-color: var(--ko); background: #FFF8F8; } .mz.fs { border-top-color: #8C98A8; background: #F7F8FA; } .mz.lunga { box-shadow: 0 0 0 2px #F6C23E inset; }
.mz .tg { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 6px; }
.mz .mo { font-size: .76rem; color: var(--mu); }
.mz .dt { font-size: .82rem; }
.mz .acts { margin-top: auto; padding-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }

/* tabelle */
.tbl-mov { width: 100%; font-size: .84rem; border-collapse: separate; border-spacing: 0; }
.tbl-mov th { background: #F6F8FA; color: var(--mu); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; text-align: center; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl-mov td { border-bottom: 1px solid var(--line2); padding: 6px; vertical-align: middle; text-align: center; }
.tbl-mov .tl, .tbl-mov td.tl { text-align: left; }
.tbl-mov tr.annullato td { color: #A0A8B5; text-decoration: line-through; background: #FBFBFC; }
.tbl-mov tr.aperto td { background: #FFF8F8; }
.tbl-mov tr.anom td { background: #FFFBEA; }
.tbl-mov td.up-text { text-transform: uppercase; }
.ed { border: 0; background: none; color: var(--mu); padding: 0 3px; font-size: .78rem; }
.ed:hover { color: var(--cri); }
.km-d { font-weight: 800; }
.anom-i { color: #C77700; cursor: help; }

/* statistiche */
.stat-tot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tot div { background: #F6F8FA; border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; }
.stat-tot span { display: block; font-size: .74rem; text-transform: uppercase; color: var(--mu); font-weight: 700; letter-spacing: .03em; }
.stat-tot b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.tbl-stat { width: 100%; font-size: .86rem; }
.tbl-stat th { color: var(--mu); font-size: .72rem; text-transform: uppercase; border-bottom: 1px solid var(--line); padding: 5px 6px; }
.tbl-stat td { border-bottom: 1px solid var(--line2); padding: 6px; font-variant-numeric: tabular-nums; }
.tbl-stat .tr { text-align: right; }
.barra { height: 10px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--cri); border-radius: 99px; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.cal-grid iframe { border: 0; width: 100%; height: 100%; }

/* accesso */
.login-ovl { position: fixed; inset: 0; z-index: 3000; background: rgba(23,32,46,.92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-ovl[hidden] { display: none; }
.login-box { background: #fff; border-radius: 14px; padding: 26px; width: min(100%, 380px); border-top: 6px solid var(--cri); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.login-brand .cross { background: var(--cri); width: 40px; height: 40px; border-radius: 10px; }
.login-brand .cross::before { width: 24px; height: 7px; background: #fff; } .login-brand .cross::after { width: 7px; height: 24px; background: #fff; }
.login-brand b { display: block; font-size: 1.12rem; } .login-brand small { color: var(--mu); }

.toastbox { position: fixed; right: 14px; bottom: 14px; z-index: 3100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast-i { background: var(--tx); color: #fff; padding: 9px 13px; border-radius: 9px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-weight: 600; font-size: .86rem; }
.toast-i.err { background: var(--ko); } .toast-i.ok { background: #1D6E3E; }

@media (max-width: 1399px) { .note-cols { grid-template-columns: 1fr; } }
@media (max-width: 1199px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .note-grid { grid-template-columns: 1fr; } .bacheca { position: static; order: -1; } }
@media (max-width: 767px) {
  .kpis { display: flex; overflow-x: auto; scrollbar-width: none; } .kpi { flex: 0 0 62%; }
  .topbar .brand .txt, .hide-sm, .clock { display: none; }
  .flotta-w { padding: 3px 8px; gap: 7px; } .flotta-w small { font-size: .5rem; }
  .op-chip span:last-child { display: none; } .op-chip { padding: 4px; }
  .cal-grid { grid-template-columns: 1fr; } .stat-tot { grid-template-columns: 1fr; }
}

/* codice radio del mezzo */
.tg .radio{background:#1F2937;color:#fff;border-radius:5px;padding:0 6px;font-size:.78em;font-weight:700;letter-spacing:.02em}
