:root{--bg:#f6f7fb;--card:#fff;--text:#172033;--muted:#667085;--line:#d9deea;--primary:#1d4ed8;--danger:#b42318;--ok:#067647;--warn:#b54708}
*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}a{color:var(--primary);text-decoration:none}input,textarea,select,button{font:inherit}input,textarea,select{width:100%;padding:.7rem;border:1px solid var(--line);border-radius:.7rem;background:#fff}textarea{min-height:88px}.container{max-width:1180px;margin:0 auto;padding:1.2rem}.topbar{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.2rem;background:#101828;color:#fff}.topbar a,.topbar .link-button{color:#fff;margin-left:1rem}.inline{display:inline}.link-button{background:none;border:0;cursor:pointer}.panel,.card,.auth-card,.mobile-card{background:var(--card);border:1px solid var(--line);border-radius:1rem;box-shadow:0 8px 24px rgba(16,24,40,.06)}.panel{padding:1rem;margin:1rem 0}.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}.card{padding:1rem}.metric{display:block;font-size:2rem;font-weight:800}.grid{display:grid;gap:1rem}.grid.two{grid-template-columns:1fr 1fr}.stack{display:grid;gap:.9rem}.stack.compact{gap:.4rem}.row-form{display:flex;gap:.6rem;align-items:center}.auth-body,.mobile-body{display:grid;min-height:100vh;place-items:center;padding:1rem}.auth-card,.mobile-card{width:min(100%,460px);padding:1.2rem}.mobile-card{font-size:1.05rem}.muted{color:var(--muted)}.small{font-size:.85rem}.alert{background:#fef3f2;border:1px solid #fecdca;color:var(--danger);padding:.8rem;border-radius:.8rem;margin:.7rem 0}.success{background:#ecfdf3;border:1px solid #abefc6;color:var(--ok);padding:.8rem;border-radius:.8rem;margin:.7rem 0}.badge{display:inline-block;padding:.25rem .55rem;border-radius:99px;background:#eff4ff;color:#3538cd;font-size:.82rem}.badge.ok{background:#ecfdf3;color:var(--ok)}.badge.bad{background:#fef3f2;color:var(--danger)}.warn{border-color:#fedf89}table{width:100%;border-collapse:collapse}th,td{padding:.7rem;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}th{font-size:.85rem;color:var(--muted);font-weight:650}.actions{display:flex;gap:.6rem;flex-wrap:wrap}button,.button{border:1px solid #bfdbfe;border-radius:.8rem;padding:.7rem 1rem;background:#eff6ff;color:var(--primary);cursor:pointer;display:inline-block;text-align:center;font-weight:650;transition:background .15s ease,border-color .15s ease,transform .05s ease,box-shadow .15s ease}.button:hover,button:hover{background:#dbeafe;border-color:#93c5fd;box-shadow:0 1px 2px rgba(16,24,40,.08)}.button:active,button:active{transform:translateY(1px)}.button:disabled,button[disabled]{background:#e4e7ec;border-color:#e4e7ec;color:#98a2b3;cursor:not-allowed;box-shadow:none;transform:none}.primary{background:var(--primary);border-color:var(--primary);color:#fff}.primary:hover{background:#1e40af;border-color:#1e40af;color:#fff}.danger{background:var(--danger);border-color:var(--danger);color:#fff}.danger:hover{background:#912018;border-color:#912018;color:#fff}.secondary{background:#f2f4f7;border-color:#d0d5dd;color:#344054}.secondary:hover{background:#e4e7ec;border-color:#c8ced8;color:#101828}.big{width:100%;font-weight:750;margin-top:.7rem}.events{list-style:none;padding:0;margin:0}.events li{padding:.5rem 0;border-bottom:1px solid var(--line)}.code{font-size:1.4rem;letter-spacing:.1rem}.copy-input{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.85rem}.qr{width:90px;height:90px}
@media(max-width:860px){.cards,.grid.two{grid-template-columns:1fr}.topbar{align-items:flex-start;gap:.8rem;flex-direction:column}.topbar a,.topbar .link-button{margin-left:0;margin-right:1rem}.row-form{flex-direction:column;align-items:stretch}table{font-size:.9rem}}
.details{display:grid;grid-template-columns:150px 1fr;gap:.45rem .8rem}.details dt{color:var(--muted);font-weight:650}.details dd{margin:0}.photos{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:1rem}.photo-card{display:grid;gap:.4rem;border:1px solid var(--line);border-radius:.9rem;padding:.6rem;background:#fff;color:var(--text)}.photo-card img{width:100%;height:150px;object-fit:cover;border-radius:.6rem;background:#eef2f6}.report-section{padding:.75rem;border:1px dashed var(--line);border-radius:.8rem;background:#fafbff;margin:.4rem 0}
.filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.8rem;align-items:end}.filter-actions{display:flex;gap:.6rem;align-items:end}.toolbar{display:flex;gap:.6rem;flex-wrap:wrap;margin-top:.9rem}.export-toolbar button{width:auto}.checkbox{display:flex;gap:.5rem;align-items:center;min-height:46px}.checkbox input{width:auto}.nowrap{white-space:nowrap}
@media(max-width:960px){.filter-grid{grid-template-columns:1fr 1fr}}
@media(max-width:640px){.filter-grid{grid-template-columns:1fr}.toolbar .button,.toolbar button{width:100%}}
.offline-warning{background:#fffaeb;border:1px solid #fedf89;color:var(--warn);padding:.8rem;border-radius:.8rem;margin:.7rem 0}.offline-indicator{display:inline-block;padding:.2rem .5rem;border-radius:99px;background:#fffaeb;color:var(--warn);font-size:.78rem}.status-dot{display:inline-block;width:.55rem;height:.55rem;border-radius:50%;background:#98a2b3;margin-right:.35rem}.status-dot.ok{background:var(--ok)}.status-dot.bad{background:var(--danger)}
.details-inline{display:inline-block}.details-inline summary{cursor:pointer;color:var(--primary);font-weight:650}.reset-form{width:260px;margin-top:.6rem;padding:.7rem;border:1px solid var(--line);border-radius:.8rem;background:#fff}.role-form select{min-width:120px}.security-note{padding:.8rem;border-radius:.8rem;background:#eff4ff;border:1px solid #b2ccff;color:#3538cd;margin:.7rem 0}

/* v6 UI/deployment polish */
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;margin:1rem 0 1.2rem}.page-head h1{margin:.1rem 0}.topbar nav{display:flex;align-items:center;gap:.85rem;flex-wrap:wrap}.topbar a,.topbar .link-button{margin-left:0}.quick-actions{margin-top:.2rem}.cards.cards-six{grid-template-columns:repeat(6,minmax(0,1fr))}.success-panel{border-color:#abefc6;background:#f6fef9}.warning-list li{color:var(--danger)}.checklist{padding-left:1.2rem}.checklist li{margin:.55rem 0}.checklist.numbered li{padding-left:.2rem}.empty-state{padding:1rem;border:1px dashed var(--line);border-radius:.9rem;background:#fafbff;color:var(--muted)}code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}pre{white-space:pre-wrap;background:#f2f4f7;border:1px solid var(--line);border-radius:.7rem;padding:.7rem;max-width:480px}.scan-card{overflow:hidden}.scan-hero{margin:-1.2rem -1.2rem 1rem;padding:1.1rem 1.2rem;background:linear-gradient(135deg,#eff4ff,#f6fef9);border-bottom:1px solid var(--line)}.scan-hero h1{margin:.45rem 0 .2rem}.driver-chip{display:inline-block;background:#f2f4f7;border:1px solid var(--line);border-radius:999px;padding:.45rem .7rem}.action-hint{background:#f8fafc;border:1px solid var(--line);padding:.8rem;border-radius:.8rem}.mobile-card .button,.mobile-card button{min-height:48px}.mobile-card form + form,.mobile-card form + a,.mobile-card a + button{margin-top:.5rem}
@media(max-width:1180px){.cards.cards-six{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){.page-head{flex-direction:column}.cards.cards-six{grid-template-columns:1fr 1fr}.topbar nav{gap:.55rem}.topbar a,.topbar .link-button{font-size:.92rem}.container{padding:.85rem}th,td{padding:.55rem}.panel{padding:.85rem}}
@media(max-width:520px){.cards.cards-six{grid-template-columns:1fr}.details{grid-template-columns:1fr}.actions{width:100%}.actions .button{width:100%}}
.badge.warn{background:#fffaeb;color:#b54708}pre{white-space:pre-wrap;background:#f8fafc;border:1px solid var(--line);border-radius:.8rem;padding:1rem;overflow:auto}.warning-list li{margin:.35rem 0}.success-panel{border-color:#abefc6}.cards-six{grid-template-columns:repeat(6,minmax(0,1fr))}@media(max-width:900px){.cards-six,.cards{grid-template-columns:repeat(2,minmax(0,1fr))}.grid.two{grid-template-columns:1fr}.topbar{align-items:flex-start;gap:.7rem;flex-direction:column}.topbar a,.topbar .link-button{margin-left:0;margin-right:.7rem}}

.badge.info{background:#eff4ff;color:#3538cd}.badge.resolved{background:#dbeafe;color:#1d4ed8}.row-resolved{background:#f8fbff}.row-resolved td{border-bottom-color:#bfdbfe}.row-resolved strong{color:#1d4ed8}

/* v17 active admin navigation */
.topbar nav a.active{
  background:#2563eb;
  color:#fff;
  border-radius:.55rem;
  padding:.42rem .68rem;
  font-weight:750;
  box-shadow:0 0 0 1px rgba(255,255,255,.16) inset;
}
.topbar nav a.active:hover{background:#1d4ed8;color:#fff}
.topbar nav a:focus-visible,.topbar .link-button:focus-visible{outline:2px solid #93c5fd;outline-offset:3px;border-radius:.45rem}
@media(max-width:760px){.topbar nav a.active{padding:.32rem .52rem}}

/* v18: export and neutral action buttons are visibly clickable */
.toolbar .button,.toolbar button,.export-toolbar .button,.export-toolbar button{min-width:64px}

/* v19: responsive topbar, consistent logout visibility */
.topbar{
  flex-wrap:wrap;
  gap:.65rem 1rem;
  overflow-x:hidden;
}
.topbar .brand{
  flex:0 0 auto;
  white-space:nowrap;
}
.topbar nav.admin-nav{
  flex:1 1 720px;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:.55rem .82rem;
  flex-wrap:wrap;
}
.topbar nav.admin-nav a,
.topbar nav.admin-nav .link-button{
  margin:0;
  white-space:nowrap;
  line-height:1.2;
}
.topbar .logout-form{
  display:inline-flex;
  align-items:center;
  margin:0;
}
.topbar .logout-button{
  padding:.25rem .35rem;
  border-radius:.45rem;
}
.topbar .logout-button:hover{
  background:rgba(255,255,255,.12);
}
@media(max-width:980px){
  .topbar{align-items:flex-start;justify-content:flex-start}
  .topbar nav.admin-nav{justify-content:flex-start;flex-basis:100%;gap:.5rem .7rem}
}
@media(max-width:520px){
  .topbar nav.admin-nav a,
  .topbar nav.admin-nav .link-button{font-size:.9rem}
}

/* v20: mobile combined report form */
.report-bundle-section{margin:.65rem 0;padding:.85rem}
.checkbox-row{display:flex;align-items:flex-start;gap:.7rem;cursor:pointer}
.checkbox-row input[type="checkbox"]{width:auto;margin-top:.25rem;min-width:18px;min-height:18px}
.report-toggle strong{display:inline-block;margin-bottom:.15rem}
.report-bundle-section .report-section{margin-top:.75rem}

/* v24: tag actions are visible and consistent in vehicle list and tag details */
.compact-toolbar{margin-top:.45rem;gap:.45rem}
.compact-toolbar button{padding:.45rem .7rem;border-radius:.65rem;font-size:.9rem}

/* v26: driver time summary and return-report warning */
.notice{background:#eff4ff;border:1px solid #bfdbfe;color:#1e3a8a;padding:.8rem;border-radius:.8rem;margin:.7rem 0}
.filters-inline{display:flex;align-items:end;gap:.75rem;flex-wrap:wrap;margin:.75rem 0 1rem}
.filters-inline label{min-width:180px}.filters-inline input{width:100%}
.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.85rem;margin-top:.9rem}
.stat-card{border:1px solid var(--line);border-radius:.9rem;background:#f8fafc;padding:1rem;display:flex;flex-direction:column;gap:.25rem}
.stat-card strong{font-size:1.45rem;color:var(--text)}
.stat-card small{color:var(--muted)}
@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.stats-grid{grid-template-columns:1fr}}

/* v27: mobile driver logout button */
.mobile-account-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  flex-wrap:wrap;
  margin:.35rem 0 1rem;
}
.mobile-account-row .driver-chip{margin:0}
.mobile-account-row form{margin:0}
button.small,.button.small{
  padding:.48rem .75rem;
  border-radius:.75rem;
  font-size:.95rem;
  font-weight:750;
}
.mobile-logout-inline{display:flex;justify-content:flex-end;margin:.4rem 0 .8rem}
@media(max-width:520px){
  .mobile-account-row{align-items:stretch}
  .mobile-account-row .driver-chip{flex:1 1 auto}
  .mobile-account-row form{flex:0 0 auto}
}

/* v34: readable import CSV format helper */
.import-format-card .compact-head{margin-top:0}
.format-table,.csv-preview-table{margin:.55rem 0 1rem;background:#fff;border:1px solid var(--line);border-radius:.9rem;overflow:hidden;border-collapse:separate;border-spacing:0}
.format-table th,.format-table td,.csv-preview-table th,.csv-preview-table td{border-bottom:1px solid var(--line)}
.format-table tr:last-child td,.csv-preview-table tr:last-child td{border-bottom:0}
.format-table td:first-child,.csv-preview-table th,.csv-preview-table td{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.format-table td:first-child{font-weight:750;color:#1d4ed8;white-space:nowrap}
.csv-preview-table th{background:#f8fafc;color:#344054;font-weight:750}
.import-advanced{margin-top:1rem;padding:.8rem;border:1px dashed var(--line);border-radius:.85rem;background:#fafbff;width:100%}
.import-advanced ul{margin:.4rem 0 0;padding-left:1.15rem}
.import-advanced li{margin:.35rem 0}
@media(max-width:760px){.format-table,.csv-preview-table{display:block;overflow-x:auto}.import-format-card .actions .button{width:100%}}

/* v36: OCR helper for odometer/fuel photo */
.ocr-box{margin:.45rem 0 .8rem;padding:.75rem;border:1px dashed var(--line);border-radius:.85rem;background:#f8fafc}
.ocr-box button{margin-bottom:.35rem}
.ocr-box pre{white-space:pre-wrap;word-break:break-word;background:#fff;border:1px solid var(--line);border-radius:.65rem;padding:.65rem;max-height:160px;overflow:auto}
.ocr-ok{color:#047857!important;font-weight:700}.ocr-warn{color:#b45309!important;font-weight:700}.ocr-error{color:#b42318!important;font-weight:700}

/* v37 camera capture UI */
.camera-input-actions{display:flex;flex-direction:column;gap:.4rem;margin-top:.55rem}
.camera-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:1rem}
.camera-modal[hidden]{display:none!important}
.camera-modal-backdrop{position:absolute;inset:0;background:rgba(10,16,30,.68);backdrop-filter:blur(2px)}
.camera-panel{position:relative;width:min(560px,100%);background:#fff;border:1px solid #d8e0ef;border-radius:20px;box-shadow:0 30px 90px rgba(10,16,30,.35);padding:1rem;display:flex;flex-direction:column;gap:.8rem}
.camera-panel-header{display:flex;align-items:center;justify-content:space-between;gap:.8rem}
.camera-preview,.camera-canvas{width:100%;max-height:58vh;object-fit:contain;background:#0f172a;border-radius:16px;border:1px solid #d8e0ef}
.camera-actions{display:flex;gap:.6rem;flex-wrap:wrap}.camera-actions button{flex:1 1 140px}
.camera-status{margin:0}.camera-modal .ocr-ok{color:#047857}.camera-modal .ocr-warn{color:#b45309}.camera-modal .ocr-error{color:#b91c1c}
@media(max-width:640px){.camera-panel{max-height:92vh;overflow:auto}.camera-preview,.camera-canvas{max-height:48vh}.camera-actions{flex-direction:column}}

/* v43: visible conflict and automatic 8h session closure details */
.row-conflict{background:#fff7ed}
.row-conflict td{border-bottom-color:#fed7aa}
.row-auto-closed{background:#fff1f2}
.row-auto-closed td{border-bottom-color:#fecdd3}
.session-status-cell{min-width:260px}
.conflict-box,.session-critical-box{
  display:grid;
  gap:.28rem;
  padding:.65rem .75rem;
  border-radius:.85rem;
  border:1px solid var(--line);
}
.conflict-box{background:#fffbeb;border-color:#fcd34d;color:#713f12}
.session-critical-box{background:#fef2f2;border-color:#fca5a5;color:#7f1d1d;font-weight:650}
.session-critical-box .badge,.conflict-box .badge{justify-self:start;margin-bottom:.15rem}
.session-critical-box strong,.conflict-box strong{color:inherit}
@media(max-width:760px){.session-status-cell{min-width:0}.conflict-box,.session-critical-box{font-size:.94rem}}

/* v55: factory reset danger zone */
.danger-zone{border-color:#fecdca;background:#fff7f5}
.danger-zone h2{color:var(--danger)}
.danger-zone ul{margin:.6rem 0 1rem 1.2rem}
.danger-zone code{background:#fff;border:1px solid #fecdca;color:var(--danger);padding:.1rem .3rem;border-radius:.35rem}

/* v58: one-click backups */
.subpanel{border:1px dashed var(--line);border-radius:.9rem;background:#f8fafc;padding:1rem;margin-top:1rem}
.subpanel h3{margin-top:0}
.tiny-input{max-width:120px;padding:.45rem .55rem;border-radius:.55rem}
.actions .tiny-input{margin-right:.35rem}

/* v63: session start/end locations */
.location-cell{min-width:150px}
.location-cell .button.small{margin-bottom:.25rem}
.location-cell .small{line-height:1.35}

/* v64: mileage conflict review */
.mileage-actions{min-width:220px}
.mileage-actions form{margin-bottom:.45rem}
.mileage-actions input[name="note"]{min-width:190px}
