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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f172a;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #e2e8f0;
    font-size: 14px;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: #1e293b;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    left: -280px;
    top: 0;
    transition: left 0.3s ease;
    z-index: 1000;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    background: #334155;
    color: #f1f5f9;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #475569;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.sidebar-close {
    background: rgba(148, 163, 184, 0.2);
    border: none;
    color: #f1f5f9;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(148, 163, 184, 0.3);
}

.sidebar-toggle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #334155;
    border: none;
    color: #f1f5f9;
    width: 40px;
    height: 60px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
    z-index: 999;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-toggle:hover {
    transform: translateY(-50%) translateX(2px);
}

.sidebar-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-20px);
}

.test-list {
    padding: 8px;
}

.test-item {
    display: block;
    padding: 10px;
    margin-bottom: 4px;
    background: #334155;
    border-radius: 6px;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: #cbd5e1;
    transition: all 0.2s ease;
    cursor: pointer;
}

.test-item:hover {
    background: #475569;
    border-left-color: #64748b;
    transform: translateX(2px);
}

.test-item.active {
    background: #475569;
    border-left-color: #94a3b8;
    border-left-width: 4px;
}

.test-client {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.test-time {
    font-size: 0.75rem;
    color: #94a3b8;
    font-family: monospace;
}

.no-tests {
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: 15px;
    overflow-x: hidden;
    transition: margin-left 0.3s ease;
    max-width: 1600px;
    margin-right: auto;
}

@media (min-width: 1920px) {
    .main-content {
        max-width: 2200px;
    }
}

.main-content header {
    background: #1e293b;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #334155;
}

.main-content header h1 {
    font-size: 1.8rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

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

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

.stat-card {
    background: #1e293b;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid #334155;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
}

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

.client-section {
    margin-bottom: 25px;
}

.client-header {
    background: #1e293b;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid #334155;
}

.client-header h2 {
    font-size: 1.3rem;
    color: #94a3b8;
    margin: 0;
}

.client-timestamp {
    color: #64748b;
    font-family: monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}

.device-group {
    background: #1e293b;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    margin-left: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: 1px solid #334155;
}

.device-group.paired {
    border: 3px solid #dc2626;
}

.device-group.unpaired {
    border-left: 4px solid #10b981;
}

.device-group:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
}

.device-title-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.device-status-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid #10b981;
}

.device-header h3 {
    font-size: 1.1rem;
    color: #e2e8f0;
    margin: 0;
}

.device-meta {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    font-size: 0.85rem;
    color: #94a3b8;
}

.device-power-info {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.device-power-info strong {
    color: #cbd5e1;
    white-space: nowrap;
}

.power-times {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    color: #94a3b8;
}

.status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-indicator.offline {
    background-color: #dc2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.device-id {
    font-weight: 600;
    color: #94a3b8;
}

.device-client {
    color: #94a3b8;
}

.timestamp {
    color: #64748b;
    font-family: monospace;
}

.no-data {
    background: #1e293b;
    padding: 60px;
    border-radius: 12px;
    text-align: center;
    color: #64748b;
    font-size: 1.2rem;
    border: 1px solid #334155;
}

/* ==================== */
/* Navigation           */
/* ==================== */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #334155;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: #94a3b8;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: #334155;
    color: #f1f5f9;
}

.nav-link.active {
    background: #334155;
    color: #f1f5f9;
    font-weight: 600;
}

.nav-logout {
    color: #ef4444;
}

.nav-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ==================== */
/* Login Page           */
/* ==================== */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.login-card h1 {
    color: #94a3b8;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.15);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #334155;
    color: #f1f5f9;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.login-btn:hover {
    background: #475569;
    border-color: #64748b;
}

/* ==================== */
/* DB Table Page        */
/* ==================== */

.db-page {
    max-width: 100%;
}

.db-table-wrapper {
    overflow-x: auto;
    background: #1e293b;
    border-radius: 8px;
    border: 1px solid #334155;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.db-table thead {
    background: #334155;
    position: sticky;
    top: 0;
    z-index: 5;
}

.db-table th {
    padding: 12px 16px;
    text-align: left;
    color: #f1f5f9;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #475569;
}

.db-table th a {
    color: #f1f5f9;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.db-table th a:hover {
    color: #94a3b8;
}

.sort-arrow {
    color: #64748b;
    font-size: 0.8rem;
}

.sort-arrow.active {
    color: #94a3b8;
}

.db-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #334155;
    color: #cbd5e1;
    vertical-align: top;
}

.db-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.4);
}

.col-id {
    width: 70px;
    font-weight: 600;
    color: #94a3b8;
    font-family: monospace;
}

.col-date {
    width: 180px;
    white-space: nowrap;
    font-family: monospace;
    color: #94a3b8;
}

.col-data {
    max-width: 0;
    width: 100%;
}

.data-preview {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 6px;
    transition: background 0.2s;
}

.data-preview:hover {
    background: rgba(51, 65, 85, 0.5);
}

.data-preview.expanded {
    background: rgba(15, 23, 42, 0.5);
}

.data-short {
    font-family: monospace;
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.truncated {
    color: #64748b;
}

.data-full pre {
    font-family: monospace;
    font-size: 0.78rem;
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
    background: #0f172a;
    border-radius: 4px;
    border: 1px solid #334155;
    margin: 0;
}

.no-data-cell {
    text-align: center;
    color: #64748b;
    padding: 40px !important;
    font-size: 1rem;
}

/* ==================== */
/* Sort Bar (Dashboard) */
/* ==================== */

.sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #334155;
    flex-wrap: wrap;
}

.sort-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 4px;
}

.sort-btn {
    color: #94a3b8;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    background: #334155;
    border: 1px solid #475569;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

.sort-btn.active {
    background: #475569;
    color: #f1f5f9;
    border-color: #94a3b8;
    font-weight: 600;
}

/* ==================== */
/* Stats Page           */
/* ==================== */

.stats-page {
    max-width: 100%;
}

.stats-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.stats-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #334155;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stats-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rebuild-btn {
    background: #334155;
    color: #f1f5f9;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #475569;
    transition: all 0.2s ease;
}

.rebuild-btn:hover {
    background: #475569;
    border-color: #64748b;
}

.last-update {
    color: #64748b;
    font-size: 0.8rem;
    font-family: monospace;
}

.klient-filter {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.klient-filter:focus {
    border-color: #64748b;
}

/* Stats Legend */

.stats-legend {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #334155;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.streak-notice-dot {
    background: #f59e0b;
}

.streak-warning-dot {
    background: #f97316;
}

.streak-critical-dot {
    background: #ef4444;
}

/* Streak row highlighting */

.stats-table tr.streak-notice {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.stats-table tr.streak-warning {
    border-left: 4px solid #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.stats-table tr.streak-critical {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.stats-table tr.streak-notice:hover {
    background: rgba(245, 158, 11, 0.15);
}

.stats-table tr.streak-warning:hover {
    background: rgba(249, 115, 22, 0.17);
}

.stats-table tr.streak-critical:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Consecutive badge */

.consecutive-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    background: #334155;
}

.consecutive-badge.streak-notice {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.consecutive-badge.streak-warning {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.consecutive-badge.streak-critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Offline count cell with expandable dates */

.col-count {
    min-width: 120px;
}

.col-consecutive {
    white-space: nowrap;
}

.offline-count-cell {
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.offline-count-cell:hover {
    background: rgba(51, 65, 85, 0.5);
}

.count-number {
    font-weight: 700;
    font-size: 0.95rem;
    color: #e2e8f0;
    margin-right: 6px;
}

.expand-hint {
    font-size: 0.7rem;
    color: #64748b;
}

.offline-dates-list {
    margin-top: 8px;
    padding: 8px;
    background: #0f172a;
    border-radius: 4px;
    border: 1px solid #334155;
    max-height: 200px;
    overflow-y: auto;
}

.offline-date {
    font-family: monospace;
    font-size: 0.78rem;
    color: #94a3b8;
    padding: 2px 0;
    border-bottom: 1px solid #1e293b;
}

.offline-date:last-child {
    border-bottom: none;
}

/* ==================== */
/* Responsive           */
/* ==================== */

/* Tablet */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    /* Layout */
    .layout {
        flex-direction: column;
    }

    /* Navigation */
    .top-nav {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Header */
    .main-content header {
        padding: 14px;
        margin-bottom: 12px;
    }

    .main-content header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    /* Main content */
    .main-content {
        padding: 10px;
    }

    /* Sort bar */
    .sort-bar {
        padding: 8px 12px;
        gap: 6px;
    }

    .sort-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    /* Stats cards */
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Client sections */
    .client-section {
        margin-bottom: 16px;
    }

    .client-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 14px;
        margin-bottom: 10px;
    }

    .client-header h2 {
        font-size: 1.05rem;
    }

    .client-timestamp {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Device groups */
    .device-group {
        margin-left: 0;
        padding: 12px;
        margin-bottom: 8px;
    }

    .device-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .device-header h3 {
        font-size: 0.95rem;
    }

    .device-meta {
        flex-direction: column;
        gap: 6px;
        font-size: 0.8rem;
    }

    .device-power-info {
        flex-direction: column;
        gap: 2px;
    }

    .device-status-section {
        width: 100%;
        justify-content: flex-end;
        padding-top: 4px;
        border-top: 1px solid #334155;
    }

    .online-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .status-indicator {
        width: 14px;
        height: 14px;
    }

    /* Sidebar */
    .sidebar {
        width: 100%;
        left: -100%;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        width: 44px;
        height: 44px;
        border-radius: 0 50% 50% 0;
    }

    .sidebar-header {
        padding: 14px;
    }

    .sidebar-header h2 {
        font-size: 1rem;
    }

    /* Login */
    .login-card {
        padding: 28px 20px;
        margin: 0 10px;
    }

    .login-card h1 {
        font-size: 1.4rem;
    }

    .login-subtitle {
        font-size: 0.8rem;
    }

    /* DB table */
    .db-table-wrapper {
        border-radius: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .db-table th {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .db-table td {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .col-id {
        width: 50px;
    }

    .col-date {
        width: auto;
        font-size: 0.72rem;
    }

    .data-short {
        font-size: 0.72rem;
    }

    .data-full pre {
        font-size: 0.7rem;
        max-height: 250px;
    }

    /* Stats toolbar */
    .stats-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 8px;
    }

    .stats-toolbar-left {
        flex-direction: column;
        gap: 8px;
    }

    .rebuild-btn {
        text-align: center;
        padding: 10px 16px;
    }

    .klient-filter {
        width: 100%;
    }

    .last-update {
        font-size: 0.72rem;
    }

    /* Stats legend */
    .stats-legend {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px;
    }

    .legend-item {
        font-size: 0.75rem;
    }

    /* Stats table */
    .col-count {
        min-width: 90px;
    }

    .count-number {
        font-size: 0.85rem;
    }

    .expand-hint {
        font-size: 0.65rem;
    }

    .offline-dates-list {
        max-height: 150px;
        padding: 6px;
    }

    .offline-date {
        font-size: 0.72rem;
    }

    .consecutive-badge {
        font-size: 0.72rem;
        padding: 2px 8px;
    }

    /* No data */
    .no-data {
        padding: 30px 15px;
        font-size: 1rem;
    }
}

/* Phone */
@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .main-content {
        padding: 6px;
    }

    .main-content header {
        padding: 12px 10px;
        margin-bottom: 8px;
    }

    .main-content header h1 {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    /* Nav stacked */
    .top-nav {
        padding: 6px 8px;
        gap: 4px;
    }

    .nav-links {
        gap: 2px;
    }

    .nav-link {
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    /* Sort bar compact */
    .sort-bar {
        padding: 6px 8px;
        margin-bottom: 8px;
    }

    .sort-label {
        font-size: 0.75rem;
        width: 100%;
        margin-bottom: 2px;
    }

    .sort-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    /* Stats cards stacked */
    .stats {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 10px;
    }

    .stat-card {
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    .stat-number {
        font-size: 1.3rem;
        margin-bottom: 0;
        order: 2;
    }

    .stat-label {
        font-size: 0.75rem;
        order: 1;
    }

    /* Client */
    .client-header {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    .client-header h2 {
        font-size: 0.95rem;
    }

    .client-timestamp {
        font-size: 0.7rem;
    }

    /* Device */
    .device-group {
        padding: 10px;
        margin-bottom: 6px;
        border-radius: 6px;
    }

    .device-header {
        padding-bottom: 6px;
        margin-bottom: 6px;
    }

    .device-header h3 {
        font-size: 0.88rem;
        word-break: break-word;
    }

    .device-id {
        font-size: 0.75rem;
    }

    .device-meta {
        font-size: 0.75rem;
    }

    /* Sidebar full-screen on phone */
    .sidebar-header {
        padding: 12px;
    }

    .test-item {
        padding: 8px;
    }

    .test-client {
        font-size: 0.82rem;
    }

    .test-time {
        font-size: 0.7rem;
    }

    /* Login tight */
    .login-card {
        padding: 24px 16px;
    }

    .login-card h1 {
        font-size: 1.2rem;
    }

    .form-group input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .login-btn {
        padding: 12px;
        font-size: 0.85rem;
    }

    /* DB Table tighter */
    .db-table th,
    .db-table td {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .col-id {
        width: 40px;
        font-size: 0.72rem;
    }

    /* Stats toolbar */
    .stats-toolbar {
        padding: 8px;
    }

    .rebuild-btn {
        font-size: 0.78rem;
        padding: 8px 12px;
        width: 100%;
    }

    .klient-filter {
        font-size: 0.78rem;
        padding: 8px;
    }

    /* Stats legend inline */
    .stats-legend {
        padding: 6px 8px;
        gap: 4px;
    }

    .legend-item {
        font-size: 0.7rem;
    }

    .legend-dot {
        width: 10px;
        height: 10px;
    }

    /* Stats table */
    .stats-table th,
    .stats-table td {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .consecutive-badge {
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    .count-number {
        font-size: 0.8rem;
    }

    .expand-hint {
        display: block;
        font-size: 0.6rem;
        margin-top: 2px;
    }

    /* No data */
    .no-data {
        padding: 20px 10px;
        font-size: 0.9rem;
    }

    .no-data-cell {
        padding: 20px !important;
        font-size: 0.85rem;
    }
}
