/* Administration — feuille de style sans dépendance */
@font-face { font-family: "DM Sans"; src: url(../fonts/dm-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; }
@font-face { font-family: "DM Sans"; src: url(../fonts/dm-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; }
@font-face { font-family: "DM Sans"; src: url(../fonts/dm-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; }
@font-face { font-family: "Averia Sans Libre"; src: url(../fonts/averia-sans-libre-latin-700-normal.woff2) format("woff2"); font-weight: 700; }
:root { --primary: #334b35; --secondary: #6d8c54; --base: #f1cf69; --text: #4f5a50; --muted: #8a948b; --bg: #f6f4ec; --line: #e7e3d6; --white: #fff; --danger: #b83a3a; --radius: 10px; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "DM Sans", sans-serif; font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--primary); }
h1, h2, h3 { font-family: "Averia Sans Libre", serif; color: var(--primary); margin: 0; }
.ico { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .2s, color .2s; }
.btn-primary { background: var(--primary); color: var(--base); }
.btn-primary:hover { background: var(--secondary); color: var(--white); }
.btn-light { background: var(--white); color: var(--primary); border: 1px solid var(--line); }
.btn-light:hover { background: var(--bg); color: var(--primary); }
.btn-danger-light { background: #fbebeb; color: var(--danger); }
.btn-danger-light:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Mise en page */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--primary); color: #cfdccf; overflow-y: auto; z-index: 20; padding-bottom: 30px; }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); color: #fff; font-weight: 700; }
.sidebar__brand img { height: 52px; width: 52px; border-radius: 50%; }
.sidebar__brand small { color: #b9c9b0; font-size: 11px; }
.sidebar__brand span { font-size: 14px; letter-spacing: .02em; color: var(--base); line-height: 1.2; }
.sidebar__group { margin: 22px 22px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #8fa591; }
.sidebar__link { display: flex; align-items: center; gap: 12px; padding: 9px 22px; color: #dbe6d2; font-weight: 500; border-left: 3px solid transparent; }
.sidebar__link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar__link.is-active { background: rgba(255, 255, 255, .08); border-left-color: var(--base); color: #fff; }
.sidebar__link span { flex: 1; }
.sidebar__link b { background: var(--base); color: var(--primary); font-size: 11px; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.main { margin-left: 260px; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 16px; background: var(--white); border-bottom: 1px solid var(--line); padding: 14px 30px; position: sticky; top: 0; z-index: 10; }
.topbar__menu { display: none; background: none; border: 0; cursor: pointer; color: var(--primary); }
.topbar__menu .ico { width: 24px; height: 24px; }
.topbar__title { font-size: 22px; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.user-menu { position: relative; }
.user-menu__btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; color: var(--primary); }
.user-menu__name { font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; }
.user-menu__name small { font-weight: 400; color: var(--muted); font-size: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--base); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-menu__drop { position: absolute; right: 0; top: 48px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .08); min-width: 180px; display: none; overflow: hidden; }
.user-menu.is-open .user-menu__drop { display: block; }
.user-menu__drop a { display: block; padding: 10px 16px; color: var(--primary); }
.user-menu__drop a:hover { background: var(--bg); }
.content { padding: 28px 30px 60px; }
.alert { margin: 18px 30px 0; padding: 12px 16px; border-radius: 8px; font-weight: 500; }
.content .alert, .auth-card .alert, .form .alert { margin: 0 0 16px; }
.alert-success { background: #e5f4e4; color: #2d6a33; }
.alert-error { background: #fbebeb; color: #9b2c2c; }
.alert-info { background: #fdf6e1; color: #7a5b00; }

/* Cartes, grilles, statistiques */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 24px; }
.card--flush { padding: 0; overflow-x: auto; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head h2 { font-size: 19px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.grid-2--wide { grid-template-columns: 1.4fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat { display: flex; align-items: center; gap: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: var(--text); }
.stat:hover { border-color: var(--secondary); color: var(--text); }
.stat__icon { width: 50px; height: 50px; border-radius: 50%; background: #eef3ea; color: var(--secondary); display: flex; align-items: center; justify-content: center; }
.stat__icon .ico { width: 24px; height: 24px; }
.stat b { display: block; font-family: "Averia Sans Libre", serif; font-size: 24px; color: var(--primary); line-height: 1.1; }
.stat p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.stat--danger .stat__icon { background: #fbebeb; color: var(--danger); }
.stat--yellow .stat__icon { background: #fdf3d4; color: #9a7a10; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shortcuts a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); border-radius: 8px; color: var(--primary); font-weight: 500; }
.shortcuts a:hover { background: var(--base); }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fbfaf6; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table small { color: var(--muted); }
.table tfoot th { font-size: 14px; color: var(--primary); text-transform: none; letter-spacing: 0; }
.table--list tbody tr:hover { background: #fbfaf6; }
.row-urgent td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.row-unread td { font-weight: 700; }
.thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.dot { font-size: 13px; color: var(--muted); }
.dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ccc; margin-right: 6px; }
.dot--on { color: #2d6a33; }
.dot--on::before { background: #4caf50; }
.badge { display: inline-block; font-size: 11px; line-height: 20px; font-weight: 700; padding: 0 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge-warning { background: #fdf0c8; color: #7a5b00; }
.badge-info { background: #e7f1fb; color: #1d5b8f; }
.badge-success { background: #e5f4e4; color: #2d6a33; }
.badge-danger { background: #fbebeb; color: #9b2c2c; }

/* Barre d'outils, onglets */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .muted { flex: 1; margin: 0; }
.toolbar select, .toolbar input[type=search], .toolbar input[type=date] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs__tab { padding: 9px 16px; border-radius: 8px; background: var(--white); border: 1px solid var(--line); color: var(--primary); font-weight: 700; }
.tabs__tab.is-active { background: var(--primary); color: var(--base); border-color: var(--primary); }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.field--wide { grid-column: 1 / -1; }
.field__label { display: block; font-weight: 700; color: var(--primary); margin-bottom: 6px; font-size: 14px; }
.form input:not([type]), .form input[type=tel], .form input[type=url], .form input[type=search], .form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=date], .form input[type=datetime-local], .form select, .form textarea,
.auth-card input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fdfcf9; font: inherit; color: var(--primary); }
.form input:focus, .form select:focus, .form textarea:focus, .auth-card input:focus { outline: 2px solid rgba(109, 140, 84, .3); border-color: var(--secondary); background: #fff; }
.form .field { margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
.hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.form__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; color: var(--primary); }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 42px; height: 24px; background: #d6d2c4; border-radius: 12px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--secondary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--secondary); outline-offset: 2px; }
.color-field { display: flex; align-items: center; gap: 12px; }
.color-field input { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.image-field { display: flex; gap: 18px; align-items: flex-start; background: #fbfaf6; border: 1px dashed var(--line); border-radius: 8px; padding: 14px; }
.image-field__preview { width: 180px; height: 120px; border-radius: 6px; background: var(--bg) repeating-conic-gradient(#eeeae0 0 25%, transparent 0 50%) 50% / 16px 16px; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.image-field__preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-field__preview span { color: var(--muted); font-size: 13px; }
.image-field__controls { display: flex; flex-direction: column; gap: 8px; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span { width: 48px; height: 48px; border: 2px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--primary); cursor: pointer; background: #fff; }
.icon-picker span .ico { width: 24px; height: 24px; }
.icon-picker input:checked + span { border-color: var(--secondary); background: #eef3ea; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.check-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; background: #fff; }
.check-card input { margin-top: 4px; accent-color: var(--secondary); }
.check-card span { display: flex; flex-direction: column; }
.check-card strong { color: var(--primary); font-size: 14px; }
.check-card small { color: var(--muted); }
.check-card:has(input:checked) { border-color: var(--secondary); background: #f3f7ef; }
.section-label { font-size: 16px; margin: 22px 0 8px; color: var(--secondary); }
.back { font-weight: 700; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0 0 16px; }
.dl dt { font-weight: 700; color: var(--primary); }
.dl dd { margin: 0; }
.dl--answers { grid-template-columns: 1fr 1fr; }
.dl--answers dt { font-weight: 500; color: var(--text); }
.dl--answers dd { font-weight: 700; color: var(--primary); }
.code { display: inline-block; background: var(--base); color: var(--primary); font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 6px; margin-right: 8px; }
.answer-urgent { color: var(--danger) !important; }
.message-body { background: var(--bg); border-radius: 8px; padding: 16px 20px; }
.emails { word-break: break-word; }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar__label { width: 170px; font-weight: 500; }
.bar__track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--secondary); border-radius: 5px; }
.empty-state { text-align: center; padding: 50px 20px; }
.empty-state .ico { width: 48px; height: 48px; color: var(--danger); }
.empty-state h2 { margin: 12px 0; }

/* Connexion / installation */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--primary); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 36px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.auth-card__logo { height: 90px; width: auto; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card label { display: block; font-weight: 700; color: var(--primary); margin-bottom: 14px; font-size: 14px; }
.auth-card input { margin-top: 6px; }
.auth-card button { margin-top: 6px; }
.auth-card__back { text-align: center; margin: 18px 0 0; font-size: 14px; }

@media (max-width: 1100px) { .grid-2, .grid-2--wide { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; }
  .topbar__menu { display: block; }
  .topbar__right .btn, .user-menu__name { display: none; }
  .content { padding: 20px 14px 50px; }
  .form-grid, .shortcuts, .dl, .dl--answers { grid-template-columns: 1fr; }
  .image-field { flex-direction: column; }
}
@media print { .sidebar, .topbar, .form, .btn, .back { display: none !important; } .main { margin: 0; } .grid-2 { display: block; } }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: -10px 0 24px; }
.invoice-lines input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--primary); background: #fdfcf9; }
.invoice-lines td { padding: 8px 6px; }

/* Page « Créer un utilisateur » */
.tabs-choice { display: flex; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.tabs-choice__item { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 12px; border: 2px solid #e3e7df; background: #fff; color: inherit; text-decoration: none; }
.tabs-choice__item small { color: #6b7469; }
.tabs-choice__item.is-active { border-color: #334b35; background: #f2f6ef; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.created-card { border-left: 5px solid #2d6a33; margin-bottom: 16px; }
.created-card h2 { margin: 0 0 4px; color: #2d6a33; }
.created-card__list { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 14px 0; }
.created-card__list dt { font-weight: 700; }
.created-card__list dd { margin: 0; word-break: break-all; }
.created-card__pass { font-size: 1.15em; letter-spacing: .5px; background: #fdf6dc; padding: 2px 8px; border-radius: 6px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.text-success { color: #2d6a33; font-weight: 600; } .text-danger { color: #c53030; font-weight: 600; }
@media (max-width: 640px) { .created-card__list { grid-template-columns: 1fr; } }
.form-grid + .form-grid, .form-grid + .section-label { margin-top: 14px; }
