/* ── Dashboard Common Styles ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

:root {
    --bg: #f0f2f5;
    --tx: #1e293b;
    --pn: #fff;
    --bd: #e2e8f0;
    --bd2: #f1f5f9;
    --lb: #64748b;
    --lb2: #475569;
    --mt: #94a3b8;
    --mt2: #cbd5e1;
    --hv: #f8fafc;
    --su: #f1f5f9;
    --off: #6b7280;
    --accent: #f7b731;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --purple: #a855f7;
    --chG: rgba(0, 0, 0, .06);
    --chT: #000000
}

body.theme-blue {
    --bg: #0b1120;
    --tx: #e2e8f0;
    --pn: #111a2e;
    --bd: rgba(255, 255, 255, .06);
    --bd2: rgba(255, 255, 255, .04);
    --lb: rgba(255, 255, 255, .5);
    --lb2: rgba(255, 255, 255, .7);
    --mt: rgba(255, 255, 255, .35);
    --mt2: rgba(255, 255, 255, .2);
    --hv: rgba(255, 255, 255, .03);
    --su: rgba(255, 255, 255, .05);
    --off: rgba(255, 255, 255, .3);
    --chG: rgba(255, 255, 255, .04);
    --chT: #ffffff
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--tx);
    min-height: 100vh;
    min-width: 1440px;
    overflow-x: auto
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 200px;
    height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: hidden;
    overflow-x: hidden
}

.sidebar::-webkit-scrollbar {
    width: 3px
}

.sidebar::-webkit-scrollbar-track {
    background: transparent
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px
}

.sidebar-logo {
    padding: 14px 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1)
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f7b731, #e8a020);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(247, 183, 49, 0.2)
}

.sidebar-logo .txt {
    font-weight: 700;
    color: #fff;
    font-size: 0.88rem;
    letter-spacing: 0.3px
}

.sidebar-logo .sub {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.28);
    display: block;
    margin-top: 1px
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 8px 6px;
    padding: 10px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(6,182,212,.08));
    border: 1px solid rgba(99,102,241,.18)
}

.sidebar-user .su-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(99,102,241,.35)
}

.sidebar-user .su-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,.6);
    flex-shrink: 0;
    display: inline-block
}

.sidebar-user .su-info {
    display: flex;
    flex-direction: column;
    min-width: 0
}

.sidebar-user .su-label {
    font-size: 0.5rem;
    color: #22c55e;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px
}

.sidebar-user .su-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.sidebar-nav {
    padding: 8px 6px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin
}

.nav-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 10px 6px;
    margin-top: 2px
}

.nav-divider span {
    font-size: 0.58rem;
    font-weight: 700;
    color: #f5a623;
    letter-spacing: 1.5px;
    white-space: nowrap
}

.nav-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(245, 166, 35, 0.25), transparent)
}

.nav-plant {
    padding: 5px 10px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    margin: 1px 0;
    transition: all .2s
}

.nav-plant:hover {
    background: rgba(255, 255, 255, 0.04)
}

.nav-plant .pdot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.45);
    flex-shrink: 0;
    transition: all .3s
}

.nav-plant .pname {
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    transition: color .2s
}

.nav-plant .parr {
    margin-left: auto;
    font-size: 0.42rem;
    color: rgba(255, 255, 255, 0.15);
    transition: all .3s
}

.nav-plant:hover .pname {
    color: rgba(255, 255, 255, 0.7)
}

.nav-plant.expanded .parr {
    transform: rotate(90deg);
    color: rgba(255, 255, 255, 0.3)
}

.nav-plant.expanded .pdot {
    background: #60a5fa;
    box-shadow: 0 0 6px rgba(96, 165, 250, 0.3)
}

.nav-plant.has-active .pdot {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.35)
}

.nav-plant.has-active .pname {
    color: #e2e8f0
}

.plant-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(.4, 0, .2, 1)
}

.plant-sub.open {
    max-height: 200px
}

.psw {
    padding: 2px 0 4px 18px;
    border-left: 2px solid rgba(59, 130, 246, 0.1);
    margin-left: 14px
}

.psw a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all .2s;
    margin: 1px 0
}

.psw a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7)
}

.psw a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.08));
    color: #60a5fa;
    font-weight: 600
}

.psw a i {
    width: 13px;
    text-align: center;
    font-size: 0.66rem;
    opacity: 0.5
}

.psw a:hover i {
    opacity: 0.8
}

.psw a.active i {
    opacity: 1
}

.nav-sec {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 10px 4px;
    margin-top: 2px
}

.nav-sec span {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 1.2px;
    white-space: nowrap
}

.nav-sec::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent)
}

.s-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: 0.73rem;
    font-weight: 500;
    transition: all .2s;
    margin: 1px 0
}

.s-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7)
}

.s-link.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.08));
    color: #60a5fa;
    font-weight: 600
}

.s-link i {
    width: 14px;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.45
}

.s-link:hover i {
    opacity: 0.8
}

.theme-sw {
    padding: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06)
}

.theme-sw .t-btns {
    display: flex;
    gap: 3px
}

.theme-sw .t-btn {
    flex: 1;
    padding: 5px 4px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.56rem;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all .2s
}

.theme-sw .t-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7)
}

.theme-sw .t-btn.on {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.3)
}

.theme-sw .t-btn i {
    font-size: 0.5rem
}

/* ── Main ── */
.main {
    margin-left: 200px;
    min-height: 100vh
}

.topbar {
    height: 42px;
    background: var(--pn);
    border-bottom: 1px solid var(--bd);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px)
}

.topbar h1 {
    font-size: .9rem;
    font-weight: 700;
    color: var(--tx)
}

.topbar .date {
    font-size: .68rem;
    color: var(--lb);
    margin-left: 8px
}

.topbar-r {
    display: flex;
    align-items: center;
    gap: 8px
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 500
}

.live-badge.err {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444
}

.live-dot {
    width: 5px;
    height: 5px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite
}

.live-badge.err .live-dot {
    background: #ef4444
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .3
    }
}

.up-time {
    font-size: 0.65rem;
    color: var(--lb)
}

.page {
    padding: 8px 12px
}

/* ── Responsive ── */