<div class="page-heading"><div><p class="eyebrow">Safety Profile</p><h1><?= e($profile['driver_name']) ?></h1><p>Configure the driver’s operating jurisdiction, cycle, terminal timezone, permitted special statuses, and ELD information.</p></div><a class="btn btn-light" href="<?= url('/hos/driver?driver_id='.(int)$driverId) ?>">Back to Logbook</a></div>
<form method="post" action="<?= url('/hos/profile/save') ?>" class="panel form-stack"><?= csrf_field() ?><input type="hidden" name="driver_id" value="<?= (int)$driverId ?>">
<div class="form-grid three">
<label><span>Operating Region</span><select name="operating_region"><option value="us" <?= $profile['operating_region']==='us'?'selected':'' ?>>United States</option><option value="canada" <?= $profile['operating_region']==='canada'?'selected':'' ?>>Canada</option><option value="cross_border" <?= $profile['operating_region']==='cross_border'?'selected':'' ?>>Cross-border US / Canada</option></select></label>
<label><span>Default Rule Set</span><select name="default_rule_set"><option value="us_property" <?= $profile['default_rule_set']==='us_property'?'selected':'' ?>>US Property-Carrying</option><option value="canada_south" <?= $profile['default_rule_set']==='canada_south'?'selected':'' ?>>Canada South of 60°N</option><option value="canada_north" <?= $profile['default_rule_set']==='canada_north'?'selected':'' ?>>Canada North of 60°N</option></select></label>
<label><span>US Cycle</span><select name="us_cycle"><option value="60_7" <?= $profile['us_cycle']==='60_7'?'selected':'' ?>>60 hours / 7 days</option><option value="70_8" <?= $profile['us_cycle']==='70_8'?'selected':'' ?>>70 hours / 8 days</option></select></label>
<label><span>Canada Cycle</span><select name="canada_cycle"><option value="cycle_1" <?= $profile['canada_cycle']==='cycle_1'?'selected':'' ?>>Cycle 1 · 70 / 7</option><option value="cycle_2" <?= $profile['canada_cycle']==='cycle_2'?'selected':'' ?>>Cycle 2 · 120 / 14</option></select></label>
<label><span>Home Terminal Name</span><input name="home_terminal_name" value="<?= e($profile['home_terminal_name']) ?>"></label>
<label><span>Terminal Timezone</span><input name="home_terminal_timezone" value="<?= e($profile['home_terminal_timezone']) ?>" placeholder="America/Chicago"><small class="muted">Use an IANA timezone, such as America/New_York.</small></label>
<label><span>24-Hour Log Period Starts</span><input type="time" name="log_day_start_time" value="<?= e(substr((string)$profile['log_day_start_time'],0,5)) ?>"><small class="muted">Carrier-designated start time for each daily log period.</small></label>
<label class="field-full"><span>Home Terminal Address</span><input name="home_terminal_address" value="<?= e($profile['home_terminal_address']) ?>"></label>
<label><span>ELD Provider</span><input name="eld_provider" value="<?= e($profile['eld_provider']) ?>" placeholder="Certified device provider"></label>
<label><span>ELD Device Identifier</span><input name="eld_device_identifier" value="<?= e($profile['eld_device_identifier']) ?>"></label>
</div>
<div class="permission-grid hos-option-grid">
<label class="permission-option"><input type="checkbox" name="personal_conveyance_allowed" value="1" <?= !empty($profile['personal_conveyance_allowed'])?'checked':'' ?>><span>Allow Personal Conveyance</span></label>
<label class="permission-option"><input type="checkbox" name="yard_move_allowed" value="1" <?= !empty($profile['yard_move_allowed'])?'checked':'' ?>><span>Allow Yard Move</span></label>
<label class="permission-option"><input type="checkbox" name="short_haul_enabled" value="1" <?= !empty($profile['short_haul_enabled'])?'checked':'' ?>><span>Short-Haul Eligibility Flag</span></label>
<label class="permission-option"><input type="checkbox" name="eld_exempt" value="1" <?= !empty($profile['eld_exempt'])?'checked':'' ?>><span>ELD Exemption Recorded</span></label>
<label class="permission-option"><input type="checkbox" name="active" value="1" <?= !empty($profile['active'])?'checked':'' ?>><span>HOS Tracking Active</span></label>
</div>
<label><span>ELD Exemption Reason / Documentation</span><textarea name="eld_exemption_reason" rows="3"><?= e($profile['eld_exemption_reason']) ?></textarea></label>
<div class="notice notice-info"><strong>Important:</strong> recording an exemption here does not determine legal eligibility. The carrier remains responsible for validating and documenting the applicable exemption.</div>
<div class="form-actions"><button class="btn btn-primary">Save HOS Profile</button></div>
</form>
