:root {
    --bg: #e6edf5;
    --card: #ffffff;
    --border: #e2e5ea;
    --text: #1f2430;
    --muted: #6b7280;
    --primary: #2566b0;
    --primary-dark: #0b1c33;
    --accent: #2fc4e8;
    --green: #1f8a5f;
    --red: #b3261e;
    --amber: #b06a00;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-dark);
    color: white;
    padding: 10px 24px;
    border-bottom: 2px solid var(--accent);
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: white; }
.nav-brand img { width: 34px; height: 34px; display: block; }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.nav-brand-text .nav-brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.3px; }
.nav-brand-text .nav-brand-sub { font-size: 11px; color: #9fc4e8; }
.nav-links a, .nav-user a {
    color: white;
    text-decoration: none;
    margin-inline-start: 16px;
    opacity: 0.9;
}
.nav-links a:hover, .nav-user a:hover { opacity: 1; text-decoration: underline; }
.nav-user { display: flex; align-items: center; gap: 8px; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin-bottom: 4px; }
h2 { font-size: 18px; margin-top: 28px; }
.subtitle { color: var(--muted); margin-bottom: 20px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 18px;
}

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #eef1f5; font-weight: 600; color: var(--muted); }
tr:hover td { background: #fafbfc; }
a.rowlink { color: var(--primary); text-decoration: none; font-weight: 600; }
a.rowlink:hover { text-decoration: underline; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text);
}
textarea { width: 100%; min-height: 80px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.btn {
    display: inline-block;
    padding: 9px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-new { background: #e5edf7; color: var(--primary); }
.badge-in_review { background: #fdf3d8; color: var(--amber); }
.badge-contacted { background: #e5edf7; color: var(--primary); }
.badge-offered { background: #e3f2ea; color: var(--green); }
.badge-hired { background: #d7f0e2; color: var(--green); }
.badge-on_hold { background: #f1f1f1; color: var(--muted); }
.badge-rejected { background: #fbe6e5; color: var(--red); }
.badge-withdrawn { background: #f1f1f1; color: var(--muted); }
.badge-handled { background: #e3f2ea; color: var(--green); }
.badge-unhandled { background: #fdf3d8; color: var(--amber); font-weight: 700; }

.score {
    font-weight: 700;
    font-size: 16px;
}
.score-high { color: var(--green); }
.score-mid { color: var(--amber); }
.score-low { color: var(--red); }

.flash-wrap { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #e3f2ea; color: var(--green); }
.flash-error { background: #fbe6e5; color: var(--red); }

.login-page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--primary-dark);
}
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { width: 84px; height: 84px; }
.login-logo .brand-name { color: white; font-weight: 700; font-size: 20px; margin-top: 8px; letter-spacing: 0.5px; }
.login-logo .brand-sub { color: #9fc4e8; font-size: 12px; margin-top: 2px; letter-spacing: 1px; }
.login-wrap {
    max-width: 380px;
    width: 100%;
}
.public-form-wrap {
    max-width: 640px;
    margin: 0 auto;
}
.public-header {
    text-align: center;
    margin-bottom: 24px;
}
.public-header .public-logo { margin-bottom: 10px; }
.public-header .public-logo img { width: 60px; height: 60px; }
.public-header .public-brand-name { color: var(--primary-dark); font-weight: 700; font-size: 15px; letter-spacing: 0.5px; margin-bottom: 4px; }

/* --- דשבורד (עמוד הבית) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.stat-tile {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary-dark);
    border-radius: 10px;
    padding: 16px 18px;
}
.stat-tile.accent { border-top-color: var(--accent); }
.stat-tile.good { border-top-color: var(--green); }
.stat-tile.warn { border-top-color: var(--amber); }
.stat-number { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dash-columns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.dash-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-section-title h2 { margin: 0; }
.dash-section-title a { font-size: 13px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.status-bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.status-bar-row .status-bar-label { flex: 0 0 150px; color: var(--text); }
.status-bar-row .status-bar-track { flex: 1; background: #eef1f5; border-radius: 6px; height: 10px; overflow: hidden; }
.status-bar-row .status-bar-fill { height: 100%; background: var(--primary); border-radius: 6px; }
.status-bar-row .status-bar-count { flex: 0 0 28px; text-align: left; color: var(--muted); }
.apply-link-box {
    display: flex; align-items: center; gap: 8px; background: #f8f9fb;
    border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
    font-size: 13px; direction: ltr; text-align: left; overflow-wrap: anywhere;
}
.page-header {
    background: var(--primary-dark);
    border-radius: 8px;
    padding: 20px 26px;
    margin-bottom: 22px;
    color: white;
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 20px;
}
.page-header h1, .page-header .subtitle { color: white; margin-bottom: 0; }
.page-header .subtitle { color: #9fc4e8; }
.page-header h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-header .btn-secondary { background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.35); }
.page-header .btn-secondary:hover { background: rgba(255,255,255,0.18); }
.page-header a.muted { color: #9fc4e8; }
.alert-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fdf3d8; border: 1px solid #f3d98a; color: #7a5200;
    border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; font-size: 14px;
}
.alert-banner a { color: #7a5200; }
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--primary); }
.activity-item.activity-new_candidate .activity-dot { background: var(--accent); }
.activity-item.activity-status_change .activity-dot { background: var(--primary); }
.activity-item.activity-review .activity-dot { background: var(--amber); }
.activity-item.activity-new_job .activity-dot { background: var(--green); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 14px; color: var(--text); }
.activity-text a { color: var(--text); text-decoration: none; }
.activity-text a:hover { text-decoration: underline; }
.activity-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; }
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-columns { grid-template-columns: 1fr; }
}

.muted { color: var(--muted); font-size: 13px; }
.mismatch-list { color: var(--red); font-size: 13px; }
.criteria-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }

/* --- public form: sections, job picker, yes/no screening questions --- */
.section-block { margin-bottom: 26px; }
.section-block h2 {
    font-size: 16px;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    color: var(--primary-dark);
}
.section-hint { color: var(--muted); font-size: 13px; margin: -6px 0 14px 0; }
.job-question {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}
.job-question .q-label { font-weight: 600; font-size: 14px; margin-bottom: 8px; display: block; color: var(--text); }
.yesno-group { display: flex; gap: 10px; margin-bottom: 8px; }
.yesno-group label {
    display: flex; align-items: center; gap: 6px;
    background: white; border: 1px solid var(--border); border-radius: 6px;
    padding: 10px 18px; cursor: pointer; font-size: 15px; color: var(--text);
    flex: 1; justify-content: center;
}
.yesno-group input[type=radio] { width: 18px; height: 18px; margin: 0; }
.yesno-group input[type=radio]:checked + span { font-weight: 700; }
#jobQuestionsWrap:empty::before {
    content: "בחר/י משרה למעלה כדי לראות שאלות ספציפיות אליה (אם יש).";
    color: var(--muted); font-size: 13px;
}
.job-select-wrap select { width: 100%; padding: 12px; font-size: 16px; }

/* --- dynamic language rows (public form + staff form) --- */
.lang-row {
    display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
}
.lang-row input[type=text] { flex: 2; }
.lang-row select { flex: 1; }
.lang-row-remove {
    flex: 0 0 auto; background: none; border: 1px solid var(--border); border-radius: 6px;
    color: var(--red); cursor: pointer; font-size: 14px; padding: 8px 12px; line-height: 1;
}
.lang-row-remove:hover { background: #fdf1f1; }

/* --- consent checkbox (public form) --- */
.consent-block {
    background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 14px;
}
.consent-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); }
.consent-label input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }

/* --- mobile-first responsiveness (especially for the public /apply form, opened mostly on phones) --- */
@media (max-width: 640px) {
    .container { padding: 14px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    input[type=text], input[type=search], input[type=email], input[type=password],
    input[type=number], input[type=date], select, textarea {
        font-size: 16px;   /* prevents iOS auto-zoom on focus */
        padding: 12px;
        width: 100%;
    }
    .btn { width: 100%; text-align: center; padding: 14px; font-size: 16px; }
    .public-form-wrap { max-width: 100%; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .container table { display: block; overflow-x: auto; white-space: nowrap; }
}
