:root {
  --sidebar-width: 244px;
  --sidebar-bg: #0f1b2b;
  --sidebar-bg-2: #11233a;
  --primary: #356fe1;
  --border: #e4e9f0;
  --muted: #6e7887;
  --bg: #f7f9fc;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: #172033; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
a { text-decoration: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: #fff;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, width .25s ease;
}

.brand-wrap { display: flex; align-items: center; gap: 12px; padding: 23px 18px 20px 22px; min-height: 82px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; display: grid; place-items: center; font-size: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; }
.brand-text span { margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.72); }
.sidebar-collapse { margin-left: auto; color: #d8e1ee; padding: 4px; }
.sidebar-collapse:hover { color: #fff; }

.sidebar-nav { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.nav-entry { color: #f0f4f9; display: flex; align-items: center; gap: 14px; min-height: 43px; padding: 0 14px; border-radius: 7px; transition: .15s ease; }
.nav-entry i { width: 18px; font-size: 17px; text-align: center; }
.nav-entry:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-entry.active { background: linear-gradient(90deg, #2f63c7, #416fcb); box-shadow: 0 5px 13px rgba(0,0,0,.15); }

.connection-card { margin: auto 15px 20px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(4,13,26,.2); }
.connection-card hr { border-color: rgba(255,255,255,.13); }
.status-dot { display: inline-block; width: 9px; height: 9px; background: #47be71; border-radius: 50%; margin-right: 5px; }

.main-shell { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left .25s ease; }
.topbar { height: 66px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 1010; }
.icon-btn { border: 0; font-size: 22px; color: #172033; align-items: center; justify-content: center; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.date-filter { height: 36px; min-width: 215px; border: 1px solid #d9dee7; border-radius: 6px; align-items: center; padding: 0 12px; gap: 10px; background: #fff; font-size: 12px; }
.date-filter .bi-chevron-down { margin-left: auto; font-size: 10px; }
.site-select { width: 170px; height: 36px; font-size: 12px; border-color: #d9dee7; }
.user-box { display: flex; align-items: center; gap: 10px; min-width: 165px; }
.user-box > i { font-size: 24px; }
.user-box div { display: flex; flex-direction: column; line-height: 1.25; }
.user-box strong { font-size: 12px; }
.user-box span { color: var(--muted); font-size: 11px; margin-top: 2px; }

.content-area { padding: 18px 28px 32px; }
.page-title { font-size: 22px; margin: 0; font-weight: 700; }
.page-subtitle { color: var(--muted); margin: 3px 0 15px; font-size: 12px; }

.card-panel { background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 1px 2px rgba(22,34,51,.03); }
.metric-card { min-height: 118px; padding: 18px 16px; position: relative; }
.metric-card .label { color: #495365; font-size: 12px; }
.metric-card .value { font-size: 25px; font-weight: 700; margin-top: 8px; letter-spacing: -.4px; }
.metric-card .trend { margin-top: 9px; font-size: 12px; }
.metric-card .trend small { color: var(--muted); margin-left: 12px; }
.metric-icon { position: absolute; right: 17px; top: 47px; font-size: 28px; color: #356bc8; }
.text-good { color: #2fa65a; }
.text-bad { color: #db4b3e; }

.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; }
.panel-header h2 { margin: 0; font-size: 14px; font-weight: 700; }
.panel-header .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.panel-body { padding: 12px 16px 16px; }
.chart-wrap { position: relative; height: 230px; }
.chart-wrap.small { height: 190px; }

.map-wrap { height: 255px; border-radius: 0 0 9px 9px; overflow: hidden; margin: 10px 8px 8px; }
.leaflet-container { font-family: inherit; background: #eef2ed; }
.map-marker { border: none; background: transparent; }
.map-marker span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.map-marker.green span { background: #44ac5b; }
.map-marker.orange span { background: #f1b421; color: #423300; }
.map-marker.red span { background: #d94d40; }

.rank-list { padding: 4px 0 0; }
.rank-item { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; padding: 9px 16px; border-top: 1px solid #eef1f5; font-size: 11px; }
.rank-num { width: 18px; height: 18px; border-radius: 50%; color: white; font-weight: 700; display: grid; place-items: center; font-size: 9px; background: #49a85d; }
.rank-num.warn { background: #e5a62f; }
.rank-num.danger { background: #d9584b; }
.rank-value { text-align: right; }
.rank-value small { display: block; margin-top: 2px; }
.rank-footer { padding: 10px 16px; border-top: 1px solid #eef1f5; color: #2e63bc; font-size: 11px; }

.donut-layout { display: flex; align-items: center; gap: 20px; }
.donut-box { width: 130px; height: 130px; flex: 0 0 130px; }
.legend-list { flex: 1; display: grid; gap: 10px; font-size: 11px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-row strong { margin-left: auto; font-weight: 500; }
.panel-note { color: #39a75e; font-size: 11px; margin-top: 13px; }

.alert-list { padding: 0 16px 10px; }
.alert-row { min-height: 38px; display: grid; grid-template-columns: 22px 190px 1fr 90px; gap: 10px; align-items: center; border-top: 1px solid #edf1f4; font-size: 10.5px; }
.alert-icon { width: 17px; height: 17px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 10px; }
.alert-icon.danger { background: #de4438; }
.alert-icon.warning { background: #e9ad2b; }
.alert-icon.info { background: #3b6cb8; }
.alert-time { text-align: right; color: var(--muted); }

.report-list .report-row { display: grid; grid-template-columns: 1fr auto 22px; gap: 8px; padding: 9px 16px; border-top: 1px solid #edf1f4; font-size: 10.5px; align-items: center; }
.report-row .fmt { color: var(--muted); }

.data-table { font-size: 12px; }
.data-table thead th { color: #6c7684; font-weight: 600; white-space: nowrap; background: #fafbfd; }
.data-table td, .data-table th { padding: 11px 12px; vertical-align: middle; border-color: #edf0f4; }
.sensor-state { display: inline-flex; align-items: center; gap: 6px; }
.sensor-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #36ad5c; }
.badge-soft { background: #edf4ff; color: #3261aa; font-weight: 600; }

.toolbar-card { padding: 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-card .form-control, .toolbar-card .form-select { max-width: 240px; font-size: 12px; }
.kpi-mini { padding: 14px 16px; }
.kpi-mini .caption { color: var(--muted); font-size: 11px; }
.kpi-mini .big { font-size: 21px; font-weight: 700; margin-top: 4px; }

.realtime-pulse { width: 9px; height: 9px; background: #34ac58; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 0 rgba(52,172,88,.45); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(52,172,88,0); } 100% { box-shadow: 0 0 0 0 rgba(52,172,88,0); } }

.placeholder-hero { padding: 28px; }
.placeholder-hero h2 { font-size: 18px; }
.demo-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #fff5d9; color: #8a6513; font-size: 10px; font-weight: 700; }
.loading-state { min-height: 300px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.sidebar-backdrop { display: none; }

body.sidebar-mini .sidebar { width: 78px; }
body.sidebar-mini .brand-text, body.sidebar-mini .nav-entry span, body.sidebar-mini .connection-card, body.sidebar-mini .sidebar-collapse { display: none !important; }
body.sidebar-mini .brand-wrap { justify-content: center; padding-left: 15px; padding-right: 15px; }
body.sidebar-mini .nav-entry { justify-content: center; padding: 0; }
body.sidebar-mini .main-shell { margin-left: 78px; }

@media (max-width: 1199px) {
  .metric-card .value { font-size: 21px; }
  .donut-layout { gap: 10px; }
  .donut-box { width: 112px; height: 112px; flex-basis: 112px; }
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1020; }
  .main-shell { margin-left: 0 !important; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 14px; }
}

@media (max-width: 767.98px) {
  .user-box { min-width: auto; }
  .user-box div { display: none; }
  .alert-row { grid-template-columns: 22px 1fr auto; }
  .alert-row .alert-message { display: none; }
  .donut-layout { flex-direction: column; align-items: stretch; }
  .donut-box { margin: 0 auto; }
}

.realtime-new {

    animation:
        realtimeNew 1.6s ease;

}


@keyframes realtimeNew {

    0% {

        background:
            rgba(25, 135, 84, 0.25);

    }

    100% {

        background:
            transparent;

    }

}
