body { background: #f5f6f8; }
.card-stat .num { font-size: 2rem; font-weight: 600; }
.login-box { max-width: 380px; margin: 8vh auto; }
.table td, .table th { vertical-align: middle; }

/* Hours of service screen */
.hos-app { max-width: 460px; }
.hos-current { display: flex; align-items: center; gap: .9rem; background: #fff; border: 2px solid #f59e0b; border-radius: 14px; padding: .9rem 1rem; margin-bottom: .8rem; }
.hos-current.hos-s-driving { border-color: #16a34a; }
.hos-current.hos-s-sleeper { border-color: #7c3aed; }
.hos-current.hos-s-off_duty, .hos-current.hos-s-none { border-color: #9ca3af; }
.hos-current-name { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.hos-current-time { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.hos-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 10px; font-size: 1.35rem; color: #fff; background: #f97316; flex: none; }
.hos-s-driving .hos-icon { background: #16a34a; }
.hos-s-sleeper .hos-icon { background: #7c3aed; }
.hos-s-off_duty .hos-icon, .hos-s-none .hos-icon { background: #6b7280; }
.hos-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.hos-btn { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1.5px solid #d1d5db; border-radius: 12px; padding: .65rem .8rem; font-weight: 500; cursor: pointer; margin: 0; }
.hos-btn input { position: absolute; opacity: 0; pointer-events: none; }
.hos-btn:has(input:checked) { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); font-weight: 700; }
.hos-btn:has(input:focus-visible) { outline: 2px solid #2563eb; }
.hos-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; margin-bottom: .5rem; }
.hos-gauge { position: relative; text-align: center; }
.hos-ring { width: 100%; max-width: 170px; display: block; margin: 0 auto; }
.hos-gauge-time { position: absolute; left: 0; right: 0; top: 36%; font-size: 1.7rem; font-weight: 600; color: #1e1b4b; }
.hos-gauge-label { margin-top: -1.6rem; color: #6b7280; font-size: 1.05rem; }
.hos-low .hos-gauge-time { color: #dc2626; }

/* Problem reports */
.issue-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.issue-cat { display: block; border: 1.5px solid #d1d5db; border-radius: 10px; padding: .7rem .8rem; background: #fff; cursor: pointer; margin: 0; }
.issue-cat input { position: absolute; opacity: 0; pointer-events: none; }
.issue-cat:has(input:checked) { border-color: #dc3545; box-shadow: 0 0 0 2px rgba(220, 53, 69, .2); font-weight: 600; }
.issue-cat:has(input:focus-visible) { outline: 2px solid #2563eb; }
.issue-thumb { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid #dee2e6; }
.issue-msg { border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; max-width: 85%; }
.issue-msg.from-driver { background: #fff; border: 1px solid #dee2e6; }
.issue-msg.from-office { background: #e7f1ff; margin-left: auto; }

/* Driver app layout: top bar + bottom tabs */
.driver-app { padding-top: calc(52px + env(safe-area-inset-top)); padding-bottom: calc(64px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
.driver-app main.container { max-width: 640px; padding-top: .75rem; }
.app-top { position: fixed; top: 0; left: 0; right: 0; z-index: 1030; background: #0d6efd; color: #fff;
  padding: env(safe-area-inset-top) .5rem 0; height: calc(52px + env(safe-area-inset-top)); display: flex; align-items: center; gap: .25rem; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.app-title { flex: 1; font-weight: 600; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: .5rem; }
.app-back, .app-refresh { color: #fff; text-decoration: none; background: none; border: 0; font-size: 1.7rem; line-height: 1; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.app-back { font-size: 2.2rem; margin-top: -4px; }
.app-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff; border-top: 1px solid #dee2e6;
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.app-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 62px; font-size: .75rem; color: #6b7280; text-decoration: none; gap: 2px; }
.app-tabs a.active { color: #0d6efd; font-weight: 600; }
.app-tab-icon { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .75; }
.app-tabs a.active .app-tab-icon { filter: none; opacity: 1; }
.driver-app .btn { min-height: 44px; }
.driver-app h1.h3 { font-size: 1.4rem; }
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }

/* Document scanner */
.scanner { position: fixed; inset: 0; z-index: 2000; background: #111; color: #fff; display: flex; flex-direction: column; }
.scanner[hidden] { display: none; }
.scan-step { display: flex; flex-direction: column; flex: 1; min-height: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.scan-step[hidden] { display: none; }
.scan-bar { display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem; min-height: 48px; }
.scan-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: .25rem; }
#scanEditCanvas { position: absolute; inset: 0; touch-action: none; }
#scanViewCanvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.5); }
.scan-actions { display: flex; gap: .5rem; padding: .6rem .75rem; }
.scan-actions .btn { min-height: 48px; }
.scan-modes { display: flex; margin: .25rem .75rem 0; }
.scan-modes .btn { flex: 1; }
.scan-modes .btn.active { background: #fff; color: #111; }
.scan-pages { flex: 1; overflow: auto; display: flex; flex-wrap: wrap; gap: 1rem; padding: 1rem; align-content: flex-start; justify-content: center; }
.scan-thumb { position: relative; }
.scan-thumb canvas { display: block; background: #fff; border-radius: 4px; }
.scan-thumb .btn { position: absolute; top: 4px; right: 4px; padding: 0 .4rem; min-height: 0; }
.scan-msg { position: absolute; z-index: 5; top: 45%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.8); padding: .8rem 1.2rem; border-radius: 10px; font-size: 1.1rem; }

/* Stops */
.stop-row.stop-pickup { border-left: 4px solid #0d6efd !important; }
.stop-row.stop-delivery { border-left: 4px solid #198754 !important; }
.stop-card { border-left: 4px solid #0d6efd; }
.stop-card.delivery { border-left-color: #198754; }
.stop-card.done { opacity: .65; }
.stop-card.current { box-shadow: 0 0 0 2px rgba(13,110,253,.35); }
.stop-pin { width: 28px; height: 28px; border-radius: 50%; background: #0d6efd; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.stop-pin.delivery { background: #198754; }
