:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --primary: #2557d6;
    --primary-dark: #173c9c;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: #111827;
}

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

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

.login-card,
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 28px;
}

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

.sidebar {
    width: 250px;
    background: #111827;
    color: #fff;
    padding: 22px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 28px;
}

.nav a {
    display: block;
    color: #d1d5db;
    padding: 11px 12px;
    border-radius: 9px;
    margin-bottom: 6px;
}

.nav a.active,
.nav a:hover {
    background: #1f2937;
    color: #fff;
}

.main {
    flex: 1;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.grid {
    display: grid;
    gap: 16px;
}

.stats {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.card {
    padding: 18px;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
}

.muted {
    color: var(--muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 96px;
}

.btn {
    display: inline-flex;
    align-items: center;
    border: 0;
    border-radius: 9px;
    padding: 10px 14px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.btn:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn.secondary {
    background: #6b7280;
}

.btn.danger {
    background: var(--danger);
}

.btn.success {
    background: var(--success);
}

.btn.warning {
    background: var(--warning);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f9fafb;
    font-size: 13px;
    color: #374151;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
    background: #e5e7eb;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.error,
.badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.badge.warning,
.badge.monitoring {
    background: #fef3c7;
    color: #92400e;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
    z-index: 20;
}

.modal:target {
    display: flex;
}

.modal-box {
    width: min(920px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-small {
    width: min(460px, 100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-close {
    color: var(--muted);
    font-size: 24px;
    font-weight: 700;
}

.captcha {
    display: flex;
    gap: 12px;
    align-items: center;
}

.captcha img {
    border: 1px solid var(--border);
    border-radius: 8px;
}

@media (max-width: 800px) {
    .app {
        display: block;
    }

    .sidebar {
        width: 100%;
    }

    .main {
        padding: 18px;
    }
}
