/* =========================================================
   Facteur24 — dashboard d'administration
   ========================================================= */

body.admin { background: #f4f6fb; display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
body.admin--login { display: grid; place-items: center; grid-template-columns: 1fr; padding: 24px; }

/* ------------------------------ connexion ----------------------------- */

.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 36px 34px 32px; }
.login-mark { width: 46px; height: 46px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; margin-bottom: 10px; }
.login-card h1 { font-size: 24px; margin: 0; }
.login-sub { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 12px; }
.login-card .field__label { margin-top: 8px; }
.login-card .btn { margin-top: 20px; width: 100%; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.alert--error { background: #fdeaea; color: #a52028; }
.alert--ok { background: #e6f6e8; color: #23652a; }

/* ------------------------------ navigation ---------------------------- */

.adm-nav { background: #101728; color: #fff; padding: 24px 18px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; }
.adm-brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.adm-brand small { display: block; font-weight: 500; font-size: 12px; color: #8d99ac; }
.adm-nav nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.adm-nav__link { color: #c3cbdb; text-decoration: none; padding: 11px 14px; border-radius: 9px; font-size: 15px; font-weight: 600; }
.adm-nav__link:hover { background: #1b2438; color: #fff; }
.adm-nav__link.is-active { background: var(--blue); color: #fff; }
.adm-nav__foot { border-top: 1px solid #232d44; padding-top: 16px; font-size: 13.5px; color: #8d99ac; display: flex; flex-direction: column; gap: 6px; }
.adm-nav__foot a { color: #c3cbdb; }

/* -------------------------------- layout ------------------------------ */

.adm-main { padding: 30px 34px 70px; min-width: 0; }
.adm-head { margin-bottom: 24px; }
.adm-head h1 { font-size: 28px; margin: 6px 0 4px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm-head p { color: var(--ink-soft); margin: 0; font-size: 15px; }

.panel { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px; }
.panel__h { font-size: 17px; font-weight: 700; margin: 0 0 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.empty { color: var(--ink-mute); font-size: 15px; margin: 0; }

/* --------------------------------- KPIs ------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px; }
.kpi__l { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.kpi__v { display: block; font-size: 27px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }

.bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar__fill { width: 100%; max-width: 54px; background: linear-gradient(180deg, #3b7de4, var(--blue)); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bar__n { font-size: 13px; font-weight: 700; }
.bar__d { font-size: 12px; color: var(--ink-mute); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; text-decoration: none; color: var(--ink); font-size: 14px; }
.chip:hover { border-color: var(--blue); }

/* -------------------------------- table ------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 12px 10px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f7f9fd; }
.table small { color: var(--ink-mute); }
.table .num { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; text-decoration: none; }

.pill { display: inline-block; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill--draft { background: #eceff5; color: #5b6478; }
.pill--awaiting_payment { background: #fff3d6; color: #8a6100; }
.pill--paid { background: #e2edff; color: #1450b8; }
.pill--printing { background: #fff3d6; color: #8a6100; }
.pill--sent { background: #e2f0ff; color: #0f5fa8; }
.pill--delivered { background: #e3f6e5; color: #21692a; }
.pill--cancelled { background: #f0f1f4; color: #6b7280; }
.pill--failed { background: #fdeaea; color: #a52028; }

.filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filters .input { height: 48px; flex: 1 1 280px; max-width: 420px; }
.filters .btn { height: 48px; font-size: 15px; }
.filters .select { min-width: 200px; }

.pager { display: flex; align-items: center; gap: 16px; justify-content: center; color: var(--ink-soft); font-size: 14.5px; }
.pager .btn { height: 44px; font-size: 15px; }

/* ----------------------------- détail commande ------------------------ */

.order-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.party-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin: 0 0 8px; }
.party-box p { margin: 0; font-size: 14.5px; }
.party-box__name { font-weight: 700; }
.party-box__meta { margin-top: 8px !important; color: var(--ink-soft); font-size: 13.5px; }

.meta-line { display: flex; justify-content: space-between; gap: 14px; margin: 0; padding: 8px 0; border-bottom: 1px solid #f0f2f7; font-size: 14.5px; color: var(--ink-soft); }
.meta-line:last-child { border-bottom: 0; }
.meta-line strong { color: var(--ink); text-align: right; }

.files { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.files li { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.files__ico { color: var(--blue); flex: none; }
.files__n { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; }
.files__n small { display: block; color: var(--ink-mute); font-weight: 500; }

.letter-preview { white-space: pre-wrap; background: #f7f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 18px; font-family: var(--font); font-size: 14px; line-height: 1.6; max-height: 420px; overflow: auto; margin: 14px 0 0; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 14px; font-size: 14px; }
.timeline__d { color: var(--ink-mute); font-size: 13px; }
.timeline__m em { color: var(--ink-mute); font-style: normal; font-size: 13px; }

.admin-form { display: flex; flex-direction: column; gap: 8px; }
.admin-form .field__label { margin-top: 10px; }
.admin-form .input { height: 48px; }
.admin-form .textarea { height: auto; }
.admin-form .btn { margin-top: 18px; width: 100%; height: 48px; font-size: 15px; }

@media (max-width: 1080px) {
  body.admin { grid-template-columns: 1fr; }
  .adm-nav { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .adm-nav nav { flex-direction: row; flex-wrap: wrap; }
  .adm-nav__foot { border: 0; padding: 0; flex-direction: row; gap: 14px; }
  .order-grid, .parties { grid-template-columns: 1fr; }
  .adm-main { padding: 22px 16px 60px; }
}

/* Chevron des selects (l'admin n'utilise pas le span .select__chevron) */
.admin .select { position: relative; }
.admin .select::after {
  content: ''; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid #4c576d; border-bottom: 2px solid #4c576d;
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
