:root {
    --primary: #15559a;
    --primary-dark: #0b3a6d;
    --secondary: #f3f6fb;
    --accent: #f5a623;
    --success: #34c759;
    --danger: #ff3b30;
    --font-family-base: 'Inter', 'Segoe UI', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--secondary), #ffffff);
    font-family: var(--font-family-base);
    color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
}

.navbar {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Headings: harmonise marges/espaces */
h1, .h1 {
    margin: 0 0 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

h2, .h2,
h3, .h3 {
    margin: 0 0 0.75rem;
    font-weight: 700;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary);
    display: inline-flex; /* FIX: title alignment */
    align-items: center;  /* FIX: title alignment */
    gap: 0.5rem;          /* FIX: title alignment */
    line-height: 1.2;     /* FIX: title alignment */
    margin: 0;            /* FIX: title alignment */
}

.app-title-icon { /* Align with app */
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.icon-2x {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary);
}

/* Input styling for login forms */
.login-card .form-control {
    border-radius: 14px;
    border: 1px solid #e0e7ff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    padding: 12px 14px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.login-card .form-control:focus {
    border-color: #5b8def;
    box-shadow: 0 10px 24px rgba(91, 141, 239, 0.18);
    transform: translateY(-1px);
}

.login-card .form-control::placeholder {
    color: #6b7280;
    opacity: 0.9;
    font-weight: 500;
}

/* Instance cards */
.portal-instance-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 65%);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-instance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

/* Hero */
.portal-hero {
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.hero-title {
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: -0.5px;
}

.hero-gradient {
    background: linear-gradient(120deg, #1d4ed8, #22d3ee, #0010a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.alert {
    font-size: 1rem; /* Align with body text */
    line-height: 1.5; /* Align with body text */
}

.form-control,
.form-select {
    border-radius: 0.75rem;
    border: 1px solid rgba(21, 85, 154, 0.2);
    padding: 0.75rem 1rem;
}

.table {
    border-radius: 1rem;
    overflow: hidden;
}

.alert {
    border-radius: 0.75rem;
}

.footer {
    margin-top: auto;
}

.cookie-banner {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: 420px;
    margin: 0 auto;
    z-index: 1080;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.badge-role {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
}

.status-popover-btn {
    transition: all 0.2s ease;
}

.status-popover-btn.text-danger:hover,
.status-popover-btn.text-danger:focus {
    color: #fff !important;
    background-color: var(--bs-danger);
    border-color: var(--bs-danger);
}

.status-popover-btn.text-secondary:hover,
.status-popover-btn.text-secondary:focus {
    color: #212529 !important;
    background-color: rgba(108, 117, 125, 0.12);
    border-color: #6c757d;
}

.table-section-heading {
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

.table-subsection-heading {
    background-color: #f1f3f5;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

.table-child-row {
    background-color: #f8f9fa;
}

.progress-thin {
    height: 6px;
}

@media (max-width: 992px) {
    .navbar {
        border-radius: 0.75rem;
    }
}

@media (max-width: 576px) {
    .card {
        border-radius: 0.75rem;
    }
    .navbar-brand {
        font-size: 1rem;
    }
}

.btn-outline-pink {
    color: #d63384;
    border-color: #d63384;
}

.btn-outline-pink:hover,
.btn-outline-pink:focus {
    color: #fff;
    background-color: #d63384;
    border-color: #d63384;
}

/* Commission Emploi */
[data-bs-theme="dark"] .commission-page {
    background-color: #0f172a;
    color: #f8fafc;
}

.commission-wrapper {
    font-family: var(--font-family-base);
    color: #1f2937;
}

[data-bs-theme="dark"] .commission-page .commission-wrapper {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .commission-page .text-muted {
    color: #94a3b8 !important;
}

.commission-page {
    background: linear-gradient(135deg, #f6f8fb, #ffffff);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

[data-bs-theme="dark"] .commission-page {
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.55);
}

.commission-filters {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

[data-bs-theme="dark"] .commission-page .commission-filters {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.45);
}

.commission-filters .form-label {
    font-weight: 600;
    color: #1f2937;
}

[data-bs-theme="dark"] .commission-page .commission-filters .form-label {
    color: #f8fafc;
}

.commission-filters .form-text {
    color: #6b7280;
}

[data-bs-theme="dark"] .commission-page .commission-filters .form-text {
    color: #94a3b8;
}

.commission-card[data-visible="0"] {
    display: none !important;
}

.commission-establishment {
    padding: 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

[data-bs-theme="dark"] .commission-page .commission-establishment {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.45);
    color: #e2e8f0;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
}

.commission-establishment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.commission-establishment-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

.commission-establishment-location {
    color: #64748b;
    font-weight: 500;
}

.commission-establishment-rne {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
}

.commission-establishment-count {
    background: rgba(148, 163, 184, 0.15);
    color: #1e293b;
}

[data-bs-theme="dark"] .commission-page .commission-establishment .text-muted {
    color: #a5b4d4 !important;
}

[data-bs-theme="dark"] .commission-page .commission-establishment-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .commission-page .commission-establishment-location {
    color: #cbd5f5;
}

[data-bs-theme="dark"] .commission-page .commission-establishment-rne {
    color: #94a3b8;
}

.commission-post {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 1rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .commission-page .commission-post {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.55);
    color: #f8fafc;
}

.commission-post + .commission-post {
    margin-top: 1rem;
}

.commission-post-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.commission-post-code {
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
}

.commission-post-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.commission-post-meta {
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.commission-post-summary {
    color: #6b7280;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.commission-post-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.commission-post-badge {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
}

.commission-post-details {
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 500;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #1e293b;
    background-color: rgba(248, 250, 252, 0.8);
    transition: all 0.15s ease;
}

.commission-post-details:hover,
.commission-post-details:focus {
    color: #0f172a;
    border-color: #94a3b8;
    background-color: #e2e8f0;
}

[data-bs-theme="dark"] .commission-page .commission-post-code {
    color: #cbd5f5;
}

[data-bs-theme="dark"] .commission-page .commission-post-title {
    color: #f8fafc;
}

[data-bs-theme="dark"] .commission-page .commission-post-meta,
[data-bs-theme="dark"] .commission-page .commission-post-summary {
    color: #a5b4d4;
}

[data-bs-theme="dark"] .commission-page .commission-post-details {
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.6);
    background-color: rgba(30, 41, 59, 0.7);
}

[data-bs-theme="dark"] .commission-page .commission-post-details:hover,
[data-bs-theme="dark"] .commission-page .commission-post-details:focus {
    background-color: rgba(71, 85, 105, 0.75);
    border-color: rgba(148, 163, 184, 0.9);
}

[data-bs-theme="dark"] .commission-page .commission-card .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .commission-page .commission-card .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .commission-page .border {
    border-color: rgba(148, 163, 184, 0.35) !important;
}

[data-bs-theme="dark"] .commission-page .bg-light {
    background-color: rgba(148, 163, 184, 0.1) !important;
    color: #e2e8f0;
}

.badge-protege {
    background-color: #0ea5e9;
    color: #fff;
}

.badge-vacant {
    background-color: #fbbf24;
    color: #1f2937;
}

[data-bs-theme="dark"] .commission-page .badge.bg-light {
    background-color: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

.priority-chip {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.candidate-list > li {
    font-size: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.9rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.65rem;
    background: rgba(249, 250, 251, 0.95);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.candidate-list > li:nth-child(even) {
    background-color: rgba(241, 245, 249, 0.95);
}

.candidate-list > li:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background-color: rgba(219, 234, 254, 0.6);
}

.candidate-list {
    position: relative;
}

[data-bs-theme="dark"] .commission-page .candidate-list > li {
    border-color: rgba(99, 102, 241, 0.4);
    background-color: rgba(30, 41, 59, 0.9);
}

[data-bs-theme="dark"] .commission-page .candidate-list > li:nth-child(even) {
    background-color: rgba(51, 65, 85, 0.85);
}

[data-bs-theme="dark"] .commission-page .candidate-list > li:hover {
    border-color: rgba(129, 140, 248, 0.6);
    background-color: rgba(67, 56, 202, 0.4);
}

[data-bs-theme="dark"] .commission-page .candidate-row,
[data-bs-theme="dark"] .commission-page .candidate-row .text-muted {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .commission-page .candidate-row .text-muted small {
    color: #cbd5f5 !important;
}

.candidate-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.candidate-external-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-left: 0.4rem;
    color: #0f172a;
}

[data-bs-theme="dark"] .commission-page .candidate-external-icon {
    color: #facc15;
}

.candidate-item {
    cursor: grab;
    transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.candidate-item.is-dragging {
    opacity: 0.96;
    transform: scale(1.01);
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.25);
}

.candidate-item.is-dragging .candidate-drag-handle {
    cursor: grabbing;
}

.candidate-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    min-width: 1.25rem;
    font-size: 1rem;
    color: #6b7280;
    cursor: grab;
    user-select: none;
}

.candidate-order-controls .btn {
    white-space: nowrap;
}

[data-bs-theme="dark"] .candidate-drag-handle {
    color: #cbd5f5;
}

.mutation-reorder-wrapper {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.6);
}

.mutation-choice-list {
    position: relative;
}

.mutation-choice-item {
    cursor: grab;
    background: rgba(255, 255, 255, 0.95);
    transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.mutation-choice-item.is-dragging {
    opacity: 0.92;
    transform: scale(1.01);
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.25);
}

.mutation-choice-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    color: rgba(71, 85, 105, 0.9);
    font-size: 1.1rem;
    user-select: none;
}

.mutation-choice-item.is-dragging .mutation-choice-handle {
    cursor: grabbing;
}

.candidate-status-icon,
.candidate-wish-icon span {
    font-size: 1.2rem;
}

.candidate-status-icon {
    margin-right: 6px;
}

.candidate-wish-row {
    width: 100%;
    font-size: 0.9rem;
}

.candidate-wish-col {
    min-width: 0;
}

.candidate-wish-priority {
    flex: 0 0 100px;
}

.candidate-wish-label {
    flex: 1 1 auto;
}

.candidate-wish-status {
    flex: 0 0 180px;
}

.candidate-wish-icon {
    flex: 0 0 48px;
    font-size: 1.3rem;
    color: #0f172a;
}

.candidate-wish-list .list-group-item {
    font-size: 0.9rem;
    border-color: rgba(15, 23, 42, 0.08);
}

.candidate-wish-list .list-group-item:nth-child(even) {
    background-color: rgba(15, 23, 42, 0.03);
}

[data-bs-theme="dark"] .commission-page .candidate-wish-list .list-group-item {
    background-color: transparent;
    color: #e2e8f0;
    border-color: rgba(226, 232, 240, 0.12);
}

[data-bs-theme="dark"] .commission-page .candidate-wish-list .list-group-item:nth-child(even) {
    background-color: rgba(148, 163, 184, 0.12);
}

[data-bs-theme="dark"] .commission-page .candidate-wish-icon {
    color: #f8fafc;
}

[data-bs-theme="dark"] .commission-page .candidate-wish-status,
[data-bs-theme="dark"] .commission-page .candidate-wish-label {
    color: #e2e8f0 !important;
}

.commission-notice {
    background: #f3f4f6;
}

[data-bs-theme="dark"] .commission-page .commission-notice {
    background: rgba(148, 163, 184, 0.1);
}

.auto-assign-panel {
    font-family: var(--font-family-base);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 28px;
    margin-bottom: 32px;
}

[data-bs-theme="dark"] .commission-page .auto-assign-panel {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 25px 60px rgba(2, 6, 23, 0.85);
    color: #f8fafc;
}

.auto-assign-panel-header {
    text-align: center;
    margin-bottom: 18px;
}

.auto-assign-panel-title {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #1e293b;
}

[data-bs-theme="dark"] .commission-page .auto-assign-panel-title {
    color: #f8fafc;
}

.auto-assign-panel-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 4px;
}

[data-bs-theme="dark"] .commission-page .auto-assign-panel-subtitle {
    color: #cbd5f5;
}

.auto-assign-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.auto-assign-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    min-width: 160px;
    font-size: 0.9rem;
}

.auto-assign-btn:focus,
.auto-assign-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
}

.auto-assign-btn-outline {
    border-color: #38bdf8;
    background: #ffffff;
    color: #0f4c64;
    font-size: 0.85rem;
}

.auto-assign-btn-outline:hover {
    background: #e0f2fe;
}

[data-bs-theme="dark"] .commission-page .auto-assign-btn-outline {
    background: transparent;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.6);
}

[data-bs-theme="dark"] .commission-page .auto-assign-btn-outline:hover {
    background: rgba(148, 163, 184, 0.15);
}

.auto-assign-btn-primary {
    border-color: #15559a;
    background: #15559a;
    color: #ffffff;
    font-size: 0.85rem;
}

[data-bs-theme="dark"] .commission-page .auto-assign-btn-primary {
    border-color: #93c5fd;
    background: #2563eb;
}

.auto-assign-btn-danger {
    border-color: #e53e3e;
    background: #e53e3e;
    color: #ffffff;
    font-size: 0.85rem;
}

[data-bs-theme="dark"] .commission-page .auto-assign-btn-danger {
    border-color: #f87171;
    background: #b91c1c;
}

.auto-assign-btn-icon {
    font-size: 1.1rem;
}

.auto-assign-result {
    background: #e5e7eb;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 16px;
    font-size: 0.85rem;
    margin-top: 20px;
}

[data-bs-theme="dark"] .commission-page .auto-assign-result {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.2);
}

.auto-assign-result .auto-assign-status {
    margin-bottom: 12px;
}

.auto-assign-result-content ul,
.auto-assign-result-content ol {
    padding-left: 1rem;
}

.auto-assign-result-content li {
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    list-style-position: inside;
}

.auto-assign-counts {
    list-style: none;
    padding-left: 0;
    margin-bottom: 12px;
}

.auto-assign-result-content .status-accepte,
.auto-assign-counts .status-accepte {
    background: #dcfce7;
    color: #166534;
}

.auto-assign-result-content .status-refuse,
.auto-assign-counts .status-refuse {
    background: #fee2e2;
    color: #991b1b;
}

.auto-assign-result-content .status-en_attente,
.auto-assign-counts .status-en_attente {
    background: #fef9c3;
    color: #713f12;
}

.auto-assign-result-content .status-retire,
.auto-assign-counts .status-retire {
    background: #e2e8f0;
    color: #1e293b;
}

.auto-assign-modal-content {
    font-family: var(--font-family-base);
}

.auto-assign-modal-body {
    color: #475569;
    font-size: 0.95rem;
}

.auto-assign-modal-body p {
    margin-bottom: 12px;
}

.auto-assign-rules-list,
.auto-assign-steps-list {
    line-height: 1.55;
    margin-left: 18px;
    padding-left: 0;
}

.auto-assign-rules-list li,
.auto-assign-steps-list li {
    margin-bottom: 8px;
}

.auto-assign-sublist {
    margin: 6px 0 0 16px;
    padding-left: 0;
}

@media (max-width: 768px) {
    .commission-page {
        padding: 20px;
    }
    .auto-assign-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .auto-assign-btn {
        width: 100%;
    }
    .commission-post-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
.candidate-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background-color: #ffffff;
    color: #1e293b;
    font-weight: 600;
    padding: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.candidate-info-btn:hover,
.candidate-info-btn:focus {
    background-color: #e2e8f0;
    border-color: rgba(59, 130, 246, 0.6);
}
