<div class="page-heading inspection-heading"><div><p class="eyebrow">Roadside / Audit View</p><h1><?= e($profile['driver_name']) ?> · HOS Records</h1><p><?= e($profile['home_terminal_name'] ?: 'Home terminal not configured') ?> · <?= e($profile['home_terminal_timezone']) ?></p></div><div class="page-actions"><button class="btn btn-primary" type="button" onclick="window.print()">Print Records</button><a class="btn btn-light" href="<?= url('/hos/driver?'.((Auth::user()['role']??'')==='driver'?'':'driver_id='.(int)$driverId)) ?>">Back</a></div></div>
<div class="notice notice-info inspection-only-screen"><strong>Inspection mode:</strong> Showing <?= (int)$days ?> consecutive calendar days ending <?= e($endDate) ?>. Each daily record can also be downloaded as a PDF.</div>
<div class="hos-inspection-list">
<?php foreach($logs as $record): $daily=$record['summary']; ?>
<section class="panel hos-inspection-day">
    <div class="hos-inspection-head"><div><h2><?= e(date('l, F j, Y',strtotime($record['log_date']))) ?></h2><p><?= e(hos_rule_label((string)$record['rule_set'])) ?> · <?= e($record['cycle_code']) ?></p></div><div><span class="badge badge-<?= status_class((string)$record['status']) ?>"><?= e(readable_status((string)$record['status'])) ?></span><a class="text-link" href="<?= url('/hos/pdf?driver_id='.(int)$driverId.'&date='.$record['log_date']) ?>">PDF</a></div></div>
    <?php require app_path('Views/hos/_graph.php'); ?>
    <div class="hos-total-row"><div><span>Off Duty</span><strong><?= hos_minutes($daily['totals']['off_duty']) ?></strong></div><div><span>Sleeper</span><strong><?= hos_minutes($daily['totals']['sleeper_berth']) ?></strong></div><div><span>Driving</span><strong><?= hos_minutes($daily['totals']['driving']) ?></strong></div><div><span>On Duty</span><strong><?= hos_minutes($daily['totals']['on_duty']) ?></strong></div></div>
    <div class="hos-inspection-details"><span><b>Vehicle:</b> <?= e($record['vehicle_numbers'] ?: '—') ?></span><span><b>Trailer:</b> <?= e($record['trailer_numbers'] ?: '—') ?></span><span><b>Shipping docs:</b> <?= e($record['shipping_documents'] ?: '—') ?></span><span><b>Certified:</b> <?= e($record['certification_name'] ?: 'Not certified') ?><?= $record['certified_at']?' · '.e(datetime_display($record['certified_at'])):'' ?></span></div>
    <?php if($daily['violations']): ?><div class="hos-warning-list"><?php foreach($daily['violations'] as $warning): ?><span><?= e($warning) ?></span><?php endforeach; ?></div><?php endif; ?>
</section>
<?php endforeach; ?>
</div>
<div class="hos-print-footer">FleetLume operational logbook report. This output does not independently establish ELD registration or certification.</div>
