/* ==========================================================================
   Évaluations RH — Baobab Express SA
   Feuille de style unique (aucune dépendance externe)
   ========================================================================== */

:root {
    --brand-900: #0b3d3a;
    --brand-800: #0d4f4a;
    --brand-700: #0f766e;
    --brand-600: #13887f;
    --brand-100: #d9efec;
    --accent: #d97706;
    --accent-soft: #fef3c7;
    --ink-900: #111827;
    --ink-700: #374151;
    --ink-500: #6b7280;
    --ink-300: #d1d5db;
    --ink-100: #f3f4f6;
    --surface: #ffffff;
    --bg: #f6f7f9;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --success: #15803d;
    --success-soft: #dcfce7;
    --info: #1d4ed8;
    --info-soft: #dbeafe;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06), 0 1px 3px rgba(17, 24, 39, .08);
    --shadow-md: 0 4px 12px rgba(17, 24, 39, .08);
    --sidebar-w: 258px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink-900);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .8125rem; }
.muted { color: var(--ink-500); }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-900), var(--brand-800) 60%, #0a3532);
    color: #e7f4f2;
    padding: 1.25rem 1rem 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; gap: .7rem; align-items: center; margin-bottom: 1.5rem; }
.brand-logo {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--accent);
    display: grid; place-items: center;
    font-weight: 800; color: #1f2937; font-size: 1rem;
}
.brand-text strong { display: block; font-size: .95rem; letter-spacing: .01em; }
.brand-text span { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #9fd3cd; }

.nav-group { margin-bottom: 1.1rem; }
.nav-title {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
    color: #86bfb9; margin: .4rem .6rem .35rem;
}
.nav-link {
    display: flex; align-items: center; gap: .55rem;
    padding: .5rem .65rem; border-radius: var(--radius-sm);
    color: #dceeec; font-size: .9rem; margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.nav-link .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .9; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .9rem 1.6rem;
    background: var(--surface); border-bottom: 1px solid var(--ink-100);
    position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { font-size: .8rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: .08em; }
.topbar h1 { font-size: 1.2rem; margin: 0; }

.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--brand-100); color: var(--brand-800);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.user-chip .user-meta { line-height: 1.15; }
.user-chip .user-meta strong { display: block; font-size: .875rem; }
.user-chip .user-meta span { font-size: .75rem; color: var(--ink-500); }

.content { padding: 1.4rem 1.6rem 3rem; max-width: 1500px; width: 100%; }

/* ---------- Cards & grids ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--ink-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.2rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--ink-100);
}
.card-head h2 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.1rem 1.2rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--ink-100); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-500); }
.stat .value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; margin-top: .25rem; }
.stat .hint { font-size: .78rem; color: var(--ink-500); }
.stat.accent { border-left: 4px solid var(--brand-700); }
.stat.warn { border-left: 4px solid var(--accent); }
.stat.ok { border-left: 4px solid var(--success); }
.stat.dark { border-left: 4px solid var(--brand-900); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.table th, table.table td { padding: .6rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--ink-100); }
table.table thead th {
    background: var(--ink-100); color: var(--ink-700);
    font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650;
    position: sticky; top: 0;
}
table.table tbody tr:hover { background: #fafbfc; }
table.table tfoot td { font-weight: 600; background: var(--ink-100); }
table.table.compact td, table.table.compact th { padding: .42rem .6rem; }
.truncate { display: inline-block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .16rem .5rem; border-radius: 999px;
    font-size: .72rem; font-weight: 650; letter-spacing: .02em;
    background: var(--ink-100); color: var(--ink-700); white-space: nowrap;
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--ink-100); color: var(--ink-500); }
.badge.brand { background: var(--brand-100); color: var(--brand-800); }

.pill {
    display: inline-block; padding: .1rem .45rem; border-radius: 6px;
    background: var(--ink-100); font-size: .72rem; color: var(--ink-700);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .9rem; border-radius: var(--radius-sm);
    border: 1px solid var(--ink-300); background: var(--surface); color: var(--ink-700);
    font-size: .875rem; font-weight: 600; cursor: pointer; line-height: 1.2;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--ink-100); text-decoration: none; }
.btn-primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #b45309; border-color: #b45309; color: #fff; }
.btn-danger { background: var(--surface); border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-700); }
.btn-ghost:hover { background: var(--brand-100); }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: .85rem; }
label.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-700); margin-bottom: .25rem; }
.input, .select, .textarea {
    width: 100%; padding: .5rem .65rem; border-radius: var(--radius-sm);
    border: 1px solid var(--ink-300); background: #fff; font: inherit; font-size: .875rem; color: var(--ink-900);
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--brand-100); border-color: var(--brand-600); }

/* ---------- Select2 : recherche dans les listes deroulantes ---------- */
.select2-container { max-width: 100%; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 36px;
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.select2-container--default .select2-selection--single { height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    padding-left: .65rem;
    padding-right: 1.6rem;
    font-size: .875rem;
    color: var(--ink-900);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--ink-500); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 34px; right: .35rem; }
.select2-container--default .select2-selection--multiple { padding: .15rem .35rem; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--brand-100);
    border: 1px solid var(--brand-600);
    border-radius: 999px;
    color: var(--brand-900);
    font-size: .78rem;
    padding: .1rem .55rem;
    margin: .2rem .25rem .2rem 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--brand-800);
    margin-right: .35rem;
    font-weight: 700;
}
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    font-size: .875rem;
    margin-top: .25rem;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    outline: 2px solid var(--brand-100);
    border-color: var(--brand-600);
}
.select2-container--default .select2-selection--single .select2-selection__clear { color: var(--ink-500); margin-right: .2rem; }
.select2-dropdown {
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 22px rgba(17, 24, 39, .12);
    font-size: .875rem;
    z-index: 2100;
}
.select2-container--default .select2-search--dropdown { padding: .45rem .5rem; }
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    padding: .4rem .55rem;
    font-size: .85rem;
    outline: none;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus { border-color: var(--brand-600); }
.select2-container--default .select2-results__option { padding: .45rem .65rem; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--brand-700);
    color: #fff;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
    background: var(--brand-100);
    color: var(--brand-900);
    font-weight: 600;
}
.select2-container--default .select2-results__option--highlighted[aria-selected="true"] { color: #fff; }
.select2-results__message { color: var(--ink-500); font-size: .85rem; }
.textarea { min-height: 80px; resize: vertical; }
.input.score { width: 90px; text-align: center; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { margin-bottom: 0; }

.alert { border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .875rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); border-color: #86efac; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #fca5a5; color: #7f1d1d; }
.alert-info { background: var(--info-soft); border-color: #bfdbfe; color: #1e3a8a; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: radial-gradient(circle at 15% 20%, #0f766e 0%, #0b3d3a 45%, #072b29 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .28); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .brand-logo { margin: 0 auto .6rem; width: 52px; height: 52px; font-size: 1.2rem; }
.auth-brand h1 { font-size: 1.15rem; margin-bottom: .2rem; }
.auth-brand p { color: var(--ink-500); font-size: .82rem; margin: 0; }
.auth-hint { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px dashed var(--ink-300); font-size: .78rem; color: var(--ink-500); }
.auth-hint code { background: var(--ink-100); padding: .05rem .3rem; border-radius: 4px; }

/* ---------- Evaluation form ---------- */
.section-card { border: 1px solid var(--ink-100); border-radius: var(--radius); margin-bottom: 1.1rem; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1rem; background: var(--brand-900); color: #fff;
}
.section-head h3 { margin: 0; font-size: .95rem; font-weight: 600; }
.section-head .section-score { font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.16); padding: .15rem .55rem; border-radius: 999px; font-size: .82rem; }
.block { padding: .8rem 1rem .2rem; border-bottom: 1px solid var(--ink-100); }
.block:last-of-type { border-bottom: 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.block-head h4 { margin: 0; font-size: .875rem; color: var(--brand-800); text-transform: uppercase; letter-spacing: .05em; }
.block-head .block-score { font-size: .78rem; color: var(--ink-500); }
.question { display: grid; grid-template-columns: 1fr 110px; gap: .8rem; padding: .5rem 0; border-bottom: 1px dashed var(--ink-100); align-items: start; }
.question:last-child { border-bottom: 0; }
.question .q-text { font-size: .875rem; }
.question .q-meta { font-size: .74rem; color: var(--ink-500); }
.question .q-input { text-align: right; }
.question .q-input input { width: 90px; text-align: center; }
.section-footer { padding: .8rem 1rem 1rem; background: #fbfdfc; }
.section-footer .grid-2 { gap: .8rem; }

/* ---------- Appreciation grid (fiches checklist) ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.choice-grid label { position: relative; display: block; cursor: pointer; }
.choice-grid input { position: absolute; opacity: 0; inset: 0; }
.choice-grid span {
    display: block; text-align: center; padding: .4rem .2rem; border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm); font-size: .75rem; line-height: 1.2; background: #fff; color: var(--ink-700);
}
.choice-grid input:checked + span { background: var(--brand-700); border-color: var(--brand-700); color: #fff; font-weight: 650; }
.choice-grid input:focus-visible + span { outline: 2px solid var(--brand-100); }

/* ---------- Score display ---------- */
.score-big { font-size: 2.4rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.score-outof { font-size: .9rem; color: var(--ink-500); }
.score-line { display: flex; align-items: center; gap: .6rem; }
.progress { height: 8px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-700); }
.progress.warn > span { background: var(--accent); }
.progress.danger > span { background: var(--danger); }

.bar-row { display: grid; grid-template-columns: 200px 1fr 60px; gap: .8rem; align-items: center; margin-bottom: .45rem; font-size: .82rem; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--ink-500); }
.empty strong { display: block; color: var(--ink-700); margin-bottom: .2rem; }
.divider { height: 1px; background: var(--ink-100); margin: 1rem 0; }
.stack > * + * { margin-top: .6rem; }
.inline { display: inline; }
.spacer { flex: 1; }
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; }

.pagination { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .8rem 1rem; }
.pagination a, .pagination span {
    min-width: 34px; text-align: center; padding: .3rem .55rem; border-radius: var(--radius-sm);
    border: 1px solid var(--ink-300); font-size: .8rem; color: var(--ink-700); background: #fff;
}
.pagination .current { background: var(--brand-700); border-color: var(--brand-700); color: #fff; font-weight: 650; }
.pagination .disabled { opacity: .45; }

.actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.actions form { display: inline; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { position: relative; width: 100%; flex: none; height: auto; padding: 1rem; }
    .sidebar .nav-group { display: none; }
    .sidebar.open .nav-group { display: block; }
    .brand { margin-bottom: .5rem; }
    .content { padding: 1rem; }
    .topbar { padding: .8rem 1rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .question { grid-template-columns: 1fr; }
    .question .q-input { text-align: left; }
    .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bar-row { grid-template-columns: 120px 1fr 50px; }
}
@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .content { padding: 0; }
    .card, .section-card { box-shadow: none; border-color: #999; break-inside: avoid; }
    body { background: #fff; }
}
