:root {
  --bg: #F5F3EE; --surface: #fff; --ink: #1B1A17; --muted: #625E55; --line: #E4E0D6; --line2: #EEEBE4;
  --accent: #1E5B47; --accent-dark: #164636; --accent-soft: #E3EEE8; --side: #15201B; --gold: #D9A441;
  --ok-bg: #E3EEE8; --ok: #1A5140; --warn-bg: #FBEFD5; --warn: #744A06; --bad-bg: #F8E1DE; --bad: #8E2A22;
  --info-bg: #E2EBF5; --info: #1F4A73; --mute-bg: #EEEBE4; --mute: #4F4B43; --outlook: #0F4C81;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: #123C2F; }
h1, h2, h3, p { margin: 0; }
.serif, h1, .h2 { font-family: 'Fraunces', Georgia, serif; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex-shrink: 0; background: var(--side); display: flex; flex-direction: column; padding: 24px 16px; gap: 32px; position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #2A4238 transparent; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--gold); display: flex; align-items: center; justify-content: center; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 600; color: #F5F3EE; display: block; }
.brand-sub { font-size: 11px; color: #8FA599; display: block; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-title { font-size: 11px; font-weight: 600; color: #7E958A; letter-spacing: .08em; padding: 0 12px 8px; }
.nav-i { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 9px; color: #C3D1C9; text-decoration: none; font-size: 14px; }
.nav-i:hover { background: #21332B; color: #fff; }
.nav-i.on { background: #2A4238; color: #fff; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.user { display: flex; align-items: center; gap: 10px; padding: 12px; margin-top: 8px; border-top: 1px solid #26362F; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2A4238; color: #E7EFEA; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.user-name { font-size: 13px; color: #F5F3EE; font-weight: 500; display: block; }
.user-mail { font-size: 12px; color: #8FA599; display: block; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.logout-btn { margin-left: auto; color: #8FA599; background: none; border: 0; cursor: pointer; display: flex; padding: 4px; }
.logout-btn:hover { color: #fff; }
.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; flex-shrink: 0; border-bottom: 1px solid var(--line); background: #FBFAF7; display: flex; align-items: center; padding: 0 40px; gap: 16px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs .sep { color: #B3AD9F; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.content { padding: 32px 40px 56px; display: flex; flex-direction: column; gap: 24px; max-width: 1480px; width: 100%; }

/* Headings */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin-top: 6px; font-size: 15px; color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.h2 { font-size: 20px; font-weight: 600; }
.sect { font-size: 16px; font-weight: 600; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-head .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card-flush { overflow: hidden; }
.card-flush > .card-head { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 24px; align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.g-main-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.g-form-side { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
@media (max-width: 1100px) { .g3, .g4, .g-main-side, .g-form-side, .g2 { grid-template-columns: minmax(0, 1fr); } }

.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 12px; font-weight: 500; color: #57534A; }
.kpi-value { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); }

.kv { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line2); gap: 16px; }
.kv:last-child { border-bottom: none; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.kv.total > span:last-child { font-weight: 700; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font: 500 14px 'IBM Plex Sans', sans-serif; text-decoration: none; border: 1px solid #D6D1C4; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outlook { background: var(--outlook); border-color: var(--outlook); color: #fff; }
.btn-outlook:hover { background: #0B3A63; color: #fff; }
.btn-danger { color: var(--bad); border-color: #E7C3BE; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
form.inline { display: inline; }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: var(--mute-bg); color: var(--mute); }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: #FAF8F4; font-size: 13px; text-decoration: none; color: var(--ink); }
.chip:hover { background: #F1EEE7; color: var(--ink); }

/* Tables */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 500; color: #57534A; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #FAF8F4; white-space: nowrap; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: none; }
table.t .r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 600; background: #FAF8F4; border-top: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.cell-main { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.thumb { width: 44px; height: 44px; border-radius: 9px; background: #DCE6E0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Forms */
.form-sect { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.form-sect-head { display: flex; gap: 14px; align-items: flex-start; }
.step-n { font-family: 'Fraunces', Georgia, serif; font-size: 15px; font-weight: 600; color: var(--accent); width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.frow { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.frow > .f { flex: 1 1 160px; min-width: 0; }
.frow > .f.w2 { flex-grow: 2; }
.lbl { display: block; font-size: 12px; font-weight: 500; color: #57534A; margin-bottom: 6px; }
.input { height: 40px; border: 1px solid #D6D1C4; border-radius: 10px; padding: 0 12px; font: 400 14px 'IBM Plex Sans', sans-serif; color: var(--ink); background: #fff; width: 100%; }
.input:focus { outline: 2px solid #9CC3B0; border-color: var(--accent); }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.calc { background: #F3F7F4; border-color: #CFE0D6; color: var(--ok); font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; display: block; }
.field-error, .validation-summary-errors { color: var(--bad); font-size: 12px; margin-top: 4px; display: block; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.drop { border: 1.5px dashed #CFC9BA; border-radius: 12px; padding: 14px 16px; background: #FBFAF7; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 24px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; height: 44px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }

/* Misc */
.flash { padding: 14px 18px; border-radius: 12px; display: flex; gap: 12px; align-items: center; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--bad-bg); color: var(--bad); }
.flash-warn { background: #FBEFD9; color: #744A06; }
.note { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; background: #FBFAF7; }
.note-warn { background: #FFFCF4; border-color: #EED9A8; }
.note-ok { background: #F3F7F4; border-color: #CFE0D6; }
.todo { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line2); }
.todo:last-child { border-bottom: none; }
.todo-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bien-card { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); overflow: hidden; }
.bien-card:hover { border-color: #C9C2B2; color: var(--ink); }
.bien-cover { height: 90px; background: #DCE6E0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: var(--accent); }
.bien-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.mini-stats span { display: block; }
.dark-card { background: var(--side); border-color: var(--side); color: #E7EFEA; }
.dark-card .kv { border-color: #26362F; }
.dark-card .kv > span:first-child { color: #B7C8BF; }
.bar-track { height: 14px; background: var(--line2); border-radius: 7px; }
.bar-fill { height: 14px; border-radius: 7px; }
.chart svg { width: 100%; height: auto; display: block; }
.email-preview { white-space: pre-line; line-height: 1.65; }
.login-wrap { display: flex; min-height: 100vh; }
.login-hero { width: 44%; background: var(--side); color: #E7EFEA; padding: 56px 64px; display: flex; flex-direction: column; }
.login-hero h1 { font-size: 48px; line-height: 1.05; font-weight: 500; color: #F5F3EE; letter-spacing: -.02em; }
.login-form { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
@media (max-width: 900px) { .login-hero { display: none; } .side { display: none; } .content, .topbar { padding-left: 16px; padding-right: 16px; } }
@media print { .side, .topbar, .no-print { display: none !important; } .content { padding: 0; } body { background: #fff; } }

pre.code { background: #FAF8F4; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 0; overflow-x: auto; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #F1EEE7; padding: 1px 5px; border-radius: 5px; }
table.t td.nowrap, .nowrap { white-space: nowrap; }
.amt-in { color: var(--ok); font-weight: 500; }
.amt-out { color: var(--ink); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { height: 32px; font-size: 13px; width: auto; min-width: 120px; padding: 0 8px; border-radius: 8px; }
.tx-detail { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }

/* Droits : les actions non autorisées sont masquées (le serveur les refuse de toute façon) */
.role-admin form[action*="/Delete"], .role-comptable form[action*="/Delete"], .role-read form[action*="/Delete"],
.role-admin form[action*="Disconnect"], .role-comptable form[action*="Disconnect"],
.role-admin form[action*="/Jobs/Clear"], .role-comptable form[action*="/Jobs/Clear"],
.role-admin form[action*="/Dropbox/"], .role-comptable form[action*="/Dropbox/"] { display: none !important; }
.role-comptable a[href$="/Create"], .role-comptable a[href*="/Create?"], .role-comptable form[action*="/Create"],
.role-comptable form[action*="Upload"], .role-comptable form[action*="AddMove"], .role-comptable form[action*="/Apply"],
.role-comptable form[action*="/Standard"], .role-comptable form[action*="/SaveDoc"],
.role-read form[method="post"]:not([action*="/Logout"]):not([action*="/Password"]), .role-read a[href$="/Create"] { display: none !important; }
.role-comptable .bank-target option[value^="exp:"] { display: none; }

/* Aide : bulles ⓘ, visites guidées, premiers pas, mode */
.info-tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--info-bg); color: var(--info); font: italic 600 11px Georgia, serif; cursor: help; position: relative; vertical-align: middle; margin-left: 4px; }
.info-tip:hover::after, .info-tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 280px; background: #1B2A24; color: #fff; font: 400 12.5px/1.45 'IBM Plex Sans', sans-serif; padding: 10px 12px; border-radius: 10px; z-index: 50; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,.18); white-space: normal; }
.help-btn { width: 32px; padding: 0; font-weight: 700; font-size: 15px; border: 1px solid #D6D1C4; border-radius: 50%; }
.tour-box { position: fixed; z-index: 1000; border-radius: 12px; box-shadow: 0 0 0 4000px rgba(20, 30, 25, .45); pointer-events: none; transition: all .2s; }
.tour-tip { position: fixed; z-index: 1001; background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: 0 14px 40px rgba(0,0,0,.25); font-size: 14px; }
.tour-tip p { margin: 6px 0 12px; color: #3E3A33; line-height: 1.5; }
.tour-count { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; }
.onb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.onb-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: #FBFAF7; }
.onb-step:hover { background: #F3F7F4; }
.onb-step.done { opacity: .6; }
.onb-step.done strong { text-decoration: line-through; }
.onb-check { flex: 0 0 20px; height: 20px; border-radius: 50%; border: 1.5px solid #B9B3A5; display: flex; align-items: center; justify-content: center; color: #fff; }
.onb-step.done .onb-check { background: var(--accent); border-color: var(--accent); }
.mode-bar { display: flex; gap: 8px; align-items: center; padding: 8px 32px; background: var(--info-bg); color: var(--info); font-size: 13px; border-bottom: 1px solid var(--line); }

/* Paramètres : sélecteur de canal, migration */
.h3 { font-size: 15px; font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-i { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: #FBFAF7; cursor: pointer; font: inherit; color: var(--ink); transition: all .15s; }
.seg-i strong { display: flex; gap: 8px; align-items: center; }
.seg-i:hover:not(:disabled) { border-color: var(--accent); }
.seg-i.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(30, 91, 71, .12); }
.seg-i:disabled { opacity: .55; cursor: not-allowed; }
.mig { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: #FBFAF7; border: 1px solid var(--line); }
.mig .bar-fill { background: var(--accent); }
.mig.running .bar-fill { background: linear-gradient(90deg, var(--accent), #3E9C7A, var(--accent)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.ai-card { background: linear-gradient(135deg, #fff 60%, #F1F6F3); }

/* ── Classement IA ─────────────────────────────────────────────── */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes aurora { 0% { transform: translate(-10%, -10%) rotate(0deg); } 50% { transform: translate(10%, 5%) rotate(180deg); } 100% { transform: translate(-10%, -10%) rotate(360deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pop { 0% { opacity: 0; transform: translateY(14px) scale(.97); } 100% { opacity: 1; transform: none; } }
@keyframes scan { 0% { top: -10%; } 100% { top: 105%; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.3); opacity: 0; } }
@keyframes ring { from { stroke-dashoffset: 113; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 164, 65, .0), 0 30px 80px -30px rgba(10, 40, 30, .6); } 50% { box-shadow: 0 0 0 8px rgba(217, 164, 65, .18), 0 30px 80px -30px rgba(10, 40, 30, .6); } }

.ai-hero { position: relative; overflow: hidden; border-radius: 22px; padding: 46px 40px; color: #F2F6F3; background: #10231B; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; cursor: pointer; border: 1.5px dashed rgba(255,255,255,.18); transition: transform .2s, border-color .2s; box-shadow: 0 30px 80px -30px rgba(10, 40, 30, .6); }
.ai-hero::before, .ai-hero::after { content: ""; position: absolute; width: 70%; height: 140%; border-radius: 50%; filter: blur(60px); opacity: .55; animation: aurora 18s linear infinite; pointer-events: none; }
.ai-hero::before { background: radial-gradient(circle, #2E7A5F 0%, transparent 65%); left: -15%; top: -40%; }
.ai-hero::after { background: radial-gradient(circle, #D9A441 0%, transparent 60%); right: -25%; bottom: -60%; animation-duration: 24s; animation-direction: reverse; opacity: .35; }
.ai-hero > * { position: relative; z-index: 1; }
.ai-hero h1 { font-size: 34px; font-weight: 600; letter-spacing: -.01em; color: #fff; }
.ai-hero p { color: #C3D4CB; font-size: 15px; max-width: 640px; }
.ai-hero .ai-orb { width: 74px; height: 74px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #D9A441, #F0CF83); color: #10231B; animation: floaty 4s ease-in-out infinite; box-shadow: 0 14px 40px -10px rgba(217,164,65,.7); }
.ai-hero.drag { border-color: #F0CF83; transform: scale(1.01); animation: glow 1.2s ease-in-out infinite; }
.ai-hero.drag .ai-orb { animation-duration: 1s; }
.ai-hero .ai-btn { margin-top: 6px; background: #fff; color: #10231B; border: 0; padding: 11px 20px; border-radius: 12px; font: 600 14px 'IBM Plex Sans', sans-serif; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.ai-hero .ai-types { font-size: 12px; color: #8FB0A1; }
.ai-hero.compact { min-height: 0; padding: 22px; flex-direction: row; gap: 16px; text-align: left; }
.ai-hero.compact h1 { font-size: 20px; } .ai-hero.compact .ai-orb { width: 46px; height: 46px; border-radius: 14px; }
.ai-hero.compact p { font-size: 13px; } .ai-hero.compact .ai-types { display: none; }

.ai-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ai-bar .stat { display: flex; gap: 6px; align-items: baseline; font-size: 13px; color: var(--muted); }
.ai-bar .stat b { font: 600 22px 'Fraunces', Georgia, serif; color: var(--ink); }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 700px) { .ai-grid { grid-template-columns: 1fr; } .ai-hero { padding: 30px 18px; } .ai-hero h1 { font-size: 24px; } }

.ai-c { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; animation: pop .45s cubic-bezier(.2,.8,.2,1) both; position: relative; transition: box-shadow .2s, transform .2s, opacity .3s, max-height .5s; }
.ai-c:hover { box-shadow: 0 18px 40px -22px rgba(20, 40, 30, .35); }
.ai-c-top { display: flex; gap: 16px; padding: 18px; align-items: flex-start; }
.ai-thumb { position: relative; flex: 0 0 86px; height: 112px; border-radius: 10px; background: linear-gradient(160deg, #F7F5EF, #ECE8DE); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; color: #A49E90; }
.ai-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-thumb .ext { position: absolute; bottom: 6px; left: 6px; font: 700 10px 'IBM Plex Sans'; background: var(--side); color: #fff; padding: 2px 6px; border-radius: 5px; letter-spacing: .04em; }
.ai-thumb .lines { position: absolute; inset: 16px 12px auto 12px; display: flex; flex-direction: column; gap: 6px; }
.ai-thumb .lines i { display: block; height: 4px; border-radius: 2px; background: #D9D3C6; }
.ai-thumb .beam { position: absolute; left: 0; right: 0; height: 26px; background: linear-gradient(180deg, transparent, rgba(46,122,95,.35), rgba(217,164,65,.55) 60%, transparent); animation: scan 1.6s ease-in-out infinite; display: none; }
.ai-c.busy .beam { display: block; }
.ai-c-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-file { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-title { font: 600 18px/1.25 'Fraunces', Georgia, serif; min-height: 23px; }
.ai-step { font-size: 13px; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.ai-step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: floaty .8s ease-in-out infinite; }
.ai-skel { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ai-skel i { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #EEEBE4, #F8F6F1, #EEEBE4); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.ai-type { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; align-self: flex-start; animation: fadeUp .35s both; }
.ai-sum { font-size: 13px; color: #3E3A33; animation: fadeUp .4s .1s both; }
.ai-conf { flex: 0 0 auto; position: relative; width: 44px; height: 44px; }
.ai-conf svg { transform: rotate(-90deg); }
.ai-conf circle.v { animation: ring 1s cubic-bezier(.2,.8,.2,1) both; }
.ai-conf span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 600 11px 'IBM Plex Sans'; }
.ai-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line2); border-top: 1px solid var(--line2); }
.ai-fact { background: #FCFBF8; padding: 9px 14px; display: flex; flex-direction: column; gap: 2px; opacity: 0; animation: fadeUp .35s both; }
.ai-fact small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ai-fact b { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; word-break: break-word; }
.ai-more { padding: 8px 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line2); cursor: pointer; background: #FCFBF8; }
.ai-more:hover { color: var(--accent); }
.ai-extra { display: none; padding: 0 18px 12px; background: #FCFBF8; }
.ai-extra.on { display: block; }
.ai-extra .kv { font-size: 13px; }
.ai-alerts { display: flex; flex-direction: column; gap: 6px; padding: 10px 18px; background: #FFF9EC; border-top: 1px solid #F3E3BC; }
.ai-alerts div { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #744A06; animation: fadeUp .35s both; }
.ai-dest { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.ai-path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; flex: 1 1 100%; }
.ai-dest .actions { margin-left: auto; }
.ai-path span { background: #F2F0EA; padding: 4px 9px; border-radius: 7px; animation: fadeUp .35s both; }
.ai-path span:last-child { background: var(--accent); color: #fff; }
.ai-path em { color: #B3AD9F; font-style: normal; }
.ai-path.none span:last-child { background: var(--warn-bg); color: var(--warn); }
.ai-edit { display: none; padding: 14px 18px; border-top: 1px solid var(--line2); background: #FBFAF7; gap: 10px; flex-direction: column; }
.ai-edit.on { display: flex; }
.ai-edit .frow { gap: 10px; }
.ai-edit .lbl { font-size: 11.5px; }
.ai-c.done { border-color: #B9D6C8; }
.ai-c.done .ai-done { display: flex; }
.ai-done { display: none; align-items: center; gap: 12px; padding: 14px 18px; background: var(--ok-bg); color: var(--ok); font-size: 13.5px; border-top: 1px solid #CFE3D9; }
.ai-done .ok { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 30px; animation: pop .4s both; }
.ai-c.done .ai-dest, .ai-c.done .ai-edit { display: none; }
.ai-c.err .ai-step { color: var(--bad); }
.ai-c.err .ai-step .dot { background: var(--bad); animation: none; }
.ai-c.gone { opacity: 0; transform: scale(.96); }
.ai-dup { padding: 8px 18px; font-size: 12.5px; background: var(--info-bg); color: var(--info); border-top: 1px solid #D3E0EE; }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; animation: burst .8s ease-out forwards; z-index: 5; }
.ai-recent { display: flex; flex-direction: column; }
.ai-recent a { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line2); text-decoration: none; color: inherit; }
.ai-recent a:hover { background: #FBFAF7; }
.nav-new { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #10231B; background: linear-gradient(135deg, #D9A441, #F0CF83); padding: 2px 6px; border-radius: 6px; }
.ai-step .txt { transition: opacity .15s; }

/* Simulations */
.sim-layout { display: grid; grid-template-columns: minmax(380px, 470px) minmax(0, 1fr); gap: 22px; align-items: start; }
.sim-right { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 4px; transition: opacity .2s; }
.sim-right.loading { opacity: .65; }
.sim-right.flashy .sim-kpi .kpi-value { animation: fadeUp .3s both; }
@media (max-width: 1150px) { .sim-layout { grid-template-columns: 1fr; } .sim-right { position: static; max-height: none; overflow: visible; } }
.sim-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sim-kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.sim-kpi.hero { grid-column: 1 / -1; background: linear-gradient(135deg, #10231B, #1E5B47); color: #fff; border: 0; }
.sim-kpi.hero .kpi-label, .sim-kpi.hero .kpi-sub { color: #BFD3C8; }
.sim-kpi.hero .kpi-value { font-size: 34px; color: #fff; }
.sim-kpi.hero .kpi-value.neg { color: #F3B8AE; } .sim-kpi.hero .kpi-value.pos { color: #B8E5CC; }
@media (max-width: 700px) { .sim-kpis { grid-template-columns: 1fr 1fr; } }
.sim-plan { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .sim-plan { grid-template-columns: 1fr; } }
.sim-plan-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv.sub { font-size: 12px; color: var(--muted); padding-left: 12px; }
.sim-bar { height: 8px; border-radius: 4px; background: #E9E5DC; overflow: hidden; margin-top: 10px; }
.sim-bar span { display: block; height: 100%; background: var(--gold); }
.sim-tax { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sim-tax > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sim-tax > div.on { border-color: var(--accent); background: var(--accent-soft); }
.sim-tax small { font-size: 11px; color: var(--muted); } .sim-tax b { font: 600 20px 'Fraunces', Georgia, serif; }
tr.sim-mark td { background: #EAF3EE; }
button.sugg { margin-top: 5px; display: inline-flex; gap: 6px; align-items: center; border: 0; background: #FBF4E4; color: #7A5410; font: 500 12px 'IBM Plex Sans', sans-serif; padding: 3px 9px; border-radius: 999px; cursor: help; max-width: 100%; }
button.sugg i { font-style: normal; color: var(--gold); }
button.sugg span { opacity: .7; }
button.sugg.alt { background: #F2F0EA; color: var(--muted); cursor: pointer; }
button.sugg.alt span { text-decoration: underline; opacity: 1; }
input[data-auto]::placeholder { color: #9A7A35; opacity: 1; }
.sim-market { background: linear-gradient(135deg, #fff 55%, #F4F1E8); }
.sim-mk { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.sim-mk > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.sim-mk small { font-size: 11px; color: var(--muted); } .sim-mk b { font: 600 18px 'Fraunces', Georgia, serif; } .sim-mk span { font-size: 11.5px; color: var(--muted); }
.sim-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 700px) { .sim-list { grid-template-columns: 1fr; } }
.sim-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: inherit; transition: box-shadow .2s, transform .2s; }
.sim-card:hover { box-shadow: 0 16px 36px -22px rgba(20,40,30,.4); transform: translateY(-2px); color: inherit; }
.sim-card-k { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.sim-card-k small { display: block; font-size: 11px; color: var(--muted); } .sim-card-k b { font-variant-numeric: tabular-nums; }
.sim-right .grid.g2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1500px) { .sim-right .grid.g2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Menu latéral : défilement quand la fenêtre est moins haute que le menu */
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: #2A4238; border-radius: 3px; }
.side .nav, .side .side-foot { flex-shrink: 0; }
