/* DOS Facture électronique — feuille de style (charte DOS : vert #1c604f, menthe #bee2e4, ivoire, Inter) */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --green-900: #103428; --green-800: #144232; --green-700: #17513e; --green-600: #1c604f;
  --green-200: #b3d2c8; --green-100: #dbeae4; --green-50: #eef5f1;
  --mint-400: #bee2e4; --mint-200: #e4f3f4;
  --ivory: #f8f6f0; --ivory-deep: #f1eee5; --paper: #ffffff;
  --sand-100: #ebe7dc; --sand-200: #ded9cc;
  --ink-900: #171c19; --ink-800: #1e2521; --ink-700: #33403a; --ink-600: #4b574f; --ink-500: #67726b; --ink-100: #eceee9;
  --success: #216048; --success-bg: #e4f1ea; --warning: #8a611b; --warning-bg: #f7efdd; --danger: #8f3129; --danger-bg: #f7e6e3; --danger-strong: #b4453a;
  --radius-sm: 10px; --radius-md: 16px; --radius-lg: 20px; --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(23,28,25,.05); --shadow-sm: 0 2px 6px rgba(23,28,25,.06); --shadow-md: 0 6px 20px rgba(23,28,25,.07);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink-800); background: var(--ivory); -webkit-font-smoothing: antialiased; }
a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-700); text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink-900); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
:focus-visible { outline: 3px solid rgba(28,96,79,.45); outline-offset: 2px; }
.muted { color: var(--ink-500); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--green-600); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Logo */
.logo { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none !important; }
.logo img { height: 34px; width: auto; display: block; }
.logo-sep { width: 1px; height: 26px; background: var(--sand-200); }
.logo-product { font-weight: 600; font-size: 15px; color: var(--ink-900); }

/* En-tête utilisateur */
.topbar { background: var(--paper); border-bottom: 1px solid var(--sand-100); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 14px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.usage { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.usage-bar { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; }
.usage-bar > span { display: block; height: 6px; background: var(--green-600); border-radius: var(--radius-pill); }
.usage-bar.over > span { background: #c08a2e; }
.avatar { width: 36px; height: 36px; border-radius: var(--radius-pill); background: var(--green-50); color: var(--green-700); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar-lg { width: 60px; height: 60px; font-size: 20px; }
.page { max-width: 1080px; margin: 0 auto; padding: 36px 28px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-wide { max-width: 1240px; }
.footer { border-top: 1px solid var(--sand-100); background: var(--paper); }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 16px 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-500); }

/* Cartes, encadrés */
.card { background: var(--paper); border: 1px solid var(--sand-100); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--sand-100); }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--sand-100); font-size: 13px; color: var(--ink-500); }
.kpi { background: var(--paper); border: 1px solid var(--sand-100); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 14px; color: var(--ink-500); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-900); }
.reassure { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 13px 18px; background: var(--mint-200); border-radius: var(--radius-md); font-size: 14px; color: var(--green-800); }
.reassure span { display: inline-flex; align-items: center; gap: 8px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius-md); font-size: 14px; line-height: 1.5; border: 1px solid var(--sand-100); background: var(--paper); }
.notice-warning { background: var(--warning-bg); border-color: #ecdcb6; color: #6e4c12; }
.notice-error { background: var(--danger-bg); border-color: #eccbc6; color: var(--danger); }
.notice-success { background: var(--success-bg); border-color: #c7e2d3; color: var(--success); }
.notice-info { background: var(--green-50); border-color: var(--green-100); color: var(--green-800); }
.notice svg { flex: none; margin-top: 1px; }
.flashes { display: flex; flex-direction: column; gap: 8px; }
.break { overflow-wrap: anywhere; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--radius-pill); border: 1px solid transparent; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .2s, box-shadow .2s; }
.btn-primary { background: var(--green-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--green-700); color: #fff; box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--paper); color: var(--ink-900); border-color: var(--sand-200); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--green-50); color: var(--ink-900); }
.btn-ghost { background: transparent; color: var(--green-600); }
.btn-ghost:hover { background: var(--green-50); }
.btn-danger { background: var(--danger-strong); color: #fff; }
.btn-danger:hover { background: #9a3a31; color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger-strong); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--green-600); cursor: pointer; font-weight: 500; }
.linklike:hover { text-decoration: underline; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--sand-200); border-radius: var(--radius-md); background: var(--paper); font: inherit; font-size: 15px; color: var(--ink-800); box-shadow: var(--shadow-xs); }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--green-600); outline: none; box-shadow: 0 0 0 3px rgba(28,96,79,.25); }
.input.is-invalid { border-color: var(--danger-strong); }
.input.is-uncertain { border-color: #c08a2e; background: #fffaf0; }
.input[readonly] { background: var(--ivory-deep); color: var(--ink-500); }
.help { font-size: 13px; color: var(--ink-500); }
.error-text { font-size: 13px; color: var(--danger-strong); }
.uncertain-text { font-size: 13px; color: var(--warning); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green-600); }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--green-600); margin-bottom: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: #c7e2d3; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: #ecdcb6; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: #eccbc6; }
.badge-neutral { background: var(--sand-100); color: var(--ink-700); border-color: var(--sand-200); }
.badge-mint { background: var(--mint-200); color: var(--green-800); border-color: #d3eced; }
.badge-brand { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-500); padding: 12px 14px; white-space: nowrap; }
.table td { padding: 13px 14px; border-top: 1px solid var(--sand-100); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table tr.group td { background: var(--ivory-deep); font-weight: 600; color: var(--ink-900); border-top: 1px solid var(--sand-200); }
.table tr.sub td:first-child { padding-left: 46px; }
.table tfoot td { border-top: 2px solid #d7dad5; font-weight: 700; color: var(--ink-900); }
.table-lines td { padding: 8px 6px; }
.table-lines th { padding: 8px 6px; }
.table-lines .input { min-height: 40px; padding: 8px 10px; font-size: 14px; }

/* Filtres */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; color: var(--ink-600); border: 1px solid transparent; text-decoration: none !important; }
.pill:hover { background: var(--green-50); color: var(--ink-800); }
.pill.active { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }

/* Étapes */
.steps { display: flex; gap: 6px; padding: 6px; background: var(--paper); border: 1px solid var(--sand-100); border-radius: var(--radius-pill); box-shadow: var(--shadow-xs); }
.step { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; color: var(--ink-600); }
.step-num { width: 22px; height: 22px; border-radius: var(--radius-pill); background: var(--ink-100); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.step.active { background: var(--green-600); color: #fff; }
.step.active .step-num { background: rgba(255,255,255,.2); color: #fff; }
.step.done { color: var(--green-700); }

/* Dépôt */
.dropzone { background: var(--paper); border: 2px dashed var(--green-200); border-radius: 24px; padding: 56px 28px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; transition: background .2s, border-color .2s; }
.dropzone.dragover { background: var(--green-50); border-color: var(--green-600); }
.dropzone-icon { width: 72px; height: 72px; border-radius: var(--radius-pill); background: var(--green-50); color: var(--green-600); display: flex; align-items: center; justify-content: center; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-list { font-size: 14px; color: var(--ink-600); }

/* Revue */
.review { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.review-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.review-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.totals { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: var(--green-50); border-radius: var(--radius-md); }
.totals dl { display: flex; gap: 28px; margin: 0; }
.totals dt { font-size: 13px; color: var(--ink-500); }
.totals dd { margin: 0; font-weight: 600; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.totals .ttc dd { font-size: 18px; font-weight: 700; }
.done-icon { width: 72px; height: 72px; border-radius: var(--radius-pill); background: var(--green-600); color: #fff; display: flex; align-items: center; justify-content: center; }
.file-card { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px solid var(--sand-200); border-radius: var(--radius-md); }
.spinner { width: 40px; height: 40px; border-radius: var(--radius-pill); border: 4px solid var(--green-100); border-top-color: var(--green-600); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Connexion */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-side { flex: 1 1 420px; min-width: 0; background: var(--green-600); color: var(--ivory); padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.auth-side h1 { color: #fff; font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; max-width: 520px; }
.auth-side p { color: var(--green-100); font-size: 17px; line-height: 1.6; max-width: 480px; }
.auth-side .eyebrow { color: var(--mint-400); }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #fff; }
.auth-points li { display: flex; align-items: center; gap: 12px; }
.auth-points .ico { width: 36px; height: 36px; border-radius: var(--radius-sm); background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; flex: none; }
.auth-main { flex: 1 1 480px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 28px; }
.auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.code-input { font-size: 26px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .auth-side { padding: 36px 28px; } .auth-side h1 { font-size: 30px; } }

/* Console admin */
.admin { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 240px; max-width: 100%; background: var(--green-900); color: var(--ivory); padding: 26px 18px; display: flex; flex-direction: column; gap: 28px; }
.sidebar .logo img { height: 32px; }
.sidebar-tag { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mint-400); padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--green-100); font-size: 15px; font-weight: 500; text-decoration: none !important; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.14); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--green-200); }
.side-foot strong { color: #fff; font-size: 14px; }
.side-foot .linklike { color: var(--mint-400); text-align: left; }
.admin-main { flex: 999 1 560px; min-width: 0; padding: 34px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 760px) { .admin-main { padding: 24px 18px 48px; } }
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; align-items: end; height: 200px; padding: 0 8px; border-bottom: 1px solid var(--sand-200); }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.bar { display: block; width: 100%; max-width: 64px; border-radius: 10px 10px 0 0; background: var(--green-200); min-height: 2px; }
.bar.current { background: var(--green-600); }
.bar-labels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; padding: 0 8px; text-align: center; font-size: 13px; color: var(--ink-500); }
.progress { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 6px; background: var(--green-600); }
.progress.over > span { background: #c08a2e; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { display: none; }
.confirm-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; background: var(--danger-bg); border: 1px solid #eccbc6; border-radius: var(--radius-md); color: var(--danger); font-size: 14px; }
.hidden { display: none !important; }
