:root {
  --ink: #17212b;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #0f6b5c;
  --accent-2: #1b74c5;
  --danger: #c62828;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

#app { display: flex; height: 100%; }

/* ------------------------------------------------------------- sidebar -- */
#panel {
  width: 372px;
  min-width: 340px;
  height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 500;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 2px;
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #1f8f78);
  color: #fff; font-weight: 800; letter-spacing: .5px;
}
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -.2px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; margin: 0 0 10px; color: var(--muted); }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #344054;
  margin-bottom: 10px;
}
select, input {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .12);
}
select:disabled { background: #f2f4f7; color: #98a2b3; }

.row { display: flex; gap: 10px; }
.row label { flex: 1; }

button {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .05s, background .15s, border-color .15s;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: #0b5c4f; }
button.ghost {
  background: #fff; color: #344054;
  border-color: #d0d5dd; margin-top: 8px;
}
button.ghost:hover { border-color: #98a2b3; }
button.ghost.active {
  background: #ecfdf3; color: #067647; border-color: #75e0a7;
}

#infoCard .info-head,
#compareCard .info-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
#infoCard h2,
#compareCard h2 { margin: 0; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); }
#compareCard .info-head h2 {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.badge {
  font-size: 11px; font-weight: 700;
  background: #eef4ff; color: #175cd3;
  border: 1px solid #b2ccff;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
dl { display: grid; grid-template-columns: 118px 1fr; gap: 6px 10px; margin: 0 0 12px; }
dt { font-size: 12px; color: var(--muted); }
dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.hint { font-size: 11px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.hint.left { text-align: left; margin: 0 0 8px; }

textarea {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  outline: none;
  resize: vertical;
}
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .12);
}

.mini-actions { display: flex; gap: 6px; }
button.mini {
  width: auto;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #344054;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  white-space: nowrap;
}
button.mini:hover { border-color: #98a2b3; }

.cache-list {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0;
  background: #fff;
}
.cache-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 12px;
}
.cache-item:last-child { border-bottom: 0; }
.cache-item input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.cache-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cache-area { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.cache-item .mini { padding: 3px 6px; }
.cache-item .del { color: #b42318; }

/* ------------------------------------------------------ compare ghosts -- */
.compare-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
  background: #fff;
  margin: 8px 0 6px;
}
.compare-item {
  padding: 7px 8px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 12px;
}
.compare-item:last-child { border-bottom: 0; }
.compare-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.compare-line + .compare-line { margin-top: 6px; }
.compare-item .swatch {
  width: 10px; height: 10px; border-radius: 3px; flex: none;
  border: 1px solid rgba(0, 0, 0, .15);
}
.compare-item .cache-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-item .mini { padding: 3px 6px; }
.compare-item .del { color: #b42318; }
.compare-line .spacer { flex: 1; }
.compare-angle {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.compare-summary {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #344054;
}
.compare-summary:empty { display: none; }

.leaflet-pane > svg path.compare-ghost {
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
.leaflet-pane > svg path.compare-ghost.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45));
}

.ghost-tag { pointer-events: none; }
.ghost-tag-inner {
  display: inline-block;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(23, 33, 43, .84);
  color: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.ghost-tag-inner b { font-size: 12px; letter-spacing: .2px; }

/* ----------------------------------------------------------- plan tools -- */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
button.tab {
  width: auto; flex: 1;
  padding: 7px 6px;
  font-size: 11.5px; font-weight: 700;
  color: #344054; background: #fff;
  border: 1px solid #d0d5dd; border-radius: 8px;
  white-space: nowrap;
}
button.tab.active { background: #ecfdf3; color: #067647; border-color: #75e0a7; }

.plan-block { border-top: 1px dashed var(--line); padding-top: 10px; margin-bottom: 10px; }
.plan-block:first-of-type { border-top: 0; padding-top: 0; }
.row.three label { flex: 1 1 0; min-width: 0; }
.opt { font-weight: 500; color: var(--muted); font-size: 10px; margin-left: 4px; }

.plan-result {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.plan-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 9px;
  font-size: 12px;
  border-bottom: 1px solid #f2f4f7;
}
.plan-row:last-child { border-bottom: 0; }
.plan-row span { color: var(--muted); }
.plan-row b { font-variant-numeric: tabular-nums; text-align: right; }
.plan-warn {
  margin: 6px 0 0; padding: 6px 9px;
  background: #fff4e5; color: #93370d;
  font-size: 11px; border-radius: 6px;
}
.plan-note { margin: 6px 0 0; padding: 0 9px 8px; font-size: 10px; color: var(--muted); }

.plan-tag { pointer-events: none; }
.plan-tag span {
  display: inline-block;
  transform: translate(-50%, -50%);
  background: rgba(23, 33, 43, .84);
  color: #fff;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.plan-tag.road span { background: #b35c00; }
.plan-tag.lot span { font-weight: 600; background: rgba(23, 33, 43, .76); }
.plan-tag.lot.bad span { background: #b42318; }
.plan-tag.green span { background: #2b8a3e; }

/* --------------------------------------------------------------- senaryolar */
.scen-list {
  max-height: 180px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.scen-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #f2f4f7;
}
.scen-item:last-child { border-bottom: 0; }
.scen-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.scen-name {
  font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scen-meta {
  font-size: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scen-item .mini { padding: 3px 6px; }
.scen-item .del { color: #b42318; }
.scenario-actions { margin-top: 6px; flex-wrap: wrap; }

/* --------------------------------------------------------------- satış -- */
.sales-head { margin-top: 12px; }
.sales-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
}
.sale-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 7px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 11px;
}
.sale-row:last-child { border-bottom: 0; }
.sale-no { width: 18px; font-weight: 700; color: var(--muted); text-align: right; flex: none; }
.sale-area { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-select { width: 88px; margin: 0; padding: 3px 4px; font-size: 11px; flex: none; }
.sale-price { display: flex; align-items: center; gap: 3px; flex: none; }
.sale-price input { width: 86px; margin: 0; padding: 3px 5px; font-size: 11px; }
.sale-cur { font-size: 10px; color: var(--muted); }
.plan-tag.lot.sold span { background: #b42318; }
.plan-tag.lot.option span { background: #b35c00; }

/* ---------------------------------------------------------------- modal -- */
.modal {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(16, 24, 40, .65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 15px; }
.sheet-holder { padding: 12px; overflow: auto; background: #fff; }
.sheet-holder svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92vh - 120px);
  margin: 0 auto;
}
button.mini.strong { background: var(--accent); color: #fff; border-color: var(--accent); }

.foot { margin-top: auto; padding-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.foot p { margin: 6px 0 0; }
.foot .tiny { font-size: 10px; color: #98a2b3; }
.quota { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #344054; }
.quota .dot { width: 7px; height: 7px; border-radius: 50%; background: #12b76a; }

/* ----------------------------------------------------------------- map -- */
#mapWrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #dfe5ea; }

.map-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 700;
  background: rgba(23, 33, 43, .86);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 7px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.map-badge.coord { bottom: 46px; font-weight: 500; font-variant-numeric: tabular-nums; }

.toast {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 900;
  max-width: min(520px, calc(100% - 24px));
  background: #3a1212;
  color: #fff;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.ok { background: #083d2e; }

.leaflet-control-layers { border-radius: 8px !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { border-radius: 6px !important; }

@media (max-width: 820px) {
  #app { flex-direction: column-reverse; }
  #panel {
    width: 100%; min-width: 0; height: auto; max-height: 52vh;
    border-right: 0; border-top: 1px solid var(--line);
  }
  #mapWrap { height: 48vh; flex: none; }
  .map-badge.coord { display: none; }
}
