/* Operational controls remain reachable on phones and vehicle tablets. */
[hidden] { display: none !important; }
@media (min-width: 1101px) {
  .sidebar { position: sticky; top: 0; height: 100dvh; min-height: 0; gap: 14px; align-self: start; overflow-y: auto; }
  .brand { order: 0; }
  .station-photo { order: 1; max-height: 100px; margin: 0 auto; }
  .nav { order: 2; }
  body.vehicle-mode .vehicle-mode-mark, body.crew-mode .vehicle-mode-mark { order: 3; flex: 1 0 112px; min-height: 112px; padding: 18px 12px; flex-direction: column; gap: 8px; container: vehicle-mark / size; }
  .vehicle-mode-mark strong, body.crew-mode .vehicle-mode-mark strong { max-width: 100%; writing-mode: horizontal-tb; text-orientation: mixed; white-space: normal; overflow-wrap: normal; text-align: center; font-size: 34px; line-height: 1.2; }
  body.crew-mode .vehicle-mode-mark strong { font-size: 24px; }
  .vehicle-mode-mark em { margin: 0; writing-mode: horizontal-tb; text-orientation: mixed; white-space: nowrap; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .sidebar-panel { order: 4; padding: 12px; }
  h1 { font-size: 28px; }
  /* Rotate whole lines only when the remaining sidebar space can contain them. */
  @container vehicle-mark (min-height: 400px) {
    .vehicle-mode-mark strong { writing-mode: vertical-rl; white-space: nowrap; font-size: 64px; }
    body.crew-mode .vehicle-mode-mark strong { font-size: 28px; }
    .vehicle-mode-mark em { writing-mode: vertical-rl; }
  }
}
.mobile-sync { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 0; border-block: 1px solid var(--line); }
.mobile-sync span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
#mobileSyncBtn { min-height: 44px; flex: 0 0 180px; }
#mobileSyncBtn.sync-ok { background: #21764a; color: white; border-color: #21764a; }
#mobileSyncBtn.sync-error { background: #b81f25; color: white; border-color: #b81f25; }
#mobileSyncBtn.sync-pending { background: #f5e8c9; color: #69450b; }
.next-day { display: flex; align-items: center; gap: 8px; }
.next-day input, .handover-select input { width: 22px; height: 22px; flex: 0 0 22px; }
.handover-notice { padding: 14px 0; border-bottom: 2px solid var(--red); line-height: 1.5; }
.handover-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 20px; align-items: start; border-bottom: 1px solid var(--line); padding: 20px 0; }
.handover-select { display: flex; flex-direction: row; gap: 12px; align-items: start; }
.handover-select span span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.handover-row p, .handover-row ul { margin: 8px 0; font-size: 14px; }
.handover-row strong, .handover-row li { overflow-wrap: anywhere; }
.handover-row .actions { flex-wrap: wrap; }
#conflictBox { border-left: 4px solid #b81f25; padding: 12px 16px; background: #fff0ef; margin-block: 16px; }
.finish-panel { max-height: calc(100dvh - 32px); overflow: auto; }
.finish-panel .actions { position: sticky; bottom: 0; background: white; padding-block: 12px; }
.panel { border-radius: 6px; box-shadow: none; min-width: 0; }
.grid > * { min-width: 0; }
button, .btn, select { min-height: 44px; }
.segmented button { min-height: 44px; }
.person-row { min-width: 0; }
.person-row strong { overflow-wrap: anywhere; }
.app-locked .shell { visibility: hidden; }
body:not(.app-locked) .start-screen.hidden { display: none; }
@media (max-width: 1100px) {
  .person-row.no-vehicle { grid-template-columns: minmax(0, 1fr); }
  .vehicle-mode-mark strong, body.crew-mode .vehicle-mode-mark strong { font-size: 36px; }
  .vehicle-mode-mark em { font-size: 20px; }
  .handover-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .handover-row > .actions { grid-column: 1 / -1; justify-content: start; }
}
@media (max-width: 620px) {
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav button { font-size: 14px; min-height: 48px; }
  .time-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-mode-mark strong, body.crew-mode .vehicle-mode-mark strong { font-size: 30px; }
  .vehicle-mode-mark em { font-size: 18px; }
  .handover-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .actions .btn { flex: 1 1 140px; }
  .segmented button { font-size: 13px; padding: 10px 5px; }
  input, select, textarea { font-size: 16px; min-width: 0; }
  .brand strong { font-size: 16px; }
}
@media print { .mobile-sync, .handover-notice, #conflictBox { display: none; } }
.sync-local, #mobileSyncBtn.sync-local { background: #fff2ca; color: #644400; border-color: #947326; }
.capture-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
#offlineStatus { flex: 1 1 260px; color: var(--muted); font-size: 13px; }
body.vehicle-mode #capture.active { display: flex; flex-direction: column; }
body.vehicle-mode #eventGrid { display: contents; }
body.vehicle-mode #activeEventPanel { order: 1; }
body.vehicle-mode #attendancePanel { order: 2; }
body.vehicle-mode #eventForm { order: 3; margin-top: 16px; }
body.vehicle-mode #capture > .mobile-sync, body.vehicle-mode #capture > .capture-actions { order: 0; }
.provisional-section { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.provisional-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 1fr) auto; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.provisional-row p { margin-bottom: 0; font-size: 14px; color: var(--muted); }
.conflict-row { border-top: 1px solid #d1a9a5; padding-block: 16px; }
.conflict-row h3 { font-size: 16px; overflow-wrap: anywhere; }
.conflict-variants { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.conflict-variants pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
#storageRecovery { padding: 16px; background: #ffefed; border-left: 4px solid #b81f25; }
@media (max-width: 780px) { .provisional-row, .conflict-variants { grid-template-columns: minmax(0,1fr); } }
