/* Solar Rota mobile and touch ergonomics */

/* ─────────────────────────────────────────────────────────
   BREAKPOINT CONTRACT (Etap 1 — 2026-04-26)
   xs:  <= 360px   küçük telefon (iPhone SE, alt segment Android)
   sm:  <= 480px   telefon dikey (full-screen drawer/modal, sticky CTA)
   md:  <= 768px   telefon yatay / tablet dikey (2 sütun → 1, kart layout)
   lg:  <= 1024px  tablet yatay / küçük dizüstü (yan panel daralır)
       >= 1025px   masaüstü (mevcut tasarım korunur)

   Eski 720 / 900 blokları geçici olarak korunur, yeni kurallar bu
   sözleşmeye göre eklenir. (legacy 720 / legacy 900 etiketleri ile
   işaretli eski bloklar Etap 6'da konsolide edilir.)
   ───────────────────────────────────────────────────────── */

html {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button,
.btn,
input,
select,
textarea {
  touch-action: manipulation;
}

/* ── GLOBAL TOUCH TARGETS (Etap 2) ─────────────────────────
   Dokunmatik cihazlarda tüm aksiyon hedefleri 44 px asgari.
   `pointer: coarse` koşulu fareli laptop ve trackpad'i bozmaz.       */
@media (pointer: coarse) {
  button,
  .btn,
  [role="button"],
  a.cta,
  .step-dot,
  .lang-btn,
  .currency-btn,
  .settings-choice-btn,
  .header-icon-btn,
  .header-lang-btn,
  .leaflet-bar a,
  .leaflet-touch .leaflet-bar a,
  .roof-tool-btn,
  .modal-close,
  .settings-panel-close {
    min-height: 44px;
    min-width: 44px;
  }

  /* Form alanları zoom önlemi için 16 px font, dar alanlarda taşmasın */
  input,
  select,
  textarea {
    font-size: 16px;
    min-width: 0;
  }
}

/* ── MOBILE BOTTOM CTA BAR (Etap 2) ────────────────────────
   <=768 ekranda sticky alt aksiyon barı; adıma duyarlı içerik
   body[data-step="N"] ile değişir. Masaüstünde tamamen gizli.        */
.mobile-bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  body.has-bottom-bar #main-content {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
  }

  .mobile-bottom-bar__group {
    display: none;
    flex: 1;
    align-items: center;
    gap: 8px;
  }

  .mobile-bottom-bar__group .btn {
    flex: 1;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 0.92rem;
    justify-content: center;
  }

  .mobile-bottom-bar__group .btn-primary {
    flex: 2;
  }

  body[data-step="1"] .mobile-bottom-bar__group[data-step="1"],
  body[data-step="2"] .mobile-bottom-bar__group[data-step="2"],
  body[data-step="3"] .mobile-bottom-bar__group[data-step="3"],
  body[data-step="4"] .mobile-bottom-bar__group[data-step="4"],
  body[data-step="5"] .mobile-bottom-bar__group[data-step="5"],
  body[data-step="7"] .mobile-bottom-bar__group[data-step="7"] {
    display: flex;
  }

  /* Step 6 (yükleniyor) ve modallar açıkken bar gizli */
  body[data-step="6"] .mobile-bottom-bar,
  body.modal-open .mobile-bottom-bar {
    display: none;
  }

  /* Etap 6 regresyon: mevcut adım içi .nav-btns / .hero-cta-wrap mobilde
     görünür kalır — bottom bar ek aksiyondur, mevcut Playwright testleri
     ve scroll-up etkileşimi bozulmasın. */
}

/* ── SETTINGS PANEL & OVERLAY ─────────────────────────────
   Inline style'dan class'a taşındı (Etap 1).
   JS hala display ve transform'u inline manipüle eder; bu kurallar
   yalnız statik görünümü ve responsive davranışı tanımlar.            */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 28px 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-md);
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.settings-panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.settings-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  transition: color 0.2s;
}

.settings-panel-close:hover,
.settings-panel-close:focus-visible {
  color: var(--text);
}

.settings-panel-section {
  margin-bottom: 28px;
}

.settings-panel-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.settings-panel-row {
  display: flex;
  gap: 8px;
}

.settings-panel-row--rate {
  align-items: center;
  gap: 8px;
}

.settings-panel-rate-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  min-width: 0;
}

.settings-panel-rate-refresh {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  flex-shrink: 0;
}

.settings-panel-rate-refresh:hover,
.settings-panel-rate-refresh:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-panel-rate-status {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.settings-panel-dashboard-btn {
  width: 100%;
  justify-content: center;
  height: 44px;
}

/* Settings drawer responsive — md (telefon yatay / tablet dikey) */
@media (max-width: 768px) {
  .settings-panel {
    width: 360px;
    max-width: 80vw;
    padding: 24px 20px;
  }

  /* Drawer içindeki seçim butonları dokunma için 44 px */
  .settings-panel .lang-btn,
  .settings-panel .currency-btn,
  .settings-panel .settings-choice-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .settings-panel-rate-refresh {
    width: 44px;
    height: 44px;
  }
}

/* Settings drawer responsive — sm (telefon dikey) full-screen */
@media (max-width: 480px) {
  .settings-panel {
    width: 100%;
    max-width: 100vw;
    border-left: 0;
    padding: 20px 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .settings-panel-section {
    margin-bottom: 22px;
  }

  .settings-panel-header {
    margin-bottom: 24px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 118px;
  }

  #app-header {
    padding: 0;
  }

  .header-top {
    gap: 10px;
    margin-bottom: 0;
  }

  .logo {
    min-width: 0;
  }

  .logo-icon {
    width: auto;
    height: 56px;
    max-width: 180px;
    flex: 0 0 auto;
  }

  .logo-text {
    font-size: 1.45rem;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .logo-tagline {
    font-size: .62rem;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-assurance {
    display: none;
  }

  .header-utility-bar {
    gap: 6px !important;
  }

  .currency-switcher,
  .lang-switcher {
    gap: 4px;
  }

  .currency-btn,
  .lang-btn {
    min-height: 34px;
    padding: 7px 9px;
  }

  #exchange-rate-status-header {
    display: none;
  }

  #dashboard-btn {
    min-height: 36px;
    padding: 7px 10px !important;
  }

  #main-content {
    padding: 16px 14px 88px;
  }

  .step-dots-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 2px;
    scrollbar-width: none;
  }

  .step-dots-wrap::-webkit-scrollbar {
    display: none;
  }

  .step-dots {
    min-width: max-content;
    justify-content: flex-start;
    padding-right: 8px;
  }

  .step-dot {
    min-width: 34px;
  }

  .step-dot-num {
    min-width: 30px;
    min-height: 30px;
  }

  .step-heading {
    margin-bottom: 18px;
  }

  .step-heading-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
    line-height: 1.15;
  }

  .step-heading-sub {
    font-size: .9rem;
    max-width: none;
  }

  .card,
  .equipment-summary-card,
  .fin-box,
  .chart-wrap,
  .eng-report-wrap,
  .bess-result-wrap,
  .nm-result-wrap {
    max-width: 100%;
  }

  .two-col,
  .equipment-layout,
  .bess-metrics,
  .result-metrics-grid,
  .offgrid-stat-grid,
  .offgrid-chip-grid,
  .bess-detail-grid,
  .offgrid-note-strip {
    grid-template-columns: 1fr !important;
  }

  .btn {
    min-height: 44px;
    justify-content: center;
    white-space: normal;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px !important;
  }

  input[type="range"] {
    min-height: 36px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }

  .nav-btns,
  .step-nav-row,
  .step3-nav-sticky,
  .action-btns {
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-btns .btn,
  .step-nav-row .btn,
  .step3-nav-sticky .btn,
  .action-btns .btn {
    flex: 1 1 180px;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 118px;
  }

  #app-header {
    padding: 0;
  }

  .header-brand {
    box-sizing: border-box;
    max-width: 100%;
    padding: 8px 10px !important;
    overflow: hidden;
  }

  .header-steps-row {
    box-sizing: border-box;
    max-width: 100%;
    padding: 6px 10px !important;
    overflow: hidden;
  }

  .header-inner {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 96px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }

  .header-brand .header-inner {
    min-height: auto;
    padding: 0;
  }

  .header-steps-row .header-inner {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
  }

  .logo-icon {
    height: 52px !important;
    max-width: 168px !important;
  }

  .logo-text {
    max-width: 156px;
    font-size: 1.22rem !important;
  }

  .logo-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    flex: 0 0 auto;
    min-width: 0;
    gap: 6px;
    margin-left: 0;
  }

  .header-lang-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
  }

  .header-icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .header-steps-center {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .header-steps-center::-webkit-scrollbar {
    display: none;
  }

  .header-steps-center .step-dots {
    min-width: max-content;
    justify-content: flex-start;
    padding-right: 8px;
  }

  .header-top {
    align-items: center;
  }

  .header-utility-bar {
    width: 100%;
    margin-left: 0 !important;
    order: 2;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .currency-switcher,
  .lang-switcher {
    flex: 0 0 auto;
  }

  #dashboard-btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .step-dots-wrap {
    order: 3;
    width: calc(100vw - 20px);
    margin-top: 2px;
  }

  #main-content {
    padding: 14px 12px 92px;
  }

  .card {
    padding: 16px;
  }

  .tooltip-box {
    left: auto;
    right: 0;
    transform: none;
    width: min(280px, calc(100vw - 32px));
  }

  .step-hero {
    min-height: auto;
    margin: -14px -12px 0;
    padding-bottom: 22px;
  }

  .hero-content {
    padding: 24px 14px 22px;
  }

  .hero-eyebrow {
    font-size: .66rem;
    margin-bottom: 10px;
  }

  .hero-title {
    font-size: clamp(1.65rem, 9vw, 2.25rem);
    line-height: 1.06;
    margin-bottom: 10px;
  }

  .hero-sub {
    font-size: .92rem;
    margin-bottom: 0;
  }

  .hero-panels-bg,
  .hero-orb {
    display: none;
  }

  .scenario-grid-wrap {
    width: 100%;
    padding: 0 12px;
  }

  #step-1 .scenario-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .scenario-choice-card {
    min-height: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 12px;
    row-gap: 4px;
    border-radius: 10px;
  }

  .scenario-card-icon {
    grid-row: span 2;
    width: 60px;
    height: 60px;
    justify-self: center;
    align-self: center;
    margin-bottom: 0;
  }

  .scenario-choice-card strong {
    font-size: .98rem;
    line-height: 1.2;
    margin: 0;
  }

  .scenario-card-desc {
    font-size: .8rem;
    line-height: 1.4;
    margin: 0;
  }

  .scenario-summary {
    margin-top: 10px;
    padding: 10px 12px;
    font-size: .78rem;
  }

  .hero-cta-wrap {
    width: 100%;
    padding: 0 12px;
    margin-top: 12px;
  }

  .hero-cta-btn {
    width: 100%;
    border-radius: 8px;
    padding: 14px 18px;
  }

  #step-2.active,
  #step-3.active {
    width: 100%;
    margin-left: 0;
  }

  .step2-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    height: auto;
    min-height: 0;
    padding: 8px;
    gap: 8px;
    align-items: stretch;
  }

  .step2-search-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: 46px;
  }

  .step2-geo-btn {
    grid-column: 2;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  #location-warning,
  #selected-location {
    grid-column: 1 / -1;
    min-width: 0;
  }

  #step2-map-slot {
    height: auto;
    min-height: 0;
    --step2-map-footer-h: 112px;
  }

  .step2-map-helper,
  .step2-legend-card {
    position: absolute;
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .roof-draw-hint {
    left: 10px;
    right: 10px;
    top: 62px;
    transform: none;
    min-width: 0;
    max-width: none;
    padding: 10px 12px;
    gap: 8px;
    justify-content: flex-start;
    white-space: normal;
  }

  .step2-map-helper {
    top: 10px;
    left: 10px;
    max-width: min(320px, calc(100% - 20px));
  }

  .step2-legend-card {
    top: auto;
    bottom: 96px;
  }

  .leaflet-touch .leaflet-bar a {
    width: 38px;
    height: 38px;
    line-height: 38px;
  }

  .map-layer-btn {
    top: 10px;
    right: 10px;
    min-height: 40px;
    padding: 8px 11px;
  }

  .location-bottom-card {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .loc-bottom-left,
  .loc-bottom-center,
  .loc-bottom-right {
    width: 100%;
    justify-content: stretch;
  }

  .loc-bottom-left {
    align-items: center;
  }

  .loc-bottom-ghi {
    width: 100%;
    justify-content: center;
  }

  .loc-bottom-right .btn {
    flex: 1 1 0;
  }

  .step3-split {
    grid-template-rows: minmax(280px, 46dvh) auto;
  }

  .step3-map-col {
    height: min(46dvh, 390px);
    min-height: 280px;
  }

  .roof-tool-legend {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    padding: 10px 12px;
  }

  .roof-tool-legend-toggle {
    top: 10px;
    left: auto;
    right: 10px;
  }

  .roof-map-compass {
    top: auto;
    bottom: 92px;
    right: auto;
    left: 10px;
    grid-template-columns: 40px auto;
    padding: 8px 10px;
  }

  .roof-map-compass-glyph {
    width: 40px;
    height: 40px;
  }

  .roof-map-compass-arrow {
    height: 20px;
  }

  .step3-config-col {
    padding: 16px 12px 24px;
  }

  .equipment-summary-card {
    position: static;
    padding: 16px;
  }

  .tariff-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tariff-tab {
    min-width: 0;
    padding: 12px 10px;
  }

  .calc-cta-btn {
    min-height: 52px;
    border-radius: 8px;
    padding: 15px 18px;
  }

  .step-loading-wrap {
    min-height: calc(100dvh - var(--header-h) - 20px);
    padding: 28px 14px 70px;
  }

  .loading-headline {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  .loading-steps {
    width: 100%;
  }

  .result-context-strip {
    gap: 8px;
    padding: 10px 12px;
    font-size: .78rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .kpi-card {
    padding: 16px;
    min-height: 0;
  }

  .kpi-value {
    font-size: clamp(1.75rem, 11vw, 2.45rem);
    overflow-wrap: anywhere;
  }

  .fin-box {
    padding: 16px;
  }

  .offgrid-result-card,
  .bess-result-wrap {
    padding: 16px;
  }

  .offgrid-result-head {
    flex-direction: column;
    gap: 8px;
  }

  .offgrid-stat-card {
    min-height: 0;
  }

  .audit-summary-grid,
  .audit-section-grid,
  .eng-report-intro,
  .perf-badges,
  .scenario-insight-grid,
  .structural-insight-grid,
  .scenario-explainer {
    grid-template-columns: 1fr !important;
  }

  .loss-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .fin-row {
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  .fin-label,
  .fin-val {
    min-width: 0;
  }

  .payback-bar-wrap {
    min-width: 120px;
  }

  .chart-wrap {
    padding: 14px;
    overflow: hidden;
  }

  .chart-title {
    font-size: .92rem;
  }

  #monthly-chart-canvas,
  #hourly-chart-canvas,
  #scenario-chart-canvas,
  #fx-chart-canvas {
    max-height: 260px !important;
  }

  .tech-table,
  .section-table,
  .cost-breakdown-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .tech-table th,
  .tech-table td,
  .section-table th,
  .section-table td,
  .cost-breakdown-table th,
  .cost-breakdown-table td {
    white-space: nowrap;
  }

  .ui-scroll-hint {
    display: block;
  }

  .proposal-section {
    padding: 16px;
  }

  .proposal-summary-grid,
  .proposal-projection-summary,
  .proposal-warning-grid {
    grid-template-columns: 1fr;
  }

  .proposal-table {
    min-width: 860px;
  }

  .proposal-accordion-summary {
    padding: 16px;
  }

  .proposal-accordion > :not(summary) {
    margin: 0 16px 16px;
  }

  #offgrid-device-table-wrap,
  #comparison-result-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  #offgrid-device-table {
    min-width: 640px;
  }

  #offgrid-device-table input,
  #offgrid-device-table select,
  #offgrid-device-table button {
    min-height: 44px !important;
  }

  #offgrid-device-table td,
  #offgrid-device-table th {
    padding: 5px 4px !important;
  }

  #offgrid-device-table input,
  #offgrid-device-table select {
    font-size: 0.82rem !important;
  }

  #offgrid-device-table button {
    min-width: 44px;
  }

  #evidence-file-status {
    overflow-wrap: anywhere;
    line-height: 1.55;
  }

  .on-grid-data-source-table {
    display: block;
  }

  .on-grid-ds-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .on-grid-ds-row > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #turkey-map-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #turkey-svg-map {
    min-width: 620px;
  }

  .eng-report-header {
    align-items: flex-start;
    gap: 10px;
  }

  .eng-report-title {
    min-width: 0;
    flex-wrap: wrap;
    line-height: 1.35;
  }

  .eng-report-body {
    font-size: .84rem;
  }

  .action-btns {
    flex-direction: column;
  }

  .action-btns .btn {
    width: 100%;
    flex: 1 1 auto;
  }

  #comparison-modal,
  #dashboard-modal {
    align-items: flex-start !important;
    padding: 10px !important;
  }
}

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

@media (max-width: 480px) {
  :root {
    --header-h: 132px;
  }

  .logo-tagline {
    display: none;
  }

  .logo-text {
    font-size: 1.08rem;
  }

  .currency-btn,
  .lang-btn {
    padding: 7px 8px;
    font-size: .72rem;
  }

  .step-dot-num {
    min-width: 28px !important;
    min-height: 28px !important;
  }

  .step-connector {
    width: 10px !important;
  }

  .hero-content {
    padding-top: 18px;
  }

  .scenario-choice-card {
    padding: 12px;
  }

  .scenario-card-icon {
    width: 56px;
    height: 56px;
    justify-self: center;
    align-self: center;
  }

  .step2-geo-label {
    display: inline;
  }

  #step2-map-slot {
    height: auto;
    min-height: 0;
    --step2-map-footer-h: 120px;
  }

  .location-bottom-card {
    left: 8px;
    right: 8px;
  }

  .step2-map-helper {
    padding: 10px 12px;
  }

  .step2-map-helper strong {
    font-size: .82rem;
  }

  .step2-map-helper span,
  .step2-overlay-legend .ghi-leg-item {
    font-size: .7rem;
  }

  .step2-legend-card {
    bottom: 88px;
    padding: 9px 10px;
  }

  .roof-tool-legend {
    top: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    padding: 9px 10px;
  }

  .roof-tool-legend-toggle {
    top: 8px;
    left: auto;
    right: 8px;
  }

  .roof-map-compass {
    top: auto;
    bottom: 96px;
    right: auto;
    left: 8px;
    max-width: calc(100% - 16px);
  }

  .loc-bottom-right {
    flex-direction: column;
  }

  .tariff-tabs {
    grid-template-columns: 1fr;
  }

  .bess-result-wrap,
  .nm-result-wrap {
    padding: 14px;
  }

  .nm-result-wrap > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .modal-content,
  #comparison-modal > div,
  #dashboard-modal > div {
    max-height: 94dvh !important;
    border-radius: 10px !important;
  }
}

/* ─────────────────────────────────────────────────────────
   ETAP 3 — Step 2 + Step 4 + Off-grid tablo + Türkiye SVG
   ───────────────────────────────────────────────────────── */

/* Türkiye SVG: 620 px dayatması kaldırılır, viewBox-based responsive */
@media (max-width: 768px) {
  #turkey-map-wrap {
    overflow-x: visible;
  }

  #turkey-svg-map {
    min-width: 0 !important;
    width: 100%;
    height: auto;
    max-width: 620px;
    margin: 0 auto;
    display: block;
  }
}

@media (max-width: 480px) {
  /* Bölge etiketleri küçük ekranda daha kompakt */
  #turkey-svg-map text {
    font-size: 0.6rem;
  }
}

/* Off-grid cihaz tablosu — <= 480 kart layout
   thead gizlenir, her tr bir karta dönüşür, td'ler data-label ile etiketlenir */
@media (max-width: 480px) {
  #offgrid-device-table-wrap {
    overflow-x: visible !important;
  }

  #offgrid-device-table {
    min-width: 0 !important;
    display: block;
    width: 100%;
  }

  #offgrid-device-table thead {
    display: none;
  }

  #offgrid-device-table tbody,
  #offgrid-device-table tfoot {
    display: block;
    width: 100%;
  }

  #offgrid-device-table tr.offgrid-device-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border) !important;
    border-radius: 10px;
    background: var(--surface-light, rgba(255,255,255,0.02));
  }

  #offgrid-device-table .ogd-cell {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    padding: 0 !important;
    text-align: left !important;
    min-width: 0;
  }

  #offgrid-device-table .ogd-cell::before {
    content: attr(data-label);
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  #offgrid-device-table .ogd-cell--name {
    grid-column: 1 / -1;
  }

  #offgrid-device-table .ogd-cell--name input {
    width: 100% !important;
  }

  #offgrid-device-table .ogd-cell--remove {
    grid-column: 1 / -1;
    align-items: stretch;
  }

  #offgrid-device-table .ogd-cell--remove::before {
    display: none;
  }

  #offgrid-device-table .ogd-cell--remove button {
    width: 100%;
    min-height: 44px;
    font-size: 0.85rem !important;
    padding: 10px !important;
  }

  #offgrid-device-table .ogd-cell input,
  #offgrid-device-table .ogd-cell select {
    width: 100% !important;
    min-height: 44px;
    font-size: 16px !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
  }

  #offgrid-device-table .ogd-cell--total {
    align-self: end;
    font-size: 0.95rem !important;
  }

  #offgrid-device-table tfoot tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 10px 12px;
  }

  #offgrid-device-table tfoot td {
    padding: 0 !important;
    text-align: left !important;
  }

  /* Yatay scroll ipucu off-grid tablosu için artık gerekli değil */
  #offgrid-device-table-wrap + .ui-scroll-hint,
  .ui-scroll-hint:has(+ #offgrid-device-table-wrap) {
    display: none;
  }
}

/* Step 2 helper + legend kart yığma — <= 480 ekranda absolute yerine relative */
@media (max-width: 480px) {
  .step2-map-helper,
  .step2-legend-card {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 8px 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* Legend bottom konumlanıyordu; şimdi aşağıya akış */
  .step2-legend-card {
    margin-top: 4px !important;
  }
}

/* ─────────────────────────────────────────────────────────
   ETAP 4 — Step 3 Fullscreen Draw + Leaflet Touch
   ───────────────────────────────────────────────────────── */

/* Vertex ikonu — dokunmatik cihazlarda 28 px hit alanı, görsel 10 px ortalı */
.roof-vertex-icon--touch {
  background: transparent;
  border: 0;
  position: relative;
}

.roof-vertex-icon--touch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #F59E0B;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* Leaflet edit handles — dokunmatik için büyütülmüş hit alanı */
@media (pointer: coarse) {
  .leaflet-editing-icon,
  .leaflet-edit-marker-selected,
  .leaflet-marker-icon.leaflet-div-icon {
    width: 28px !important;
    height: 28px !important;
    margin-left: -14px !important;
    margin-top: -14px !important;
    background-clip: content-box;
    padding: 8px;
    box-sizing: border-box;
  }
}

/* Fullscreen toggle butonu — sadece <=768 ekranda görünür */
.step3-fullscreen-toggle {
  display: none;
}

.step3-fullscreen-toggle .step3-fs-icon-close {
  display: none;
}

@media (max-width: 768px) {
  .step3-fullscreen-toggle {
    display: flex;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 35;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: background 0.15s, border-color 0.15s;
  }

  .step3-fullscreen-toggle:hover,
  .step3-fullscreen-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
  }

  body.step3-fullscreen .step3-fullscreen-toggle .step3-fs-icon-open {
    display: none;
  }

  body.step3-fullscreen .step3-fullscreen-toggle .step3-fs-icon-close {
    display: block;
  }

  /* Fullscreen mode aktifken */
  body.step3-fullscreen #app-header {
    transform: translateY(-100%);
    pointer-events: none;
  }

  body.step3-fullscreen .step3-config-col,
  body.step3-fullscreen .roof-tool-legend,
  body.step3-fullscreen .roof-tool-legend-toggle {
    display: none !important;
  }

  body.step3-fullscreen #step-3,
  body.step3-fullscreen .step3-split,
  body.step3-fullscreen .step3-map-col {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    z-index: 30;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  body.step3-fullscreen #step3-map-slot {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
  }

  body.step3-fullscreen .step3-fullscreen-toggle {
    z-index: 50;
    background: rgba(28, 28, 30, 0.92);
    backdrop-filter: blur(8px);
  }

  /* Fullscreen aktifken bottom bar gizli — harita üstünde tek aksiyon hâkim */
  body.step3-fullscreen .mobile-bottom-bar {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────
   ETAP 5 — Hero / Modallar / Landing
   ───────────────────────────────────────────────────────── */

/* Hero orblar ve floating panellar — küçük ekranda azalt/gizle */
@media (max-width: 768px) {
  .hero-orb {
    transform: scale(0.5);
    opacity: 0.4;
  }

  .hero-fp {
    opacity: 0.5;
  }
}

@media (max-width: 480px) {
  .hero-orb,
  .hero-panels-bg {
    display: none;
  }

  /* Hero başlık asla container'ı taşırmasın */
  .hero-eyebrow,
  .hero-content h1,
  .hero-content .scenario-select-subline {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* Modal scroll lock — body.modal-open eklendiğinde arka plan kaymaz */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Comparison ve Dashboard modal — <= 480 full-screen */
@media (max-width: 480px) {
  #comparison-modal,
  #dashboard-modal {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  #comparison-modal > div,
  #dashboard-modal > div {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  /* Modal başlık sticky — kaydırırken kapatma butonu hep ulaşılabilir */
  #comparison-modal > div > div:first-child,
  #dashboard-modal > div > div:first-child {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
  }

  /* Comparison senaryo kartları yatay swipe (scroll-snap) */
  #comparison-scenarios {
    grid-template-columns: 100% !important;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px !important;
    padding-bottom: 8px;
  }

  #comparison-scenarios::-webkit-scrollbar {
    display: none;
  }

  #comparison-scenarios > * {
    scroll-snap-align: start;
    min-width: 0;
  }
}

/* Landing page — küçük ekranda tour carousel ve FAQ ergonomi */
@media (max-width: 768px) {
  .lp-tour-tabs,
  .lp-tour-panes {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .lp-tour-tabs::-webkit-scrollbar,
  .lp-tour-panes::-webkit-scrollbar {
    display: none;
  }

  .lp-tour-pane,
  .lp-tour-tab {
    scroll-snap-align: start;
  }

  /* FAQ accordion — başlık 48 px asgari */
  .lp-faq-q,
  details.lp-faq-row > summary,
  summary.lp-faq-q {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  /* Landing CTA butonları full-width */
  .lp-cta-btn,
  .lp-tour-cta,
  .lp-tour-summary-go {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
}

/* ─────────────────────────────────────────────────────────
   FAZ C — UX Polish (map hint, empty states, edge cases)
   ───────────────────────────────────────────────────────── */

/* Map draw hint mobilde 2 satıra geçebilsin, harita merkezini kapatmasın */
@media (max-width: 480px) {
  #map-draw-hint {
    white-space: normal !important;
    max-width: calc(100vw - 24px);
    width: max-content;
    top: 12px !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    transform: none !important;
    margin: 0 auto;
    text-align: center;
    font-size: 0.78rem;
    padding: 8px 12px;
    line-height: 1.4;
  }
}

/* Empty state — Off-grid cihaz listesi boşken yönlendirici kart */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 18px;
  margin: 12px 0;
  background: var(--surface-glass);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.10);
  color: #8B5CF6;
}

.empty-state__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  font-style: normal;
  line-height: 1.4;
}

.empty-state__hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: normal;
  line-height: 1.5;
  max-width: 360px;
}

.empty-state__cta {
  margin-top: 4px;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: rgba(245, 158, 11, 0.08);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.empty-state__cta:hover,
.empty-state__cta:focus-visible {
  background: var(--primary);
  color: #000;
  transform: translateY(-1px);
}

/* offgrid-stat-card <=480 fail-safe — 114 px sabit yükseklik DE/EN dilde
   uzun etiketleri kırpıyordu; küçük ekranda yükseklik içeriğe uyar.   */
@media (max-width: 480px) {
  .offgrid-stat-card {
    min-height: auto !important;
    padding: 14px;
  }

  .offgrid-stat-value {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .offgrid-stat-label,
  .offgrid-stat-note {
    overflow-wrap: anywhere;
  }
}

/* Faz D: panel-preview <=480 4'lü stat 2x2 grid */
@media (max-width: 480px) {
  .panel-preview {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px !important;
    padding: 12px !important;
  }

  .panel-preview-stat {
    min-width: 0;
  }

  .panel-preview-val {
    font-size: 1.25rem !important;
    overflow-wrap: anywhere;
  }

  .panel-preview-label {
    font-size: 0.68rem !important;
    overflow-wrap: anywhere;
  }
}
