* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; }

#panel {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  background: rgba(17, 24, 39, 0.9); color: #e5e7eb;
  padding: 12px 14px; border-radius: 10px; width: 250px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35); backdrop-filter: blur(4px);
  font-size: 13px; line-height: 1.5; max-height: calc(100vh - 24px); overflow-y: auto;
}
.panel-header { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.panel-header .tld { color: #38bdf8; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; transition: background .3s; }
.dot.on { background: #22c55e; }
.stat { font-size: 13px; }
.stat #count { font-size: 18px; font-weight: 700; color: #fff; }
.hint { color: #9ca3af; font-size: 12px; margin-top: 6px; }

.mini-btn {
  background: #374151; color: #e5e7eb; border: none; border-radius: 6px;
  padding: 4px 8px; font-size: 12px; cursor: pointer; margin-top: 6px;
}
.mini-btn:hover { background: #4b5563; }

.filters { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.filters.hidden, .detail.hidden, .alerts.hidden, .replay-bar.hidden { display: none; }
.filters label { font-size: 12px; color: #cbd5e1; display: flex; flex-direction: column; gap: 3px; }
.filters .range { display: flex; gap: 6px; }
.filters input[type="number"] { width: 100%; background: #111827; border: 1px solid #374151; color: #e5e7eb; border-radius: 5px; padding: 3px 6px; font-size: 12px; }
.filters .chk { flex-direction: row; align-items: center; gap: 6px; }

.detail { margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 8px; }
.detail .cs { font-size: 15px; font-weight: 700; color: #fff; }
.detail table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.detail td { padding: 1px 0; }
.detail td:first-child { color: #9ca3af; padding-right: 10px; white-space: nowrap; }
.detail .route-btn { margin-top: 6px; }
.detail .route { margin-top: 6px; font-size: 12px; color: #a7f3d0; }

.alerts { margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 8px; }
.alerts-title { color: #fbbf24; font-size: 12px; margin-bottom: 4px; }
#alerts-log { display: flex; flex-direction: column; gap: 3px; max-height: 120px; overflow-y: auto; }
#alerts-log .a { font-size: 11px; color: #fca5a5; }
#alerts-log .a b { color: #fff; }

#controls {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: rgba(17,24,39,0.92); color: #e5e7eb; padding: 8px 10px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35); backdrop-filter: blur(4px);
}
.mode-row { display: flex; gap: 6px; justify-content: center; }
.mode-btn {
  background: #374151; color: #e5e7eb; border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.mode-btn.active { background: #2563eb; color: #fff; }
.replay-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.replay-bar select { background: #111827; color: #e5e7eb; border: 1px solid #374151; border-radius: 5px; padding: 3px 5px; font-size: 12px; }
#replay-slider { width: 320px; }
.replay-time { font-variant-numeric: tabular-nums; font-size: 12px; color: #93c5fd; min-width: 130px; text-align: right; }

#legend {
  position: absolute; bottom: 20px; left: 12px; z-index: 10;
  background: rgba(17,24,39,0.9); color: #e5e7eb; padding: 8px 10px;
  border-radius: 8px; font-size: 11px;
}
.legend-title { margin-bottom: 4px; }
.legend-bar { height: 8px; width: 160px; border-radius: 4px; background: linear-gradient(90deg, #00c853, #ffd600, #ff6d00, #d500f9); }
.legend-labels { display: flex; justify-content: space-between; margin-top: 2px; color: #9ca3af; }

#toasts { position: absolute; top: 12px; right: 12px; z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: rgba(127, 29, 29, 0.95); color: #fee2e2; padding: 8px 12px; border-radius: 8px;
  font-size: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.4); border-left: 3px solid #f87171;
  animation: slidein .2s ease-out;
}
.toast b { color: #fff; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.maplibregl-popup-content { font-size: 12px; }

/* Hesap */
.account { margin-top: 8px; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 8px; }
.account.hidden, #acct-in.hidden { display: none; }
#acct-out input { width: 100%; margin-bottom: 5px; background: #111827; border: 1px solid #374151; color: #e5e7eb; border-radius: 5px; padding: 4px 6px; font-size: 12px; }
.acct-btns { display: flex; gap: 6px; }
.acct-btns .mini-btn { flex: 1; margin-top: 2px; }
.acct-msg { font-size: 11px; color: #fca5a5; margin-top: 4px; min-height: 14px; }
.acct-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acct-user span { font-weight: 600; color: #fff; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.myzones-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: #cbd5e1; font-size: 12px; }
#myzones { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
#myzones .z { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: #a7f3d0; }
#myzones .z button { background: none; border: none; color: #f87171; cursor: pointer; font-size: 13px; padding: 0 2px; }

/* Arama */
.search { width: 100%; margin-top: 8px; background: #111827; border: 1px solid #374151; color: #e5e7eb; border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.search::placeholder { color: #6b7280; }
.pbtns { display: flex; gap: 6px; margin-top: 6px; }
.pbtns .mini-btn { flex: 1; margin-top: 0; }

/* Telefon / dar ekran */
@media (max-width: 640px) {
  #panel { width: calc(100vw - 20px); max-width: 300px; padding: 9px 11px; font-size: 12px; max-height: 46vh; }
  .panel-header { font-size: 14px; margin-bottom: 4px; }
  .stat #count { font-size: 15px; }
  .hint { font-size: 11px; }
  #legend { display: none; }                 /* kontrollerle çakışmasın */
  #controls { bottom: 12px; padding: 6px 8px; max-width: calc(100vw - 16px); }
  .mode-btn { padding: 5px 9px; font-size: 12px; }
  .replay-bar { flex-wrap: wrap; justify-content: center; gap: 6px; }
  #replay-slider { width: 100%; order: 5; }
  .replay-time { min-width: 0; text-align: center; }
  #toasts { max-width: 70vw; }
}

