* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', sans-serif; background: #f4f6fb; display: flex; }

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    padding: 0;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a5c38;
    border-bottom: 1px solid #e5e7eb;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 12px 0; }
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #374151;
    text-decoration: none;
    font-size: .95rem;
    transition: background .15s;
}
.sidebar-nav .nav-item:hover, .sidebar-nav .nav-item.active {
    background: #f0fdf4;
    color: #1a5c38;
    border-right: 3px solid #1a5c38;
}
.sidebar-nav .nav-item .material-icons { font-size: 1.1rem; }
.sidebar-footer { padding: 16px 20px; color: #9ca3af; font-size: .8rem; border-top: 1px solid #e5e7eb; }

.main-content { margin-left: 240px; width: calc(100% - 240px); min-height: 100vh; }
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; }
.topbar-greeting { font-size: 1rem; }

.kpi-card {
    border-radius: 12px;
    padding: 18px 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 90px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.kpi-label { font-size: .82rem; opacity: .88; margin-bottom: 4px; }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi-icon {
    position: absolute;
    right: 12px; top: 12px;
    font-size: 2.2rem;
    opacity: .22;
}
.kpi-green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.kpi-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.kpi-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.kpi-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.kpi-pink   { background: linear-gradient(135deg, #ec4899, #be185d); }
.kpi-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.kpi-salmon { background: linear-gradient(135deg, #fb923c, #f97316); }
.kpi-teal   { background: linear-gradient(135deg, #14b8a6, #0d9488); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.metric-tile {
    border-radius: 10px;
    padding: 12px 10px;
    min-height: 88px;
    border: 1px solid #e5e7eb;
    background: #fff;
    transition: box-shadow .15s;
}
.metric-tile.metric-live {
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4, #fff);
    box-shadow: 0 1px 4px rgba(34,197,94,.12);
}
.metric-tile.metric-idle { background: #fafafa; }
.metric-name {
    font-size: .72rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
    margin: 4px 0 2px;
}
.metric-unit { font-size: .75rem; font-weight: 500; color: #6b7280; }
.metric-meta { font-size: .68rem; color: #9ca3af; }

.status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.status-dot.offline { background: #ef4444; }

/* --- Login page ------------------------------------------------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a5c38, #0d9488);
    padding: 16px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
}
.login-logo { font-size: 1.6rem; font-weight: 700; color: #1a5c38; }

/* --- Responsive ------------------------------------------------------- */
/* Below the Bootstrap "lg" breakpoint the sidebar becomes an offcanvas
   drawer (toggled by the hamburger) and the content spans full width. */
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg {
        position: fixed;
        width: 260px;
    }
    .main-content { margin-left: 0; width: 100%; }
}

@media (min-width: 992px) {
    /* Offcanvas stays visible (pinned) on desktop. */
    .sidebar.offcanvas-lg { visibility: visible !important; transform: none !important; }
}

@media (max-width: 575.98px) {
    .kpi-card { padding: 14px 12px; min-height: 78px; }
    .kpi-value { font-size: 1.35rem; }
    .kpi-icon { font-size: 1.8rem; }
    .topbar-greeting { font-size: .9rem; }
}