* { box-sizing: border-box; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #f5f5f4;
  color: #1c1917;
}
header {
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e7e5e4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
header h1 { margin: 0; font-size: 22px; }
.muted { color: #78716c; font-weight: 400; font-size: 0.9em; }
.topnav { display: flex; gap: 12px; }
.topnav a {
  color: #0c4a6e;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding: 4px 0;
}
.topnav a.active { border-bottom: 2px solid #0c4a6e; }
.stats { display: flex; gap: 16px; align-items: center; }
.stats span b { color: #0c4a6e; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
button {
  background: #0c4a6e;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
button:disabled { background: #a8a29e; cursor: not-allowed; }
.filters {
  background: #fff;
  padding: 12px 24px;
  border-bottom: 1px solid #e7e5e4;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filters label { display: flex; gap: 6px; align-items: center; }
.filters input, .filters select {
  padding: 5px 8px;
  border: 1px solid #d6d3d1;
  border-radius: 4px;
  font-size: 13px;
}
.error {
  background: #fef2f2;
  color: #991b1b;
  padding: 8px 24px;
  border-bottom: 1px solid #fecaca;
}
.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  padding: 16px 24px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
h2 { font-size: 16px; margin: 0 0 12px; }
.card {
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.score {
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.score-high { background: #14532d; color: #f0fdf4; }
.score-mid  { background: #15803d; color: #fff; }
.score-low  { background: #ca8a04; color: #fff; }
.score-min  { background: #57534e; color: #fff; }
.label {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.label-kesin-firsat { background: #dcfce7; color: #14532d; }
.label-yuksek       { background: #fef9c3; color: #713f12; }
.label-orta         { background: #fef2f2; color: #7c2d12; }
.label-dusuk        { background: #f3f4f6; color: #374151; }
.tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.tag-pos { background: #ecfdf5; color: #065f46; }
.tag-neg { background: #fef2f2; color: #991b1b; }
.status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.status-yapim       { background: #fed7aa; color: #7c2d12; }
.status-ihale       { background: #fef3c7; color: #713f12; }
.status-planli      { background: #e0e7ff; color: #3730a3; }
.status-tamamlandi  { background: #d1fae5; color: #065f46; }
.infra-yapim { border-left: 3px solid #ea580c; }
.infra-ihale { border-left: 3px solid #ca8a04; }
.infra-planli { border-left: 3px solid #4f46e5; }
.loc { color: #44403c; }
.loc b { color: #0c4a6e; }
.tip {
  margin-left: auto;
  background: #f5f5f4;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #57534e;
}
.price-line {
  font-size: 16px;
  margin-bottom: 6px;
}
.price-line b { color: #14532d; font-size: 18px; }
.title {
  display: block;
  color: #0c4a6e;
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 13px;
}
.title:hover { text-decoration: underline; }
.map-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: #0b1d35; color: #fcd34d;
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  text-decoration: none; margin-bottom: 8px;
  transition: all .15s;
}
.map-btn:hover { background: #f59e0b; color: #0b1d35; }
.card-locked { position: relative; overflow: hidden; }
.card-locked .card-body { min-height: 120px; }
.locked-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.95) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  z-index: 5;
  text-align: center;
  backdrop-filter: blur(2px);
}
.locked-overlay .lock-icon { font-size: 28px; }
.locked-overlay .lock-msg { font-size: 14px; color: #0b1d35; line-height: 1.5; }
.locked-overlay .lock-cta {
  background: #f59e0b;
  color: #0b1d35;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
  margin-top: 4px;
}
.locked-overlay .lock-cta:hover { background: #fbbf24; }
.reasons {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reasons li {
  background: #fef9c3;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  color: #713f12;
}
.plan-link {
  font-size: 12px;
  margin-top: 6px;
  color: #57534e;
}
.plan-link a { color: #57534e; text-decoration: none; }
.plan-link a:hover { color: #0c4a6e; }
.sidebar { font-size: 13px; }
.plan {
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.plan-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.plan-head .pafta { font-weight: 700; color: #0c4a6e; }
.plan-head .date { color: #78716c; }
.plan a { color: #0c4a6e; font-size: 12px; }

/* ============== MOBILE RESPONSIVE ============== */
@media (max-width: 768px) {
  body { font-size: 15px; }

  /* Header — stack vertical */
  header {
    padding: 12px 14px;
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }
  header h1 { font-size: 19px; width: 100%; }
  header h1 .muted { font-size: 14px; }

  /* Top nav — horizontal scroll */
  .topnav {
    width: 100%;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a {
    flex-shrink: 0;
    font-size: 14px;
    white-space: nowrap;
  }
  .topnav button { flex-shrink: 0; margin-left: 0 !important; }

  /* Stats row — compact */
  .stats {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
  }
  .stats span { white-space: nowrap; }
  form.inline { width: 100%; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
  form.inline label { font-size: 13px; }
  form.inline button { flex: 1; min-width: 140px; font-size: 14px; padding: 10px; }

  /* Filters — stack to column-y grid */
  .filters {
    padding: 10px 14px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }
  .filters label {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    font-size: 12px;
    color: #57534e;
  }
  .filters input, .filters select {
    width: 100%;
    padding: 9px 10px;
    font-size: 15px; /* iOS keyboard zoom prevention >= 16px */
  }
  .filters button {
    width: 100%;
    padding: 11px;
    font-size: 15px;
  }

  /* Layout — single column */
  .layout {
    grid-template-columns: 1fr;
    padding: 12px 14px;
    gap: 14px;
  }

  /* Cards */
  .card { padding: 12px; }
  .card-head {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    line-height: 1.3;
  }
  .card-head .loc { width: 100%; margin-top: 2px; }
  .card-head .tip { margin-left: 0; }

  .price-line { font-size: 15px; line-height: 1.6; }
  .price-line b { font-size: 17px; }
  .title {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
  }
  .map-btn {
    padding: 8px 14px;
    font-size: 13px;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
  }
  .reasons li { font-size: 11px; padding: 4px 9px; }
  .plan-link { font-size: 11px; line-height: 1.5; word-break: break-word; }

  /* Form inline (scrape) */
  form.inline label { display: inline-flex; }

  /* Sidebar — full width below */
  .sidebar h2 { font-size: 17px; margin: 12px 0 10px; }
}

/* ============== EXTRA SMALL (phones <480) ============== */
@media (max-width: 480px) {
  header { padding: 10px 12px; }
  header h1 { font-size: 17px; }
  .stats { font-size: 12px; gap: 6px 10px; }
  .filters { padding: 10px 12px; }
  .layout { padding: 10px 12px; }
  .card { padding: 11px; border-radius: 7px; }
  .price-line b { font-size: 16px; }
}

/* Touch-friendly buttons */
@media (hover: none) {
  button, .map-btn, .topnav a, .filters button {
    min-height: 40px;
  }
  .card { -webkit-tap-highlight-color: rgba(11, 29, 53, .1); }
}
