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

:root {
    --color-bg: #f5f7fa;
    --color-card: #ffffff;
    --color-text: #2d3748;
    --color-text-muted: #718096;
    --color-border: #e2e8f0;
    --color-success: #48bb78;
    --color-warning: #ed8936;
    --color-error: #f56565;
    --color-idle: #a0aec0;
    --color-primary: #4299e1;
    --spacing: 1rem;
    --border-radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    padding: var(--spacing);
}

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

header {
    background: var(--color-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.75rem;
    color: var(--color-text);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.refresh-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, opacity 0.2s;
}

.refresh-btn:hover {
    opacity: 0.9;
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.card {
    background: var(--color-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--color-bg);
    border-radius: 4px;
}

.status-item .label {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.status-item .value {
    font-family: monospace;
    color: var(--color-text);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.status-badge.warning {
    background: var(--color-warning);
    color: white;
}

.status-badge.error {
    background: var(--color-error);
    color: white;
}

.status-badge.idle {
    background: var(--color-idle);
    color: white;
}

.status-badge.unknown {
    background: var(--color-text-muted);
    color: white;
}

.token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.token-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.token-badge.ok {
    background: var(--color-success);
    color: white;
}

.token-badge.fail {
    background: var(--color-error);
    color: white;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
}

.list-item {
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: 4px;
    border-left: 4px solid var(--color-idle);
}

.list-item.ok {
    border-left-color: var(--color-success);
}

.list-item.error {
    border-left-color: var(--color-error);
}

.list-item.warning {
    border-left-color: var(--color-warning);
}

.list-item.idle {
    border-left-color: var(--color-idle);
}

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

.list-item-title {
    font-weight: 600;
    color: var(--color-text);
}

.list-item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.list-item-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.error-message {
    padding: 1rem;
    background: #fff5f5;
    border-left: 4px solid var(--color-error);
    border-radius: 4px;
    color: #c53030;
    font-size: 0.875rem;
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--color-primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .header-info {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 375px) {
    body {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }
}
