:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px; color: #24352f; background: #f6f8fa;
  --green: #126854; --green-hover: #0d5342; --ink: #24352f; --muted: #6b7a76;
  --line: #e5ebe8; --soft: #f5f8f6; --danger: #b33e3c;
  font-synthesis: none; text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, a, input, select, textarea { touch-action: manipulation; }
button { transition: background .16s, color .16s, box-shadow .16s, border-color .16s; }
button:disabled { cursor: default; opacity: .52; }
button:focus-visible, a:focus-visible { outline: 3px solid #47a58b; outline-offset: 3px; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #dce4df; border-radius: 9px; padding: 12px 13px; background: #fff; color: var(--ink); line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #89938f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #3a987b; box-shadow: 0 0 0 3px #18856a15; }
input[type=date] { min-height: 44px; }
input[type=color] { width: 60px; height: 43px; padding: 5px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); }
textarea { resize: vertical; }
label, .field { display: flex; flex-direction: column; gap: 9px; font-size: .875rem; font-weight: 600; position: relative; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.875rem; letter-spacing: -.9px; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.1rem; letter-spacing: -.3px; line-height: 1.45; }
h3 { font-size: .9375rem; line-height: 1.4; }
a { color: var(--green); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; padding: 12px; background: white; z-index: 30; }
.skip-link:focus { top: 15px; }
.icon { flex: 0 0 auto; width: 20px; height: 20px; vertical-align: middle; }
[data-icon] { display: inline-flex; }
.muted { color: var(--muted); font-weight: 400; line-height: 1.55; }
.small { font-size: .8125rem; }
.eyebrow { font-size: .6875rem; letter-spacing: 1.7px; font-weight: 700; color: var(--green); margin-bottom: 9px; }
.primary, .secondary, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 12px 17px; min-height: 44px; font-size: .875rem; line-height: 1.25; font-weight: 600; }
.primary { background: var(--green); color: #fff; box-shadow: 0 2px 3px #12685410; }
.primary:hover:not(:disabled) { background: var(--green-hover); box-shadow: 0 3px 10px #12685425; }
.secondary { background: white; border-color: #dfe6e2; color: #3f5049; }
.secondary:hover:not(:disabled) { background: #f5f8f6; border-color: #b8cbc1; }
.compact { min-height: 38px; padding: 8px 13px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #6f7e76; text-decoration: none; }
.icon-button:hover { background: #eef4f0; color: var(--green); }
.icon-button.danger:hover { background: #fff0ed; color: var(--danger); }
.link-button { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--green); font-size: .8125rem; font-weight: 600; padding: 5px 0; text-align: left; }
.link-button .icon { width: 16px; height: 16px; }
.link-button:hover { color: #073d2f; text-decoration: underline; text-underline-offset: 3px; }
.danger-button { background: #b84640; color: white; }
.danger-button:hover { background: #97312d; }

/* Navigation et structure */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 230px; padding: 29px 18px 15px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; font-weight: 750; line-height: 1.1; color: #203e32; padding: 0 9px; }
.brand-mark { width: 39px; height: 43px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 11px; font-size: 1.5rem; font-weight: 800; box-shadow: inset 0 -4px 0 #ffffff13; }
.brand-sub { display: block; font-size: .6875rem; color: #7e8b83; font-weight: 500; letter-spacing: .15px; margin-top: 6px; }
.nav-label { color: #93a097; font-size: .625rem; font-weight: 700; letter-spacing: 1.35px; margin: 37px 12px 12px; }
.nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; min-height: 46px; border: 0; border-radius: 8px; margin: 4px 0; text-align: left; background: transparent; color: #6c7b73; font-size: .875rem; font-weight: 500; }
.nav .icon { width: 19px; height: 19px; }
.nav:hover { background: #f5f8f6; color: #244d3c; }
.nav.active { background: #eaf3ed; color: #165c46; font-weight: 650; }
.side-bottom { margin-top: auto; }
.workspace-note { display: flex; align-items: center; gap: 10px; padding: 17px 9px; margin-top: 35px; border-bottom: 1px solid var(--line); color: #769080; }
.workspace-note strong { display: block; font-size: .75rem; color: #4c6357; margin-bottom: 4px; }
.workspace-note span { font-size: .6875rem; }
.account-button { display: flex; align-items: center; gap: 10px; padding: 17px 5px 0; background: transparent; border: 0; width: 100%; color: var(--muted); text-align: left; }
.account-button > .icon { margin-left: auto; width: 16px; }
.avatar { display: inline-grid; place-items: center; width: 35px; height: 35px; flex-shrink: 0; background: #eaf0e8; color: #56734a; border-radius: 50%; font-size: .75rem; font-weight: 700; }
#identity { display: block; min-width: 0; }
#identity strong { display: block; font-size: .75rem; color: #364b3f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 117px; }
#identity > span { display: block; font-size: .6875rem; margin-top: 4px; }
.workspace { margin-left: 230px; }
.topbar { height: 67px; border-bottom: 1px solid var(--line); background: #fff; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .75rem; color: #849187; }
.breadcrumb { display: flex; gap: 14px; align-items: center; }
.breadcrumb strong { font-weight: 500; color: #4a5d50; }
.breadcrumb > span { color: #c3ccc6; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
#today-label { text-transform: capitalize; }
.mobile-account, .mobile-nav { display: none; }
main { max-width: 1600px; margin: auto; padding: 31px 34px 44px; outline: none; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-header .muted { margin-top: 8px; font-size: .875rem; }
.page-header .primary { flex-shrink: 0; }

/* Filtres */
.filter-section { margin-bottom: 24px; }
.filter-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.periods { display: flex; gap: 3px; padding: 4px; background: #eaf0ed; border-radius: 9px; width: max-content; max-width: 100%; }
.periods button { padding: 8px 14px; min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: #738278; font-size: .8125rem; font-weight: 550; white-space: nowrap; }
.periods button.active { color: #244d3b; background: #fff; box-shadow: 0 1px 4px #294e3614; }
.periods button:hover:not(.active) { background: #e1eae4; }
#toggle-filters { font-size: .8125rem; }
#toggle-filters[aria-expanded=true] { border-color: #70a78f; color: var(--green); background: #f0f7f2; }
.filter-fields { display: flex; align-items: center; gap: 12px; }
.search-control { flex: 1; min-width: 180px; position: relative; }
.search-control > .icon, .search-control > span:not(.sr-only) { position: absolute; top: 12px; left: 13px; color: #8b9a90; }
.search-control input { padding-left: 41px; font-size: .8125rem; font-weight: 400; height: 43px; }
.advanced-filters { display: flex; gap: 10px; align-items: center; }
.advanced-filters label:not(.category-control) { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: .75rem; color: #758679; }
.advanced-filters input { width: 142px; min-height: 43px; padding: 9px 10px; font-size: .75rem; font-weight: 400; }
.category-control select { width: 191px; height: 43px; font-size: .8125rem; font-weight: 400; }
.filter-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; border: 1px solid #d7e6dd; background: #edf5ef; color: #3f6d52; padding: 6px 9px; border-radius: 6px; max-width: 100%; overflow-wrap: anywhere; }
.filter-chip .icon { width: 13px; height: 13px; }
.filter-reset { background: transparent; border: 0; color: #6e8475; font-size: .6875rem; padding: 5px 2px; }
.filter-reset:hover { color: var(--green); text-decoration: underline; }
.filter-count { display: inline-grid; place-items: center; border-radius: 10px; min-width: 18px; height: 18px; font-size: .6875rem; background: #dcece0; }
#filter-error:empty { display: none; }

/* Indicateurs et graphiques */
.stats { display: grid; grid-template-columns: 1.12fr 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.stat { min-width: 0; padding: 22px 23px 19px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 3px #243d2e02; }
.stat-primary { color: #fff; background: #14644f; border-color: #14644f; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .8125rem; color: #718078; }
.stat-primary .stat-top { color: #c4ded0; }
.stat-icon { display: grid; place-items: center; width: 33px; height: 33px; color: #70917d; background: #f2f6f3; border-radius: 9px; }
.stat-primary .stat-icon { color: #cce5d6; background: #ffffff12; }
.stat-icon .icon { width: 18px; height: 18px; }
.stat-value { display: flex; align-items: baseline; gap: 8px; margin: 11px 0 17px; line-height: 1.1; font-size: clamp(1.6rem,2.5vw,2.25rem); font-weight: 650; letter-spacing: -1px; font-variant-numeric: tabular-nums; flex-wrap: wrap; overflow-wrap: anywhere; }
.stat-value small { font-size: .8125rem; font-weight: 500; letter-spacing: 0; color: #8d9c93; }
.stat-primary .stat-value small { color: #bcdbc9; }
.stat-bottom { display: flex; align-items: center; gap: 7px; color: #7b8b80; font-size: .6875rem; min-height: 20px; flex-wrap: wrap; }
.stat-bottom .icon { width: 13px; height: 13px; }
.stat-primary .stat-bottom { color: #bed9ca; }
.mini-pill { background: #edf4ef; padding: 4px 7px; border-radius: 5px; color: #688272; font-size: .625rem; }
.stat-fraction { margin-left: auto; font-size: .75rem; font-weight: 400; color: #87968c; letter-spacing: 0; }
.coverage-track { height: 4px; width: 100%; background: #edf3ef; border-radius: 5px; overflow: hidden; margin: -3px 0 7px; }
.coverage-track span { display: block; height: 100%; background: #5e9e7c; border-radius: inherit; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 13px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 22px 23px 18px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: .9375rem; font-weight: 650; }
.panel-head p { margin-top: 5px; font-size: .75rem; }
.charts { display: grid; grid-template-columns: 1.42fr 1fr; gap: 22px; align-items: start; }
.chart-key { display: inline-flex; align-items: center; gap: 6px; font-size: .6875rem; color: #8a988f; }
.chart-key i { width: 6px; height: 6px; border-radius: 50%; background: #18836a; }
.trend-panel { height: 100%; min-height: 338px; display: flex; flex-direction: column; }
.trend-svg { width: calc(100% - 28px); margin: auto 14px 0; display: block; overflow: visible; }
.trend-svg text { font-family: inherit; font-size: 11px; fill: #87968c; }
.chart-caption { display: flex; align-items: center; gap: 7px; border-top: 1px solid #f0f4f1; margin-top: 14px; padding: 13px 23px; font-size: .6875rem; color: #94a095; }
.chart-caption .icon { width: 14px; height: 14px; }
.categories-panel { height: 100%; }
.categories-panel .panel-head > .icon { color: #99aaa0; width: 18px; }
.bars { display: grid; gap: 16px; padding: 1px 23px 24px; max-height: 328px; overflow: auto; }
.bar-row { display: block; width: 100%; padding: 2px 0; border: 0; background: transparent; color: inherit; text-align: left; border-radius: 4px; }
.bar-row:hover .bar-label { color: var(--green); }
.bar-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .75rem; }
.bar-label > span { display: flex; align-items: center; gap: 7px; }
.bar-label i { width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }
.bar-label strong { font-size: .75rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-bottom { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.bar-bottom > span { width: 33px; text-align: right; color: #8b9b90; font-size: .625rem; }
.bar-track { height: 5px; border-radius: 4px; overflow: hidden; background: #f0f4f2; flex: 1; }
.bar-fill { height: 100%; border-radius: inherit; }
.insight { margin: 17px 0 22px; display: flex; align-items: center; gap: 12px; background: #edf3ef; border: 1px solid #e2ebe5; padding: 12px 16px; border-radius: 9px; }
.insight > .icon { width: 17px; color: #63856d; }
.insight p { color: #6f8374; font-size: .75rem; line-height: 1.6; }
.insight p strong { font-weight: 600; color: #46644f; }
.insight .link-button { flex-shrink: 0; margin-left: auto; font-size: .6875rem; }
.chart-empty { flex: 1; min-height: 235px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: #90a095; }
.chart-empty > .icon { width: 32px; height: 32px; margin-bottom: 15px; color: #bdcec1; }
.chart-empty p { font-size: .8125rem; max-width: 245px; line-height: 1.6; }
.charts + .expense-panel { margin-top: 22px; }

/* Dépenses, factures et administration */
.count-badge { display: inline-block; border: 1px solid #e6ece8; background: #f7f9f7; color: #778b7c; border-radius: 6px; padding: 2px 7px; font-size: .6875rem; font-weight: 500; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { padding: 12px 16px; background: #fafcfb; border-top: 1px solid #f0f3f1; border-bottom: 1px solid #edf1ee; color: #98a59b; font-size: .6875rem; font-weight: 500; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 23px; }
th:last-child, td:last-child { padding-right: 16px; }
td { border-bottom: 1px solid #f0f4f1; padding: 15px 16px; font-size: .75rem; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fcfefd; }
.expense-name { display: flex; gap: 11px; align-items: center; }
.expense-name > div { min-width: 130px; }
.category-icon { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; flex-shrink: 0; border-radius: 9px; background: color-mix(in srgb,var(--category-color,#126854) 8%,white); color: var(--category-color,#126854); }
.category-icon .icon { width: 17px; height: 17px; }
.expense-title { border: 0; background: transparent; padding: 0; color: #3b5143; text-align: left; font-weight: 600; font-size: .75rem; line-height: 1.45; }
.expense-title:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.row-meta { display: flex; gap: 5px; align-items: center; color: #93a094; font-size: .625rem; margin-top: 4px; }
.category-tag { display: inline-flex; align-items: center; border: 0; border-radius: 5px; padding: 5px 8px; background: color-mix(in srgb,var(--category-color,#126854) 9%,white); color: color-mix(in srgb,var(--category-color,#126854) 85%,#24352f); font-size: .625rem; font-weight: 550; text-align: left; white-space: nowrap; }
.category-tag:hover { box-shadow: 0 0 0 1px currentColor; }
.date-cell { color: #7f8e82; white-space: nowrap; font-size: .6875rem; }
.receipt-status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; background: transparent; border: 0; white-space: nowrap; font-size: .625rem; }
.receipt-status .icon { width: 13px; height: 13px; }
.receipt-status.complete { color: #71917a; }
.receipt-status.missing { color: #a08355; }
.receipt-status:hover { text-decoration: underline; }
td.amount, th.amount { text-align: right; white-space: nowrap; }
td.amount { font-size: .75rem; font-weight: 650; color: #43594a; font-variant-numeric: tabular-nums; }
.currency { display: block; font-size: .5625rem; font-weight: 400; color: #9caaa0; margin-top: 3px; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell .icon-button { width: 29px; height: 33px; color: #a4b0a6; }
.actions-cell .icon { width: 15px; height: 15px; }
.sort-control { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-shrink: 0; font-size: .6875rem; font-weight: 400; color: #8c9b90; }
.sort-control select { width: auto; max-width: 180px; padding: 7px 10px; font-size: .75rem; color: #697e6e; border-color: #e7ede9; border-radius: 7px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; padding: 15px 23px; color: #829287; font-size: .75rem; border-top: 1px solid var(--line); }
.list-footer > div { display: flex; align-items: center; gap: 14px; }
.collection-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; font-size: .875rem; }
.collection-head .count-badge { margin-right: 5px; }
.category-grid, .invoice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 19px; }
.category-card, .invoice-card { padding: 24px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.category-card:hover, .invoice-card:hover { border-color: #bfd1c3; box-shadow: 0 4px 16px #2b4d3210; }
.category-card-top, .invoice-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.category-card .category-icon { width: 40px; height: 40px; }
.category-card h2, .invoice-card h2 { font-size: 1rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.category-card p, .invoice-card p { font-size: .8125rem; }
.category-card .link-button { margin-top: 22px; }
.category-card.inactive { background: #fafcfb; }
.category-card.inactive .category-icon { filter: grayscale(1); }
.status-pill { font-size: .6875rem; color: #4a805e; background: #eef6ef; padding: 5px 8px; border-radius: 5px; white-space: nowrap; }
.status-pill.neutral { background: #eff2ef; color: #8a958b; }
.section-help { display: flex; gap: 8px; align-items: center; margin-top: 23px; color: #85988a; font-size: .75rem; line-height: 1.6; }
.section-help .icon { width: 15px; }
.document-icon { display: grid; place-items: center; width: 47px; height: 53px; background: #f0f5f1; color: #7c9982; border: 1px solid #e0eae2; border-radius: 8px; }
.document-icon .icon { width: 25px; height: 25px; }
.invoice-card .category-tag { margin: 17px 0 20px; }
.invoice-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.invoice-card-bottom strong { font-size: .9375rem; }
.invoice-card-bottom small { color: #839387; font-size: .625rem; font-weight: 400; }
.team-list { padding: 0 22px; }
.team-row { display: flex; align-items: center; gap: 18px; padding: 23px 0; border-bottom: 1px solid var(--line); }
.team-row:last-child { border-bottom: 0; }
.team-person { flex: 1; }
.team-person strong { display: block; font-size: .875rem; }
.team-person > span { display: block; color: var(--muted); font-size: .75rem; margin-top: 6px; overflow-wrap: anywhere; }
.role-badge { min-width: 130px; font-size: .75rem; color: #5f7668; }
.empty { padding: 48px 24px; text-align: center; background: white; border-radius: 12px; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 16px; background: #eef5f0; color: #7a9c86; }
.empty-icon .icon { width: 25px; height: 25px; }
.empty h2 { margin-bottom: 10px; }
.empty p { color: var(--muted); line-height: 1.7; font-size: .875rem; max-width: 390px; margin: 0 auto 22px; }

/* Formulaires : panneau latéral et fenêtres courtes */
dialog { color: var(--ink); width: min(480px,calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid #dae5de; border-radius: 16px; box-shadow: 0 24px 90px #0f372e26; }
dialog::backdrop { background: #152d2547; backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 27px 28px 23px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.35rem; }
.dialog-head .icon-button { margin-top: -5px; margin-right: -6px; }
.dialog-subtitle { font-size: .8125rem; margin-top: 7px; }
.expense-drawer { position: fixed; inset: 0 0 0 auto; width: min(620px,100%); height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 18px 0 0 18px; border: 0; }
.expense-drawer form { height: 100%; display: flex; flex-direction: column; }
.drawer-body { overflow-y: auto; flex: 1; padding: 0 29px; overscroll-behavior: contain; }
.form-section { padding: 25px 0; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 21px; font-weight: 650; }
.step-number { color: #89a190; font-size: .6875rem; border: 1px solid #e0e9e2; border-radius: 5px; display: grid; place-items: center; width: 25px; height: 23px; background: #f8faf8; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 19px 17px; }
.full { grid-column: 1 / -1; }
.required-hint { position: absolute; right: 0; top: 0; font-size: .6875rem; font-weight: 400; color: #90a194; }
.optional { color: #8fa194; font-size: .6875rem; font-weight: 400; }
label > .optional { position: absolute; top: 0; right: 0; }
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 60px; font-weight: 650; }
.input-unit > span { position: absolute; right: 14px; top: 15px; font-size: .75rem; font-weight: 400; color: #859a8d; }
#inline-category { font-size: .6875rem; padding-top: 0; }
#inline-category .icon { width: 12px; height: 12px; }
.ai-row { display: flex; align-items: center; gap: 13px; background: #f7faf8; padding: 12px; border: 1px solid #e9f0eb; border-radius: 9px; }
.ai-row .secondary { font-size: .6875rem; white-space: nowrap; border-color: #dbe8df; color: #668571; padding: 8px 9px; }
.ai-row .secondary .icon { width: 14px; height: 14px; }
.ai-row .small { font-size: .6875rem; line-height: 1.5; }
.upload { padding: 24px 15px 20px; display: flex; align-items: center; text-align: center; gap: 5px; border: 1.5px dashed #d0e0d5; border-radius: 11px; background: #fbfdfb; cursor: pointer; font-size: .8125rem; }
.upload:hover, .upload.dragging, .upload:focus-within { border-color: #599a76; background: #f0f8f2; }
.upload-icon { display: grid; place-items: center; background: #eef4ef; border-radius: 9px; width: 36px; height: 36px; color: #729b7f; margin-bottom: 7px; }
.upload .small { margin-top: 10px; font-size: .625rem; }
.upload input { width: 100%; position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #edf2ee; }
.file-icon { display: grid; place-items: center; width: 34px; height: 39px; background: #eef5f0; color: #71937b; border-radius: 6px; flex-shrink: 0; }
.file-icon .icon { width: 17px; height: 17px; }
.file-row > div { flex: 1; min-width: 0; }
.file-row strong, .file-row a:not(.icon-button) { display: block; font-size: .8125rem; font-weight: 500; overflow-wrap: anywhere; }
.file-row > div > span { display: block; font-size: .625rem; color: #90a092; margin-top: 5px; }
.file-row .icon-button { width: 29px; }
.file-row .icon-button .icon { width: 16px; }
.file-section-label { font-size: .6875rem; color: #7f9586; margin-top: 22px; }
footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 20px 28px; border-top: 1px solid var(--line); }
.drawer-footer { background: #fff; gap: 18px; justify-content: space-between; padding: 20px 28px; box-shadow: 0 -8px 18px #243e2c03; }
.save-summary > span { display: block; font-size: .625rem; color: #8b9e90; margin-bottom: 7px; }
.save-summary strong { font-size: 1.1rem; color: #3a5c46; letter-spacing: -.3px; }
.save-summary small { font-size: .625rem; font-weight: 400; color: #829989; }
.save-actions { display: flex; align-items: center; gap: 8px; }
.small-body { padding: 23px 28px; }
#small-fields { display: grid; gap: 19px; }
.color-field { display: flex; align-items: center; gap: 19px; }
.color-field > span { max-width: 235px; }
.switch-row { flex-direction: row; justify-content: space-between; align-items: center; gap: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #fafcfb; }
.switch-row strong { display: block; font-size: .8125rem; }
.switch-row .muted { display: block; font-size: .6875rem; margin-top: 5px; }
.switch-row input { flex-shrink: 0; }
.field-help { font-size: .75rem; color: #869a8c; line-height: 1.6; margin-top: -10px; }
.error:not(:empty) { padding: 12px 14px; background: #fff2ef; border: 1px solid #f3d9d2; border-radius: 8px; color: #a6483b; font-size: .8125rem; line-height: 1.6; margin-top: 14px; margin-bottom: 15px; }
.error:empty { display: none; }
.confirm-dialog { width: min(415px,calc(100% - 32px)); }
.confirm-dialog form { padding: 28px 28px 0; }
.confirm-dialog footer { margin: 25px -28px 0; }
.confirm-dialog h2 { margin: 18px 0 10px; }
.confirm-dialog p { font-size: .875rem; }
.confirm-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #fff0eb; color: #b86a53; }
#account-identity { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; }
#account-identity .avatar { width: 46px; height: 46px; font-size: 1rem; }
#account-identity strong { display: block; font-size: .9375rem; }
#account-identity div > span { display: block; font-size: .75rem; color: var(--muted); margin-top: 5px; overflow-wrap: anywhere; }
.account-links { display: grid; }
.account-links button { display: flex; align-items: center; gap: 13px; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 16px 0; text-align: left; color: #506e5c; font-size: .875rem; }
.account-links button > .icon:last-child:not(:first-child) { margin-left: auto; width: 16px; }

/* Connexion et états */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; background: white; }
.login-brand { padding: 48px 12%; color: white; background: #154f3e; display: flex; flex-direction: column; justify-content: space-between; gap: 70px; }
.login-brand .brand { color: white; padding: 0; }
.login-brand .brand-mark { background: #d5e6d3; color: #1b563e; }
.login-brand .brand-sub { color: #a6c6b0; }
.login-brand .eyebrow { color: #a0c2a6; }
.login-brand h1 { font-size: clamp(2rem,3.5vw,3.2rem); line-height: 1.17; letter-spacing: -1.6px; margin: 20px 0 25px; }
.login-brand p { font-size: .9375rem; line-height: 1.8; color: #aac7b4; max-width: 380px; }
.login-features { margin-top: 36px; font-size: .875rem; color: #c5ddcc; line-height: 2.8; }
.login-features > .icon, .login-features > span { margin-right: 9px; color: #91b79b; }
.login-brand .login-foot { font-size: .75rem; color: #83ad90; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 35px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 1.7rem; line-height: 1.3; letter-spacing: -.8px; margin: 14px 0 12px; }
.login-card > .muted { font-size: .875rem; margin-bottom: 31px; }
.login-card > label { margin-top: 22px; margin-bottom: 9px; font-size: .8125rem; }
.password-field { position: relative; }
.password-field input { padding-right: 45px; }
.password-field button { position: absolute; right: 4px; top: 5px; }
.login-submit { width: 100%; margin-top: 26px; justify-content: space-between; }
.login-help { font-size: .75rem; line-height: 1.8; text-align: center; color: #8c9d90; margin-top: 24px; }
.spinner { display: inline-block; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; width: 15px; height: 15px; flex-shrink: 0; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 9px; color: #73937e; font-size: .8125rem; padding: 12px; }
#content[aria-busy=true] { opacity: .5; pointer-events: none; }
#toast { position: fixed; bottom: 27px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(540px,calc(100vw - 30px)); padding: 15px 20px; background: #244f3c; color: white; font-size: .8125rem; line-height: 1.6; border-radius: 11px; box-shadow: 0 10px 35px #17372530; }
#toast.toast-error { background: #8d4838; }
.boot-error { margin: 30px; padding: 25px; color: #a6483b; background: #fff2ef; border: 1px solid #f3d9d2; border-radius: 10px; line-height: 1.6; }

/* Adaptations : les lignes deviennent des cartes, sans tableau à faire défiler. */
@media (min-width: 1251px) {
  #toggle-filters { display: none; }
}
@media (max-width: 1250px) {
  .sidebar { width: 207px; padding-left: 14px; padding-right: 14px; }
  .workspace { margin-left: 207px; }
  .topbar { padding: 0 25px; }
  main { padding: 28px 25px 40px; }
  .advanced-filters { display: none; }
  .filter-fields.expanded { flex-wrap: wrap; }
  .filter-fields.expanded .advanced-filters { display: flex; flex: 1 1 100%; }
  .filter-fields.expanded .advanced-filters label { flex: 1; }
  .filter-fields.expanded .advanced-filters select, .filter-fields.expanded .advanced-filters input { width: 100%; }
  .stat { padding: 18px; }
  .stat-bottom { font-size: .625rem; }
  .mini-pill { display: none; }
  td { padding: 15px 10px; }
  th { padding: 12px 10px; }
  .expense-name > .category-icon { display: none; }
  .row-meta { flex-wrap: wrap; }
  .category-grid, .invoice-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .charts { grid-template-columns: 1.25fr 1fr; gap: 18px; }
  .panel-head { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 1020px) {
  .stats { gap: 12px; }
  .stat-top { font-size: .75rem; }
  .stat-icon { display: none; }
  .stat-value { margin-top: 19px; }
  .charts { grid-template-columns: 1fr; }
  .bars { grid-template-columns: 1fr 1fr; column-gap: 25px; max-height: none; }
  .trend-panel { min-height: 0; }
  .trend-svg { max-height: 265px; }
  .chart-key { font-size: .75rem; }
  .table-wrap { overflow: visible; }
  .expense-table thead { display: none; }
  .expense-table, .expense-table tbody { display: block; }
  .expense-table tbody { padding: 0 20px; }
  .expense-table tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'title amount' 'category receipt' 'date actions'; gap: 9px 12px; padding: 19px 0; border-bottom: 1px solid var(--line); }
  .expense-table tr:last-child { border-bottom: 0; }
  .expense-table td, .expense-table td:first-child, .expense-table td:last-child { border: 0; padding: 0; min-width: 0; }
  .designation-cell { grid-area: title; }
  .category-cell { grid-area: category; }
  .date-cell { grid-area: date; align-self: center; }
  .receipt-cell { grid-area: receipt; text-align: right; }
  .actions-cell { grid-area: actions; }
  .expense-table .amount { grid-area: amount; font-size: .875rem; }
  .expense-name > div { min-width: 0; }
  .expense-title { font-size: .8125rem; }
  .row-meta { font-size: .6875rem; margin-top: 5px; }
  .actions-cell .icon-button { width: 34px; height: 28px; }
  .category-tag, .receipt-status, .date-cell { font-size: .6875rem; }
  .actions-cell .icon { width: 16px; height: 16px; }
  .insight .link-button { font-size: .75rem; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .workspace { margin: 0; }
  .topbar { height: 56px; padding: 0 20px; }
  .breadcrumb { font-size: .75rem; gap: 8px; }
  .breadcrumb { color: #42694e; }
  #today-label { display: none; }
  .mobile-account { display: inline-flex; }
  main { padding: 25px 18px calc(100px + env(safe-area-inset-bottom)); }
  .page-header { margin-bottom: 22px; align-items: start; }
  h1 { font-size: 1.65rem; }
  .page-header .muted { font-size: .8125rem; max-width: 250px; }
  .eyebrow { font-size: .625rem; }
  #new-expense { width: 42px; height: 42px; padding: 0; min-height: 42px; border-radius: 11px; }
  #new-expense > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .periods { padding: 3px; gap: 0; }
  .periods button { padding: 8px 10px; font-size: .6875rem; }
  #toggle-filters { font-size: .75rem; padding: 8px 10px; gap: 6px; }
  #toggle-filters .icon { width: 15px; height: 15px; }
  .filter-top { gap: 8px; }
  .filter-fields.expanded .advanced-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .advanced-filters .category-control { grid-column: 1/-1; }
  .filter-section { margin-bottom: 20px; }
  .filter-chips { margin-top: 9px; }
  .search-control input, input, select, textarea { font-size: 16px; }
  .search-control input { font-size: .875rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
  .stat { padding: 17px 16px; }
  .stat-primary { grid-column: 1 / -1; }
  .stat-primary .stat-icon { display: grid; width: 31px; height: 31px; }
  .stat-primary .stat-value { margin: 7px 0 14px; font-size: 2.1rem; }
  .stat-value { margin: 13px 0 14px; font-size: 1.65rem; gap: 5px; }
  .stat-value small { font-size: .6875rem; }
  .stat-fraction { font-size: .625rem; margin-left: 0; }
  .stat-top { font-size: .6875rem; }
  .stat-bottom { font-size: .625rem; }
  .stat-primary .stat-top { font-size: .8125rem; }
  .charts { gap: 17px; }
  .panel-head { padding: 19px 18px 16px; }
  .panel-head h2 { font-size: .875rem; }
  .panel-head p { font-size: .6875rem; }
  .trend-svg { width: calc(100% - 10px); margin: 5px 5px 0; }
  .trend-svg text { font-size: 13px; }
  .chart-caption { padding: 12px 18px; font-size: .625rem; }
  .chart-key { font-size: .625rem; }
  .bars { grid-template-columns: 1fr; gap: 17px; padding: 3px 18px 23px; }
  .bar-label { font-size: .8125rem; }
  .bar-label strong { font-size: .8125rem; }
  .bar-bottom > span { font-size: .6875rem; }
  .insight { padding: 13px 14px; gap: 9px; flex-wrap: wrap; }
  .insight > .icon { align-self: start; margin-top: 3px; }
  .insight p { flex: 1; font-size: .75rem; }
  .insight .link-button { margin-left: 26px; }
  .expense-table tbody { padding: 0 17px; }
  .expense-table .expense-title { font-size: .875rem; }
  .expense-table .row-meta { font-size: .6875rem; }
  .expense-table td.amount { font-size: .9375rem; }
  .currency { font-size: .625rem; }
  .receipt-status { font-size: .6875rem; }
  .actions-cell .icon-button { width: 38px; height: 35px; }
  .category-tag { font-size: .6875rem; padding: 6px 8px; }
  .sort-control > span { display: none; }
  .sort-control select { font-size: .6875rem; max-width: 145px; }
  .expense-panel .panel-head { flex-wrap: wrap; gap: 12px; }
  .expense-panel .panel-head:has(#sort) > div { flex: 1; }
  .collection-head { align-items: start; font-size: .8125rem; }
  .collection-head .primary { font-size: .75rem; padding: 10px 12px; }
  .collection-head > div { padding-top: 4px; line-height: 1.8; }
  .category-grid, .invoice-grid { grid-template-columns: 1fr; gap: 14px; }
  .category-card, .invoice-card { padding: 20px; }
  .category-card p { max-width: 240px; }
  .invoice-card h2 { font-size: 1.05rem; }
  .invoice-card p { font-size: .8125rem; }
  .invoice-card-bottom strong { font-size: 1.1rem; }
  .invoice-card .category-tag { font-size: .75rem; }
  .section-help { font-size: .75rem; align-items: start; }
  .section-help .icon { margin-top: 4px; }
  .team-list { padding: 0 16px; }
  .team-row { display: grid; grid-template-columns: 35px 1fr auto; gap: 10px; }
  .team-row .avatar { grid-column: 1; grid-row: 1; }
  .team-person { grid-column: 2; grid-row: 1; }
  .team-row .icon-button { grid-column: 3; grid-row: 1; }
  .team-row .role-badge { grid-column: 2; min-width: 0; font-size: .6875rem; }
  .team-row .status-pill { grid-column: 3; font-size: .625rem; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; bottom: 0; left: 0; right: 0; padding: 8px 6px calc(9px + env(safe-area-inset-bottom)); background: #fffffffa; border-top: 1px solid #e5ece7; z-index: 8; backdrop-filter: blur(12px); }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; color: #95a198; min-height: 45px; font-size: .5625rem; border-radius: 8px; }
  .mobile-nav button.active { color: #216b4a; background: #f0f7f2; font-weight: 600; }
  .mobile-nav .icon { width: 20px; height: 20px; }
  .expense-drawer { border-radius: 0; width: 100%; }
  .dialog-head { padding: 22px 20px 18px; }
  .dialog-head h2 { font-size: 1.25rem; }
  .dialog-subtitle { font-size: .75rem; }
  .drawer-body { padding: 0 20px; }
  .form-section { padding: 23px 0; }
  .form-section h3 { font-size: .8125rem; gap: 7px; flex-wrap: wrap; }
  .form-grid { gap: 17px 12px; }
  label, .field { font-size: .8125rem; }
  .input-unit > span { top: 15px; font-size: .6875rem; right: 11px; }
  .input-unit input { padding-right: 52px; }
  .ai-row { flex-direction: column; align-items: start; gap: 9px; }
  .ai-row .secondary { font-size: .75rem; }
  .ai-row .small { font-size: .75rem; }
  .upload .small { font-size: .6875rem; line-height: 1.5; }
  .required-hint { font-size: .625rem; }
  .drawer-footer { flex-wrap: wrap; gap: 14px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); }
  .save-summary { display: flex; align-items: center; justify-content: space-between; width: 100%; }
  .save-summary > span { margin: 0; font-size: .6875rem; }
  .save-actions { width: 100%; }
  .save-actions .primary { flex: 1; }
  .save-actions .secondary { width: 90px; }
  .small-body { padding: 20px; }
  footer { padding: 18px 20px; }
  .confirm-dialog footer { margin-left: -28px; margin-right: -28px; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 26px; gap: 0; }
  .login-brand > div:not(.brand), .login-foot { display: none; }
  .login-form-wrap { padding: 36px 26px; align-items: start; }
  .login-card h2 { font-size: 1.8rem; }
}
@media (max-width: 370px) {
  main { padding-left: 14px; padding-right: 14px; }
  .periods button { padding: 8px 7px; font-size: .625rem; }
  #toggle-filters { padding: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-value small { font-size: .625rem; }
  .expense-title { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Lecture confortable des données et commandes, y compris sur petit écran. */
.nav-label { font-size: .6875rem; }
.brand-sub, .workspace-note span, #identity > span { font-size: .75rem; }
.workspace-note strong, #identity strong { font-size: .8125rem; }
.topbar { font-size: .8125rem; }
.periods button, .search-control input, .category-control select { font-size: .875rem; }
.advanced-filters input, .advanced-filters label:not(.category-control) { font-size: .8125rem; }
.filter-reset, .filter-chip, .filter-count { font-size: .75rem; }
.stat-top { font-size: .875rem; }
.stat-bottom, .mini-pill, .stat-fraction { font-size: .75rem; }
.panel-head h2 { font-size: 1rem; }
.panel-head p, .chart-key, .chart-caption { font-size: .75rem; }
.bar-label, .bar-label strong { font-size: .875rem; }
.bar-bottom > span { font-size: .75rem; }
.insight p, .insight .link-button { font-size: .8125rem; }
th, .date-cell, .receipt-status, .category-tag { font-size: .75rem; }
.expense-title, td.amount { font-size: .875rem; }
.row-meta { font-size: .75rem; }
.currency { font-size: .6875rem; }
.sort-control, .sort-control select { font-size: .8125rem; }
.actions-cell .icon-button { width: 34px; height: 36px; }
.required-hint, .optional, .step-number, .ai-row .secondary, .ai-row .small, #inline-category { font-size: .75rem; }
.upload .small, .file-row > div > span, .save-summary > span, .save-summary small { font-size: .75rem; }
.field-help, .switch-row .muted, .status-pill, .count-badge, .invoice-card-bottom small { font-size: .75rem; }
.mobile-nav button { font-size: .6875rem; }
@media (max-width: 760px) {
  .periods button { font-size: .75rem; padding-left: 9px; padding-right: 9px; }
  #toggle-filters { font-size: .75rem; }
  .stat-top { font-size: .75rem; }
  .stat-primary .stat-top { font-size: .875rem; }
  .stat-bottom { font-size: .6875rem; }
  .stat-fraction, .currency { font-size: .75rem; }
  .stat-value { flex-wrap: wrap; }
  .bar-label, .bar-label strong { font-size: .875rem; }
  .actions-cell .icon-button { width: 40px; height: 40px; }
  .receipt-status, .category-tag { font-size: .75rem; min-height: 32px; }
  .sort-control select { font-size: .8125rem; }
  .drawer-footer .primary, .drawer-footer .secondary { min-height: 46px; }
}
@media (max-width: 370px) {
  .periods button { font-size: .6875rem; padding-left: 7px; padding-right: 7px; }
  .filter-top { flex-wrap: wrap; }
}

/* Les sept postes initiaux restent visibles ; les textes secondaires gardent du contraste. */
.bars { max-height: none; }
.nav-label, .brand-sub, .workspace-note span, #identity > span, .topbar,
.stat-top, .stat-bottom, .stat-fraction, .stat-value small,
.panel-head p, .chart-key, .chart-caption, .bar-bottom > span,
th, .date-cell, .row-meta, .currency, .sort-control,
.filter-reset, .section-help, .required-hint, .optional,
.file-row > div > span, .file-section-label, .save-summary > span, .save-summary small,
.login-help, .field-help, .small.muted, .collection-head > div > .muted { color: #65796c; }
.stat-primary .stat-top, .stat-primary .stat-bottom, .stat-primary .stat-value small { color: #c5e0d1; }
.breadcrumb > span { color: #748479; }
.receipt-status.complete { color: #4c765a; }
.receipt-status.missing { color: #8d692d; }
.actions-cell .icon-button { color: #718776; }
.status-pill { color: #41724f; }
.status-pill.neutral { color: #647467; }
.category-tag { color: color-mix(in srgb, var(--category-color,#126854) 58%, #152c20); }
input::placeholder, textarea::placeholder { color: #718175; }
.trend-svg text { fill: #627969; }
.trend-panel .trend-svg { margin-top: auto; margin-bottom: auto; }
.login-brand .brand-sub { color: #b5d2be; }
.mobile-nav button { color: #677f6d; }
@media (max-width: 760px) {
  .mobile-nav button { min-height: 48px; }
  .trend-svg { min-height: 170px; }
}

/* Quantités, prix et récapitulatifs. */
.filter-actions { display:flex; align-items:center; gap:8px; }
.pricing-detail { display:block; margin-top:6px; font-size:.75rem; color:#65796c; font-variant-numeric:tabular-nums; }
input[name="amount"][readonly] { background:#edf5ef; border-color:#d2e4d9; color:#185d43; font-weight:650; cursor:default; }
.pricing-help { margin-top:0; margin-bottom:0; line-height:1.6; }
#pricing-error:not(:empty) { margin:0; }
#export-expenses { white-space:nowrap; }
@media(max-width:760px) {
  .filter-top { flex-wrap:wrap; }
  .filter-actions { width:100%; justify-content:space-between; }
  #export-expenses { font-size:.8125rem; }
}

[hidden] { display: none !important; }
