/* ===== سامانه برنامه‌ریزی مسیر ویزیتور — professional navigation look ===== */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1a2430;
  --muted: #64748b;
  --line: #dbe2ea;
  --primary: #166534;
  --primary-dark: #14532d;
  --primary-soft: #e8f3ec;
  --accent: #0e7490;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --amber: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .10), 0 1px 2px rgba(15, 23, 42, .06);
  --header-h: 62px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

[hidden] {
  display: none !important;
}
#mainLayout[hidden],
#routeView[hidden],
.layout[hidden],
.route-view[hidden] {
  display: none !important;
}

body {
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  overflow: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 700; }
button { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--header-h);
  background: linear-gradient(180deg, #10241a 0%, #143526 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 12px;
  position: relative;
  z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 0; font-size: 11px; color: #a7c4b5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.12); color: #e2e8f0;
  white-space: nowrap;
}
.chip.ok { background: rgba(34,197,94,.25); color: #bbf7d0; }
.chip.bad { background: rgba(239,68,68,.25); color: #fecaca; }

/* ---------- layout ---------- */
.layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  direction: rtl;
}
.panel {
  width: 400px;
  min-width: 340px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1100;
}
.panel-scroll { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.map-wrap { flex: 1; position: relative; min-width: 0; }
#map, #routeMap { position: absolute; inset: 0; background: #dde3ea; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head .card-title { margin-bottom: 0; }
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; flex-shrink: 0;
}

/* ---------- controls ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.geo-cascade-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.geo-label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.geo-details-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 6px;
  background: rgba(14, 116, 144, 0.08); color: var(--primary);
  font-size: 11.5px; font-weight: 500;
}
.field { display: block; font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.field input, .field select, .select, .input {
  width: 100%; margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit; font-size: 13.5px;
  background: #fff; color: var(--ink);
}
.select[multiple] { margin-top: 4px; }
.select:focus, .input:focus { outline: 2px solid rgba(22,101,52,.35); border-color: var(--primary); }
.select:disabled, .input:disabled { background: #f1f5f9; color: var(--muted); }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--primary); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: #d1e7db; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-lg { width: 100%; padding: 12px; font-size: 14.5px; margin-top: 10px; }
.btn-mini { padding: 3px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-od { width: 100%; }
.btn-od.active { outline: 2px solid var(--accent); background: #ecfeff; }
.btn-danger { color: var(--danger); border-color: #fecaca; }

/* ---------- type chips ---------- */
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.type-chip .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.type-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- status & results ---------- */
.status-line {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px dashed var(--line);
}
.status-line.ok { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.status-line.err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.status-line .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 7px; overflow: hidden; }
.status-line .bar > i { display: block; height: 100%; background: var(--primary); transition: width .4s; }

.result-count { font-size: 15px; font-weight: 700; color: var(--primary-dark); margin-top: 10px; }
.result-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.coverage-note { font-size: 11.5px; color: var(--muted); background: #f8fafc; border-radius: 6px; padding: 6px 8px; margin-top: 8px; border: 1px solid var(--line); }

/* ---------- POI list ---------- */
.list-actions { display: flex; gap: 6px; }
.poi-list { display: flex; flex-direction: column; gap: 7px; max-height: 340px; overflow-y: auto; padding-left: 4px; }
.poi-item {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  background: #fff;
}
.poi-item:hover { background: #f8fafc; }
.poi-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.poi-item .poi-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.poi-item .poi-body { min-width: 0; flex: 1; }
.poi-item .poi-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-item .poi-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poi-item .brand-tag {
  font-size: 10.5px; font-weight: 700;
  background: #eef2ff; color: #3730a3;
  border-radius: 5px; padding: 1px 6px; margin-inline-start: 6px;
  white-space: nowrap;
}
.poi-item input[type=checkbox] { margin-top: 5px; width: 15px; height: 15px; accent-color: var(--primary); }

/* ---------- OD ---------- */
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.od-grid .btn-od:first-child, .od-grid .btn-od:nth-child(2) { grid-column: auto; }
.od-grid .checkline { grid-column: 1 / -1; }
.od-grid .btn-ghost { grid-column: 1 / -1; }
.od-info { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.od-line { font-size: 12.5px; }
.od-line b { color: var(--ink); }
.od-line .addr { color: var(--muted); display: block; font-size: 11.5px; }
.muted { color: var(--muted); }

/* ---------- plan grid ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.plan-grid label { font-size: 12px; color: var(--muted); display: block; }
.workdays { margin-top: 10px; }
.workdays-label { font-size: 12px; color: var(--muted); }
.workday-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.wday-chip {
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 3px 12px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.wday-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- routes section ---------- */
.routes-summary { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.route-cards { display: flex; flex-direction: column; gap: 8px; }
.route-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.route-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.route-card .rc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.5px; }
.route-card .rc-badge {
  font-size: 11px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 6px; padding: 2px 8px;
}
.route-card .rc-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.route-card .rc-stops { font-size: 11.5px; color: var(--muted); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- providers ---------- */
.provider-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.provider-row:last-child { border-bottom: none; }
.provider-row .p-name { font-weight: 700; width: 130px; flex-shrink: 0; }
.provider-row .p-caps { color: var(--muted); font-size: 11px; flex: 1; }
.provider-row .p-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.provider-caps { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.provider-legend { font-size: 11px; color: var(--muted); padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.p-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.p-dot.ok { background: #22c55e; }
.p-dot.warn { background: #f59e0b; }
.p-dot.bad { background: #ef4444; }
.p-dot.off { background: #cbd5e1; }
.provider-parts { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ---------- map hint ---------- */
.map-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(14, 116, 144, .95); color: #fff;
  padding: 8px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
  z-index: 1000; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  white-space: nowrap;
}
.map-bbox-badge {
  position: absolute; bottom: 24px; left: 12px;
  background: rgba(14,116,144,.9); color: #fff;
  font-size: 11.5px; padding: 4px 10px; border-radius: 6px;
  z-index: 1000;
}
.map-legend {
  position: absolute; bottom: 24px; right: 12px;
  background: rgba(255,255,255,.95); color: var(--ink);
  font-size: 11.5px; padding: 5px 10px; border-radius: 6px;
  box-shadow: var(--shadow); z-index: 1000;
}

/* detected chains */
.detected-chains { margin-top: 8px; }
.detected-chains .dc-title { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.dc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #e0e7ff; background: #eef2ff; color: #3730a3;
  border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 600; margin: 0 6px 5px 0;
}
.dc-chip button {
  border: none; background: #3730a3; color: #fff;
  border-radius: 999px; font-size: 10.5px; font-weight: 700;
  padding: 1px 8px; cursor: pointer;
}
.dc-chip button:hover { background: #312e81; }
.dc-chip.added { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }

/* ---------- route view ---------- */
.route-view { display: flex; height: calc(100vh - var(--header-h)); direction: rtl; }
.route-side {
  width: 460px; min-width: 380px;
  background: #fff; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 1100;
}
.route-side-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.route-side-head h1 { font-size: 15px; }
.route-side-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.route-map-wrap { flex: 1; position: relative; min-width: 0; }

.route-summary {
  background: var(--primary-soft);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.route-summary .rs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; text-align: center; }
.route-summary .rs-item b { display: block; font-size: 15px; color: var(--primary-dark); }
.route-summary .rs-item span { font-size: 11px; color: var(--muted); }

/* timeline (stepped layout) */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 12px 0;
  position: relative;
}
.tl-node {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: relative;
  transition: all 0.2s ease;
}
.tl-node:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.tl-node.origin {
  border-right: 4px solid #16a34a;
  background: linear-gradient(to left, #f0fdf4, #ffffff 40%);
}
.tl-node.dest {
  border-right: 4px solid #dc2626;
  background: linear-gradient(to left, #fef2f2, #ffffff 40%);
}
.tl-node.stop {
  border-right: 4px solid var(--primary);
}
.tl-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tl-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
}
.tl-badge.origin { background: #16a34a; }
.tl-badge.dest { background: #dc2626; }
.tl-badge.stop { background: var(--primary); }
.tl-node-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}
.tl-node-address {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}
.tl-node-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--muted);
}
.tl-node-meta b {
  color: var(--ink);
}

/* Stepped Connector between two nodes */
.tl-connector {
  position: relative;
  padding: 8px 16px 8px 12px;
  margin: -2px 0;
  display: flex;
  align-items: center;
}
.tl-connector::before {
  content: '';
  position: absolute;
  right: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #cbd5e1;
  z-index: 1;
}
.tl-leg-card {
  position: relative;
  z-index: 2;
  margin-right: 18px;
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}
.tl-leg-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.tl-leg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.tl-leg-dist {
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 4px;
}
.tl-leg-time {
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tl-traffic-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.tl-traffic-badge.green { background: #dcfce7; color: #15803d; }
.tl-traffic-badge.orange { background: #fef3c7; color: #b45309; }
.tl-traffic-badge.red { background: #fee2e2; color: #b91c1c; }
.tl-traffic-badge.gray { background: #f1f5f9; color: #64748b; }
.tl-leg-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

/* Step-by-step street directions inside connector */
.tl-street-steps {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tl-street-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  font-size: 11.5px;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.tl-street-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  flex: 1;
}
.tl-street-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}
.tl-street-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #1e293b;
  font-size: 11px;
}
.route-card .rc-action {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
}
.route-card:hover .rc-action {
  color: var(--primary-dark);
}

/* weather & air quality card */
.weather-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.weather-card .wc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.weather-card .wc-temp-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.weather-card .wc-icon {
  font-size: 38px;
  line-height: 1;
}
.weather-card .wc-temp {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
}
.weather-card .wc-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.weather-card .wc-aqi-wrap {
  text-align: left;
}
.weather-card .aqi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.aqi-badge.green { background: #22c55e; color: #ffffff; }
.aqi-badge.yellow { background: #eab308; color: #713f12; }
.aqi-badge.orange { background: #f97316; color: #ffffff; }
.aqi-badge.red { background: #ef4444; color: #ffffff; }
.aqi-badge.purple { background: #a855f7; color: #ffffff; }
.aqi-badge.gray { background: #94a3b8; color: #ffffff; }

.weather-card .aqi-sub {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 3px;
}
.weather-card .wc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  background: rgba(255,255,255,0.75);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}
.weather-card .wc-cell b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}
.weather-card .wc-cell span {
  font-size: 10.5px;
  color: #64748b;
}
.weather-card .wc-src {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 8px;
  text-align: right;
  direction: rtl;
}

/* compare */
.compare-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.compare-card h3 { font-size: 13.5px; margin-bottom: 8px; }
.compare-card table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.compare-card td, .compare-card th { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.compare-card th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.compare-card .better { color: var(--ok); font-weight: 700; }
.compare-card .worse { color: var(--danger); font-weight: 700; }

/* toasts */
.toast-wrap { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff;
  padding: 10px 16px; border-radius: 9px;
  font-size: 13px; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  animation: toast-in .25s ease;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel-foot { padding-top: 4px; }
.panel-foot p { font-size: 11px; margin: 0; }

/* Leaflet RTL fixes & marker styles */
.leaflet-container { font-family: 'Vazirmatn', sans-serif; }
.leaflet-popup-content { font-family: 'Vazirmatn', sans-serif; direction: rtl; text-align: right; font-size: 12.5px; }
.mk { display: block; }
.mk-circle {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.mk-circle.selected { outline: 3px solid rgba(14,116,144,.55); }
.mk-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.mk-od {
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.cluster-icon {
  background: rgba(22,101,52,.85);
  color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  border: 3px solid rgba(255,255,255,.8);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* ---------- mobile switch bar ---------- */
.mobile-switch-bar {
  display: none;
}
.m-switch-btn {
  font-family: inherit;
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  transition: all .15s ease;
}
.m-switch-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(22,101,52,.25);
}

/* ---------- responsive (Tablets & Mobile) ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .panel { width: 370px; min-width: 320px; }
  .route-side { width: 400px; min-width: 340px; }
  .grid-2 { gap: 8px; }
  .topbar { padding: 0 14px; }
}

@media (max-width: 768px) {
  :root {
    --header-h: 56px;
  }
  body { overflow: hidden; }
  .topbar { padding: 0 12px; }
  .topbar .brand h1 { font-size: 13px; }
  .topbar .brand p { display: none; }
  #trafficChip { display: none; }
  #tileSelect { max-width: 130px; font-size: 12px; padding: 6px 4px; }

  .mobile-switch-bar {
    display: flex;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: 6px 10px;
    gap: 8px;
    position: relative;
    z-index: 1200;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }

  .layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 49px);
    position: relative;
    overflow: hidden;
  }

  .panel {
    width: 100%;
    min-width: 0;
    height: 100%;
    border-left: none;
    border-top: none;
    display: flex;
    flex-direction: column;
  }
  .panel-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 60px 12px;
  }

  .map-wrap {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 10;
  }

  /* Mobile mode toggling */
  body.mobile-show-map #sidePanel { display: none !important; }
  body.mobile-show-map #mapWrap { display: block !important; z-index: 1000; }
  body:not(.mobile-show-map) #mapWrap { display: none; }
  body:not(.mobile-show-map) #sidePanel { display: flex !important; }

  /* Mobile touch targets & iOS zoom prevention */
  .field input, .field select, .select, .input {
    font-size: 16px !important;
    min-height: 42px;
  }
  .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn-lg {
    min-height: 46px;
    font-size: 15px;
  }
  .grid-2, .plan-grid, .geo-cascade-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .od-grid {
    grid-template-columns: 1fr;
  }
  .poi-list {
    max-height: 280px;
  }

  /* Route view mobile */
  .route-view {
    flex-direction: column;
    height: calc(100vh - var(--header-h));
    overflow: hidden;
  }
  .route-map-wrap {
    height: 42vh;
    min-height: 240px;
  }
  .route-side {
    width: 100%;
    min-width: 0;
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .route-side-scroll {
    padding: 10px 12px;
  }
  .route-summary .rs-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .weather-card .wc-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
}

/* ---------- dual POI search ---------- */
.poi-search-tools{display:flex;justify-content:flex-start;margin-top:4px}
.poi-grid-label{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);font-weight:600}
.poi-grid-select{min-width:110px;padding:7px 9px}
.btn-boost{width:100%;margin-top:8px;background:#f8fafc;border-color:#0e7490;color:#0e7490}
.btn-boost:hover{background:#ecfeff}
