/* Sunset v2c — Field app only (no shared design-tokens package). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --brand: #e2067e;
  --brand-hover: #b90065;
  --grad: linear-gradient(135deg, #ff2e93 0%, #ff5c4a 50%, #ff8a00 100%);
  --spark: #ff8a00;
  --teal: #00837e;
  --teal-on-dark: #04c8bd;
  --ink: #16070e;
  --ink-2: #4a3a42;
  --muted: #7a6a72;
  --page: #faf8f9;
  --subtle: #fff3f7;
  --surface: #ffffff;
  --line: #ede3e8;
  --border-focus: #e2067e;
  --ok: #00837e;
  --warn: #b35c00;
  --danger: #c4162a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 7, 14, 0.06), 0 6px 20px rgba(22, 7, 14, 0.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--page);
  color: var(--ink);
}

#app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}

.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand img {
  height: 28px;
  width: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--subtle);
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chip.ok {
  background: #e3f5f4;
  color: var(--teal);
}

.header-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

#app-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 16px 16px 3rem;
}

@media (max-width: 767px) {
  #app-main {
    max-width: 26rem;
    padding: 12px 12px 2.5rem;
  }
}

.login-shell {
  min-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
  padding: 12px 0 2rem;
}

.login-shell .brand-mark {
  margin: 0 auto 1rem;
}

.brand-mark {
  display: block;
  width: min(100%, 15rem);
  height: auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 26rem;
  padding: 24px 20px 20px;
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 0.35rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

h1.screen-title {
  font-size: 22px;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

h2.section-title {
  font-size: 17px;
  margin: 0.75rem 0 0.5rem;
}

#screen {
  display: grid;
  gap: 0.75rem;
}

label.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin: 10px 0 4px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-height: 2.75rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(226, 6, 126, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  min-height: 2.75rem;
}

.btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  color: #fff;
}

.btn-grad {
  background: var(--grad);
  border: 0;
  color: var(--ink);
  font-weight: 700;
}

.btn-grad:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-block {
  width: 100%;
}

button.stop-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  text-align: inherit;
  color: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button.stop-row .seq {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: none;
  font-size: 13px;
}

button.stop-row.cur {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(226, 6, 126, 0.12);
}

button.stop-row.cur .seq {
  background: var(--grad);
  color: var(--ink);
}

button.stop-row.done {
  opacity: 0.72;
}

button.stop-row.done .seq {
  background: #e3f5f4;
  color: var(--teal);
}

button.stop-row:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.stop-meta {
  flex: 1;
  min-width: 0;
}

.stop-meta b {
  display: block;
  font-size: 14px;
}

.stop-eta {
  font-size: 12px;
  color: var(--muted);
  flex: none;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

.shift-card {
  border-color: var(--teal);
}

.shift-card-muted {
  opacity: 0.85;
}

.notice-bar {
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--subtle);
  border: 1px solid #f8cfe2;
  font-size: 13px;
}

.notice-bar.teal {
  background: #e8f7f6;
  border-color: #b5e3df;
}

.langs {
  display: flex;
  gap: 0.4rem;
}

.langs button {
  min-width: 3rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
}

.langs button[aria-pressed="true"] {
  background: var(--subtle);
  border-color: var(--brand);
  color: var(--brand);
}

#status {
  position: sticky;
  bottom: 0;
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--subtle);
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
}

[hidden] {
  display: none !important;
}

html[dir="rtl"] #app-main,
html[dir="rtl"] .login-shell {
  text-align: right;
}

.accept-header {
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--subtle);
  border: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
}

.accept-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.accept-actions .btn {
  flex: 1 1 8rem;
}

.reject-panel,
.problem-panel,
.pod-capture {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.action-disabled {
  margin: 0.5rem 0;
}

.action-disabled .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-disabled-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--teal);
}

#stops-locked {
  margin: 0;
  font-size: 0.9rem;
  color: var(--teal);
}

.stop-detail-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 58-24 — navigation handoff row + route ack chip. The geo: fallback stays a
   quiet inline link next to the Maps/Waze buttons. */
.nav-actions {
  align-items: center;
}

.nav-geo {
  font-size: 0.85rem;
  color: var(--teal);
  text-decoration: underline;
  padding: 0.4rem 0;
}

.route-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 58-19a — dashboard hero + remaining-stops timeline. Rows keep the ≥48px
   touch target; RTL comes free from flex/logical alignment. */
.dashboard {
  display: grid;
  gap: 0.75rem;
}

.dashboard .btn {
  min-height: 3rem;
}

.chip.warn {
  background: #fdf0dd;
  color: var(--warn);
}

.chip.danger {
  background: #fdeaea;
  color: var(--danger);
}

.chip.muted {
  background: #f3eef1;
  color: var(--muted);
}

.hero-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(226, 6, 126, 0.12);
  display: grid;
  gap: 0.25rem;
}

.hero-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.hero-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.hero-badges {
  margin-top: 0.15rem;
}

.hero-line {
  margin: 0;
  font-size: 14px;
}

.hero-open {
  margin-top: 0.5rem;
  min-height: 3rem;
}

.dashboard-progress {
  margin: 0;
}

.card.dashboard-empty {
  text-align: center;
  padding: 24px 16px;
}

.card.dashboard-empty p {
  margin: 0.35rem 0 0;
}

.card.dashboard-empty.all-done {
  border-color: var(--teal);
  background: #eef9f8;
}

p.dashboard-empty {
  text-align: center;
  padding: 1rem 0;
}

button.timeline-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  min-height: 3rem;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  text-align: inherit;
  color: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button.timeline-row .seq {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: none;
  font-size: 13px;
}

button.timeline-row.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(226, 6, 126, 0.12);
}

button.timeline-row.current .seq {
  background: var(--grad);
  color: var(--ink);
}

button.timeline-row.done {
  opacity: 0.72;
}

button.timeline-row.done .seq {
  background: #e3f5f4;
  color: var(--teal);
}

button.timeline-row:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 60-13b — cancelled stop rows: greyed and never tappable. Reuses the
   locked --line/--muted pair; no new hex. */
button.stop-row.cancelled,
button.timeline-row.cancelled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.stop-row.cancelled .seq,
button.timeline-row.cancelled .seq {
  background: var(--line);
  color: var(--muted);
}

.cancel-banner {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.timeline-time {
  flex: none;
  display: grid;
  gap: 4px;
  justify-items: end;
  max-width: 40%;
}

.map-placeholder {
  min-height: 140px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #eef1ee linear-gradient(#e2e7e2 1px, transparent 1px),
    linear-gradient(90deg, #e2e7e2 1px, transparent 1px);
  background-size: 40px 40px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}

/* 58-19b — connection banner, duty card, KPI strip, notifications inbox.
   Same patterns as the timeline: flex layout so RTL mirrors for free,
   ≥48px targets via the .dashboard .btn / min-height rules. */
.conn-banner {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
}

.conn-banner.online {
  background: #e8f7f6;
  border-color: #b5e3df;
  color: var(--teal);
}

.conn-banner.reconnecting,
.conn-banner.offline {
  background: #fdf0dd;
  border-color: #f0d0a8;
  color: var(--warn);
}

.duty-card {
  display: grid;
  gap: 0.6rem;
}

.duty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.duty-actions .btn {
  flex: 1 1 9rem;
  min-height: 3rem;
}

.duty-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.kpi-tile {
  flex: 1 1 6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  box-shadow: var(--shadow);
}

.kpi-tile .kpi-value {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.kpi-tile .kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inbox-card {
  display: grid;
  gap: 0.5rem;
}

.inbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 3rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.inbox-row.unread {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(226, 6, 126, 0.1);
}

.inbox-row .inbox-body {
  margin: 0;
  font-size: 14px;
}

.pod-stub-note {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

@media (min-width: 768px) {
  .route-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 16px;
    align-items: start;
  }

  .map-placeholder {
    min-height: 320px;
    margin-top: 0;
  }
}

/* 58-20 — offline queue panel: status chips + conflict decision rows. */
.queue-panel {
  display: grid;
  gap: 0.5rem;
  margin-block: 0.75rem;
}

.queue-attention {
  color: var(--danger);
  font-weight: 600;
  margin: 0;
}

.queue-rows {
  display: grid;
  gap: 0.5rem;
}

.queue-row {
  border: 1px solid var(--line, #e7dfe4);
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  display: grid;
  gap: 0.375rem;
}

.queue-row.st-conflict {
  border-color: var(--warn);
}

.queue-row.st-failed,
.queue-row.st-expired {
  border-color: var(--danger);
}

.queue-explain {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.queue-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.queue-actions .btn {
  min-height: 3rem;
}

/* 58-22c — driver chat. Same patterns as the inbox/timeline: flex rows so
   RTL mirrors for free, ≥48px targets for gloves. Bubbles align by logical
   direction (margin-inline) so me/peer flip with dir=rtl automatically. */
.chat-card {
  display: grid;
  gap: 0.6rem;
}

.chat-open {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 3rem;
  width: 100%;
}

.chat-thread-list {
  display: grid;
  gap: 0.5rem;
}

button.chat-thread-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 3rem;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: start;
  color: inherit;
  font-weight: 500;
  cursor: pointer;
}

button.chat-thread-row:hover {
  border-color: var(--brand);
}

.chat-unread {
  flex: none;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 2px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 2px;
}

.chat-msg.me {
  align-self: flex-end;
  background: var(--subtle);
  border-color: #f3d3e4;
}

.chat-msg.peer {
  align-self: flex-start;
}

.chat-msg.queued {
  opacity: 0.75;
  border-style: dashed;
}

.chat-msg .chat-body {
  margin: 0;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg .chat-meta {
  font-size: 11px;
}

.chat-msg .chip {
  justify-self: start;
}

.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-quick-chip {
  flex: 1 1 8rem;
  min-height: 3rem;
}

.chat-composer {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.chat-composer textarea {
  flex: 1;
  min-height: 3rem;
  resize: vertical;
}

.chat-composer .btn {
  flex: none;
  min-width: 5rem;
  min-height: 3rem;
}

.chat-note {
  margin: 0;
  color: var(--warn);
}
