:root {
    --panel-w: 340px;
    --bg: #ffffff;
    --fg: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --on: #15803d;
    --off: #dc2626;
    --sim: #7c3aed;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }

#map { position: absolute; top: 0; bottom: 0; left: var(--panel-w); right: 0; transition: left .2s; }
#yukleniyor {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--muted); z-index: 500; background: rgba(255,255,255,.7);
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
#panel {
    position: absolute; top: 0; bottom: 0; left: 0; width: var(--panel-w);
    overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg);
    padding: 14px 16px 24px; z-index: 1000; transition: transform .2s;
}
body.panel-kapali #panel { transform: translateX(calc(-1 * var(--panel-w) + 44px)); }
body.panel-kapali #map { left: 44px; }
body.sim-modu #panel { border-right: 3px solid var(--sim); }

.panel-ust { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
h1 { font-size: 17px; margin: 0 0 6px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.ikon-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 16px; }

.rozet { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .05em; }
.rozet.ok { background: #dcfce7; color: #166534; }
.rozet.uyari { background: #fef3c7; color: #92400e; }
.rozet.sim { background: #ede9fe; color: var(--sim); }

.arama { position: relative; margin-top: 12px; }
#search-input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
#search-results { position: absolute; left: 0; right: 0; top: 100%; background: #fff; z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); border-radius: 8px; overflow: hidden; }
.sr-item, .liste-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0;
    background: none; padding: 7px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.sr-item:hover, .liste-item:hover { background: #f3f4f6; }
.sr-ad, .li-ad { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-tip, .li-ek { color: var(--muted); font-size: 11px; }
.sr-bos { padding: 10px; color: var(--muted); font-size: 13px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.on { background: var(--on); }
.dot.off { background: var(--off); }

.istatistik { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kutu { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.kutu span { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kutu small { font-size: 10px; color: var(--muted); }
.kutu.on span { color: var(--on); }
.kutu.off span { color: var(--off); }

.not { font-size: 12px; color: var(--muted); margin: 8px 0; }
.bos { font-size: 13px; color: var(--muted); margin: 0; }

#kesik-liste { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
#kesik-liste:empty { display: none; }
.aktif-item, .olay-item { font-size: 13px; padding: 7px 9px; border-left: 3px solid var(--off);
    background: #fef2f2; border-radius: 4px; margin-bottom: 6px; cursor: pointer; }
.aktif-item.sim { border-color: var(--sim); background: #f5f3ff; }
.olay-item { border-color: #2563eb; background: #eff6ff; cursor: default; }
.olay-zaman { font-size: 11px; color: var(--muted); }

.sim { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.sim button { margin: 4px 4px 0 0; padding: 7px 10px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.anahtar { font-size: 14px; font-weight: 600; cursor: pointer; }

.lejant { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; }
.lejant div { display: flex; align-items: center; gap: 6px; }
.lejant .cizgi { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.lejant .cizgi.kesik { background: repeating-linear-gradient(90deg, #15803d 0 5px, transparent 5px 9px); }
.lejant .nokta { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid; background: #fff; }
.lejant .kare { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.scada-ikon { width: 16px; height: 16px; border-radius: 3px; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #111827, 0 2px 6px rgba(0,0,0,.35); }
.scada-ikon.acik { animation: nabiz 1.4s ease-in-out infinite; }
@keyframes nabiz { 50% { box-shadow: 0 0 0 1.5px #111827, 0 0 0 8px rgba(220,38,38,.25); } }
.pp-gecmis { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.olay-item[data-eleman] { cursor: pointer; }
.olay-item.tur-acma { border-color: var(--off); background: #fef2f2; }
.olay-item.tur-kapama { border-color: var(--on); background: #f0fdf4; }
.olay-item.tur-ariza { border-color: #f59e0b; background: #fffbeb; }
.olay-item.eslesmedi { border-style: dashed; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3000; padding: 10px 16px;
    border-radius: 10px; color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; }
.toast.acma { background: var(--off); }
.toast.ariza { background: #d97706; }
footer { margin-top: 18px; font-size: 12px; }
footer a { color: var(--muted); }

/* ── Popup ───────────────────────────────────────────────────────────────── */
.pp { font-size: 13px; line-height: 1.4; }
.pp-tip { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.pp-ad { font-weight: 700; font-size: 14px; margin-bottom: 2px; white-space: pre-line; }
.pp-row { margin: 3px 0; }
.pp-muted { color: var(--muted); font-size: 11px; }
.pp-etki { margin: 6px 0; padding: 6px 8px; background: #f3f4f6; border-radius: 6px; }
.pp-canli { margin-top: 6px; font-size: 11px; color: #1e40af; }
.pp-btn { margin-top: 4px; padding: 6px 12px; border: 0; border-radius: 6px; background: var(--sim); color: #fff; cursor: pointer; font-weight: 600; }

.custom-tooltip { font-weight: 600; white-space: pre-line; }

/* ── Mobil ───────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    :root { --panel-w: 100vw; }
    #map { left: 0; top: 0; bottom: 55%; }
    body.panel-kapali #map { bottom: 56px; }
    #panel { width: 100%; height: 55%; top: auto; bottom: 0; border-right: 0; border-top: 1px solid var(--line);
        border-radius: 14px 14px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.12); }
    body.panel-kapali #panel { transform: translateY(calc(100% - 56px)); }
    body.panel-kapali #map { left: 0; }
}
