* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: #0f172a;
    color: #d9e3f0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #1f2937, #111827);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

header .title h1 {
    margin: 0;
    font-size: 1.6rem;
}

header .title .subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
}

.status-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: #ef4444;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-chip.running {
    background: #22c55e;
}

main {
    padding: 1.5rem 2rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
    background: #1e293b;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.controls label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: #94a3b8;
}

.controls input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: inherit;
}

.control-group.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.control-actions {
    display: flex;
    gap: 0.75rem;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-weight: 600;
    transition: transform 0.1s ease, opacity 0.2s ease;
}

button.primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

button.secondary {
    background: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.message {
    grid-column: 1 / -1;
    min-height: 1.2rem;
    font-size: 0.85rem;
}

.message.error {
    color: #f87171;
}

.message.success {
    color: #34d399;
}

.cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card {
    background: #1e293b;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card header h2 {
    margin: 0;
    font-size: 1rem;
    color: #cbd5f5;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-card span.label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-card span.value {
    font-size: 1.4rem;
    font-weight: 600;
}

.metric-card.positive span.value {
    color: #22c55e;
}

.metric-card.negative span.value {
    color: #f87171;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid.responsive-two {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.form-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 0.75rem;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.form-grid input {
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: inherit;
}

.danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
}

.charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.collapsible {
    cursor: pointer;
}

.collapsible > summary {
    font-weight: 600;
    color: #cbd5f5;
    outline: none;
}

.collapsible[open] > summary {
    margin-bottom: 0.75rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: rgba(148, 163, 184, 0.1);
}

th, td {
    padding: 0.6rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

tbody tr:hover {
    background: rgba(37, 99, 235, 0.08);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(148, 163, 184, 0.2);
}

.badge.up {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
}

.badge.down {
    background: rgba(248, 113, 113, 0.18);
    color: #f87171;
}

.events-log {
    max-height: 260px;
.events-log .event {
    margin-bottom: 0.4rem;
}

.events-log .event.error {
    color: #f87171;
}

.events-log .event.warn {
    color: #facc15;
}

.events-log .event strong {
    color: #fbbf24;
}

    overflow-y: auto;
    background: rgba(15, 23, 42, 0.65);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: "Fira Code", "Courier New", monospace;
    font-size: 0.8rem;
    line-height: 1.35;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.assets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.assets-list span {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
    font-size: 0.8rem;
}

footer {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #64748b;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    background: #111827;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .controls {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .events-log {
        max-height: 200px;
    }
}
