:root {
    --green: #1d4a32;
    --green-dark: #143626;
    --line: #d7e0d8;
    --paper: #eef2ef;
    --card: #ffffff;
    --text: #1c241e;
    --muted: #5c6b60;
    --danger: #8d2b2b;
}

* { box-sizing: border-box; }

html,
body {
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--paper);
}

.top {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--green);
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 650;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.top nav {
    display: flex;
    gap: 0.9rem;
}

.top a {
    color: #fff;
    text-decoration: none;
}

.top a:hover { text-decoration: underline; }

main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.flash {
    flex: 0 0 auto;
    margin: 0;
    background: #e7f3ea;
    padding: 0.55rem 1rem;
}

.devbar {
    flex: 0 0 auto;
    margin: 0;
    background: #f3e2b8;
    color: #3d3114;
    padding: 0.55rem 1rem;
    font-weight: 650;
}

.stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 1.2rem 0 2rem;
    max-width: 40rem;
}

.screen,
.split {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.screen {
    overflow: auto;
    padding: 1rem 1.1rem 1.5rem;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
    overflow: hidden;
}

.split.groups-layout {
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
}

.members-page {
    background: var(--card);
}

.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.2rem 0 0.6rem;
}

.list-head h1 {
    margin: 0;
}

.list-head .button {
    margin-top: 0;
}

.member-sheet-wrap {
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--line);
}

.member-sheet {
    display: grid;
    grid-template-columns: minmax(16rem, 1.15fr) minmax(16rem, 1fr) minmax(18rem, 1.2fr);
    gap: 0.15rem 1.6rem;
    align-items: start;
}

.member-sheet h2 {
    margin: 0.1rem 0 0.15rem;
}

.member-sheet label {
    margin: 0.4rem 0 0.15rem;
}

.member-sheet .check {
    margin-top: 0.35rem;
}

.member-sheet .hint {
    font-size: 0.85rem;
    margin: 0.15rem 0 0.35rem;
}

.member-sheet input[type="text"],
.member-sheet input[type="email"],
.member-sheet select {
    width: 100%;
    max-width: 100%;
}

.member-sheet input[type="date"] {
    width: 11.5rem;
}

.member-sheet input[name="house_number"],
.member-sheet input[name="postal_code"] {
    width: 100%;
    max-width: 8rem;
}

.member-actions,
.member-bank {
    grid-column: 1 / -1;
}

.bank-line {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 0.7fr 1fr;
    gap: 0.2rem 1rem;
    align-items: end;
}

.member-sheet .bank-line input,
.member-sheet .bank-line input[name="bic"] {
    width: 100%;
    max-width: 100%;
}

.member-sheet .sepa-preview {
    max-height: 6rem;
}

@media (max-width: 1100px) {
    .member-sheet,
    .bank-line {
        grid-template-columns: 1fr;
    }
}

.pane {
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.1rem 1.5rem;
    background: var(--card);
}

.pane + .pane {
    border-left: 1px solid var(--line);
}

h1 {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.hint {
    color: var(--muted);
    margin-top: 0;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    align-content: start;
}

.tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 9rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    background: var(--card);
    color: inherit;
    text-decoration: none;
}

.tile strong {
    font-size: 1.15rem;
}

.tile span {
    color: var(--muted);
}

.tile:hover {
    background: #f7faf8;
}

.rights {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.25rem 1.5rem;
    margin-top: 1.2rem;
    align-content: start;
}

.rights h2 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.rights .check {
    margin-top: 0.35rem;
    font-weight: 500;
}

label {
    display: block;
    margin: 0.85rem 0 0.3rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
select {
    display: block;
    width: 32ch;
    max-width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #b7c4ba;
    border-radius: 0;
    font: inherit;
    background: #fff;
}

input[type="date"] {
    width: 12rem;
}

input[type="number"] {
    width: 6rem;
}

textarea {
    display: block;
    width: 40rem;
    max-width: 100%;
    min-height: 4.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #b7c4ba;
    border-radius: 0;
    font: inherit;
}

input[name="house_number"],
input[name="postal_code"] {
    width: 8rem;
}

input[name="phone"],
input[name="phone_mobile"] {
    width: 16rem;
}

select[name="partner_member_id"],
select[name="admission_member_id"] {
    width: 28rem;
}

.pair {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.2rem;
    align-items: flex-end;
}

input[name="first_name"],
input[name="last_name"],
input[name="city"] {
    width: 16rem;
}

input[name="street"] {
    width: 20rem;
}

input[name="account_holder"],
input[name="bank_name"],
input[name="iban"] {
    width: 28rem;
}

input[name="bic"] {
    width: 12rem;
}

input[name="transfer_annual_year"] {
    width: 8ch;
}

fieldset.plain {
    border: 0;
    margin: 0;
    padding: 0;
    min-inline-size: 0;
}

fieldset.plain:disabled {
    opacity: 0.55;
}

input[type="file"] {
    display: block;
    max-width: 100%;
}

.list-alert,
.sepa-missing {
    color: var(--danger);
    font-weight: 650;
}

.sepa-preview {
    display: block;
    max-width: 100%;
    max-height: 18rem;
    margin-top: 0.6rem;
    border: 1px solid var(--line);
}

input[name="display_name"],
input[name="name"],
input[type="email"] {
    width: 48ch;
    max-width: 100%;
}

.pane h2 {
    margin: 1rem 0 0.3rem;
    font-size: 1rem;
}

.screen h3 {
    margin: 1.25rem 0 0.2rem;
    padding-top: 0.55rem;
    border-top: 2px solid var(--line);
    font-size: 1rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.9rem;
    font-weight: 600;
}

button,
.button {
    display: inline-block;
    margin-top: 1rem;
    margin-right: 0.4rem;
    background: var(--green);
    color: #fff;
    border: 0;
    border-radius: 0;
    padding: 0.55rem 0.95rem;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover { background: var(--green-dark); }

.error {
    background: #fdecec;
    color: var(--danger);
    padding: 0.6rem 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.45rem 0.35rem;
    border-bottom: 1px solid var(--line);
}

th { font-size: 0.85rem; color: var(--muted); }

td.num,
th.num { text-align: right; font-variant-numeric: tabular-nums; }

.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    margin: 0 0 1rem;
}

.figure {
    border: 1px solid var(--line);
    background: var(--card);
    padding: 0.8rem 1rem;
}

.figure b {
    display: block;
    font-size: 1.25rem;
    font-weight: 650;
}

.figure span {
    color: var(--muted);
    font-size: 0.9rem;
}

.actions { white-space: nowrap; }

.actions form {
    display: inline;
}

.actions button {
    margin-top: 0;
}

.actions .exit-open {
    margin-left: 0.35rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
}

.exit-dialog {
    border: 1px solid var(--line);
    padding: 1.1rem 1.2rem;
    max-width: 24rem;
}

.exit-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.exit-dialog h2 {
    margin: 0 0 0.35rem;
}

.exit-dialog form > div {
    margin-top: 0.85rem;
}

.exit-dialog button {
    margin-top: 0;
    margin-right: 0.35rem;
}

table.rules {
    table-layout: fixed;
}

table.rules .col-nr {
    width: 2.2rem;
}

table.rules .col-actions {
    width: 14rem;
}

td.rule-actions {
    vertical-align: middle;
}

.rule-line {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.rule-move {
    display: flex;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.rule-move form {
    margin: 0;
}

.rule-move button {
    width: 2.1rem;
    margin: 0;
    padding: 0.25rem 0;
    text-align: center;
}

.rule-arrow-gap {
    display: inline-block;
    width: 2.1rem;
}

.rule-text {
    flex: 1;
    min-width: 0;
}

.rule-actions {
    display: grid;
    grid-template-columns: repeat(2, 6.2rem);
    gap: 0.35rem;
    align-items: center;
}

.rule-actions form {
    margin: 0;
}

.rule-actions .button,
.rule-actions button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.3rem;
    text-align: center;
    box-sizing: border-box;
}

.choice {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.35rem 0 0.8rem;
}

.choice label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.choice .check {
    margin-top: 0;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.2rem 1.2rem;
}

.status-row .check {
    min-width: 14rem;
    margin-bottom: 0.35rem;
}

.status-row input[type="date"] {
    width: 12rem;
}

.period-bar,
.sicht-switch,
.pay-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
    margin: 0.3rem 0 0.8rem;
}

.period-bar strong {
    min-width: 12rem;
    text-align: center;
}

.period-bar .button,
.sicht-switch .button,
.pay-filter .button {
    margin-top: 0;
}

.sicht-switch .button {
    background: #fff;
    color: var(--green);
    border: 1px solid var(--green);
}

.sicht-switch .button.on {
    background: var(--green);
    color: #fff;
}

.pay-filter select {
    width: auto;
    min-width: 16rem;
}

.pay-filter label {
    margin: 0;
}

table.pay td,
table.pay th {
    white-space: nowrap;
}

table.pay .sum-row th {
    border-top: 2px solid var(--line);
}

table.opening input[type="text"] {
    display: inline-block;
    width: 8rem;
}

table.opening input.hours {
    width: 5rem;
}

.opening-start label {
    display: inline;
    margin-right: 0.4rem;
}

.move-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

@media (max-width: 800px) {
    .move-cols { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .split { grid-template-columns: 1fr; }
    .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
}
