:root {
  --bg: #f7f4ee; --fg: #2c2c2c; --muted: #6b6b6b; --accent: #1a5c4a; --card: #fff;
  --courant: #1a5c4a; --hors_courant: #8a4f24; --vacances: #2563ab; --fixes: #6b21a8;
  --procession: #9d174d; --travaux: #b45309; --equipement: #0f766e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--fg); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .85rem; }
.view { max-width: 560px; margin: 0 auto; padding: 1rem; padding-bottom: 3rem; }

/* login */
#login { text-align: center; padding-top: 4rem; }
#login form { display: flex; gap: .5rem; justify-content: center; margin: .8rem 0; }
.sep { margin: 1.2rem 0 .4rem; color: var(--muted); font-size: .85rem; }

/* header */
header { display: flex; align-items: center; justify-content: space-between; }
header h1 { font-size: 1.25rem; font-weight: 600; text-transform: capitalize; }
header button { font-size: 1.5rem; background: none; border: none; padding: .3rem .9rem; cursor: pointer; color: var(--accent); }

#offline-banner { background: #fde68a; padding: .4rem .8rem; border-radius: 8px; font-size: .85rem; margin-bottom: .6rem; text-align: center; }

/* cartes résumé */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.card { background: var(--card); border-radius: 10px; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .15rem; box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.card span { font-size: .72rem; color: var(--muted); }
.card strong { font-size: .95rem; }
.card small { font-size: .68rem; color: var(--muted); }
.card.total { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: .8rem; }
.card.total strong { font-size: 1.3rem; }

/* formulaire */
#tx-form { background: var(--card); border-radius: 12px; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
#tx-form .row { display: flex; gap: .5rem; }
#tx-form input { flex: 1; min-width: 0; }
input, button { font: inherit; padding: .55rem .7rem; border: 1px solid #ddd; border-radius: 8px; background: #fff; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.ftoggle { display: flex; align-items: center; gap: .3rem; font-size: .9rem; padding: 0 .4rem; }

/* chips catégories */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .78rem; padding: .3rem .6rem; border-radius: 999px; border: 1.5px solid #ccc; background: #fff; opacity: .75; }
.chip.on { color: #fff; opacity: 1; }
.chip.cat-courant.on { background: var(--courant); border-color: var(--courant); }
.chip.cat-hors_courant.on { background: var(--hors_courant); border-color: var(--hors_courant); }
.chip.cat-vacances.on { background: var(--vacances); border-color: var(--vacances); }
.chip.cat-fixes.on { background: var(--fixes); border-color: var(--fixes); }
.chip.cat-procession.on { background: var(--procession); border-color: var(--procession); }
.chip.cat-travaux.on { background: var(--travaux); border-color: var(--travaux); }
.chip.cat-equipement.on { background: var(--equipement); border-color: var(--equipement); }

/* liste */
#list { margin-top: 1rem; }
#search { width: 100%; margin-bottom: .5rem; }
#tx-list { list-style: none; margin: 0; padding: 0; }
#tx-list li { display: flex; align-items: center; gap: .5rem; background: var(--card); border-radius: 8px; padding: .45rem .6rem; margin-bottom: .3rem; font-size: .88rem; }
#tx-list .d { color: var(--muted); font-variant-numeric: tabular-nums; }
#tx-list .s { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tx-list .s em { color: var(--muted); font-style: normal; font-size: .8rem; }
#tx-list .a { font-variant-numeric: tabular-nums; font-weight: 600; }
#tx-list .del { border: none; background: none; color: #c00; font-size: 1rem; padding: 0 .2rem; }
.fmark { color: var(--accent); }
.badge { font-size: .65rem; padding: .1rem .4rem; border-radius: 999px; color: #fff; }
.badge.cat-courant { background: var(--courant); } .badge.cat-hors_courant { background: var(--hors_courant); }
.badge.cat-vacances { background: var(--vacances); } .badge.cat-fixes { background: var(--fixes); }
.badge.cat-procession { background: var(--procession); } .badge.cat-travaux { background: var(--travaux); }
.badge.cat-equipement { background: var(--equipement); }

footer { display: flex; justify-content: space-between; margin-top: 1.5rem; font-size: .85rem; }
footer a { color: var(--accent); }
