* { box-sizing: border-box; }

:root {
  --brand: #22C55E;
  --brand-dark: #16a34a;
  --bg: #0b0d0c;
  --fg: #f4f6f5;
  --muted: #9aa39d;
  --card: #151917;
  --border: #2a322d;
  --accent-fg: #04140a;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.site-footer {
  padding: 0.75rem 1.25rem 1.25rem;
  text-align: right;
}

.build-tag {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #111613;
  border-bottom: 3px solid var(--brand);
  padding: 0.5rem 1rem;
}
.topnav .brand {
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.brand-logo, .hero-logo {
  border-radius: 50%;
  background: var(--brand);
}
.topnav ul { list-style: none; display: flex; gap: 0.15rem; margin: 0; padding: 0; flex: 1; flex-wrap: wrap; }
.topnav li a { color: #fff; padding: 0.4rem 0.7rem; border-radius: 4px; display: inline-block; }
.topnav li a:hover { background: rgba(34, 197, 94, 0.2); text-decoration: none; }
.topnav li.active > a {
  background: rgba(34, 197, 94, 0.25);
  box-shadow: inset 0 -3px 0 var(--brand);
}
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.user { color: var(--muted); font-size: 0.9rem; }
.logout-form { margin: 0; }

.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 22rem;
  width: 100%;
  text-align: center;
}
.login-form, .stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin-top: 1rem;
}
.login-form label, .stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.login-form input, .stack-form input:not(.autofill-trap), .stack-form textarea {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font: inherit;
}
.login-form .btn, .stack-form .btn { align-self: stretch; text-align: center; cursor: pointer; }
.autofill-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
body.bare main { display: flex; justify-content: center; padding-top: 4rem; }

body.landing main {
  position: relative;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 2rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-login {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  margin: 0;
}

.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 { margin: 0.5rem 0 0.25rem; }
.hero-logo { display: block; margin: 0 auto 0.5rem; }

body.landing .hero {
  margin: 0;
}
body.landing .hero h1 {
  margin: 0.85rem 0 0.4rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
body.landing .tagline {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.landing-logo {
  width: min(16rem, 70vw);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}

.card-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.card h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.muted { color: var(--muted); }

.btn {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--fg);
  background: transparent;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--accent-fg);
  font-weight: 600;
}
.btn.primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn.danger {
  border-color: #7f1d1d;
  color: #fca5a5;
}
.btn.danger:hover { background: #7f1d1d; text-decoration: none; color: #fff; }
button.btn { font: inherit; cursor: pointer; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.day-publish main {
  max-width: none;
  padding: 0.75rem 1rem 2rem;
}

.run-switch {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  gap: 1rem;
  margin: 0;
  font-weight: 600;
}
.run-switch .current {
  color: var(--fg);
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.05rem;
}
.run-switch a {
  color: var(--brand);
  text-decoration: none;
  padding-bottom: 0.05rem;
  border-bottom: 2px solid transparent;
}
.day-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.day-pick, .day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}
.sheet-approve {
  margin-left: auto;
}
.sheet-approve .btn.primary {
  min-width: 8rem;
}
.sheet-add { margin: 0.75rem 0 0; }
.day-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
}
.day-dock .flash { margin: 0 0 0.5rem; }
.day-dock .pub-status { margin: 0 0 0.5rem; }
.day-dock .sheet-approve { margin-left: 0; }
body.day-publish.day-docked main {
  padding-bottom: 8.5rem;
}
.day-pick label, .sheet-editor label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.day-pick select,
.sheet-editor select, .sheet-editor input[type="text"],
.sheet-editor input[name="number"], .sheet-editor input[name="parcels"] {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  min-width: 10rem;
}
.file-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.flash {
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  margin: 0 0 0.75rem;
}
.flash.ok { background: rgba(34, 197, 94, 0.15); border: 1px solid var(--brand); }
.flash.err { background: rgba(185, 28, 28, 0.2); border: 1px solid #b91c1c; color: #fecaca; }
.pub-status {
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.day-split {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.day-edit h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0;
  font-weight: 600;
  align-items: center;
}
.sheet-head .ink-swap {
  margin-left: auto;
}
.sheet-head .ink-swap .btn {
  font-weight: 600;
}
.to-check { color: #fb923c; }

.sheet-editor {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
}
.sheet-editor h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.sheet-editor label { margin-bottom: 0.5rem; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; }
.seg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  margin: 0.4rem 0;
}
.seg legend { color: var(--muted); padding: 0 0.3rem; }
.seg label { display: inline-flex; flex-direction: row; align-items: center; gap: 0.35rem; margin-right: 1rem; color: var(--fg); }

.sheet-table { display: flex; flex-direction: column; gap: 0.4rem; }
.sheet-row {
  display: grid;
  grid-template-columns: minmax(7rem, 32%) 1fr;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  align-items: start;
}
.sheet-row.has-extras {
  grid-template-columns: minmax(7rem, 26%) 1fr minmax(5.5rem, 28%);
}
.sheet-street {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}
.sheet-street:hover { color: var(--brand); }
.sheet-street.unknown,
.sheet-street.unknown:hover {
  color: #fecaca;
  text-decoration: underline;
  text-decoration-color: #b91c1c;
}
.sheet-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sheet-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 2rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #1c231f;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.low {
  background: rgba(251, 146, 60, 0.18);
  border-color: #fb923c;
  color: #fdba74;
}
.chip.add {
  border-style: dashed;
  font-weight: 700;
  color: var(--muted);
}
.chip.coural:not(.low) {
  color: var(--brand);
}
.chip-count { font-size: 0.8rem; opacity: 0.85; }
.chip.news {
  background: rgba(74, 222, 128, 0.14);
  border-color: #4ade80;
  color: #86efac;
}
.chip.drop {
  background: rgba(232, 121, 249, 0.14);
  border-color: #e879f9;
  color: #f0abfc;
}
.chip.both {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.28) 50%, rgba(232, 121, 249, 0.28) 50%);
  border-color: #c4b5fd;
  color: var(--fg);
}
.kind-news { color: #86efac !important; }
.kind-drop { color: #f0abfc !important; }
.kind-letter { color: #93c5fd !important; }
.kind-done { color: #86efac; }
.kind-skip { color: #fdba74; }
.kind-card { color: #f0abfc; }
.check-inline {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg) !important;
  font-size: 0.9rem;
  min-height: 2.4rem;
}
.check-inline.kind-news { color: #86efac !important; }
.check-inline.kind-drop { color: #f0abfc !important; }
.check-inline.kind-letter { color: #93c5fd !important; }

.photo-drop {
  margin: 0;
  min-height: 12rem;
}
.photo-drop.over { outline: 2px dashed var(--brand); }
.day-photo img {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.photo-empty {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
  min-height: 12rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  color: var(--fg);
}
.photo-replace {
  display: inline-block;
  margin-top: 0.5rem;
  cursor: pointer;
  color: var(--brand);
}

@media (min-width: 900px) {
  .day-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
  }
  .day-photo {
    position: sticky;
    top: 0.75rem;
  }
  .day-photo img {
    max-height: calc(100vh - 6rem);
  }
  .photo-empty { min-height: calc(100vh - 10rem); }
}

.table-wrap { overflow-x: auto; margin-top: 1rem; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.photo-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
}
.photo-card { position: relative; }
.photo-card .row-remove-form {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
}
.photo-card .row-remove {
  background: rgba(0, 0, 0, 0.55);
  min-width: 2rem;
  min-height: 2rem;
}
.addr-gps {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  margin: 0.35rem 0;
}
.addr-gps-label {
  font-weight: 700;
  min-width: 4.6rem;
  flex-shrink: 0;
}
.addr-gps [data-gps-text] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.addr-gps .row-remove-form { flex-shrink: 0; }

.pin-kind-bar {
  display: flex;
  gap: 0.4rem;
  margin: 0.35rem 0 0.5rem;
}
.pin-kind-bar .chip {
  cursor: pointer;
  background: #1c231f;
}
.pin-kind-bar .chip.is-on,
.map-follow-bar .chip.is-on {
  border-color: var(--brand);
  background: var(--brand);
  color: #0b100e;
}
.map-follow-bar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0.35rem 0 0;
}
.map-follow-bar .chip { cursor: pointer; }
.crumb-back {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  margin-right: 0.5rem;
}
.live-map-split {
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
  margin-top: 0.35rem;
}
.live-map-canvas { flex: 1 1 100%; min-width: 0; }
.live-map-split.is-open .live-map-canvas { flex: 1 1 50%; }
.live-map-pane {
  display: none;
  flex: 1 1 50%;
  min-width: 16rem;
  overflow: auto;
  max-height: min(80vh, 860px);
}
.live-map-split.is-open .live-map-pane { display: block; }
.live-map-pane h2 { margin-top: 0; font-size: 1.15rem; }
.live-map-pane h2 a { color: inherit; text-decoration: none; }
.live-map-pane h2 a:hover { color: var(--brand); }
.live-map-pane .photo-grid { margin-top: 0.75rem; }
.addr-detail-split.live-map-split.is-open .live-map-pane { display: block; }
.addr-detail-split .live-map-canvas { position: relative; z-index: 0; }
.addr-detail-split .pin-map.addr-edit-map {
  height: min(80vh, 860px);
  min-height: 22rem;
  margin-top: 0;
}
.addr-detail-split .pin-kind-bar { margin-top: 0; }
.addr-detail-split:not(.is-editing) .pin-kind-bar { display: none; }
.addr-detail-split:not(.is-editing) .addr-detail .row-remove-form { display: none; }
.addr-detail-split:not(.is-editing) .addr-note-important { pointer-events: none; }
.addr-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.12rem 0.85rem 0.85rem;
  margin: 0 0 1rem;
}
.addr-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.45rem;
}
.addr-detail-head h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.addr-detail-form { margin: 0; }
.addr-detail-head .btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}
.addr-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(7.5rem, 1fr);
  gap: 0.45rem 0.75rem;
  align-items: stretch;
}
.addr-detail-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}
.addr-detail-meta .addr-title-edit {
  margin: 0 0 0.1rem;
  font-size: 1.2rem;
}
.addr-detail-meta .addr-gps { margin: 0.1rem 0; }
.addr-detail-meta .addr-note-important {
  display: flex;
  margin: 0.15rem 0 0;
}
.addr-detail-photo {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  justify-self: end;
  grid-column: 2;
  grid-row: 1 / span 2;
  margin-right: -0.05rem;
}
.addr-detail-photo:has(.photo-grid) {
  height: 0;
  min-height: 100%;
}
.addr-detail-photo .photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  margin: 0 0 0 auto;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  width: max-content;
  overflow: hidden;
}
.addr-detail-photo .photo-card {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.addr-detail-photo .photo-grid img {
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 22rem;
  min-height: 0;
  object-fit: contain;
  object-position: right center;
  cursor: zoom-in;
}
.addr-detail .addr-note-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 0;
  min-height: 0;
  grid-column: 1;
  grid-row: 2;
}
.addr-detail textarea[name="note"] {
  flex: 1 1 auto;
  min-height: 7.5rem;
  height: 100%;
  resize: vertical;
  font: inherit;
  color: inherit;
  background: #121816;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}
.addr-detail textarea[name="note"]::placeholder {
  color: var(--muted);
  font-style: italic;
  opacity: 1;
}
.addr-detail-split:not(.is-editing) .addr-title-edit input[name="number"],
.addr-detail-split:not(.is-editing) .addr-title-edit input[name="street"],
.addr-detail-split:not(.is-editing) textarea[name="note"] {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  box-shadow: none;
  cursor: default;
}
.addr-detail-split:not(.is-editing) textarea[name="note"] { resize: none; }
.addr-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}
.addr-photo-lightbox.is-open { display: flex; }
.addr-photo-lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.addr-number-form { margin: 0 0 0.85rem; }
.addr-title-edit {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  line-height: 1.2;
}
.addr-title-edit input[name="number"] {
  width: 4.8rem;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: #121816;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.addr-title-edit input[name="street"] {
  flex: 1 1 8rem;
  min-width: 6rem;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: #121816;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.addr-title-edit .addr-suburb {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.addr-title-edit input[name="number"]:focus,
.addr-title-edit input[name="street"]:focus {
  outline: 2px solid var(--brand);
  border-color: var(--brand);
}
@media (max-width: 800px) {
  .addr-detail-split.live-map-split.is-open { flex-direction: column; }
  .addr-detail-split .live-map-pane { max-height: none; order: -1; }
  .addr-detail-split .pin-map.addr-edit-map {
    height: min(42vh, 420px);
    min-height: 14rem;
  }
  .addr-detail-body { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .addr-detail-meta, .addr-detail .addr-note-label, .addr-detail-photo { grid-column: 1; grid-row: auto; }
  .addr-detail-photo { order: 3; }
  .addr-detail .addr-note-label { order: 2; }
  .addr-detail-photo:has(.photo-grid) { height: auto; min-height: 0; }
  .addr-detail-photo .photo-grid img { height: 7rem; width: auto; }
}
.map-follow-bar:not(:has(.chip)):not(:has([data-full-map]:not([hidden]))) {
  display: none;
}
@media (max-width: 800px) {
  .live-map-split.is-open { flex-direction: column; }
  .live-map-pane { max-height: 42vh; order: -1; }
}
.stop-pin { background: none !important; border: none; }
.stop-pin-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  border: 2px solid #0b100e;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
}
.pin-pending .stop-pin-dot { background: #38bdf8; }
.pin-done .stop-pin-dot { background: #86efac; }
.pin-next-cycle .stop-pin-dot { background: #fdba74; }
.pin-carded .stop-pin-dot { background: #f0abfc; }
.pin-house-osm .stop-pin-dot { background: #86efac; }
.pin-house-app .stop-pin-dot { background: #38bdf8; }
.pin-delivery .stop-pin-dot {
  background: #f8fafc;
  border-color: #6d28d9;
  box-shadow: 0 0 0 2px #c4b5fd;
}
.house-pin { background: none !important; border: none; }
.house-pin-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  border: 2px solid #0b100e;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
  background: #86efac;
}
.pin-map.addr-edit-map {
  height: min(55vh, 520px);
  min-height: 18rem;
}
table.data td.row-actions {
  width: 2.6rem;
  padding: 0.1rem 0.2rem;
  text-align: right;
}
body.phone .topnav { flex-wrap: nowrap; gap: 0.4rem; }
body.phone .topnav .user { display: none; }
body.phone .topnav ul { display: none; }
body.phone .day-pick { display: none; }
body.phone .sheet-extras,
body.phone .sheet-row-extra { display: none; }
@media (max-width: 899px) {
  .day-toolbar { gap: 0.5rem; }
  .day-actions { width: 100%; }
  .sheet-approve {
    margin-left: 0;
    justify-content: space-between;
  }
  .sheet-head .ink-swap { margin-left: 0; width: 100%; }
  .sheet-head .ink-swap .btn { width: 100%; }
  .sheet-approve .btn.primary { flex: 1; text-align: center; min-height: 2.6rem; }
  .file-btn { width: 100%; text-align: center; }
  .sheet-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .sheet-row.has-extras { grid-template-columns: 1fr; }
  .chip { min-height: 2.4rem; padding: 0.25rem 0.7rem; }
  .photo-drop { min-height: 10rem; }
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}
.back-arrow {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
}
.back-arrow:hover { border-color: var(--brand); text-decoration: none; color: var(--brand); }
.crumb-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.crumb-sep { color: var(--border); }

.reorder {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.reorder li {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem 0.35rem 0.25rem;
  touch-action: none;
  user-select: none;
}
.reorder li.dragging { opacity: 0.7; border-color: var(--brand); }
.reorder li.is-selected {
  border-color: var(--brand);
  background: rgba(34, 197, 94, 0.12);
}
.reorder li.is-search-hit {
  border-color: var(--brand);
  background: rgba(34, 197, 94, 0.22);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.45);
}
.reorder li.is-selected.dragging { opacity: 0.85; }
.reorder .row-addr {
  align-self: stretch;
  display: flex;
  align-items: center;
  min-height: 2.4rem;
}
.drag-handle {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  letter-spacing: -0.15em;
  cursor: grab;
  min-height: 2.4rem;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.addr-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.addr-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
}
.addr-list li.is-miss,
.addr-list li[hidden] {
  display: none !important;
}
.addr-search-wrap {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.35rem 0 0.65rem;
  background: var(--bg);
}
.addr-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font: inherit;
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
}
.list-head h1 { margin: 0; }
.addr-pick {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.addr-pick:hover { text-decoration: underline; }
.row-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
.row-add:hover { background: rgba(34, 197, 94, 0.12); text-decoration: none; }
.row-remove-form { margin: 0; }
.row-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f87171;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
}
.row-remove:hover { background: rgba(248, 113, 113, 0.14); }
body.map-page main { max-width: none; }
.pin-map {
  height: min(80vh, 860px);
  min-height: 22rem;
  margin-top: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.leaflet-tooltip {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font: 13px/1.3 system-ui, sans-serif;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.leaflet-tooltip-top:before {
  border-top-color: var(--border);
}
.driver-van { background: none !important; border: none; }
.driver-van-svg {
  display: block;
  width: 40px;
  height: 28px;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}
.addr-deliveries-h {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.1rem;
}
table.data tr[data-delivery] { cursor: pointer; }
table.data tr[data-delivery]:hover td { background: rgba(196, 181, 253, 0.08); }
table.data tr[data-delivery].is-on td { background: rgba(196, 181, 253, 0.18); }
.addr-note-important {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  color: var(--fg) !important;
  font-size: 0.95rem !important;
}
.addr-note-important input[type="checkbox"] {
  width: auto;
  background: none;
  border: none;
  padding: 0;
  accent-color: var(--brand);
}
.sheet-history { margin-top: 0.5rem; }
.status {
  font-weight: 600;
}
.status.delivered { color: #86efac; }
.status.next-cycle { color: #fdba74; }
.status.carded { color: #f0abfc; }
.status.pending { color: var(--muted); }
.photo-empty-msg {
  min-height: 8rem;
  display: flex;
  align-items: center;
}
