:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182230;
  background: #f3f6f9;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: #f3f6f9;
}

.app-shell {
  width: min(100%, 44rem);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}

.app-header { margin-bottom: 1rem; }
.eyebrow { margin: 0 0 .25rem; color: #526273; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 8vw, 2.25rem); }
h2 { margin-bottom: 1rem; font-size: 1.15rem; }

.card {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #d8e0e8;
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(24 34 48 / 8%);
}

.status-list { margin: 0; }
.status-list > div { display: grid; grid-template-columns: minmax(7.5rem, 1fr) minmax(8rem, 1.25fr); gap: .75rem; padding: .7rem 0; border-top: 1px solid #e8edf2; }
.status-list dt { color: #526273; }
.status-list dd { margin: 0; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.status-list--compact > div { font-size: 1rem; line-height: 1.4; }
[data-status="connected"] { color: #137333; }
[data-status="waiting"] { color: #805d00; }
[data-status="error"] { color: #b3261e; }

.technical-status { margin-top: .65rem; }
.technical-status summary { cursor: pointer; color: #34495e; font-weight: 650; }
.technical-status[open] summary { margin-bottom: .5rem; }
.message { padding: .85rem 1rem; border-radius: .6rem; }
.message--error { border: 1px solid #f1b8b3; color: #8c1d18; background: #fff2f1; }
.empty-state { margin: 0; color: #657586; }

.route-list,
.stop-list {
  display: grid;
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-card {
  display: grid;
  width: 100%;
  min-height: 4.75rem;
  gap: .2rem;
  padding: .75rem .9rem;
  border: 2px solid #d8e0e8;
  border-radius: .75rem;
  color: inherit;
  background: #fff;
  font: inherit;
  text-align: left;
  touch-action: manipulation;
}

.route-card:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 2px;
}

.route-card[data-selected="true"] {
  border-color: #1769aa;
  background: #eef6ff;
}

.route-card strong { font-size: 1.05rem; line-height: 1.32; }
.route-card span { color: #526273; font-size: 1rem; line-height: 1.4; }

.driver-progress-summary {
  margin-bottom: .75rem;
  padding: .7rem;
  border: 1px solid #d8e0e8;
  border-radius: .7rem;
  background: #f7fafc;
}

.driver-progress-summary h3 {
  margin: 0 0 .5rem;
  color: #34495e;
  font-size: .92rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.driver-progress-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .15rem;
  margin: 0;
}

.driver-progress-metrics > div {
  min-width: 0;
  padding: .35rem .1rem;
  border-left: 1px solid #d8e0e8;
  text-align: center;
}

.driver-progress-metrics > div:first-child { border-left: 0; }
.driver-progress-metrics dt { color: #526273; font-size: .875rem; line-height: 1.25; overflow-wrap: anywhere; }
.driver-progress-metrics dd { margin: .12rem 0 0; font-size: 1.2rem; font-weight: 750; line-height: 1.2; }

.selected-route-summary {
  display: grid;
  gap: .15rem;
  margin-bottom: .75rem;
}
.selected-route-summary h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.route-start-control:empty { display: none; }
.route-start-action { width: 100%; margin: .45rem 0 .35rem; }
.route-start-status { margin: .4rem 0 .3rem; color: #137333; font-size: 1rem; font-weight: 750; line-height: 1.4; }
.route-completion-control:empty { display: none; }
.route-completion-status { margin: .3rem 0; color: #137333; font-size: 1rem; font-weight: 750; line-height: 1.4; }
.route-completion-warning { margin: .25rem 0; color: #9c5700; font-weight: 700; }
.route-progress { margin: 0; color: #1769aa; font-size: 1.05rem; font-weight: 750; line-height: 1.35; }
.route-progress-detail { margin: 0; color: #526273; font-size: 1rem; line-height: 1.4; }

.route-execution-progress { display: grid; gap: .35rem; margin-top: .55rem; }
.route-progress-segments { display: flex; gap: .25rem; width: 100%; min-width: 0; }
.route-progress-segment {
  flex: 1 1 0;
  min-width: 0;
  height: .6rem;
  border: 2px solid #9aabba;
  border-radius: 999px;
  background: #fff;
}
.route-progress-segment[data-progress-state="completed"] { border-color: #137333; background: #137333; }
.route-progress-segment[data-progress-state="current"] { border-color: #1769aa; background: repeating-linear-gradient(135deg, #1769aa 0 .22rem, #fff .22rem .42rem); }
.route-progress-continuous { width: 100%; height: .65rem; accent-color: #137333; }
.route-progress-summary-text { margin: 0; color: #526273; font-size: 1rem; font-weight: 650; line-height: 1.4; }

.stop-card {
  overflow: hidden;
  border: 1px solid #d8e0e8;
  border-radius: .8rem;
  background: #fff;
}

.stop-card[data-stop-state="active"] { border: 2px solid #1769aa; box-shadow: 0 3px 10px rgb(23 105 170 / 14%); }
.stop-card[data-stop-state="completed"] { border-left: .35rem solid #137333; }
.stop-card[data-stop-state="upcoming"] { border-left: .35rem solid #8a98a8; }

.stop-card-toggle {
  display: grid;
  width: 100%;
  min-height: 4.25rem;
  gap: .15rem;
  padding: .65rem .85rem;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  touch-action: manipulation;
}

.stop-card-toggle:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: -3px;
}

.stop-card[data-expanded="true"] .stop-card-toggle { border-bottom: 1px solid #e1e7ed; background: #f7fafc; }
.stop-card[data-stop-state="active"] .stop-card-toggle { background: #eef6ff; }
.stop-card-sequence { color: #526273; font-size: .9rem; font-weight: 750; letter-spacing: .02em; line-height: 1.3; text-transform: uppercase; }
.stop-card-toggle strong { font-size: 1.125rem; line-height: 1.35; overflow-wrap: anywhere; }
.stop-card-compact { color: #526273; font-size: 1rem; line-height: 1.4; }
.stop-card-details { padding: .7rem .85rem .85rem; }
.stop-card-heading { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.stop-card .stop-status { color: #805d00; font-weight: 700; }
.stop-card .stop-event-time { color: #34495e; }
.stop-facts {
  margin-top: .42rem;
  padding-top: .5rem;
  border-top: 1px solid #e1e7ed;
}

.stop-facts h3 {
  margin: 0 0 .25rem;
  color: #526273;
  font-size: .9rem;
  letter-spacing: .06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.stop-facts p { margin: 0; font-size: 1rem; line-height: 1.5; }
.stop-instructions { padding: .6rem; border: 1px solid #d8e0e8; border-radius: .6rem; background: #f7fafc; }
.stop-facts--warning { padding: .6rem; border: 1px solid #f2c66d; border-radius: .6rem; background: #fff8e6; }
.stop-facts--warning dd { color: #6f4e00; }
.driver-note-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 6rem;
  padding: .7rem;
  border: 1px solid #9aabba;
  border-radius: .6rem;
  color: inherit;
  background: #fff;
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}
.driver-note-editor textarea:focus-visible { outline: 3px solid #8ab4f8; outline-offset: 2px; }
.driver-note-feedback { display: flex; justify-content: space-between; gap: .75rem; margin-top: .3rem; color: #526273; font-size: .88rem; line-height: 1.35; }
.driver-note-save { width: 100%; margin-top: .55rem; }
.driver-note-readonly { white-space: pre-wrap; overflow-wrap: anywhere; }
.payment-condition__status { color: #526273; }
.payment-condition__controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin-top: .45rem;
}
.payment-condition__option {
  min-height: 3rem;
  padding: .65rem;
  border: 1px solid #1769aa;
  border-radius: .6rem;
  color: #1769aa;
  background: #fff;
  font: inherit;
  font-weight: 750;
}
.payment-condition__option[aria-pressed="true"] { color: #fff; background: #1769aa; }
.payment-condition__option:disabled { border-color: #9aabba; color: #526273; background: #e7edf2; }
.payment-condition__option:focus-visible { outline: 3px solid #8ab4f8; outline-offset: 2px; }
.no-delivery-editor label { display: block; color: #526273; font-size: .9rem; font-weight: 750; }
.no-delivery-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 6rem;
  margin-top: .35rem;
  padding: .7rem;
  border: 1px solid #9aabba;
  border-radius: .6rem;
  color: inherit;
  background: #fff;
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}
.no-delivery-editor textarea:focus-visible { outline: 3px solid #8ab4f8; outline-offset: 2px; }
.no-delivery-editor__counter { display: block; margin-top: .25rem; color: #526273; font-size: .88rem; }
.no-delivery-editor__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: .55rem; }
.no-delivery-editor__actions button:not(.stop-action) {
  min-height: 3.25rem;
  padding: .75rem 1rem;
  border: 1px solid #9aabba;
  border-radius: .65rem;
  color: #34495e;
  background: #fff;
  font: inherit;
  font-weight: 750;
  text-transform: uppercase;
}

.stop-facts dl { margin: 0; }
.stop-facts dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8.5rem, auto);
  align-items: start;
  gap: .5rem;
  padding: .16rem 0;
  font-size: 1rem;
  line-height: 1.4;
}
.stop-facts dt { color: #526273; }
.stop-facts dd { margin: 0; font-size: 1.05rem; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.stop-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: .65rem;
  margin-top: .55rem;
}

.stop-action {
  min-height: 3.25rem;
  padding: .75rem 1rem;
  border: 0;
  border-radius: .65rem;
  color: #fff;
  background: #1769aa;
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
  text-transform: uppercase;
  touch-action: manipulation;
}

.stop-action:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 2px;
}

.stop-action:disabled {
  color: #526273;
  background: #d8e0e8;
}

.stop-action--final { background: #0b6b3a; }

.route-finalization-dialog {
  width: min(calc(100% - 2rem), 24rem);
  padding: 0;
  border: 0;
  border-radius: .8rem;
  color: #182230;
  background: #fff;
  box-shadow: 0 1rem 3rem rgb(24 34 48 / 28%);
}

.route-finalization-dialog::backdrop { background: rgb(24 34 48 / 58%); }
.route-finalization-dialog__content { padding: 1.25rem; }
.route-finalization-dialog__content h2 { margin: 0 0 .75rem; }
.route-finalization-dialog__content p { margin: 0; line-height: 1.5; }
.route-finalization-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: .65rem;
  margin-top: 1.25rem;
}

.route-finalization-dialog__actions button {
  min-height: 3rem;
  padding: .65rem .75rem;
  border: 1px solid #9aabba;
  border-radius: .6rem;
  color: #182230;
  background: #fff;
  font: inherit;
  font-weight: 750;
  text-transform: uppercase;
}

.route-finalization-dialog__actions .route-finalization-dialog__confirm {
  border-color: #0b6b3a;
  color: #fff;
  background: #0b6b3a;
}

.route-finalization-dialog__actions button:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 2px;
}

@media (min-width: 40rem) {
  .app-shell { padding-right: 1.5rem; padding-left: 1.5rem; }
  .card { padding: 1.25rem; }
}

@media (min-width: 23rem) {
  .stop-facts dd { white-space: nowrap; }
}

@media (max-width: 25rem) {
  .driver-progress-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .driver-progress-metrics > div:nth-child(3) { border-left: 0; }
  .stop-facts dl > div { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
}
