/* =========================================================
   StoreCalc 5.0 · Commercial SaaS skin
   Screen-only override layer: light frosted chrome, 12px cards,
   #2563EB primary, readable type floor, App-style mobile shell.
   Print / PDF styles in style.css remain untouched.
   ========================================================= */
@media screen {
  :root {
    --ink: #0f172a;
    --ink-2: #1e293b;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #5b6b82;
    --faint: #64748b;
    --line: #e2e8f0;
    --line-2: #f1f5f9;
    --bg: #f8fafc;
    --paper: #ffffff;
    --blue: #2563eb;
    --blue-600: #1d4ed8;
    --blue-soft: #eff6ff;
    --emerald: #059669;
    --emerald-soft: #ecfdf5;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --rose: #dc2626;
    --rose-soft: #fef2f2;
    --violet: #7c3aed;
    --violet-soft: #f5f3ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 64px -28px rgba(15, 23, 42, .38);
    --topbar-h: 64px;
    --tabs-h: 56px;
  }

  html { background: #f8fafc; }
  body {
    background: #f8fafc;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
  }
  small { font-size: 12px; }

  /* ---------------- Topbar ---------------- */
  .topbar {
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: none;
  }
  .topbar::after { display: none; }
  .topbar-inner {
    max-width: 1480px;
    min-height: 64px;
    padding: 10px 24px;
    gap: 18px;
  }
  .brand { gap: 9px; }
  .brand-mark {
    width: 32px; height: 32px; border-radius: 8px;
    filter: none;
  }
  .brand-title { font-size: 17px; font-weight: 700; color: #0f172a; letter-spacing: -.01em; }
  .brand-title .ver {
    color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe;
    border-radius: 6px; font-size: 12px; font-weight: 600;
    padding: 0 5px; vertical-align: 1px;
  }
  .brand-sub { font-size: 12px; color: #64748b; letter-spacing: 0; }

  .combo-trigger {
    min-width: 200px; height: 40px; padding: 5px 10px;
    border-radius: 9px; border: 1px solid #e2e8f0;
    background: #f8fafc; color: #0f172a;
  }
  .combo-trigger:hover { background: #f1f5f9; border-color: #cbd5e1; }
  .combo-trigger > .icon { color: #64748b; }
  .combo-copy b { font-size: 13px; color: #0f172a; font-weight: 650; }
  .combo-copy small { font-size: 12px; color: #64748b; }
  .combo-trigger .chev { color: #64748b; }
  .combo-pop { border-radius: 12px; border-color: #e2e8f0; box-shadow: 0 24px 64px -28px rgba(15, 23, 42, .38); }
  .combo-search input { font-size: 13px; }
  .combo-search kbd { font-size: 12px; }
  .combo-meta { font-size: 12px; }
  .city-group-label { font-size: 12px; letter-spacing: .08em; }
  .city-option-main b { font-size: 13px; }
  .city-option-main small { font-size: 12px; }
  .city-option .tier-chip { font-size: 12px; padding: 1px 6px; }
  .city-empty { font-size: 13px; }

  .industry-picker {
    height: 40px; padding: 5px 9px; border-radius: 9px;
    border: 1px solid #e2e8f0; background: #f8fafc;
  }
  .industry-picker:hover { background: #f1f5f9; border-color: #cbd5e1; }
  .picker-icon { width: 26px; height: 26px; border-radius: 7px; background: #eff6ff; color: #2563eb; }
  .picker-copy small { font-size: 12px; color: #64748b; }
  .industry-picker select { font-size: 13px; color: #0f172a; font-weight: 600; }
  .industry-picker .chev { color: #64748b; top: 13px; }

  .top-status {
    height: 34px; padding: 0 10px; border-radius: 8px;
    font-size: 12px; color: #475569;
    background: #f8fafc; border: 1px solid #e2e8f0;
  }
  .top-status small { font-size: 12px; color: #64748b; }
  .top-status .dot { width: 6px; height: 6px; }
  .top-status.live { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
  .top-status.live .dot { background: #059669; }
  .top-status.model { color: #b45309; background: #fffbeb; border-color: #fde68a; }
  .top-status.model .dot { background: #d97706; }
  .top-status small { color: #64748b; }

  .btn {
    min-height: 36px; padding: 0 13px; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #fff; color: #334155;
    font-size: 13px; font-weight: 600;
    box-shadow: none;
  }
  .btn:hover { border-color: #cbd5e1; background: #f8fafc; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); transform: none; }
  .btn:active { transform: none; }
  .btn.small { min-height: 32px; padding: 0 11px; font-size: 12px; border-radius: 7px; }
  .btn.big { min-height: 46px; font-size: 14px; border-radius: 10px; }
  .btn.primary {
    background: #2563eb; border-color: #2563eb; color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, .18);
  }
  .btn.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
  .btn.top-btn {
    height: 34px; min-height: 34px; padding: 0 11px;
    background: #fff; border-color: #e2e8f0; color: #334155;
  }
  .btn.top-btn:hover { background: #f8fafc; }
  .btn.top-btn.ghost { background: #fff; }
  #btn-novice { color: #1d4ed8; border-color: #dbeafe; background: #eff6ff; }
  #btn-novice:hover { background: #dbeafe; }
  .btn.danger { color: #b91c1c; border-color: #fecaca; background: #fff; }
  .link-btn { font-size: 12px; color: #2563eb; }
  .link-btn.danger { color: #dc2626; }
  .link-btn.light { color: #2563eb; }

  /* ---------------- Module tabs ---------------- */
  .tabs {
    position: sticky; top: 64px; z-index: 900;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
  }
  .tabs-inner { max-width: 1480px; min-height: 56px; padding: 0 24px; gap: 2px; }
  .tab { padding: 0 16px; color: #64748b; gap: 9px; }
  .tab::after { left: 14px; right: 14px; height: 2px; background: transparent; }
  .tab:hover { color: #0f172a; background: #f8fafc; }
  .tab.active { color: #0f172a; }
  .tab.active::after { background: #2563eb; }
  .tab .step {
    width: 24px; height: 24px; font-size: 12px;
    color: #64748b; background: #f1f5f9; border: 0;
  }
  .tab.active .step { color: #fff; background: #2563eb; box-shadow: none; }
  .tab-copy b { font-size: 13px; font-weight: 600; }
  .tab-copy small { font-size: 12px; color: #64748b; }
  .tabs-right { font-size: 12px; }

  /* ---------------- Shell ---------------- */
  .main { max-width: 1480px; padding: 24px; }
  .page { animation: saasPageIn .2s ease; }
  .page-head { align-items: flex-end; gap: 20px; margin-bottom: 18px; }
  .eyebrow {
    font-size: 12px; letter-spacing: .1em; font-weight: 600;
    color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe;
    padding: 2px 7px; border-radius: 5px;
  }
  .eyebrow.light { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; }
  .page-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
  .page-head p { font-size: 13px; color: #64748b; max-width: 760px; margin-top: 4px; line-height: 1.6; }
  .page-head-side { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; }
  .head-chips { gap: 8px; }
  .head-chip {
    min-width: 126px; padding: 8px 12px; border-radius: 10px;
    background: #fff; border: 1px solid #e2e8f0; box-shadow: none;
  }
  .head-chip small { font-size: 12px; color: #64748b; }
  .head-chip b { font-size: 18px; font-weight: 700; }
  .head-chip span { font-size: 12px; color: #64748b; }
  .applied-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 12px; border-radius: 9px;
    background: #fff; border: 1px solid #e2e8f0; box-shadow: none;
    font-size: 12px; color: #475569;
  }
  .applied-chip b { font-weight: 650; color: #0f172a; }
  .applied-chip small { color: #64748b; font-size: 12px; }

  .card {
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
  }
  .card-head { margin-bottom: 14px; gap: 12px; }
  .card-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
  .card-sub { font-size: 12px; color: #64748b; line-height: 1.5; margin-top: 3px; }
  .hint { font-size: 12px; color: #64748b; }
  .data-badge {
    font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
    color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  }
  .data-badge.official { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
  .data-badge.live { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; }
  .data-badge.measured { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; }
  .data-badge.model { color: #b45309; background: #fffbeb; border-color: #fde68a; }
  .data-badge.offline { color: #475569; background: #f8fafc; border-color: #e2e8f0; }

  /* ---------------- GIS workspace ---------------- */
  .gis-grid { grid-template-columns: minmax(0, 3fr) minmax(420px, 2fr); gap: 20px; }
  .map-card, .inspector-card {
    position: sticky;
    top: calc(var(--topbar-h) + var(--tabs-h) + 16px);
    height: calc(100vh - var(--topbar-h) - var(--tabs-h) - 32px);
    min-height: 560px; max-height: none;
  }
  .map-card { overflow: hidden; }
  .map-topline { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
  .map-title { gap: 8px; }
  .map-title b { font-size: 14px; font-weight: 650; }
  .map-title small { font-size: 12px; color: #64748b; }
  .live-dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px rgba(5, 150, 105, .12); }
  .tile-switch { padding: 3px 8px; border-radius: 7px; background: #f8fafc; border-color: #e2e8f0; }
  .tile-switch .icon { width: 14px; height: 14px; }
  .tile-switch select {
    font-size: 12px; color: #334155; max-width: 122px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .map-canvas-wrap { background: #eef2f7; }
  .leaflet-container { background: #eef2f7; }
  .leaflet-control-attribution,
  .leaflet-control-attribution a { font-size: 12px !important; }
  .leaflet-control-attribution { padding: 2px 6px !important; border-radius: 6px 0 0 0; }
  .leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 32px !important; }
  .leaflet-control-scale-line { font-size: 12px !important; }
  .leaflet-popup-content { font-size: 12px; }
  .popup-card b { font-size: 13px; }
  .popup-card span, .popup-card small { font-size: 12px; color: #64748b; }
  .ccm-label { font-size: 12px; }
  .store-pin-label { font-size: 12px; }
  .store-pin-head, .store-pin-head::after { font-size: 12px; }
  .mc-marker em { font-size: 12px; top: -18px; }
  .dual-control .field-label { font-size: 12px; }
  .dual-label.leaflet-tooltip { font-size: 12px; }

  .map-searchbar { padding: 9px 14px 8px; gap: 4px 8px; }
  .place-search-field { height: 36px; border-radius: 8px; }
  .place-search-field input { font-size: 13px; }
  .place-search-field .btn { height: 28px; font-size: 12px; }
  .place-search-status { font-size: 12px; }
  .place-results { border-radius: 10px; }
  .place-result { font-size: 13px; padding: 8px 9px; }
  .place-result b { font-size: 13px; }
  .place-result small { font-size: 12px; }
  .place-result .pr-src { font-size: 12px; }
  .land-alert { padding: 9px 14px; gap: 9px; }
  .land-alert b { font-size: 13px; }
  .land-alert span { font-size: 12px; }
  .land-alert small { font-size: 12px; }
  .land-alert .btn { height: 30px; font-size: 12px; }

  .map-tools {
    width: 100px; padding: 8px 7px; border-radius: 10px;
    border: 1px solid #e2e8f0; background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px -16px rgba(15, 23, 42, .35);
  }
  .tool-group-label { font-size: 12px; letter-spacing: .06em; padding: 2px 7px 4px; color: #64748b; }
  .map-tool { height: 32px; padding: 0 7px; border-radius: 6px; font-size: 13px; gap: 7px; }
  .map-tool .icon { width: 15px; height: 15px; }
  .map-tool:hover { background: #f1f5f9; }
  .map-tool.active { background: #eff6ff; color: #1d4ed8; }
  .map-tool.primary { background: #eff6ff; color: #1d4ed8; }
  .tool-sep { margin: 3px 6px; background: #f1f5f9; }
  .map-legend {
    gap: 6px; padding: 8px 10px; border-radius: 8px;
    background: rgba(255, 255, 255, .94); border: 1px solid #e2e8f0;
    font-size: 12px; color: #64748b; box-shadow: 0 2px 8px -6px rgba(15, 23, 42, .3);
  }
  .map-legend i { width: 9px; height: 9px; }
  .map-result-float { font-size: 12px; border-radius: 9px; }
  .map-result-float b { font-size: 13px; }
  .map-result-float small, .map-result-float .mf-grid em { font-size: 12px; }

  .map-funnel-bar {
    background: #fff; color: #0f172a; border-top: 1px solid #e2e8f0;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  }
  .mf-stat { padding: 10px 14px; border-right: 1px solid #f1f5f9; }
  .mf-stat span { font-size: 12px; color: #64748b; }
  .mf-stat b { font-size: 20px; color: #0f172a; }
  .mf-stat small { font-size: 12px; color: #64748b; }
  .mf-guard { font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }

  .inspector-tabs {
    gap: 4px; padding: 8px; background: #fff;
    border-bottom: 1px solid #f1f5f9;
  }
  .inspector-tab { padding: 8px 7px; border-radius: 8px; font-size: 13px; font-weight: 600; }
  .inspector-tab .icon { width: 16px; height: 16px; }
  .inspector-tab small { font-size: 12px; color: #64748b; }
  .inspector-tab.active { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; box-shadow: none; }
  .inspector-tab.active small { color: #60a5fa; }
  .inspector-body { padding: 0 18px; }
  .inspector-section { padding: 16px 0; border-bottom: 1px solid #f1f5f9; }
  .inspector-section .section-head h3 { font-size: 14px; font-weight: 650; }
  .inspector-section .section-head p { font-size: 12px; color: #64748b; }
  .inspector-foot { padding: 12px 18px 16px; border-top: 1px solid #f1f5f9; }
  .panel-footnote { font-size: 12px; color: #64748b; }

  .area-empty { border-radius: 10px; background: #f8fafc; border-color: #e2e8f0; }
  .area-empty .icon { width: 24px; height: 24px; }
  .area-empty b { font-size: 13px; }
  .area-empty span { font-size: 12px; }
  .metric { border-radius: 8px; background: #f8fafc; padding: 10px 12px; }
  .metric-label { font-size: 12px; color: #64748b; }
  .metric-value { font-size: 20px; }
  .metric-unit { font-size: 12px; }
  .metric-sub { font-size: 12px; }
  .poi-estimate span { font-size: 12px; }
  .poi-summary-meta { font-size: 12px; }
  .poi-note { font-size: 12px; border-radius: 7px; }
  .poi-item { border-radius: 7px; }
  .poi-item .poi-rank { font-size: 12px; width: 20px; height: 20px; }
  .poi-item-main b { font-size: 13px; }
  .poi-item-main small { font-size: 12px; }
  .poi-actions .link-btn { font-size: 12px; }
  .bench-item { border-radius: 8px; background: #f8fafc; }
  .bench-label { font-size: 12px; }
  .bench-value { font-size: 14px; }
  .bench-value small { font-size: 12px; }
  .bench-note { font-size: 12px; }
  .field-label { font-size: 13px; font-weight: 500; color: #475569; }
  .field-label em { font-size: 12px; color: #64748b; }
  .field-input { height: 36px; border-radius: 8px; padding: 0 10px; }
  .field-input input, .field-input select { font-size: 13px; }
  .field-input .suffix { font-size: 12px; }
  .rent-readout { border-radius: 8px; background: #0f172a; padding: 10px 12px; }
  .rent-readout span, .rent-readout small { font-size: 12px; }
  .rent-readout b { font-size: 20px; }
  .rent-scale-labels { font-size: 12px; }
  .rent-compare { font-size: 12px; }
  .rent-lease-note { font-size: 12px; border-radius: 8px; background: #f8fafc; }
  .street-list { gap: 5px; }
  .street-item { border-radius: 8px; padding: 8px; background: #f8fafc; }
  .street-main b { font-size: 13px; }
  .street-main small { font-size: 12px; }
  .street-rent b { font-size: 13px; }
  .street-rent small { font-size: 12px; }
  .deep-pack-head b { font-size: 13px; }
  .deep-pack-head small { font-size: 12px; }
  .heat-item { border-radius: 8px; padding: 10px; }
  .heat-label { font-size: 12px; }
  .heat-value { font-size: 19px; }
  .heat-value small { font-size: 12px; }
  .heat-note { font-size: 12px; }
  .heat-actions .btn { font-size: 12px; }
  .district-option { padding: 8px 10px; border-radius: 8px; }
  .district-option b { font-size: 13px; }
  .district-option small { font-size: 12px; }
  .district-option em { font-size: 12px; }
  .funnel-lead { border-radius: 10px; background: #0f172a; }
  .funnel-lead small { font-size: 12px; }
  .funnel-lead b { font-size: 24px; }
  .funnel-lead b span { font-size: 12px; }
  .funnel-lead .funnel-status { font-size: 12px; }
  .funnel-message { font-size: 12px; border-radius: 8px; padding: 9px 11px; }
  .funnel-cell { border-radius: 8px; background: #f8fafc; padding: 8px 9px; }
  .funnel-cell span, .funnel-cell small { font-size: 12px; }
  .funnel-cell b { font-size: 13px; }
  .funnel-note { font-size: 12px; }
  .scale-guard { font-size: 12px; border-radius: 8px; }
  .demand-anchor, .demand-warning, .anchor-mark em { font-size: 12px; }
  .anchor-mark em { padding: 0 4px; }

  /* ---------------- Cockpit ---------------- */
  .cockpit-grid { grid-template-columns: 352px minmax(0, 1fr); gap: 20px; }
  .ctl-card {
    top: calc(var(--topbar-h) + var(--tabs-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - 32px);
    padding: 18px 16px 16px; border-radius: 12px;
    scrollbar-width: thin;
  }
  .ctl-card .card-head { margin-bottom: 10px; }
  .ctl-head-actions { gap: 6px; }
  .ctl-subtitle { font-size: 12px; color: #64748b; }
  .template-note {
    font-size: 12px; line-height: 1.5; border-radius: 8px;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    padding: 8px 10px;
  }
  /* Accordion groups */
  .ctrl-acc { border-top: 1px solid #f1f5f9; margin-top: 10px; padding-top: 2px; }
  .ctrl-acc:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
  .ctrl-acc > summary {
    list-style: none; cursor: pointer; display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    align-items: center; gap: 2px 8px; padding: 10px 2px;
  }
  .ctrl-acc > summary::-webkit-details-marker { display: none; }
  .ctrl-acc-title { font-size: 14px; font-weight: 650; color: #0f172a; }
  .ctrl-acc-hint { grid-column: 1; font-size: 12px; color: #64748b; }
  .ctrl-acc-caret, .advanced-card .summary-caret {
    grid-column: 2; grid-row: 1 / span 2;
    width: 8px; height: 8px; margin: 0 4px 0 0; justify-self: end;
    border-right: 1.6px solid #64748b; border-bottom: 1.6px solid #64748b;
    transform: rotate(45deg); transition: transform .2s ease;
  }
  .ctrl-acc[open] .ctrl-acc-caret { transform: rotate(225deg); }
  .ctrl-acc-body { padding: 0 0 4px; }
  .control-group { border-top: 1px dashed #f1f5f9; padding-top: 10px; margin-top: 8px; }
  .control-group:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
  .control-group-head { margin-bottom: 8px; gap: 8px; }
  .control-group-head b { font-size: 13px; font-weight: 600; color: #334155; letter-spacing: 0; text-transform: none; }
  .control-group-head span { font-size: 12px; color: #64748b; }
  .control-row { margin-bottom: 11px; }
  .control-label { margin-bottom: 4px; gap: 8px; }
  .control-label > span { font-size: 13px; color: #334155; font-weight: 500; }
  .control-label em { font-size: 12px; color: #64748b; }
  .control-value {
    font-family: var(--font); font-size: 12px; font-weight: 600; color: #0f172a;
    padding: 1px 6px; border-radius: 6px; background: #f1f5f9;
  }
  .control-line { gap: 9px; }
  .control-line .num-input {
    width: 68px; height: 30px; font-size: 13px; border-radius: 7px; padding: 0 7px;
  }
  .control-hint { font-size: 12px; color: #64748b; line-height: 1.45; }
  input[type="range"] { height: 4px; }
  input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; border-width: 2px; }
  .control-pair { gap: 10px; }
  .switch-row { padding: 10px 0; }
  .switch-row b { font-size: 13px; font-weight: 500; }
  .switch-row small { font-size: 12px; color: #64748b; }
  .owner-econ { font-size: 12px; border-radius: 8px; background: #eff6ff; line-height: 1.55; }
  .owner-econ b { font-size: 12px; }
  .delivery-safe { font-size: 12px; border-radius: 8px; }
  .franchise-grid > div { border-radius: 8px; background: #f8fafc; padding: 9px; }
  .franchise-grid span { font-size: 12px; }
  .franchise-grid b { font-size: 16px; }
  .franchise-grid small { font-size: 12px; }
  .franchise-hint { font-size: 12px; }
  .franchise-delta { font-size: 12px; border-radius: 8px; }
  .invest-mini {
    margin-top: 12px; padding: 11px 12px; border-radius: 9px;
    background: #f8fafc; border: 1px solid #e2e8f0;
  }
  .invest-total span { font-size: 12px; color: #64748b; }
  .invest-total b { font-size: 18px; color: #0f172a; }
  .invest-row { font-size: 12px; color: #64748b; }
  .invest-row b { font-size: 12px; color: #334155; }
  .ctl-note { font-size: 12px; color: #64748b; margin-top: 12px; }

  /* Advanced tax block lives in the rail as group 4 */
  .advanced-card {
    margin-top: 12px; padding: 0; overflow: visible;
    border: 0; border-top: 1px solid #f1f5f9; border-radius: 0;
    background: transparent; box-shadow: none;
  }
  .advanced-card > summary {
    display: grid; grid-template-columns: minmax(0, 1fr) 16px;
    align-items: center; gap: 2px 8px; padding: 11px 2px;
  }
  .advanced-card summary b { font-size: 14px; font-weight: 650; color: #0f172a; }
  .advanced-card summary span { font-size: 12px; color: #64748b; }
  .advanced-card .summary-caret { grid-column: 2; grid-row: 1 / span 2; }
  .adv-body { padding: 2px 0 0; border-top: 0; }
  .adv-grid { grid-template-columns: 1fr 1fr; gap: 9px 10px; margin-top: 8px; }
  .adv-note { font-size: 12px; color: #64748b; }
  .adv-toggle { font-size: 12px; color: #475569; }
  .tax-entity-box { flex-direction: column; border-radius: 9px; background: #f8fafc; padding: 10px 11px; }
  .tax-entity-box > .field { flex: none; }
  .tax-entity-note b { font-size: 13px; }
  .tax-entity-note span { font-size: 12px; }
  .tax-entity-note p { font-size: 12px; }
  .rent-solver-main > div { border-radius: 9px; background: #f8fafc; }
  .rent-solver-main small { font-size: 12px; }
  .rent-solver-main b { font-size: 18px; }
  .rent-solver-main span { font-size: 12px; }
  .rent-solver-controls { padding: 12px 18px; background: #f8fafc; }
  .rent-solver-controls .field { min-width: 140px; }
  .chip-btn { font-size: 12px; padding: 5px 10px; border-radius: 7px; border-color: #e2e8f0; }
  .rent-solver-empty { font-size: 12px; }
  .rent-solver-verify span { font-size: 12px; }
  .rent-negotiation-card { border-radius: 10px; background: #f8fafc; border-color: #bfdbfe; }
  .rnc-head b { font-size: 13px; }
  .rent-negotiation-card li { font-size: 12px; }
  .rent-negotiation-card p { font-size: 12px; }
  .rent-solver-actions span { font-size: 12px; }

  .cockpit-main { gap: 16px; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi-card {
    padding: 16px 16px 14px; border-radius: 12px;
    border: 1px solid #e2e8f0; box-shadow: none;
  }
  .kpi-card::before { display: none; }
  .kpi-head { align-items: flex-start; gap: 8px; }
  .kpi-label { font-size: 13px; font-weight: 500; color: #64748b; }
  .kpi-card .data-badge { font-size: 12px; padding: 1px 6px; }
  .kpi-value { margin-top: 8px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: #0f172a; }
  .kpi-value small { font-size: 13px; color: #64748b; margin-left: 3px; }
  .kpi-sub { margin-top: 5px; font-size: 12px; color: #64748b; line-height: 1.4; }
  .kpi-sub b { color: #334155; font-weight: 650; }
  .kpi-card.rose .kpi-value { color: #dc2626; }

  .rent-solver-card > .card-head { padding: 18px 20px 0; margin-bottom: 12px; }
  .rent-solver-result { padding: 16px 20px 20px; }
  .capacity-card, .chart-card, .cost-card, .mc-card { padding: 20px; }
  .capacity-head { margin-bottom: 14px; }
  .capacity-head h3 { font-size: 16px; }
  .capacity-formula { font-size: 12px; color: #64748b; }
  .capacity-formula code { font-size: 12px; padding: 2px 5px; border-radius: 4px; }
  .capacity-stats { gap: 20px; flex-wrap: wrap; }
  .capacity-stat span { font-size: 12px; color: #64748b; }
  .capacity-stat b { font-size: 18px; color: #0f172a; }
  .capacity-stat b small { font-size: 12px; }
  .capacity-bar { height: 14px; border-radius: 7px; }
  .capacity-scale { font-size: 12px; color: #64748b; }
  .micro-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px; margin-top: 12px;
  }
  .micro-item {
    min-width: 0; padding: 8px 10px; border-radius: 8px;
    background: #f8fafc; border: 1px solid #f1f5f9;
  }
  .micro-item span {
    display: block; font-size: 12px; color: #64748b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .micro-item b {
    display: block; margin-top: 2px; font-size: 15px; font-weight: 650;
    color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .micro-item.warn { background: #fffbeb; border-color: #fde68a; }
  .micro-item.warn b { color: #b45309; }
  .micro-item.bad { background: #fef2f2; border-color: #fecaca; }
  .micro-item.bad b { color: #b91c1c; }
  .capacity-notes { gap: 6px; margin-top: 12px; }
  .cap-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 9px; border-radius: 6px; font-size: 12px;
    background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b;
  }
  .cap-chip b { font-size: 12px; color: #334155; font-weight: 650; }
  .cap-chip.warn { background: #fffbeb; border-color: #fde68a; color: #b45309; }
  .cap-chip.bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

  .chart-legend { gap: 10px; }
  .legend-item { font-size: 12px; color: #64748b; }
  .legend-item b { font-size: 12px; }
  .chart-wrap { height: 320px; }
  .axis-text { font-size: 12px; fill: #64748b; }
  .season-label { font-size: 12px; }
  .cf-payback-text, .cf-quarter-label { font-size: 12px; }
  .chart-tip { font-size: 12px; border-radius: 8px; }
  .chart-tip b { font-size: 13px; }
  .chart-foot {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px; padding-top: 12px; border-top: 1px solid #f1f5f9;
  }
  .chart-foot .cap-chip {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4;
    white-space: normal; background: #f8fafc; border: 1px solid #f1f5f9;
  }
  .chart-foot .cap-chip b { font-size: 14px; color: #0f172a; }
  .chart-foot .cap-chip.warn { background: #fffbeb; border-color: #fde68a; }
  .chart-foot .cap-chip.bad { background: #fef2f2; border-color: #fecaca; }

  .unit-profit { font-size: 13px; border-radius: 6px; }
  .cost-stack { height: 28px; border-radius: 7px; }
  .cost-legend { gap: 7px 16px; }
  .cost-item { font-size: 12px; }
  .cost-dot { width: 8px; height: 8px; border-radius: 2px; }
  .cost-pct { font-size: 12px; width: 42px; }
  .tax-basis { border-radius: 8px; background: #f8fafc; }
  .tax-basis-head b { font-size: 13px; }
  .tax-basis-head span { font-size: 12px; }
  .tax-basis-grid small { font-size: 12px; }
  .tax-basis-grid b { font-size: 12px; }
  .tax-basis p { font-size: 12px; }
  .unit-table { gap: 5px 22px; }
  .unit-row { font-size: 12px; padding: 5px 0; }
  .mc-grid { gap: 10px; }
  .mc-stat { border-radius: 8px; background: #f8fafc; padding: 10px 12px; }
  .mc-stat span { font-size: 12px; }
  .mc-stat b { font-size: 22px; }
  .mc-stat small { font-size: 12px; }
  .mc-bar-wrap { margin-top: 14px; }
  .mc-bar-head, .mc-axis { font-size: 12px; }
  .mc-foot { font-size: 12px; }

  .plan-bar { padding: 16px 18px; border-radius: 12px; }
  .plan-bar-text strong { font-size: 14px; }
  .plan-bar-text span { font-size: 12px; color: #64748b; }
  .compare-card { padding: 20px; }
  .compare-col { border-radius: 10px; }
  .compare-col-head { padding: 10px 12px; background: #f8fafc; }
  .compare-col-head b { font-size: 13px; }
  .compare-col-head span { font-size: 12px; }
  .compare-row { font-size: 12px; padding: 7px 12px; }
  .compare-warning { font-size: 12px; border-radius: 8px; background: #fffbeb; }
  .monthly-card summary { padding: 16px 20px; }
  .monthly-card summary { font-size: 14px; font-weight: 600; color: #0f172a; }
  table.monthly { font-size: 12px; }
  table.monthly th { font-size: 12px; padding: 9px 10px; }
  table.monthly td { padding: 8px 10px; }
  table.monthly .m-season { font-size: 12px; }

  /* Shortlist matrix */
  .shortlist-card { overflow: visible; }
  .shortlist-table {
    width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px;
  }
  .shortlist-table th, .shortlist-table td {
    padding: 14px 16px; font-size: 13px; line-height: 1.45;
    border-bottom: 1px solid #f1f5f9; vertical-align: middle;
  }
  .shortlist-table thead th {
    background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 600;
    white-space: nowrap;
  }
  .shortlist-table th:first-child, .shortlist-table td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: #fff; color: #64748b; font-weight: 500; white-space: nowrap;
    box-shadow: 1px 0 0 #e2e8f0;
  }
  .shortlist-table thead th:first-child { background: #f8fafc; z-index: 3; }
  .shortlist-table tbody tr:hover td { background: #f8fafc; }
  .shortlist-table tbody tr:hover td:first-child { background: #f8fafc; }
  .shortlist-table .sl-head-city { display: block; font-size: 14px; color: #0f172a; font-weight: 650; margin-bottom: 1px; }
  .rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 8px;
    font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
    color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe;
  }
  .rank-badge.rank-1 { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
  .rank-badge.rank-2 { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; }
  .rank-badge.rank-3 { color: #b45309; background: #fffbeb; border-color: #fde68a; }
  .rank-badge.rank-4, .rank-badge.rank-5 { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }

  /* ---------------- Risk ---------------- */
  .verdict-banner {
    padding: 16px 20px; border-radius: 12px; gap: 14px;
    color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0;
  }
  .verdict-banner.warn { color: #92400e; background: #fffbeb; border-color: #fde68a; }
  .verdict-banner.bad { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
  .verdict-icon { width: 40px; height: 40px; border-radius: 10px; }
  .verdict-icon .icon { width: 20px; height: 20px; }
  .verdict-copy b { font-size: 18px; }
  .verdict-copy span { font-size: 12px; }
  .verdict-score b { font-size: 26px; }
  .verdict-score span { font-size: 12px; }
  .risk-dimensions { gap: 10px; }
  .risk-dimension { border-radius: 10px; padding: 11px 12px; }
  .risk-dimension-head span { font-size: 12px; }
  .risk-dimension-head b { font-size: 13px; }
  .risk-dimension p { font-size: 12px; }
  .risk-dimension-meta { font-size: 12px; }
  .risk-actions li { font-size: 12px; }
  .risk-grid { gap: 16px; margin-bottom: 16px; }
  .risk-grid > .card { padding: 20px; }
  .redline-name { font-size: 13px; }
  .redline-actual { font-size: 13px; }
  .redline-threshold, .redline-detail { font-size: 12px; }
  .redline-cat { font-size: 12px; padding: 1px 6px; border-radius: 4px; }
  .sens-label, .sens-value, .sens-pct { font-size: 12px; }
  .reserve-note { font-size: 12px; border-radius: 8px; }
  .risk-mc-card { padding: 14px 18px; border-radius: 12px; }
  .risk-mc-card .mc-inline span { font-size: 12px; }
  .risk-mc-card .mc-inline b { font-size: 16px; }
  .closure-card { border-radius: 12px; background: #fffbeb; border-color: #fde68a; box-shadow: none; }
  .closure-head h3 { font-size: 16px; }
  .closure-head p, .closure-note { font-size: 12px; }
  .closure-amount small, .closure-amount span { font-size: 12px; }
  .closure-amount b { font-size: 26px; }
  .closure-grid > div { border-radius: 8px; }
  .closure-grid small { font-size: 12px; }
  .closure-grid b { font-size: 13px; }
  .closure-tiers { gap: 10px; }
  .closure-tier { border-radius: 10px; padding: 12px; background: #fff; border: 1px solid #fde68a; }
  .closure-tier.severe { background: #fef2f2; border-color: #fecaca; }
  .tier-head span { font-size: 13px; font-weight: 650; color: #92400e; }
  .closure-tier.severe .tier-head span { color: #991b1b; }
  .tier-head b { font-size: 12px; font-weight: 500; color: #a16207; }
  .closure-tier.severe .tier-head b { color: #b91c1c; }
  .tier-amount { font-size: 22px; color: #78350f; }
  .closure-tier.severe .tier-amount { color: #991b1b; }
  .closure-tier small { font-size: 12px; color: #92400e; }
  .closure-tier.severe small { color: #b91c1c; }
  .tier-rows span { font-size: 12px; color: #92400e; }
  .closure-tier.severe .tier-rows span { color: #b91c1c; }
  .tier-rows b { font-size: 12px; color: #78350f; }
  .closure-tier.severe .tier-rows b { color: #991b1b; }
  .sens-arrow { width: 16px; height: 16px; font-size: 12px; border-radius: 4px; }
  .report-card {
    padding: 20px 22px; color: #0f172a; border-radius: 12px;
    background: #fff; border: 1px solid #dbeafe;
  }
  .report-card h3 { font-size: 20px; color: #0f172a; }
  .report-card p { font-size: 12px; color: #64748b; }
  .report-card .btn.light { background: #2563eb; border-color: #2563eb; color: #fff; }

  /* ---------------- Checklist / reconcile ---------------- */
  .progress-card { padding: 18px 20px; border-radius: 12px; }
  .progress-label { font-size: 12px; color: #64748b; letter-spacing: .06em; }
  .progress-head b { font-size: 16px; }
  .progress-pct { font-size: 26px; color: #1d4ed8; }
  .progress-meta { font-size: 12px; }
  .compliance-snapshot { gap: 16px; }
  .snapshot-card { padding: 18px; }
  .snapshot-list { gap: 7px; }
  .snap-item { font-size: 12px; padding: 4px 8px; border-radius: 6px; }
  .snapshot-desc { font-size: 12px; }
  .phase-title { font-size: 14px; }
  .phase-count, .phase-progress { font-size: 12px; }
  .phase-badge { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
  .task { padding: 10px 12px; border-radius: 8px; }
  .task-text { font-size: 13px; }
  .task-level, .task-source { font-size: 12px; }
  .reconcile-card { border-radius: 12px; }
  .rec-input-table th, .rec-input-table td { font-size: 12px; padding: 9px 10px; }
  .rec-input { font-size: 13px; border-radius: 7px; }
  .rec-empty { font-size: 12px; }
  .rec-diagnosis { font-size: 13px; border-radius: 8px; }
  .rec-table th, .rec-table td { font-size: 12px; padding: 8px 9px; }
  .rec-actions span { font-size: 12px; }
  .scope-note { font-size: 12px; }

  /* ---------------- Forms / dialogs ---------------- */
  .icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #fff; color: #64748b;
  }
  .data-dialog { border-radius: 14px; }
  .dialog-head { padding: 20px 22px 14px; background: #fff; }
  .dialog-head h3 { font-size: 20px; }
  .dialog-section h4 { font-size: 15px; }
  .dialog-section > p { font-size: 12px; }
  .offline-strip { font-size: 12px; border-radius: 8px; }
  .radio-card { border-radius: 8px; padding: 10px; }
  .radio-card b { font-size: 13px; }
  .radio-card span { font-size: 12px; }
  .api-note, .legal-meta { font-size: 12px; }
  .drop-zone { border-radius: 10px; background: #f8fafc; }
  .drop-zone b { font-size: 13px; }
  .drop-zone span { font-size: 12px; }
  .dataset-status { font-size: 12px; border-radius: 7px; }
  .source-table, .source-table th, .source-table td { font-size: 12px; }
  .legal-list li { font-size: 12px; }
  .check-row { font-size: 12px; }

  /* ---------------- Footer ---------------- */
  .footer {
    background: #fff; color: #64748b;
    border-top: 1px solid #e2e8f0; margin-top: 32px;
  }
  .footer-inner { max-width: 1480px; padding: 20px 24px; }
  .footer strong { color: #0f172a; font-size: 14px; }
  .footer p { font-size: 12px; line-height: 1.6; }
  .footer-actions { gap: 5px; }
  .footer-asof { font-size: 12px; color: #64748b; }

  /* ---------------- Toast ---------------- */
  .toast {
    position: fixed; left: auto; right: 20px; top: 72px; bottom: auto;
    transform: translateY(-8px);
    z-index: 3000; padding: 10px 14px; border-radius: 9px;
    background: #0f172a; color: #f8fafc; border: 1px solid #1e293b;
    box-shadow: 0 16px 40px -18px rgba(15, 23, 42, .55);
    font-size: 13px; max-width: min(440px, calc(100vw - 40px));
  }
  .toast.show { opacity: 1; transform: none; }
  .toast.err { border-color: #dc2626; }
  .toast.ok { border-color: #059669; }
  .toast.warn { border-color: #d97706; color: #fef3c7; }

  /* ---------------- Novice wizard ---------------- */
  .novice-overlay {
    z-index: 2000; padding: 5vh 20px;
    background: rgba(15, 23, 42, .45);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    align-items: flex-start;
  }
  .novice-panel {
    width: min(900px, 100%); padding: 24px; border-radius: 14px;
    background: #fff; box-shadow: 0 32px 80px -32px rgba(15, 23, 42, .45);
    max-height: 90vh; overflow-y: auto;
  }
  .novice-head { margin-bottom: 16px; gap: 16px; }
  .novice-head h3 { font-size: 24px; font-weight: 700; margin: 4px 0 3px; }
  .novice-head p { font-size: 13px; color: #64748b; line-height: 1.55; }
  .novice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .novice-grid .field-label { font-size: 13px; }
  .novice-grid .field-input { height: 40px; }
  .novice-grid .field-input input, .novice-grid .field-input select { font-size: 13px; }
  .novice-grid .field:has(#novice-budget) { grid-column: 1 / -1; width: min(360px, 100%); margin: 2px auto 0; }
  .novice-hint { margin-top: 12px; font-size: 12px; color: #64748b; text-align: center; }
  .novice-actions { justify-content: center; gap: 10px; margin-top: 16px; }
  .novice-actions .btn { min-height: 44px; padding: 0 22px; font-size: 14px; border-radius: 9px; }
  .novice-result { margin-top: 18px; }
  .novice-verdict { border-radius: 10px; padding: 16px 18px; gap: 3px; }
  .novice-verdict span { font-size: 12px; }
  .novice-verdict b { font-size: 20px; font-weight: 700; }
  .novice-verdict small { font-size: 12px; }
  .novice-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
  .novice-card-grid > div {
    border-radius: 10px; padding: 14px 16px; gap: 3px;
    background: #f8fafc; border: 1px solid #e2e8f0;
  }
  .novice-card-grid small { font-size: 12px; color: #64748b; }
  .novice-card-grid b { font-size: 20px; font-weight: 700; line-height: 1.35; color: #0f172a; }
  .novice-card-grid span { font-size: 12px; color: #64748b; line-height: 1.5; }
  .novice-card-grid b.novice-risk-text { font-size: 14px; line-height: 1.5; font-weight: 600; }
  .novice-note { font-size: 12px; color: #64748b; text-align: center; }

  /* ---------------- Mobile-only scaffolding (hidden on desktop) ---------------- */
  .m-context-pill,
  .m-bottom-nav,
  .m-sheet-overlay,
  .m-sheet-backdrop,
  .m-params-btn,
  .ctl-close { display: none; }

  /* ---------------- Numeric alignment ---------------- */
  .kpi-value, .kpi-sub b, .micro-item b, .capacity-stat b, .capacity-stat b small,
  .head-chip b, .metric-value, .bench-value, .heat-value, .rent-readout b,
  .street-rent b, .control-value, .control-line .num-input, .invest-total b,
  .invest-row b, .unit-profit, .cost-value, .cost-pct, .ur-value, .mc-stat b,
  .progress-pct, .verdict-score b, .closure-amount b, .closure-grid b,
  .rent-solver-main b, .shortlist-table td, table.monthly, .novice-card-grid b,
  .novice-verdict b, .rank-badge, .franchise-grid b, .tax-basis-grid b,
  .tax-entity-note span, .owner-econ b, .delivery-safe b, .mf-stat b,
  .poi-estimate b, .district-option em, .task-level, .phase-progress {
    font-variant-numeric: tabular-nums;
  }
}

/* =========================================================
   Mobile App shell · <768px
   ========================================================= */
@media screen and (max-width: 767px) {
  :root { --topbar-h: 56px; --tabs-h: 0px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.params-sheet-open { overflow: hidden; }

  /* Single-row header */
  .topbar { background: rgba(255, 255, 255, .94); }
  .topbar-inner {
    display: flex; flex-wrap: nowrap; align-items: center;
    gap: 8px; padding: 8px 12px; min-height: 56px;
  }
  .brand { flex: 0 0 auto; gap: 6px; min-width: 0; }
  .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
  .brand-text { min-width: 0; }
  .brand-title { font-size: 13px; gap: 3px; }
  .brand-title .ver { font-size: 12px; padding: 0 3px; line-height: 16px; }
  .brand-sub { display: none; }

  .m-context-pill {
    display: inline-flex; align-items: center; gap: 5px;
    flex: 1 1 auto; min-width: 0; max-width: none;
    height: 40px; margin-left: 2px; padding: 0 9px;
    border-radius: 10px; border: 1px solid #e2e8f0; background: #f8fafc;
    color: #0f172a; font-size: 12px; font-weight: 500;
  }
  .m-context-pill:hover { background: #f1f5f9; }
  .m-context-pill b {
    flex: 1 1 auto; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
  }
  .m-context-pill .icon { width: 14px; height: 14px; color: #64748b; flex: none; }
  .m-context-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .12); flex: none;
  }

  .top-controls { display: flex; flex: 0 0 auto; flex-wrap: nowrap; width: auto; margin-left: 0; gap: 0; }
  .city-combo, .industry-picker, .top-status { display: none !important; }
  .top-actions { display: flex; gap: 6px; }
  .top-actions .btn.top-btn {
    width: 32px; height: 40px; min-height: 40px; padding: 0;
    border-radius: 9px; justify-content: center;
  }
  .top-actions .btn.top-btn span { display: none; }
  .top-actions .btn.top-btn .icon { width: 17px; height: 17px; }
  .top-actions #btn-share, .top-actions #btn-reset-plan { display: none; }

  /* Step tabs become bottom App tabs */
  .tabs { display: none !important; }
  .main { max-width: none; padding: 12px; }

  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .page-head h2 { font-size: 21px; margin-top: 5px; }
  .page-head p { font-size: 13px; line-height: 1.55; }
  .eyebrow { font-size: 12px; padding: 2px 6px; }
  .head-chips { display: none; }
  .page-head-side { width: 100%; justify-content: space-between; gap: 8px; }
  .applied-chip {
    flex: 1 1 auto; min-width: 0; white-space: normal;
    font-size: 12px; line-height: 1.4; padding: 7px 10px;
  }
  .applied-chip small { display: none; }
  .m-params-btn {
    display: inline-flex; flex: none; min-height: 40px;
    padding: 0 13px; font-size: 13px; border-radius: 9px;
  }

  .card { border-radius: 12px; }
  .card-head h3 { font-size: 15px; }

  /* Map / inspector stack */
  .gis-grid { grid-template-columns: 1fr; gap: 12px; }
  .map-card, .inspector-card {
    position: relative; top: 0; height: auto; min-height: 0; max-height: none;
  }
  .map-card { height: calc(100vh - 210px); min-height: 540px; }
  .inspector-body { max-height: none; overflow: visible; padding: 0 14px; }
  .inspector-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px; }
  .inspector-tab { padding: 8px 7px; }
  .inspector-tab small { display: block; font-size: 12px; }
  .inspector-foot { padding: 11px 14px 14px; }
  .map-topline { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .map-title { flex: 1 1 100%; }
  .map-title b, .map-title small { white-space: normal; }
  .map-top-actions { width: 100%; justify-content: space-between; }
  .tile-switch { max-width: 150px; }
  .tile-switch select { max-width: 112px; font-size: 12px; }
  .map-searchbar { padding: 8px 10px 7px; }
  .place-search-field { flex: 1 1 100%; }
  .place-search-status { font-size: 12px; }
  .map-tools {
    width: 100%; max-width: 100%; align-self: stretch;
    margin: 6px 8px 8px; padding: 5px 6px;
    border-radius: 10px; flex-direction: row; align-items: center;
    overflow-x: auto; overflow-y: hidden; z-index: 520;
  }
  .map-tool { flex: 0 0 auto; height: 40px; min-height: 40px; font-size: 12px; padding: 0 9px; }
  .map-tool .icon { width: 16px; height: 16px; }
  .map-tool span { font-size: 12px; white-space: nowrap; }
  .map-tools .tool-group-label { display: none; }
  .map-tools .tool-sep { flex: none; width: 1px; height: 20px; margin: 0 3px; }
  .map-legend { display: none; }
  .map-funnel-bar { grid-template-columns: 1fr 1fr; }
  .mf-stat { padding: 9px 12px; }
  .mf-stat b { font-size: 18px; }
  .mf-guard { grid-column: 1 / -1; margin: 0 10px 8px; justify-self: start; }
  .funnel-chain { grid-template-columns: 1fr; }

  /* Cockpit */
  .cockpit-grid { grid-template-columns: 1fr; gap: 12px; }
  .cockpit-main { gap: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 14px 14px 12px; }
  .kpi-label { font-size: 12px; }
  .kpi-card .data-badge { font-size: 12px; }
  .kpi-value { font-size: 24px; margin-top: 6px; }
  .kpi-value small { font-size: 12px; }
  .kpi-sub { font-size: 12px; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; }
  .micro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .micro-item { padding: 8px 9px; }
  .chart-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .chart-wrap { height: 280px; }
  .capacity-card, .chart-card, .cost-card, .mc-card { padding: 16px; }
  .rent-solver-card > .card-head { padding: 16px 16px 0; }
  .rent-solver-result { padding: 14px 16px 16px; }
  .rent-solver-controls { padding: 12px 16px; }
  .rent-solver-main { grid-template-columns: 1fr 1fr; gap: 7px; }
  .rent-solver-main b { font-size: 16px; }
  .capacity-head { flex-direction: column; gap: 10px; }
  .capacity-stats { width: 100%; justify-content: space-between; gap: 10px; }
  .capacity-stat { text-align: left; }
  .cost-legend { grid-template-columns: 1fr 1fr; }
  .unit-table { grid-template-columns: 1fr; }
  .mc-grid { grid-template-columns: 1fr; }
  .plan-bar { flex-direction: column; align-items: flex-start; padding: 14px; }
  .plan-actions { width: 100%; }
  .plan-actions .btn { flex: 1; }
  .chart-legend { flex-wrap: wrap; gap: 8px 12px; }
  .legend-item { font-size: 12px; }
  .tax-entity-box { flex-direction: column; }
  .adv-grid { grid-template-columns: 1fr 1fr; }
  .monthly-card summary { padding: 14px 16px; }
  .report-card { flex-direction: column; align-items: flex-start; padding: 18px; }
  .report-card .btn.light { width: 100%; }

  /* Bottom sheet: parameters */
  .ctl-card {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 1700; width: 100%; max-height: 86vh;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
    border: 0; border-radius: 16px 16px 0 0;
    box-shadow: 0 -20px 60px -18px rgba(15, 23, 42, .4);
    transform: translateY(105%); visibility: hidden;
    transition: transform .26s ease, visibility .26s;
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.params-sheet-open .ctl-card { transform: none; visibility: visible; }
  .ctl-close { display: grid; position: absolute; top: 0; right: 0; width: 40px; height: 40px; min-height: 40px; }
  .ctl-card .card-head { position: relative; display: block; padding-right: 48px; }
  .ctl-head-actions { margin-top: 10px; justify-content: flex-start; flex-wrap: wrap; }
  .ctl-head-actions .btn.small { min-height: 36px; }
  .m-sheet-backdrop {
    position: fixed; inset: 0; z-index: 1650;
    background: rgba(15, 23, 42, .42);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    display: block;
  }
  .m-sheet-backdrop[hidden] { display: none !important; }

  /* Bottom App tab bar */
  .m-bottom-nav {
    display: grid; position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1500; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  }
  .m-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 48px; padding: 3px 0; border: 0; border-radius: 9px;
    background: none; color: #64748b; font-size: 12px; font-weight: 500;
  }
  .m-tab .icon { width: 20px; height: 20px; }
  .m-tab.active { color: #2563eb; background: #eff6ff; }
  .m-tab:active { background: #f1f5f9; }

  /* City / industry context sheet */
  .m-sheet-overlay {
    position: fixed; inset: 0; z-index: 1900;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0; background: rgba(15, 23, 42, .42);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  }
  .m-sheet-overlay[hidden] { display: none !important; }
  .m-sheet {
    width: 100%; max-height: 86vh; overflow-y: auto;
    background: #fff; border-radius: 16px 16px 0 0;
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px -18px rgba(15, 23, 42, .4);
  }
  .m-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
  .m-sheet-head h3 { font-size: 17px; font-weight: 650; }
  .m-sheet-head p { margin-top: 3px; font-size: 12px; color: #64748b; }
  .m-sheet-head .icon-btn { width: 40px; height: 40px; min-height: 40px; }
  .m-sheet-body { display: flex; flex-direction: column; gap: 14px; }
  .m-sheet-body .field-label { font-size: 13px; }
  .m-sheet-body .field-input { height: 44px; }
  .m-sheet-actions { margin-top: 18px; }
  .m-sheet-actions .btn { width: 100%; min-height: 44px; font-size: 14px; }

  /* Novice wizard */
  .novice-overlay { padding: 10px; align-items: flex-start; }
  .novice-panel { padding: 16px 14px; border-radius: 14px; max-height: 94vh; }
  .novice-head h3 { font-size: 20px; }
  .novice-head p { font-size: 12px; }
  .novice-grid { grid-template-columns: 1fr 1fr; gap: 10px 10px; }
  .novice-grid .field-input { height: 42px; }
  .novice-actions { flex-direction: column; align-items: stretch; }
  .novice-actions .btn { width: 100%; min-height: 44px; }
  .novice-card-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .novice-card-grid > div { padding: 12px; }
  .novice-card-grid b { font-size: 17px; }
  .novice-card-grid b.novice-risk-text { font-size: 13px; }
  .novice-verdict b { font-size: 18px; }

  /* Matrix & tables */
  .shortlist-table th, .shortlist-table td { padding: 12px 14px; }
  .shortlist-table th:first-child, .shortlist-table td:first-child { min-width: 104px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .risk-grid, .compliance-snapshot { grid-template-columns: 1fr; }
  .risk-dimensions { grid-template-columns: 1fr; }
  .risk-mc-card { align-items: flex-start; }
  .verdict-banner { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .verdict-score { margin-left: 0; text-align: left; }
  .closure-grid { grid-template-columns: 1fr 1fr; }
  .footer { margin-top: 20px; }
  .footer-inner { padding: 18px 14px; }
  .footer-actions { align-items: flex-start; }

  .toast { top: 64px; right: 12px; left: auto; max-width: calc(100vw - 24px); }

  select { max-width: 100%; }
  .field-input select { text-overflow: ellipsis; }
}

@keyframes saasPageIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   PWA install entry & iPhone safe-area
   ========================================================= */
@media screen {
  .app-install-top {
    color: #1d4ed8; border-color: #dbeafe; background: #eff6ff;
  }
  .app-install-top:hover { background: #dbeafe; border-color: #bfdbfe; }

  .dialog-install {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 22px; border-top: 1px solid #e2e8f0; background: #f8fafc;
  }
  .dialog-install-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .dialog-install-copy b { font-size: 13px; color: #0f172a; }
  .dialog-install-copy span { font-size: 12px; color: #64748b; line-height: 1.45; }
  .dialog-install .btn { flex: none; }
  #data-dialog .dialog-body { max-height: calc(88vh - 150px); }
}

@media screen and (max-width: 1180px) {
  .app-install-top { display: none !important; }
}

@media screen and (max-width: 767px) {
  .app-install-top { display: none !important; }
  .topbar { padding-top: env(safe-area-inset-top, 0px); }
  .topbar-inner {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .main {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .m-bottom-nav {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .toast { top: calc(64px + env(safe-area-inset-top, 0px)); }
  .m-sheet,
  .ctl-card { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .dialog-install {
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .dialog-install .btn { width: 100%; min-height: 40px; }
}

/* =========================================================
   Map LOD labels & non-blocking tile fallback
   ========================================================= */
@media screen {
  .map-tile-fallback {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 1300; display: flex; align-items: center; gap: 12px;
    width: max-content; max-width: min(590px, calc(100% - 24px));
    padding: 10px 12px 10px 14px; border: 1px solid #fde68a; border-radius: 10px;
    background: rgba(255, 251, 235, .97); box-shadow: 0 10px 26px rgba(15, 23, 42, .14);
    color: #78350f;
  }
  .map-tile-fallback[hidden] { display: none !important; }
  .map-tile-fallback-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .map-tile-fallback-copy b { font-size: 12.5px; color: #92400e; }
  .map-tile-fallback-copy span { font-size: 12px; color: #92400e; line-height: 1.45; }
  .map-tile-fallback-actions { display: flex; align-items: center; gap: 6px; flex: none; }
  .map-tile-fallback-actions .btn { min-height: 32px; height: 32px; padding: 0 10px; border-color: #fcd34d; background: #fff; color: #92400e; }
  .map-tile-fallback-close {
    width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
    color: #92400e; font-size: 18px; line-height: 1; cursor: pointer;
  }
  .map-tile-fallback-close:hover { background: #fef3c7; }

  .map-lod-marker { background: none; border: 0; pointer-events: none; }
  .map-lod-chip {
    display: inline-block; transform: translate(-50%, -50%);
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
    background: rgba(255, 255, 255, .94); border: 1px solid rgba(148, 163, 184, .42);
    box-shadow: 0 2px 7px rgba(15, 23, 42, .12);
    color: #334155; font-size: 12px; font-weight: 600; line-height: 1.35;
    letter-spacing: .01em;
  }
  .map-lod-marker.city .map-lod-chip {
    transform: translate(-50%, -145%);
    color: #1d4ed8; border-color: #bfdbfe; background: rgba(239, 246, 255, .96);
  }
  .map-lod-marker.street .map-lod-chip {
    color: #334155; border-color: rgba(148, 163, 184, .38); background: rgba(255, 255, 255, .91);
  }
  .map-lod-marker.poi .map-lod-chip {
    padding: 2px 7px; color: #9a3412; border-color: #fed7aa;
    background: rgba(255, 247, 237, .95); font-size: 11.5px; font-weight: 600;
  }
  .map-zoom-far .dual-label.leaflet-tooltip { display: none; }
}

@media screen and (max-width: 767px) {
  .map-tile-fallback {
    top: 8px; width: auto; max-width: calc(100% - 16px);
    flex-direction: column; align-items: stretch; gap: 7px; padding: 9px 10px;
  }
  .map-tile-fallback-actions { justify-content: flex-end; }
  .map-tile-fallback-actions .btn { min-height: 34px; height: 34px; }
  .map-lod-chip { font-size: 11px; padding: 2px 6px; }
  .map-lod-marker.poi .map-lod-chip { font-size: 10.5px; }
}

@media screen and (max-width: 767px) {
  #funnel-district, #funnel-access, #funnel-exposure { min-height: 40px; }
  .poi-actions .btn,
  .poi-actions .link-btn,
  .funnel-note .link-btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
}
