:root {
    --teal: #0E7490;
    --teal-dark: #0B5568;
    --teal-50: #ECFEFF;
    --ink: #0F172A;
    --muted: #64748B;
    --line: #E2E8F0;
    --bg: #F1F5F9;
    --card: #FFFFFF;
    --ok: #16A34A;
    --warn: #EA580C;
    --err: #DC2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: linear-gradient(180deg, var(--teal) 0%, var(--teal-dark) 100%); color: #E0F2FE; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 4px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #BAE6FD; }
.nav-menu { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; color: #E0F2FE; font-weight: 500; transition: .15s; }
.nav-item i { font-size: 17px; width: 20px; }
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: #fff; color: var(--teal); font-weight: 600; }
.sidebar-foot { padding: 16px 18px; font-size: 11px; }
.sidebar-foot .muted { color: #BAE6FD; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 500; }
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { color: var(--muted); font-weight: 500; }
.btn-logout { border: 1px solid var(--line); background: #fff; color: var(--err); padding: 7px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; }
.btn-logout:hover { background: #FEF2F2; }
.content { padding: 22px 24px; }

.card-s { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.grid { display: grid; gap: 16px; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.stat .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; }
.stat .val { font-size: 30px; font-weight: 800; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.sec-head h2 { font-size: 17px; font-weight: 700; margin: 0; }

.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.btn-ghost:hover { background: var(--bg); }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.tbl thead th { background: #F8FAFC; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #F8FAFC; }
.tbl .mono { font-family: ui-monospace, "Cascadia Code", monospace; font-weight: 700; color: var(--teal); }

.badge-durum { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.badge-durum .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill { padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--teal-50); color: var(--teal-dark); }
.pill-online { background: #DCFCE7; color: #166534; }
.pill-offline { background: #F1F5F9; color: #64748B; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters .fld { display: flex; flex-direction: column; gap: 4px; }
.filters label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filters .form-control, .filters .form-select { min-width: 150px; }

.map-box { height: 560px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.map-sm { height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%); }
.login-card { width: 380px; max-width: 92vw; background: #fff; border-radius: 20px; padding: 34px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-logo { width: 76px; height: 76px; border-radius: 18px; background: #fff; color: var(--teal); display: grid; place-items: center; font-size: 30px; margin: 0 auto 14px; padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.login-logo img { width: 100%; height: 100%; object-fit: contain; }

/* Grafik sarmalayıcı: Chart.js'in taşmasını engeller (responsive + sabit yükseklik) */
.chart-wrap { position: relative; width: 100%; height: 260px; }
.chart-wrap canvas { max-height: 100%; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li .tl-dot { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; }
.timeline .tl-time { font-size: 12px; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-weight: 600; }

/* Responsive grid yardımcıları (dar ekranda tek kolona iner) */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.eq-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* Tablolar dar ekranda yatay kaydırılır */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; }
.table-scroll .tbl { min-width: 640px; }

/* Hamburger menü (yalnızca mobilde görünür) */
.menu-toggle { display: none; background: transparent; border: none; font-size: 24px; color: var(--teal); cursor: pointer; margin-right: 6px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 900; }
.sidebar-backdrop.show { display: block; }

/* ---- Tablet ---- */
@media (max-width: 992px) {
    .two-col, .eq-2 { grid-template-columns: 1fr; }
}

/* ---- Mobil: sidebar off-canvas ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100dvh; width: 240px;
        transform: translateX(-100%); transition: transform .25s ease; z-index: 1000;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
    .brand-title, .brand-sub, .sidebar-foot { display: block; }
    .nav-item { justify-content: flex-start; font-size: 14px; }
    .menu-toggle { display: inline-flex; align-items: center; }
    .topbar { padding: 0 14px; gap: 8px; }
    .topbar-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .user-chip { display: none; }
    .content { padding: 16px 14px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .filters { gap: 8px; }
    .filters .form-control, .filters .form-select { min-width: 0; }
    .filters .fld { flex: 1 1 140px; }
    .map-box { height: 62dvh; }
}

@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr; }
}
