/* TVS — couleurs de la charte commune, mise en page alignée sur la Box. */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--kb-font); color: var(--kb-text); background: var(--kb-bg); font-size: 13px; }
button, input, select, textarea { font-family: inherit; font-size: 13px; }
.mono { font-family: var(--kb-mono); }
.muted { color: var(--kb-muted); }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.tv-top { display: flex; align-items: center; gap: 12px; background: var(--kb-primary); color: #fff; padding: 0 16px; height: 56px; }
.tv-brand { display: flex; align-items: center; gap: 10px; }
.tv-brand .logo-img { width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; overflow: hidden; }
.tv-brand .logo-img.has-logo { width: auto; max-width: 90px; background: #fff; padding: 3px 6px; }
.tv-brand .logo-text { font-weight: 700; font-size: 14px; line-height: 1.1; }
.tv-brand .logo-text small { display: block; font-weight: 500; font-size: 10px; opacity: .8; }
.tv-top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; }
.tv-top-right select { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 4px 8px; }
.tv-top-right select option { color: var(--kb-text); }
.tv-top-right a { color: #fff; text-decoration: none; }

.tv-main { padding: 14px 16px 40px; }
.tv-empty { padding: 40px; text-align: center; color: var(--kb-muted); }
.tv-card { background: var(--kb-surface); border: 1px solid var(--kb-border); border-radius: var(--kb-radius); box-shadow: var(--shadow-sm); }
.tv-alerte { background: var(--kb-st-warn-bg); color: var(--kb-st-warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

.tv-tiles { display: flex; gap: 10px; padding: 14px; flex-wrap: wrap; }
.tv-tile { width: 160px; height: 104px; border: 1px solid var(--kb-border); background: #f4f4f6; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--kb-muted-strong); }
.tv-tile:hover { border-color: var(--kb-primary); }
.tv-tile .n { font-size: 40px; font-weight: 300; line-height: 1; color: #555; }
.tv-tile .l { font-size: 13px; margin-top: 6px; }
.tv-tile.active { background: var(--kb-primary-light); border-color: #9fc9ec; }
.tv-tile.active .l { font-weight: 700; color: var(--kb-text); }
.tv-tile.total { cursor: default; width: 200px; }
.tv-tile.total .n { font-size: 28px; }

.tv-bar { display: flex; align-items: center; gap: 10px; padding: 0 14px 10px; flex-wrap: wrap; }
.tv-bar input[type=search] { padding: 6px 10px; border: 1px solid var(--kb-border); border-radius: 6px; width: 260px; }
.tv-bar .sp { flex: 1; }
.tv-btn { background: var(--kb-surface); border: 1px solid var(--kb-border); color: var(--kb-text); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tv-btn:hover { border-color: var(--kb-primary); }
.tv-btn.primary { background: var(--kb-primary); border-color: var(--kb-primary); color: #fff; }
.tv-btn.primary:hover { background: var(--kb-primary-dark); }
.tv-btn.danger { color: var(--kb-danger); }
.tv-btn:disabled { opacity: .45; cursor: default; }
.tv-link { background: none; border: 0; color: var(--kb-primary); cursor: pointer; padding: 0; }

.tv-table-wrap { overflow: auto; border-top: 1px solid var(--kb-border); max-height: calc(100vh - 300px); }
table.tv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tv-table th { position: sticky; top: 0; background: #ececee; font-weight: 600; text-align: left; padding: 8px 8px; border-right: 1px solid #dcdce0; cursor: pointer; white-space: nowrap; z-index: 1; }
.tv-table td { padding: 6px 8px; border-bottom: 1px solid var(--kb-border-light); white-space: nowrap; }
.tv-table tbody tr { cursor: pointer; }
.tv-table tbody tr:hover td { background: var(--kb-hover-row); }
.tv-table td.wrap { white-space: normal; }
.tv-table tr.off td { color: var(--kb-faint); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--kb-st-neutral-bg); color: var(--kb-st-neutral); }
.pill.info { background: var(--kb-st-info-bg); color: var(--kb-st-info); }
.pill.ok { background: var(--kb-st-ok-bg); color: var(--kb-st-ok); }
.pill.warn { background: var(--kb-st-warn-bg); color: var(--kb-st-warn); }
.pill.danger { background: var(--kb-st-danger-bg); color: var(--kb-st-danger); }

/* Fenêtres */
.tv-overlay { position: fixed; inset: 0; background: rgba(20,24,32,.35); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow: auto; }
.tv-modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,.2)); width: 100%; max-width: 1180px; }
.tv-modal.small { max-width: 520px; }
.tv-modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--kb-border); }
.tv-modal-head h2 { margin: 0; font-size: 16px; }
.tv-modal-head .x { margin-left: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--kb-muted); }
.tv-modal-body { padding: 16px 18px; }
.tv-modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--kb-border); }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 18px; margin-bottom: 14px; }
.tv-field label { display: block; font-size: 11px; color: var(--kb-muted-strong); margin-bottom: 3px; }
.tv-field input, .tv-field select, .tv-field textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--kb-border); border-radius: 6px; background: #fff; }
.tv-field textarea { min-height: 60px; resize: vertical; }
.tv-section { font-weight: 700; margin: 16px 0 8px; font-size: 13px; }
.tv-totaux { display: flex; gap: 22px; padding: 10px 14px; background: var(--kb-bg); border-radius: 8px; margin-top: 10px; }
.tv-totaux b { font-size: 16px; }
.tv-journal { font-size: 12px; color: var(--kb-muted-strong); max-height: 160px; overflow: auto; }
.tv-journal div { padding: 3px 0; border-bottom: 1px solid var(--kb-border-light); }
.tv-copy { display: flex; gap: 6px; }
.tv-copy input { flex: 1; font-family: var(--kb-mono); font-size: 11px; }
.tv-comment { background: var(--kb-st-info-bg); border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; }
.tv-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d1d1f; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; }
.tv-toast.err { background: var(--kb-danger); }
.tv-exp { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; font-weight: 700; text-decoration: none; background: var(--kb-st-danger-bg); color: var(--kb-st-danger); line-height: 16px; }
.tv-exp.xls { background: var(--kb-st-ok-bg); color: var(--kb-st-ok); }
.tv-exp:hover { filter: brightness(.92); }

.tv-bar input#tv-plaque { width: 230px; text-transform: uppercase; }
.tv-plaques { margin: 0 14px 10px; padding: 8px 10px; border: 1px solid var(--kb-border); border-radius: 8px; font-size: 13px; max-height: 260px; overflow: auto; }
.tv-plaques table { margin-top: 6px; }
.tv-plaques tr[data-d] { cursor: pointer; }
.tv-plaques tr[data-d]:hover td { background: rgba(0,0,0,.04); }
.tv-plaques mark { background: #ffe066; color: inherit; padding: 0; border-radius: 2px; }

/* Carte grise dans la fiche véhicule (04/11/2026) */
.tv-cg { margin-top: 12px; padding: 10px; border: 1px dashed var(--kb-border); border-radius: 6px; }
.tv-cg.survol { border-color: var(--kb-primary); background: var(--kb-surface); }
.tv-cg > label { display: block; font-weight: 600; margin-bottom: 6px; }
.tv-cg-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tv-cg-aide { font-size: 11px; opacity: .7; }

/* Tableau de bord par véhicule (04/11/2026) */
.tv-tile .sous { font-size: 11px; color: var(--kb-danger); margin-top: 2px; }
.tv-chip { background: var(--kb-surface); border: 1px solid var(--kb-border); border-radius: 14px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.tv-chip:hover { border-color: var(--kb-primary); }
.tv-chip.active { background: var(--kb-primary-light); border-color: #9fc9ec; font-weight: 600; }
.tv-table td.tv-c { text-align: center; }
.tv-cg-pic { text-decoration: none; font-size: 16px; }
.tv-cg-non { color: var(--kb-danger); font-weight: 700; }
.tv-table td.tv-ko { background: var(--kb-st-danger-bg); color: var(--kb-st-danger); }
.tv-table td.tv-ko .fl { font-weight: 400; }
.tv-table td.tv-errs { min-width: 320px; font-size: 11px; color: var(--kb-st-danger); }
