.auth-pending main, .auth-pending header, .auth-pending nav { display: none !important; }

:root {
  color-scheme: light;
  --blue: #007aff;
  --green: #007aff;
  --green-dark: #0066d6;
  --mint: #e8f2ff;
  --orange: #ff9500;
  --red: #ff3b30;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, .16);
  --paper: rgba(255, 255, 255, .92);
  --bg: #f2f2f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: rgba(0, 122, 255, .12);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  background: linear-gradient(160deg, #f8fbff 0%, #eef4ff 55%, #f2f2f7 100%);
}

.auth-screen.hidden { display: none; }

.auth-card {
  width: min(100%, 420px);
  padding: 28px 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 24px 70px rgba(25, 62, 120, .16);
}

.auth-card h1 { margin: 6px 0; }
.auth-card label { display: grid; gap: 7px; margin-top: 16px; font-weight: 650; }
.auth-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  border-radius: 17px;
  color: white;
  background: #1677ff;
  font-size: 25px;
  font-weight: 800;
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: #d1242f;
  font-size: 14px;
  text-align: center;
}

.secondary {
  border: 1px solid rgba(60, 60, 67, .18);
  color: #007aff;
  background: #fff;
  min-height: 48px;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 600;
}
.danger {
  border: 0;
  color: #ff3b30;
  background: rgba(255, 59, 48, .08);
  min-height: 48px;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 600;
}
.danger:active {
  background: rgba(255, 59, 48, .18);
}
.full { width: 100%; }

.customer-form-sheet {
  width: min(calc(100% - 24px), 640px);
  max-height: calc(100dvh - 24px);
  padding: 22px;
  border: 0;
  border-radius: 24px;
}

.customer-form-sheet::backdrop { background: rgba(17, 24, 39, .38); }
.two-column-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide-field { grid-column: 1 / -1; }

.visit-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-height: 44px;
  padding: 9px 14px;
  border-top: .5px solid rgba(60, 60, 67, .12);
  font-size: 13px;
  background: rgba(255, 255, 255, .5);
}
.visit-summary .vs-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.visit-summary .vs-icon.visited { background: #e8f8f0; color: #16815f; }
.visit-summary .vs-icon.missed { background: #feebea; color: #c0392b; }
.visit-summary .vs-icon.skipped { background: #f2f2f7; color: #8e8e93; }
.visit-summary .vs-status {
  font-weight: 650;
  font-size: 14px;
  color: var(--ink);
}
.visit-summary .vs-type {
  color: #8e8e93;
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
}
.visit-summary .vs-time {
  color: #8e8e93;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  margin-top: 1px;
}
.visit-summary .vs-note {
  width: 100%;
  color: #636366;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 1px;
}

/* ── Record cards (Apple-style) ── */
.record-list { display: grid; gap: 10px; }

.record-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 16px 16px 16px 14px;
  background: rgba(255, 255, 255, .94);
}

.record-list .swipe-container {
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 0 0 .5px rgba(60, 60, 67, .12), 0 4px 16px rgba(0, 0, 0, .035);
}

.rec-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 50%;
}

.rec-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.rec-dot.done {
  color: #fff;
  background: #34c759;
}

.rec-dot.missed {
  color: #fff;
  background: #ff9500;
}

.rec-dot.skipped {
  color: #8e8e93;
  background: #e5e5ea;
}

.rec-dot.remote {
  color: #fff;
  background: #3a5ccc;
}

.rec-body {
  flex: 1;
  min-width: 0;
}

.rec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rec-head h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -.02em;
  color: #1c1c1e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .01em;
}

.rec-badge.visited {
  color: #16815f;
  background: #e8f8f0;
}

.rec-badge.missed {
  color: #9a5d00;
  background: #fff4e0;
}

.rec-badge.skipped {
  color: #636366;
  background: #f2f2f7;
}

.rec-badge.remote {
  color: #3a5ccc;
  background: #e8effe;
}

.rec-meta {
  margin: 5px 0 0;
  color: #8e8e93;
  font-size: 13px;
  line-height: 1.4;
}

.rec-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.rec-detail span {
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(118, 118, 128, .08);
  color: #636366;
  font-size: 12px;
  line-height: 1.4;
}

.customer-form-sheet input,
.customer-form-sheet select,
.customer-form-sheet textarea,
.auth-card input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d8dde6;
  border-radius: 12px;
  padding: 11px 12px;
  color: #1c1c1e;
  background: #fff;
  font: inherit;
}

.customer-form-sheet textarea { min-height: 88px; resize: vertical; }

@media (max-width: 560px) {
  .two-column-form { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .customer-form-sheet {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top));
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(244, 246, 244, .94);
  backdrop-filter: blur(8px);
}
.eyebrow, .muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; }
h2 { margin: 4px 0 6px; font-size: 21px; }
h3 { margin-bottom: 6px; }
.date-pill {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--green-dark);
  background: var(--mint);
  font-weight: 700;
}

main {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 8px 14px calc(94px + env(safe-area-inset-bottom));
}
.view { display: none; }
.view.active { display: block; }
.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  color: white;
  background: linear-gradient(135deg, #007aff, #0066d6);
  box-shadow: 0 14px 30px rgba(0, 122, 255, .18);
}
.hero-card .muted { color: rgba(255,255,255,.72); }
.hero-card h2 { font-size: 23px; }
.hero-card p { margin: 0; color: rgba(255,255,255,.8); font-size: 13px; line-height: 1.5; }
.primary {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}
.hero-card .primary { color: var(--green-dark); background: white; }
.primary.small { min-height: 42px; white-space: nowrap; }
.primary.full { margin-top: 16px; }
.progress-card, .empty-card, .route-card, .store-card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 5px 16px rgba(28, 47, 42, .04);
}
.progress-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 16px;
}
.progress-meta { display: flex; justify-content: space-between; font-size: 13px; }
.progress-meta span { color: var(--muted); }
.expand-route-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 10px 0 4px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--green);
  border-radius: 14px;
  border-style: dashed;
  cursor: pointer;
  font: inherit;
  color: var(--green);
  transition: background 0.15s;
}
.expand-route-bar:active { background: var(--mint); }
.expand-route-icon {
  font-size: 14px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--mint);
  flex-shrink: 0;
}
.expand-route-label {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  text-align: left;
}
.expand-route-label strong {
  color: var(--ink);
  background: var(--mint);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 800;
}
.expand-route-hint {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.progress-track {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ef;
}
#progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s; }
.empty-card { margin-top: 14px; padding: 34px 22px; border-radius: 20px; text-align: center; }
.empty-card p { color: var(--muted); line-height: 1.55; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 17px;
  color: var(--green);
  background: var(--mint);
  font-size: 22px;
  font-weight: 900;
}
.hidden { display: none !important; }

.due-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 0 0 12px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(118,118,128,.12);
}

.plan-reasons {
  display: flex;
  gap: 7px;
  margin: 10px 2px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.plan-reasons::-webkit-scrollbar { display: none; }

.plan-reasons span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: .5px solid rgba(0,122,255,.14);
  border-radius: 999px;
  color: #44627f;
  background: rgba(232,242,255,.75);
  font-size: 10px;
  font-weight: 650;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  color: #636366;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.segment.active {
  color: #1c1c1e;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.segment span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 9px;
  color: #007aff;
  background: rgba(0,122,255,.1);
  font-size: 10px;
}

.store-list { display: grid; gap: 10px; margin-top: 12px; }
.tag {
  display: inline-block;
  margin-left: 5px;
  padding: 3px 7px;
  border-radius: 7px;
  color: #705821;
  background: #fff1c8;
  font-size: 11px;
  vertical-align: 2px;
}
.status-mark {
  position: absolute;
  right: 16px;
  bottom: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.photo-slot {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 78px;
  height: 54px;
  overflow: hidden;
  border: 1px dashed rgba(0, 122, 255, .28);
  border-radius: 12px;
  color: #007aff;
  background: rgba(0, 122, 255, .055);
  transform: translate(-50%, -50%);
}

.cooperation-status {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 3px 7px;
  border: .5px solid rgba(60,60,67,.1);
  border-radius: 999px;
  color: #636366;
  background: rgba(255,255,255,.82);
  font-size: 10px;
  font-weight: 650;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cooperation-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(118,118,128,.08);
}

.cooperation-dot.green { background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.12); }
.cooperation-dot.red { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255,59,48,.11); }
.cooperation-dot.yellow { background: #ffcc00; box-shadow: 0 0 0 3px rgba(255,204,0,.14); }
.cooperation-dot.gray { background: #8e8e93; }

.status-sheet {
  padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
}

.status-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status-sheet-head h2 {
  margin-bottom: 0;
}

.status-options {
  display: grid;
  overflow: hidden;
  border: .5px solid rgba(60,60,67,.13);
  border-radius: 18px;
  background: white;
}
.status-options button {
  display: grid;
  grid-template-columns: 16px 1fr 14px;
  align-items: center;
  gap: 12px;
  min-height: 65px;
  padding: 10px 14px;
  border: 0;
  border-bottom: .5px solid rgba(60,60,67,.15);
  text-align: left;
  background: white;
}
.status-options button:last-child { border-bottom: 0; }
.status-options strong, .status-options small { display: block; }
.status-options strong { color: #1c1c1e; font-size: 15px; }
.status-options small { margin-top: 3px; color: #8e8e93; font-size: 11px; }
.status-options b { color: #c7c7cc; font-size: 20px; font-weight: 400; }

@media (max-width: 370px) {
  .store-main {
    gap: 9px;
    padding-right: 12px;
  }
  .store-info { padding-right: 52%; }
  .photo-slot { width: 68px; }
  .cooperation-status span:last-child { display: none; }
}

.location-capture-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 7px;
}

.location-capture-row input {
  min-width: 0;
  margin-top: 0;
}

.location-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 76px;
  padding: 0 12px;
  border: 1px solid rgba(0, 122, 255, .18);
  border-radius: 12px;
  color: #007aff;
  background: rgba(0, 122, 255, .08);
  font-size: 14px;
  font-weight: 700;
}

.location-button:disabled {
  opacity: .55;
}

.customer-location-card {
  padding: 16px;
  border: .5px solid rgba(60, 60, 67, .12);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0, 122, 255, .06), rgba(255, 255, 255, .98));
}

.location-primary {
  margin: 8px 0 0;
  color: #1c1c1e;
  font-size: 15px;
  font-weight: 650;
}

.location-meta {
  margin: 5px 0 0;
  color: #8e8e93;
  font-size: 12px;
  line-height: 1.5;
}

.navigate-link {
  align-self: flex-start;
  padding: 8px 13px;
  border-radius: 999px;
  color: #fff;
  background: #007aff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.photo-slot::before {
  font-size: 20px;
  line-height: 1;
  content: "⌾";
}

.photo-slot::after {
  margin-top: -5px;
  font-size: 9px;
  font-weight: 650;
  content: "拍照";
}

.photo-slot.has-photo {
  border-style: solid;
  border-color: rgba(60, 60, 67, .12);
  background: #e5e5ea;
}

.photo-slot:active {
  transform: scale(.96);
}

.photo-slot.has-photo::before,
.photo-slot.has-photo::after {
  display: none;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-title h3 { margin-top: 3px; }
.photo-add-button { color: var(--blue); white-space: nowrap; }

.customer-photo-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.customer-photo {
  position: relative;
  overflow: hidden;
  border: .5px solid rgba(60, 60, 67, .13);
  border-radius: 15px;
  background: #f2f2f7;
}

.customer-photo a {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e5e5ea;
}

.customer-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-photo time {
  display: block;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 10px;
}

.customer-photo button {
  position: absolute;
  right: 6px;
  bottom: 4px;
  min-height: 30px;
  border: 0;
  color: var(--red);
  background: transparent;
  font-size: 11px;
}

.empty-photo-wall {
  grid-column: 1 / -1;
  min-height: 82px;
  border: 1px dashed rgba(0, 122, 255, .3);
  border-radius: 15px;
  color: var(--blue);
  background: rgba(0, 122, 255, .055);
  font-weight: 650;
}

.form-help {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.camera-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  border-top: 1px solid var(--line);
}
.actions button {
  min-height: 45px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink);
  background: white;
  font-size: 13px;
  font-weight: 750;
}
.actions button:last-child { border-right: 0; }
.actions .visit { color: var(--green); }
.actions .miss { color: var(--orange); }
.actions .skip { color: var(--muted); }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 8px 3px 14px;
}
.section-heading h2 { margin-bottom: 0; }
.count-badge {
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--green);
  background: var(--mint);
  font-size: 13px;
  font-weight: 800;
}
.route-quick-select {
  width: 100%;
  min-height: 46px;
  margin-bottom: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: #1c1c1e;
  font-size: 16px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238e8e93' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E\");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.route-list { display: grid; gap: 11px; }
.route-card {
  width: 100%;
  border-radius: 18px;
  padding: 17px;
  text-align: left;
}
.route-card.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(23,107,91,.1); }
.route-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.route-top > div { min-width: 0; }
.route-top strong { font-size: 17px; }
.route-top span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.route-select {
  flex: 0 0 auto;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0 13px;
  color: white;
  background: var(--green);
  font-size: 12px;
  font-weight: 750;
}
.route-select.current { color: var(--green); background: var(--mint); }
.route-customers { display: grid; margin-top: 12px; border-top: .5px solid var(--line); }
.route-customer-row {
  display: grid;
  grid-template-columns: 28px 1fr 12px;
  align-items: center;
  gap: 10px;
  min-height: 55px;
  padding: 7px 2px;
  border: 0;
  border-bottom: .5px solid var(--line);
  text-align: left;
  background: transparent;
}
.route-customer-row > span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--green);
  background: var(--mint);
  font-size: 11px;
  font-weight: 800;
}
.route-customer-row strong,
.route-customer-row small { display: block; }
.route-customer-row strong { color: var(--ink); font-size: 14px; }
.route-customer-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.route-customer-row b { color: #b5b5bd; font-size: 20px; font-weight: 400; }
.route-expand {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 0;
  border-radius: 11px;
  color: var(--green);
  background: var(--mint);
  font-size: 12px;
  font-weight: 750;
}
.customer-search {
  display: grid;
  gap: 6px;
  margin: -2px 2px 14px;
  color: var(--muted);
  font-size: 11px;
}
.customer-search input {
  width: 100%;
  min-height: 46px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: white;
  font-size: 16px;
}

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.stats-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}
.stats-grid span { display: block; color: var(--muted); font-size: 12px; }
.stats-grid strong { display: block; margin-top: 5px; font-size: 27px; }
.text-button { border: 0; padding: 7px; color: var(--red); background: transparent; }
.export-link { font-size: 14px; font-weight: 500; color: #007aff; text-decoration: none; }
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 4px;
  padding: 6px 0;
}
.date-nav input[type="date"] {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: white;
  font-size: 15px;
}
.date-nav button {
  min-width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.date-nav .text-button { border: none; font-size: 13px; padding: 0 6px; color: var(--link); }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px max(14px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  border-top: .5px solid rgba(60, 60, 67, .15);
  background: rgba(249, 249, 249, .88);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border: 0;
  color: #8e8e93;
  background: transparent;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: .02em;
  transition: color .2s ease;
}
.nav-item.active {
  color: #007aff;
  font-weight: 650;
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  transition: transform .25s cubic-bezier(.2,.9,.25,1.25);
}
.nav-icon svg {
  width: 24px;
  height: 24px;
}
.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.ai-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(145deg, #1d55d5, #7b4ee8);
  box-shadow: 0 14px 34px rgba(68, 73, 190, .2);
}

.ai-hero h2 { margin: 9px 0 5px; font-size: 25px; }
.ai-hero p { margin: 0; color: rgba(255,255,255,.78); font-size: 13px; line-height: 1.5; }
.ai-local-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.15);
  font-size: 10px;
  font-weight: 700;
}

.ai-status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 50%;
}
.ai-status-dot.online { background: #45e08a; box-shadow: 0 0 0 5px rgba(69,224,138,.18); }
.ai-status-dot.offline { background: #ff9f0a; }
.ai-status-dot.loading { border-top-color: transparent; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.ai-metrics article {
  padding: 13px 6px;
  border: .5px solid rgba(60,60,67,.12);
  border-radius: 17px;
  text-align: center;
  background: white;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0, 122, 255, .12);
  transition: transform .18s ease, background .22s ease;
}
.ai-metrics article:active {
  transform: scale(.96);
  background: #f2f2f7;
}
.ai-metrics span { display: block; color: var(--muted); font-size: 10px; }
.ai-metrics strong { display: block; margin-top: 4px; font-size: 22px; }

/* ── Dashboard ── */
.dash-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.dash-row article {
  padding: 13px 8px;
  border-radius: 13px;
  text-align: center;
  background: rgba(118, 118, 128, .06);
}
.dash-row span { display: block; color: #8e8e93; font-size: 11px; }
.dash-row strong { display: block; margin-top: 4px; font-size: 21px; font-weight: 720; }

.dash-section-title {
  margin: 16px 0 8px;
}
.dash-section-title span {
  color: #8e8e93;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.dash-route-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 1fr 32px auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 13px;
}
.dash-route-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1c1c1e;
  font-weight: 600;
}
.dash-route-num { color: #8e8e93; font-size: 12px; text-align: right; }
.dash-route-bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: rgba(118, 118, 128, .15);
  overflow: hidden;
}
.dash-route-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #007aff;
  transition: width .5s ease;
}
.dash-route-pct { color: #007aff; font-size: 12px; font-weight: 650; text-align: right; }
.dash-never { color: #ff9500; font-size: 10px; font-weight: 650; }

.dash-trend {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 0 0;
  overflow-x: auto;
}
.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 36px;
}
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 82px;
}
.trend-bars span {
  width: 10px;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height .4s ease;
}
.trend-v { background: #007aff; }
.trend-m { background: #ff9500; }
.trend-r { background: #5e5ce6; }
.trend-label { color: #8e8e93; font-size: 10px; }
.trend-num { color: #1c1c1e; font-size: 12px; font-weight: 650; }

.trend-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: .5px solid rgba(60, 60, 67, .12);
  font-size: 11px;
  color: #8e8e93;
}
.trend-legend b {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: 0px;
}
.tl-v { background: #007aff; }
.tl-m { background: #ff9500; }
.tl-r { background: #5e5ce6; }

/* AI metric detail sheet */
.ai-metric-sheet {
  padding: 0 18px calc(18px + env(safe-area-inset-bottom));
}
.aim-list {
  display: grid;
  overflow: hidden;
  margin-top: 10px;
  border: .5px solid rgba(60, 60, 67, .13);
  border-radius: 18px;
  background: white;
}
.aim-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 12px;
  border: 0;
  border-bottom: .5px solid rgba(60, 60, 67, .12);
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.aim-row:last-child {
  border-bottom: 0;
}
.aim-row:active {
  background: rgba(0, 0, 0, .04);
}
.aim-row strong,
.aim-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aim-row strong {
  color: #1c1c1e;
  font-size: 15px;
  font-weight: 620;
}
.aim-row small {
  margin-top: 3px;
  color: #8e8e93;
  font-size: 12px;
}
.aim-row b {
  color: #c7c7cc;
  font-size: 20px;
  font-weight: 400;
}

.ai-panel {
  margin-top: 12px;
  padding: 17px;
  border: .5px solid rgba(60,60,67,.12);
  border-radius: 21px;
  background: white;
}
.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ai-panel-head h3 { margin: 3px 0 0; font-size: 18px; }
.ai-report,
.ai-answer {
  margin-top: 14px;
  padding: 14px;
  border-radius: 15px;
  color: #30333a;
  background: #f4f6fb;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.ai-stale-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #8a5a00;
  background: #fff4d6;
  font-size: 12px;
  line-height: 1.5;
}
.ai-answer { color: #25304b; background: #eef3ff; }
.ai-chat-history {
  display: grid;
  gap: 10px;
  max-height: 420px;
  margin-top: 14px;
  overflow-y: auto;
}
.ai-chat-empty { margin: 4px 0; line-height: 1.55; }
.ai-chat-message {
  display: grid;
  gap: 4px;
  max-width: 92%;
}
.ai-chat-message.user { justify-self: end; }
.ai-chat-message.assistant { justify-self: start; }
.ai-chat-message span {
  padding: 0 4px;
  color: var(--muted);
  font-size: 10px;
}
.ai-chat-message.user span { text-align: right; }
.ai-chat-message p {
  margin: 0;
  padding: 11px 13px;
  border-radius: 16px;
  background: #f2f2f7;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ai-chat-message.user p {
  color: white;
  background: var(--blue);
  border-bottom-right-radius: 5px;
}
.ai-chat-message.assistant p { border-bottom-left-radius: 5px; }
.ai-priority-list { display: grid; margin-top: 10px; }
.ai-priority-item {
  display: grid;
  grid-template-columns: 38px 1fr 12px;
  align-items: center;
  gap: 11px;
  min-height: 65px;
  padding: 10px 0;
  border: 0;
  border-bottom: .5px solid var(--line);
  text-align: left;
  background: transparent;
}
.ai-priority-item:last-child { border-bottom: 0; }
.ai-priority-score {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: #5d46cc;
  background: #eeeaff;
  font-size: 13px;
  font-weight: 800;
}
.ai-priority-item strong,
.ai-priority-item small,
.ai-priority-item em { display: block; }
.ai-priority-item strong { color: var(--ink); font-size: 15px; }
.ai-priority-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.ai-priority-item em { margin-top: 4px; color: #6c54d8; font-size: 10px; font-style: normal; }
.ai-priority-item b { color: #b5b5bd; font-size: 20px; font-weight: 400; }
.ai-question-form textarea {
  width: 100%;
  margin-top: 13px;
  padding: 12px;
  border: 1px solid #d8dde6;
  border-radius: 14px;
  font: inherit;
  resize: vertical;
}
.ai-question-form button:disabled,
.ai-panel button:disabled { opacity: .58; }

@media (max-width: 370px) {
  .ai-metrics { grid-template-columns: repeat(2, 1fr); }
}

dialog {
  width: min(calc(100% - 24px), 560px);
  max-height: 88vh;
  margin: auto auto 0;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 24px 24px 0 0;
  color: var(--ink);
  background: white;
}
.customer-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.customer-detail-actions .full { margin-top: 0; }
.customer-detail-actions .danger {
  grid-column: 1 / -1;
}
@media (max-width: 370px) {
  .customer-detail-actions { grid-template-columns: 1fr; }
}
dialog::backdrop { background: rgba(9, 25, 21, .45); backdrop-filter: blur(2px); }
#action-form { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin-bottom: 2px; }
.dialog-head p { color: var(--muted); }
.close-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--bg);
  font-size: 26px;
}
.form-stack { display: grid; gap: 14px; margin-top: 10px; }
label { color: #34423e; font-size: 13px; font-weight: 700; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #d9e1de;
  border-radius: 13px;
  padding: 12px 13px;
  outline: 0;
  background: #fbfcfb;
  font-size: 16px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--green); }
.deal-fields { display: grid; grid-template-columns: 1.5fr .7fr; gap: 10px; padding: 13px; border-radius: 15px; background: var(--mint); }

@media (min-width: 700px) {
  dialog { margin: auto; border-radius: 24px; }
}

body {
  letter-spacing: -.01em;
  background:
    radial-gradient(circle at 88% 0%, rgba(0, 122, 255, .09), transparent 260px),
    var(--bg);
}

button {
  touch-action: manipulation;
}

.topbar {
  align-items: flex-end;
  padding: calc(18px + env(safe-area-inset-top)) 20px 12px;
  background: rgba(242, 242, 247, .78);
  border-bottom: .5px solid rgba(60, 60, 67, .08);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}

.eyebrow {
  margin-bottom: 3px;
  color: #636366;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}

h1 {
  font-size: 29px;
  font-weight: 780;
  letter-spacing: -.035em;
}

h2 {
  font-weight: 760;
  letter-spacing: -.025em;
}

.date-pill {
  min-height: 36px;
  padding: 0 12px;
  color: #007aff;
  background: rgba(0, 122, 255, .1);
  font-size: 14px;
  font-weight: 650;
}

main {
  padding: 10px 16px calc(102px + env(safe-area-inset-bottom));
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  padding: 22px 20px;
  border: .5px solid rgba(0, 122, 255, .12);
  border-radius: 26px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 12%, rgba(255,255,255,.9), transparent 110px),
    linear-gradient(145deg, #dcebff 0%, #edf6ff 54%, #fff 100%);
  box-shadow: 0 10px 30px rgba(0, 73, 160, .08);
}

.hero-card::after {
  position: absolute;
  right: -25px;
  bottom: -48px;
  width: 150px;
  height: 150px;
  border: 24px solid rgba(0, 122, 255, .06);
  border-radius: 50%;
  content: "";
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-card .muted {
  color: #5c6f86;
  font-weight: 600;
}

.hero-card h2 {
  margin-top: 7px;
  color: #102a43;
  font-size: 24px;
}

.hero-card p {
  max-width: 225px;
  color: #62758a;
}

.hero-card .primary,
.primary {
  color: white;
  background: #007aff;
  box-shadow: none;
}

.hero-card .primary {
  color: white;
  background: #007aff;
}

.primary {
  border-radius: 13px;
  font-weight: 650;
}

.progress-card,
.empty-card,
.route-card,
.store-card {
  border: .5px solid rgba(60, 60, 67, .12);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .035);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.progress-card {
  margin: 12px 0 14px;
  padding: 15px 16px;
  border-radius: 18px;
}

.progress-track {
  height: 5px;
  background: rgba(118, 118, 128, .16);
}

#progress-bar {
  background: #007aff;
}

.empty-card {
  border-radius: 24px;
}

.empty-icon {
  color: #007aff;
  background: rgba(0, 122, 255, .1);
}

.store-list {
  gap: 11px;
}

.store-card {
  border-radius: 21px;
}

.store-card.done {
  opacity: .92;
}

.tag {
  color: #9a6500;
  background: rgba(255, 204, 0, .16);
}

.status-mark {
  color: #007aff;
  font-weight: 650;
}

.actions {
  border-top: .5px solid var(--line);
}

.actions button {
  min-height: 47px;
  border-right: .5px solid var(--line);
  background: rgba(255, 255, 255, .58);
  font-size: 13px;
  font-weight: 590;
}

.actions .visit {
  color: #007aff;
}

.actions .miss {
  color: #ff9500;
}

.route-card {
  border-radius: 20px;
  padding: 17px 16px;
}

.route-card.selected {
  border-color: rgba(0, 122, 255, .45);
  background: rgba(232, 242, 255, .92);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, .08);
}

.route-top strong {
  font-weight: 690;
}

.route-top span,
.count-badge {
  color: #007aff;
}

.count-badge {
  background: rgba(0, 122, 255, .1);
}

.stats-grid article {
  border: .5px solid rgba(60, 60, 67, .12);
  border-radius: 20px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .025);
}

.stats-grid strong {
  font-weight: 720;
  letter-spacing: -.035em;
}

dialog {
  border: .5px solid rgba(255,255,255,.6);
  border-radius: 28px 28px 0 0;
  background: rgba(250, 250, 252, .98);
  box-shadow: 0 -12px 50px rgba(0,0,0,.16);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.close-button {
  color: #636366;
  background: rgba(118, 118, 128, .12);
  font-weight: 400;
}

label {
  color: #3a3a3c;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
  border: .5px solid rgba(60, 60, 67, .18);
  border-radius: 12px;
  background: white;
}

.customer-sheet {
  padding: 0 18px calc(22px + env(safe-area-inset-bottom));
}

.customer-sheet-head {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 18px 0 14px;
}

.customer-sheet-head h2 {
  margin: 2px 0;
}

.customer-sheet-head p {
  margin: 0;
  color: #8e8e93;
  font-size: 13px;
}

.back-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #007aff;
  background: rgba(0,122,255,.1);
  font-size: 30px;
  line-height: 1;
}

.customer-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: .5px solid rgba(60,60,67,.14);
  border-radius: 17px;
  background: white;
}

.customer-summary article {
  min-width: 0;
  padding: 14px 8px;
  border-right: .5px solid rgba(60,60,67,.14);
  text-align: center;
}

.customer-summary article:last-child { border-right: 0; }
.customer-summary span { display: block; color: #8e8e93; font-size: 10px; }
.customer-summary strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-section { margin-top: 20px; }
.detail-section h3 { margin: 3px 0 12px; font-size: 19px; }
.timeline { display: grid; gap: 0; }
.timeline-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  position: relative;
  padding-bottom: 18px;
}
.timeline-item::before {
  position: absolute;
  top: 7px;
  bottom: -3px;
  left: 64px;
  width: 1px;
  background: rgba(0,122,255,.18);
  content: "";
}
.timeline-item:last-child::before { display: none; }
.timeline-item::after {
  position: absolute;
  top: 4px;
  left: 60px;
  width: 9px;
  height: 9px;
  border: 2px solid #fafaFC;
  border-radius: 50%;
  background: #007aff;
  box-shadow: 0 0 0 2px rgba(0,122,255,.16);
  content: "";
}
.timeline-item time { color: #8e8e93; font-size: 11px; }
.timeline-item div { padding-left: 8px; }
.timeline-item strong { font-size: 14px; }
.timeline-item p { margin: 4px 0 0; color: #636366; font-size: 12px; line-height: 1.45; }
.empty-card.compact { margin-top: 0; padding: 24px 18px; }

input:focus,
textarea:focus,
select:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .12);
}

.check-row input {
  accent-color: #007aff;
}

.deal-fields {
  background: rgba(0, 122, 255, .08);
}

button {
  position: relative;
  overflow: hidden;
  border: 0;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), opacity .18s ease,
    background-color .22s ease, box-shadow .22s ease;
}

button:active {
  opacity: .65;
  transition: opacity .08s ease;
}

.primary {
  box-shadow: 0 7px 18px rgba(0, 122, 255, .22);
}

.store-card {
  transform: translateZ(0);
  transition: opacity .32s ease, transform .32s cubic-bezier(.2,.8,.2,1),
    box-shadow .32s ease, border-color .32s ease;
}

.store-card.just-updated {
  animation: card-confirm .55s cubic-bezier(.2,.8,.2,1);
}

.route-card {
  transition: transform .22s cubic-bezier(.2,.8,.2,1), background-color .25s ease,
    border-color .25s ease, box-shadow .25s ease;
}

.tap-glow {
  position: absolute;
  z-index: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  pointer-events: none;
  border-radius: 50%;
  background: rgba(255,255,255,.46);
  transform: scale(0);
  animation: tap-glow .52s ease-out forwards;
}

.actions .tap-glow,
.route-card .tap-glow,
.nav-icon .tap-glow,
.date-pill .tap-glow {
  background: rgba(0,122,255,.13);
}

.toast {
  position: fixed;
  z-index: 30;
  top: calc(15px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 9px 16px 9px 10px;
  border: .5px solid rgba(255,255,255,.7);
  border-radius: 24px;
  color: #1c1c1e;
  background: rgba(250,250,252,.88);
  box-shadow: 0 12px 38px rgba(0,0,0,.15);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%,-18px) scale(.94);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  transition: opacity .25s ease, transform .38s cubic-bezier(.2,.9,.2,1.12);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%,0) scale(1);
}

.toast-check {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: white;
  background: #34c759;
  font-size: 16px;
  font-weight: 750;
}

.view.active {
  animation: view-enter .28s cubic-bezier(.2,.8,.2,1);
}

dialog[open] {
  animation: sheet-up .38s cubic-bezier(.2,.85,.2,1);
}

@keyframes tap-glow {
  0% { opacity: 1; transform: scale(0); }
  100% { opacity: 0; transform: scale(24); }
}

.tap-ripple {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  border-radius: 50%;
  background: rgba(0, 122, 255, .18);
  transform: scale(0);
  animation: ripple-out .5s ease-out forwards;
}
@keyframes ripple-out {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

@keyframes card-confirm {
  0% { transform: scale(1); }
  42% {
    transform: scale(.985);
    border-color: rgba(52,199,89,.46);
    box-shadow: 0 0 0 5px rgba(52,199,89,.09);
  }
  100% { transform: scale(1); }
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(24px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #007aff;
  background: rgba(0, 122, 255, .1);
  font-size: 27px;
  font-weight: 500;
  line-height: 1;
}

.search-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.global-search-sheet {
  width: min(calc(100% - 18px), 620px);
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
}

.global-search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.global-search-head h2 {
  margin-bottom: 0;
}

.global-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 10px;
  color: #007aff;
  background: rgba(118, 118, 128, .12);
  transition: background .15s;
}

.global-search-box:focus-within {
  background: rgba(118, 118, 128, .18);
}

.global-search-box svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .6;
}

.global-search-box input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: #1c1c1e;
  background: transparent;
  font-size: 17px;
  font-weight: 400;
  -webkit-appearance: none;
  appearance: none;
}

.global-search-box input:focus {
  border-color: transparent;
  box-shadow: none;
}

.global-search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(118, 118, 128, .4);
  color: #fff;
  cursor: pointer;
  position: relative;
}

.global-search-box input::-webkit-search-cancel-button::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
}

.global-search-tip {
  margin: 8px 4px 10px;
  color: #8e8e93;
  font-size: 11px;
  line-height: 1.4;
}

.global-search-results {
  display: grid;
  margin-top: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  overflow: hidden;
}

.global-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: 6px 6px 6px 12px;
  border-bottom: .5px solid rgba(60, 60, 67, .1);
}

.global-result-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  padding: 0;
  text-align: left;
  background: transparent;
}

.global-result-main > span:first-child {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #007aff;
  background: rgba(0, 122, 255, .1);
  font-size: 12px;
  font-weight: 750;
}

.global-result-main strong,
.global-result-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-result-main strong {
  color: #1c1c1e;
  font-size: 15px;
}

.global-result-main small {
  margin-top: 4px;
  color: #8e8e93;
  font-size: 11px;
}

.global-result-action {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0 11px;
  color: #007aff;
  background: rgba(0, 122, 255, .1);
  font-size: 12px;
  font-weight: 700;
}

.global-search-empty {
  padding: 24px 20px;
  text-align: center;
}

.global-search-empty strong {
  display: block;
  margin-top: 7px;
}

.global-search-empty p {
  margin: 7px 0 0;
  color: #8e8e93;
  font-size: 12px;
  line-height: 1.5;
}

.off-plan-note {
  padding: 10px 12px;
  border-radius: 12px;
  color: #765300;
  background: rgba(255, 204, 0, .14);
  font-size: 12px;
  line-height: 1.45;
}

.off-plan-badge {
  display: inline-flex;
  margin-top: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #765300;
  background: rgba(255, 204, 0, .14);
  font-size: 10px;
  font-weight: 700;
}

@media (min-width: 700px) {
  .global-search-sheet {
    margin: auto;
    border-radius: 26px;
  }
}

/* Final touch-target overrides for one-handed iPhone use. */
.date-pill,
.close-button,
.back-button {
  min-width: 44px;
  min-height: 44px;
}

.cooperation-status {
  min-height: 44px;
  padding-right: 10px;
  padding-left: 10px;
}

/* Final iOS-style card layout: text and accessories have separate columns. */
.store-card {
  overflow: hidden;
  border: .5px solid rgba(60, 60, 67, .12);
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .045);
}
.store-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 82px;
  align-items: center;
  gap: 12px;
  min-height: 112px;
  padding: 14px 14px 14px 16px;
}
.sequence {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #007aff;
  background: rgba(0, 122, 255, .1);
  font-size: 16px;
  font-weight: 750;
}
.store-info { min-width: 0; padding-right: 0; }
.customer-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  outline: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.customer-link h3 { margin: 0; }
.store-info h3 {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #1c1c1e;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.store-info p {
  margin: 7px 0 0;
  display: -webkit-box;
  overflow: hidden;
  color: #8e8e93;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.store-accessory {
  display: grid;
  justify-items: stretch;
  align-self: stretch;
  gap: 8px;
}

.store-accessory .cooperation-status,
.store-accessory .photo-slot {
  position: static;
  width: 100%;
  transform: none;
}

.store-accessory .cooperation-status {
  z-index: auto;
  justify-content: center;
  min-height: 32px;
  padding: 4px 7px;
  border: .5px solid rgba(60, 60, 67, .12);
  color: #636366;
  background: rgba(248, 248, 250, .96);
  box-shadow: none;
  font-size: 10px;
}

.store-accessory .photo-slot {
  min-height: 54px;
  height: auto;
  border-color: rgba(0, 122, 255, .22);
  border-radius: 13px;
  background: rgba(0, 122, 255, .055);
}

.store-accessory .photo-slot:active {
  transform: scale(.97);
}

.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  touch-action: pan-y;
}
.swipe-content {
  position: relative;
  z-index: 1;
  width: 100%;
  transition: transform .45s cubic-bezier(.25,.1,.25,1);
  will-change: transform;
  background: rgba(255, 255, 255, .94);
}
.swipe-content.swiping {
  transition: none;
}
.swipe-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  border: 0;
  background: #ff3b30;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  border-radius: 0 22px 22px 0;
}

.swipe-quick-visit {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border-radius: 22px;
  background: #34c759;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}
.swipe-quick-visit span {
  font-size: 26px;
  font-weight: 800;
}
.swipe-container.swipe-quick .swipe-quick-visit {
  box-shadow: inset 0 0 40px rgba(0,0,0,.1);
}

.actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5px;
  background: rgba(60, 60, 67, .12);
}

.actions button {
  min-height: 50px;
  border: 0;
  border-right: 0;
  background: rgba(255, 255, 255, .98);
  font-size: 14px;
  font-weight: 650;
}

@media (max-width: 370px) {
  .store-main {
    grid-template-columns: 38px minmax(0, 1fr) 72px;
    gap: 9px;
    padding-right: 12px;
  }

  .sequence {
    width: 38px;
    height: 38px;
  }

  .store-info h3 {
    font-size: 17px;
  }

  .store-accessory .cooperation-status {
    padding-right: 4px;
    padding-left: 4px;
  }
}
