:root {
    --bg: #0f1419;
    --sidebar: #1a2332;
    --card: #1e2a3a;
    --border: #2d3f54;
    --text: #e7ecf3;
    --muted: #8b9cb3;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    padding: 1.25rem 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.brand-icon { color: var(--success); }

.sidebar nav { flex: 1; padding: 0.75rem 0; }

.sidebar nav a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--muted);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar nav a:hover { color: var(--text); background: rgba(59,130,246,0.08); text-decoration: none; }
.sidebar nav a.active { color: var(--text); background: rgba(59,130,246,0.15); border-left-color: var(--primary); }

.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.logout { color: var(--muted); font-size: 0.9rem; }

.content { flex: 1; padding: 1.5rem 2rem; overflow-x: auto; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 600; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert-success { background: rgba(34,197,94,0.15); border: 1px solid var(--success); color: #86efac; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--danger); color: #fca5a5; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; text-align: center; }
.stat .num { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat .label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ok { background: rgba(34,197,94,0.2); color: #86efac; }
.badge-fail { background: rgba(239,68,68,0.2); color: #fca5a5; }
.badge-muted { background: rgba(139,156,179,0.2); color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    background: var(--primary);
    transition: background 0.15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--border); color: var(--text); }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}
.login-box h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.25rem; }
.login-box .btn { width: 100%; margin-top: 0.5rem; }

code.cron-url {
    display: block;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 0.5rem 0 1rem;
    border: 1px solid var(--border);
}

.pagination { margin-top: 1rem; display: flex; gap: 0.5rem; align-items: center; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 768px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar nav { display: flex; flex-wrap: wrap; padding: 0.5rem; }
    .sidebar nav a { flex: 1 1 auto; padding: 0.5rem; border-left: none; border-bottom: 2px solid transparent; }
    .content { padding: 1rem; }
}
