* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--background); color: var(--ink); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px #152b37; }
[hidden] { display: none !important; }
.workbench { max-width: 1120px; margin: auto; display: grid; grid-template-columns: 300px minmax(0,650px); gap: 48px; align-items: start; padding: 48px 32px; }
aside { position: sticky; top: 48px; }
aside h1 { font-size: 2.625rem; line-height: 1.2; letter-spacing: -1.5px; margin: 36px 0 24px; }
aside p, aside small { line-height: 1.8; color: var(--muted); }
aside small { display: block; margin-top: 32px; }
.wordmark { font: 30px/1 Russo,system-ui,sans-serif; letter-spacing: -2px; }
.phone { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 28px; min-height: 90dvh; box-shadow: 0 24px 70px #18324115; display: flex; flex-direction: column; }
header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 10px; gap: 8px; }
.header-actions { display: flex; gap: 4px; }
.quiet { background: transparent; border-color: transparent; font-size: 0.8125rem; padding: 8px; color: var(--muted); }
.build-label { padding: 0 22px; font-size: 0.8125rem; color: var(--muted); }
main { display: grid; align-content: start; gap: 20px; min-width: 0; padding: 24px 22px 32px; flex: 1; }
h2 { font-size: 1.75rem; line-height: 1.25; letter-spacing: -.8px; margin: 0; scroll-margin-top: 20px; }
h3 { font-size: 1.25rem; margin: 0; }
h4 { font-size: 1rem; margin: 0; }
p { margin: 0; font-size: 0.875rem; line-height: 1.65; }
p, h2, h3, h4, a, button { overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 0.8125rem; }
.eyebrow { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 1.2px; }
.next { padding: 22px; background: var(--night); color: white; border-radius: 18px; display: grid; gap: 14px; }
.next p { color: #e2e6e8; }
.action { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 700; min-height: 52px; }
.secondary { background: var(--background); color: var(--ink); }
.vehicle { display: grid; gap: 6px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.vehicle strong { font-size: 0.875rem; }
.vehicle p { color: var(--muted); font-size: 0.8125rem; }
.card, form { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; min-width: 0; }
form { scroll-margin-top: 16px; }
.card form { padding: 12px; }
label { display: grid; gap: 8px; font-size: 0.875rem; min-width: 0; }
input, select, textarea { min-width: 0; width: 100%; padding: 12px; border: 1px solid #78867D; border-radius: 8px; background: white; color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--success); }
.check { display: flex; align-items: center; min-height: 48px; line-height: 1.5; overflow-wrap: anywhere; }
.checklist { display: grid; gap: 2px; border-block: 1px solid var(--line); padding-block: 12px; }
.checklist .check:nth-child(even) { background: #f7f7f4; }
.draft { color: var(--success); font-size: 0.8125rem; }
.draft:empty { display: none; }
.photo-set { display: grid; gap: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.photo-slot { display: grid; gap: 8px; align-content: start; text-align: left; min-width: 0; padding: 10px; background: #f7f7f4; }
.photo-slot strong { font-size: 0.8125rem; line-height: 1.4; }
.photo-slot small { font-size: 0.8125rem; line-height: 1.4; color: #506068; }
.photo-slot img, .photo-placeholder { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; }
.photo-placeholder { display: grid; place-items: center; background: var(--wash); color: #506068; font-size: 1.75rem; }
img { display: block; max-width: 100%; height: auto; image-orientation: from-image; border-radius: 8px; }
.comparison { display: grid; gap: 18px; }
.comparison-inbox { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.comparison-inbox button { display: grid; gap: 2px; width: 100%; min-height: 48px; text-align: left; }
.comparison-inbox span { font-size: .875rem; color: var(--muted); }
[data-materials^="comparison:"] > summary { scroll-margin-block-start: 16px; }
.comparison-pair { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.comparison-pair div { min-width: 0; }
.comparison-pair > div > p { overflow-wrap: normal; word-break: normal; }
@media (min-width: 600px) {
  .comparison-pair { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
}
details { border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
details[open] > :not(summary) { margin-top: 16px; }
summary { cursor: pointer; min-height: 48px; padding: 12px 4px; font-weight: 700; overflow-wrap: anywhere; }
.chip { justify-self: start; border-radius: 20px; padding: 8px 12px; font-size: 0.8125rem; background: #e8f1ed; color: var(--success); }
.completed-trip { gap: 10px; }
.completed-trip .trip-result {
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(115deg, #103e35, #195446);
  color: #fff;
}
.completed-trip .trip-result h3 { font-size: 1.3rem; }
.completed-trip .trip-result .chip { padding: 0; background: transparent; color: #ceebdd; }
.completed-trip .trip-result .chip::before { content: "✓"; margin-inline-end: .45em; }
.completed-documents { padding-block: 8px; border-block: 1px solid var(--line); }
.completed-trip dl { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,6.5rem),1fr)); gap: 8px; margin: 0; }
.completed-trip dl > div { padding: 8px 10px; border-radius: 8px; background: var(--wash); }
.completed-trip dt { font-size: 0.8125rem; color: var(--muted); }
.completed-trip dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.completed-trip-approval { color: var(--success); font-weight: 700; }
.queue { display: grid; gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 10px; }
.plan-card.nearest { border-left: 4px solid var(--accent); background: var(--wash); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-actions button { flex: 1; }
.export { padding: 16px; border-radius: 12px; text-decoration: none; text-align: center; }
#status, #retry { margin: 12px 22px 0; font-size: 0.8125rem; overflow-wrap: anywhere; }
#status:empty, #retry:empty { display: none; }
#status:not(:empty), #retry:not(:empty) { padding: 12px; background: var(--background); border-radius: 8px; }
#status[data-kind=saved] { background: #e8f1ed; color: #18513f; }
#status[data-kind=error] { background: #fbece8; color: #8d3022; }
#status[data-kind=loading] { background: #edf1f5; }
nav { display: flex; flex-wrap: wrap; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; border-radius: 0 0 28px 28px; }
nav button { flex: 1 0 25%; min-width: max-content; padding: 8px 2px; border: 0; background: transparent; font-size: 0.8125rem; color: var(--muted); }
nav button[aria-current=page] { background: var(--background); color: var(--ink); font-weight: 700; }
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(94vw,520px); max-height: 90dvh; color: var(--ink); }
dialog::backdrop { background: #152b37b3; }
dialog[open] { display: grid; gap: 16px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.dialog-head h2 { font-size: 1.375rem; }
#photo-preview img { max-height: 42dvh; margin: auto; object-fit: contain; }
video { width: 100%; max-height: 45dvh; background: #152b37; }
input[type=file] { font-size: 0.8125rem; padding: 8px; }
@media (max-width: 760px) {
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { font-size: max(16px, 1rem); }
  .workbench { display: block; padding: 0; }
  aside { display: none; }
  .phone { border: 0; border-radius: 0; min-height: 100dvh; max-width: 500px; margin: auto; }
  main { padding: 24px 16px calc(106px + env(safe-area-inset-bottom)); }
  header { padding-inline: 16px; }
  .build-label { padding-inline: 16px; }
  #status, #retry { margin-inline: 16px; }
  nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%,500px); z-index: 2; border-radius: 0; }
  form, .card { padding: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .15s ease; }
}

/* Preserved drafts and OCR lines must remain readable on narrow screens. */
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }

fieldset { min-width: 0; margin: 12px 0; padding: 12px; border: 1px solid #cad5d9; border-radius: 12px; }
legend { font-weight: 700; padding: 0 6px; }

.metadata { font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }
.touch-action { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 16px; border: 1px solid #78867D; border-radius: 12px; background: var(--background); color: var(--ink); text-decoration: none; font-weight: 700; }
.route-actions { display: grid; gap: 8px; }

.form-error { color:#8d3022; background:#fbece8; }
.form-error:empty { display:none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior:auto !important; transition:none !important; animation:none !important; } }
@media (max-width:760px) { nav {position:sticky;left:auto;transform:none;width:100%;margin-top:auto;} main {padding-bottom:24px;} }
header {padding-top:calc(18px + env(safe-area-inset-top));flex-wrap:wrap;}

[data-material-count] { display:block; margin-top:6px; }
#decision-dialog .inline-actions { flex-direction:column; }

/* The shutter stays outside the scrolling preview. */
#photo-dialog {
  grid-template-rows: auto minmax(0,1fr) auto;
  gap: 10px;
  overflow: hidden;
  overscroll-behavior: contain;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
#photo-dialog .dialog-head { align-items: center; }
#photo-dialog .dialog-head h2 { font-size: clamp(1.0625rem, 4.2vw, 1.375rem); margin: 0; }
#photo-dialog .photo-caption { min-width: 0; }
#photo-equipment { margin: 3px 0 0; font-size: 0.875rem; line-height: 1.3; overflow-wrap: anywhere; }
#photo-dialog #close-photo { flex: 0 0 44px; width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 1.625rem; line-height: 1; }
#photo-dialog .photo-body { grid-row: 2; display: grid; min-height: 0; overflow-y: auto; align-content: start; gap: 10px; }
#photo-dialog .photo-feedback:has(#photo-message:empty) { display: none; }
#photo-dialog .photo-feedback { display: grid; gap: 8px; }
#photo-dialog #photo-message { margin: 0; }
#photo-dialog #photo-message:empty { display: none; }
#photo-dialog .photo-content {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}
#photo-dialog .photo-controls { grid-row: 3; display: grid; gap: 8px; }
#photo-dialog .photo-controls button { min-height: 48px; margin: 0; }
#photo-dialog .photo-controls:not(:has(> button:not([hidden]))) { display: none; }
#photo-dialog[data-equipment-camera="true"] #cancel-camera { display: none; }
#photo-dialog[data-equipment-camera="true"] #start-camera { background: var(--night); color: #fff; }
#photo-dialog .camera-stage { min-height: 0; min-width: 0; }
#photo-dialog #camera-video:not([hidden]) {
  display: block;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}
#photo-dialog .camera-stage:has(#camera-video:not([hidden])) { display: grid; min-height: 100px; background: #152b37; border-radius: 12px; }
#photo-dialog[data-equipment-camera="true"]:has(#camera-video:not([hidden])) .photo-content {
  grid-template-rows: auto minmax(110px,1fr) auto;
  align-content: stretch;
}
#photo-dialog[data-equipment-camera="true"] .photo-content:has(#camera-video:not([hidden])) #camera-video { height: 100%; }
#photo-dialog #photo-guide { background: var(--background); margin: 0; min-width: 0; }
#photo-dialog #photo-guide summary { min-height: 40px; }
#photo-dialog #photo-guide figure { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; }
#photo-guide img { width: 92px; height: 70px; flex: none; object-fit: contain; }
#photo-guide figcaption { min-width: 0; overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.3; }
#photo-dialog [hidden] { display: none; }

.photo-angle { display: grid; grid-template-columns: 106px minmax(0,1fr); align-items: center; gap: 12px; }
.photo-angle p { margin: 0; font-size: 0.875rem; line-height: 1.35; }
.photo-step-angle {
  display: flex;
  flex-wrap: wrap;
  padding: 8px;
  background: #f3f7f3;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.photo-step-angle .photo-map { flex: 0 0 106px; }
.photo-step-angle p { flex: 1 0 min(7.5em, 100%); }
.photo-map { position: relative; width: 106px; height: 80px; border-radius: 10px; background: #e1eee5; }
.photo-map-unit {
  position: absolute; top: 17px; left: 42px; width: 22px; height: 46px; border: 2px solid var(--night); border-radius: 6px 6px 3px 3px;
  background: linear-gradient(to bottom, var(--night) 0 14%, #a9cdb9 14% 31%, var(--night) 31% 37%, #fff 37%);
}
.photo-map-unit::before, .photo-map-unit::after {
  position: absolute; content: ''; left: -5px; right: -5px; height: 5px; border-inline: 3px solid var(--night);
}
.photo-map-unit::before { top: 12px; }
.photo-map-unit::after { bottom: 6px; }
[data-unit="trailer"] .photo-map-unit { top: 24px; height: 39px; background: #fff; border-radius: 3px; }
[data-unit="trailer"] .photo-map-unit::before { left: 6px; right: auto; top: -9px; width: 6px; height: 7px; border: 0; background: var(--night); }
.photo-map-marker {
  position: absolute; top: var(--marker-y); left: var(--marker-x);
  width: 12px; height: 13px; background: #076953;
  clip-path: polygon(32% 0,68% 0,68% 49%,100% 49%,50% 100%,0 49%,32% 49%);
  transform: translate(-50%,-50%) rotate(var(--marker-rotation,0deg));
}
[data-position=front] { --marker-x: 50%; --marker-y: 10%; }
[data-position=rear] { --marker-x: 50%; --marker-y: 90%; --marker-rotation: 180deg; }
[data-position=left] { --marker-x: 22%; --marker-y: 50%; --marker-rotation: -90deg; }
[data-position=right] { --marker-x: 78%; --marker-y: 50%; --marker-rotation: 90deg; }
[data-position=cabin] { --marker-x: 50%; --marker-y: 10%; }
[data-position=cabin] .photo-map-unit { background: linear-gradient(to bottom, #83bf9f 0 34%, var(--night) 34% 40%, #fff 40%); }
[data-position=seat] { --marker-x: 27%; --marker-y: 24%; --marker-rotation: -90deg; }
@media (max-width: 760px), (pointer: coarse) and (hover: none), (orientation: landscape) and (max-height: 500px) {
  #photo-dialog[open] {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  #photo-dialog[open] #photo-preview img { max-height: 57dvh; }
  #photo-dialog[open]:has(#camera-video:not([hidden])) {
    --camera-surface: #101a16;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    background: var(--camera-surface);
    color: #fff;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-body { display: contents; }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .dialog-head {
    grid-row: 1;
    grid-column: 1;
    min-width: 0;
    padding: 0 4px 6px;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #close-photo {
    background: #29362e;
    transition: none;
    border-color: #87938b;
    color: #fff;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-feedback {
    position: relative;
    grid-row: 2;
    grid-column: 1;
    align-self: start;
    z-index: 1;
    margin: 4px 8px 0;
    justify-items: center;
    pointer-events: none;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-message:not(:empty) {
    padding: 5px 10px;
    border-radius: 8px;
    background: #101a16e8;
    color: #fff;
    font-size: 0.8125rem;
    line-height: 1.3;
  }
  #photo-dialog[open] .photo-content:has(#camera-video:not([hidden])) {
    position: relative;
    grid-row: 2;
    grid-column: 1;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    align-content: stretch;
  }
  #photo-dialog[open] .camera-stage:has(#camera-video:not([hidden])) {
    min-height: 0;
    background: #080e0b;
    border-radius: 0;
  }
  #photo-dialog[open] #camera-video:not([hidden]) {
    height: 100%;
    max-height: none;
    min-height: 0;
    border-radius: 0;
    background: transparent;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-guide:not([hidden]) {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-end: 8px;
    z-index: 1;
    max-inline-size: min(248px, calc(100% - 16px));
    max-block-size: calc(50% - 8px);
    overflow: auto;
    padding: 0 8px;
    border: 1px solid #87938b;
    border-radius: 10px;
    background: #101a16f5;
    color: #fff;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-guide[open] {
    max-block-size: calc(100% - 16px);
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-guide summary {
    min-height: 44px;
    font-size: 0.875rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-guide figure {
    display: grid;
    gap: 4px;
    margin: 0 0 8px;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-guide img {
    width: 100%;
    height: min(132px, 28dvh);
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-angle:not([hidden]) {
    position: absolute;
    inset-inline-start: 8px;
    inset-block-end: 8px;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 6px;
    max-width: min(280px, calc(100% - 16px));
    max-block-size: calc(100% - 16px);
    overflow: auto;
    padding: 4px 8px 4px 4px;
    border-radius: 9px;
    background: #101a16e8;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-content:has(#photo-guide:not([hidden])) #photo-angle:not([hidden]) {
    max-block-size: calc(50% - 8px);
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-content:has(#photo-guide[open]:not([hidden])) #photo-angle {
    display: none;
  }
  #photo-dialog #photo-angle:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-map {
    transform: scale(.5);
    transform-origin: top left;
    margin: 0 -52px -40px 0;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #photo-angle p { font-size: 0.8125rem; }
  #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-controls {
    grid-row: 3;
    grid-column: 1;
    display: grid;
    place-items: center;
    min-height: 70px;
    gap: 0;
  }
  #photo-dialog[open]:has(#camera-video:not([hidden])) #cancel-camera { display: none; }
  #photo-dialog[open] #take-frame:not([hidden]) {
    min-width: 144px;
    min-height: 54px;
    border: 2px solid #fff;
    border-radius: 28px;
    background: #fff;
    color: var(--camera-surface);
    font-weight: 700;
  }
  #photo-dialog[open] #take-frame:not([hidden]):focus-visible { outline-color: #fff; }

  @media (orientation: landscape) {
    #photo-dialog[open] .photo-controls { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
    #photo-dialog[open]:has(#camera-video:not([hidden])) {
      grid-template-rows: auto minmax(0, 1fr);
      grid-template-columns: minmax(0, 1fr) minmax(106px, min(27vw, 7.625rem));
    }
    #photo-dialog[open]:has(#camera-video:not([hidden])) .dialog-head { grid-column: 1 / -1; }
    #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-content { grid-column: 1; }
    #photo-dialog[open]:has(#camera-video:not([hidden])) .photo-controls {
      grid-row: 2;
      grid-column: 2;
      grid-auto-flow: row;
      grid-template-columns: minmax(0, 1fr);
      margin-inline-start: 10px;
    }
    #photo-dialog[open] #take-frame:not([hidden]) { min-width: 0; width: 100%; }
  }
}
[data-issue-attachment] {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
}
[data-issue-attachment] img { grid-row: span 2; width: 72px; height: 72px; object-fit: contain; }
[data-issue-attachment] p { margin: 0; font-size: 0.875rem; }
[data-issue-attachment] button { justify-self: start; }

/* Original voice and editable message share the existing form. */
.voice-message { border: 1px solid #78867D; border-radius: 12px; padding: 12px; }
audio { width: 100%; max-width: 100%; min-width: 0; }
.voice-message button { min-height: 48px; margin-block: 4px; }

/* Compact contacts retain full-size touch actions and reflow at narrow widths. */
.duty-contacts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr)); gap: 12px; }
.duty-contacts > h3 { grid-column: 1 / -1; margin-bottom: 0; }
.duty-contacts h4 { margin-block: 4px; }
.duty-contacts p { font-size: 0.875rem; margin-block: 6px; }
.duty-contacts button { min-height: 48px; margin: 4px 4px 0 0; }

.evidence-list { margin: 0; padding: 0; list-style: none; }
.evidence-list li { margin-block: 6px; }
.evidence-row { width: 100%; min-height: 48px; display: grid; gap: 4px; text-align: left; padding: 10px 12px; }
.evidence-row small { font-size: 0.875rem; }
.photo-placeholder { aspect-ratio: auto; min-height: 56px; font-size: 1.25rem; }

.document-row { padding: 12px; border: 1px solid var(--border, #89959b); border-radius: 12px; margin-block: 10px; }
.document-row > summary { min-height: 48px; padding-block: 12px; font-weight: 700; }
.document-original { display: block; width: 100%; max-height: 280px; object-fit: contain; margin-block: 12px; }
.document-row [hidden] { display: none; }

.photo-slot.photo-compact { min-height: 48px; gap: 2px; padding: 10px 12px; }

.control-error-target { min-width:0; display:grid; gap:6px; align-content:start; scroll-margin-block:16px; }
.control-error-target > .photo-slot { width:100%; }
.control-error-target > label { margin-block:0; }
.control-error { margin:0; padding:10px 12px; border-radius:8px; font-size:0.875rem; line-height:1.5; overflow-wrap:anywhere; }

.comparison-original { position: relative; }
.comparison-original a, .comparison-original img { display: block; width: 100%; }
.comparison-original img { height: auto; }
.comparison-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.comparison-region { stroke: #a92317; stroke-width: 3px; fill: #a9231720; }
.cabin-reference-canvas { position: relative; max-width: 760px; }
.cabin-reference-canvas img { display: block; width: 100%; height: auto; }
.cabin-reference-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.cabin-reference-canvas svg:focus-visible { outline: 3px solid #145d9b; outline-offset: 3px; }
.cabin-reference-region { stroke: #167252; stroke-width: .005; fill: #16725230; pointer-events: none; }
.cabin-reference-saved { stroke: #145d9b; stroke-width: .005; fill: #145d9b20; pointer-events: none; }
.cabin-reference-cursor { fill: #db8e00; stroke: #1b2027; stroke-width: .003; pointer-events: none; }

/* R79: the same actions in a quieter, task-first driver layout. */
body { background: var(--background); }
.workbench { display: block; max-width: 880px; padding: 0 24px; }
.workbench aside { display: none; }
.phone { min-height: 100dvh; max-width: none; border: 0; border-radius: 0; box-shadow: none; container: driver-shell / inline-size; }
header { position: relative; padding: calc(14px + env(safe-area-inset-top)) 28px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark { font-size: 1.5rem; letter-spacing: -1px; color: var(--night); }
.brand-identity { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.account-menu { margin-inline-start: auto; position: relative; border: 0; padding: 0; flex: none; }
.account-menu > summary { min-height: 48px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-size: 1rem; }
.account-menu[open] > .header-actions { position: absolute; right: 0; top: 100%; z-index: 4; display: grid; width: max-content; min-width: 180px; max-width: calc(100vw - 32px); padding: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #12293a20; }
.header-actions button { text-align: left; font-size: 1rem; min-height: 48px; }
main { display: block; max-width: 760px; width: 100%; margin: 0 auto; padding: 28px 28px 48px; }
main > * + * { margin-top: 16px; }
.driver-page { display: grid; gap: 16px; align-content: start; }
.driver-page > .eyebrow { color: var(--muted); font-weight: 700; }
.driver-page > h2 { margin-bottom: 0; }
.driver-page > p { color: var(--muted); }
h2 { font-size: clamp(1.6875rem,4vw,2.125rem); line-height: 1.2; letter-spacing: -.9px; }
h3 { font-size: 1.1875rem; line-height: 1.3; }
p, label { font-size: 1rem; line-height: 1.55; }
.muted, .metadata { font-size: 0.875rem; line-height: 1.5; }
button, .touch-action { min-height: 48px; }
.action { background: var(--accent); color: var(--on-accent); border-color: var(--accent-line); font-weight: 700; }
.action.secondary:not(:disabled) { background: var(--paper); color: var(--night); border-color: var(--line); }
.action:disabled { background: #e4e8e9; border-color: #e4e8e9; color: #40515b; }
.task-hero, .next, .trip-lead { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); color: var(--ink); }
.task-hero p, .next p, .trip-lead p { color: var(--muted); }
.next h3 { font-size: 1.5rem; }
.driver-page > .vehicle { border: 0; padding: 2px 0 6px; gap: 2px; }
.driver-page > .vehicle strong { font-size: 1.0625rem; }
.driver-page > .vehicle p { font-size: 0.875rem; }
.driver-page > form, .driver-page > .card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 20px; }
.driver-page form h3 { font-size: 1.125rem; }
.driver-page > details, .utility-details { background: var(--paper); border-color: var(--line); }
.driver-page > details > summary, .utility-details > summary { font-size: 1rem; }
.driver-page > .card > h3 { margin-bottom: 8px; }
.driver-page .checklist-details { padding: 8px 12px; }
.checklist { gap: 0; padding-block: 4px; }
.checklist .check { padding: 5px 4px; }
.checklist .check:nth-child(even) { background: transparent; }
.photo-grid { gap: 8px; }
.photo-slot { background: var(--background); border-color: var(--line); border-radius: 12px; }
.photo-slot strong { font-size: 1rem; }
.photo-slot small { font-size: 0.875rem; }
.photo-set > p { color: var(--muted); }
.trip-lead { background: var(--night); border-color: var(--night); color: var(--paper); }
.trip-lead p { color: #CFDED3; }
.trip-lead .chip { color: var(--paper); background: #29574A; }
.route-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent-line); }
.evidence-row[data-next="true"] { border-color: var(--night); background: var(--wash); }
.evidence-row[data-next="true"]:not([data-local="true"]) small { display: none; }
.evidence-row strong { font-size: 1rem; }
.duty-contacts { border: 0; padding: 4px 0; box-shadow: none; }
.duty-contacts > section + section { border-top: 1px solid var(--line); padding-top: 16px; }
.driver-page .voice-message { border: 0; padding: 0; }
nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); border-radius: 0; }
nav button { min-width: 0; min-height: 64px; display: grid; justify-items: center; align-content: center; gap: 3px; border-radius: 12px; padding: 6px 2px; font-size: 1rem; line-height: 1.2; }
nav button span { min-width: 0; max-width: 100%; }
@container driver-shell (width < 19.5rem) {
  nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  nav button { min-height: 48px; grid-auto-flow: column; gap: 6px; align-items: center; justify-content: center; }
}
nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button[aria-current=page] { background: var(--wash); color: var(--night); }
#status, #retry { max-width: 760px; margin: 10px auto 0; width: calc(100% - 56px); font-size: 0.9375rem; }
.build-label { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 28px; font-size: 0.875rem; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--night); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent); }
@media (max-width: 760px) {
  .workbench { padding: 0; }
  .phone { width: 100%; max-width: 100%; }
  header { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  main { padding: 22px 16px 26px; }
  .task-hero, .next, .trip-lead { padding: 18px; }
  .driver-page > form, .driver-page > .card { padding: 16px; }
  #status, #retry { width: calc(100% - 32px); }
  .build-label { padding-inline: 16px; }
  nav { position: sticky; left: auto; bottom: 0; transform: none; width: 100%; z-index: 2; margin-top: auto; }
}
@media (max-width: 360px) {
  .brand { gap: 6px; }
  .brand-identity { font-size: 0.8125rem; }
  nav { padding-inline: 5px; gap: 0; }
  nav button { font-size: 1rem; }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Architect visual review: compact shortcuts, no accordion wall. */
.phone { background: var(--background); }
header { border: 0; background: var(--background); padding-bottom: 8px; }
.brand .wordmark { font-size: 1.5625rem; }
.account-menu > summary { list-style: none; background: #fff; border: 1px solid var(--line); }
.account-menu > summary::-webkit-details-marker { display: none; }
main { padding-top: 18px; }
.driver-page { gap: 18px; }
.driver-page > .eyebrow { font-size: 0.75rem; letter-spacing: 1.5px; }
.shift-page > .vehicle { margin-top: -8px; }
.next { padding: 22px; }
.next > .eyebrow { font-size: 0.6875rem; letter-spacing: 1.4px; }
.next h3 { font-size: 1.75rem; letter-spacing: -.8px; }
.next p { font-size: 1rem; line-height: 1.55; }
.shift-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; align-items: start; }
.shift-tools > details { min-width: 0; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.shift-tools > details > summary { list-style: none; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; min-height: 112px; padding: 16px; font-size: 1rem; font-weight: 700; line-height: 1.35; }
.shift-tools > details > summary::-webkit-details-marker { display: none; }
.shift-tools > details > summary svg { width: 24px; height: 24px; stroke: var(--night); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.shift-tools > details[open] { grid-column: 1 / -1; padding: 0 14px 14px; }
.shift-tools > details[open] > summary { min-height: 64px; padding: 14px 2px; flex-direction: row; justify-content: flex-start; align-items: center; }
.shift-tools > .duty-entry { grid-column: 1 / -1; }
.shift-tools > .duty-entry > summary { min-height: 54px; padding: 12px 16px; font-weight: 400; flex-direction: row; align-items: center; }
.shift-tools > .duty-entry > summary::after { content: '›'; margin-left: auto; font-size: 1.5rem; line-height: 1; }
.shift-page > details { padding: 4px 12px; background: transparent; border-color: transparent; }
.shift-page > details > summary { min-height: 48px; color: var(--muted); font-size: 0.875rem; }
nav { background: var(--paper); border-top: 1px solid var(--line); }
nav button[aria-current=page] { color: var(--night); background: var(--wash); }
#connection:not(:empty) {
  display: flex;
  align-items: baseline;
  gap: 9px;
  max-width: 760px;
  margin: 10px auto 0;
  width: calc(100% - 40px);
  padding: 9px 12px;
  border-radius: 12px;
  background: #FFF4DF;
  color: #63401C;
  line-height: 1.4;
}
#connection:not(:empty)::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #925716;
}
#connection:empty { display: none; }
@media (max-width: 760px) {
 main { padding: 18px 20px 30px; }
 header { padding-inline: 20px; }
 .next { padding: 20px; }
}
@media (max-width: 360px) {
 main { padding-inline: 16px; }
 header { padding-inline: 16px; }
 .shift-tools > details > summary { padding: 14px; font-size: 1rem; }
}

/* Compose starts with the driver's words; attachments remain optional. */
.voice-message { display: grid; gap: 12px; }
[data-voice-card] { display: grid; gap: 8px; }
[data-voice-status]:empty, [data-issue-attachment]:empty { display: none; }
.driver-page .photo-slot[data-purpose="issue"] { min-height: 48px; background: #fff; padding: 12px 16px; }
.driver-page .photo-slot[data-purpose="issue"] .photo-placeholder,
.driver-page .photo-slot[data-purpose="issue"] small { display: none; }
.driver-page .voice-message > .vehicle-context { font-size: 0.875rem; color: var(--muted); }

/* Logistics shortcut also appears outside the home action grid. */
.logist-entry > summary { display: flex; align-items: center; gap: 12px; }
.logist-entry[data-conversation] { padding-block: 0; }
.logist-entry[data-conversation][open] { padding-bottom: 12px; }
.logist-entry[data-conversation] > summary { display: list-item; }
.logist-entry > summary svg { width: 24px; height: 24px; flex: 0 0 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }

/* Intake: one task at a time; original form values remain in the same draft. */
.intake-heading { display:grid;gap:8px; }
.intake-heading h2 { font-size:1.75rem;line-height:1.2; }
[data-intake] { gap:16px; }
[data-intake] > h3 { display:none; }
[data-intake-panel] { display:grid;gap:16px; }
[data-intake-panel][hidden] { display:none; }
[data-intake-panel] .action { width:100%; }
[data-intake] input[hidden] { display:none; }
[data-intake-note] { display:grid;gap:8px; }
[data-intake-note-toggle],.intake-back { justify-self:start;padding-inline:0; }
[data-intake-panel="photos"] .photo-set > h3,
[data-intake-panel="photos"] .photo-set > p { display:none; }
[data-intake-panel="photos"] .photo-grid { display:block; }
[data-intake-panel="photos"] .photo-slot { width:100%;min-height:54px;align-content:center;justify-items:center;text-align:center; }
[data-intake-panel="photos"] .photo-placeholder,
[data-intake-panel="photos"] .photo-slot:not([data-local="true"]) small { display:none; }
[data-intake] .checklist { border:0;padding:0; }
[data-intake] .form-error:empty,[data-intake] .draft:empty { display:none; }

@media (max-width: 760px) {
  .driver-home form[data-action="return"]:has([name="parked"]:checked):has([name="all"]:checked) > .driver-primary:not(:disabled):not(form:has(input:not([type=checkbox]):focus, textarea:focus, select:focus) .driver-primary) {
    position: sticky;
    inset-block-end: calc(var(--driver-nav-height, 80px) + 8px);
    z-index: 1;
  }
}

.intake-help { padding:0 8px;border:0;background:transparent; }
.intake-help > summary { color:var(--muted);font-size:0.875rem;font-weight:400; }
.intake-ack { font-size:0.875rem;line-height:1.5;color:var(--muted); }
[data-intake-submit-host] > button { width:100%; }
[data-intake-note-summary] { font-size:0.875rem;line-height:1.5; }


/* Keep route context compact while the driver is working on loading/delivery. */
.trip-lead.trip-lead-compact { padding: 12px; gap: 4px; }
.trip-lead-compact > .eyebrow { display: none; }
.trip-lead-compact h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -.3px; }
.trip-lead-compact .chip { justify-self: start; }

/* Give the document fields priority while keeping the original one tap away. */
.document-row > form[data-action="document"] { padding: 0; border: 0; background: transparent; gap: 10px; }
.driver-home .document-row > .photo-slot { width: 100%; min-height: 52px; align-content: center; text-align: center; }
.driver-home .document-row > .photo-slot .photo-placeholder,
.driver-home .document-row > .photo-slot:not([data-local="true"]) small { display: none; }
.document-row [data-document-photo] { margin: 0; }
.driver-home .document-row[data-next-document] { background: var(--paper); border-color: var(--line); }
.document-row form > [data-document-retake] { width: 100%; min-height: 52px; justify-items: center; }
.document-row form > [data-document-retake][data-local="true"] { text-align: center; }
.document-row form > [data-document-retake]:not([data-local="true"]) small { display: none; }

/* Put arrival alongside the address and directions for the current stop. */
.driver-page .card > form:is([data-action="phase"], [data-action="completeTaskStop"]) { padding: 0; border: 0; background: transparent; }
.driver-page [data-evidence-list] > form[data-action="reportSignalWait"] { padding: 0; border: 0; background: transparent; }

.shift-page > form[data-action="start"] h3,
.shift-page > form[data-action="bundle"] h3 { font-size: 1.5rem; line-height: 1.25; }
.shift-page > form[data-action="bundle"] { gap: 10px; }

.shift-page > form[data-action="resume"] h3 { font-size: 1.5rem; line-height: 1.25; }
.driver-home .sleep-entry > summary { display: flex; gap: 8px; align-items: center; }
.driver-home .sleep-entry > summary svg { width: 20px; height: 20px; flex: 0 0 20px; fill: var(--signal); stroke: #91651a; stroke-width: 1.7; stroke-linejoin: round; }
.driver-home .sleep-entry > summary::after { content: ""; width: 7px; height: 7px; margin-inline-start: auto; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.driver-home .sleep-entry[open] > summary::after { transform: rotate(225deg); }
.driver-home .sleep-entry > form { padding: 0; border: 0; background: transparent; }

/* Show the next required return angle, with accepted originals under one disclosure. */
[data-return-step], [data-return-handover] { display: grid; gap: 12px; }
[data-return-progress] { color: var(--muted); font-size: 0.875rem; }
[data-return-current] .photo-set > h3, [data-return-current] .photo-set > p { display: none; }
[data-return-current] .photo-grid { display: block; }
[data-return-current] .photo-slot { width: 100%; min-height: 72px; justify-items: center; align-content: center; }
[data-return-current] .photo-slot[data-return-sequence="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent-line); }
[data-return-current] .photo-slot[data-return-sequence="true"] small { color: inherit; }
[data-return-current] .photo-slot .photo-placeholder,
[data-return-current] .photo-slot:not([data-local="true"]) small { display: none; }

#pending-push {
  align-self: center;
  max-width: calc(100% - 32px);
  margin: 8px 0 0;
  border-color: var(--accent-line);
  background: var(--wash);
}

.notice-answer-text { margin-top: 0; font-size: 1.2rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

.driver-home > .trip-lead:first-child { padding: 16px; }
[data-step-recovery-work]:not([hidden]) { display: contents; }
[data-step-recovery] button { width: 100%; min-height: 48px; }
.driver-home:has(> [data-step-recovery]:not([hidden])) > :is(.next,.arrival-offline) { display: none; }
.driver-home > .next:first-child { margin-block: 0 8px; }
.driver-home > h2:first-child { margin-block: 4px 12px; font-size: clamp(1.625rem, 6vw, 2.125rem); letter-spacing: -.035em; }
.driver-home .surrender-entry[open] > summary { margin-bottom: 12px; }
.driver-home .surrender-entry > form { padding: 0; border: 0; background: transparent; }

.driver-home .home-details { background: transparent; border-color: var(--line); }
.driver-home .home-details > summary { font-weight: 600; }
.driver-home [data-required-return] { margin-top: 12px; }

.driver-home .photo-slot[data-return-sequence="true"] { min-height: 54px; text-align: center; justify-items: center; align-content: center; background: var(--accent); color: var(--on-accent); }
.driver-home .photo-slot[data-return-sequence="true"] .photo-placeholder,
.driver-home .photo-slot[data-return-sequence="true"]:not([data-local="true"]) small { display: none; }

/* Give the equipment overview a branded surface. Keep the route summary quiet. */
.driver-home .shift-start-summary {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 0;
  border-radius: 20px;
  background: var(--night);
  color: #fff;
}

.driver-page > .trip-lead {
  border-color: var(--night);
  background: var(--night);
  color: var(--cream);
  overflow-wrap: anywhere;
}

.driver-page > .trip-lead.trip-lead-compact { padding: 16px; }
.driver-page > .trip-lead .trip-series { font-size: .875rem; font-weight: 700; }
.driver-page > .trip-lead .chip {
  background: #245449;
  border: 1px solid #527369;
  padding: 3px 10px;
  color: var(--cream);
}

.driver-page .next,
.driver-page > .intake-heading {
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
.driver-page .next p { color: var(--muted); }
.driver-page > .intake-heading:has(+ form[data-intake-stage="photos"]) {
  padding: 0;
  border: 0;
  background: transparent;
}
.driver-home .trailer-swap-summary { padding: 12px 14px; gap: 4px; }
.driver-home .trailer-swap-summary h2 { font-size: 1.45rem; }
.driver-page .release-actions { display: grid; gap: 8px; }
.driver-page .next[data-tone="waiting"] { --status-tone: #925716; background: #FFF4DF; }
.driver-page .next[data-tone="blocked"] { --status-tone: #A83732; background: #FFF0ED; }
.driver-page .next[data-tone="success"] { --status-tone: var(--success); background: #E8F3E9; }
.driver-page .next[data-tone] h3 { display: flex; align-items: baseline; gap: 10px; }
.driver-page .next[data-tone] h3::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: var(--status-tone);
}
.driver-home [data-volume-step] { display: grid; gap: 8px; }
.driver-home [data-volume-step] > p { margin: 0; }
.driver-home .volume-correction { display: grid; gap: 8px; }
.driver-home .volume-correction h3 { margin: 0; }
.driver-home .volume-correction > .document-row { margin: 0; }

.driver-home .shift-start-summary > .vehicle-context { font-weight: 700; }
.driver-page > .trip-lead p { color: inherit; }

.driver-page .route-instruction {
  padding: 10px 12px;
  border-radius: 12px;
  background: #e3ecff;
  color: #284875;
}


/* Programmatic focus announces the current step without outlining its heading. */
#screen :is(h2, h3)[tabindex="-1"]:focus { outline: none; }

.driver-home, .driver-page { -webkit-tap-highlight-color: transparent; }

#screen :is(.driver-home, .driver-page) :is(button, a, summary):focus-visible {
  outline: 2px solid var(--night);
  outline-offset: 3px;
  box-shadow: none;
}



.driver-page button.action:not(:disabled),
.driver-page .updated-delivery .route-primary {
  background: var(--paper);
  border-color: var(--line);
  color: var(--night);
}

#screen .driver-page button.action,
#screen .driver-page .driver-primary { transition: none; }

#screen :is(button, a).driver-primary:not(:disabled),
#photo-dialog[open] .photo-controls :is(#take-frame, #save-photo, #photo-reconcile):not([hidden], :disabled),
#photo-dialog[open]:not([data-offline-draft="true"]):not(:has(:is(#take-frame, #save-photo):not([hidden], :disabled))) #start-camera:not([hidden], :disabled) {
  background: var(--signal);
  border-color: #AD8428;
  color: var(--on-signal);
}

#photo-dialog[data-offline-draft="true"][open] #start-camera {
  background: var(--paper);
  border-color: var(--line);
  color: var(--night);
}
#photo-dialog[data-offline-draft="true"] :is(#photo-angle, #photo-guide) { display: none; }

#screen .driver-page button.driver-primary small { color: inherit; }

.driver-page .trip-route { background: transparent; border: 0; padding: 0; }
.driver-page .trip-route[open] { background: var(--paper); border: 1px solid var(--line); }
.driver-page .trip-route > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--night);
  list-style: none;
}
.trip-route > summary::-webkit-details-marker { display: none; }
.trip-route > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin: 0 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.trip-route[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.trip-route:not([open]) .request-close, .trip-route[open] .request-open { display: none; }
.trip-route[open] > .request-body { margin-top: 0; }
.request-body { display: grid; gap: 16px; padding: 4px 16px 16px; }
.request-body :is(p,h3,h4) { margin: 0; overflow-wrap: anywhere; }
.request-body :is(.request-header,.request-toll,.request-comment) { display: grid; gap: 6px; }
.request-toll { padding: 12px 14px; border-radius: 12px; background: #e9effb; color: #223a66; }
.request-toll span, .request-toll p { font-size: .875rem; color: inherit; }
.request-comment { white-space: pre-line; }
.trip-route-leg { display: grid; gap: 6px; padding-block: 12px; }
.trip-route-leg + .trip-route-leg { border-top: 1px solid var(--line); }
.route-waypoints { display: grid; gap: 6px; margin: 0; padding-inline-start: 1.5em; overflow-wrap: anywhere; }
.trip-route-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.route-web-link { display: flex; align-items: center; min-height: 44px; color: var(--accent); }

.arrival-navigation {
  display: flex;
  justify-content: center;
  border: 1px solid transparent;
  align-items: center;
  min-height: 44px;
  padding-inline: 14px;
  border-radius: 12px;
  background: #e2f1eb;
  color: #103e35;
  font-weight: 650;
  text-decoration: none;
}
.trip-route[open] ~ .arrival-stop .arrival-navigation { display: none; }
.arrival-offline { display: grid; gap: 8px; }
.arrival-offline > p { margin: 0; color: var(--muted); }
.arrival-offline .photo-slot {
  width: 100%;
  min-height: 52px;
  justify-items: center;
  align-content: center;
  text-align: center;
}
.arrival-offline .photo-placeholder,
.arrival-offline .photo-slot:not([data-local="true"]) small { display: none; }

/* A bright route surface anchors the driver's current work. */
.phone:has(.driver-page, .driver-home) {
  --paper: #f2f8f6;
  --wash: #daf6ea;
  --line: #cddfd8;
  --signal: #ffce47;
  --on-signal: #242311;
  background: linear-gradient(155deg, #d6f7ed 0, #eaf6f3 165px, #f3f8f6 380px);
}
.phone:has(.driver-page, .driver-home) > header { background: transparent; }
.driver-page > .trip-lead, .driver-home .shift-start-summary {
  background: radial-gradient(ellipse at 110% -25%, #169c89, transparent 62%),
              linear-gradient(110deg, #063e38, #006953 75%, #00785f);
  border-color: transparent;
  box-shadow: 0 5px 16px #004a3520;
}
.driver-page .card, .driver-home .home-details { background-color: #fff; }
.driver-page .route-instruction { border-inline-start: 3px solid #009f87; }
.phone:has(.driver-page, .driver-home) nav button[aria-current=page] {
  background: #d3f5e6; color: #00573e; box-shadow: inset 0 -3px #00895e;
}
/* Driver identity and the two places that introduce the assigned work. */
.brand { align-items: center; column-gap: 10px; }
.brand-identity:not(:empty) { border-inline-start: 1px solid #A3B0A5; padding-inline-start: 10px; }
.account-menu > summary { display: flex; align-items: center; gap: 8px; background: transparent; }
.account-menu > summary::before {
  content: ""; width: 14px; height: 11px; border-block: 2px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
header { border-bottom: 1px solid var(--line); }
.driver-page > .trip-lead, .driver-home .shift-start-summary { position: relative; isolation: isolate; }
.driver-page > .trip-lead::before, .driver-home .shift-start-summary::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 0 auto; width: min(35%, 160px);
  pointer-events: none; border-radius: inherit;
  background: repeating-radial-gradient(ellipse at 120% -12%, transparent 0 14px, #d9e9c410 15px 16px, transparent 17px 28px);
}
.driver-page > .trip-lead .trip-series, .driver-home .shift-start-summary .equipment-label {
  font-size: .8125rem; line-height: 1.4; font-weight: 700; color: #CEE1D4;
}
.driver-page > .trip-lead h2 { font-size: clamp(1.375rem, 5.5vw, 1.75rem); line-height: 1.17; text-wrap: pretty; }
.driver-page > .trip-lead.trip-lead-compact { gap: 6px; padding: 16px 18px; }
.driver-page > .trip-lead .chip { font-size: .8125rem; font-weight: 700; }
.driver-home form[data-action="start"] {
  padding: 0; border: 0; background: transparent; gap: 12px;
}
.driver-home .shift-start-summary { padding: 20px; gap: 10px; border-radius: var(--radius); color: var(--cream); }
.driver-home .shift-start-summary > .vehicle-context { font-size: 1.35rem; line-height: 1.25; }
.assigned-equipment { margin: 0; }
.assigned-equipment > div + div { margin-top: 12px; padding-top: 12px; border-top: 1px solid #ffffff35; }
.assigned-equipment dt { font-size: .85rem; color: #D1E4D9; }
.assigned-equipment dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.assigned-equipment strong { display: block; font-size: 1.35rem; line-height: 1.25; }
.assigned-equipment span { display: block; font-size: .95rem; }
.driver-home .shift-start-summary > p:last-child { color: #E1EDE5; }
#screen form[data-action="login"] > button.action:not(:disabled),
#decision-dialog .action:not(:disabled) { background: var(--signal); color: var(--on-signal); border-color: #AD8428; }
.driver-page .route-instruction, .request-toll { color: #20483F; background: #E7EFEB; }
nav button[aria-current=page] { background: var(--wash); color: var(--night); box-shadow: inset 0 -3px var(--night); }

/* Keep the address and arrival action together on short phone screens. */
@media (max-width: 400px) and (max-height: 700px) {
  main:has(.driver-page :is([data-arrival-online]:not([hidden]), [data-next-document])) { padding: 8px 10px 20px; }
  .driver-page:has(:is([data-arrival-online]:not([hidden]), [data-next-document])) { gap: 8px; }
  .driver-page:has(:is([data-arrival-online]:not([hidden]), [data-next-document])) > .trip-lead-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 10px 12px;
  }
  .driver-page:has(:is([data-arrival-online]:not([hidden]), [data-next-document])) > .trip-lead-compact > :is(.trip-series, .chip) {
    order: -1;
  }
  .driver-page:has(:is([data-arrival-online]:not([hidden]), [data-next-document])) > .trip-lead-compact > h2 { width: 100%; }
  .driver-page .card:has(> [data-arrival-online]:not([hidden])) {
    padding: 10px 12px;
    gap: 8px;
  }
  .driver-page .card:has(> [data-arrival-online]:not([hidden])) > p { line-height: 1.4; }
}

fieldset[data-mechanic-restore], fieldset[data-message-restore] { display: contents; }

#document-original[open] {
  position: fixed; inset: 0; box-sizing: border-box; margin: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px;
  width: 100%; max-width: none; height: 100dvh; max-height: none;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border: 0; border-radius: 0; background: #101815;
}
#document-original img { width: 100%; height: 100%; object-fit: contain; }
#document-original form { display:flex; justify-content:flex-end; margin:0; }
#document-original button { width:auto; min-height:48px; padding-inline:18px; }

@media (max-width: 350px) and (max-height: 700px) {
  .driver-page .arrival-stop { gap: 4px; }
  .driver-page .arrival-stop button.action { min-height: 44px; padding-block: 8px; }
  .arrival-stop > p { margin-block: 0; }
  .driver-page .trip-route > summary { min-height: 44px; padding-block: 6px; }
}
@media (max-width: 350px) {
  .phone > header .brand { display: grid; gap: 2px; }
  .phone > header .brand-identity:not(:empty) { border: 0; padding: 0; }
}

.document-open-hint {
  display: block;
  margin-top: 4px;
  color: var(--ink, #162b26);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.document-row[open] > summary .document-open-hint { display: none; }

.voice-options > button { margin: 4px 4px 0 0; }

.voice-message textarea[name="text"] {
  field-sizing: content;
  max-height: 44dvh;
  overflow-y: auto;
}

/* At the stop, keep the current document action within reach on short phones.
   The trip request contains the complete address for both stops. */
@media (max-width: 400px) and (max-height: 700px) {
  .driver-page:has([data-next-document]) > .trip-lead-compact h2 {
    width: 100%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .driver-home .document-row[data-next-document] > summary {
    min-height: 44px;
    margin: 0 0 4px;
    padding-block: 4px;
  }
}

/* The first capture button already names the document. Preserve the summary
   for closed rows, saved photos, drafts and every later review state. */
.document-row[data-next-document][open]:has(> .photo-slot.driver-primary:not(:disabled, [hidden], [data-local="true"])) > summary {
  display: none;
}
.driver-home .document-row[data-next-document][open]:has(> .photo-slot.driver-primary:not(:disabled, [hidden], [data-local="true"])) {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Route information is plain text. Optional actions share one filled style. */
.driver-page .request-toll,
.driver-page .route-instruction {
  background: transparent;
  color: var(--ink);
  padding: 0;
  border: 0;
  border-radius: 0;
}
.driver-page .request-toll > span { color: var(--muted); }
.driver-page {
  --utility-ink: #204a70;
  --utility-fill: var(--driver-action-fill);
}
.driver-page a.touch-action[href^="tel:"],
.driver-page .trip-route-links > a.touch-action,
.driver-page .updated-delivery .trip-route-links > a.touch-action,
.driver-page .arrival-navigation {
  background: var(--utility-fill);
  color: #fff;
  border: 0;
  border-radius: 12px;
  min-height: 48px;
  box-shadow: inset 0 1px 0 #ffffff36, 0 2px 3px #033a7029;
  font-weight: 650;
}
.driver-page a.touch-action[href^="tel:"] { justify-content: flex-start; }
.driver-page :is(.trip-route-links > a.touch-action, .arrival-navigation, a.touch-action[href^="tel:"]):active {
  background: #044a99;
  transform: translateY(1px);
}
.driver-page :is(.request-open, .request-close) { color: var(--utility-ink); }

.driver-page a[href^="yandexnavi:"] { gap: 9px; white-space: nowrap; }
.driver-page a[href^="yandexnavi:"]::before {
  content: "";
  flex: 0 0 24px;
  height: 22px;
  background: linear-gradient(to bottom, #ffc047 0%, #ffae21 49%, #ff8208 50%, #ff9a12 100%);
  clip-path: polygon(0 0, 100% 47%, 100% 53%, 0 100%, 26% 50%);
}

.stop-contact { overflow-wrap: anywhere; }
.driver-page .stop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.driver-page .stop-actions > a.touch-action {
  flex: 1 1 7rem;
  justify-content: center;
  padding-inline: 8px;
}

/* Shared driver actions, including controls inserted after recording or taking a photo. */
:root { --driver-action-fill: linear-gradient(160deg, #0879ce, #0352ad); }
#screen[data-role="driver"] :is(button, a.touch-action):not(.driver-primary, :disabled, [aria-disabled="true"]),
.phone:has(#screen[data-role="driver"]) :is(#shell-update, #pending-push, #retry button):not(:disabled),
body:has(#screen[data-role="driver"]) :is(#decision-cancel, #cancel-camera, #document-original button):not(:disabled) {
  background: var(--driver-action-fill);
  color: white;
  border-color: transparent;
  border-radius: 12px;
  min-height: 48px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 #ffffff36, 0 2px 3px #033a7029;
}
#screen[data-role="driver"] :is(button, a.touch-action):not(.driver-primary, :disabled):active {
  background: #044a99;
  transform: translateY(1px);
}
#screen[data-role="driver"] button:not(.driver-primary) small { color: inherit; }
#screen[data-role="driver"] :is(button:disabled, a[aria-disabled="true"]) {
  background: #e5e9ec; color: #53606a; border-color: transparent; box-shadow: none; opacity: 1;
}
#screen[data-role="driver"] details > summary { color: #205786; }
#screen[data-role="driver"] a:not(.touch-action, .arrival-navigation, .driver-primary) {
  color: #145993; text-decoration: underline; text-underline-offset: .18em;
}
.phone:has(#screen[data-role="driver"]) nav button { color: #225b88; }
.phone:has(#screen[data-role="driver"]) nav button[aria-current="page"] {
  background: #e3f1fc; color: #124e7c; box-shadow: inset 0 -3px #086db6;
}
.phone:has(#screen[data-role="driver"]) #account-menu > summary::before { border-color: currentColor; }

.account-menu > summary {
  justify-content: center;
  min-width: 7rem;
  color: #174e42;
  background: #e4eee8;
  border-color: transparent;
}
.account-menu:not([open]) .menu-hide, .account-menu[open] .menu-show { display: none; }
.account-menu[open] > summary::before {
  content: "×"; width: 14px; height: auto; line-height: 1;
  background: none; border: 0; font-size: 1.15rem;
}
.account-menu[open] > .header-actions {
  margin: 6px 0 0; gap: 0; padding: 4px; background: #fff;
  border-color: #d7e2db; border-radius: 14px; box-shadow: 0 6px 20px #163c3024;
}
.account-menu .header-actions button {
  background: transparent; color: #184a40; border: 0; box-shadow: none;
  border-radius: 8px; padding: 10px 14px; font-weight: 600;
}
.account-menu .header-actions button + button { border-top: 1px solid #e3e9e5; }
.account-menu .header-actions button:active { background: #e4eee8; }
header:has(.account-menu[open]) { z-index: 5; }

/* Dispatcher workspace */
.phone:has(#screen[data-role="dispatcher"]) {background:#f2f6f3}
.phone:has(#screen[data-role="dispatcher"]) nav {position:sticky;bottom:0;z-index:3;box-shadow:0 -4px 18px #103e3515}
.phone:has(#screen[data-role="dispatcher"]) nav button[aria-current="page"] {background:#103e35;color:white}
#screen[data-role="dispatcher"] h2 {color:#093e35;letter-spacing:-.025em}
.dispatch-inbox {display:grid;gap:12px}
.dispatch-inbox > h3 {margin:0;color:#31584e}
.dispatch-alert {padding:clamp(16px,3vw,26px);border-radius:20px;background:linear-gradient(110deg,#093e35,#076451);color:white;overflow-wrap:anywhere}
.dispatch-alert h4 {margin:0;font-size:1.35rem;color:white}
.dispatch-alert p {margin:6px 0;color:#d9eee6}
.dispatch-alert dl {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:18px 0;padding:16px 0;border-block:1px solid #ffffff40}
.dispatch-alert dt {color:#d9eee6;font-size:.875rem}
.dispatch-alert dd {margin:4px 0 0;font-weight:750;font-size:clamp(1.1rem,3vw,1.65rem);line-height:1.2;color:white}
.dispatch-alert dl > div:last-child dd {color:#ffda80}
.dispatch-alert .dispatch-state {display:flex;align-items:baseline;gap:8px;font-weight:650;color:white}
.dispatch-state::before {content:"";flex:none;width:9px;height:9px;border-radius:50%;background:#ffcd58}
.dispatch-alert form {background:transparent;border:0;padding:0;margin:12px 0 0}
#screen[data-role="dispatcher"] .dispatch-alert button.action,#screen[data-role="dispatcher"] .dispatch-plan > summary {background:#ffcd58;color:#342504;border:0;border-radius:12px;font-weight:700}
.dispatch-plan {background:white;padding:8px}
.dispatch-plan > summary {padding:12px 16px;cursor:pointer}
.dispatch-plan[open] > summary {margin-bottom:12px}

.fleet-board{background:white;border-radius:20px;overflow:hidden;border:1px solid #d6e2dc}
.fleet-board header{position:static;display:block;padding:18px 22px;background:linear-gradient(115deg,#093e35,#076451);color:white}
#screen .fleet-board header h2{color:white;margin:.25rem 0}.fleet-board header p{color:#dcf4e9;margin:0}
.fleet-filters{display:flex;flex-wrap:wrap;gap:6px;padding:12px}
.fleet-board button{width:auto;min-height:36px;border:0;border-radius:9px;padding:6px 10px;background:#e8f1ed;color:#124c40;font-weight:650;cursor:pointer}
.fleet-board button[aria-pressed=true]{background:#10594b;color:white}
.fleet-scroll{overflow:auto;max-height:58vh}.fleet-board table{width:100%;border-collapse:collapse;min-width:540px;font-size:.89rem}.fleet-board th,.fleet-board td{text-align:left;padding:9px;border-bottom:1px solid #e0e9e4;vertical-align:middle}.fleet-board th{background:#edf4ef;color:#39594e;position:sticky;top:0;z-index:1}.fleet-board small{display:block;color:#486256;line-height:1.35}.fleet-board .fleet-task{background:#ffcd58;color:#392900}.fleet-detail{background:#f0f7f3}.fleet-detail p{margin:6px}

/* Dispatchers work with the same shift at a desk and on a phone. */
@media (min-width: 761px) {
  .workbench:has(#screen[data-role="dispatcher"]) { max-width: none; padding: 0; }
  .phone:has(#screen[data-role="dispatcher"]) { width: 100%; max-width: none; }
  main#screen[data-role="dispatcher"] { max-width: none; padding-inline: clamp(20px, 3vw, 64px); }
  #screen[data-role="dispatcher"] .fleet-board table { font-size: 1rem; }
  .fleet-board th, .fleet-board td { padding: 10px 16px; }
  .fleet-board td:first-child { white-space: nowrap; }
  .fleet-scroll { max-height: 65dvh; }
}
@media (max-width: 760px) {
  .fleet-board { border-radius: 14px; }
  .fleet-scroll { overflow: visible; max-height: none; }
  .fleet-board table, .fleet-board tbody { display: block; min-width: 0; }
  .fleet-board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .fleet-board tr { display: grid; padding: 12px; border-top: 1px solid #d6e2dc; gap: 7px; }
  .fleet-board td { display: block; padding: 0; border: 0; overflow-wrap: anywhere; }
  .fleet-board td:nth-child(2)::before, .fleet-board td:nth-child(3)::before {
    display: block; color: #486256; font-size: .8rem;
  }
  .fleet-board td:nth-child(2)::before { content: "Сейчас"; }
  .fleet-board td:nth-child(3)::before { content: "Следующий рейс"; }
  [data-live-fleet] td:nth-child(2)::before { content:"Водитель"; }
  [data-live-fleet] td:nth-child(3)::before { content:"Сейчас"; }
  [data-live-fleet] td:nth-child(4)::before, [data-live-fleet] td:nth-child(5)::before {
    display:block; color:#486256; font-size:.8rem;
  }
  [data-live-fleet] td:nth-child(4)::before { content:"Следующий рейс"; }
  [data-live-fleet] td:nth-child(5)::before { content:"Связь"; }
  .fleet-board tr:has(.fleet-detail) { background: #f0f7f3; }
  .fleet-board button { min-height: 44px; }
  .fleet-filters { padding: 8px; }
}

.fleet-board > label,.fleet-board > [data-fleet-empty]{display:block;margin:12px 16px}.fleet-board [hidden]{display:none!important}.fleet-board td:first-child{white-space:normal}

.dispatch-route-map{width:100%;height:min(65vh,480px);min-height:300px;border:0;border-radius:12px}

#road-alert{box-sizing:border-box;width:min(92vw,480px);max-height:85dvh;border:0;border-top:10px solid #ff871b;border-radius:20px;padding:24px;background:#fff3dd;color:#342313}#road-alert::backdrop{background:rgb(23 22 17 / 78%)}#road-alert button{background:#ffae42;color:#271c0c;font-weight:700}

#road-alert .road-sign{display:block;font-size:3rem;line-height:1.15;margin-bottom:.5rem}#road-alert[data-severity="stop"]{border-top-color:#bd241c;background:#fff2eb}#road-alert[data-severity="stop"] h2{color:#941c19}

form:has(select[name="category"] option[value="roads"]:checked) .expense-other { display:none }
.expense-camera[open] { position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:#111;color:white }
.expense-camera video { width:100%;height:100%;object-fit:contain }
.expense-camera button,.expense-camera p { position:absolute;margin:0;z-index:1 }
.expense-camera .dismiss { top:max(1rem,env(safe-area-inset-top));left:max(1rem,env(safe-area-inset-left)) }
.expense-camera .shutter { bottom:max(1.5rem,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%) }
.expense-camera p { top:25%;left:5%;right:5%;text-align:center;background:#111 }
@media(orientation:landscape){.expense-camera .shutter{left:auto;right:max(1rem,env(safe-area-inset-right));bottom:50%;transform:translateY(50%)}}
.crash-dialog{width:min(94vw,36rem);max-height:90dvh;border:0;border-radius:20px;padding:1rem;color:#162b26;background:#fff}
.crash-dialog::backdrop{background:#10231ed9}
.crash-dialog header{display:flex;align-items:center;justify-content:space-between}
.crash-dialog main{display:grid;gap:.65rem}
.crash-dialog video,.crash-dialog img{max-width:100%}
.crash-dialog button,.crash-entry{min-height:44px}

.account-menu .header-actions [data-driver-crash] { display:flex; align-items:center; gap:10px; }
.crash-menu-icon { display:grid; place-items:center; flex:0 0 32px; height:32px; border-radius:10px; color:#804412; background:#ffedc7; }
.crash-menu-icon svg { width:23px; height:23px; }

canvas[data-volume-row] {
  max-width: 100%;
  height: auto;
}
p.terminal-pin {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: .25em 0;
}

@media (max-width: 350px) and (max-height: 600px) {
  .driver-page:has([data-arrival-online]:not([hidden])) > .trip-lead-compact {
    padding-block: 6px;
    row-gap: 2px;
  }
  .driver-page .arrival-stop:has(> [data-arrival-online]:not([hidden])) {
    row-gap: 5px;
  }
}

.desk-commands,.desk-issues { display:none; }
.workbench:has(#screen[data-role]:not([data-role="driver"])) {display:block;max-width:none;padding:0}
.phone:has(#screen[data-role]:not([data-role="driver"])) {
  --desk-font:"Segoe UI","Helvetica Neue",Arial,sans-serif;--ink:#242627;--night:#353936;--background:#fff;--paper:#fff;--line:#c9ccc6;--wash:#fff2b7;--accent:#ffdf77;--on-accent:#302a17;
  width:100%;max-width:none;background:#fff;padding-left:166px;font:13px/1.35 var(--desk-font);
}
.phone:has(#screen[data-role]:not([data-role="driver"])) > header {
  order:-1;margin-left:-166px;position:sticky;top:0;z-index:5;height:36px;padding:2px 12px;background:#fff1b1;border-bottom:1px solid #c9bd85;
}
.phone:has(#screen[data-role]:not([data-role="driver"])) > header .brand {display:flex;align-items:center}
.phone:has(#screen[data-role]:not([data-role="driver"])) .wordmark {font:700 16px var(--desk-font);color:#89372d;letter-spacing:-.6px}
.phone:has(#screen[data-role]:not([data-role="driver"])) > nav {position:fixed;inset:36px auto 0 0;width:166px;display:flex;flex-direction:column;justify-content:flex-start;gap:0;padding:6px 0;background:#f8f7f1;border:0;border-right:1px solid #d8d8cf;box-shadow:none}
.phone:has(#screen[data-role]:not([data-role="driver"])) > nav button {flex:none;display:flex;justify-content:start;align-items:center;gap:10px;padding:5px 12px;border:0;border-radius:0;font:13px var(--desk-font);color:#2d312d;min-height:31px;background:transparent}
.phone:has(#screen[data-role]:not([data-role="driver"])) > nav button[aria-current="page"] {background:#fff1b1;color:#232920;box-shadow:inset 3px 0 #af8d18}
.phone:has(#screen[data-role]:not([data-role="driver"])) > nav svg {width:15px;height:15px}
main#screen[data-role]:not([data-role="driver"]) {display:flex;flex-direction:column;align-items:stretch;width:100%;max-width:none;padding:12px 16px;gap:8px;font:13px/1.35 var(--desk-font)}
#screen[data-role]:not([data-role="driver"]) :is(h2,h3,h4,label,p,small,summary,button,input,textarea,select,th,td) {font-family:var(--desk-font);letter-spacing:normal}
#screen[data-role]:not([data-role="driver"]) :is(p,label,summary,button,input,textarea,select,th,td) {font-size:13px;line-height:1.45}
#screen[data-role]:not([data-role="driver"]) h2 {font-size:21px;font-weight:500;line-height:1.25;color:#202625;margin:4px 0}
#screen[data-role]:not([data-role="driver"]) :is(h3,h4) {font-size:14px;font-weight:600}
#screen[data-role]:not([data-role="driver"]) :is(.card,details,form,.fleet-board) {border:1px solid #cdd0c9;border-radius:2px;background:#fff;padding:7px;box-shadow:none;gap:6px}
#screen[data-role]:not([data-role="driver"]) :is(button,.dispatch-plan>summary) {min-height:25px;padding:3px 9px;border:1px solid #b1b5b0;border-radius:3px;color:#242627;background:linear-gradient(#fff,#eceeea);box-shadow:none;font-weight:400}
#screen[data-role]:not([data-role="driver"]) button.action {background:#ffe488;border-color:#c8b15d;justify-self:start}
#screen[data-role]:not([data-role="driver"]) :is(input:not([type="checkbox"]),select,textarea) {min-height:24px;padding:3px 6px;border:1px solid #aeb3ae;border-radius:2px}
#screen[data-role]:not([data-role="driver"]) .desk-title {order:-5}
#screen .desk-commands {display:flex;gap:4px;order:-4}
#screen .desk-commands b {color:#28703d;font-size:15px}
#screen .desk-register {order:-3;border:0;padding:0}
#screen .desk-register header {display:none}
#screen .desk-register .fleet-filters {display:inline-flex;margin:0 12px 4px 0;padding:0;gap:2px}
#screen .desk-register button[aria-pressed="true"] {background:#fff0aa;color:#292b26;border-color:#ae9856}
#screen .desk-register table {width:100%;border-collapse:collapse;font-size:13px}
#screen .desk-register :is(th,td) {padding:5px 10px;text-align:left;border:1px solid #e1e3df;color:#292b26}
#screen .desk-register th {background:#f1f3f0;font-weight:600;color:#464d4b}
#screen .desk-register tbody tr:nth-child(even) {background:#fafbf9}
#screen .desk-register small {font-size:12px;color:#505953}
#screen .desk-register td {font-weight:400}
#screen .desk-register td strong {font-weight:600}
#screen .desk-issues {display:block}
#screen .desk-issues button {border:0;background:transparent;padding:0;text-align:left}
#screen .desk-issues tr:has([aria-pressed="true"]) {background:#ffe69a}
#screen [data-issue-detail] {order:-2}
#screen [data-issue-detail][data-selected="false"] {display:none}
.phone:has(#screen[data-role]:not([data-role="driver"])) #account-menu > summary {min-height:26px;padding:3px 9px;border-radius:4px;font:500 13px/1.35 var(--desk-font);background:#fff8d8;color:#39392e}
#screen .desk-register {font-variant-numeric:tabular-nums}
#screen .desk-commands button {display:inline-flex;gap:6px;align-items:center;font-weight:500;min-height:28px}
#screen .desk-register .fleet-scroll {scrollbar-gutter:stable}
#screen .dispatch-plan {scroll-margin-top:44px}

.fleet-filter-label { align-self:center; font-size:12px; font-weight:600; padding-inline:4px; }

@media (max-width:959px) {
  #screen[data-role="dispatcher"] select {
    overflow:hidden;
    text-overflow:ellipsis;
  }
}

@media (max-width:959px) {
  .phone:has(#screen[data-role]:not([data-role="driver"])) {
    padding:0; border:0; border-radius:0; box-shadow:none; min-height:100dvh;
  }
  .phone:has(#screen[data-role]:not([data-role="driver"])) > header {
    order:-3; margin:0; position:relative; height:auto; min-height:44px;
    padding:4px max(12px,env(safe-area-inset-right)) 4px max(12px,env(safe-area-inset-left));
  }
  .phone:has(#screen[data-role]:not([data-role="driver"])) > nav {
    order:-2; position:static; width:100%; margin:0; padding:0; transform:none;
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); border:0; border-bottom:1px solid #d5d3c7;
  }
  .phone:has(#screen[data-role]:not([data-role="driver"])) > nav button {
    justify-content:center; flex-direction:column; gap:3px; min-height:48px; padding:4px 1px; font-size:12px;
  }
  .phone:has(#screen[data-role]:not([data-role="driver"])) > nav button[aria-current="page"] {box-shadow:inset 0 -3px #ab810c}
  main#screen[data-role]:not([data-role="driver"]) {padding:12px max(10px,env(safe-area-inset-right)) 24px max(10px,env(safe-area-inset-left))}
  main#screen[data-role]:not([data-role="driver"]) :is(button,summary,select,input:not([type="checkbox"])) {min-height:44px}
  main#screen[data-role]:not([data-role="driver"]) :is(p,label,summary,button,th,td) {font-size:14px}
  .phone:has(#screen[data-role]:not([data-role="driver"])) #account-menu > summary {min-height:40px;display:flex;align-items:center}
  #screen[data-role]:not([data-role="driver"]) :is(input:not([type="checkbox"]),select,textarea) {font-size:16px;min-height:44px}
  #screen .desk-commands {flex-wrap:wrap}
  #screen .desk-register .fleet-filters {display:flex;flex-wrap:wrap;gap:4px;margin:0 0 6px}
  #screen .desk-register > label {margin:8px 0}
  #screen .desk-register button[aria-pressed="true"] {background:#fff0aa;color:#292b26}
  #screen .desk-issues {overflow:auto}
}
@media (max-width:760px) {
  #screen .desk-register tbody tr {border-bottom:1px solid #d3d5ce;padding:9px 5px}
  #screen .desk-register td {border:0;padding:0;min-width:0}
  #screen .desk-register td::before {color:#565c56;font-size:12px}
  #screen [data-live-fleet] tbody tr {grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 12px}
  #screen [data-live-fleet] td:first-child {grid-column:1/-1}
  #screen .desk-issues table,#screen .desk-issues tbody {display:block}
  #screen .desk-issues thead {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #screen .desk-issues tr {display:grid;grid-template-columns:1fr 1fr;gap:5px 12px}
  #screen .desk-issues td:first-child {grid-column:1/-1}
  #screen .desk-issues td:first-child button {width:100%;text-align:left}
  #screen .desk-issues td::before {display:block}
  #screen .desk-issues td:nth-child(2)::before {content:"Машина"}
  #screen .desk-issues td:nth-child(3)::before {content:"Водитель"}
  #screen .desk-issues td:nth-child(4)::before {content:"Дата"}
  #screen .desk-issues td:nth-child(5)::before {content:"Состояние"}
  #screen .desk-register .fleet-scroll {scrollbar-gutter:auto}
}

@media (max-width:959px) {
  .phone:has(#screen[data-role="mechanic"]) > nav {grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* Single-purpose staff workspaces have no section rail. */
.phone:has(#screen:is([data-role="cashier"],[data-role="manager"])) {padding-left:0}
.phone:has(#screen:is([data-role="cashier"],[data-role="manager"])) > header {margin-left:0}
#screen[data-role="cashier"] ol {margin:0;padding:0;list-style:none;font-variant-numeric:tabular-nums}
#screen[data-role="cashier"] li {padding:8px 10px;line-height:1.55;border-top:1px solid #dce0db;overflow-wrap:anywhere}
#screen[data-role="cashier"] li:nth-child(even) {background:#f7f8f6}
@media (min-width:761px) {
  #screen[data-role="cashier"] form[data-action="roadAdvance"] {grid-template-columns:minmax(12em,22em) minmax(8em,12em) auto;align-items:end}
  #screen[data-role="cashier"] form[data-action="roadAdvance"] > :not(label):not(button) {grid-column:1/-1}
}
