:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #0078d4;
    --success: #28a745;
    --danger: #dc3545;
    --border-color: #333;
    --radius-sm: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
}

header {
    background-color: var(--card-bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

h1 {
    margin: 0;
    font-size: 1.25rem;
}

.status {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #333;
}

.status.-connected {
    background: var(--success);
    color: white;
}

.status.-disconnected {
    background: var(--danger);
    color: white;
}

.controls {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#filterInput {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #333;
    background: #2d2d2d;
    color: white;
    width: 60%;
}

/* Login Styles */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.login-container input {
    margin: 10px 0;
    padding: 10px;
    width: 100%;
    max-width: 300px;
    background: #333;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
}

.login-container button {
    margin-top: 10px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.login-container button:hover {
    background: #0056b3;
}

.telemetry-grid {
    display: grid;
    /* Mobile First: Auto-fit columns min 100% or 300px */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #333;
    transition: transform 0.1s;
}

.card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--accent);
}

.card-row {
    display: flex;
    justify-content: space-between;
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.blink {
    animation: flash 1s;
}

@keyframes flash {
    0% {
        background-color: #333;
    }

    100% {
        background-color: var(--card-bg);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 75px;
    right: 20px;
    z-index: 1000;
    pointer-events: none; /* Allow clicks to pass through empty container space */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.toast {
    background: rgba(220, 38, 38, 0.95);
    /* Vibrant Alert Red */
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    border-left: 5px solid #ef4444;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards, fadeOut 0.5s forwards 4.5s;
    min-width: 320px;
    max-width: 420px;
    backdrop-filter: blur(10px);
    pointer-events: auto; /* Allow interactions on the toast itself */
    position: relative;
}

.toast-header {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    line-height: 1;
}

.toast-close-btn:hover {
    opacity: 1;
}

.toast-body {
    font-size: 1rem;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Alert History */
.history-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.history-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.-empty {
    color: var(--text-secondary);
    font-style: italic;
    justify-content: center;
    padding: 1.5rem;
}

.history-item .timestamp {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 1rem;
}

.history-item .message {
    font-weight: 500;
}

/* Modern Multi-Sensor UI & Aesthetics */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    padding: 1.25rem;
}

.sensor-card {
    background: #1b1e24;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #2d323e;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.sensor-card:hover {
    border-color: #0078d4;
    transform: translateY(-2px);
}

.sensor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sensor-title {
    display: flex;
    flex-direction: column;
}

.sensor-title h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #ffffff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sensor-tenant {
    font-size: 0.75rem;
    color: #8c93a0;
    margin-top: 2px;
}

.sensor-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(0, 120, 212, 0.15);
    color: #4da6ff;
    border: 1px solid rgba(0, 120, 212, 0.35);
}

.badge-refractometer {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
}

.badge-flow {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.4);
}

.badge-level {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.4);
}

/* Metric Display Cards inside Device Tile */
.metrics-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.metric-box {
    background: #14171d;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    border: 1px solid #262b35;
    display: flex;
    flex-direction: column;
}

.metric-box.primary-hero {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(20, 23, 29, 0.95) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    padding: 0.85rem 1rem;
}

.metric-label {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.primary-hero .metric-value {
    font-size: 1.85rem;
    color: #fbbf24;
}

.metric-unit {
    font-size: 0.8rem;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 2px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
    border-top: 1px solid #262b35;
    padding-top: 0.6rem;
    margin-top: 0.2rem;
}

.pulse-indicator {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    margin-right: 5px;
}

.raw-toggle-btn {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.raw-payload {
    font-size: 0.72rem;
    background: #0d1117;
    color: #7dd3fc;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #1e293b;
    max-height: 120px;
    overflow-y: auto;
    margin: 0;
}

/* --- Single User Multi-Device Fleet Enhancements --- */

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.btn-logout {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.btn-logout:hover {
    background: #30363d;
    color: #f85149;
}

/* KPI Summary Bar */
.kpi-summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 1rem 1.25rem 0.5rem 1.25rem;
}

.kpi-card {
    background: #181b21;
    border: 1px solid #262b35;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8c93a0;
    font-weight: 600;
}

.kpi-val {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    margin: 4px 0 2px 0;
}

.kpi-sub {
    font-size: 0.75rem;
    color: #64748b;
}

.kpi-highlight-gold .kpi-val { color: #fbbf24; }
.kpi-highlight-blue .kpi-val { color: #38bdf8; }
.kpi-highlight-green .kpi-val { color: #10b981; }

/* Controls & Toolbar */
.controls-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.25rem 0.25rem 1.25rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #181b21;
    border: 1px solid #262b35;
    border-radius: 6px;
    padding: 0 10px;
    min-width: 240px;
}

.search-box input {
    background: transparent;
    border: none;
    color: #f1f5f9;
    padding: 8px 0;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
}

.filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-chip-divider {
    width: 1px;
    height: 18px;
    background: #333a47;
    margin: 0 4px;
    flex-shrink: 0;
}

.chip {
    background: #1b1f27;
    border: 1px solid #2a313d;
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip:hover {
    background: #252b36;
    color: #e2e8f0;
}

.chip.active {
    background: #0078d4;
    border-color: #0078d4;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 120, 212, 0.4);
}

.chip.chip-live.active {
    background: #064e3b;
    border-color: #059669;
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.chip.chip-all.active {
    background: #1e293b;
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.live-dot-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: livePulse 1.8s infinite;
    display: inline-block;
}

@keyframes livePulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.chip {
    background: #1b1f27;
    border: 1px solid #2a313d;
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.chip:hover {
    background: #252b36;
    color: #e2e8f0;
}

.chip.active {
    background: #0078d4;
    border-color: #0078d4;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 120, 212, 0.4);
}

/* Master-Detail / Focus Layout */
.fleet-content-layout {
    display: flex;
    position: relative;
    width: 100%;
    align-items: flex-start;
}

.fleet-content-layout .grid {
    flex: 1;
    transition: width 0.2s ease;
}

.fleet-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    background: #14171d;
    border: 1px dashed #262b35;
    border-radius: 12px;
    text-align: center;
    color: #94a3b8;
    margin: 1rem 0;
}

.fleet-empty-state svg {
    margin-bottom: 12px;
    color: #64748b;
}

.fleet-empty-state h4 {
    margin: 0 0 6px 0;
    color: #f1f5f9;
    font-size: 1.05rem;
}

.fleet-empty-state p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    max-width: 420px;
}

.sensor-card {
    cursor: pointer;
}

.sensor-card.selected-focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3) !important;
}

/* Focus Drawer (Right side on desktop, bottom overlay on mobile) */
.focus-drawer {
    width: 380px;
    background: #161920;
    border-left: 1px solid #282e3b;
    padding: 1.25rem;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 12px 0 0 12px;
    margin: 1.25rem 1.25rem 1.25rem 0;
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    z-index: 50;
    animation: drawerSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlide {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.focus-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #262b35;
}

.focus-header h3 {
    margin: 4px 0 0 0;
    font-size: 1.15rem;
    color: #ffffff;
}

.focus-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
}

.focus-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
}

.focus-hero-box {
    margin: 1rem 0;
    background: #0f1217;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #222731;
}

.focus-hero-label {
    font-size: 0.72rem;
    color: #8c93a0;
    text-transform: uppercase;
}

.focus-hero-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fbbf24;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.focus-spec-range {
    font-size: 0.75rem;
    color: #10b981;
    margin-top: 4px;
}

.focus-chart-container {
    background: #0f1217;
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid #222731;
    margin-bottom: 1rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #8c93a0;
    margin-bottom: 6px;
}

#focus-sparkline-canvas {
    width: 100%;
    height: 90px;
    display: block;
}

.focus-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1.2rem;
}

.btn-focus-rule {
    width: 100%;
    background: #2563eb;
    color: white;
    border: none;
    padding: 9px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-focus-rule:hover {
    background: #1d4ed8;
}

.section-card {
    margin: 1.25rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid #262b35;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #14171d;
    border-top: 1px solid #242933;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(12px);
}

.nav-tab {
    background: transparent;
    border: none;
    color: #717d91;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 16px;
    transition: color 0.15s;
}

.nav-tab svg {
    transition: transform 0.15s;
}

.nav-tab:hover {
    color: #e2e8f0;
}

.nav-tab.active {
    color: #38bdf8;
}

.nav-tab.active svg {
    transform: translateY(-2px);
    stroke: #38bdf8;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .fleet-content-layout {
        flex-direction: column;
    }
    .focus-drawer {
        position: fixed;
        bottom: 60px;
        top: auto;
        left: 0;
        right: 0;
        width: auto;
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-top: 1px solid #333a47;
        margin: 0;
    }
}

@media (max-width: 640px) {
    header {
        padding: 0.6rem 0.85rem;
        gap: 8px;
    }

    .brand-logo {
        width: 30px;
        height: 30px;
        flex-shrink: 0;
    }

    .brand-logo svg {
        width: 18px;
        height: 18px;
    }

    header h1 {
        font-size: 0.95rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 155px;
    }

    header h1 + span {
        display: none; /* Hide subtitle on small mobile viewports to prevent wrapping */
    }

    .user-profile-badge {
        padding: 3px 6px !important;
        font-size: 0.72rem !important;
    }

    .user-profile-badge span:last-child {
        display: none; /* Hide '(Password)' label on mobile */
    }

    .status {
        font-size: 0.72rem;
        padding: 3px 6px;
    }

    .btn-logout {
        padding: 5px 7px;
    }

    /* 2x2 Compact KPI Grid instead of vertical stack */
    .kpi-summary-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0.6rem 0.75rem 0.25rem 0.75rem;
    }

    .kpi-card {
        padding: 0.6rem 0.75rem;
        border-radius: 8px;
    }

    .kpi-val {
        font-size: 1.3rem;
        margin: 2px 0;
    }

    .kpi-label {
        font-size: 0.65rem;
        letter-spacing: 0.3px;
    }

    .kpi-sub {
        font-size: 0.68rem;
    }

    /* Controls toolbar & search */
    .controls-toolbar {
        padding: 0.4rem 0.75rem;
        gap: 8px;
    }

    .search-box {
        min-width: 100%;
        order: 1;
    }

    .filter-chips {
        order: 2;
        width: 100%;
        padding-bottom: 4px;
    }

    #deviceCount {
        order: 3;
        font-size: 0.75rem !important;
        margin-left: 0 !important;
    }

    /* Sensor Grid */
    .grid {
        grid-template-columns: 1fr;
        padding: 0.6rem 0.75rem;
        gap: 0.75rem;
    }

    .sensor-card {
        padding: 0.9rem;
        border-radius: 10px;
    }

    .primary-hero .metric-value {
        font-size: 1.5rem;
    }

    /* Bottom Navigation Bar for Mobile */
    .bottom-nav {
        height: 56px;
        padding: 0 4px;
    }

    .nav-tab {
        font-size: 0.68rem;
        padding: 4px 8px;
        gap: 2px;
    }

    .nav-tab svg {
        width: 18px;
        height: 18px;
    }

    /* Range selector and filters in Data Explorer */
    .range-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .range-inputs .input-group {
        width: 100%;
    }

    .btn-apply-filter {
        width: 100%;
    }
}

/* Modal Overlay & Password Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: #1e2430;
    border: 1px solid #333a47;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #f1f5f9;
}

.modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    background: #14171d;
    border: 1px solid #333a47;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    margin-top: 4px;
}

.modal-input:focus {
    outline: none;
    border-color: #38bdf8;
}

/* Telemetry Explorer Layout */
.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1rem;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0284c7;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-export:hover {
    background: #0369a1;
}

.explorer-filter-bar {
    background: #181c24;
    border: 1px solid #272d3b;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.range-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-btn {
    background: #222734;
    border: 1px solid #333a47;
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.preset-btn.active, .preset-btn:hover {
    background: #0284c7;
    color: white;
    border-color: #0284c7;
}

.range-inputs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.range-inputs .input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.range-inputs label {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.range-inputs input, .range-inputs select {
    background: #14171d;
    border: 1px solid #333a47;
    border-radius: 6px;
    color: #f1f5f9;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.range-inputs input:focus, .range-inputs select:focus {
    outline: none;
    border-color: #38bdf8;
}

.btn-apply-filter {
    background: #10b981;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    height: 32px;
}

.btn-apply-filter:hover {
    background: #059669;
}

/* Analytics Trend Chart Card */
.analytics-chart-card {
    background: #181c24;
    border: 1px solid #272d3b;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 1rem;
}

/* Telemetry Data Table */
.table-container {
    overflow-x: auto;
    border: 1px solid #272d3b;
    border-radius: 8px;
    background: #14171d;
}

.telemetry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.telemetry-table th {
    background: #1a1f29;
    padding: 10px 12px;
    color: #94a3b8;
    font-weight: 600;
    border-bottom: 1px solid #272d3b;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.telemetry-table th:hover {
    color: #38bdf8;
}

.telemetry-table th .sort-icon {
    font-size: 0.75rem;
    margin-left: 4px;
    color: #38bdf8;
}

.telemetry-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #1e2430;
    color: #e2e8f0;
    white-space: nowrap;
}

.telemetry-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.05);
}

.table-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-stale {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 4px 4px 4px;
}

.pagination-info {
    font-size: 0.8rem;
    color: #94a3b8;
}

.page-size-select {
    background: #1e2430;
    border: 1px solid #333a47;
    color: #cbd5e1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.pagination-buttons button {
    background: #1e2430;
    border: 1px solid #333a47;
    color: #cbd5e1;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.pagination-buttons button:hover:not(:disabled) {
    background: #0284c7;
    color: white;
    border-color: #0284c7;
}

.pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Relative time indicator on cards */
.time-ago {
    font-size: 0.72rem;
    margin-left: 4px;
    color: #94a3b8;
}

.time-ago.stale {
    color: #f87171;
    font-weight: 600;
}