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

/* Tab Styles - Google Workspace Design */
.tabs {
    background: #FFFFFF;
    border: 1px solid #E8EAED;
    border-radius: 8px 8px 0 0;
    display: flex;
    gap: 0;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
}

.tab-button {
    flex: 0 0 auto;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-right: 1px solid #E8EAED;
    color: #5F6368;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.25px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.tab-button:last-child {
    border-right: none;
}

.tab-button:hover {
    background: #F8F9FA;
    color: #202124;
}

.tab-button.active {
    background: #1A73E8;
    color: #FFFFFF;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #FFFFFF;
}

.tab-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.tab-button.active .tab-icon {
    opacity: 1;
}

.tab-panel {
    background: #F8F9FA;
    min-height: calc(100vh - 200px);
    padding: 16px;
    border-radius: 0 0 8px 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F8F9FA;
    color: #202124;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

header {
    background: #FFFFFF;
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
    border: 1px solid #E8EAED;
}

header h1 {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
}

.header-info {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: #5F6368;
}

.header-info span {
    display: flex;
    align-items: center;
}

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

.card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
    border: 1px solid #E8EAED;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(60,64,67,0.15);
}

/* CPU card takes full width */
.card.cpu-card {
    grid-column: 1 / -1; /* Takes full width of grid */
}

/* Memory card styling */
.card.memory-card {
    grid-column: span 1;
    max-width: 400px; /* Limit width for better proportions */
}

/* Legacy wide class for other components */
.card.wide {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .card.wide {
        grid-column: span 1;
    }

    .card.cpu-card {
        grid-column: 1 / -1; /* Still full width on mobile */
    }

    .card.memory-card {
        grid-column: span 1;
        max-width: none; /* Remove width limit on mobile */
    }
}

.card h2 {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E8EAED;
}

.metric-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}

.big-number {
    font-size: 36px;
    font-weight: 400;
    color: #1A73E8;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    line-height: 1.2;
}

.unit {
    font-size: 14px;
    color: #5F6368;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #21262d;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s ease;
}

.status-good {
    background: linear-gradient(90deg, #34A853 0%, #0F9D58 100%);
}

.status-warning {
    background: linear-gradient(90deg, #FBBC04 0%, #F9AB00 100%);
}

.status-critical {
    background: linear-gradient(90deg, #EA4335 0%, #D23E2C 100%);
}

.metric-details {
    font-size: 13px;
    color: #5F6368;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid #E8EAED;
}

.metric-details div {
    display: flex;
    justify-content: space-between;
}

.metric-details span {
    color: #202124;
    font-weight: 500;
}

/* CPU Section Styles */
.cpu-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #30363d;
    gap: 20px;
}

.cpu-overview {
    flex: 1;
    min-width: 250px;
}

.cpu-total-breakdown {
    margin-top: 8px;
}

.cpu-usage-bar {
    display: flex;
    width: 100%;
    height: 12px;
    background: #21262d;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.usage-section {
    height: 100%;
    transition: width 0.8s ease;
    position: relative;
}

.usage-section.user {
    background: linear-gradient(90deg, #58a6ff 0%, #79c0ff 100%);
}

.usage-section.system {
    background: linear-gradient(90deg, #f0883e 0%, #ffab70 100%);
}

.usage-section.iowait {
    background: linear-gradient(90deg, #da3633 0%, #f85149 100%);
}

.usage-section.idle {
    background: linear-gradient(90deg, #238636 0%, #2ea043 100%);
}

.cpu-breakdown-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 4px;
    font-size: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(33, 38, 45, 0.6);
    border-radius: 3px;
    color: #c9d1d9;
}

.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-color.user {
    background: linear-gradient(90deg, #58a6ff 0%, #79c0ff 100%);
}

.legend-color.system {
    background: linear-gradient(90deg, #f0883e 0%, #ffab70 100%);
}

.legend-color.iowait {
    background: linear-gradient(90deg, #da3633 0%, #f85149 100%);
}

.legend-color.idle {
    background: linear-gradient(90deg, #238636 0%, #2ea043 100%);
}

.cpu-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
    min-width: 280px;
}

.cpu-model {
    font-size: 12px;
    font-weight: 600;
    color: #58a6ff;
    margin-bottom: 4px;
    text-align: right;
    word-wrap: break-word;
}

.cpu-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    font-size: 10px;
    color: #8b949e;
}

.cpu-specs div {
    display: flex;
    justify-content: space-between;
    padding: 2px 4px;
    background: rgba(88, 166, 255, 0.1);
    border-radius: 3px;
    border-left: 2px solid #58a6ff;
}

.cpu-load-info {
    font-size: 11px;
    color: #8b949e;
}

.cpu-info span {
    color: #c9d1d9;
    font-weight: 500;
}

.cpu-cores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 3px;
}

@media (min-width: 1200px) {
    .cpu-cores-grid {
        grid-template-columns: repeat(8, 1fr); /* 8 columns for 24 cores = 3 rows */
    }
}

@media (min-width: 1600px) {
    .cpu-cores-grid {
        grid-template-columns: repeat(12, 1fr); /* 12 columns for 24 cores = 2 rows */
    }
}

.cpu-core {
    background: #FFFFFF;
    border: 1px solid #E8EAED;
    border-radius: 8px;
    padding: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
}

.cpu-core:hover {
    border-color: #1A73E8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(60,64,67,0.15);
}

.core-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.core-name {
    font-size: 9px;
    font-weight: 600;
    color: #5F6368;
    text-transform: uppercase;
    font-family: 'Google Sans', Arial, sans-serif;
}

.core-usage {
    font-size: 11px;
    font-weight: 700;
    color: #202124;
    font-family: 'Google Sans', Arial, sans-serif;
}

.progress-bar.small {
    height: 4px;
    margin-bottom: 4px;
}

.core-details {
    font-size: 8px;
}

.core-breakdown {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.core-breakdown span {
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 500;
    cursor: help;
    font-size: 7px;
}

.core-user {
    background: rgba(26, 115, 232, 0.1);
    color: #1A73E8;
}

.core-system {
    background: rgba(251, 188, 5, 0.1);
    color: #FBBC05;
}

.core-idle {
    background: rgba(52, 168, 83, 0.1);
    color: #34A853;
}

/* Network Section */
.network-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.network-item {
    background: #FFFFFF;
    border: 1px solid #E8EAED;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
    transition: all 0.2s ease;
}

.network-item:hover {
    border-color: #1A73E8;
    box-shadow: 0 2px 8px rgba(60,64,67,0.15);
}

.network-label {
    font-size: 10px;
    color: #5F6368;
    margin-bottom: 2px;
    font-family: 'Google Sans', Arial, sans-serif;
    font-weight: 500;
}

.network-value {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    font-family: 'Google Sans', Arial, sans-serif;
}

/* Disk Section */
.disk-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.disk-item {
    background: #FFFFFF;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #E8EAED;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
    transition: all 0.2s ease;
}

.disk-item:hover {
    border-color: #1A73E8;
    box-shadow: 0 2px 8px rgba(60,64,67,0.15);
}

.disk-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.disk-mount {
    font-weight: 600;
    color: #1A73E8;
    font-family: 'Google Sans', Arial, sans-serif;
}

.disk-device {
    font-size: 12px;
    color: #5F6368;
    font-family: 'Google Sans', Arial, sans-serif;
}

.disk-usage {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #202124;
    font-family: 'Google Sans', Arial, sans-serif;
}

.disk-percent {
    font-weight: 600;
    color: #202124;
}

/* Process Section */
.process-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.tab-button {
    padding: 4px 8px;
    background: #21262d;
    border: 1px solid #30363d;
    color: #8b949e;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
}

.tab-button:hover {
    background: #30363d;
    color: #c9d1d9;
}

.tab-button.active {
    background: #58a6ff;
    color: #0d1117;
    border-color: #58a6ff;
}

.process-list {
    overflow-x: auto;
}

.process-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.process-table thead {
    background: #21262d;
}

.process-table th {
    padding: 10px;
    text-align: left;
    color: #58a6ff;
    font-weight: 600;
    border-bottom: 2px solid #30363d;
}

.process-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #30363d;
    color: #c9d1d9;
}

.process-table tbody tr:hover {
    background: #21262d;
}

.process-table td:last-child {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 20px;
    color: #8b949e;
}

/* Htop Styles - Maximum Data Density */
.htop-container {
    background: #FFFFFF;
    border: 1px solid #E8EAED;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(60,64,67,0.08);
    overflow: hidden;
}

.htop-header {
    background: linear-gradient(135deg, #1A73E8 0%, #1967D2 100%);
    color: #FFFFFF;
    padding: 8px 12px;
    border-bottom: 1px solid #E8EAED;
}

.htop-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
    font-size: 11px;
}

.htop-stat-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.htop-label {
    font-weight: 500;
    opacity: 0.9;
}

.htop-value {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Htop Progress Bars */
.htop-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.htop-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.htop-bar-label {
    width: 30px;
    font-size: 10px;
    font-weight: 600;
    text-align: right;
}

.htop-bar-container {
    flex: 1;
    height: 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.htop-bar {
    height: 100%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.htop-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

.cpu-bar {
    background: linear-gradient(90deg, #34A853, #0F9D58);
}

.mem-bar {
    background: linear-gradient(90deg, #FBBC04, #F9AB00);
}

.swap-bar {
    background: linear-gradient(90deg, #EA4335, #D23E2C);
}

.htop-bar-value {
    min-width: 60px;
    font-size: 10px;
    font-weight: 600;
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Htop Controls */
.htop-controls {
    padding: 8px 12px;
    background: #F8F9FA;
    border-bottom: 1px solid #E8EAED;
    display: flex;
    gap: 12px;
    align-items: center;
}

.htop-filter {
    flex: 1;
    max-width: 300px;
    padding: 4px 8px;
    border: 1px solid #E8EAED;
    border-radius: 4px;
    font-size: 12px;
    background: #FFFFFF;
    transition: border-color 0.2s;
}

.htop-filter:focus {
    outline: none;
    border-color: #1A73E8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.1);
}

.htop-refresh-btn {
    padding: 4px 12px;
    background: #1A73E8;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.htop-refresh-btn:hover {
    background: #1967D2;
}

/* Htop Table - Ultra Compact */
.htop-table-container {
    overflow-x: auto;
    background: #FFFFFF;
}

.htop-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 10px !important;
}

.htop-table thead {
    background: #F8F9FA;
    position: sticky;
    top: 0;
    z-index: 10;
}

.htop-table th {
    padding: 3px 4px !important;
    font-size: 9px !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #5F6368;
    border-bottom: 2px solid #E8EAED;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.htop-table th.sortable {
    cursor: pointer;
    transition: background 0.2s;
}

.htop-table th.sortable:hover {
    background: #E8EAED;
}

.htop-table th.sort-active {
    background: #E8F0FE;
    color: #1A73E8;
}

.sort-indicator {
    display: inline-block;
    margin-left: 2px;
    font-size: 8px;
    color: #1A73E8;
}

.htop-table tbody tr {
    transition: background 0.1s;
    border-bottom: 1px solid #F8F9FA;
}

.htop-table tbody tr:hover {
    background: #F8F9FA;
}

.htop-table td {
    padding: 1px 4px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* Process State Colors */
.process-state-R { color: #34A853; font-weight: 600; } /* Running */
.process-state-S { color: #5F6368; } /* Sleeping */
.process-state-D { color: #EA4335; } /* Disk sleep */
.process-state-Z { color: #9E9E9E; font-style: italic; } /* Zombie */
.process-state-T { color: #FBBC04; } /* Stopped */

/* CPU/Memory Usage Coloring */
.high-usage { color: #EA4335; font-weight: 600; }
.medium-usage { color: #FBBC04; font-weight: 600; }
.low-usage { color: #34A853; }

/* Command Column */
.htop-table td:last-child {
    max-width: 400px;
    font-family: 'Courier New', monospace;
    font-size: 9px !important;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .dashboard {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px;
    }

    header {
        padding: 8px 12px;
    }

    header h1 {
        font-size: 16px;
    }

    .header-info {
        flex-direction: column;
        gap: 3px;
        font-size: 10px;
    }

    .big-number {
        font-size: 20px;
    }

    .card {
        padding: 8px;
    }

    .cpu-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .cpu-overview {
        min-width: auto;
        width: 100%;
    }

    .cpu-breakdown-legend {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .legend-item {
        font-size: 11px;
        padding: 3px 6px;
    }

    .cpu-info {
        text-align: left;
        flex-direction: column;
        gap: 10px;
        min-width: auto;
    }

    .cpu-cores-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 6px;
        max-height: 300px;
    }

    .cpu-info {
        min-width: auto;
    }

    .cpu-model {
        font-size: 12px;
        text-align: left;
    }

    .cpu-specs {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .cpu-specs div {
        padding: 3px 6px;
        font-size: 11px;
    }

    .cpu-core {
        padding: 8px;
    }

    .core-breakdown {
        gap: 4px;
    }

    .core-breakdown span {
        font-size: 10px;
        padding: 1px 4px;
    }

    .process-table {
        font-size: 11px;
    }

    .process-table th,
    .process-table td {
        padding: 6px;
    }
}

/* Animation for real-time updates */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

.updating {
    animation: pulse 0.5s ease;
}

/* Temperature specific styling */
#temperature-card .metric-details div {
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 5px;
    background: #21262d;
    display: flex;
    justify-content: space-between;
}

.temp-zone {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #21262d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid;
}

.temp-zone.status-good {
    border-left-color: #2ea043;
}

.temp-zone.status-warning {
    border-left-color: #f0883e;
}

.temp-zone.status-critical {
    border-left-color: #f85149;
}

.temp-label {
    font-weight: 500;
    color: #c9d1d9;
}

.temp-value {
    font-weight: 700;
    font-size: 16px;
}

/* GPU Styling */
.gpu-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gpu-item {
    background: #21262d;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #30363d;
}

.gpu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #30363d;
}

.gpu-name {
    font-weight: 600;
    color: #58a6ff;
    font-size: 14px;
}

.gpu-temp {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.gpu-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.gpu-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gpu-metric .metric-label {
    font-size: 12px;
    color: #8b949e;
    font-weight: 500;
}

.gpu-metric .metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #c9d1d9;
}

/* Disk I/O Styling */
.diskio-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diskio-item {
    background: #21262d;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #30363d;
}

.diskio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.diskio-device {
    font-weight: 600;
    color: #58a6ff;
    font-size: 14px;
}

.diskio-rates {
    display: flex;
    gap: 15px;
}

.read-rate {
    color: #2ea043;
    font-weight: 500;
    font-size: 13px;
}

.write-rate {
    color: #f0883e;
    font-weight: 500;
    font-size: 13px;
}

.diskio-details {
    font-size: 12px;
    color: #8b949e;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.diskio-details div {
    display: flex;
    justify-content: space-between;
}

.diskio-details span {
    color: #c9d1d9;
    font-weight: 500;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}