/* Louvounou Finances — design system (destiné à webapp/public/css/app.css) */

:root {
    color-scheme: light;
    --brand: #E8802B;
    --brand-deep: #C85818;
    --brand-grad: linear-gradient(180deg, #F08A2E, #D2670F);
    --brand-line: linear-gradient(90deg, #F5A04C, #E8802B 35%, #C85818);
    --topbar: #262B2F;
    --topbar-ink: #C6CCD2;
    --ink: #1D2228;
    --muted: #68727C;
    --faint: #8A94A0;
    --bg: #F4F5F7;
    --panel: #FFFFFF;
    --line: #E8EBEE;
    --line-strong: #D8DDE2;
    --ok: #1E7F4F;
    --ok-bg: #E5F3EC;
    --danger: #C0362C;
    --danger-bg: #FBEAE8;
    --info: #33587E;
    --info-bg: #E8EEF6;
    --warn: #B35A10;
    --warn-bg: #FDEFE1;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(29, 34, 40, .05), 0 8px 24px rgba(29, 34, 40, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Topbar ---------- */

header.site { background: var(--topbar); }
header.site::after {
    content: "";
    display: block;
    height: 3px;
    background: var(--brand-line);
}

.topbar { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: .01em; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; flex: none; display: block; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.brand em { font-style: normal; color: var(--brand); }

.topbar nav { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.topbar nav a {
    color: var(--topbar-ink);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    position: relative;
}
.topbar nav a:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .07); }
.topbar nav a.active { color: #fff; }
.topbar nav a.active::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
}
.topbar form { margin: 0; display: flex; }
.topbar .logout {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .22);
    color: var(--topbar-ink);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
}
.topbar .logout:hover { color: #fff; border-color: rgba(255, 255, 255, .45); }

/* ---------- Structure de page ---------- */

main { padding: 30px 0 60px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 4px 0 22px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-header .sub { margin: 3px 0 0; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > * { min-width: 0; }

.panel {
    background: var(--panel);
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.panel h1, .panel h2, .panel h3 { margin-top: 0; letter-spacing: -.01em; }
.panel h2 { font-size: 17px; }
.panel h3 { font-size: 15px; }

.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon--lg { width: 22px; height: 22px; }

.callout { display: flex; align-items: center; gap: 14px; padding: 18px 24px; }
.callout .icon--lg { color: var(--brand-deep); }
.callout .callout-text { font-size: 13.5px; }

/* ---------- Boutons ---------- */

.btn, button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 600;
    transition: background .12s, box-shadow .12s, transform .12s;
}
.btn:hover, button:hover { background: #F5F6F8; text-decoration: none; }
.btn.primary, button.primary {
    background: var(--brand-grad);
    border: 0;
    padding: 10px 15px;
    color: #fff;
    box-shadow: 0 1px 2px rgba(200, 88, 24, .35);
}
.btn.primary:hover, button.primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(200, 88, 24, .3); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }

:is(.btn, button, input, select, textarea):focus-visible { outline: 3px solid rgba(232, 128, 43, .3); outline-offset: 1px; }

/* ---------- Formulaires ---------- */

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid rgba(232, 128, 43, .18); outline-offset: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand-deep); }
input[type="file"] { padding: 8px; color: var(--muted); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3A434D; }
.field { margin-bottom: 16px; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 5px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:hover { background: #FAFBFC; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Badges de statut ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 999px;
    padding: 3px 10px 3px 8px;
    font-size: 12px; font-weight: 600;
    background: #EEF0F2; color: #5A6470;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }

.badge--analyzing, .badge--anonymizing, .badge--running, .badge--queued { background: var(--info-bg); color: var(--info); }
.badge--completed, .badge--anonymized, .badge--positive { background: var(--ok-bg); color: var(--ok); }
.badge--error, .badge--failed, .badge--negative { background: var(--danger-bg); color: var(--danger); }
.badge--documents_uploaded { background: var(--warn-bg); color: var(--warn); }

.positive { color: var(--ok); font-weight: 600; }
.negative, .error { color: var(--danger); font-weight: 600; }

/* ---------- Verdict + jauge ---------- */

.verdict-banner {
    display: flex; align-items: center; gap: 12px;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 16px; font-weight: 700;
    margin-bottom: 18px;
}
.verdict-banner .icon { width: 22px; height: 22px; }
.verdict-banner.positive { background: var(--ok-bg); color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.verdict-banner.negative { background: var(--danger-bg); color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }

.gauge { margin: 6px 0 4px; }
.gauge .gauge-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.gauge .gauge-head strong { color: var(--ink); font-size: 14px; }
.gauge .track { position: relative; height: 8px; border-radius: 999px; background: var(--line); }
.gauge .fill {
    position: absolute; inset: 0 auto 0 0;
    width: calc(min(var(--pct), 100) * 1%);
    border-radius: 999px;
    background: var(--brand-grad);
}
.gauge.over .fill { background: linear-gradient(180deg, #E05A4E, #C0362C); }
.gauge .mark { position: absolute; top: -4px; bottom: -4px; left: 33%; width: 2px; border-radius: 2px; background: #3A434D; }
.gauge .mark-label { position: absolute; top: 14px; left: 33%; transform: translateX(-50%); font-size: 11px; color: var(--faint); white-space: nowrap; }
.gauge .track { margin-bottom: 26px; }

/* ---------- Stats en ligne ---------- */

.stats { display: flex; gap: 0; flex-wrap: wrap; }
.stats > div { flex: 1 1 120px; padding: 2px 18px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.stats .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* ---------- Listes de points ---------- */

ul.clean { margin: 8px 0 0; padding-left: 18px; }
ul.points { list-style: none; margin: 10px 0 0; padding: 0; }
ul.points li { display: flex; gap: 9px; padding: 6px 0; align-items: flex-start; }
ul.points .icon { margin-top: 3px; }
ul.points.pros .icon { color: var(--ok); }
ul.points.cons .icon { color: var(--danger); }

/* ---------- Flash / erreurs ---------- */

.flash {
    display: flex; align-items: center; gap: 10px;
    background: var(--ok-bg); color: var(--ok);
    box-shadow: inset 3px 0 0 var(--ok);
    padding: 12px 14px; border-radius: 10px; margin-bottom: 20px;
    font-weight: 500; font-size: 14px;
}
.errors {
    background: var(--danger-bg); color: var(--danger);
    box-shadow: inset 3px 0 0 var(--danger);
    padding: 12px 14px; border-radius: 10px; margin-bottom: 20px;
    font-size: 14px;
}
.errors strong { display: block; margin-bottom: 2px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Aperçu anonymisé ---------- */

.masked-preview {
    white-space: pre-wrap; overflow: auto; max-height: 70vh;
    border: 1px solid var(--line); border-radius: 10px;
    padding: 16px; background: #FAFBFC;
    font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Login ---------- */

.auth-wrap { min-height: calc(100vh - 63px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-card .auth-brand .logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 6px 16px rgba(200, 88, 24, .35); }
.auth-card .auth-brand .name { font-size: 19px; font-weight: 700; }
.auth-card .auth-brand .name em { font-style: normal; color: var(--brand-deep); }
.auth-card .panel { padding: 28px; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-card .panel > .muted { margin: 0 0 20px; font-size: 14px; }
.auth-card button.primary { width: 100%; margin-top: 4px; }
.remember { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .grid-2 { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; padding: 10px 0; row-gap: 6px; }
    .topbar nav { flex-wrap: wrap; order: 3; width: 100%; margin-left: -12px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .panel { padding: 18px; }
    .table-scroll { margin: 0 -18px; padding: 0 18px; }
    .stats { row-gap: 12px; }
    .stats > div { flex-basis: 40%; padding: 2px 14px; }
    .stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
}

/* ---------- Compléments pour les vues applicatives ---------- */

main:has(.auth-wrap) { padding: 0; }
.panel--narrow { max-width: 720px; }
.pagination, .table-block, .form-block { margin-top: 18px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.section-header h2, .section-header p { margin-bottom: 0; }
.section-header p { margin-top: 3px; }
.form-block .remember { margin-bottom: 14px; }
.badge--queued, .badge--inactive { background: #EEF0F2; color: #5A6470; }
.badge--active { background: var(--ok-bg); color: var(--ok); }
