:root {
  --bg: #07101d;
  --bg-soft: #0b1627;
  --surface: rgba(13, 27, 46, .78);
  --surface-solid: #0e1b2d;
  --surface-2: #13233a;
  --text: #f4f8ff;
  --muted: #9badc4;
  --line: rgba(255,255,255,.09);
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  --glow: rgba(64, 141, 255, .16);
  --radius: 24px;
  --banking: #2f80ed;
  --payments: #ef476f;
  --commerce: #06d6a0;
  --social: #f59e0b;
  --logistics: #8b5cf6;
  --data: #22c1c3;
  --trust: #a3e635;
}

:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-soft: #edf2f8;
  --surface: rgba(255,255,255,.84);
  --surface-solid: #ffffff;
  --surface-2: #f0f4f9;
  --text: #142136;
  --muted: #5d6e84;
  --line: rgba(10, 30, 54, .10);
  --shadow: 0 24px 70px rgba(18, 45, 75, .12);
  --glow: rgba(47, 128, 237, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Vazirmatn", "Vazir", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(47,128,237,.10), transparent 29%),
    radial-gradient(circle at 85% 30%, rgba(139,92,246,.09), transparent 26%),
    var(--bg);
  overflow-x: hidden;
}

button, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .08;
  pointer-events: none;
  z-index: -1;
}
.ambient-a { background:#2f80ed; top:-160px; right:-80px; }
.ambient-b { background:#8b5cf6; bottom:-180px; left:-120px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px clamp(20px, 5vw, 76px);
  background: color-mix(in srgb, var(--bg) 83%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display:flex; align-items:center; gap:12px; margin-left:auto; min-width:0; }
.brand strong { display:block; font-size:14px; font-weight:800; }
.brand small { display:block; color:var(--muted); font-size:10px; direction:ltr; text-align:right; letter-spacing:.02em; }
.brand-mark { width:38px; height:38px; position:relative; display:grid; place-items:center; border:1px solid var(--line); border-radius:12px; background:var(--surface); overflow:hidden; }
.brand-mark i { position:absolute; width:26px; height:4px; border-radius:10px; transform:rotate(-35deg); }
.brand-mark i:nth-child(1){ background:var(--banking); top:10px; right:4px; }
.brand-mark i:nth-child(2){ background:var(--payments); top:17px; right:7px; }
.brand-mark i:nth-child(3){ background:var(--commerce); top:24px; right:10px; }
.top-nav { display:flex; gap:22px; color:var(--muted); font-size:13px; }
.top-nav a { transition:.2s ease; }
.top-nav a:hover { color:var(--text); }
.icon-button { width:40px; height:40px; border-radius:12px; border:1px solid var(--line); background:var(--surface); cursor:pointer; }

.section-shell { width:min(1540px, calc(100% - 40px)); margin-inline:auto; }
.hero { min-height:610px; display:grid; grid-template-columns: 1.15fr .85fr; align-items:center; gap:44px; padding-block:74px 52px; }
.eyebrow, .section-kicker { color:#8eb9ff; font-size:12px; font-weight:700; letter-spacing:.02em; }
.eyebrow { display:inline-flex; align-items:center; gap:9px; padding:8px 12px; border:1px solid var(--line); border-radius:999px; background:var(--surface); }
.pulse-dot, .live-dot { width:7px; height:7px; border-radius:50%; background:#3ddc97; box-shadow:0 0 0 0 rgba(61,220,151,.55); animation:pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow:0 0 0 9px rgba(61,220,151,0); } 100% { box-shadow:0 0 0 0 rgba(61,220,151,0); } }
.hero h1 { max-width:780px; margin:22px 0 18px; font-size:clamp(38px, 5vw, 72px); line-height:1.08; letter-spacing:-.035em; }
.hero h1 em { color:#84b5ff; font-style:normal; }
.hero-copy > p { max-width:760px; color:var(--muted); font-size:16px; line-height:2; }
.hero-actions { display:flex; gap:12px; margin-top:28px; }
.primary-button, .secondary-button { display:inline-flex; align-items:center; justify-content:center; min-height:48px; padding:0 22px; border-radius:14px; border:1px solid transparent; cursor:pointer; }
.primary-button { background:linear-gradient(135deg, #2f80ed, #5a9bf0); color:white; box-shadow:0 10px 30px rgba(47,128,237,.28); }
.secondary-button { background:var(--surface); border-color:var(--line); }
.hero-stats { display:grid; grid-template-columns:repeat(4,1fr); margin-top:46px; max-width:780px; border-top:1px solid var(--line); }
.hero-stats div { padding:22px 0 0; }
.hero-stats strong { display:block; font-size:24px; }
.hero-stats span { color:var(--muted); font-size:11px; }
.hero-visual { display:grid; place-items:center; }
.mini-map-card { width:min(100%, 480px); aspect-ratio:1.05; position:relative; border:1px solid var(--line); border-radius:34px; background:linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 94%, #2f80ed 6%), var(--surface)); box-shadow:var(--shadow); overflow:hidden; transform:perspective(900px) rotateY(-8deg) rotateX(4deg); }
.mini-map-card::after { content:""; position:absolute; inset:0; background-image:linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size:38px 38px; opacity:.25; mask-image:linear-gradient(to bottom,black,transparent); }
.mini-map-lines { position:absolute; inset:0; }
.mini-map-lines i { position:absolute; left:-12%; top:var(--y); width:124%; height:8px; border-radius:20px; background:var(--c); transform:rotate(-10deg); box-shadow:0 0 28px color-mix(in srgb, var(--c) 48%, transparent); }
.orbit { position:absolute; border:1px dashed rgba(255,255,255,.16); border-radius:50%; z-index:2; }
.orbit-a { width:260px; height:260px; top:64px; right:74px; }
.orbit-b { width:170px; height:170px; top:110px; right:118px; }
.mini-station { position:absolute; z-index:4; width:24px; height:24px; border-radius:50%; background:var(--surface-solid); border:6px solid #fff; box-shadow:0 0 0 8px rgba(255,255,255,.06); }
.s1 { top:30%; right:34%; border-color:var(--payments); }
.s2 { top:52%; right:51%; border-color:var(--social); }
.s3 { top:67%; right:27%; border-color:var(--data); }
.mini-card-copy { position:absolute; right:28px; bottom:28px; z-index:5; direction:ltr; text-align:left; }
.mini-card-copy b { display:block; font-size:22px; }
.mini-card-copy small { color:var(--muted); }

.map-section { padding-block:62px 20px; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:26px; margin-bottom:24px; }
.section-heading.compact { align-items:center; }
.section-heading h2 { font-size:clamp(28px,3vw,42px); margin:8px 0 6px; }
.section-heading p { margin:0; max-width:740px; color:var(--muted); line-height:1.9; font-size:13px; }
.map-actions, .filter-pills { display:flex; flex-wrap:wrap; gap:8px; }
.tool-button, .filter-pill, .journey-chip { border:1px solid var(--line); background:var(--surface); border-radius:12px; padding:10px 14px; cursor:pointer; color:var(--muted); transition:.2s ease; }
.tool-button:hover, .filter-pill:hover, .journey-chip:hover { color:var(--text); border-color:color-mix(in srgb, #5a9bf0 55%, var(--line)); }
.tool-button.active, .filter-pill.active, .journey-chip.active { color:white; background:#2f80ed; border-color:#2f80ed; }
.journey-bar { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:16px; padding:11px 13px; border:1px solid var(--line); background:var(--surface); border-radius:16px; }
.journey-bar > span { color:var(--muted); font-size:12px; margin-left:3px; }
.journey-chip { padding:7px 12px; font-size:11px; border-radius:999px; }
.journey-chip.ghost { background:transparent; }
.metro-layout { display:grid; grid-template-columns:230px minmax(0, 1fr) 320px; gap:14px; align-items:stretch; min-height:760px; }
.legend-panel, .detail-panel, .map-card { border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); backdrop-filter:blur(14px); box-shadow:var(--shadow); }
.legend-panel { padding:18px; }
.panel-title { display:flex; justify-content:space-between; align-items:center; padding-bottom:14px; border-bottom:1px solid var(--line); }
.panel-title span { font-weight:800; font-size:13px; }
.panel-title small { color:var(--muted); font-size:9px; }
.line-legend { display:grid; gap:6px; margin-top:14px; }
.line-legend button { width:100%; display:grid; grid-template-columns:14px 1fr; gap:10px; align-items:center; text-align:right; border:1px solid transparent; background:transparent; color:var(--muted); padding:10px 8px; border-radius:12px; cursor:pointer; transition:.2s; }
.line-legend button:hover, .line-legend button.active { background:var(--surface-2); color:var(--text); border-color:var(--line); }
.line-swatch { width:12px; height:12px; border-radius:4px; background:var(--line-color); box-shadow:0 0 18px color-mix(in srgb, var(--line-color) 48%, transparent); }
.line-legend strong { display:block; font-size:11px; }
.line-legend small { display:block; font-size:9px; opacity:.72; direction:ltr; text-align:right; margin-top:2px; }
.legend-note { margin-top:18px; padding-top:16px; border-top:1px solid var(--line); display:flex; gap:10px; align-items:flex-start; }
.legend-note p { margin:0; color:var(--muted); font-size:9px; line-height:1.8; }
.interchange-icon { flex:0 0 auto; width:20px; height:20px; border:4px solid #e8f0ff; border-radius:50%; box-shadow:0 0 0 3px var(--surface-solid); }

.map-card { position:relative; min-width:0; overflow:hidden; background:linear-gradient(180deg, color-mix(in srgb, var(--surface-solid) 92%, transparent), var(--surface)); }
.map-card::before { content:""; position:absolute; inset:56px 0 0; pointer-events:none; background-image:linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size:38px 38px; opacity:.16; }
.map-topbar { position:relative; z-index:3; height:56px; padding:0 16px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); }
.map-topbar > div { display:flex; align-items:center; gap:8px; font-size:11px; }
.map-topbar-meta { color:var(--muted); direction:rtl; }
.svg-scroller { position:relative; height:704px; overflow:auto; direction:ltr; scrollbar-width:thin; }
.metro-svg { display:block; width:100%; min-width:900px; height:auto; min-height:100%; user-select:none; }
.map-hint { position:absolute; bottom:14px; left:14px; z-index:5; padding:8px 11px; border-radius:10px; background:color-mix(in srgb, var(--surface-solid) 86%, transparent); color:var(--muted); border:1px solid var(--line); font-size:9px; backdrop-filter:blur(10px); }

.detail-panel { padding:20px; min-width:0; overflow:hidden; }
.detail-empty { height:100%; display:grid; place-content:center; text-align:center; padding:30px 12px; }
.detail-empty .empty-icon { width:58px; height:58px; margin:0 auto 14px; display:grid; place-items:center; border-radius:18px; background:var(--surface-2); border:1px solid var(--line); color:#7eaef3; font-size:28px; }
.detail-empty h3 { font-size:15px; margin:0 0 8px; }
.detail-empty p { margin:0; color:var(--muted); font-size:11px; line-height:1.9; }
.hidden { display:none !important; }
.detail-content { position:relative; }
.detail-accent { height:4px; border-radius:999px; margin-bottom:16px; background:var(--accent, #2f80ed); }
.detail-badges { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.detail-badge { padding:5px 8px; border-radius:999px; border:1px solid var(--line); color:var(--muted); font-size:9px; background:var(--surface-2); }
.detail-badge.active { color:#5ee3a5; border-color:rgba(94,227,165,.24); background:rgba(94,227,165,.06); }
.detail-badge.inactive { color:#ffadbc; border-color:rgba(255,173,188,.22); background:rgba(255,173,188,.06); }
.detail-content h3 { margin:0; font-size:21px; line-height:1.4; }
.detail-subtitle { color:var(--muted); font-size:11px; line-height:1.8; margin:8px 0 0; }
.detail-section { margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }
.detail-section h4 { margin:0 0 10px; font-size:11px; color:#b6c7dc; }
.chip-cloud { display:flex; flex-wrap:wrap; gap:6px; }
.chip-cloud span { padding:6px 8px; border-radius:9px; background:var(--surface-2); border:1px solid var(--line); font-size:9px; }
.detail-list { display:grid; gap:7px; }
.detail-list-item { padding:10px; border-radius:12px; border:1px solid var(--line); background:var(--surface-2); }
.detail-list-item b { display:block; font-size:10px; }
.detail-list-item span { display:block; margin-top:4px; color:var(--muted); font-size:9px; line-height:1.6; }
.detail-list-item .micro-status { display:inline-flex; width:auto; margin-top:7px; font-size:8px; padding:3px 6px; border-radius:999px; }
.micro-status.active { color:#58dca0; background:rgba(88,220,160,.08); }
.micro-status.inactive { color:#f6a6b5; background:rgba(246,166,181,.08); }

.opportunity-section, .status-section, .actors-section { padding-block:80px 10px; }
.opportunity-grid { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; }
.opportunity-card { position:relative; min-height:210px; padding:20px; border:1px solid var(--line); border-radius:20px; background:var(--surface); box-shadow:var(--shadow); overflow:hidden; transition:.22s ease; cursor:pointer; }
.opportunity-card:hover { transform:translateY(-4px); border-color:rgba(112,164,237,.38); }
.opportunity-card::after { content:""; position:absolute; width:120px; height:120px; border-radius:50%; background:var(--accent); filter:blur(80px); opacity:.13; left:-60px; bottom:-60px; }
.opportunity-index { color:var(--muted); font-size:10px; }
.opportunity-card h3 { margin:18px 0 8px; font-size:15px; }
.opportunity-card p { margin:0; color:var(--muted); font-size:11px; line-height:1.8; }
.opportunity-cross { margin-top:22px; display:inline-flex; padding:6px 9px; border-radius:999px; border:1px solid var(--line); font-size:9px; direction:ltr; background:var(--surface-2); }

.status-board { display:grid; grid-template-columns:.75fr 1.25fr; gap:24px; padding:28px; border:1px solid var(--line); border-radius:28px; background:linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 93%, #2f80ed 7%)); box-shadow:var(--shadow); }
.status-copy h2 { font-size:32px; margin:8px 0 10px; }
.status-copy p { color:var(--muted); font-size:12px; line-height:1.9; max-width:500px; }
.status-key { display:flex; gap:14px; margin-top:20px; color:var(--muted); font-size:10px; }
.status-key span { display:flex; align-items:center; gap:6px; }
.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.status-dot.active { background:#37d991; box-shadow:0 0 12px rgba(55,217,145,.5); }
.status-dot.inactive { background:#ef7187; box-shadow:0 0 12px rgba(239,113,135,.4); }
.status-columns { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.status-column { border:1px solid var(--line); border-radius:18px; padding:14px; background:var(--surface-solid); }
.status-column-head { display:flex; justify-content:space-between; align-items:center; padding-bottom:10px; border-bottom:1px solid var(--line); }
.status-column-head strong { font-size:12px; }
.status-column-head span { color:var(--muted); font-size:9px; }
.status-list { display:grid; gap:6px; margin-top:10px; max-height:340px; overflow:auto; }
.status-item { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:9px 10px; border-radius:10px; background:var(--surface-2); font-size:9px; }
.status-item span:last-child { color:var(--muted); direction:ltr; text-align:left; font-size:8px; }

.actors-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; }
.actor-card { padding:18px; min-height:165px; border:1px solid var(--line); border-radius:18px; background:var(--surface); box-shadow:var(--shadow); }
.actor-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:var(--surface-2); border:1px solid var(--line); margin-bottom:16px; font-size:16px; }
.actor-card h3 { margin:0 0 7px; font-size:12px; }
.actor-card p { margin:0; color:var(--muted); font-size:10px; line-height:1.8; }
.site-footer { width:min(1540px, calc(100% - 40px)); margin:80px auto 26px; min-height:86px; display:flex; justify-content:space-between; align-items:center; gap:20px; border-top:1px solid var(--line); color:var(--muted); }
.site-footer strong { display:block; color:var(--text); font-size:12px; direction:ltr; text-align:right; }
.site-footer span { font-size:9px; direction:ltr; display:block; }
.site-footer a { font-size:10px; }

/* SVG */
.metro-line-base { fill:none; stroke-linecap:round; stroke-linejoin:round; opacity:.96; transition:opacity .25s, filter .25s, stroke-width .25s; }
.metro-line-hit { fill:none; stroke:transparent; stroke-width:24; stroke-linecap:round; stroke-linejoin:round; cursor:pointer; pointer-events:stroke; }
.metro-line-group.dimmed .metro-line-base { opacity:.12; }
.metro-line-group.selected .metro-line-base { filter:drop-shadow(0 0 7px var(--line-color)); stroke-width:10 !important; }
.station-group { cursor:pointer; transition:opacity .2s; }
.station-group.dimmed { opacity:.18; }
.station-halo { fill:var(--surface-solid); stroke:var(--line-color); stroke-width:4; transition:.2s; }
.station-core { fill:var(--surface-solid); stroke:#dce8f8; stroke-width:2.5; transition:.2s; }
.station-group:hover .station-core, .station-group.selected .station-core { r:7; filter:drop-shadow(0 0 8px var(--line-color)); }
.station-label { fill:var(--text); font-family:"Vazirmatn",Tahoma,sans-serif; font-size:var(--map-font-size, 12px); font-weight:var(--map-font-weight, 550); paint-order:stroke; stroke:var(--surface-solid); stroke-width:4; stroke-linejoin:round; direction:rtl; unicode-bidi:plaintext; }
.station-label.en { direction:ltr; text-anchor:start; }
.station-sub { fill:var(--muted); font-family:"Vazirmatn",Tahoma,sans-serif; font-size:calc(var(--map-font-size, 12px) * .68); direction:ltr; paint-order:stroke; stroke:var(--surface-solid); stroke-width:3; }
.interchange-ring { fill:var(--surface-solid); stroke:#eef5ff; stroke-width:5; }
.interchange-inner { fill:var(--surface-solid); stroke:var(--accent, #fff); stroke-width:3; }
.interchange-group { cursor:pointer; transition:opacity .2s; }
.interchange-group.dimmed { opacity:.17; }
.interchange-group:hover .interchange-ring, .interchange-group.selected .interchange-ring { filter:drop-shadow(0 0 9px rgba(255,255,255,.48)); }
.interchange-label { fill:var(--text); font-family:"Vazirmatn",Tahoma,sans-serif; font-size:calc(var(--map-font-size, 12px) * .84); font-weight:var(--map-font-weight, 700); paint-order:stroke; stroke:var(--surface-solid); stroke-width:4; direction:ltr; }
.interchange-status { stroke:var(--surface-solid); stroke-width:3; }
.interchange-status.active { fill:#40df9b; }
.interchange-status.inactive { fill:#ef7187; }
.journey-path { fill:none; stroke:#ffffff; stroke-width:5; stroke-linecap:round; stroke-linejoin:round; stroke-dasharray:14 10; filter:drop-shadow(0 0 8px rgba(255,255,255,.36)); opacity:0; pointer-events:none; animation:dash 1.4s linear infinite; }
.journey-path.visible { opacity:.92; }
@keyframes dash { to { stroke-dashoffset:-48; } }
.journey-label { fill:#fff; font-family:"Vazirmatn",Tahoma,sans-serif; font-size:calc(var(--map-font-size, 12px) * .84); font-weight:var(--map-font-weight, 700); opacity:0; paint-order:stroke; stroke:#102039; stroke-width:5; }
.journey-label.visible { opacity:1; }
.map-mode-active .station-group { opacity:.22; }
.map-mode-active .interchange-group[data-status="inactive"] { opacity:.14; }
.map-mode-active .interchange-group[data-status="active"] { opacity:1; }
.map-mode-products .station-group:not(.is-interchange) { opacity:.22; }
.map-mode-products .interchange-group[data-has-product="false"] { opacity:.2; }
.map-mode-opportunities .station-group:not(.is-interchange) { opacity:.15; }
.map-mode-opportunities .interchange-group[data-status="active"] { opacity:.18; }
.map-mode-opportunities .interchange-group[data-status="inactive"] .interchange-ring { stroke:#fff; stroke-width:6; filter:drop-shadow(0 0 8px rgba(239,113,135,.55)); }

@media (max-width: 1260px) {
  .metro-layout { grid-template-columns:210px minmax(0,1fr); }
  .detail-panel { grid-column:1 / -1; min-height:260px; }
  .detail-empty { min-height:220px; }
  .opportunity-grid { grid-template-columns:repeat(3,1fr); }
  .actors-grid { grid-template-columns:repeat(3,1fr); }
}
@media (max-width: 900px) {
  .top-nav { display:none; }
  .hero { grid-template-columns:1fr; min-height:auto; padding-top:48px; }
  .hero-visual { display:none; }
  .hero-stats { grid-template-columns:repeat(2,1fr); }
  .section-heading { align-items:flex-start; flex-direction:column; }
  .metro-layout { grid-template-columns:1fr; }
  .legend-panel { order:1; }
  .map-card { order:2; }
  .detail-panel { order:3; }
  .line-legend { grid-template-columns:repeat(2,1fr); }
  .svg-scroller { height:630px; }
  .opportunity-grid { grid-template-columns:repeat(2,1fr); }
  .status-board { grid-template-columns:1fr; }
  .actors-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 620px) {
  .section-shell, .site-footer { width:min(100% - 24px, 1540px); }
  .site-header { padding-inline:12px; }
  .brand small { display:none; }
  .hero { padding-top:34px; }
  .hero h1 { font-size:38px; }
  .hero-copy > p { font-size:13px; }
  .hero-actions { flex-direction:column; }
  .hero-stats { margin-top:32px; }
  .line-legend { grid-template-columns:1fr; }
  .opportunity-grid, .actors-grid, .status-columns { grid-template-columns:1fr; }
  .opportunity-card { min-height:auto; }
  .map-actions { width:100%; overflow:auto; flex-wrap:nowrap; padding-bottom:2px; }
  .tool-button { white-space:nowrap; }
  .journey-bar { overflow:auto; flex-wrap:nowrap; }
  .journey-chip, .journey-bar > span { white-space:nowrap; }
  .map-topbar-meta { display:none !important; }
  .site-footer { align-items:flex-start; flex-direction:column; padding-top:20px; }
}

/* =========================================================
   Stable map view toolbar
   Prevents menu items from wrapping / jumping between rows.
   ========================================================= */
.map-controlbar {
  display: grid;
  grid-template-columns: minmax(640px, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  box-shadow: 0 12px 34px rgba(0,0,0,.10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.view-switcher {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  direction: rtl;
}

.view-button {
  position: relative;
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: right;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
  overflow: hidden;
}

.view-button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, #5a9bf0 42%, var(--line));
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.view-button.active {
  color: var(--text);
  border-color: color-mix(in srgb, #2f80ed 62%, var(--line));
  background: linear-gradient(145deg, color-mix(in srgb, #2f80ed 14%, var(--surface-solid)), var(--surface));
  box-shadow: inset 0 0 0 1px rgba(47,128,237,.08), 0 7px 18px rgba(47,128,237,.10);
}

.view-button-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: #91baff;
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}

.view-button.active .view-button-icon {
  color: #fff;
  background: #2f80ed;
  border-color: #2f80ed;
}

.view-button-icon.active-product-icon { color: #35d696; }
.view-button-icon.opportunity-icon { color: #f3bb47; }
.view-button.active .view-button-icon.active-product-icon,
.view-button.active .view-button-icon.opportunity-icon { color: #fff; }

.view-button-copy {
  min-width: 0;
  display: block;
  line-height: 1.25;
}

.view-button-copy strong {
  display: block;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-button-copy small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-count {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.map-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  direction: rtl;
  white-space: nowrap;
}

.font-control {
  position: relative;
  display: flex;
  min-width: 0;
}

.font-control-button,
.reset-view-button {
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: .2s ease;
}

.font-control-button:hover,
.reset-view-button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, #5a9bf0 42%, var(--line));
  background: var(--surface-2);
}

.font-aa {
  direction: ltr;
  font-family: Arial, sans-serif;
  font-weight: 700;
  color: #9ec1ff;
}

.font-current {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
}

.reset-view-button > span {
  font-size: 17px;
  line-height: 1;
}

.font-popover {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  z-index: 80;
  width: 310px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-solid);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  white-space: normal;
}

.font-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.font-popover-head strong { display:block; font-size:11px; }
.font-popover-head small { display:block; margin-top:3px; color:var(--muted); font-size:8px; }
.font-popover-head button,
.font-presets button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.font-popover-head button { padding:6px 8px; font-size:8px; }

.font-range-row,
.font-select-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:13px;
  color:var(--muted);
  font-size:9px;
}
.font-range-row output { direction:ltr; color:var(--text); }
.font-range { width:100%; margin-top:8px; accent-color:#2f80ed; }
.font-presets { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:10px; }
.font-presets button { padding:7px 5px; font-size:8px; }
.font-presets button.active { color:white; background:#2f80ed; border-color:#2f80ed; }
.font-select-row select {
  min-width:100px;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--surface-2);
  color:var(--text);
  font:inherit;
}

.view-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.view-summary-badge {
  flex: 0 0 auto;
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 9px;
  border-radius:999px;
  color:#a9c9ff;
  background:rgba(47,128,237,.09);
  border:1px solid rgba(47,128,237,.18);
  font-size:9px;
  font-weight:800;
  white-space:nowrap;
}
.view-summary p { margin:0; color:var(--muted); font-size:10px; line-height:1.7; }

/* Keep the toolbar deterministic at medium widths: groups may move as a whole,
   but individual controls never jump between rows. */
@media (max-width: 1180px) {
  .map-controlbar {
    grid-template-columns: 1fr;
  }
  .map-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .map-controlbar {
    display: block;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .view-switcher {
    width: 670px;
    grid-template-columns: repeat(3, 1fr);
  }
  .map-tools {
    width: max-content;
    margin-top: 8px;
  }
  .view-summary {
    align-items:flex-start;
  }
}
