/* ============================================================
   Portail RH — thème AGRI DIAM
   Bleu institutionnel #094693 · Vert agricole #18913F
   ============================================================ */
:root {
    --blue: #094693; --blue-700: #073a7a; --blue-800: #052c5e; --blue-50: #eaf1fb; --blue-100: #d3e2f6;
    --green: #18913f; --green-700: #127432; --green-50: #e8f6ec;
    --ink: #13233d; --ink-2: #44526a; --muted: #6b778c; --line: #e2e8f1; --line-2: #eef2f7;
    --bg: #f3f6fa; --card: #ffffff;
    --amber: #b7791f; --amber-50: #fdf5e6; --red: #c0352b; --red-50: #fdecea;
    --purple: #6b46c1; --purple-50: #f1ecfb; --teal: #0e7c86; --teal-50: #e4f5f6;
    --radius: 12px; --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 35, 70, .06), 0 4px 16px rgba(16, 35, 70, .05);
    --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--line-2); padding: 1px 6px; border-radius: 5px; color: var(--blue-800); }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.01em; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .text-right { text-align: right; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent; font: 600 13.5px/1.2 var(--font); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(9, 70, 147, .25); }
.btn-primary:hover { background: var(--blue-700); color: #fff; }
.btn-success { background: var(--green); color: #fff; } .btn-success:hover { background: var(--green-700); color: #fff; }
.btn-danger { background: #fff; color: var(--red); border-color: #f1c4bf; } .btn-danger:hover { background: var(--red-50); color: var(--red); }
.btn-light { background: #fff; color: var(--ink-2); border-color: var(--line); } .btn-light:hover { border-color: var(--blue-100); background: var(--blue-50); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--muted); } .btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-icon { width: 36px; height: 36px; padding: 0; background: transparent; color: var(--ink-2); border-radius: 9px; position: relative; }
.btn-icon:hover { background: var(--blue-50); color: var(--blue); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }

/* ---------- Alertes & badges ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert-error { background: var(--red-50); color: #8f2219; border-color: #f4cbc6; }
.alert-success { background: var(--green-50); color: var(--green-700); border-color: #bfe5cb; }
.alert-warning { background: var(--amber-50); color: #7c5212; border-color: #f1dcb2; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.4; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-indigo { background: var(--blue-50); color: var(--blue); }
.badge-success { background: var(--green-50); color: var(--green-700); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-danger, .badge-red { background: var(--red-50); color: var(--red); }
.badge-purple { background: var(--purple-50); color: var(--purple); }
.badge-teal { background: var(--teal-50); color: var(--teal); }
.badge-muted { background: var(--line-2); color: var(--muted); }

/* ---------- Formulaires ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label, .filter-field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input:not([type]), select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
    font: 14px var(--font); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9, 70, 147, .12); }
input::placeholder, textarea::placeholder { color: #a3adbd; }
input[type=file] { font: 13px var(--font); color: var(--ink-2); }
.checkbox-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; margin: 4px 0 14px; }
.checkbox-line input { width: 16px; height: 16px; accent-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; align-items: end; }
.form-grid .form-group { margin: 0; } .form-grid .span-2 { grid-column: span 2; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.stacked-form .panel { margin-bottom: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.filter-field.grow { flex: 1; min-width: 220px; }
.inline-edit { display: flex; gap: 8px; align-items: center; } .inline-edit.wrap { flex-wrap: wrap; }
.inline-edit input, .inline-edit select { width: auto; padding: 7px 10px; font-size: 13px; }
.inline-edit input.short { width: 92px; } .inline-edit .checkbox-line { margin: 0; font-size: 12.5px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note-input { margin-bottom: 8px; padding: 7px 10px !important; font-size: 13px !important; }
.decision-buttons { display: flex; gap: 6px; }
.info-box { display: flex; gap: 28px; flex-wrap: wrap; padding: 14px 18px; background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: var(--radius-sm); margin-top: 14px; }
.info-box div { display: flex; flex-direction: column; } .info-box strong { font-size: 18px; color: var(--blue); } .info-box span { font-size: 12px; color: var(--ink-2); }

/* ---------- Page de connexion ---------- */
.auth-page { min-height: 100vh; background: #fff; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 56px 56px 40px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(120% 90% at 0% 100%, rgba(24, 145, 63, .55) 0%, rgba(24, 145, 63, 0) 55%), linear-gradient(160deg, var(--blue) 0%, var(--blue-800) 100%); }
.auth-brand::before { content: ""; position: absolute; left: -30%; right: -40%; top: 34%; height: 46%; border: 10px solid rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .16) transparent transparent transparent; border-radius: 50%; transform: rotate(-6deg); }
.auth-brand img { width: 220px; position: relative; }
.auth-brand h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 700; max-width: 420px; position: relative; }
.auth-brand h2 span { color: #8fe0a8; }
.auth-brand p { color: rgba(255, 255, 255, .78); max-width: 400px; position: relative; margin: 14px 0 0; }
.auth-brand small { color: rgba(255, 255, 255, .6); position: relative; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 38px 36px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card.center { text-align: center; }
.auth-logo { display: none; text-align: center; margin-bottom: 18px; } .auth-logo img { width: 190px; }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-intro { color: var(--muted); margin: 0 0 24px; }
.auth-form .btn { margin-top: 4px; padding: 11px 16px; font-size: 14px; }
.auth-footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.demo-accounts { margin-top: 22px; padding: 14px 16px; background: var(--line-2); border-radius: var(--radius-sm); font-size: 12.5px; }
.demo-title { margin: 0 0 6px; font-weight: 700; color: var(--ink-2); }
.demo-accounts div { display: flex; gap: 8px; align-items: center; } .demo-accounts div + div { margin-top: 4px; } .demo-accounts span { width: 90px; color: var(--muted); }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-brand { display: none; } .auth-logo { display: block; } }

/* ---------- Structure application ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #dbe6f6;
    background: linear-gradient(180deg, var(--blue-800) 0%, var(--blue) 100%); z-index: 40; }
.sidebar-brand { display: flex; align-items: center; justify-content: center; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar-brand img { width: 168px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-caption { margin: 8px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: rgba(255, 255, 255, .5); }
.nav-caption:not(:first-child) { margin-top: 20px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 2px; border-radius: 9px; color: #dbe6f6; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: #45c56d; }
.nav-count { margin-left: auto; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar-version { font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.sidebar-backdrop { display: none; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-toggle { display: none; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-title strong { font-size: 15px; } .topbar-title span { font-size: 12px; color: var(--green); font-weight: 600; letter-spacing: .02em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); }
.user-chip:hover { border-color: var(--blue-100); background: var(--blue-50); text-decoration: none; color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue), var(--green)); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; } .user-chip-text strong { font-size: 13px; } .user-chip-text small { font-size: 11.5px; color: var(--muted); }
.notification-wrap { position: relative; }
.notif-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.notification-panel { display: none; position: absolute; right: 0; top: 46px; width: 340px; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16, 35, 70, .14); }
.notification-wrap.open .notification-panel { display: block; }
.panel-title { margin: 0; padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.notification-item { display: flex; flex-direction: column; gap: 2px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.notification-item:hover { background: var(--blue-50); text-decoration: none; color: var(--ink); }
.notification-item span { font-size: 13px; color: var(--ink-2); } .notification-item small { font-size: 11.5px; color: var(--muted); }
.content { padding: 28px; max-width: 1360px; width: 100%; }

/* ---------- Titres de page, cartes ---------- */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-heading h1 { font-size: 24px; font-weight: 700; }
.page-heading p { margin: 4px 0 0; color: var(--muted); }
.heading-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .heading-actions form { margin: 0; }
.identity { display: flex; gap: 16px; align-items: center; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.panel h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 14px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-header h2 { margin: 0; }
.panel-header a { font-size: 13px; font-weight: 600; }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.detail-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 20px; }
.detail-sections .panel { margin: 0; }
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list div { display: grid; grid-template-columns: 44% 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 13px; } .detail-list dd { margin: 0; font-weight: 500; }
.profile-avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue), var(--green)); flex-shrink: 0; }
.profile-avatar.small { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

/* ---------- Statistiques ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, border-color .15s; }
a.stat-card:hover { text-decoration: none; border-color: var(--blue-100); transform: translateY(-1px); color: var(--ink); }
.stat-card div { display: flex; flex-direction: column; min-width: 0; }
.stat-card strong { font-size: 21px; font-weight: 700; line-height: 1.2; }
.stat-card span:not(.stat-icon) { font-size: 12.5px; color: var(--muted); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon.indigo { background: var(--blue-50); color: var(--blue); }
.stat-icon.teal { background: var(--green-50); color: var(--green); }
.stat-icon.amber { background: var(--amber-50); color: var(--amber); }
.stat-icon.purple { background: var(--purple-50); color: var(--purple); }

/* ---------- Soldes de congés ---------- */
.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.balance-panel { padding: 20px 22px; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, var(--blue) 0%, var(--blue-700) 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.balance-panel:nth-child(2) { background: linear-gradient(135deg, var(--green) 0%, var(--green-700) 100%); }
.balance-label { font-size: 12.5px; opacity: .85; }
.balance-value { font-size: 32px; font-weight: 700; line-height: 1.1; } .balance-value small { font-size: 14px; font-weight: 500; opacity: .85; }
.balance-meta { font-size: 12.5px; opacity: .85; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 22px; background: #f8fafc; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 22px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcff; }
.table tfoot th { background: var(--blue-50); color: var(--blue-800); font-size: 13px; text-transform: none; letter-spacing: 0; border-top: 2px solid var(--blue-100); }
.table .text-right, .table th.text-right { text-align: right; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell > * { display: inline-flex; vertical-align: middle; margin: 0 0 0 4px; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding-top: 14px; }

/* ---------- Annonces ---------- */
.announcement-list { display: grid; gap: 12px; }
.announcement-list.large { gap: 16px; margin-bottom: 16px; }
.announcement-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.announcement-list.large .announcement-card { box-shadow: var(--shadow); padding: 20px 22px; }
.announcement-card.pinned { border-left: 4px solid var(--green); }
.announcement-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.announcement-head h2 { font-size: 16.5px; margin: 0 0 2px; } .announcement-head h3 { font-size: 14.5px; margin: 0; }
.announcement-head small { color: var(--muted); font-size: 12px; }
.announcement-body { color: var(--ink-2); }

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 28, 60, .45); backdrop-filter: blur(2px); }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: #fff; border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 60px rgba(5, 28, 60, .3); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; } .modal-header h2 { font-size: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) { .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(5, 28, 60, .45); z-index: 35; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 18px; } .topbar { padding: 0 14px; }
    .user-chip-text { display: none; } .user-chip { padding: 2px; }
    .form-grid .span-2 { grid-column: auto; } .form-row { grid-template-columns: 1fr; }
}
