/* کاروان‌رو — Tactile Night HUD (Stitch) */
:root {
  --kr-abyss: #070d18;
  --kr-cockpit: #111b2c;
  --kr-elevated: #18263e;
  --kr-orange: #ea580c;
  --kr-leader: #10b981;
  --kr-amber: #f59e0b;
  --kr-sos: #ef4444;
  --kr-text: #d4e4fa;
  --kr-muted: #94a3b8;
  --kr-plate: #facc15;
  --kr-border: rgba(148, 163, 184, 0.15);
}

.kr-cockpit { background: var(--kr-abyss); color: var(--kr-text); }
.kr-cockpit .akit-app-bar,
.kr-cockpit .site-header {
  background: rgba(7, 13, 24, 0.92) !important;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--kr-border);
}

.kr-hud-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.kr-hud-chip {
  background: rgba(17, 27, 44, 0.88);
  border: 1px solid var(--kr-border);
  border-radius: 12px;
  padding: 8px 10px;
  min-height: 48px;
}
.kr-hud-chip b {
  display: block;
  font-family: "Space Mono", Vazirmatn, monospace;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: -0.03em;
}
.kr-hud-chip span {
  font-size: 0.68rem;
  color: var(--kr-muted);
  font-weight: 600;
}

.kr-map-stage { position: relative; }
.kr-sos-hold {
  position: absolute;
  left: 12px;
  bottom: 18px;
  z-index: 500;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  background: rgba(127, 29, 29, 0.85);
  color: #fecaca;
  font-weight: 800;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
  cursor: pointer;
}
.kr-sos-hold:active { transform: scale(0.96); background: #991b1b; }

.kr-lost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  color: #fbbf24;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.kr-me-badge {
  background: rgba(234, 88, 12, 0.2);
  border: 1px solid var(--kr-orange);
  color: #fdba74;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.kr-dock {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 1100;
  background: rgba(5, 20, 36, 0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--kr-border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.kr-dock__btn {
  flex: 1;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--kr-muted);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
}
.kr-dock__btn.active {
  color: #fdba74;
  background: rgba(234, 88, 12, 0.16);
}
.kr-dock__ico { font-size: 1.2rem; line-height: 1; }

.kr-more-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.55);
}
.kr-more-sheet.open { display: block; }
.kr-more-sheet__panel {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: #0d1c2d;
  border-top: 1px solid var(--kr-border);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
.kr-more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.kr-more-item {
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid var(--kr-border);
  background: #18263e;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.kr-sos-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(5, 20, 36, 0.92);
  padding: 20px;
  overflow: auto;
}
.kr-sos-overlay.open { display: flex; align-items: center; justify-content: center; }
.kr-sos-card {
  width: min(420px, 100%);
  background: #111b2c;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
}
.kr-sos-ring {
  width: 140px;
  height: 140px;
  margin: 12px auto;
  border-radius: 50%;
  border: 6px solid #7f1d1d;
  background: radial-gradient(circle, #b91c1c, #7f1d1d);
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.kr-sos-sent {
  display: none;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fecaca;
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  font-weight: 700;
}

.kr-invite-code {
  font-family: "Space Mono", Vazirmatn, monospace;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fdba74;
  text-align: center;
  padding: 12px;
  border: 1px dashed rgba(234, 88, 12, 0.5);
  border-radius: 14px;
  background: rgba(234, 88, 12, 0.08);
}
.kr-qr {
  width: 168px;
  height: 168px;
  margin: 12px auto;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  display: block;
}
.kr-share-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-share-wa { background: #128c7e !important; color: #fff !important; border: 0 !important; }
.btn-share-tg { background: #229ed9 !important; color: #fff !important; border: 0 !important; }

.kr-auth-card .otp-boxes-group { display: flex; gap: 8px; justify-content: center; direction: ltr; }
.kr-auth-card .otp-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  border-radius: 12px;
  border: 1px solid var(--kr-border);
  background: #0d1c2d;
  color: #fff;
}
.kr-auth-hint { font-size: 0.82rem; color: var(--kr-muted); margin: 8px 0 14px; }

.kr-copy-btn { min-height: 44px; }

.kr-settle-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--kr-border);
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(15, 23, 42, 0.7);
}
.kr-settle-row input { width: 20px; height: 20px; }

/* —— مسیریابی تمام‌صفحه (HUD روی نقشه) —— */
body.kr-nav-mode {
  padding-bottom: 0 !important;
  overflow: hidden;
  height: 100dvh;
  background: #0b1220;
}
body.kr-nav-mode .akit-app-bar,
body.kr-nav-mode .site-header,
body.kr-nav-mode .app-sidebar-card,
body.kr-nav-mode .trip-top-bar,
body.kr-nav-mode .kr-hud-strip,
body.kr-nav-mode .kr-map-hud {
  display: none !important;
}
body.kr-nav-mode .app-layout-grid {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  height: 100dvh;
}
body.kr-nav-mode main {
  margin: 0;
  padding: 0;
  height: 100dvh;
}
body.kr-nav-mode #tab-map {
  display: block !important;
  position: fixed;
  inset: 0;
  z-index: 1;
  animation: none;
}
body.kr-nav-mode .kr-nav-stage {
  position: absolute;
  inset: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
body.kr-nav-mode #karvanroMap {
  position: absolute !important;
  inset: 0 !important;
  height: 100% !important;
  min-height: 100% !important;
  width: 100% !important;
  border-radius: 0 !important;
  z-index: 1 !important;
}
body.kr-nav-mode .leaflet-control-zoom,
body.kr-nav-mode .leaflet-control-attribution {
  display: none !important;
}
body.kr-nav-mode .kv-webkey-hint {
  top: auto !important;
  bottom: 168px !important;
  left: 12px !important;
  right: 12px !important;
}

.kr-nav-hud {
  position: absolute;
  inset: 0;
  z-index: 400;
  pointer-events: none;
}
.kr-nav-hud > * { pointer-events: auto; }

.kr-nav-topcard {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  background: rgba(8, 14, 24, 0.94);
  border-radius: 18px;
  padding: 12px 16px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
}
.kr-nav-remain {
  font-family: "Space Mono", Vazirmatn, monospace;
  color: #7dd3fc;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.kr-nav-remain span {
  font-size: 0.85rem;
  color: #bae6fd;
  margin-right: 6px;
  font-weight: 700;
}
.kr-nav-arrow {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  grid-row: 1 / span 2;
}
.kr-nav-destline {
  grid-column: 1;
  color: #7dd3fc;
  font-weight: 800;
  font-size: 1.05rem;
}

.kr-nav-chips {
  position: absolute;
  top: calc(92px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px;
  scrollbar-width: none;
}
.kr-nav-chips::-webkit-scrollbar { display: none; }
.kr-nav-chip {
  flex: 0 0 auto;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 7px 12px;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.kr-nav-chip b { color: #38bdf8; font-family: "Space Mono", Vazirmatn, monospace; }

.kr-nav-tools {
  position: absolute;
  top: calc(148px + env(safe-area-inset-top));
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kr-nav-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.kr-nav-tools-end {
  position: absolute;
  top: calc(148px + env(safe-area-inset-top));
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kr-nav-speedo {
  position: absolute;
  left: 12px;
  bottom: calc(148px + env(safe-area-inset-bottom));
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(8, 14, 24, 0.92);
  border: 3px solid rgba(148, 163, 184, 0.35);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.kr-nav-speedo b {
  font-family: "Space Mono", Vazirmatn, monospace;
  font-size: 1.55rem;
  line-height: 1;
}
.kr-nav-speedo span { font-size: 0.68rem; color: #94a3b8; font-weight: 700; }

.kr-nav-roadchip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(148px + env(safe-area-inset-bottom));
  background: rgba(16, 185, 129, 0.92);
  color: #ecfdf5;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: calc(100% - 220px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.kr-nav-eta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(62px + env(safe-area-inset-bottom));
  background: rgba(8, 14, 24, 0.96);
  border-radius: 18px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}
.kr-nav-eta .kr-nav-mute {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #cbd5e1;
  font-size: 1.1rem;
}
.kr-nav-eta-main { text-align: center; }
.kr-nav-eta-main b {
  display: block;
  font-family: "Space Mono", Vazirmatn, monospace;
  font-size: 1.45rem;
  color: #fff;
  line-height: 1.1;
}
.kr-nav-eta-main span { font-size: 0.78rem; color: #94a3b8; font-weight: 700; }
.kr-nav-eta-search {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #cbd5e1;
  font-size: 1.1rem;
}

body.kr-nav-mode .kr-sos-hold {
  left: 12px;
  right: auto;
  bottom: calc(248px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  font-size: 0.62rem;
}

body.kr-nav-mode .kr-dock {
  display: flex !important;
  background: rgba(5, 20, 36, 0.92);
}

body.kr-nav-mode .tab-content-pane:not(#tab-map) {
  display: none;
  position: fixed;
  z-index: 900;
  background: rgba(7, 13, 24, 0.97);
  overflow: auto;
  animation: none;
  padding: 16px 14px calc(88px + env(safe-area-inset-bottom));
}
body.kr-nav-mode .tab-content-pane:not(#tab-map).active {
  display: block;
}
@media (max-width: 960px) {
  body.kr-nav-mode .tab-content-pane:not(#tab-map).active {
    top: 10vh;
    left: 0;
    right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--kr-border);
  }
}
@media (min-width: 961px) {
  body.kr-nav-mode .tab-content-pane:not(#tab-map).active {
    top: 12px;
    bottom: 78px;
    right: 12px;
    left: auto;
    width: min(460px, 42vw);
    border-radius: 20px;
    border: 1px solid var(--kr-border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

.kr-ad-banner {
  position: absolute;
  z-index: 450;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(280px, calc(100% - 72px));
  background: linear-gradient(180deg, #166534, #14532d);
  border: 2px solid #86efac;
  border-radius: 18px;
  padding: 12px;
  color: #ecfdf5;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.kr-ad-banner[hidden] { display: none !important; }
.kr-ad-banner img,
.kr-ad-banner video {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #052e16;
}
.kr-ad-banner h4 { margin: 8px 0 4px; font-size: 1.05rem; }
.kr-ad-banner p { margin: 0; font-size: 0.78rem; color: #bbf7d0; }
.kr-ad-banner .kr-ad-close {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
}
.kr-ad-cta {
  display: inline-block;
  margin-top: 8px;
  background: #facc15;
  color: #14532d;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
}

.kv-ad-pin { text-align: center; line-height: 1.15; }
.kv-ad-pin__mark {
  display: inline-flex;
  min-width: 54px;
  padding: 4px 6px;
  border-radius: 8px;
  background: #166534;
  border: 2px solid #86efac;
  color: #facc15;
  font-weight: 900;
  font-size: 0.68rem;
}
.kv-ad-pin__poi {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #facc15;
  background: #111b2c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.kv-ad-pin__poi img { width: 100%; height: 100%; object-fit: cover; }

.kr-leaflet-ad-pop { min-width: 180px; max-width: 240px; }
.kr-leaflet-ad-pop img,
.kr-leaflet-ad-pop video { width: 100%; border-radius: 8px; max-height: 120px; object-fit: cover; }

.kr-sheet-back {
  display: none;
  position: fixed;
  z-index: 980;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--kr-border);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.94);
  color: #e2e8f0;
  font-weight: 800;
  font-size: 0.82rem;
}
body.kr-nav-mode.kr-sheet-open .kr-sheet-back { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 960px) {
  .mobile-bottom-dock { display: none !important; }
}
@media (min-width: 961px) {
  body.kr-nav-mode .kr-sos-hold { left: 12px; right: auto; }
}

/* ورود استیچ — تمام‌صفحه */
.kr-auth-stitch.modal-overlay.active {
  display: flex !important;
  align-items: stretch;
  justify-content: center;
  background: #070d18;
  z-index: 4000;
  padding: 0;
}
.kr-auth-stitch .kr-auth-card {
  width: min(390px, 100%);
  min-height: 100dvh;
  margin: 0;
  border-radius: 0;
  background: #070d18;
  border: 0;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.kr-auth-stitch .auth-modal-brand img {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}
.kr-auth-stitch #authModalTitle {
  font-size: 1.35rem;
  font-weight: 800;
  color: #e6f0fa;
}
.kr-auth-stitch .otp-boxes-group { gap: 8px; }
.kr-auth-stitch .otp-box {
  width: 52px;
  height: 60px;
  border-radius: 14px;
  background: #0d1c2d;
  border: 1px solid rgba(255,255,255,.1);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.kr-auth-stitch .btn.auth-full,
.kr-auth-stitch #btnSendOtp,
.kr-auth-stitch #btnVerifyOtp {
  min-height: 52px;
  border-radius: 16px;
  font-weight: 800;
  background: #ea580c;
  box-shadow: 0 10px 30px -5px rgba(234, 88, 12, 0.35);
}
