/* CaptDoc : style « Genesis » (voir docs/design.md). Polices hébergées ici, aucun appel à un CDN tiers. */

@font-face { font-family: "General Sans"; src: url("../fonts/general-sans-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin-ext.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --primary: #4F46E5;
  --primary-text: #FFFFFF;
  --accent: #4F46E5;
  --accent-text: #FFFFFF;
  --primary-hover: color-mix(in srgb, var(--primary), #000 15%);
  --neutral: #9C9C9C;
  --bg: #FAFAFA;
  --bg-alt: #F3F3F6;
  --surface: #FFFFFF;
  --text: #0A0A0A;
  --text-2: #6B6B6B;
  --border: #E8E8EC;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.12);
  --font-display: "General Sans", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 24px; letter-spacing: -0.03em; }
h3 { font-size: 15px; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
small, .small { font-size: 13px; }
.caption { font-size: 12px; color: var(--text-2); }
.muted { color: var(--text-2); }
code, .code { font-family: var(--font-code); font-size: 13px; font-weight: 400; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.page { padding-top: 32px; padding-bottom: 64px; }
@media (min-width: 768px) { .page { padding-top: 48px; } }
.stack > * + * { margin-top: 24px; }
.stack-sm > * + * { margin-top: 12px; }

/* Navigation : collante, flou d'arrière-plan, 56 px */
.nav { position: sticky; top: 0; z-index: 10; height: 56px; background: rgba(255, 255, 255, 0.8); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.03em; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand { min-width: 0; }
.brand__logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.brand__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-switch { position: relative; min-width: 0; }
.brand-switch > summary.brand { display: inline-flex; max-width: 100%; border-radius: 6px; }
.brand-switch > summary.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.brand__caret { flex-shrink: 0; color: var(--text-2); }
.brand-switch__menu { position: absolute; left: 0; top: 44px; width: max-content; min-width: 220px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }
.brand-switch__item { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px 4px 8px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
a.brand-switch__item:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.brand-switch__item[aria-current] { color: var(--text); }
.brand-switch__check { width: 14px; flex-shrink: 0; text-align: center; }
.brand-switch__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-switch__sep { height: 1px; margin: 4px 0; background: var(--border); }
.nav__links { display: none; align-items: center; gap: 4px; }
.nav__links a, .drawer__panel a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.nav__links a:hover, .drawer__panel a:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.nav__links a[aria-current="page"], .drawer__panel a[aria-current="page"] { color: var(--accent-text); background: var(--accent); }
.nav__right { display: flex; align-items: center; gap: 8px; }
@media (min-width: 768px) { .nav__links { display: flex; } .drawer { display: none; } }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.drawer { position: relative; }
.drawer > summary { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 6px; color: var(--text); }
.drawer > summary:hover { background: var(--bg-alt); }
.drawer__panel { position: absolute; right: 0; top: 44px; min-width: 220px; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }

.user { position: relative; }
.user > summary { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9999px; background: var(--bg-alt); border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text); }
.user > summary:hover { border-color: var(--primary); }
.user__menu { position: absolute; right: 0; top: 40px; min-width: 240px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }
.user__who { padding: 0 4px 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.user__who strong { display: block; font-weight: 500; }

/* En-tête de page */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.overline { font-size: 11px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 12px; }
.overline a { color: inherit; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; font: 500 14px/1 var(--font-body); cursor: pointer; text-decoration: none; transition: transform 150ms, box-shadow 150ms, background-color 150ms, color 150ms, border-color 150ms; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn--primary { background: var(--primary); color: var(--primary-text); }
.btn--primary:hover { background: var(--primary-hover); color: var(--primary-text); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--text-2); color: var(--text); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { color: var(--text); background: var(--bg-alt); }
.btn--danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--lg { height: 44px; padding: 0 24px; }
.btn--block { width: 100%; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: transform 200ms, box-shadow 200ms; }
a.card { display: block; color: inherit; }
a.card:hover, .card--hover:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); text-decoration: none; color: inherit; }
.card__body { padding: 24px; }
.card__head { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card--narrow { max-width: 440px; margin: 0 auto; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (min-width: 1024px) { .grid { gap: 24px; } }

.company-card { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-height: 128px; justify-content: space-between; }
.company-card h3 { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.03em; }

/* Métadonnées : cartes à 8 px */
.meta { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.meta__item { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.meta__item dt { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.meta__item dd { margin: 0; overflow-wrap: anywhere; }
.meta__item--wide { grid-column: 1 / -1; }

/* Listes : lignes empilées, séparateurs de 1 px */
.list { list-style: none; margin: 0; padding: 0; }
.list__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); color: inherit; }
.list__row:first-child { border-top: 0; }
a.list__row:hover { background: var(--bg-alt); text-decoration: none; color: inherit; }
.list__main { min-width: 0; }
.list__title { font-weight: 500; }
.list__empty { padding: 48px 16px; text-align: center; color: var(--text-2); }

/* Liste des dépôts : colonnes sur grand écran, deux lignes sur petit écran */
.list__head, .list__row--ingestion { display: grid; align-items: center; gap: 4px 16px; grid-template-columns: 9.5rem minmax(0, 1fr) 9.5rem 7.5rem 12.5rem minmax(9rem, 1fr); grid-template-areas: "date supplier total duration state deliveries"; }
.list__head { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.cell { min-width: 0; }
.cell--date { grid-area: date; }
.cell--supplier { grid-area: supplier; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell--total { grid-area: total; }
.cell--duration { grid-area: duration; color: var(--text-2); font-size: 13px; }
.cell--state { grid-area: state; }
.cell--deliveries { grid-area: deliveries; color: var(--text-2); }
.cell--num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell--unvalidated { color: var(--text-2); font-style: italic; }
@media (max-width: 899px) {
  .list__head { display: none; }
  .list__row--ingestion { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "date state" "supplier total" "duration duration" "deliveries deliveries"; }
  .cell--duration { text-align: left; }
}

/* Pastilles */
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 12px; border-radius: 9999px; background: #F3F4F6; color: #4B5563; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip--success { background: #ECFDF5; color: #047857; }
.chip--warning { background: #FFFBEB; color: #B45309; }
.chip--error { background: #FEF2F2; color: #B91C1C; }
.chip--active { background: var(--primary); color: var(--primary-text); }

/* Bandeaux */
.banner { padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; }
.banner--warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.banner--error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.banner .reasons { margin: 8px 0 0; padding-left: 20px; }
.banner .reasons li + li { margin-top: 4px; }
.banner + .banner { margin-top: 8px; }
.banner small { display: block; margin-top: 4px; font-family: var(--font-code); font-size: 12px; opacity: 0.85; }

/* Formulaires */
.field { display: block; }
.field + .field { margin-top: 20px; }
.field > span, .label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.input, select.input { display: block; width: 100%; padding: 10px 14px; font: 400 14px/1.4 var(--font-body); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; transition: border-color 150ms, box-shadow 150ms; }
.input::placeholder { color: var(--neutral); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input.is-invalid { border-color: var(--error); }
input[type="file"].input { padding: 8px 10px; cursor: pointer; }
.error-text { margin-top: 8px; font-size: 13px; color: var(--error); }
.hint { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 24px; }

/* Dépôt mobile : actions explicites, zone tactile et aperçu avant envoi. */
.upload-page { max-width: 640px; }
.upload-field__input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.upload-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 208px; padding: 24px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); color: var(--text-2); text-align: center; cursor: pointer; transition: background-color 150ms, border-color 150ms; }
.upload-dropzone:hover, .upload-dropzone.is-dragging { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); border-color: var(--primary); }
.upload-dropzone:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.upload-dropzone.is-invalid { border-color: var(--error); }
.upload-dropzone__icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 9999px; background: var(--surface); color: var(--primary); font-size: 24px; line-height: 1; }
.upload-dropzone__title { color: var(--text); font-weight: 500; }
.upload-dropzone__copy { margin-top: 4px; font-size: 13px; }
.upload-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.upload-preview { display: flex; align-items: center; gap: 12px; min-height: 88px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.upload-preview__image { width: 62px; height: 62px; border-radius: 6px; object-fit: cover; background: var(--surface); }
.upload-preview__file { display: grid; gap: 2px; min-width: 0; flex: 1; }
.upload-preview__file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload-progress { margin-top: 20px; }
.upload-progress__bar { height: 8px; overflow: hidden; border-radius: 9999px; background: var(--bg-alt); }
.upload-progress__bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 150ms; }
.upload-progress .caption { display: block; margin-top: 8px; }

/* JSON résultat */
.json { margin: 0; padding: 16px; max-height: 560px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font: 400 13px/1.6 var(--font-code); white-space: pre; tab-size: 2; }

/* Fiche du document décodé */
.result-section { display: grid; gap: 16px; }
.result-section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.result-section__head .overline { margin-bottom: 8px; }
.result-section__documents { min-width: 0; }
.document-picker { display: grid; gap: 4px; min-width: min(100%, 310px); font-size: 12px; color: var(--text-2); }
.document-picker .input { min-width: 0; }
.invoice-result { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.invoice-result__header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding: 24px; border-bottom: 1px solid var(--border); }
.invoice-result__header h2 { margin-top: 12px; font-size: 28px; overflow-wrap: anywhere; }
.invoice-result__badges { display: flex; flex-wrap: wrap; gap: 8px; }
.chip--invoice { background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary-hover); }
.chip--credit, .chip--error { background: #FEF2F2; color: #B91C1C; }
.invoice-result__reference { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.invoice-result__actions { align-self: flex-start; }
.invoice-result__notice { padding: 12px 24px; background: #FFFBEB; border-bottom: 1px solid #FDE68A; color: #92400E; font-size: 13px; }
.invoice-result__summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .6fr); gap: 24px; padding: 24px; background: var(--bg); border-bottom: 1px solid var(--border); }
.invoice-result__dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.invoice-result__dates dt, .invoice-result__totals dt, .invoice-result__due > span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.invoice-result__dates dd { margin: 4px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.invoice-result__due { display: grid; align-content: center; gap: 4px; padding: 16px; border-radius: 8px; background: color-mix(in srgb, var(--primary) 9%, white); border: 1px solid color-mix(in srgb, var(--primary) 26%, white); }
.invoice-result__due strong { font-family: var(--font-display); font-size: 28px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.invoice-result__due small { color: #B91C1C; }
.invoice-result__due--credit, .invoice-result__total--credit { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.invoice-result__lines, .invoice-result__totals { padding: 24px; }
.invoice-result__lines h3, .invoice-result__totals h3 { margin-bottom: 16px; }
.invoice-lines { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.invoice-lines table { width: 100%; min-width: 680px; border-collapse: collapse; }
.invoice-lines th { padding: 10px 16px; background: var(--bg); color: var(--text-2); text-align: left; font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.invoice-lines td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: top; }
.invoice-lines td small { display: block; margin-top: 2px; color: var(--text-2); }
.invoice-lines__amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.invoice-result__totals { border-top: 1px solid var(--border); background: var(--bg); }
.invoice-result__totals dl { width: min(100%, 420px); margin: 0 0 0 auto; }
.invoice-result__totals dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.invoice-result__totals dl > div:first-child { border-top: 0; }
.invoice-result__totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-result__total { margin-top: 4px; padding: 12px 16px !important; border: 1px solid color-mix(in srgb, var(--primary) 26%, white) !important; border-radius: 8px; background: color-mix(in srgb, var(--primary) 9%, white); }
.invoice-result__total dd { font-family: var(--font-display); font-size: 20px; letter-spacing: -.03em; }

/* Pagination (balisage Bootstrap fourni par Laravel) */
.pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; list-style: none; margin: 24px 0 0; padding: 0; }
.pagination .page-link, .pagination li > span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13px; }
.pagination a.page-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .active .page-link, .pagination .active span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

/* Réglages d'apparence */
.appearance-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(280px, 1fr); align-items: start; gap: 32px; }
.appearance-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type="color"] { width: 42px; height: 42px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.appearance-preview { position: sticky; top: 88px; }
.appearance-preview__portal { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.appearance-preview__nav { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.appearance-preview__logo { width: 28px; height: 28px; object-fit: contain; }
.appearance-preview__body { padding: 32px; }
.appearance-preview__accent { display: inline-block; margin-bottom: 12px; color: var(--preview-accent); font-size: 13px; font-weight: 500; }
.appearance-preview__body h2 { margin-bottom: 8px; }
.appearance-preview__body p { color: var(--text-2); }
.appearance-preview__body button { margin-top: 24px; padding: 10px 16px; border: 0; border-radius: 6px; background: var(--preview-primary); color: var(--preview-primary-text); font: 500 14px/1 var(--font-body); }
@media (max-width: 767px) { .appearance-grid { grid-template-columns: 1fr; } .appearance-preview { position: static; } .appearance-colors { grid-template-columns: 1fr; } }
.pagination .disabled .page-link, .pagination .disabled span { color: var(--neutral); }


@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .btn:hover, a.card:hover { transform: none; } }

/* Bouton icône et visionneuse de l'original */
.btn--icon { width: 38px; padding: 0; }
.viewer { width: min(1100px, 94vw); height: 90vh; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); overflow: hidden; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(10, 10, 10, 0.55); }
.viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--border); flex: none; }
.viewer__bar h2 { font-size: 18px; }
.viewer__body { flex: 1; min-height: 0; background: var(--bg-alt); display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer__body iframe { width: 100%; height: 100%; border: 0; }
.viewer__body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer--json { width: min(860px, 94vw); height: min(700px, 86vh); }
.viewer__json { flex: 1; max-height: none; margin: 16px 24px 24px; }

@media (max-width: 699px) {
  .invoice-result__header, .invoice-result__summary, .invoice-result__lines, .invoice-result__totals { padding: 16px; }
  .invoice-result__summary { grid-template-columns: 1fr; gap: 16px; }
  .invoice-result__dates { grid-template-columns: 1fr; gap: 12px; }
  .invoice-lines { overflow: visible; border: 0; }
  .invoice-lines table, .invoice-lines tbody, .invoice-lines tr, .invoice-lines td { display: block; min-width: 0; width: 100%; }
  .invoice-lines thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  .invoice-lines tr { padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
  .invoice-lines tr + tr { margin-top: 8px; }
  .invoice-lines td { display: grid; grid-template-columns: minmax(90px, .65fr) 1fr; gap: 8px; padding: 4px 0; border: 0; text-align: left; white-space: normal; }
  .invoice-lines td::before { content: attr(data-label); color: var(--text-2); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
  .invoice-lines__amount { font-weight: 500; }
  .invoice-result__totals dl { width: 100%; }
}

/* Journal d'analyse */
.journal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.journal + .journal { margin-top: 12px; }
.journal > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; font-size: 13px; }
.journal > summary:hover { background: var(--bg-alt); }
.journal__title { font-weight: 500; color: var(--text); }
.journal__scroll { overflow-x: auto; border-top: 1px solid var(--border); }
.journal__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.journal__table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
.journal__table td { padding: 10px 16px; border-top: 1px solid var(--border); vertical-align: top; }
.journal__table tbody tr:first-child td { border-top: 0; }
.journal__num { font-family: var(--font-code); font-size: 12px; white-space: nowrap; color: var(--text-2); }
.journal__step { white-space: nowrap; font-weight: 500; }
.journal__row--rejected, .journal__row--timeout, .journal__row--error { background: #FFFBEB; }

.journal__cost { text-align: right; }
.journal__total { padding-top: 12px; text-align: right; font-size: 12px; color: var(--text-2); }
.journal__table tfoot td { border-top: 1px solid var(--border); background: var(--bg); }
.analysis-timeline { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.analysis-timeline .page-head { align-items: center; }
.timeline { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; }
.timeline__step { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.timeline__mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #ECFDF5; color: #047857; font-size: 12px; font-weight: 700; }
.timeline__step--active { color: var(--text); font-weight: 500; }
.timeline__step--active .timeline__mark { background: var(--primary); color: #fff; animation: timeline-pulse 1.2s ease-in-out infinite; }
.timeline__step--error .timeline__mark { background: #FEF2F2; color: #B91C1C; }
@keyframes timeline-pulse { 50% { transform: scale(1.12); } }

.upload-preview__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.upload-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.upload-list__item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; }
.upload-list__item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .upload-list__item { grid-template-columns: minmax(0, 1fr) auto; } .upload-list__item .caption { grid-column: 1; } }

/* Statuts animés de la liste des dépôts */
.chip { transition: background-color .35s ease, color .35s ease; }
.chip--live { position: relative; padding-left: 26px; }
.chip--live::before { content: ""; position: absolute; left: 11px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: currentColor; animation: chip-pulse 1.3s ease-in-out infinite; }
.state-step { display: block; margin-top: 4px; color: #6B7280; font-size: 12px; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__row--live { position: relative; }
.row-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; background: transparent; pointer-events: none; }
.row-progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--primary, #6366F1); border-radius: 2px; animation: row-slide 1.6s ease-in-out infinite; }
.list li.is-updated { animation: row-flash 1.6s ease-out; }
.chip--pop { animation: chip-pop .45s ease-out; }
.live-summary { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #4B5563; }
.live-summary:not([hidden])::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary, #6366F1); animation: chip-pulse 1.3s ease-in-out infinite; }
@keyframes chip-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes row-slide { 0% { left: -35%; } 100% { left: 100%; } }
@keyframes row-flash { 0% { background: color-mix(in srgb, var(--primary, #6366F1) 14%, white); } 100% { background: transparent; } }
@keyframes chip-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .chip--live::before, .row-progress::after, .live-summary:not([hidden])::before, .list li.is-updated, .chip--pop { animation: none; }
    .row-progress::after { left: 0; width: 100%; opacity: .35; }
}

.app-icon-preview { margin-top: 20px; display: grid; gap: 10px; }
.app-icon-preview__row { display: flex; gap: 24px; }
.app-icon-preview figure { margin: 0; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: #64748b; }
.app-icon-preview__square { border-radius: 22%; box-shadow: 0 2px 8px rgb(15 23 42 / .2); }
.app-icon-preview__maskable { border-radius: 50%; box-shadow: 0 2px 8px rgb(15 23 42 / .2); }

/* Réglages : deux colonnes (liste des rubriques / contenu), une liste puis une page sur mobile */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings__nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 80px; }
.settings__nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.settings__nav a:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.settings__nav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
.settings__icon { flex-shrink: 0; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--bg-alt); color: var(--text); }
.settings__nav a[aria-current="page"] .settings__icon { background: rgba(255, 255, 255, 0.2); color: inherit; }
.settings__chevron { display: none; margin-left: auto; }
.settings__back { display: none; align-items: center; gap: 4px; margin-bottom: 16px; font-size: 14px; font-weight: 500; color: var(--text-2); }
@media (max-width: 767px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .settings__nav { position: static; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .settings__nav a { min-height: 52px; border-radius: 0; border-top: 1px solid var(--border); color: var(--text); }
  .settings__nav a:first-child { border-top: 0; }
  .settings__nav a[aria-current="page"] { background: transparent; color: var(--text); }
  .settings__nav a[aria-current="page"] .settings__icon { background: var(--bg-alt); }
  .settings__chevron { display: inline; }
  .settings--page .settings__nav { display: none; }
  .settings--list .settings__pane { display: none; }
  .settings__back { display: inline-flex; }
}

.app-icon-preview__live { display: grid; place-items: center; width: 96px; height: 96px; box-shadow: 0 2px 8px rgb(15 23 42 / .2); }
.app-icon-preview__live[hidden] { display: none; }
.app-icon-preview__live img { max-width: 80%; max-height: 80%; }
.app-icon-preview__live--mask img { max-width: 56%; max-height: 56%; }

/* Consommation du forfait, au-dessus du contenu du portail. */
.plan-usage { margin-bottom: 16px; text-align: right; }
.plan-usage.banner { text-align: left; }

/* Flux de sortie : un onglet par destination, « + » pour en ajouter une */
.banner--stack { margin-bottom: 16px; }
.dest-tabs { display: flex; align-items: flex-end; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--bg); border-radius: 12px 12px 0 0; }
.card--tabs { overflow: visible; }
.dest-tab { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; color: var(--text-2); }
.dest-tab:hover { color: var(--text); text-decoration: none; }
.dest-tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
.dest-tab__dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.dest-tab__dot.is-on { background: var(--success); }
.dest-tab__flag { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #FFFBEB; color: #B45309; font-size: 11px; font-weight: 700; }
.dest-add { position: relative; align-self: center; margin-left: 4px; }
.dest-add__toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.dest-add__toggle:hover, .dest-add[open] .dest-add__toggle { background: var(--bg-alt); color: var(--text); }
.dest-add__menu { position: absolute; left: 0; top: 40px; z-index: 20; min-width: 200px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }
.dest-add__title { margin: 0; white-space: nowrap; padding: 4px 8px 8px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.dest-add__item { display: flex; align-items: center; min-height: 32px; padding: 0 8px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.dest-add__item:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.dest-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.dest-head__info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.dest-head__info h2 { font-size: 20px; margin-right: 4px; }
.dest-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dest-head__actions form { margin: 0; }
.checkbox-field { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox-field input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.dest-form .checkbox-field { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.dest-form .checkbox-field input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.dest-form h2, .dest-form h3 { margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 16px; }
.dest-form h3 + h3, .dest-form h2 + h3 { margin-top: 0; padding-top: 0; border-top: 0; }
.dest-form > .muted, .dest-form p.muted { margin: 0 0 16px; font-size: 13px; }
.dest-form .field + .muted { margin-top: 12px; }
.dest-form .field + h3, .dest-form .field + h2 { margin-top: 32px; }
.dest-empty { margin: 0; }
