:root {
    --primary: #4c53b6;
    --primary-dark: #3b4199;
    --primary-soft: #eef0fb;
    --ink: #1f2140;
    --text: #44475a;
    --muted: #7a7d93;
    --line: #e6e8f2;
    --bg: #f4f5fb;
    --danger: #d64545;
    --ok: #217a43;
    --sidebar: #1f2140;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
    background: #fff;
}

.login-brand {
    background: var(--sidebar);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand h1 {
    margin: 12px 0 8px;
    font-size: 36px;
}

.login-brand p { color: #c9cbe0; max-width: 380px; }
.login-mark { width: 48px; height: 48px; display: block; margin-bottom: 8px; }

.login-panel {
    display: grid;
    place-items: center;
    padding: 40px;
}

.login-box { width: min(360px, 100%); }
.login-box h2 { margin: 0 0 8px; color: var(--ink); font-size: 26px; }
.login-box .lede { color: var(--muted); margin: 0 0 24px; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-weight: 600;
    color: var(--ink);
}

.field input, .field select, .field textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 12px;
    background: #fff;
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--primary-soft);
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-small { width: auto; padding: 8px 12px; font-size: 13px; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: #fdeaea; color: var(--danger); }
.btn-link { background: none; color: var(--muted); padding: 8px; }

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.alert-error { background: #fdeaea; color: var(--danger); }
.alert-ok { background: #e8f7ee; color: var(--ok); }

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    background: var(--sidebar);
    color: #d7d9ee;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    padding: 8px 10px 22px;
}

.sidebar .brand img {
    width: 32px;
    height: 32px;
    display: block;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-foot {
    margin-top: auto;
    padding: 12px;
    color: #9aa0c7;
    font-size: 12px;
}

.main { min-width: 0; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    color: var(--ink);
}

.topbar-user {
    color: var(--muted);
    white-space: nowrap;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--ink);
}

.sidebar-overlay {
    display: none;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.content { padding: 28px; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
}

.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 28px; color: var(--ink); margin-top: 6px; }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--ink);
}

.layout-2 {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
tr:hover td { background: #fafbff; }

.job-title { color: var(--ink); font-weight: 600; }
.muted { color: var(--muted); }
.tag {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

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

.search-inline {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    min-width: 240px;
}

.empty { text-align: center; color: var(--muted); padding: 28px 0; }

@media (max-width: 1100px) {
    .layout-2 {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 900px) {
    .login-page {
        grid-template-columns: 1fr;
        min-height: 100vh;
    }

    .login-brand {
        min-height: auto;
        padding: 28px 24px;
    }

    .login-brand h1 {
        font-size: 28px;
    }

    .login-panel {
        padding: 28px 20px 40px;
        align-items: start;
    }
}

@media (max-width: 860px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 22, 40, 0.45);
        z-index: 80;
    }

    .sidebar-overlay[hidden] {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, 86vw);
        z-index: 90;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 12px 0 30px rgba(0, 0, 0, 0.18);
    }

    body.menu-open {
        overflow: hidden;
    }

    .topbar {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .topbar-user {
        font-size: 12px;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content {
        padding: 16px;
    }

    .panel {
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-filters {
        width: 100%;
    }

    .search-inline {
        min-width: 0;
        width: 100%;
        flex: 1 1 160px;
    }

    table {
        min-width: 640px;
    }

    .btn-primary {
        width: auto;
    }

    .login-box .btn-primary,
    .layout-2 .btn-primary {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card strong {
        font-size: 22px;
    }

    .topbar-user {
        display: none;
    }

    .login-brand {
        padding: 22px 18px;
    }

    .login-panel {
        padding: 20px 16px 32px;
    }
}
