/* ---------- Design tokens ---------- */
:root {
    --brand: #2557d6;
    --brand-dark: #1a43ad;
    --brand-soft: #eaf0fd;
    --text: #1b2130;
    --muted: #5d6679;
    --border: #e3e7ef;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --success: #137a4b;
    --success-soft: #e5f6ee;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --info: #1d5fa8;
    --info-soft: #e8f1fb;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-hover: 0 8px 24px rgba(16, 24, 40, .08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.page { padding: 32px 0 64px; min-height: calc(100vh - 64px - 72px); }

/* ---------- Navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 10;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.navbar .container {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px; gap: 16px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 18px; color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--brand); color: #fff; font-size: 16px;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a, .nav-links .link-button {
    padding: 8px 12px; border-radius: 8px;
    color: var(--muted); font-weight: 500;
}
.nav-links a:hover, .nav-links .link-button:hover { background: var(--bg); color: var(--text); }
.nav-links a.active { color: var(--brand); background: var(--brand-soft); }
.nav-user {
    display: flex; align-items: center; gap: 8px;
    margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--border);
}
.avatar {
    display: grid; place-items: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 600; font-size: 14px;
}
.nav-user form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { background: var(--success-soft); color: var(--success); cursor: default; }
.link-button {
    background: none; border: 0; font: inherit; cursor: pointer;
}

/* ---------- Alerts ---------- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.alert {
    padding: 12px 16px; border-radius: 8px; border: 1px solid;
    background: var(--info-soft); color: var(--info); border-color: #c9ddf5;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bfe6d3; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f7c9c4; }

/* ---------- Hero + search ---------- */
.hero {
    background: linear-gradient(135deg, #1a43ad 0%, #2557d6 55%, #3b82f6 100%);
    color: #fff; padding: 56px 0 72px;
}
.hero h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.02em; }
.hero p { margin: 0 0 28px; color: rgba(255, 255, 255, .85); font-size: 17px; }
.search-bar {
    display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px;
    background: var(--surface); padding: 8px; border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(10, 30, 80, .25);
}
.search-field { display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); }
.search-field + .search-field { border-left: 1px solid var(--border); }
.search-field input {
    width: 100%; border: 0; outline: 0; padding: 10px 0;
    font: inherit; color: var(--text); background: transparent;
}

/* ---------- Layout helpers ---------- */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.section-head h1 { font-size: 26px; margin: 0; }
.section-head .subtitle { color: var(--muted); margin: 4px 0 0; }
.result-count { color: var(--muted); font-size: 14px; }
.result-count strong { color: var(--text); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 24px; }

/* ---------- Job cards ---------- */
.job-list { display: grid; gap: 12px; }
.job-card {
    display: flex; align-items: flex-start; gap: 16px; padding: 20px 24px;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.job-card:hover { box-shadow: var(--shadow-hover); border-color: #cdd6ea; }
.company-logo {
    display: grid; place-items: center; flex-shrink: 0;
    width: 48px; height: 48px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 700; font-size: 20px;
}
.company-logo.lg { width: 64px; height: 64px; font-size: 26px; border-radius: 14px; }
.job-card-main { flex: 1; min-width: 0; }
.job-title { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.job-title a { color: var(--text); }
.job-title a:hover { color: var(--brand); }
.job-company { color: var(--muted); font-weight: 500; margin: 0 0 10px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 14px; }
.job-meta span { display: inline-flex; align-items: center; gap: 6px; }
.job-card-side {
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    flex-shrink: 0; text-align: right;
}
.posted { color: var(--muted); font-size: 13px; }
.icon { width: 16px; height: 16px; flex-shrink: 0; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--bg); color: var(--muted);
}
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* ---------- Empty state ---------- */
.empty {
    text-align: center; padding: 56px 24px; color: var(--muted);
}
.empty h3 { color: var(--text); }
.empty .btn { margin-top: 12px; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 28px;
}
.pagination .current { color: var(--muted); font-size: 14px; padding: 0 8px; }

/* ---------- Job detail ---------- */
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.detail-header { display: flex; gap: 20px; align-items: flex-start; }
.detail-header h1 { font-size: 26px; }
.detail-section { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 24px; }
.detail-section h2 { font-size: 18px; margin-bottom: 12px; }
.description { color: #343b4c; }
.description p { margin: 0 0 1em; }
.sidebar { position: sticky; top: 88px; display: grid; gap: 16px; }
.overview { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.overview li { display: flex; gap: 12px; align-items: flex-start; }
.overview .icon-wrap {
    display: grid; place-items: center; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--brand-soft); color: var(--brand);
}
.overview .label { display: block; font-size: 13px; color: var(--muted); }
.overview .value { font-weight: 600; }
.sidebar-note { color: var(--muted); font-size: 14px; margin: 12px 0 0; text-align: center; }

/* ---------- Dashboard table ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 20px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfd; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .job-title { font-size: 15px; }
td .job-company { margin: 0; font-size: 14px; }
.cell-job { display: flex; align-items: center; gap: 12px; }
.cell-job .company-logo { width: 40px; height: 40px; font-size: 16px; }
.text-right { text-align: right; }

/* ---------- Forms ---------- */
.form-card { max-width: 720px; }
.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card-body { padding: 32px; }
.auth-card h1 { font-size: 24px; text-align: center; }
.auth-card .subtitle { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-footer { text-align: center; color: var(--muted); margin: 20px 0 0; font-size: 14px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
    width: 100%; padding: 10px 12px;
    font: inherit; color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 180px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 87, 214, .15);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.help { color: var(--muted); font-size: 13px; margin-top: 6px; }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: 13px; }
.errorlist.nonfield { margin: 0 0 16px; padding: 12px 16px; border-radius: 8px; background: var(--danger-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 8px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
.footer .container { display: flex; justify-content: space-between; align-items: center; height: 72px; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}
@media (max-width: 720px) {
    .container { padding: 0 16px; }
    .navbar .container { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
    .nav-links { width: 100%; overflow-x: auto; }
    .nav-user { margin-left: auto; }
    .nav-user .username { display: none; }
    .search-bar { grid-template-columns: 1fr; }
    .search-field + .search-field { border-left: 0; border-top: 1px solid var(--border); }
    .job-card { flex-wrap: wrap; padding: 16px; }
    .job-card-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
    .form-row { grid-template-columns: 1fr; }
    .card-body, .auth-card .card-body { padding: 20px; }
    .footer .container { flex-direction: column; justify-content: center; height: auto; padding-top: 20px; padding-bottom: 20px; }
}

/* ---------- Application status ---------- */
.status { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-applied { background: var(--info-soft); color: var(--info); }
.status-reviewed { background: #f1effd; color: #5b3fc4; }
.status-shortlisted { background: #fff4e0; color: #9a5b00; }
.status-rejected { background: var(--danger-soft); color: var(--danger); }
.status-hired { background: var(--success-soft); color: var(--success); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
    color: var(--muted); background: var(--surface); border: 1px solid var(--border);
}
.tabs a:hover { color: var(--text); border-color: #cdd6ea; }
.tabs a.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.tabs .count { font-size: 12px; opacity: .8; }

.applicant-list { display: grid; gap: 12px; }
.applicant-card { padding: 20px 24px; }
.applicant-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.applicant-head .avatar { width: 44px; height: 44px; font-size: 18px; }
.applicant-head .info { flex: 1; min-width: 160px; }
.applicant-head .name { font-weight: 600; }
.applicant-head .sub { color: var(--muted); font-size: 14px; }
.applicant-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.applicant-actions form { display: flex; gap: 8px; margin: 0; }
.applicant-actions select {
    padding: 6px 10px; font: inherit; font-size: 14px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.cover-letter {
    margin-top: 14px; padding: 14px 16px; border-radius: 8px;
    background: var(--bg); color: #343b4c; font-size: 14px; white-space: pre-line;
}
.cover-letter summary { cursor: pointer; font-weight: 600; color: var(--text); }

.apply-job { display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 16px; }
.field input[type="file"] { padding: 10px; background: var(--bg); border-style: dashed; cursor: pointer; }
