:root {
    --online: #22C55E;
    --online-dim: rgba(34, 197, 94, 0.12);
    --degraded: #F59E0B;
    --degraded-dim: rgba(245, 158, 11, 0.12);
    --down: #EF4444;
    --down-dim: rgba(239, 68, 68, 0.12);

    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-elevated: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-input: rgba(15, 23, 42, 0.9);

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #475569;

    --border: rgba(148, 163, 184, 0.08);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --glass-blur: 16px;

    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
}

.app-subtitle {
    font-size: 0.7rem;
    color: var(--online);
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.header-select {
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    outline: none;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.online-dot {
    background: var(--online);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
    animation: pulse-green 2s infinite;
}

.degraded-dot {
    background: var(--degraded);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    animation: pulse-amber 2s infinite;
}

.down-dot {
    background: var(--down);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

@keyframes pulse-amber {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
}

@keyframes pulse-red {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--down-dim);
    color: var(--down);
    border: none;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Overview */
.overview-bar {
    max-width: 1300px;
    margin: 0 auto;
    padding: 14px 20px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
    text-align: center;
}

.overview-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.overview-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.online-text {
    color: var(--online);
}

.degraded-text {
    color: var(--degraded);
}

.down-text {
    color: var(--down);
}

/* Services Grid */
.services-grid {
    flex: 1;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px 20px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    align-content: start;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 16px;
    transition: all 250ms ease;
    position: relative;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.service-name {
    font-size: 0.875rem;
    font-weight: 700;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.service-url {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
    margin-bottom: 10px;
}

.service-env {
    font-size: 0.5625rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.env-prod {
    background: rgba(239, 68, 68, 0.1);
    color: var(--down);
}

.env-staging {
    background: rgba(245, 158, 11, 0.1);
    color: var(--degraded);
}

.env-dev {
    background: rgba(34, 197, 94, 0.1);
    color: var(--online);
}

.service-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.service-stat-label {
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.service-stat-value {
    font-size: 0.8125rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.service-chart {
    width: 100%;
    height: 50px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
}

.service-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Empty */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.8125rem;
    margin-bottom: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
}

.modal-body {
    padding: 18px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.btn-close:hover {
    color: var(--text-primary);
}

.form-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-label:first-child {
    margin-top: 0;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    outline: none;
}

.form-input:focus {
    border-color: #3B82F6;
}

.form-textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    outline: none;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 14px;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .overview-bar {
        grid-template-columns: repeat(3, 1fr);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
}

:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}