/* ============================================================
   SI-POLA Web Monitoring — Design System v3
   Premium Industrial IoT Dashboard
   Inspired by SmartEnergy AdminUIUX + modern glassmorphism
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
    /* Layout */
    --sidebar-w:     256px;
    --header-h:      64px;
    --radius:        14px;
    --radius-sm:     10px;
    --radius-xs:     7px;
    --radius-pill:   50px;

    /* Base Colors - Dark Mode */
    --bg-base:       #080d1a;
    --bg-surface:    #0d1426;
    --bg-card:       #111827;
    --bg-card-2:     #161e2e;
    --bg-hover:      #1c2437;
    --bg-input:      #0f1624;
    --bg-overlay:    rgba(8, 13, 26, 0.85);

    /* Borders */
    --border:        rgba(255, 255, 255, 0.06);
    --border-hover:  rgba(255, 255, 255, 0.11);
    --border-active: rgba(32, 118, 165, 0.55);
    --border-card:   rgba(255, 255, 255, 0.04);

    /* Accent — Electric Blue / Purple */
    --accent:        #2076a5;
    --accent-2:      #309476;
    --accent-3:      #06b6d4;
    --accent-dim:    rgba(32, 118, 165, 0.13);
    --accent-glow:   rgba(32, 118, 165, 0.28);
    --accent-bright: #3ea5db;

    /* Semantic */
    --success:       #22c55e;
    --success-dim:   rgba(34, 197, 94, 0.12);
    --success-glow:  rgba(34, 197, 94, 0.25);
    --warning:       #f59e0b;
    --warning-dim:   rgba(245, 158, 11, 0.12);
    --danger:        #ef4444;
    --danger-dim:    rgba(239, 68, 68, 0.12);
    --danger-glow:   rgba(239, 68, 68, 0.3);
    --info:          #38bdf8;
    --info-dim:      rgba(56, 189, 248, 0.12);

    /* Alarm Colors — complete system */
    --alarm-HH:         #ef4444;
    --alarm-HH-bg:      rgba(239, 68, 68, 0.10);
    --alarm-HH-border:  rgba(239, 68, 68, 0.30);
    --alarm-HH-glow:    rgba(239, 68, 68, 0.40);
    --alarm-H:          #f97316;
    --alarm-H-bg:       rgba(249, 115, 22, 0.10);
    --alarm-H-border:   rgba(249, 115, 22, 0.30);
    --alarm-H-glow:     rgba(249, 115, 22, 0.35);
    --alarm-L:          #eab308;
    --alarm-L-bg:       rgba(234, 179, 8, 0.10);
    --alarm-L-border:   rgba(234, 179, 8, 0.30);
    --alarm-L-glow:     rgba(234, 179, 8, 0.35);
    --alarm-LL:         #38bdf8;
    --alarm-LL-bg:      rgba(56, 189, 248, 0.10);
    --alarm-LL-border:  rgba(56, 189, 248, 0.30);
    --alarm-LL-glow:    rgba(56, 189, 248, 0.35);
    --alarm-normal:     #22c55e;
    --alarm-normal-bg:  rgba(34, 197, 94, 0.10);
    --alarm-offline:    #475569;
    --alarm-offline-bg: rgba(71, 85, 105, 0.12);

    /* Gradients */
    --grad-accent:   linear-gradient(135deg, #2076a5 0%, #309476 100%);
    --grad-accent-h: linear-gradient(135deg, #3ea5db 0%, #4fcfab 100%);
    --grad-success:  linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --grad-danger:   linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --grad-warning:  linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --grad-info:     linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    --grad-HH:       linear-gradient(135deg, #ef4444, #b91c1c);
    --grad-H:        linear-gradient(135deg, #f97316, #c2410c);
    --grad-L:        linear-gradient(135deg, #eab308, #a16207);
    --grad-LL:       linear-gradient(135deg, #38bdf8, #0284c7);
    --grad-surface:  linear-gradient(180deg, #0d1426 0%, #080d1a 100%);

    /* Text */
    --text-primary:  #f0f4ff;
    --text-secondary:#8899bb;
    --text-muted:    #3d5080;

    /* Shadows */
    --shadow-sm:     0 1px 4px rgba(0,0,0,0.4);
    --shadow-md:     0 4px 20px rgba(0,0,0,0.5);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.6);
    --shadow-accent: 0 4px 24px rgba(32, 118, 165, 0.28);
    --shadow-card:   0 2px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);

    /* Transitions */
    --transition:      all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Light Theme ────────────────────────────────────────── */
[data-theme="light"] {
    --bg-base:       #f0f4ff;
    --bg-surface:    #ffffff;
    --bg-card:       #ffffff;
    --bg-card-2:     #f6f8ff;
    --bg-hover:      #eef2ff;
    --bg-input:      #f8faff;
    --bg-overlay:    rgba(240, 244, 255, 0.9);

    --border:        rgba(32, 118, 165, 0.10);
    --border-hover:  rgba(32, 118, 165, 0.18);
    --border-card:   rgba(32, 118, 165, 0.06);

    --text-primary:  #0a0f2e;
    --text-secondary:#4a5680;
    --text-muted:    #94a3c8;

    --shadow-sm:     0 1px 4px rgba(32, 118, 165, 0.08);
    --shadow-md:     0 4px 20px rgba(32, 118, 165, 0.10);
    --shadow-lg:     0 12px 40px rgba(32, 118, 165, 0.12);
    --shadow-card:   0 2px 12px rgba(32, 118, 165, 0.08), inset 0 1px 0 rgba(255,255,255,0.8);
    --shadow-accent: 0 4px 24px rgba(32, 118, 165, 0.22);
    --bg-overlay:    rgba(240, 244, 255, 0.8);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.8; }
svg {
    flex-shrink: 0;
    max-width: 100%;
    vertical-align: middle;
}

/* Monospace numbers for metrics */
.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    min-height: 100vh;
}

.main-content {
    grid-column: 2;
    grid-row: 2;
    padding: 28px 32px;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-h));
    background: var(--bg-base);
    transition: var(--transition-slow);
}

/* ─── Header ─────────────────────────────────────────────── */
.header {
    grid-column: 1 / -1;
    grid-row: 1;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 0;
    z-index: 100;
    position: sticky;
    top: 0;
    backdrop-filter: blur(20px);
}

.header-brand {
    display: flex;
    align-items: center;
    width: var(--sidebar-w);
    padding: 0 20px;
    border-right: 1px solid var(--border);
    height: 100%;
    flex-shrink: 0;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.header-logo img { width: 100%; height: 100%; object-fit: contain; }

.header-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.header-subtitle {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 0 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Search */
.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    min-width: 220px;
    transition: var(--transition);
}
.header-search:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.header-search svg { width: 14px; height: 14px; color: var(--text-muted); }
.header-search input {
    background: none;
    border: none;
    outline: none;
    font-size: 0.82rem;
    color: var(--text-primary);
    width: 100%;
    font-family: 'Inter', sans-serif;
}
.header-search input::placeholder { color: var(--text-muted); }

/* Clock */
.header-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    padding: 0 6px;
}
.clock-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}
.clock-time {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

/* Icon buttons */
.header-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.header-btn svg { width: 17px; height: 17px; }

/* User badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 6px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    margin-left: 4px;
}
.user-badge:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.user-info-text { display: flex; flex-direction: column; gap: 1px; }
.user-name  { font-size: 0.8rem; font-weight: 600; line-height: 1.1; }
.user-role  { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 16px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    transition: var(--transition-slow);
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.nav-section-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0 12px;
    margin: 20px 0 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    text-decoration: none;
    position: relative;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent-bright);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    background: var(--grad-accent);
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.65;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-text { white-space: nowrap; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
    animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

/* Sidebar footer — connection status */
.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 4px;
    border-top: 1px solid var(--border);
}
.conn-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
    padding: 5px 2px;
}
.conn-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239,68,68,0.2);
    flex-shrink: 0;
    transition: var(--transition);
}
.conn-dot.online {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.2), 0 0 8px rgba(34,197,94,0.4);
    animation: pulse-online 2.5s infinite;
}
.conn-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.2), 0 0 8px rgba(239,68,68,0.4);
}
@keyframes pulse-online {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
    60%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ─── Sidebar Collapse ────────────────────────────────────── */
body.sidebar-minimized {
    --sidebar-w-eff: 64px;
}
body.sidebar-minimized .sidebar {
    width: 64px;
    padding: 16px 8px;
}
body.sidebar-minimized .nav-text,
body.sidebar-minimized .nav-section-label,
body.sidebar-minimized .nav-badge,
body.sidebar-minimized .sidebar-footer .conn-item span:last-child,
body.sidebar-minimized .header-brand > div:last-child {
    display: none;
}
body.sidebar-minimized .header-brand { width: 64px; padding: 0 14px; justify-content: center; }
body.sidebar-minimized .main-content { grid-column: 2; }
body.sidebar-minimized .app-layout { grid-template-columns: 64px 1fr; }
body.sidebar-minimized .nav-item { justify-content: center; padding: 10px; }
body.sidebar-minimized .nav-icon { opacity: 1; width: 22px; height: 22px; }

/* ─── Sidebar Mobile ──────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 80;
    backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-h) 1fr;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-h);
        height: calc(100vh - var(--header-h));
        transform: translateX(-100%);
        z-index: 95;
        width: var(--sidebar-w);
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-mobile-open .sidebar { transform: translateX(0); }
    body.sidebar-mobile-open .sidebar-overlay { display: block; }
    .main-content { grid-column: 1; padding: 20px 16px; }
    .header-brand { width: auto; border-right: none; }
    .header-search { display: none; }
    .header-time { display: none; }
}

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 400;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── Status Bar ──────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.status-bar-item { display: flex; align-items: center; gap: 6px; }
.status-bar-divider { width: 1px; height: 14px; background: var(--border); }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 18px; height: 18px; }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 2px;
}

/* ─── Summary Chart Area ─────────────────────────────────── */
.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.chart-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
}
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.chart-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.chart-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.chart-wrap {
    position: relative;
    height: 180px;
}

.tanks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
}

/* ─── Tank Card v3 — Premium 3D Industrial ───────────────── */
.tank-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tank-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.tank-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--border-hover);
    transform: translateY(-3px);
}

/* Alarm state borders */
.tank-card.alarm-HH {
    border-color: var(--alarm-HH-border);
    animation: glow-HH 2s infinite;
}
.tank-card.alarm-H {
    border-color: var(--alarm-H-border);
    animation: glow-H 2.5s infinite;
}
.tank-card.alarm-L {
    border-color: var(--alarm-L-border);
}
.tank-card.alarm-LL {
    border-color: var(--alarm-LL-border);
}
.tank-card.offline {
    opacity: 0.65;
    border-color: var(--border);
}

@keyframes glow-HH {
    0%, 100% { box-shadow: var(--shadow-card), 0 0 0 0 var(--alarm-HH-glow); }
    50%       { box-shadow: var(--shadow-card), 0 0 20px 2px var(--alarm-HH-glow); }
}
@keyframes glow-H {
    0%, 100% { box-shadow: var(--shadow-card), 0 0 0 0 var(--alarm-H-glow); }
    50%       { shadow: var(--shadow-card), 0 0 16px 2px var(--alarm-H-glow); }
}

/* Card Header */
.tank-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.tank-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-bright);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--accent-dim);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 4px;
}
.tank-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.tank-location {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.tank-location svg { width: 11px; height: 11px; }

/* Alarm Badge */
.alarm-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.alarm-badge.HH     { background: var(--alarm-HH-bg); color: var(--alarm-HH); border: 1px solid var(--alarm-HH-border); }
.alarm-badge.H      { background: var(--alarm-H-bg);  color: var(--alarm-H);  border: 1px solid var(--alarm-H-border); }
.alarm-badge.L      { background: var(--alarm-L-bg);  color: var(--alarm-L);  border: 1px solid var(--alarm-L-border); }
.alarm-badge.LL     { background: var(--alarm-LL-bg); color: var(--alarm-LL); border: 1px solid var(--alarm-LL-border); }
.alarm-badge.Normal { background: var(--alarm-normal-bg); color: var(--alarm-normal); border: 1px solid rgba(34,197,94,0.25); }
.alarm-badge.Offline{ background: var(--alarm-offline-bg); color: var(--alarm-offline); border: 1px solid rgba(71,85,105,0.3); }

/* ─── 3D Wide Industrial Storage Tank Visual ─────────────── */
.tank-visual-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 6px 0;
}

.tank-cylinder-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tank-cylinder {
    width: 220px;
    height: 145px;
    position: relative;
}

.tank-value-block {
    display: none; /* Hide the old right side value block */
}

.tank-percent-display {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
}
.tank-percent-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    transition: color 0.4s ease;
}
.tank-percent-unit {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}
.tank-cm-display {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}
.tank-raw-display {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.tank-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
    background: var(--bg-hover);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-card);
}

/* Tank Footer */
.tank-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.tank-footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* ─── Kondisi Sensor Title ────────────────────────────────── */
.kondisi-sensor-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 8px;
    margin-bottom: 4px;
    padding-left: 4px;
}
.kondisi-sensor-title .dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Sensor Cards Row (Bottom of Tank Card) ──────────────── */
.tank-sensors-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.sensor-card-modern {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s;
}
.sensor-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.scm-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    width: 100%;
    justify-content: center;
}
.scm-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.scm-icon svg { width: 14px; height: 14px; }
.scm-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.scm-value {
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}
.scm-unit {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}
.scm-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.scm-status.normal { color: #10b981; }
.scm-status.alarm  { color: #ef4444; }

/* Tank cylinder responsive */
.tank-cylinder-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tank-cylinder {
    width: 100%;
    max-width: 800px;
    height: auto;
    position: relative;
}

/* Responsive sensor cards */
@media (max-width: 1200px) {
    .tank-sensors-row {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .tank-sensors-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .scm-value { font-size: 0.95rem; }
}


/* ─── Horizontal Gauge Bar (legacy compat) ────────────────── */
.gauge-container {
    display: flex;
    align-items: center;
    gap: 14px;
}
.gauge-bar-wrap { flex: 1; }
.gauge-bar {
    height: 10px;
    background: var(--bg-hover);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}
.gauge-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--grad-accent);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.gauge-fill::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 6px;
    background: rgba(255,255,255,0.4);
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}
.gauge-fill.alarm-HH { background: var(--grad-HH); }
.gauge-fill.alarm-H  { background: var(--grad-H); }
.gauge-fill.alarm-L  { background: var(--grad-L); }
.gauge-fill.alarm-LL { background: var(--grad-LL); }

.gauge-thresholds {
    display: flex;
    justify-content: space-between;
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-top: 5px;
}
.gauge-value-block { text-align: right; flex-shrink: 0; }
.gauge-percent {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}
.gauge-percent.alarm-HH { color: var(--alarm-HH); }
.gauge-percent.alarm-H  { color: var(--alarm-H); }
.gauge-percent.alarm-L  { color: var(--alarm-L); }
.gauge-percent.alarm-LL { color: var(--alarm-LL); }
.gauge-unit { font-size: 0.7rem; color: var(--text-muted); }
.gauge-cm   { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--grad-accent);
    color: #fff;
    box-shadow: var(--shadow-accent);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(32, 118, 165,0.45); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border-color: var(--border-hover);
    color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-active); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-sm svg { width: 13px; height: 13px; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--info-dim);    color: var(--info); }
.badge-accent  { background: var(--accent-dim);  color: var(--accent-bright); }

/* ─── Loading Skeleton ────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-card);
}
.skeleton-line { height: 12px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-bar { height: 80px; border-radius: var(--radius-sm); }

/* ─── Loading Spinner ─────────────────────────────────────── */
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
}
.empty-state svg { width: 56px; height: 56px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 0.82rem; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    flex-shrink: 0;
    color: var(--accent-bright);
}
.card-body { padding: 20px; }

/* Disable transitions during theme switch for instant, lightweight switching */
html.theme-changing,
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
    transition: none !important;
}

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    background: var(--bg-card-2);
    white-space: nowrap;
}
tbody td {
    padding: 12px 14px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}
tbody tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Forms & Inputs ─────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    font-size: 0.84rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.form-control:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ─── Modals ─────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8,13,26,0.8);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-backdrop.show { opacity: 1; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96) translateY(10px);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-backdrop.show .modal { transform: scale(1) translateY(0); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    padding: 16px 0;
}
.page-btn {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    padding: 0 8px;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.page-btn.active { background: var(--accent-dim); color: var(--accent-bright); border-color: var(--border-active); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    font-size: 0.84rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-icon { flex-shrink: 0; display: flex; align-items: center; }
.toast-icon svg { width: 18px; height: 18px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success .toast-icon svg { color: var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error   .toast-icon svg { color: var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning .toast-icon svg { color: var(--warning); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.info    .toast-icon svg { color: var(--accent); }

/* ─── Utilities ──────────────────────────────────────────── */
.hidden { display: none !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-accent  { color: var(--accent)  !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.fw-700       { font-weight: 700; }

/* ─── Login Page ─────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(32, 118, 165,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(139,92,246,0.10) 0%, transparent 60%),
        var(--bg-base);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border: 1px solid rgba(32, 118, 165,0.06);
    border-radius: 50%;
    top: -200px; left: -200px;
    pointer-events: none;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border: 1px solid rgba(32, 118, 165,0.05);
    border-radius: 50%;
    bottom: -100px; right: -100px;
    pointer-events: none;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(32, 118, 165,0.08);
    position: relative;
    z-index: 1;
}
.login-logo {
    width: 52px; height: 52px;
    background: var(--grad-accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-accent);
}
.login-logo svg { width: 26px; height: 26px; color: #fff; }
.login-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.login-subtitle {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* ─── Alarm Feed Panel ────────────────────────────────────── */
.alarm-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alarm-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    transition: var(--transition);
}
.alarm-feed-item:hover { background: var(--bg-hover); }
.alarm-feed-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}
.alarm-feed-dot.HH { background: var(--alarm-HH); box-shadow: 0 0 6px var(--alarm-HH); }
.alarm-feed-dot.H  { background: var(--alarm-H);  box-shadow: 0 0 6px var(--alarm-H); }
.alarm-feed-dot.L  { background: var(--alarm-L);  box-shadow: 0 0 6px var(--alarm-L); }
.alarm-feed-dot.LL { background: var(--alarm-LL); box-shadow: 0 0 6px var(--alarm-LL); }

/* ─── Responsive Grid ─────────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .tanks-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 600px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .tanks-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.5rem; }
    .main-content { padding: 16px; }
    .page-header { margin-bottom: 20px; }
    .toast-container { bottom: 12px; right: 12px; left: 12px; }
    .toast { min-width: unset; max-width: unset; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM SENSOR MONITORING CARDS — Glassmorphism + Gradient
   ═══════════════════════════════════════════════════════════════ */

/* ─── Kondisi Sensor Title ─────────────────────────────────── */
.kondisi-sensor-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 4px;
    margin: 16px 0 10px;
}
.kondisi-sensor-title .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* ─── Tank Sensors Row (Grid) ──────────────────────────────── */
.tank-sensors-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 0 4px;
}

/* ─── Premium Sensor Card (Modern) ─────────────────────────── */
.sensor-card-modern {
    background: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.sensor-card-modern::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.sensor-card-modern:hover {
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.sensor-card-modern:hover::before {
    opacity: 1;
}

/* Sensor card alarm state */
.sensor-card-modern.alarm-active {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(145deg, rgba(239,68,68,0.06) 0%, rgba(239,68,68,0.02) 100%);
    animation: sensor-alarm-glow 2s ease-in-out infinite;
}
@keyframes sensor-alarm-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(239,68,68,0.1); }
    50% { box-shadow: 0 0 16px rgba(239,68,68,0.25); }
}

.scm-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.scm-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.scm-icon svg {
    width: 15px; height: 15px;
}
.scm-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.scm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.scm-unit {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}
.scm-status {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 20px;
    width: fit-content;
}
.scm-status.normal {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.scm-status.alarm {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
    animation: alarm-pulse 1.5s ease-in-out infinite;
}
@keyframes alarm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─── Sensor Category Headers ──────────────────────────────── */
.sensor-category {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 0 4px;
    grid-column: 1 / -1;
}
.sensor-category .cat-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   TREND SENSOR SELECTOR BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.trend-sensor-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 0;
}
.trend-sensor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid var(--border-card);
    background: var(--bg-card-2);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}
.trend-sensor-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-secondary);
    transform: translateY(-1px);
}
.trend-sensor-btn.active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    transform: translateY(-1px);
}
.trend-sensor-btn .btn-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}
/* Color variants */
.trend-sensor-btn[data-sensor="level"].active { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.trend-sensor-btn[data-sensor="level"] .btn-dot { background: #3b82f6; }

.trend-sensor-btn[data-sensor="tds"].active { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.trend-sensor-btn[data-sensor="tds"] .btn-dot { background: #a855f7; }

.trend-sensor-btn[data-sensor="flow1"].active { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.trend-sensor-btn[data-sensor="flow1"] .btn-dot { background: #0ea5e9; }

.trend-sensor-btn[data-sensor="flow2"].active { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.trend-sensor-btn[data-sensor="flow2"] .btn-dot { background: #06b6d4; }

.trend-sensor-btn[data-sensor="ph"].active { background: linear-gradient(135deg, #ec4899, #db2777); }
.trend-sensor-btn[data-sensor="ph"] .btn-dot { background: #ec4899; }

.trend-sensor-btn[data-sensor="all"].active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.trend-sensor-btn[data-sensor="all"] .btn-dot {
    background: conic-gradient(#3b82f6, #a855f7, #0ea5e9, #06b6d4, #ec4899, #3b82f6);
}

/* ─── Detail Sensor Grid (for tank-detail page) ────────────── */
.detail-sensors-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

/* ─── Threshold Tabs ───────────────────────────────────────── */
.threshold-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}
.threshold-tab {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid var(--border-card);
    background: var(--bg-card-2);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.threshold-tab:hover { background: var(--bg-hover); color: var(--text-secondary); }
.threshold-tab.active {
    background: var(--accent-dim);
    color: var(--accent-bright);
    border-color: var(--border-active);
}

/* ─── Detail Value Cards ───────────────────────────────────── */
.detail-sensor-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.3s;
}
.detail-sensor-card:hover {
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.dsc-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dsc-label .dsc-icon {
    width: 24px; height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dsc-label .dsc-icon svg {
    width: 13px; height: 13px;
}
.dsc-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}
.dsc-unit {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}
.dsc-status {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 20px;
    width: fit-content;
}
.dsc-status.normal {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}
.dsc-status.alarm {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* ─── Responsive Sensor Grid ───────────────────────────────── */
@media (max-width: 768px) {
    .tank-sensors-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .detail-sensors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .trend-sensor-selector {
        gap: 4px;
    }
    .trend-sensor-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
}
@media (max-width: 480px) {
    .tank-sensors-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .detail-sensors-grid {
        grid-template-columns: 1fr 1fr;
    }
}
