/* ── HR Recruitment Portal ── */

:root {
    --primary:            #2563eb;
    --primary-dark:       #1d4ed8;
    --primary-rgb:        37,99,235;
    --sidebar-bg:         #1e293b;
    --sidebar-text:       #94a3b8;
    --sidebar-heading:    #ffffff;
    --sidebar-active:     #2563eb;
    --sidebar-active-text:#ffffff;
    --sidebar-hover:      #334155;
    --sidebar-hover-text: #e2e8f0;
    --sidebar-divider:    #334155;
    --sidebar-user-text:  #f1f5f9;
    --body-bg: #f1f5f9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--body-bg); color: #1e293b; }

/* ── Layout ── */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 240px; min-width: 240px; background: var(--sidebar-bg); display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: #fff; border-bottom: 3px solid var(--primary); padding: 0 1.5rem; height: 56px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.page-body { flex: 1; overflow-y: auto; padding: 1.5rem; }

/* ── Sidebar ── */
.sidebar-logo { padding: 1.25rem 1rem; border-bottom: 1px solid var(--sidebar-divider); }
.sidebar-logo h1 { color: var(--sidebar-heading); font-size: 1rem; font-weight: 700; }
.sidebar-logo p { color: var(--sidebar-text); font-size: 0.7rem; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.sidebar-section { padding: 0.5rem 1rem 0.25rem; font-size: 0.65rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-link { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 1rem; color: var(--sidebar-text); text-decoration: none; font-size: 0.825rem; font-weight: 500; border-radius: 0; transition: background .15s, color .15s; }
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--sidebar-hover-text); }
.sidebar-link.active { background: var(--sidebar-active); color: var(--sidebar-active-text); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--sidebar-divider); }
.sidebar-user { display: flex; align-items: center; gap: 0.625rem; }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sidebar-active); display: flex; align-items: center; justify-content: center; color: var(--sidebar-active-text); font-weight: 700; font-size: 0.75rem; flex-shrink: 0; }
.sidebar-user-info p { color: var(--sidebar-user-text); font-size: 0.8rem; font-weight: 600; line-height: 1.2; }
.sidebar-user-info span { color: var(--sidebar-text); font-size: 0.68rem; }

/* ── Cards ── */
.card { background: #fff; border-radius: 0.75rem; border: 1px solid #e2e8f0; }
.card-body { padding: 1.25rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 0.875rem; font-weight: 600; color: #1e293b; }

/* ── Stat Cards ── */
.stat-card { background: #fff; border-radius: 0.75rem; border: 1px solid #e2e8f0; padding: 1.25rem; }
.stat-card .label { font-size: 0.75rem; color: #64748b; font-weight: 500; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: #1e293b; margin: 0.25rem 0; }
.stat-card .sub { font-size: 0.75rem; color: #64748b; }
.stat-icon { width: 40px; height: 40px; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 20px; height: 20px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.8125rem; font-weight: 600; cursor: pointer; text-decoration: none; border: none; transition: background .15s, box-shadow .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.75rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.7rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: #374151; margin-bottom: 0.35rem; }
.form-label .req { color: #ef4444; }
.form-control { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.5rem; font-size: 0.8125rem; color: #1e293b; background: #fff; transition: border-color .15s, box-shadow .15s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }
.form-error { color: #ef4444; font-size: 0.72rem; margin-top: 0.25rem; }
.form-section { border: 1px solid #e2e8f0; border-radius: 0.625rem; overflow: hidden; margin-bottom: 1.25rem; }
.form-section-header { background: #f8fafc; padding: 0.625rem 1rem; border-bottom: 1px solid #e2e8f0; }
.form-section-header h3 { font-size: 0.72rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .07em; }
.form-section-body { padding: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: #f8fafc; }
th { text-align: left; font-size: 0.7rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .06em; padding: 0.625rem 1rem; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
td { padding: 0.75rem 1rem; font-size: 0.8125rem; color: #374151; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600; text-transform: capitalize; }
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-warning  { background: #fef3c7; color: #b45309; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* ── AI Score ── */
.ai-score { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 700; }
.ai-score-bar { height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.ai-score-fill { height: 100%; border-radius: 999px; }
.score-high  { color: #15803d; } .score-high  .ai-score-fill { background: #22c55e; }
.score-mid   { color: #b45309; } .score-mid   .ai-score-fill { background: #f59e0b; }
.score-low   { color: #b91c1c; } .score-low   .ai-score-fill { background: #ef4444; }

/* ── Alerts ── */
.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.8125rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.5rem; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Filters bar ── */
.filters { display: flex; gap: 0.625rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.filters .form-control { width: auto; min-width: 140px; }
.filters input.form-control { min-width: 200px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 0.25rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 0.5rem; border-radius: 0.375rem; font-size: 0.78rem; text-decoration: none; border: 1px solid #e2e8f0; color: #374151; }
.pagination a:hover { background: #f1f5f9; }
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled span { color: #cbd5e1; cursor: not-allowed; }

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.25rem; font-weight: 700; color: #0f172a; }
.page-header p { font-size: 0.8rem; color: #64748b; margin-top: 2px; }

/* ── Topbar ── */
.topbar-title { font-size: 0.9rem; font-weight: 600; color: #1e293b; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto; }
.modal-box { background: #fff; width: 100%; max-width: 860px; border-radius: 0.75rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; background: var(--primary); border-radius: 0.75rem 0.75rem 0 0; }
.modal-header h2 { color: #fff; font-size: 1rem; font-weight: 700; }
.modal-header p { color: rgba(255,255,255,.75); font-size: 0.72rem; margin-top: 2px; }
.modal-close { color: #fff; background: none; border: none; cursor: pointer; line-height: 1; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 0.625rem; }

/* ── Radio & Checkbox groups ── */
.radio-group { display: flex; flex-direction: column; gap: 0.375rem; }
.radio-item { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.8125rem; color: #374151; }
.radio-item input[type=radio], .radio-item input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--primary); }
.radio-item input:disabled + span { opacity: .45; }

/* ── Detail rows ── */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.detail-item p.label { font-size: 0.72rem; color: #64748b; margin-bottom: 2px; }
.detail-item p.value { font-size: 0.8125rem; font-weight: 600; color: #1e293b; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* ── Authorized Signatory Boxes ── */
.sig-box {
    border-radius: .625rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    transition: box-shadow .2s;
}
.sig-box.sig-signed {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    box-shadow: 0 2px 8px rgba(34,197,94,.15);
}
.sig-box.sig-active {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    box-shadow: 0 2px 12px rgba(59,130,246,.2);
}
.sig-box.sig-pending {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
}
.sig-box.sig-optional {
    background: #f9fafb;
    border: 2px dashed #e2e8f0;
    opacity: .75;
}
.sig-box.sig-rejected {
    background: #fff1f2;
    border: 2px solid #ef4444;
    box-shadow: 0 2px 8px rgba(239,68,68,.15);
}
.sig-box.sig-rejected .sig-script { color: #991b1b; }
.sig-box.sig-rejected .sig-tick   { color: #dc2626; }
.sig-box.sig-rejected .sig-date   { color: #dc2626; }
.sig-box.sig-rejected .sig-remark { color: #b91c1c; }

/* Signature display area */
.sig-area {
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: .375rem;
    background: rgba(255,255,255,.6);
    padding: .5rem;
    text-align: center;
}

/* Cursive signature name */
.sig-script {
    font-family: 'Brush Script MT', 'Segoe Script', 'Comic Sans MS', cursive;
    font-size: 1.45rem;
    color: #1e3a5f;
    line-height: 1.2;
    letter-spacing: .02em;
}
.sig-tick {
    font-size: .7rem;
    color: #16a34a;
    font-weight: 700;
    margin-top: .25rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Horizontal signature line */
.sig-line {
    border-bottom: 1.5px solid #94a3b8;
    margin: .25rem 0;
}

/* Text below the line */
.sig-role  { font-size: .68rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.sig-name  { font-size: .82rem; font-weight: 600; color: #1e293b; text-align: center; }
.sig-date  { font-size: .7rem; color: #16a34a; text-align: center; font-weight: 500; }
.sig-remark{ font-size: .72rem; color: #64748b; font-style: italic; text-align: center; }
