/* Compta Club — feuille de style (couleurs SR Furdenheim : noir et jaune) */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f4;
  --ink: #161616;
  --ink-2: #4a4a46;
  --muted: #7b7b74;
  --line: #e4e2d9;
  --black: #111111;
  --black-2: #262626;
  --yellow: #ffcc00;
  --yellow-2: #e6b800;
  --yellow-ink: #7a5c00;   /* jaune foncé lisible sur fond clair (liens) */
  --accent: var(--black);
  --accent-2: var(--yellow);
  --accent-soft: #fff5c7;
  --ok-soft: #e5f1e8;
  --pos: #187a3f;
  --neg: #b4362b;
  --neg-soft: #fbeceA;
  --warn: #9a5b00;
  --warn-soft: #fdf3dd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 1px 1px rgba(20, 30, 25, .03);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--yellow-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
p { margin: .4rem 0; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- barre du haut ---------- */
.topbar {
  background: var(--black); color: #fff;
  display: flex; align-items: center; gap: 1rem; padding: .5rem 1.25rem;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 4px solid var(--yellow);
}
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none !important; }
.brand strong { display: block; font-size: .95rem; line-height: 1.1; }
.brand small { display: block; font-size: .72rem; color: var(--yellow); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-logo { width: 42px; height: 42px; display: block; flex: none; }
.nav { display: flex; align-items: center; gap: .15rem; flex: 1; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.8); padding: .45rem .65rem; border-radius: 7px; font-size: .9rem; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.08); color: var(--yellow); }
.nav a.active { background: var(--yellow); color: var(--black); font-weight: 600; }
.nav-sep { flex: 1; }
.nav-toggle, .nav-burger { display: none; }
.usermenu { position: relative; margin-left: .4rem; }
.usermenu summary { list-style: none; cursor: pointer; padding: .4rem .7rem; border-radius: 7px; border: 1px solid rgba(255,204,0,.55); color: var(--yellow); font-size: .88rem; }
.usermenu summary:hover { background: rgba(255,204,0,.1); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .75rem; min-width: 220px; display: grid; gap: .5rem;
}
.usermenu-panel a { color: var(--ink); padding: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--neg); cursor: pointer; font: inherit; text-align: left; }

/* ---------- mise en page ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { max-width: 720px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.pad { padding: 1rem 1.25rem; }
.pad-x { padding: 0 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.grid-2 > .card { margin-bottom: 1.1rem; }
.stack { display: grid; gap: .8rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-narrow { max-width: 620px; }
.empty { text-align: center; padding: 2.5rem 1rem; }
.breadcrumb { margin: 0 0 .75rem; font-size: .9rem; }

/* ---------- formulaires ---------- */
label { display: grid; gap: .3rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
label .muted { font-weight: 400; }
input, select, textarea {
  font: inherit; font-size: .93rem; color: var(--ink); background: #fff;
  border: 1px solid #cfcbbf; border-radius: 7px; padding: .5rem .6rem; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--yellow-2); }
input[type=checkbox] { width: auto; accent-color: var(--black); }
.check { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; font-weight: 500; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  padding: .5rem .9rem; border-radius: 7px; border: 1px solid #cfcbbf; background: #fff; color: var(--ink);
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--yellow); border-color: var(--yellow-2); color: var(--black); }
.btn-primary:hover { background: var(--black); border-color: var(--black); color: var(--yellow); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--neg); }
.btn-danger-ghost:hover { background: var(--neg-soft); }
.btn-small { padding: .3rem .6rem; font-size: .82rem; }
.btn-block { width: 100%; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form input:not([type=checkbox]) { flex: 1 1 180px; width: auto; }
.inline-form select { width: auto; }
.row-form { display: flex; gap: .5rem; align-items: center; }
.row-form input:not([type=checkbox]) { flex: 1; }
.row-form select { width: auto; }
.account-form input[name=opening_balance] { max-width: 130px; flex: 0 0 130px; }
.sm-only { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; padding: .8rem; }
.filters select { width: auto; max-width: 240px; }
.filters input[type=search] { flex: 1 1 200px; width: auto; }
.rule-grid { display: grid; grid-template-columns: 1.4fr .8fr 1.2fr; gap: .8rem; }

/* ---------- alertes ---------- */
.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash { padding: .7rem 1rem; border-radius: 8px; border: 1px solid; font-size: .93rem; margin-bottom: .6rem; }
.flash-success { background: var(--ok-soft); border-color: #bfdcc8; color: #124d2a; }
.flash-error { background: var(--neg-soft); border-color: #efc5bf; color: #8a2219; }
.flash-info { background: #eef3f8; border-color: #cfdcea; color: #23415f; }
.todo-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--warn-soft); border: 1px solid #f0d9a6; color: #6b4300; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.1rem;
}
.todo-banner a:not(.btn) { color: #6b4300; text-decoration: underline; }
.todo-banner.ok { background: var(--ok-soft); border-color: #bfdcc8; color: #124d2a; }
.warn-text { color: var(--warn); font-weight: 600; }

/* ---------- indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .2rem; box-shadow: var(--shadow); }
.kpi-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ---------- graphique mensuel ---------- */
.legend { font-size: .85rem; color: var(--ink-2); display: flex; align-items: center; gap: .35rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: .5rem; }
.dot-in, .bar-in, .rank-bar .in { background: #2e8b57; }
.dot-out, .bar-out, .rank-bar .out { background: #d0654f; }
.chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: .35rem; height: 220px; align-items: end; margin: 1rem 0 .5rem; border-bottom: 1px solid var(--line); }
.chart-col { display: grid; grid-template-rows: 1fr auto; height: 100%; text-decoration: none !important; border-radius: 6px; padding: 0 2px; }
.chart-col:hover { background: var(--surface-2); }
.bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.bar { width: 42%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 0; }
.chart-label { font-size: .72rem; color: var(--muted); text-align: center; padding: .35rem 0; white-space: nowrap; }

.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; font-size: .92rem; }
.rank-bar { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 4px; }

/* ---------- tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .6rem .8rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbf8; }
table.ops td.label-cell { max-width: 420px; word-break: break-word; }
table.ops td.label-cell > a { color: var(--ink); font-weight: 500; }
tr.row-uncat td:first-child { box-shadow: inset 3px 0 0 #e0a43a; }
tr.inactive td { opacity: .55; }
.cat-select { min-width: 210px; font-size: .86rem; padding: .35rem .45rem; }
.cat-select.saving { opacity: .6; }
.cat-select.saved { border-color: var(--pos); box-shadow: 0 0 0 2px var(--ok-soft); }
tr.row-uncat .cat-select { border-color: #e0a43a; background: #fffaf0; }
.att-missing { font-size: .8rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: .15rem .45rem; border-radius: 5px; white-space: nowrap; }
.att-ok { text-decoration: none !important; }
.tag { display: inline-block; font-size: .72rem; padding: .05rem .4rem; border-radius: 4px; background: #eef3f8; color: #23415f; margin-top: .2rem; }
.tag-soft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- détail opération ---------- */
.op-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.op-label { font-size: 1.25rem; word-break: break-word; }
.op-amount { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.files { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.files li > a { display: flex; gap: .7rem; align-items: center; color: var(--ink); min-width: 0; word-break: break-all; }
.file-actions { display: flex; gap: .2rem; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.file-icon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: var(--neg-soft); color: var(--neg); font-weight: 700; font-size: .75rem; border-radius: 6px; }
.dropzone { border: 2px dashed #cfcbbf; border-radius: var(--radius); padding: 1rem; display: grid; gap: .7rem; justify-items: center; text-align: center; background: var(--surface-2); transition: .15s; }
.dropzone.over { border-color: var(--yellow-2); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-label { cursor: pointer; font-weight: 400; color: var(--ink-2); display: block; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.danger-zone { margin-top: .5rem; text-align: right; }
.steps { padding-left: 1.2rem; margin: 0 0 .5rem; display: grid; gap: .35rem; }

/* ---------- activités ---------- */
.new-activity > summary { list-style: none; display: inline-flex; }
.new-activity > summary::-webkit-details-marker { display: none; }
.new-activity[open] > summary { margin-bottom: 1rem; }
.activity-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: .8rem; }
.cat-checks { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem .8rem; margin: 0; display: grid; gap: .35rem; align-content: start; }
.cat-checks legend { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 0 .3rem; }
.cat-checks .check { font-weight: 400; color: var(--ink); }
.activity-solde { display: grid; gap: .1rem; text-align: right; margin-left: auto; }
.card-head + .table-wrap { margin-top: .6rem; }
.activity-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.activity-edit[open] { flex: 1 1 100%; }
.activity-edit > summary { list-style: none; display: inline-flex; }
.activity-edit > summary::-webkit-details-marker { display: none; }
.activity-edit[open] > summary { display: none; }

/* ---------- rapport ---------- */
.report { padding: 2rem 2.25rem; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .9rem; margin-bottom: .5rem; flex-wrap: wrap; }
.report-head h2 { font-size: 1.4rem; margin: 0; }
.report-head p { text-align: right; margin: 0; font-weight: 600; }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.report-table td, .report-table th { padding: .4rem .2rem; background: none; }
.report-table tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.report-table tr.warn-row td { color: var(--warn); font-style: italic; }
.report-result { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 .5rem; padding: .9rem 1.1rem; border-radius: 8px; background: var(--accent-soft); font-size: 1.1rem; }
.report-result.neg { background: var(--neg-soft); }
.report-result strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.report-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.5rem; }
.report-sign div { border-top: 1px solid var(--line); padding-top: .4rem; height: 80px; color: var(--muted); font-size: .85rem; }

/* ---------- connexion ---------- */
.login-page { background: linear-gradient(160deg, var(--black) 0%, var(--black-2) 52%, var(--yellow) 52.1%, var(--yellow) 56%, var(--bg) 56.1%); min-height: 100vh; }
.login-card { max-width: 380px; margin: 7vh auto 0; background: #fff; border-radius: 14px; padding: 2rem; box-shadow: 0 18px 50px rgba(0,0,0,.25); border-top: 6px solid var(--yellow); text-align: center; }
.login-card form { display: grid; gap: .9rem; margin-top: 1.2rem; text-align: left; }
.login-logo { width: 150px; height: auto; display: block; margin: 0 auto .9rem; }
.login-card h1 { font-size: 1.3rem; }
.report-logo { width: 64px; height: auto; display: block; }
.report-brand { display: flex; align-items: center; gap: 1rem; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .grid-2, .report-cols, .rule-grid, .activity-cols { grid-template-columns: 1fr; }
  .nav-burger { display: block; margin-left: auto; font-size: 1.4rem; cursor: pointer; padding: .2rem .5rem; color: #fff; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .topbar { flex-wrap: wrap; }
  .nav-sep { display: none; }
  .usermenu { margin: .3rem 0 0; }
  .usermenu-panel { position: static; margin-top: .4rem; }
  .row-form { flex-wrap: wrap; }
  .sm-only { display: inline; }
  .report { padding: 1.2rem; }
}
@media (max-width: 560px) {
  .container { padding: 1rem .8rem 2rem; }
  .row-2 { grid-template-columns: 1fr; }
  .chart { gap: .1rem; height: 170px; }
  .chart-label { font-size: .6rem; writing-mode: vertical-rl; transform: rotate(180deg); }
  .filters select, .filters input[type=search] { max-width: none; flex: 1 1 45%; }
  .cat-select { min-width: 150px; }
}

/* ---------- impression ---------- */
@media print {
  .topbar, .no-print, .flashes { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .report-result { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
