/* Design tokens from the validated mockups ("nature sobre"). */
:root {
    --bg: #F4F2EB;
    --surface: #FBFAF6;
    --surface-alt: #F7F5EF;
    --white: #FFFFFF;
    --ink: #1E231E;
    --ink-2: #3D433B;
    --muted: #6B7166;
    --faint: #8A8F84;
    --line: #E6E2D6;
    --border: #D6D2C4;
    --card-border: #E0DCCF;
    --forest: #2E5A3E;
    --forest-dark: #22442F;
    --forest-tint: #E3EBE1;
    --forest-soft: #EEF3EC;
    --sidebar: #213629;
    --sidebar-2: #2A4333;
    --sidebar-on: #2F4A38;
    --sidebar-text: #C9D3C4;
    --sidebar-muted: #93A38E;
    --warn: #7A5419;
    --warn-tint: #F3E8D2;
    --warn-bar: #C99A4E;
    --bad: #8E3A2B;
    --bad-tint: #F4E1DA;
    --bad-bar: #B9624E;
    --bad-border: #E2C4BA;
    --neutral-tint: #ECE9E0;
    --neutral: #505649;
    --badge: #B7793A;
    --font-body: 'Public Sans', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Bitter', Georgia, serif;
    --radius: 8px;
    --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--forest); text-decoration: none; }
a:hover { color: var(--forest-dark); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 18px; }
p { margin: 0; text-wrap: pretty; }
svg { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shells ---------- */

.shell-bureau { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; flex-shrink: 0; background: var(--sidebar); color: #DCE4D6;
    display: flex; flex-direction: column; gap: 24px; padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 4px 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #F2F4EE; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; }
.brand-mark svg { display: block; }
.brand--dark { color: var(--ink); }
.society-switch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sidebar-2); color: #F2F4EE; }
.society-switch small { display: block; font-size: 12px; color: var(--sidebar-muted); }
.society-switch strong { font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: var(--sidebar-2); color: #F4F6F0; }
.nav a[aria-current="page"] { background: var(--sidebar-on); color: #F4F6F0; }
.nav a span:first-of-type { flex-grow: 1; }
/* Pages of the open section, listed under it. */
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 8px; padding-left: 12px; margin-left: 21px; border-left: 1px solid var(--sidebar-on); }
.nav-sub a { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 6px; color: var(--sidebar-muted); font-size: 13.5px; font-weight: 500; }
.nav-sub a:hover { background: var(--sidebar-2); color: #F4F6F0; }
.nav-sub a[aria-current="page"] { background: var(--sidebar-on); color: #F4F6F0; font-weight: 600; }
.chip-sub { background: transparent; border-style: dashed; }
.chip-sub[aria-current="true"] { border-style: solid; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #FFF; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--sidebar-on); color: #F2F4EE; }
.sidebar-user small { display: block; font-size: 12px; color: var(--sidebar-muted); }
.sidebar-user strong { font-size: 13px; }
.sidebar .spacer { flex-grow: 1; }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; padding: 32px 40px 48px; }
.main--narrow { max-width: 820px; }

.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 40px; background: var(--sidebar); }
.topbar a { color: #DCE4D6; font-weight: 600; }
.topbar nav { display: flex; gap: 24px; align-items: center; }

.shell-app { min-height: 100vh; display: flex; flex-direction: column; }
.shell-app .content { width: 100%; max-width: 620px; margin: 0 auto; padding: 32px 20px 120px; display: flex; flex-direction: column; gap: 20px; }
.shell-public .content { width: 100%; max-width: 1040px; margin: 0 auto; padding: 48px 24px; }

.tabbar { display: none; }

/* Bureau pages on small screens: sidebar becomes a header, members get the app tab bar. */
.mobile-header { display: none; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main { padding: 20px 20px 120px; gap: 18px; }
    .mobile-header { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 0; background: var(--bg); }
    .mobile-header .subnav { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .filters .divider { display: none; }
    .filters .search { width: 100%; }
    .topbar { padding: 0 20px; }
    .topbar nav .hide-sm { display: none; }
    .shell-app .content { padding-top: 20px; }
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
        justify-content: space-around; align-items: flex-start; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        background: var(--surface); border-top: 1px solid var(--card-border);
    }
    .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; min-height: 48px; font-size: 11px; font-weight: 600; color: var(--muted); }
    .tabbar a[aria-current="page"] { color: var(--forest); }
    .tabbar .count { position: absolute; top: -4px; left: 56px; }
    .app-desktop-nav { display: none !important; }
}

/* Hotwire Native apps: the native shell provides title bar, back button and tab bar. */
[data-native] .topbar,
[data-native] .tabbar,
[data-native] .nav-back { display: none !important; }
[data-native] .shell-app .content,
[data-native] .main { padding-bottom: 32px; }
[data-native] .mobile-header { padding-top: 12px; }
/* Modal forms: the native bar holds the submit button and the "Done" button replaces "Annuler". */
[data-bridge-components~="form"] [data-bridge--form-target="submit"],
[data-native] form[data-controller~="bridge--form"] .form-actions .btn-secondary { display: none; }
[data-bridge-components~="form"] form[data-controller~="bridge--form"] .form-actions { display: none; }

/* ---------- Page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; font-size: 14px; color: var(--forest); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 24px; border-bottom: 1px solid #DEDACD; }
.tabs a { padding: 10px 2px; color: var(--muted); font-weight: 500; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--forest); }
.tabs a span { color: var(--muted); font-weight: 500; }

/* ---------- Components ---------- */

.card { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-lg); }
.card-pad { padding: 18px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head .title { display: flex; align-items: center; gap: 10px; color: var(--forest); }
.card-head .title h2 { color: var(--ink); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv .v.empty { color: var(--faint); font-weight: 500; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--forest-tint); color: var(--forest); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.bad { background: var(--bad-tint); color: var(--bad); }
.badge.mut { background: var(--neutral-tint); color: var(--neutral); }
.badge.strong { background: var(--forest); color: #F4F6F0; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: #DCE5D8; color: var(--forest); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar.grey { background: var(--neutral-tint); color: var(--neutral); }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

.sub { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); font: 600 15px var(--font-body); border: 1px solid transparent; cursor: pointer; text-align: center; }
.btn-primary { background: var(--forest); color: #F4F6F0; }
.btn-primary:hover { background: var(--forest-dark); color: #F4F6F0; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--white); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--bad-border); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 44px; font: 600 14px var(--font-body); color: var(--forest); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
form.inline { display: inline; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip[aria-current="true"] { background: var(--forest); border-color: var(--forest); color: #F4F6F0; }
@media (max-width: 900px) { .chip { min-height: 44px; } }

.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters .divider { width: 1px; height: 24px; background: #DEDACD; }
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; width: 280px; max-width: 100%; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--faint); }
.search input { border: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; outline: none; }

.progress { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--line); }
.progress span { display: block; height: 100%; }

.stat { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }

.notice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); font-size: 14px; }
.notice.warn { background: var(--warn-tint); color: #5E4214; }
.notice.ok { background: var(--forest-tint); color: var(--forest); font-weight: 600; }
.notice.bad { background: var(--bad-tint); color: var(--bad); }
.notice.info { background: var(--forest-soft); color: var(--ink-2); }
.notice > div { flex-grow: 1; }

.flashes { display: flex; flex-direction: column; gap: 10px; }

.empty-state { padding: 32px 22px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- Tables (member list, seasons, requests) ---------- */

.table { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-lg); overflow: hidden; }
.table .tr { display: grid; gap: 16px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); color: inherit; }
.table .tr:first-child { border-top: 0; }
.table .tr.head { background: var(--surface-alt); }
.table a.tr:hover { background: #F6F3EA; }
.table .person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .person strong { display: block; }
.members-table .tr { grid-template-columns: 2.1fr 1fr 1.2fr 1.2fr 1.4fr 1.5fr 24px; }
.hide-lg { display: none; }
@media (max-width: 1100px) {
    .hide-lg { display: inline; }
    .members-table .tr.head { display: none; }
    .members-table .tr { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
    .members-table .tr > .hide-md { display: none; }
}

.list-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; }
.list-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list-row .icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.list-row .icon.bad { background: var(--bad-tint); color: var(--bad); }
.list-row .icon.warn { background: var(--warn-tint); color: var(--warn); }

.society-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; color: inherit; }
.society-card:hover { border-color: var(--border); color: inherit; }
.society-card .name { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.society-card footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.money-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.money-tiles div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius); }
.money-tiles strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.money-tiles .warn { background: var(--warn-tint); color: var(--warn); }
.money-tiles .warn .sub { color: var(--warn); }
@media (max-width: 640px) { .money-tiles { gap: 8px; } .money-tiles div { padding: 10px; } .money-tiles strong { font-size: 17px; } }

.steps { display: flex; flex-direction: column; gap: 20px; }
.steps li { display: flex; gap: 14px; color: var(--ink-2); }
.steps li::before { counter-increment: step; content: counter(step); width: 28px; height: 28px; border-radius: 50%; background: #DCE5D8; color: var(--forest); font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 28px; }
.form-card { padding: 28px; max-width: 720px; }
.form section { display: flex; flex-direction: column; gap: 16px; }
.form section > header { display: flex; flex-direction: column; gap: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-card { padding: 20px; } }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; }
.field .optional { font-weight: 400; color: var(--muted); }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="password"],
.field input[type="date"], .field input[type="number"], .field select, .money-input {
    width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--white); color: var(--ink); font: 15px var(--font-body);
}
.field input:focus, .field select:focus, .money-input:focus-within { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px #DCE5D8; }
.money-input { display: flex; align-items: center; gap: 8px; }
.money-input input { border: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 42px; }
.field-help { font-size: 12px; color: var(--muted); }
.field-errors { list-style: none; margin: 0; padding: 0; color: var(--bad); font-size: 13px; font-weight: 600; }
.field.has-error input, .field.has-error select { border-color: var(--bad); }
.form-errors { list-style: none; margin: 0; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--bad-tint); color: var(--bad); font-weight: 600; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.choice-card { display: flex; gap: 12px; align-items: center; padding: 14px; min-height: 52px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); cursor: pointer; font-weight: 600; }
.choice-card:has(input:checked) { border: 1.5px solid var(--forest); background: var(--forest-soft); }
.choice-card input { accent-color: var(--forest); width: 18px; height: 18px; margin: 0; }

.segmented { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 10px; background: #E9E6DC; }
.segmented label { min-height: 44px; display: grid; place-items: center; font-weight: 600; color: var(--neutral); border-radius: 7px; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(30, 35, 30, .12); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.checkbox-card { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--forest-soft); align-items: flex-start; cursor: pointer; }
.checkbox-card input { accent-color: var(--forest); width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; }
.checkbox-card strong { display: block; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 64px; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row:first-child { border-top: 0; }
.switch-row .grow { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--border); position: relative; cursor: pointer; flex-shrink: 0; margin: 0; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #FFF; box-shadow: 0 1px 3px rgba(30, 35, 30, .25); transition: transform .15s; }
.switch:checked { background: var(--forest); }
.switch:checked::after { transform: translateX(20px); }

.autocomplete { position: relative; }
.autocomplete-results { list-style: none; margin: 4px 0 0; padding: 6px; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px rgba(30, 35, 30, .14); position: absolute; left: 0; right: 0; z-index: 5; }
.autocomplete-results li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; cursor: pointer; }
.autocomplete-results li[aria-selected="true"], .autocomplete-results li:hover { background: var(--forest-soft); }
.autocomplete-results small { display: block; font-size: 12px; color: var(--muted); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.divider-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; }
.divider-or::before, .divider-or::after { content: ''; flex-grow: 1; height: 1px; background: #DEDACD; }

.choice-cards.compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.choice-cards.compact .choice-card { padding: 10px 12px; min-height: 48px; font-size: 14px; }

.amount-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.amount-hero .money-input { max-width: 240px; justify-content: center; font-family: var(--font-display); font-size: 40px; min-height: 72px; }
.amount-hero .money-input input { font-family: var(--font-display); font-size: 40px; text-align: right; }

/* ---------- Finances ---------- */

.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs a { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-in { color: var(--forest); }
.amount-bad { color: var(--bad); }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-4 { gap: 10px; } .grid-4 .card-pad { padding: 14px; } .grid-4 .stat { font-size: 22px; } }
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-card .stat { font-size: 30px; }

.year-select select { min-height: 44px; padding: 0 36px 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 500 15px var(--font-body); }
.inline-select { min-height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 500 13px var(--font-body); max-width: 220px; }
@media (max-width: 900px) { .inline-select { min-height: 44px; } }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.bar-row strong { color: var(--ink); text-align: right; min-width: 88px; }
.bar-track { height: 10px; background: var(--neutral-tint); border-radius: 0 5px 5px 0; }
.bar-fill { display: block; height: 100%; min-width: 2px; background: var(--forest); border-radius: 0 4px 4px 0; }
@media (max-width: 640px) { .bar-row { grid-template-columns: minmax(0, 1fr) auto; } .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; } }

.entry-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--neutral-tint); color: var(--neutral); }
.entry-icon.in { background: var(--forest-tint); color: var(--forest); }
.tag.auto { background: var(--forest-soft); border-color: #D3DFD0; color: var(--forest); gap: 4px; }

.entries-table .tr { grid-template-columns: 92px minmax(0, 2.3fr) minmax(0, 1.3fr) minmax(0, 1.2fr) 60px 110px 120px; }
.entries-table .entry-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entries-table .entry-main a { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entries-table .amount { text-align: right; font-weight: 700; }
.entries-table .stack-sm { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.table .tr.foot { background: var(--surface-alt); display: flex; justify-content: space-between; flex-wrap: wrap; font-size: 13px; }
@media (max-width: 1100px) {
    .entries-table .tr.head { display: none; }
    .entries-table .tr:not(.foot) { grid-template-columns: minmax(0, 1fr) 44px auto; gap: 4px 10px; padding: 10px 16px; }
    .entries-table .tr > .hide-md { display: none; }
}

.check-toggle { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; padding: 0; cursor: pointer; margin: -8px auto; }
.check-toggle span { width: 22px; height: 22px; border-radius: 5px; border: 1.5px solid var(--border); background: var(--white); display: grid; place-items: center; color: #F4F6F0; }
.check-toggle[aria-pressed="true"] span { background: var(--forest); border-color: var(--forest); }
.check-toggle:disabled { cursor: default; opacity: .6; }

.years-table .tr { grid-template-columns: 70px repeat(5, minmax(0, 1fr)) 180px minmax(0, 1.3fr); }
.years-table .tr > .r { text-align: right; }
@media (max-width: 1200px) {
    .years-table .tr.head { display: none; }
    .years-table .tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
    .years-table .tr > .r { text-align: left; }
    .years-table .tr > [data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
}

/* First steps of a society that just opened its space. */
.setup-card { border-color: var(--border); box-shadow: 0 1px 2px rgba(30, 35, 30, .04); }
ol.setup-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.setup-steps li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.setup-steps li:first-child { border-top: 0; }
.setup-steps li.is-done strong { color: var(--muted); font-weight: 600; }
.setup-steps li.is-done .sub { color: var(--faint); }
.setup-steps .grow { flex-grow: 1; min-width: 0; }
.setup-steps .dot-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
@media (max-width: 640px) {
    .setup-steps li { flex-wrap: wrap; }
    .setup-steps li .btn { width: 100%; }
}

.checklist { display: flex; flex-direction: column; }
.checklist li { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); }
.checklist .dot-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.checklist .dot-icon.ok { background: var(--forest-tint); color: var(--forest); }
.checklist .dot-icon.warn { background: var(--warn-tint); color: var(--warn); }
.checklist span.grow { flex-grow: 1; }
ul.checklist { list-style: none; margin: 0; padding: 0; }

.log-day { padding: 18px 0 6px; }
.log-row { display: grid; grid-template-columns: 48px 36px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.log-row .when { padding-top: 8px; font-size: 13px; }
.log-row .what { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 2px; }
@media (max-width: 640px) { .log-row { grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; } .log-row .when { display: none; } .log-row .badge { grid-column: 2; justify-self: start; } }
.diff { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-alt); font-size: 13px; }
.diff div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.diff .k { color: var(--muted); }
.diff s { color: var(--faint); }

.receipt-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--card-border); border-radius: 10px; background: var(--white); }
.receipt-row .file-badge { width: 40px; height: 40px; border-radius: 8px; background: var(--bad-tint); color: var(--bad); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.receipt-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.field input[type="file"] { min-height: 64px; padding: 16px; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--white); font: 14px var(--font-body); color: var(--muted); width: 100%; }
.field input[type="file"]::file-selector-button { margin-right: 12px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: 600 13px var(--font-body); color: var(--ink); cursor: pointer; }
