:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #f6f8fb;
  --panel-strong: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --brand: #111827;
  --brand-2: #0b1220;
  --brand-soft: #edf1f6;
  --danger: #c84b3f;
  --ok: #208a55;
  --warn: #9a6a00;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.09);
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-nav-space: 76px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.35;
}

body {
  overflow-x: hidden;
  height: 100dvh;
}

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

button {
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:active,
.btn:active {
  transform: translateY(1px) scale(0.99);
}

button.tap-feedback,
.btn.tap-feedback,
.chip.tap-feedback,
.icon-btn.tap-feedback,
button.is-pending-tap {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.12), 0 5px 16px rgba(64, 0, 8, 0.14);
}

.app-shell {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.boot-card {
  width: min(360px, calc(100vw - 32px));
  margin: 18vh auto 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}

.boot-card span {
  color: var(--muted);
}

.hard-update-screen {
  position: fixed;
  inset: 0 0 calc(var(--bottom-nav-space) + var(--safe-bottom)) 0;
  z-index: 29;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.hard-update-card {
  width: min(330px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 46px rgba(80, 0, 8, 0.16);
  padding: 22px 18px;
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
  pointer-events: auto;
}

.hard-update-card img {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #fff;
}

.hard-update-card strong {
  color: var(--brand-2);
  font-size: 20px;
}

.hard-update-card span {
  color: var(--muted);
  font-size: 14px;
}

.is-hard-updating .nav {
  z-index: 76;
}

.topbar {
  position: relative;
  order: 1;
  flex: 0 0 auto;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.bell-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-2);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(92, 0, 10, 0.08);
}

.bell-btn .app-icon {
  width: 20px;
  height: 20px;
}

.bell-btn.has-due {
  border-color: #e0bd65;
  background: #fff8df;
  color: #6d4a00;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 16px;
  display: inline-grid;
  place-items: center;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #f0b8bc;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-mark.compact {
  width: 34px;
  height: 34px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-title {
  min-width: 0;
}

.brand-title strong,
.brand-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title strong {
  color: var(--brand-2);
}

.brand-title span {
  color: var(--muted);
  font-size: 12px;
}

.user-chip {
  max-width: 150px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  order: 2;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 12px;
  overflow: hidden;
}

.main.scroll-main {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px;
}

.main-inicio {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.main.route-main {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.main.map-main {
  padding: 7px 8px 8px;
  overflow: hidden;
}

.nav {
  position: relative;
  order: 3;
  flex: 0 0 auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 30;
  width: 100%;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.nav button {
  min-width: 0;
  min-height: 44px;
  height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-rows: 20px 14px;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 5px 2px;
  font-size: 11px;
  line-height: 1.05;
  text-align: center;
}

.nav .nav-icon {
  width: 24px;
  height: 20px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.nav button > span:last-child {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav .app-icon {
  width: 19px;
  height: 19px;
}

.app-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
}

.app-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.main.scroll-main .panel {
  height: auto;
  min-height: 100%;
  display: grid;
  align-content: start;
  overflow: visible;
}

.main-inicio .panel {
  height: auto;
  min-height: 100%;
  display: grid;
  align-content: start;
  overflow: visible;
  padding-bottom: calc(18px + var(--safe-bottom));
}

.route-panel {
  height: auto;
  min-height: 100%;
  gap: 8px;
  overflow: visible;
  display: grid;
  align-content: start;
}

.panel > .grid,
.panel-scroll {
  min-height: 0;
  overflow: auto;
}

.config-panel {
  overflow: auto;
}

.section-head {
  display: grid;
  gap: 8px;
}

.section-head h1,
.section-head h2,
.section-head p {
  margin: 0;
}

.section-head h1 {
  font-size: 22px;
}

.section-head h2 {
  font-size: 18px;
}

.section-head p {
  color: var(--muted);
  font-size: 13px;
}

.toolbar,
.chip-row,
.action-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.toolbar::-webkit-scrollbar,
.chip-row::-webkit-scrollbar,
.action-row::-webkit-scrollbar {
  display: none;
}

.chip,
.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(64, 0, 8, 0.04);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.chip {
  font-size: 13px;
}

.chip.active,
.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.btn.secondary {
  border-color: var(--brand);
  background: #fff;
  color: var(--brand-2);
  font-weight: 750;
}

.btn.danger {
  border-color: #e2a49c;
  background: #fff0ee;
  color: #9c3229;
}

.btn.danger.strong {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 850;
}

.btn.ghost {
  background: transparent;
}

.btn.small,
.icon-btn {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.icon-btn {
  min-width: 34px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
}

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

@media (hover: hover) {
  .btn:not(:disabled):hover,
  .chip:not(:disabled):hover,
  .home-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(64, 0, 8, 0.11);
  }
}

.btn.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-top-color: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: #fff;
  animation: spin 720ms linear infinite;
}

.btn.is-pending-tap:not(.is-loading) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 850;
}

.btn.primary.is-pending-tap:not(.is-loading),
.btn.danger.strong.is-pending-tap:not(.is-loading) {
  background: var(--brand);
  color: #fff;
}

.button-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.button-label::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 720ms linear infinite;
}

.grid {
  display: grid;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  padding: 9px;
}

.stat strong {
  display: block;
  font-size: 20px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.notice.good {
  border-color: #f2b9be;
  background: var(--brand-soft);
  color: var(--brand-2);
}

.notice.warn {
  border-color: #e0bd65;
  background: #fff6d8;
  color: #6d4a00;
}

.notice.error {
  border-color: #dc9a93;
  background: #fff0ee;
  color: #8d2b24;
}

.followup-card {
  display: grid;
  gap: 8px;
  border: 1px solid #efc2c6;
  border-radius: var(--radius);
  background: #fffafa;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(136, 0, 12, 0.06);
}

.followup-card.compact {
  padding: 9px;
}

.followup-list {
  display: grid;
  gap: 7px;
}

.followup-category {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.client-alert-list {
  display: grid;
  gap: 7px;
}

.followup-item {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.followup-item.due {
  border-color: #e0bd65;
  background: #fff8df;
}

.client-alert-item {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.client-alert-item.alert-yellow {
  border-color: #e0bd65;
  background: #fff8df;
}

.client-alert-item.alert-orange {
  border-color: #ef9f55;
  background: #fff2e4;
}

.client-alert-item.alert-red {
  border-color: #dfa09a;
  background: #fff0ee;
}

.client-alert-item.alert-gray {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.followup-item strong,
.followup-item small,
.client-alert-item strong,
.client-alert-item small {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.followup-item small,
.client-alert-item small {
  color: var(--muted);
  font-size: 12px;
}

.followup-actions {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.followup-actions::-webkit-scrollbar {
  display: none;
}

.client-alert-actions {
  flex-wrap: nowrap;
}

.notice.compact {
  padding: 7px 9px;
  font-size: 12.5px;
  line-height: 1.25;
}

.offline-steps {
  display: grid;
  gap: 5px;
  color: var(--ink);
}

.offline-steps strong {
  color: var(--brand-2);
}

.offline-steps span,
.offline-steps small {
  display: block;
  color: var(--muted);
}

.offline-download-progress {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 10px;
  background: #fff7f7;
}

.offline-download-row {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.offline-download-row strong {
  min-width: 0;
  color: var(--brand-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-download-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 850;
}

.offline-download-bar {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #f1dadd;
}

.offline-download-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--brand);
  transition: width 160ms ease;
}

.offline-map-card .action-row {
  display: grid;
  grid-template-columns: 1fr;
  overflow: visible;
  padding-bottom: 0;
}

.offline-map-card .action-row .btn {
  width: 100%;
  white-space: normal;
  line-height: 1.15;
}

.app-toast {
  position: fixed;
  z-index: 72;
  left: 14px;
  right: 14px;
  bottom: calc(var(--bottom-nav-space) + 14px + var(--safe-bottom));
  max-width: 520px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f2b9be;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 780;
  text-align: center;
  box-shadow: 0 12px 34px rgba(64, 0, 8, 0.18);
  pointer-events: none;
  animation: toast-in 160ms ease-out;
}

.app-toast.error {
  border-color: #dc9a93;
  background: #fff0ee;
  color: #8d2b24;
}

.app-toast.warn {
  border-color: #e0bd65;
  background: #fff8df;
  color: #6d4a00;
}

.app-toast.loading {
  color: var(--brand-2);
}

.app-toast.update {
  border-color: #efc2c6;
  background: #fff;
  pointer-events: auto;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.toast-icon .app-icon {
  width: 12px;
  height: 12px;
}

.toast-icon.loading {
  border: 2px solid #f2b9be;
  border-right-color: transparent;
  background: transparent;
  animation: spin 720ms linear infinite;
}

.toast-action {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  pointer-events: auto;
}

@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.route-card,
.map-card,
.form-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 2px 10px rgba(31, 37, 34, 0.06);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.pwa-card,
.diagnostic-card,
.offline-map-card {
  background: linear-gradient(180deg, #ffffff, #fff8f8);
}

.diagnostic-card summary {
  cursor: pointer;
  font-weight: 850;
  color: var(--brand-2);
}

.route-card {
  overflow: hidden;
}

.home-install-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin: 0 0 12px;
}

.home-install-card strong,
.home-install-card span {
  display: block;
}

.home-install-card strong {
  font-size: 14px;
  line-height: 1.2;
}

.home-install-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.home-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.login-install-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff8f8;
}

.login-install-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.main-recorridos .section-head {
  gap: 2px;
}

.main-recorridos .section-head h1 {
  font-size: 21px;
  line-height: 1.12;
}

.route-top-toolbar {
  gap: 6px;
}

.route-switch-row {
  padding-bottom: 1px;
}

.route-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  overflow: hidden;
}

.main.scroll-main .route-grid {
  flex: 0 0 auto;
  overflow: visible;
}

.main.route-main .route-grid {
  flex: 0 0 auto;
  overflow: visible;
  align-content: start;
}

.route-grid > .route-card {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.main.scroll-main .route-grid > .route-card {
  height: auto;
  display: block;
}

.main.route-main .route-grid > .route-card {
  height: auto;
  display: block;
}

.route-head {
  padding: 10px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.close-day-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #f0b0b5;
  border-radius: var(--radius);
  background: var(--brand-soft);
  padding: 10px;
}

.close-day-callout span,
.form-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.route-summary-line {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.route-summary-line::-webkit-scrollbar {
  display: none;
}

.route-summary-line span {
  flex: 0 0 auto;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 750;
}

.route-summary-line strong {
  color: var(--ink);
}

.route-sticky-close {
  position: relative;
  bottom: auto;
  z-index: 18;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.route-sticky-close .btn {
  width: 100%;
}

.route-title {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.route-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.route-title small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.list-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.route-list-controls {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.route-list-controls.order-mode-controls {
  grid-template-columns: minmax(0, 1fr) auto;
}

.order-mode-label {
  min-width: 0;
}

.done-order-btn {
  border-color: #83c99d;
  background: #ddffeb;
  color: #145b35;
}

.route-filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.soft-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.search-input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field textarea {
  resize: vertical;
}

.field label {
  display: block;
  margin: 0 0 5px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 750;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(17, 24, 39, 0.68);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.09);
}

.form-grid.two .full-field {
  grid-column: 1 / -1;
}

.visit-images-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffafa;
}

.visit-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.visit-image {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.visit-image img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: #f3eeee;
}

.visit-image figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.visit-image figcaption span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-btn {
  position: relative;
  justify-content: center;
  cursor: pointer;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-btn.disabled {
  opacity: .55;
  cursor: not-allowed;
}

.visit-list {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: calc(12px + var(--safe-bottom));
  scroll-padding-bottom: calc(12px + var(--safe-bottom));
}

.route-end-card {
  margin: 10px 8px calc(14px + var(--safe-bottom));
  padding: 12px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fff6f7);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.route-end-card.closed {
  border-color: rgba(22, 163, 74, 0.22);
  background: #f2fff6;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.route-closed-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.route-end-card strong,
.route-end-card small {
  display: block;
}

.route-end-card small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.3;
}

.main.scroll-main .visit-list {
  overflow: visible;
}

.main.route-main .visit-list {
  overflow: visible;
  padding-bottom: calc(var(--bottom-nav-space) + var(--safe-bottom));
}

.main.route-main .route-sticky-close {
  display: none;
}

.visit-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 7px 8px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  background: #fff;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.visit-row:last-child {
  border-bottom: 0;
}

.visit-row.visited {
  background: #e8fff0;
  border-left: 5px solid var(--ok);
  padding-left: 4px;
}

.visit-row.status-green {
  background: #e8fff0;
  border-left: 5px solid var(--ok);
  padding-left: 4px;
}

.visit-row.no-estaba {
  background: #fff8df;
  border-left: 5px solid var(--warn);
  padding-left: 4px;
}

.visit-row.status-yellow {
  background: #fff8df;
  border-left: 5px solid var(--warn);
  padding-left: 4px;
}

.visit-row.problem {
  background: #fff0ee;
  border-left: 5px solid var(--danger);
  padding-left: 4px;
}

.visit-row.status-red {
  background: #fff0ee;
  border-left: 5px solid var(--danger);
  padding-left: 4px;
}

.visit-order {
  min-width: 0;
  display: grid;
  place-items: center;
  align-self: start;
  min-height: 32px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 850;
  font-size: 12px;
}

.visit-main {
  min-width: 0;
}

.visit-name {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.visit-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.18;
}

.visit-meta {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 3px;
}

.badge {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 750;
}

.badge.ok {
  border-color: #85cfa6;
  background: #ddffeb;
  color: #145b35;
}

.badge.warn {
  border-color: #e2be65;
  background: #fff3c9;
  color: #704b00;
}

.badge.danger {
  border-color: #dfa09a;
  background: #ffe7e4;
  color: #8d2b24;
}

.badge.info {
  border-color: #f0b8bc;
  background: var(--brand-soft);
  color: var(--brand-2);
}

.badge.alert-yellow,
.client-alert-summary.alert-yellow {
  border-color: #e2be65;
  background: #fff3c9;
  color: #704b00;
}

.badge.alert-orange,
.client-alert-summary.alert-orange {
  border-color: #ef9f55;
  background: #fff2e4;
  color: #8a4300;
}

.badge.alert-red,
.client-alert-summary.alert-red {
  border-color: #dfa09a;
  background: #ffe7e4;
  color: #8d2b24;
}

.badge.alert-gray,
.client-alert-summary.alert-gray {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.client-alert-badge {
  max-width: 180px;
}

.badge.image-badge {
  border-color: #d9b1b6;
  background: #fff7f8;
  color: var(--brand-2);
}

.badge.image-badge .app-icon {
  width: 13px;
  height: 13px;
}

.visit-actions {
  display: flex;
  gap: 4px;
  align-content: start;
  align-items: start;
  justify-content: end;
  flex-wrap: nowrap;
}

.visit-actions .icon-btn {
  flex: 0 0 auto;
}

.visit-actions .status-action.active {
  border-color: #83c99d;
  background: #ddffeb;
  color: #145b35;
}

.visit-actions .status-action.green {
  border-color: #83c99d;
  background: #ddffeb;
  color: #145b35;
}

.visit-actions .status-action.yellow {
  border-color: #e2be65;
  background: #fff3c9;
  color: #704b00;
}

.visit-actions .status-action.red {
  border-color: #dfa09a;
  background: #ffe7e4;
  color: #8d2b24;
}

.visit-actions .map-action {
  border-color: #9bd7b1;
  background: #effff4;
  color: #145b35;
}

.visit-actions .notice-action {
  border-color: #9bd7b1;
  background: #e9fff1;
  color: #0b7a36;
}

.order-tools {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  gap: 4px;
}

.route-action-sheet .btn,
.visit-menu-sheet .btn {
  justify-content: center;
}

.form-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.offline-map-card {
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.map-screen {
  gap: 6px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.map-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
}

.map-search-wrap {
  position: relative;
  min-width: 0;
}

.map-search-input {
  min-height: 38px;
}

.map-search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.map-search-field .btn {
  min-height: 38px;
  white-space: nowrap;
}

.map-search-results {
  position: static;
  max-height: min(42vh, 360px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
  margin-top: 8px;
}

.map-search-results button {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  text-align: left;
  padding: 8px;
}

.map-search-results button:last-child {
  border-bottom: 0;
}

.map-search-results strong,
.map-search-results small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-search-results small {
  grid-column: 2;
  color: var(--muted);
}

.map-chip-row {
  padding-bottom: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 6px;
}

.map-chip-row .chip {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 780;
}

.map-control-strip {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.9fr 0.9fr;
  gap: 6px;
  min-width: 0;
}

.map-control-strip .map-control {
  min-width: 0;
  min-height: 34px;
  padding: 6px 7px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(64, 0, 8, 0.08);
}

.map-control .app-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.map-control span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fffafa;
  box-shadow: 0 8px 22px rgba(64, 0, 8, 0.08);
}

.map-canvas,
.maplibre-base,
.leaflet-map,
.map-simple-fallback,
.simple-map-grid {
  position: absolute;
  inset: 0;
}

.map-canvas {
  overflow: hidden;
}

.maplibre-base {
  z-index: 1;
  background: #f8f4f0;
}

.leaflet-map {
  z-index: 2;
  width: 100%;
  height: 100%;
  touch-action: pan-x pan-y pinch-zoom;
}

.leaflet-map.offline-overlay,
.leaflet-map.offline-overlay .leaflet-container,
.leaflet-map.offline-overlay .leaflet-pane,
.leaflet-map.offline-overlay .leaflet-map-pane,
.leaflet-map.offline-overlay .leaflet-overlay-pane,
.leaflet-map.offline-overlay .leaflet-marker-pane,
.leaflet-map.offline-overlay .leaflet-shadow-pane,
.leaflet-map.offline-overlay .leaflet-tooltip-pane,
.leaflet-map.offline-overlay .leaflet-popup-pane {
  background: transparent !important;
}

.leaflet-container {
  font: inherit;
}

.leaflet-kmz-pin-wrap {
  background: transparent;
  border: 0;
  overflow: visible;
}

.map-marker-shell {
  width: 136px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  pointer-events: none;
  transform: translateY(1px);
}

.map-marker-shell.selected {
  width: 142px;
  height: 58px;
  z-index: 2;
}

.map-point-label,
.simple-marker-label {
  max-width: 118px;
  padding: 3px 7px;
  border: 1px solid rgba(90, 61, 65, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #221b1c;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.12;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(32, 0, 0, 0.16);
  pointer-events: none;
}

.map-point-label.selected,
.simple-marker-label.selected {
  max-width: 128px;
  border-color: var(--brand);
  color: var(--brand-2);
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.12), 0 8px 20px rgba(32, 0, 0, 0.18);
}

.map-point-label.route-label,
.simple-marker-label.route-label {
  border-color: rgba(17, 24, 39, 0.34);
}

.leaflet-map.labels-hidden .map-point-label:not(.selected) {
  opacity: 0;
  visibility: hidden;
}

.leaflet-map.labels-mid .map-point-label.label-collided {
  opacity: 0;
  visibility: hidden;
}

.leaflet-map.labels-full .map-point-label {
  opacity: 1;
  visibility: visible;
}

.simple-map-grid.labels-hidden .simple-marker-label:not(.selected),
.simple-map-grid.labels-high .simple-marker-label:not(.selected) {
  opacity: 0;
  visibility: hidden;
}

.simple-map-grid.labels-always .simple-marker-label {
  opacity: 1;
  visibility: visible;
}

.leaflet-kmz-pin {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color, var(--brand));
  box-shadow: 0 3px 8px rgba(32, 0, 0, 0.28);
  transform: rotate(-45deg);
}

.leaflet-kmz-pin span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.92;
}

.leaflet-kmz-pin.visited {
  opacity: 0.62;
  filter: saturate(0.7);
}

.leaflet-kmz-pin.selected {
  width: 23px;
  height: 23px;
  box-shadow: 0 0 0 6px rgba(17, 24, 39, 0.16), 0 8px 18px rgba(32, 0, 0, 0.26);
  animation: pin-pop 520ms ease;
}

.leaflet-user-pin,
.leaflet-new-pin {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(32, 0, 0, 0.22);
}

.leaflet-user-pin {
  width: 22px;
  height: 22px;
  border: 3px solid var(--brand);
}

.leaflet-user-pin span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
}

.leaflet-user-pin.tracking {
  border-color: #0b7cff;
  animation: user-pin-pulse 1.4s ease-in-out infinite;
}

.leaflet-user-pin.tracking span {
  background: #0b7cff;
}

.leaflet-new-pin {
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  background: var(--pin-color, var(--brand));
  animation: new-pin-pulse 1.5s ease-in-out infinite;
}

.leaflet-new-pin span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #fff;
}

.route-endpoint {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  max-width: 124px;
  padding: 4px 7px 4px 5px;
  border: 1px solid rgba(90, 61, 65, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(32, 0, 0, 0.18);
  transform: translateY(-2px);
}

.route-endpoint span {
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #0b7cff;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.route-endpoint strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.05;
}

.route-endpoint.destination {
  border-color: rgba(17, 24, 39, 0.22);
}

.route-endpoint.destination span {
  min-width: 27px;
  background: var(--brand);
  font-size: 8px;
}

.simple-new-pin {
  position: absolute;
  z-index: 6;
  width: 34px;
  height: 42px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  filter: drop-shadow(0 9px 14px rgba(68, 0, 7, 0.28));
}

.simple-new-pin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px 18px 18px 4px;
  background: #fff;
  border: 4px solid var(--brand);
  transform: rotate(-45deg);
  animation: new-pin-pulse 1.2s ease-in-out infinite;
}

.simple-new-pin span {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
}

@keyframes pin-pop {
  from { transform: rotate(-45deg) scale(0.72); }
  to { transform: rotate(-45deg) scale(1); }
}

@keyframes new-pin-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(32, 0, 0, 0.22), 0 0 0 0 rgba(17, 24, 39, 0.32); }
  50% { box-shadow: 0 4px 14px rgba(32, 0, 0, 0.22), 0 0 0 10px rgba(17, 24, 39, 0); }
}

@keyframes user-pin-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(32, 0, 0, 0.22), 0 0 0 0 rgba(11, 124, 255, 0.26); }
  50% { box-shadow: 0 4px 14px rgba(32, 0, 0, 0.22), 0 0 0 10px rgba(11, 124, 255, 0); }
}

.map-base-warning {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  top: 10px;
  left: 10px;
  right: 64px;
  border: 1px solid #e0bd65;
  border-radius: var(--radius);
  background: #fff6d8;
  color: #6d4a00;
  padding: 8px;
  font-size: 12px;
}

.map-simple-fallback {
  z-index: 2;
  background: #fffafa;
}

.simple-map-grid {
  background:
    linear-gradient(rgba(136, 0, 12, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(136, 0, 12, 0.08) 1px, transparent 1px),
    #fffafa;
  background-size: 32px 32px;
}

.map-simple-fallback .notice {
  position: relative;
  z-index: 3;
  pointer-events: none;
  margin: 10px;
}

.map-floating-actions {
  position: absolute;
  z-index: 25;
  right: 10px;
  top: 12px;
  display: grid;
  gap: 6px;
  pointer-events: none;
}

.map-floating-actions button {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-2);
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.map-floating-actions button.active {
  border-color: #0b7cff;
  background: #eef6ff;
  color: #075fbe;
  box-shadow: 0 0 0 4px rgba(11, 124, 255, 0.12), 0 6px 18px rgba(0, 0, 0, 0.16);
}

.map-floating-actions button.pin-add {
  border-color: rgba(17, 24, 39, 0.36);
  background: var(--brand);
  color: #fff;
}

.advanced-location-details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffafa;
  padding: 8px 10px;
}

.advanced-location-details summary {
  cursor: pointer;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 850;
}

.advanced-location-details .advanced-location {
  margin-top: 8px;
}

.map-location-status {
  position: absolute;
  z-index: 25;
  left: 10px;
  bottom: 10px;
  max-width: min(260px, calc(100% - 74px));
  padding: 7px 10px;
  border: 1px solid rgba(11, 124, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #075fbe;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

.map-base-status {
  position: absolute;
  z-index: 25;
  left: 10px;
  top: 10px;
  max-width: min(240px, calc(100% - 74px));
  padding: 6px 9px;
  border: 1px solid rgba(90, 61, 65, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.map-route-control {
  position: absolute;
  z-index: 32;
  left: 10px;
  right: auto;
  top: 48px;
  width: auto;
  max-width: min(312px, calc(100% - 72px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border: 1px solid rgba(17, 24, 39, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(64, 0, 8, 0.16);
  pointer-events: auto;
}

.map-route-control-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.map-route-control-main strong {
  min-width: 0;
  color: var(--brand-2);
  font-size: 12px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-route-control-main small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.map-route-control-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.map-route-control-actions .btn {
  min-width: 0;
  min-height: 28px;
  padding: 5px 7px;
}

.map-route-control-actions .app-icon {
  width: 14px;
  height: 14px;
}

.map-top-actions {
  position: absolute;
  z-index: 25;
  left: 10px;
  right: 58px;
  top: 10px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  pointer-events: none;
}

.map-top-actions .btn {
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
}

.map-bottom-actions {
  display: none;
}

.map-bottom-actions .btn {
  pointer-events: auto;
}

.map-pick-overlay {
  position: absolute;
  z-index: 24;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
}

.map-pick-overlay::after {
  content: "Tocá el mapa";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 24px rgba(64, 0, 8, 0.18);
}

.map-sheet {
  position: fixed;
  z-index: 48;
  left: 8px;
  right: 8px;
  bottom: calc(var(--bottom-nav-space) + 10px + var(--safe-bottom));
  max-height: min(64dvh, 560px);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px 18px 10px 10px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(64, 0, 8, 0.22);
}

.map-sheet-premium {
  animation: sheet-rise 180ms ease-out;
}

@keyframes sheet-rise {
  from { transform: translateY(18px); opacity: 0.72; }
  to { transform: translateY(0); opacity: 1; }
}

.new-point-sheet {
  max-height: min(60dvh, 540px);
}

.new-point-location-sheet {
  max-height: min(34dvh, 280px);
}

.new-point-location-sheet .sheet-handle {
  flex: 0 0 auto;
}

.location-picker-bar {
  display: grid;
  gap: 8px;
  padding: 4px 12px 12px;
}

.location-picker-title {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.location-picker-title strong,
.location-picker-title small {
  display: block;
  min-width: 0;
}

.location-picker-title strong {
  color: var(--brand-2);
  font-size: 15px;
}

.location-picker-title small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.location-picker-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.location-picker-actions .btn {
  min-width: 0;
  min-height: 38px;
  padding: 8px 9px;
  white-space: normal;
  line-height: 1.12;
}

.new-point-sheet:not(.new-point-location-sheet) .modal-body {
  max-height: calc(58dvh - 54px);
}

.map-sheet .modal-body,
.map-list,
.point-sheet-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.map-sheet .modal-body {
  max-height: calc(64dvh - 54px);
}

.location-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff8f8;
}

.location-summary.strong {
  border-color: #f3adb2;
  background: linear-gradient(180deg, #fff, #fff2f3);
}

.location-summary strong,
.location-summary small {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.location-summary small {
  color: var(--muted);
  font-size: 12px;
}

.mini-pin {
  width: 21px;
  height: 21px;
  display: inline-block;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--brand);
  box-shadow: 0 4px 10px rgba(64, 0, 8, 0.22);
  transform: rotate(-45deg);
}

.mini-pin.pulse {
  animation: pin-pop 520ms ease, new-pin-pulse 1.6s ease-in-out infinite;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.new-point-sheet .quick-actions-grid {
  grid-template-columns: 1fr;
}

.quick-actions-grid .btn {
  min-width: 0;
  width: 100%;
  white-space: normal;
  line-height: 1.15;
}

.color-input-hidden {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.pin-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pin-color {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(35, 10, 12, 0.08);
}

.pin-color span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.pin-color.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.12);
}

.status-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.status-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.status-option.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-2);
}

.status-option.green {
  border-color: #b4dfc6;
  background: #f2fff6;
}

.status-option.yellow {
  border-color: #ead18e;
  background: #fffaf0;
}

.status-option.red {
  border-color: #efb9b3;
  background: #fff5f4;
}

.status-option.green.active {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(32, 138, 85, 0.1);
}

.status-option.yellow.active {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(154, 106, 0, 0.11);
}

.status-option.red.active {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(200, 75, 63, 0.11);
}

.quick-return-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7f8;
  padding: 10px;
}

.status-history {
  display: grid;
  gap: 7px;
}

.status-history-item {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.status-history-item strong {
  font-size: 13px;
}

.status-history-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quick-copy-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.point-copy-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.point-copy-row::-webkit-scrollbar {
  display: none;
}

.point-copy-row .btn {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.btn.tiny {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  flex: 0 0 auto;
  margin: 8px auto 2px;
  border-radius: 999px;
  background: #e9c8cc;
}

.point-sheet {
  max-height: min(66dvh, 620px);
}

.point-sheet-head {
  position: sticky;
  top: 0;
  padding-top: 8px;
}

.point-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.point-heading h2 {
  margin: 0;
  color: var(--brand-2);
  font-size: 18px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.point-sheet-body {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.point-main-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.point-main-actions .btn {
  min-width: 0;
  min-height: 36px;
  padding: 7px 8px;
  font-size: 12px;
}

.point-main-actions .app-icon {
  width: 15px;
  height: 15px;
}

.point-data-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.point-data-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.point-data-row:last-child {
  border-bottom: 0;
}

.point-data-row span {
  color: var(--muted);
  font-weight: 720;
}

.point-data-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-link {
  color: var(--brand-2);
  font-weight: 850;
  text-decoration: none;
}

.button-link {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  display: inline;
  cursor: pointer;
}

.message-template-list {
  display: grid;
  gap: 8px;
}

.message-template {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.message-template span {
  display: block;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 850;
}

.message-template p {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.point-hero {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fff6f6);
}

.point-title-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.point-title-row strong {
  display: block;
  font-size: 18px;
  color: var(--brand-2);
  overflow-wrap: anywhere;
}

.color-dot.large {
  width: 24px;
  height: 24px;
  box-shadow: 0 0 0 3px #fff, 0 3px 9px rgba(0, 0, 0, 0.18);
}

.point-contact {
  display: grid;
  gap: 6px;
}

.point-contact div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

.point-contact span {
  color: var(--muted);
}

.point-contact strong {
  overflow-wrap: anywhere;
}

.edit-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffafa;
}

.compact-detail {
  font-size: 12px;
}

.history-filter-card {
  padding: 10px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffafa;
  box-shadow: 0 6px 18px rgba(92, 0, 10, 0.06);
}

.history-filter-card .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.history-quick-actions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.history-quick-actions::-webkit-scrollbar {
  display: none;
}

.modal-followup-list {
  max-height: min(55dvh, 440px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.history-filter-card label:first-child {
  grid-column: 1 / -1;
}

.history-summary,
.history-close-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.history-close-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-summary > span {
  min-width: 0;
  padding: 8px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.history-summary > span strong {
  color: var(--brand-2);
  font-size: 16px;
  line-height: 1.05;
}

.history-close-summary > div {
  min-width: 0;
  padding: 8px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffafa;
}

.history-close-summary strong {
  min-width: 0;
  color: var(--brand-2);
  font-size: 15px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.history-close-summary span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 760;
}

.history-groups,
.history-list,
.history-visit-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.history-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.history-group summary {
  cursor: pointer;
  min-width: 0;
  padding: 9px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--brand-2);
  font-weight: 900;
  list-style-position: inside;
}

.history-group summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.history-week {
  margin: 8px;
  border-radius: 10px;
  background: #fffafa;
}

.history-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.history-visit-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 50px;
  gap: 6px;
  align-items: center;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.history-visit-row.history-status-green {
  background: #f5fff8;
}

.history-visit-row.history-status-yellow {
  background: #fffaf0;
}

.history-visit-row.history-status-red {
  background: #fff5f4;
}

.history-visit-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.history-visit-row small {
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.history-row-main,
.history-visit-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-row-main strong,
.history-visit-main strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.history-row-main span,
.history-visit-main span {
  color: var(--muted);
  font-size: 12px;
}

.history-row-badges {
  min-width: 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.history-visit-list {
  max-height: min(52dvh, 460px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.history-visit-row .btn.tiny {
  min-width: 0;
  width: 50px;
  padding-inline: 6px;
}

.history-panel {
  gap: 9px;
}

.compact-head {
  gap: 2px;
}

.compact-history-filter {
  padding: 9px;
  gap: 8px;
}

.compact-history-filter .field {
  margin: 0;
}

.compact-history-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.compact-history-summary > span {
  padding: 7px;
  font-size: 11.5px;
}

.compact-history-summary > span strong {
  font-size: 14px;
}

.compact-history-list {
  gap: 6px;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.history-day-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.history-day-row.is-closed {
  border-left: 4px solid #16a34a;
}

.history-day-row.is-open {
  border-left: 4px solid var(--brand);
}

.history-day-date {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.history-day-date strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
}

.history-day-date span {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.history-day-detail-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffafa;
}

.history-day-detail-head strong {
  min-width: 0;
  color: var(--brand-2);
  font-size: 15px;
}

.history-day-detail-head span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.compact-history-visits {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}

.compact-closure-visit {
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.compact-closure-visit:last-child {
  border-bottom: 0;
}

.note-preview {
  padding: 10px;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: #fff5f5;
  overflow-wrap: anywhere;
}

.soft-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
}

.soft-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-2);
}

.advanced-location {
  opacity: 0.94;
}

.check-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  color: var(--brand-2);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.color-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.color-filter {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 760;
}

.color-filter.hidden-color {
  background: #f7f1f2;
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.75;
}

.marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.marker.active {
  width: 24px;
  height: 24px;
  outline: 3px solid rgba(47, 143, 131, 0.28);
}

.marker.simple-labeled-marker {
  width: 132px;
  height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 0;
}

.marker.simple-labeled-marker.selected {
  z-index: 8;
}

.marker.simple-labeled-marker.edge-left .simple-marker-label {
  transform: translateX(28px);
}

.marker.simple-labeled-marker.edge-right .simple-marker-label {
  transform: translateX(-36px);
}

.marker.simple-labeled-marker.edge-top {
  flex-direction: column-reverse;
  justify-content: flex-start;
  transform: translate(-50%, 0);
}

.marker.simple-labeled-marker.edge-top.edge-left .simple-marker-label {
  transform: translateX(28px);
}

.marker.simple-labeled-marker.edge-top.edge-right .simple-marker-label {
  transform: translateX(-36px);
}

.simple-marker-pin {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 3px 8px rgba(32, 0, 0, 0.28);
  transform: rotate(-45deg);
}

.simple-marker-pin span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
}

.marker.simple-labeled-marker.selected .simple-marker-pin {
  width: 23px;
  height: 23px;
  box-shadow: 0 0 0 6px rgba(17, 24, 39, 0.16), 0 8px 18px rgba(32, 0, 0, 0.26);
}

.map-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.map-point {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  transition: background 140ms ease, transform 140ms ease;
}

.map-point:active,
.visit-row:active {
  transform: scale(0.995);
}

.map-point:last-child {
  border-bottom: 0;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.color-dot.status-dot-green {
  background: var(--ok);
}

.color-dot.status-dot-yellow {
  background: #e0bd65;
}

.color-dot.status-dot-red {
  background: var(--danger);
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  background: rgba(20, 22, 20, 0.48);
  padding: 14px 10px calc(14px + var(--safe-bottom));
}

.modal {
  width: min(620px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  animation: modal-pop 160ms ease-out;
}

@keyframes modal-pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0.78; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.modal-head h2 {
  margin: 0;
  min-width: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.modal-body {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.detail-list {
  display: grid;
  gap: 6px;
}

.detail-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

.detail-row span:first-child {
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card p {
  color: var(--muted);
}

.login-logo-wrap {
  display: grid;
  place-items: center;
  padding: 4px 0 2px;
}

.login-logo {
  width: min(168px, 48vw);
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}

.home-hero {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fff7f7);
}

.home-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.home-hero h1,
.home-hero p {
  margin: 0;
}

.home-hero h1 {
  color: var(--brand-2);
  font-size: 22px;
}

.home-hero p {
  color: var(--muted);
  font-size: 13px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-card {
  min-width: 0;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 12px;
  display: grid;
  gap: 5px;
  align-content: start;
  box-shadow: 0 2px 10px rgba(136, 0, 12, 0.06);
}

.home-hero.compact {
  padding: 10px;
  grid-template-columns: 58px minmax(0, 1fr);
}

.home-hero.compact .home-logo {
  width: 58px;
  height: 58px;
}

.panel > .route-card {
  flex: 0 0 auto;
}

.home-card:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.nav button:focus-visible {
  outline: 3px solid rgba(17, 24, 39, 0.28);
  outline-offset: 2px;
}

.home-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.home-card-icon .app-icon {
  width: 20px;
  height: 20px;
}

.home-card strong {
  color: var(--brand-2);
}

.home-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.code-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff7f7;
  color: #352729;
  font-size: 12px;
}

@media (min-width: 760px) {
  .topbar-inner {
    padding: 12px 18px;
  }

  .main {
    padding: 14px 18px;
  }

  .nav {
    order: 2;
    position: relative;
    top: auto;
    bottom: auto;
    max-width: 1160px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    grid-template-columns: repeat(4, 1fr);
  }

  .main {
    order: 3;
  }

  .stats {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .route-grid > .grid {
    min-height: 0;
    max-height: 100%;
    overflow: auto;
  }
}

@media (max-width: 759px) {
  .main-recorridos {
    padding: 7px 8px calc(12px + var(--safe-bottom));
  }

  .main-recorridos .section-head p {
    display: none;
  }

  .route-panel {
    gap: 6px;
  }

  .main.route-main .route-panel {
    height: auto;
    min-height: 100%;
    overflow: visible;
    display: grid;
    align-content: start;
  }

  .main-recorridos .chip-row,
  .main-recorridos .toolbar,
  .main-recorridos .action-row {
    gap: 6px;
    padding-bottom: 0;
  }

  .main-recorridos .chip,
  .main-recorridos .btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .route-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: hidden;
    overflow-x: hidden;
    align-content: stretch;
    padding-bottom: 0;
  }

  .route-grid > .route-card {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .main.route-main .route-grid {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    align-content: start;
    padding-bottom: 0;
  }

  .main.route-main .route-grid > .route-card {
    height: auto;
    min-height: 0;
    display: block;
  }

  .route-head {
    gap: 6px;
    padding: 7px;
  }

  .route-title h2 {
    font-size: 16px;
  }

  .route-title small {
    font-size: 12px;
  }

  .route-head .stats {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  .route-head .stats::-webkit-scrollbar {
    display: none;
  }

  .route-head .stat {
    flex: 0 0 72px;
    padding: 6px;
  }

  .route-head .stat strong {
    font-size: 16px;
  }

  .route-head .stat span {
    font-size: 10px;
  }

  .list-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .route-list-controls {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .route-list-controls.order-mode-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .search-input {
    padding: 7px 9px;
    min-height: 34px;
  }

  .route-actions.compact {
    max-width: 100%;
  }

  .close-day-callout {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 8px;
  }

  .close-day-callout .btn {
    width: 100%;
  }

  .visit-list {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--bottom-nav-space) + var(--safe-bottom));
    scroll-padding-bottom: calc(var(--bottom-nav-space) + var(--safe-bottom));
  }

  .main.route-main .visit-list {
    overflow: visible;
    padding-bottom: calc(var(--bottom-nav-space) + var(--safe-bottom));
  }

  .main.scroll-main .visit-list {
    overflow: visible;
  }

  .visit-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 7px;
  }

  .route-end-card {
    grid-template-columns: minmax(0, 1fr);
    margin-inline: 6px;
  }

  .route-end-card .btn {
    width: 100%;
  }

  .location-picker-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .location-picker-actions .btn:last-child {
    grid-column: 1 / -1;
  }

  .visit-order {
    min-height: 30px;
    font-size: 11px;
  }

  .visit-actions {
    max-width: none;
  }

  .visit-actions .icon-btn {
    min-width: 29px;
    width: 29px;
    height: 29px;
    min-height: 29px;
    padding: 0;
  }

  .order-tools {
    grid-template-columns: repeat(3, 30px);
  }

  .route-grid > aside {
    display: none;
  }

  .section-head p {
    display: none;
  }

  .home-card {
    min-height: 92px;
  }

  .map-route-control {
    right: auto;
    top: 46px;
    max-width: calc(100% - 68px);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding: 5px 6px;
  }

  .map-route-control-actions {
    justify-content: end;
  }

  .map-route-control-actions .btn {
    flex: 0 0 auto;
  }

  .map-route-control-main strong {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
/* Professional native shell */
.app-shell {
  background: var(--bg);
}

button.tap-feedback,
.btn.tap-feedback,
.chip.tap-feedback,
.icon-btn.tap-feedback,
button.is-pending-tap {
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.10), 0 8px 18px rgba(15, 23, 42, 0.14);
}

.topbar {
  background: #111827;
  border-bottom: 1px solid #202a38;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.brand-title strong {
  color: #f8fafc;
}

.brand-title span {
  color: #aeb8c6;
}

.brand-mark {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.bell-btn,
.user-chip {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  box-shadow: none;
}

.bell-btn.has-due {
  border-color: #b7791f;
  background: #2c2111;
  color: #ffd166;
}

.bell-badge {
  border-color: #111827;
  background: #f97316;
}

.nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 10px calc(9px + var(--safe-bottom));
  background: #111827;
  border-top: 1px solid #202a38;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.22);
}

.nav button {
  height: 54px;
  min-height: 50px;
  border-radius: 8px;
  color: #aeb8c6;
  align-content: center;
  justify-items: center;
}

.nav button.active {
  border-color: #f8fafc;
  background: #f8fafc;
  color: #111827;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.section-head h1,
.section-head h2 {
  color: var(--ink);
}

.chip,
.btn,
.icon-btn,
.search-input,
.field input,
.field select,
.field textarea,
.status-option,
.color-filter {
  border-color: #cfd6e2;
}

.chip,
.btn,
.icon-btn {
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.chip.active,
.btn.primary {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.btn.secondary {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #1f2937;
}

.btn.danger,
.btn.danger.strong {
  border-color: #dfa09a;
}

.route-card,
.map-card,
.form-card,
.home-card,
.stat,
.followup-category,
.followup-item,
.client-alert-item,
.history-day-row,
.soft-details,
.map-point {
  border-color: #d8dee8;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.route-head,
.visit-row,
.hard-update-card,
.search-input,
.field input,
.field select,
.field textarea {
  background: #ffffff;
}

.pwa-card,
.diagnostic-card,
.offline-map-card,
.home-hero,
.history-day-detail-head,
.visit-images-panel,
.location-summary,
.location-summary.strong,
.note-preview {
  border-color: #d8dee8;
  background: #ffffff;
}

.followup-card {
  border-color: #d8dee8;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.notice.good,
.badge.info,
.badge.image-badge,
.status-option.active {
  border-color: #cbd5e1;
  background: #eef2f7;
  color: #1f2937;
}

.visit-order {
  background: #e2e8f0;
  color: #1f2937;
}

.home-hero h1,
.diagnostic-card summary,
.soft-details summary,
.check-row {
  color: #111827;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: #111827;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.08);
}

.pin-color.active {
  border-color: #111827;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.10);
}

@media (max-width: 640px) {
  .home-install-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-install-actions {
    width: 100%;
    justify-content: space-between;
  }

  .main-recorridos .chip-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .main-recorridos .chip-row .chip {
    width: 100%;
  }

  .route-list-controls:not(.order-mode-controls) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .route-list-controls:not(.order-mode-controls) .search-input {
    grid-column: 1 / -1;
  }

  .route-list-controls:not(.order-mode-controls) .btn {
    min-width: 0;
    width: 100%;
    white-space: normal;
    line-height: 1.1;
  }
}

@media (min-width: 760px) {
  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #111827;
    border-color: #202a38;
  }
}
