* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #bdc3c7;
    --success-color: #27ae60;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: var(--dark-color);
    overflow: hidden; /* Prevent outer body scrollbar since main-content handles scrolling */
}

/* Print styles for A4 portrait */
@media print {
    @page { size: A4 portrait; margin: 12mm; }

    body { overflow: visible !important; background: white !important; }
    .header, .sidebar, .nav, .connection-status, .header-right { display: none !important; }
    .container { display: block !important; height: auto !important; }
    .main-content { padding: 0 !important; margin: 0 !important; overflow: visible !important; height: auto !important; }

    /* Show only Reports view and specifically Facility tab if present */
    .view { display: none !important; }
    #view-reports.view { display: block !important; }
    #view-reports .tab-pane { display: none !important; }
    #tab-facility-report.tab-pane { display: block !important; }

    /* Compact spacing */
    .stats-grid { gap: 8px !important; margin-bottom: 10px !important; grid-template-columns: repeat(2, minmax(140px, 1fr)) !important; }
    .stat-card { box-shadow: none !important; padding: 10px !important; }
    .stat-value { font-size: 1.4rem !important; }
    .card { box-shadow: none !important; border: 1px solid #e5e7eb !important; page-break-inside: auto; break-inside: auto; }
    .card-header { padding: 6px 8px !important; }
    .card-body { padding: 8px !important; }
    canvas { max-width: 100% !important; height: auto !important; }

    /* Page breaks */
    .report-panel { page-break-inside: auto; break-inside: auto; }
    #facility-report-table { page-break-inside: auto; break-inside: auto; }
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-left h1 {
    font-size: 1.5rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success-color);
}

.status-dot.offline {
    background: var(--danger-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Outbox status banner (always visible in header) */
.outbox-status-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    color: #fff;
    font-weight: 600;
    transition: background 0.3s;
}

.outbox-status-banner.idle {
    background: rgba(255,255,255,0.15);
}

.outbox-status-banner.busy {
    background: rgba(231, 76, 60, 0.35);
}

.outbox-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.outbox-status-dot.idle {
    background: #27ae60;
}

.outbox-status-dot.busy {
    background: #e74c3c;
    animation: pulse 1s infinite;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #27ae60;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.container {
    display: flex;
    height: calc(100vh - 80px);
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    overflow-y: auto;
}

.nav {
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--light-color);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: #e3f2fd;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.3rem;
}

.main-content {
    flex: 1;
    padding: 2rem;
    padding-right: 1rem; /* Reduce right padding to make room for scrollbar */
    margin-right: 20px; /* Space between inner scrollbar and outer scrollbar */
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--light-color);
}

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

.activity-icon {
    font-size: 1.5rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--dark-color);
}

.activity-time {
    font-size: 0.85rem;
    color: #95a5a6;
}

.toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-color);
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

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

.nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.node-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

.node-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

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

.node-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark-color);
}

.node-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.node-status.online {
    background: #d4edda;
    color: var(--success-color);
}

.node-status.offline {
    background: #f8d7da;
    color: var(--danger-color);
}

.node-info {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.node-info-row {
    display: flex;
    justify-content: space-between;
}

.node-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.node-actions button {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.commands-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .commands-container {
        grid-template-columns: 1fr;
    }
}

.command-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ack-log-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.ack-log-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--light-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px 10px 0 0;
}

.ack-log-panel .panel-header label {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    margin: 0;
}

.btn-clear {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.ack-log-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8f9fa;
}

.ack-log-content::-webkit-scrollbar {
    width: 8px;
}

.ack-log-content::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.ack-log-content::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.ack-log-content::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

.ack-log-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid transparent;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ack-log-item.success {
    border-left-color: var(--success-color);
}

.ack-log-item.error {
    border-left-color: var(--danger-color);
}

.ack-log-item.info {
    border-left-color: var(--primary-color);
}

.ack-log-item .timestamp {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.ack-log-item .node-id {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.ack-log-item .command-name {
    color: var(--primary-color);
    font-weight: 500;
}

.ack-log-item .status {
    font-size: 0.85rem;
    color: #495057;
}

.ack-log-item .ack-source {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.ack-log-item.command-sent .ack-source {
    background: #e3f2fd;
    color: #1976d2;
}

.ack-log-item.sensor-response .ack-source {
    background: #e8f5e9;
    color: #388e3c;
}

.ack-log-item.sensor-response {
    border-left-color: #4caf50;
    background: linear-gradient(135deg, #f1f8e9 0%, #ffffff 100%);
}

.ack-log-item .ack-message {
    font-size: 0.85rem;
    color: #2e7d32;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 3px solid #4caf50;
    word-break: break-word;
}

.ack-log-item .ack-extra-info {
    font-size: 0.75rem;
    color: #757575;
    margin-top: 0.25rem;
    font-family: 'Courier New', monospace;
}

.ack-log-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
    font-style: italic;
}

.log-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.log-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.log-list::-webkit-scrollbar {
    width: 10px;
}

.log-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.log-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.log-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.log-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    border-left: 4px solid transparent;
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    animation: slideInFromRight 0.3s ease-out;
}

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

.log-item.sensor-data {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-left-color: #06d6a0;
}

.log-item.error-data {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    border-left-color: #dc2626;
}

.log-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.log-item-node {
    font-size: 1.1rem;
}

.log-item-time {
    font-size: 0.85rem;
    opacity: 0.9;
}

.log-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.log-detail {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem;
    border-radius: 4px;
}

.log-detail-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.log-detail-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.log-count {
    color: #6c757d;
    font-weight: 600;
}

.log-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.log-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-color);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.cmd-params {
    display: grid;
    gap: 1rem;
}

.cmd-result {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}

.cmd-result.success {
    display: block;
    background: #d4edda;
    color: var(--success-color);
}

.cmd-result.error {
    display: block;
    background: #f8d7da;
    color: var(--danger-color);
}

.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: var(--dark-color);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-color);
}

.history-table tr:hover {
    background: #f8f9fa;
}

.system-info {
    display: grid;
    gap: 2rem;
}

.info-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.info-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 8px;
}

.status-label {
    font-weight: 600;
    color: var(--dark-color);
}

.status-value {
    color: #7f8c8d;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: var(--success-color);
}

.badge-danger {
    background: #f8d7da;
    color: var(--danger-color);
}

.badge-warning {
    background: #fff3cd;
    color: var(--warning-color);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--light-color);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #7f8c8d;
    transition: all 0.3s;
}

.tab-button:hover {
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
}

.tab-content {
    margin-bottom: 2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.commission-panel,
.testing-panel {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 600px;
}

.commission-panel h3,
.testing-panel h3 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}


.setup-ack-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
    font-style: italic;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--light-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px 10px 0 0;
}

.modal-header h3 {
    color: white;
    margin: 0;
}

.modal-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--light-color);
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
}

/* Sensor Table Styling */
.sensor-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
}

.sensor-table-header {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sensor-table-header h3 {
    color: #2e7d32;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sensor-table-count {
    background: rgba(46, 125, 50, 0.15);
    color: #2e7d32;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.sensor-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 700px;
}

/* Node Management: make table area scroll within view */
#view-nodes .sensor-table-wrapper {
    max-height: 70vh;
}

.sensor-table-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sensor-table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

.sensor-table-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

.sensor-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    background: #f8fafc;
    color: #334155;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 1.2rem 1.5rem;
    color: #475569;
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table td:first-child {
    font-weight: 600;
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.data-table tbody tr td {
    background: white;
}

.sensor-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #94a3b8;
}

.sensor-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.sensor-empty-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Alternating row colors for better readability */
.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.data-table tbody tr:nth-child(even):hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .nav-item span:not(.nav-icon) {
        display: none;
    }

    .header-left h1 {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs {
        overflow-x: auto;
    }

    .commission-panel,
    .testing-panel {
        max-width: 100%;
    }

    .modal-content {
        max-width: 95%;
    }

    .data-table th,
    .data-table td {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }

    .sensor-table-header h3 {
        font-size: 1.1rem;
    }
}

/* ========================================================================
   LinkNodes Styles
   ======================================================================== */

.linknode-tree {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.linknode-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.linknode-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.linknode-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.linknode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.linknode-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.linknode-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
}

.linknode-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.linknode-detail-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.detail-label {
    font-weight: 600;
    color: #64748b;
    min-width: 120px;
}

.detail-value {
    color: #334155;
    font-family: 'Courier New', monospace;
    flex: 1;
    word-break: break-all;
}

.linknode-details-card {
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 1.25rem;
}

.linknode-details-card h4 {
    margin: 0 0 1rem 0;
    color: #667eea;
    font-size: 1.1rem;
}

.details-grid {
    display: grid;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-row .detail-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row .detail-value {
    font-size: 0.95rem;
    color: #1e293b;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

/* LinkNode Command Results */
#linknode-command-results {
    max-height: 300px;
    overflow-y: auto;
}

/* Empty State for LinkNodes */
.sensor-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.sensor-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sensor-empty-text {
    color: #64748b;
    font-size: 1rem;
}

/* ========================================================================
   Router Monitoring Styles (AutoDetect Tab)
   ======================================================================== */

.router-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.router-count-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Router Icon Grid */
.router-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    min-height: 180px;
}

.router-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.router-icon-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.router-icon-container.online {
    border-color: #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(76, 175, 80, 0.02) 100%);
}

.router-icon-container.offline {
    border-color: #757575;
    background: linear-gradient(135deg, rgba(117, 117, 117, 0.05) 0%, rgba(117, 117, 117, 0.02) 100%);
}

.router-icon-container.heartbeat-flash {
    border-color: #f44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15) 0%, rgba(244, 67, 54, 0.05) 100%);
    animation: pulse-glow 300ms ease-out;
}

.router-icon-container.heartbeat-flash .router-eui64 {
    background: rgba(244, 67, 54, 0.2);
    color: #d32f2f;
}

@keyframes pulse-glow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px 10px rgba(244, 67, 54, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

.router-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.router-icon-container.online .router-icon {
    filter: brightness(1.2) saturate(1.3);
}

.router-icon-container.offline .router-icon {
    filter: grayscale(100%) brightness(0.6);
    opacity: 0.5;
}

.router-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.router-status-indicator.online {
    background: #4CAF50;
}

.router-status-indicator.offline {
    background: #757575;
}

/* LinkNode heartbeat blink control (dark green) */
.router-status-indicator.Link_node_iocn_blinkf_ctrl {
    background-color: #7f1d1d !important; /* force initial dark red */
    box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.65);
    animation: linknode-blink-red-green 1200ms ease-out; /* extended for prominence */
    animation-fill-mode: both;
    will-change: background-color, transform, box-shadow;
}

@keyframes linknode-blink-red-green {
    0% {
        background-color: #7f1d1d; /* dark red */
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.65); /* red glow */
    }
    50% {
        background-color: #b91c1c; /* vivid red */
        transform: scale(1.25);
        box-shadow: 0 0 12px 8px rgba(185, 28, 28, 0.35);
    }
    100% {
        background-color: #065f46; /* dark green */
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
    }
}

.router-label {
    text-align: center;
    font-family: monospace;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.router-eui64 {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 4px;
    background: rgba(44, 62, 80, 0.08);
    border-radius: 3px;
}

.router-ipv6 {
    font-size: 0.75rem;
    color: #64748b;
    padding-top: 2px;
}

.router-display-name {
    font-size: 0.8rem;
    color: #2c3e50;
    font-weight: 600;
    padding: 2px 4px;
    background: rgba(44, 62, 80, 0.08);
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.router-location {
    font-size: 0.8rem;
    color: #2c3e50;
    font-weight: 600;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.router-icon-container.online .router-eui64 {
    color: #2c3e50;
    background: rgba(76, 175, 80, 0.1);
}

.router-icon-container.online .router-ipv6 {
    color: #4CAF50;
}

.router-icon-container.online .router-display-name {
    color: #2c3e50;
    background: rgba(76, 175, 80, 0.1);
}

.router-icon-container.online .router-location {
    color: #4CAF50;
}

.router-icon-container.offline .router-eui64 {
    color: #757575;
    background: rgba(117, 117, 117, 0.1);
}

.router-icon-container.offline .router-ipv6 {
    color: #999;
}

.router-icon-container.offline .router-display-name {
    color: #757575;
    background: rgba(117, 117, 117, 0.1);
}

.router-icon-container.offline .router-location {
    color: #999;
}

.router-last-seen {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    text-align: center;
}

.router-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* Statistics Cards */
.stats-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
}

.stats-card h5 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1rem;
}

/* Chart containers */
#heartbeat-chart, #offline-chart {
    position: relative;
}

/* Simple bar chart styling (custom implementation) */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bar-chart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bar-chart-label {
    min-width: 100px;
    font-size: 0.85rem;
    font-family: monospace;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-chart-bar-container {
    flex: 1;
    height: 28px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.bar-chart-value {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.bar-chart-empty {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-style: italic;
}

/* ==================== Custom Scrollbar Styles ==================== */

/* Main content scrollbar - Large and visible */
.main-content {
    scrollbar-width: thick; /* For Firefox */
    scrollbar-color: #667eea #f1f5f9; /* thumb and track color for Firefox */
}

/* Webkit browsers (Chrome, Safari, Edge) - Custom large scrollbar */
.main-content::-webkit-scrollbar {
    width: 16px; /* Wide scrollbar */
}

.main-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
    margin: 5px;
}

.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 3px solid #f1f5f9; /* Creates padding effect */
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
}

.main-content::-webkit-scrollbar-thumb:active {
    background: #667eea;
}

/* Sidebar scrollbar - Thinner but still visible */
.sidebar::-webkit-scrollbar {
    width: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==================== Sensor Tables Styles ==================== */

/* Sensor Tabs */
.sensor-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.sensor-tab-btn {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.sensor-tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.sensor-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Tab Content */
.sensor-tab-content {
    display: none;
}

.sensor-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 1rem;
}

/* Sensor Table */
.sensor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.sensor-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sensor-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.sensor-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s ease;
}

.sensor-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.sensor-table tbody tr:last-child {
    border-bottom: none;
}

.sensor-table tbody td {
    padding: 1rem;
    color: #334155;
}

.sensor-table tbody td:first-child {
    color: #94a3b8;
    font-weight: 600;
}

.sensor-table tbody td strong {
    color: #667eea;
    font-size: 1.1rem;
}

.sensor-table .empty-state {
    padding: 0;
    text-align: center;
}

.sensor-table .empty-state .log-empty {
    padding: 3rem 2rem;
}

/* ============================================ */
/* Modern Group Configuration Styles            */
/* ============================================ */

.grouping-container.modern-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header Section */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.group-header .page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

/* Grid Layout */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* Section Cards */
.section-card.minimal {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-header.compact {
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header.compact h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

/* Configuration Inputs */
.config-inputs {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.minimal-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 0.875rem;
    color: #1f2937;
    transition: border-color 0.15s;
}

.minimal-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Node Count Badge */
.node-count {
    background: #6366f1;
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Nodes List */
.nodes-list-container {
    padding: 1rem;
}

.select-all-row {
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.nodes-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

.nodes-list .node-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.15s;
}

.nodes-list .node-item:last-child {
    border-bottom: none;
}

.nodes-list .node-item:hover {
    background: #f3f4f6;
}

.nodes-list .node-item input[type="checkbox"] {
    flex-shrink: 0;
}

.node-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.node-eui64 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    font-family: 'Courier New', monospace;
}

.node-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Empty States */
.empty-state.minimal {
    padding: 3rem 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Action Section */
.action-section {
    background: linear-gradient(to bottom, #f9fafb, white);
}

.group-creation-controls {
    padding: 1.5rem;
}

.button-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.group-id-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.group-id-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.group-id-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.group-id-input::placeholder {
    color: #9ca3af;
}

/* Modern Buttons */
.btn-modern {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-modern.primary {
    background: #6366f1;
    color: white;
}

.btn-modern.primary:hover:not(:disabled) {
    background: #5558e3;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-modern.secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.btn-modern.secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.btn-modern.success {
    background: #10b981;
    color: white;
}

.btn-modern.success:hover:not(:disabled) {
    background: #0ea968;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-text {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.15s;
}

.btn-text:hover {
    color: #4f46e5;
    text-decoration: underline;
}

/* Progress Bar */
.progress-container {
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.progress-bar-wrapper {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-status {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Groups Grid */
.groups-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.group-card {
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.group-card:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.group-card.selected {
    background: #eef2ff;
    border-color: #6366f1;
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.group-id-badge {
    background: #6366f1;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.group-card-body {
    font-size: 0.875rem;
    color: #6b7280;
}

.group-card-body .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.group-card-body .label {
    font-weight: 500;
}

.group-card-body .value {
    color: #374151;
    font-weight: 600;
}

/* Status Messages */
.status-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-message.warning {
    background: #fed7aa;
    color: #92400e;
    border: 1px solid #fdba74;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar Styling */
.nodes-list::-webkit-scrollbar,
.groups-grid::-webkit-scrollbar {
    width: 6px;
}

.nodes-list::-webkit-scrollbar-track,
.groups-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.nodes-list::-webkit-scrollbar-thumb,
.groups-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.nodes-list::-webkit-scrollbar-thumb:hover,
.groups-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Staging Table Styles */
.staging-section {
    background: linear-gradient(to bottom, #fef3c7, #fffbeb);
    border: 1px solid #fbbf24;
}

.staging-section .section-header {
    background: #fef3c7;
    border-bottom: 1px solid #fbbf24;
}

.staging-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.node-count.staging {
    background: #f59e0b;
    color: white;
}

.staging-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: white;
}

.staging-list .staging-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #fed7aa;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    transition: background 0.15s;
}

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

.staging-list .staging-item:hover {
    background: #fffbeb;
}

.staging-list .staging-item.selected {
    background: #fef3c7;
}

.staging-list .staging-item input[type="checkbox"] {
    flex-shrink: 0;
}

.staging-item-number {
    width: 30px;
    height: 30px;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Action Buttons Row */
.action-buttons-row {
    padding: 1rem 1.5rem;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
}

.btn-modern.light {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.btn-modern.light:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Update staging section colors for better visibility */
.staging-section .empty-state {
    color: #92400e;
    background: #fffbeb;
    padding: 2rem 1rem;
    border-radius: 8px;
}

/* Adjust node-info styling in staging */
.staging-item .node-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.staging-item .node-eui64 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    font-family: 'Courier New', monospace;
}

.staging-item .node-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Update scrollbar for staging list */
.staging-list::-webkit-scrollbar {
    width: 6px;
}

.staging-list::-webkit-scrollbar-track {
    background: #fef3c7;
    border-radius: 3px;
}

.staging-list::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 3px;
}

.staging-list::-webkit-scrollbar-thumb:hover {
    background: #f59e0b;
}

/* Configuration Row Layout */
.config-inputs-row {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* New Groups Section */
.new-groups-section {
    background: linear-gradient(to bottom, #dcfce7, #f0fdf4);
    border: 1px solid #86efac;
}

.new-groups-section .section-header {
    background: #dcfce7;
    border-bottom: 1px solid #86efac;
}

.btn-text.success {
    color: #16a34a;
    font-weight: 600;
}

.btn-text.success:hover {
    color: #15803d;
}

.new-groups-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
}

.new-group-item {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: white;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.new-group-item:hover {
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
    transform: translateY(-1px);
}

.new-group-info {
    flex: 1;
}

.new-group-id {
    font-weight: 600;
    color: #16a34a;
    margin-bottom: 0.25rem;
}

.new-group-details {
    font-size: 0.75rem;
    color: #6b7280;
}

.new-group-status {
    padding: 0.25rem 0.75rem;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Testing Section */
.testing-section {
    background: linear-gradient(to bottom, #fef3c7, #fffbeb);
    border: 1px solid #fcd34d;
}

.testing-section .section-header {
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
}

.testing-controls {
    padding: 1.5rem;
}

.test-group-select {
    margin-bottom: 1.5rem;
}

.test-group-select label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.test-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.btn-test {
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white;
}

.btn-test:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-test .icon {
    font-size: 1.125rem;
}

.btn-test.on {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.btn-test.on:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.btn-test.off {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.btn-test.off:hover:not(:disabled) {
    background: linear-gradient(135deg, #4b5563, #374151);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

.btn-test.blink {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.btn-test.blink:hover:not(:disabled) {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4);
}

.btn-test.auto {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.btn-test.auto:hover:not(:disabled) {
    background: linear-gradient(135deg, #10b981, #059669);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.4);
}

.btn-test.ambient {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.btn-test.ambient:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.btn-test.dual {
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
}

.btn-test.dual:hover:not(:disabled) {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.4);
}

.test-result {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.test-result.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.test-result.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.test-result.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Adjust grid for smaller screens */
@media (max-width: 768px) {
    .test-buttons {
        grid-template-columns: 1fr;
    }
    
    .config-inputs-row {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar for new groups list */
.new-groups-list::-webkit-scrollbar {
    width: 6px;
}

.new-groups-list::-webkit-scrollbar-track {
    background: #dcfce7;
    border-radius: 3px;
}

.new-groups-list::-webkit-scrollbar-thumb {
    background: #86efac;
    border-radius: 3px;
}

.new-groups-list::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

/* Save to Database Section */
.save-section {
    padding: 1rem;
    background: linear-gradient(to bottom, #e0f2fe, #f0f9ff);
    border-top: 1px solid #7dd3fc;
}

.save-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.save-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-save-database {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-save-database:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.btn-save-database:disabled {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.btn-save-database .icon {
    font-size: 1.25rem;
}

/* Responsive design for save inputs */
@media (max-width: 768px) {
    .save-inputs-row {
        grid-template-columns: 1fr;
    }
}

/* Link Nodes Database Dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.dialog-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 800px;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================================================
   IoT Operations Dashboard Styles
   ======================================================================== */

.dashboard-page {
    position: relative;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0;
    z-index: 1;
}

.dashboard-topbar {
    background: linear-gradient(135deg, #0b1224, #0f172a);
    color: #e2e8f0;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 14px 50px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
    display: inline-flex;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-topbar select,
.ghost-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
    text-decoration: none;
}

.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.kpi-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 14px 50px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: -60px;
    right: -40px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at center, rgba(14, 165, 233, 0.12), transparent 60%);
    transform: rotate(18deg);
}

.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(29, 78, 216, 0.12));
    color: #1d4ed8;
    font-weight: 700;
}

.kpi-label {
    font-size: 0.9rem;
    color: #64748b;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.kpi-sub {
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delta {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
}

.delta.up {
    background: rgba(16, 185, 129, 0.15);
    color: #0f9f6e;
}

.delta.down {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.sparkline {
    margin-left: auto;
    width: 110px;
    height: 36px;
}

.panel {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 14px 50px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.overline {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.main-grid {
    display: grid;
    grid-template-columns: 1.7fr 1.2fr;
    gap: 14px;
}

.sub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.energy-chart {
    background: linear-gradient(135deg, #f5fbff 0%, #eef2ff 100%);
    border: 1px solid #e5edfb;
    border-radius: 16px;
    padding: 14px 16px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.chart-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.primary {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.16);
}

.legend-dot.baseline {
    background: #cbd5e1;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
}

.energy-svg {
    width: 100%;
    height: auto;
}

.axis-labels {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    margin-top: 10px;
    font-size: 0.8rem;
    color: #64748b;
}

.axis-labels span {
    text-align: center;
}

.chart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    color: #64748b;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.chipline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.12);
    color: #0f172a;
    font-weight: 600;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.chart-badge {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    font-weight: 600;
    border: 1px solid rgba(34, 197, 94, 0.18);
}

.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.control {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.toggle {
    width: 50px;
    height: 28px;
    border-radius: 999px;
    background: #e2e8f0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    top: 3px;
    left: 4px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.14);
    transition: transform 0.2s ease;
}

.toggle.active {
    background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
}

.toggle.active::after {
    transform: translateX(20px);
}

.range {
    width: 100%;
    accent-color: #0ea5e9;
}

/* Dual Range Slider Styles */
.dual-range-container {
    position: relative;
    width: 100%;
    height: 40px;
    margin: 10px 0;
}

.dual-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    transform: translateY(-50%);
    pointer-events: none;
}

.dual-range-track::before {
    content: '';
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9 0%, #06b6d4 100%);
    border-radius: 4px;
    left: var(--low-percent, 20%);
    right: calc(100% - var(--high-percent, 72%));
}

.dual-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 8px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.dual-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: white;
    border: 3px solid #0ea5e9;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dual-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.dual-range::-webkit-slider-thumb:active {
    transform: scale(1.15);
    border-color: #0284c7;
}

.dual-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: white;
    border: 3px solid #0ea5e9;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.dual-range-low::-webkit-slider-thumb {
    border-color: #f59e0b;
}

.dual-range-low::-moz-range-thumb {
    border-color: #f59e0b;
}

.dual-range-high::-webkit-slider-thumb {
    border-color: #10b981;
}

.dual-range-high::-moz-range-thumb {
    border-color: #10b981;
}

.dual-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.dual-range-labels span:nth-child(2) {
    font-weight: 500;
    color: #475569;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Action Buttons for All Lights ON/OFF */
.action-buttons-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-btn-icon {
    font-size: 1.2rem;
}

.action-btn-on {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.action-btn-on:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}

.action-btn-off {
    background: linear-gradient(135deg, #607D8B 0%, #546E7A 100%);
    color: white;
}

.action-btn-off:hover {
    background: linear-gradient(135deg, #546E7A 0%, #455A64 100%);
}

.action-btn-blink {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.action-btn-blink:hover {
    background: linear-gradient(135deg, #F57C00 0%, #E65100 100%);
}

.action-btn-auto {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.action-btn-auto:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
}

.chip {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip.active {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
    color: #0f172a;
}

.badge {
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge.success {
    background: rgba(22, 163, 74, 0.16);
    color: #15803d;
}

.badge.warning {
    background: rgba(245, 158, 11, 0.16);
    color: #c05621;
}

.badge.danger {
    background: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
}

.list {
    display: grid;
    gap: 12px;
}

.alert {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff9f5;
    display: grid;
    gap: 6px;
}

.alert.critical {
    background: #fff5f5;
    border-color: rgba(239, 68, 68, 0.25);
}

.alert .title {
    font-weight: 700;
}

.alert .meta {
    color: #64748b;
    font-size: 0.9rem;
}

.sites {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.site-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
}

.site-card .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-flex;
}

.dot.success { background: #16a34a; }
.dot.warning { background: #f59e0b; }
.dot.danger { background: #ef4444; }

.small {
    font-size: 0.9rem;
    color: #64748b;
}

.activity {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f6;
}

.activity:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1d4ed8;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.tag {
    padding: 6px 10px;
    background: #f1f5f9;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.link {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .axis-labels {
        grid-template-columns: repeat(5, 1fr);
        row-gap: 6px;
    }
}

@media (max-width: 720px) {
    .dashboard-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .top-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .controls {
        grid-template-columns: 1fr;
    }
    .sub-grid {
        grid-template-columns: 1fr;
    }
}

/* IP Address List Styles */
.ip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ip-category {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    padding: 0.5rem;
}

.ip-cat-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ip-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.1rem 0.5rem;
}

.iface-name {
    color: #7f8c8d;
    font-family: monospace;
}

.iface-ip {
    font-weight: 500;
    color: var(--primary-color);
    font-family: monospace;
}

/* Highlight currently-applied mode button (loaded from Group_settings) */
.btn-test.active-mode {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85) inset,
                0 0 12px rgba(0, 0, 0, 0.35);
    transform: scale(1.04);
    outline: 2px solid #1f2937;
    outline-offset: -2px;
}
