:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f0f2f9;
    --border: #e2e6f0;
    --text: #1c2333;
    --text-dim: #6b7488;
    --accent: #4f6ef7;
    --accent-2: #8b5cf6;
    --accent-dark: #3c56d6;
    --green: #17a673;
    --green-bg: #e7f8f0;
    --red: #e0364f;
    --red-bg: #fdeaee;
    --blue: #4f6ef7;
    --blue-bg: #eaf0fe;
    --grey: #8891a5;
    --grey-bg: #eef0f5;
    --shadow: 0 12px 32px rgba(31, 45, 90, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---------- Landing / Login ---------- */
.landing-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: radial-gradient(circle at top left, #eef1fd 0%, var(--bg) 55%);
}
.landing-wrap { padding: 24px; }
.landing-card, .login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 48px;
    text-align: center;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.landing-mark {
    width: 56px; height: 56px;
    object-fit: contain;
    display: block; margin: 0 auto 20px;
    filter: drop-shadow(0 6px 14px rgba(31, 45, 90, 0.18));
}
.landing-mark.small { width: 36px; height: 36px; margin: 0; }
.landing-card h1 { margin: 0 0 8px; font-size: 26px; color: var(--text); }
.landing-sub { color: var(--text-dim); margin-bottom: 28px; }
.login-card { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-card h2 { text-align: center; margin: 0 0 20px; color: var(--text); }
.login-card label { font-size: 13px; color: var(--text-dim); margin-top: 6px; font-weight: 600; }
.login-card input {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
    padding: 11px 13px; color: var(--text); font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.login-error { color: var(--red); font-size: 13px; text-align: center; }
.btn-primary {
    display: inline-block; margin-top: 20px; padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white; text-decoration: none; border: none; border-radius: 10px;
    font-weight: 600; font-size: 14px; cursor: pointer;
    box-shadow: 0 8px 20px rgba(79, 110, 247, 0.3);
}
.btn-primary:hover { filter: brightness(1.05); }

/* ---------- App shell ---------- */
.app-body { min-height: 100vh; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(31, 45, 90, 0.04);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-weight: 700; letter-spacing: 0.2px; color: var(--text); }
.btn-ghost {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
    padding: 8px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 13px;
    font-weight: 600;
}
.btn-ghost:hover { color: var(--accent-dark); border-color: var(--accent); background: var(--blue-bg); }

.dashboard-main { padding: 32px 40px; width: 100%; margin: 0; }
.dashboard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.dashboard-head h1 { font-size: 22px; margin: 0; color: var(--text); }

/* ---------- Table ---------- */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
    box-shadow: var(--shadow);
}
.scheduler-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scheduler-table th {
    text-align: left; padding: 15px 18px; color: var(--text-dim); font-weight: 700;
    border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.6px;
}
.scheduler-table td { padding: 15px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.scheduler-table tr:last-child td { border-bottom: none; }
.scheduler-table tbody tr:hover { background: #fafbff; }
.sched-name { font-weight: 700; color: var(--text); }
.sched-desc { color: var(--text-dim); font-size: 12px; margin-top: 3px; max-width: 260px; }

/* ---------- Status pill ---------- */
.pill {
    display: inline-block; padding: 5px 13px; border-radius: 20px; font-size: 11px;
    font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-grey { background: var(--grey-bg); color: var(--grey); }

/* ---------- Controls ---------- */
.cron-input {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
    padding: 7px 9px; color: var(--text); font-size: 12.5px; width: 130px; margin-right: 6px;
    font-family: 'Consolas', 'Courier New', monospace;
}
.cron-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.cron-desc-input {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
    padding: 7px 9px; color: var(--text); font-size: 12px; width: 170px; margin-top: 6px;
    display: block;
}
.cron-desc-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.cron-desc-input::placeholder { color: var(--grey); }
.btn-tiny, .btn-small {
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 12px; text-decoration: none;
    display: inline-block; font-weight: 600;
}
.btn-tiny:hover, .btn-small:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--blue-bg); }
.btn-secondary { color: var(--text-dim); }
.actions-cell { white-space: nowrap; }
.actions-inner { display: flex; align-items: center; gap: 8px; }

.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0; background: var(--grey-bg);
    border: 1px solid var(--border); border-radius: 22px; transition: 0.2s;
}
.slider::before {
    position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px;
    background: white; border: 1px solid var(--border); border-radius: 50%; transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .slider { background: var(--green-bg); border-color: var(--green); }
input:checked + .slider::before { transform: translateX(18px); background: var(--green); border-color: var(--green); }

.error-text { color: var(--red); cursor: help; }

/* ---------- Toast ---------- */
.toast { font-size: 13px; padding: 7px 16px; border-radius: 8px; opacity: 0; transition: 0.2s; font-weight: 600; }
.toast.show { opacity: 1; }
.toast-ok { background: var(--green-bg); color: var(--green); }
.toast-error { background: var(--red-bg); color: var(--red); }
