/* Font of the association's name on the main site (#logo-name), copied from www.aef-ppb.ch/css/fonts (OFL) */
@font-face {
  font-family: 'MerriweatherBold';
  src: url('fonts/merriweather-bold-webfont.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
:root {
  --green: #3f7d3a;
  --green-dark: #2f5f2b;
  --beige: #f6f2e7;
  --line: #ddd6c4;
  --text: #222;
  --muted: #6b6558;
  --red: #b3261e;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--beige); }
a { color: var(--green-dark); }
h1 { font-size: 1.35rem; margin: 0 0 .7rem; }
h2 { font-size: 1.1rem; margin: 1.3rem 0 .5rem; }
.muted { color: var(--muted); font-size: .9em; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .35rem 1rem; background: var(--green); color: #fff; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.brand img { width: 32px; height: 32px; border-radius: 50%; background: #fff; object-fit: cover; }
.mainnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.mainnav a { padding: .3rem .7rem; border-radius: 6px; }
.mainnav a:hover, .mainnav a.active { background: rgba(255, 255, 255, .18); }
.who small { opacity: .8; margin-left: .3rem; }
.logout svg { width: 22px; height: 22px; display: block; }
main { max-width: 1300px; margin: 0 auto; padding: .9rem .8rem 2rem; }

/* Blocks */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.flash { padding: .5rem .8rem; border-radius: 6px; margin-bottom: .7rem; }
.flash-ok { background: #e6f2e3; color: var(--green-dark); }
.flash-error { background: #fbe4e2; color: var(--red); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; color: var(--muted); }
.tile b { display: block; font-size: 1.8rem; color: var(--text); line-height: 1.1; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .35rem .55rem; border-bottom: 1px solid var(--line); }
table.list th { background: #efe9da; font-weight: 600; font-size: .9em; }
table.list tr:last-child td { border-bottom: 0; }

/* Forms */
label { display: block; margin-bottom: .6rem; font-weight: 500; }
input[type=email], input[type=text], input:not([type]) { display: block; width: 100%; margin-top: .25rem; padding: .45rem .55rem; font: inherit; border: 1px solid #c8c0ad; border-radius: 6px; background: #fff; }
input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.btn { display: inline-block; padding: .45rem 1rem; font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--green-dark); }

/* Login */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.login { width: 100%; max-width: 360px; text-align: center; }
.login label { text-align: left; }
.login-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.login h1 { margin: .5rem 0 1.2rem; }
input.code { font-size: 1.6rem; letter-spacing: .35em; text-align: center; }

a.tile { text-decoration: none; }
a.tile:hover { border-color: var(--green); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
.btn.danger { color: var(--red); border-color: #e3b3ae; }
.btn.small { padding: .2rem .6rem; font-size: .88em; text-decoration: none; color: var(--text); }
.btn.small.danger { color: var(--red); }
form.inline { display: inline; margin: 0; }
tr.inactive td { color: #888; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: #efe9da; font-size: .85em; }
.badge.ok { background: #e6f2e3; color: var(--green-dark); }
.badge.warn { background: #fdd789; color: #000; }
.badge.danger { background: #faafa9; color: var(--red); font-weight: bold }
.page-title { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.page-title h1 { margin: 0; flex: 1; }
.actions { display: flex; gap: .5rem; }
.actions form { margin: 0; }
.status { margin: .4rem 0 1rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid2 .card h2:first-child { margin-top: 0; }
.notes-full { white-space: normal; }
.table-scroll { overflow-x: auto; }
table.narrow { width: auto; min-width: 50%; }
table.history td { vertical-align: top; }

/* Members list: sticky header row and name column while scrolling */
.members-bar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.members-bar input[type=search] { flex: 1; min-width: 240px; margin: 0; padding: .45rem .6rem; font: inherit; border: 1px solid #c8c0ad; border-radius: 6px; }
.members-bar form { margin: 0; }
label.inline { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: normal; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font: inherit; font-size: .88em; padding: .25rem .6rem; border: 1px solid #c8c0ad; border-radius: 999px; background: #fff; cursor: pointer; }
.chip .n { color: var(--muted); font-size: .9em; }
.chip.special { background: #f3eee0; }
.chip[data-state=in], .chip-demo.in { background: var(--green); border-color: var(--green); color: #fff; }
.chip[data-state=out], .chip-demo.out { background: #fbe4e2; border-color: #e3b3ae; color: var(--red); text-decoration: line-through; }
.chip[data-state] .n { color: inherit; }
.chip.reset { border-style: dashed; }
.chip-demo { padding: 0 .4rem; border-radius: 999px; }
.legend { padding: 0 .4rem; border-radius: 4px; border: 1px solid var(--line); }
.legend.debtor { background: #ffd0b9; }
.legend.deleted { background: #f2f2f2; color: #888; }
.hint { margin: .4rem 0 .6rem; }
.hint[hidden] { display: none; }
.hint-toggle { width: 1.9rem; padding-left: 0; padding-right: 0; border-radius: 50%; font-weight: 700; }
.hint-toggle.on { background: #efe9da; }
.table-wrap { overflow: auto; max-height: calc(100vh - 200px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.members { border: 0; border-radius: 0; overflow: visible; border-collapse: separate; border-spacing: 0; font-size: .9em; }
table.members th, table.members td { white-space: nowrap; padding: .3rem .5rem; }
table.members thead th { position: sticky; top: 0; z-index: 2; }
table.members .name { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line); }
table.members thead th.name { z-index: 3; background: #efe9da; }
table.members.compact .x { display: none; }
/* Household as figures (woman, man, unknown, child): same type close together, a gap only between adults and children */
.sprites { position: absolute; }
table.members td.c { padding-left: .2rem; padding-right: .2rem; }
.figs { display: inline-flex; align-items: flex-end; padding: 0 .15em; border-radius: 4px; }   /* adults - children: the figures' own margins */
.figs .adults, .figs .kids { display: inline-flex; align-items: flex-end; }
.figs .fig + .fig { margin-left: -.3em; }
.figs .kids .fig + .fig { margin-left: -.25em; }
.figs.issue { background: #fbe4e2; box-shadow: 0 0 0 1px #e3b3ae; }
.fig { width: .8em; height: 1em; }
.fig-f { fill: #c2185b; }
.fig-m { fill: #1565c0; }
.fig-u { fill: #888; }
.fig-k { fill: #2e7d32; width: .7em; }
/* Row of the household just visited, when coming back to the list */
table.members tbody td { transition: background-color 1.5s; }
table.members tr.visited td { background: #fff7c2 !important; }
table.members tr.debtor td { background: #ffd0b9; }
table.members tr.deleted td { background: #f2f2f2; color: #888; }
table.members td.notes { max-width: 22em; overflow: hidden; text-overflow: ellipsis; }
/* Widths from the Paramètres page (--name-w, --street-w, --email-w on the table), longer text cut with … */
table.members .cut { display: block; overflow: hidden; text-overflow: ellipsis; }
table.members td.name .cut { max-width: var(--name-w, none); }
table.members td.street .cut { max-width: var(--street-w, none); }
table.members td.email .cut { max-width: var(--email-w, none); }
.number-unit { display: flex; align-items: center; gap: .5rem; width: 9rem; font-weight: normal; }
.number-unit input { flex: 1; min-width: 0; margin-top: .25rem; padding: .45rem .55rem; font: inherit; border: 1px solid #c8c0ad; border-radius: 6px; }
/* Groups: icon of the site's menu (white circle, readable on a green chip), or the letter */
.tag-icon { width: 1.45em; height: 1.45em; vertical-align: middle; border-radius: 50%; background: #fff; border: 1px solid #c8c0ad; }
.tag-letter { display: inline-block; min-width: 1.45em; height: 1.45em; line-height: 1.35em; padding: 0 .25rem; border: 1px solid #c8c0ad; border-radius: 999px;
  font-size: .8em; font-weight: 600; text-align: center; vertical-align: middle; background: #f3eee0; color: var(--text); }
.chip .tag-letter { font-size: .85em; }
.letters .tag-icon, .letters .tag-letter { margin-right: 2px; }
td.letters .tag-icon { width: 1.35em; height: 1.35em; }
.letters.big { line-height: 2; }

/* Edit form */
form.edit .card { margin-bottom: 1rem; }
form.edit .card h2 { margin-top: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 1rem; }
.fields .wide { grid-column: span 2; }
.fields .full { grid-column: 1 / -1; }
.fields select, .fields textarea, .fields input { display: block; width: 100%; margin-top: .25rem; padding: .45rem .55rem; font: inherit; border: 1px solid #c8c0ad; border-radius: 6px; background: #fff; }
.check-under { display: flex; align-items: center; gap: .3rem; margin-top: .25rem; font-weight: normal; font-size: .9em; }
.fields .check-under input { display: inline; width: auto; margin: 0; }
.person-tag-boxes { margin: 0 0 .6rem; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); }
td.person-tags { line-height: 1.7; white-space: nowrap; }
input.journal-no { display: inline-block; width: 8rem; margin: 0 .6rem 0 -.8rem; padding: .2rem .4rem; font: inherit; font-size: .9em; border: 1px solid #c8c0ad; border-radius: 6px; }
.exempt { color: var(--green-dark); font-style: italic; }
.plain-list { margin: .4rem 0; padding-left: 1.2rem; columns: 2 260px; }
.tag-boxes { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.remove { color: var(--red); }
/* Paramètres: one block per option, grouped options side by side */
.setting { margin-bottom: 1rem; }
.setting:last-child { margin-bottom: 0; }
.setting-title { font-weight: 500; margin-bottom: .2rem; }
.setting-row { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.setting-row label { font-weight: normal; }
.settings select { display: block; margin-top: .25rem; padding: .45rem .55rem; font: inherit; border: 1px solid #c8c0ad; border-radius: 6px; background: #fff; }
.setting-help { margin: -.3rem 0 0; }
.form-buttons { display: flex; justify-content: flex-end; gap: .6rem; }
.form-buttons .btn.primary { width: auto; }

/* Members' page (membres.aef-ppb.ch): one narrow column, the card first */
body.member main { max-width: 480px; }
.preview-banner { padding: .35rem 1rem; background: #fdf0d5; color: #7a5400; font-size: .9em; text-align: center; }
.center { text-align: center; }
.member .card { margin-bottom: .8rem; }
.member .card h2 { margin-top: 0; }
.member .login { margin: 1.5rem auto; }
.btn.choice { display: block; width: 100%; margin-bottom: .5rem; text-align: left; }
.member-card { position: relative; margin: .4rem 0 .6rem; padding: 1rem 1.1rem; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, var(--green) 0%, #5d9c4f 60%, #8cb860 100%); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.site-name { font-family: 'MerriweatherBold', serif; font-weight: normal; }
.brand img.logo { width: auto; height: 30px; border-radius: 0; background: none; }
.mc-head { display: flex; align-items: center; gap: .7rem; font-size: .85rem; line-height: 1.3; }
.mc-head img { width: auto; height: 32px; }
.mc-head small { font-size: .85em; }
.mc-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .4rem; }
.mc-row .mc-status { margin-top: 0; }
.mc-title { margin: .8rem 0 .3rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.mc-names { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.mc-num { margin-top: .2rem; font-size: 1rem; opacity: .9; }
.mc-status { display: inline-block; margin-top: .6rem; padding: .2rem .7rem; border-radius: 999px; font-weight: 600; font-size: .9rem; background: #fff; }
.mc-status.ok { color: var(--green-dark); }
.mc-status.due { color: #fff; background: #ff3c3c; border: 2px solid yellow; }
.mc-status.bad { color: var(--red); background: #fbe4e2; }
.mc-qr { margin-top: .9rem; text-align: center; }
.mc-qr svg { width: 190px; height: 190px; padding: 6px; background: #fff; border-radius: 8px; }
.pay .btn.primary { text-align: center; text-decoration: none; }
img.slip { width: 100%; height: auto; border: 1px solid var(--line); }
.site-link { margin-top: 1.2rem; font-family: 'MerriweatherBold', serif; }

@media (max-width: 600px) {
  .fields .wide { grid-column: auto; }
  .who { display: none; }
  table.list:not(.members) th:nth-child(3), table.list:not(.members) td:nth-child(3) { display: none; }
  /* On a phone, a fixed Nom column would take most of the screen: it scrolls with the others */
  table.members .name { left: auto; box-shadow: none; }
}
