/* Compta: quiet grouped lists on a light grey ground, one deep-ink card for the total, one indigo accent.
   Same language as the assistant dashboard. Light only. On wide screens the tabs float as a pill at the top. */

:root {
    color-scheme: light;
    --bg: #ebebf1;
    --card: #fff;
    --fill: #e9e9f1;
    --sep: #cbcbd6;
    --text: #1c1c1e;
    --text-2: #5b5b63;
    --accent: #2f42c9;
    --accent-soft: #eceefc;
    --on-accent: #fff;
    --danger: #c0262d;
    --ink: #151a45;
    --ink-text: #f3f4ff;
    --ink-muted: #b9beea;
    --signal: #ffc46b;
    --ink-danger: #ff8a8f;
    --radius: 16px;
    --radius-sm: 10px;
    --margin-x: 56px;
    --page-width: 560px;
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    max-width: var(--page-width);
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.4;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd, figure { margin: 0; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
h2 { padding: 16px 16px 4px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
a { color: var(--accent); }
.muted { color: var(--text-2); }
.over { color: var(--danger); }
code { font-size: .9em; background: var(--fill); padding: 1px 5px; border-radius: 4px; }
.page > p { margin: 12px 4px; }
.back-link { align-self: flex-start; margin: 0 4px; font-size: 17px; text-decoration: none; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Large title, no bar */
.binding {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: calc(72px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 20px 0;
}
.binding h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 24px; }
.page > * { margin-top: 0; margin-bottom: 0; }

/* Grouped list: a white card, rows separated by hairlines */
.bleed, details.filters, details.danger-zone, .selection-total {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--sep);
    overflow: hidden;
}
details.filters, details.danger-zone { padding: 0 16px; }
details.danger-zone[open] { padding-bottom: 16px; }

/* Floating pill tabs (phone: bottom) */

/* Buttons: pills */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.1); }
.btn-block, button.btn-block { display: flex; width: 100%; }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.link-button { min-height: 48px; padding: 0 4px; background: none; color: var(--accent); font-weight: 500; }
.link-button:hover { background: none; filter: none; }

/* Forms */
.stack { display: block; }
.stack label, .login-box label { display: block; margin: 0 0 4px 4px; font-size: 13px; color: var(--text-2); }
input, select, textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-bottom: 14px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 17px; /* 16px or more: iOS does not zoom into the field */
    font-variant-numeric: tabular-nums;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--text-2); opacity: .7; }
select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b5b63' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
input[type="search"] { appearance: none; -webkit-appearance: none; }
#amount { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.stack button { width: 100%; margin-top: 8px; }
.inline-fields { display: flex; gap: 12px; }
.inline-fields > * { min-width: 0; }
.inline-fields input { flex: 1; }
.inline-fields select { width: 104px; flex: none; }
.inline-fields .btn { flex: 1; margin-bottom: 14px; padding: 0 8px; text-align: center; }
.filters .inline-fields > div { flex: 1; }
.filters input, .filters select { background: var(--fill); }
[hidden] { display: none !important; }
.form-error, .login-error { margin-bottom: 12px; color: var(--danger); font-weight: 600; }

details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '+'; width: 32px; text-align: center; font-size: 24px; font-weight: 300; color: var(--text-2); }
details[open] > summary::after { content: '\2212'; }
.danger-zone summary { color: var(--danger); }
.archived.bleed > summary { padding: 0 16px; }
.archived.bleed[open] > summary { border-bottom: 1px solid var(--sep); }
.danger-zone p { margin-bottom: 12px; color: var(--text-2); }

/* Rows: date on the left, label in the middle, amount on the right */
.ledger-row {
    display: grid;
    grid-template-columns: var(--margin-x) 1fr auto;
    column-gap: 12px;
    align-items: start;
    min-height: 64px;
    padding: 12px 16px;
    border-top: 1px solid var(--sep);
    color: inherit;
    text-decoration: none;
}
h2 + .ledger-row, summary + .ledger-row, .bleed > .ledger-row:first-child { border-top: 0; }
a.ledger-row:hover { background: var(--fill); }
.ledger-row .when { font-size: 15px; line-height: 1.3; color: var(--text-2); }
.ledger-row .when b { display: block; font-weight: 600; color: var(--text); }
.ledger-row .when small { display: block; font-size: 13px; }
.ledger-row .what, .ledger-row .amount { display: block; min-width: 0; }
.ledger-row .amount { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-row strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row .sub { display: flex; gap: 12px; font-size: 15px; color: var(--text-2); overflow: hidden; white-space: nowrap; }
.ledger-row .amount .sub { justify-content: flex-end; }
.ledger-row .sub .cat { overflow: hidden; text-overflow: ellipsis; }
.ledger-row .note { grid-column: 2 / 4; font-size: 15px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row > progress { grid-column: 2 / 4; margin: 8px 0 0; }
.ledger-row .what > progress { margin: 8px 0 0; }
.category-row .amount .sub { font-size: 14px; }

/* Budget bar */
progress {
    display: block;
    width: 100%;
    height: 6px;
    appearance: none;
    border: 0;
    border-radius: 3px;
    background: var(--sep);
    overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--sep); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
progress.over::-webkit-progress-value { background: var(--danger); }
progress.over::-moz-progress-bar { background: var(--danger); }

/* State tags (over budget, archived) */
.stamp {
    display: inline-block;
    align-self: center;
    padding: 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--danger) 12%, var(--card));
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    line-height: 22px;
}
.stamp.quiet { background: var(--fill); color: var(--text-2); }

/* Signature: the deep-ink total card */
.project-total {
    padding: 20px;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--ink-text);
}
.project-total .label { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.big-total {
    display: block;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -.04em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.sums { margin-top: 16px; }
.sums > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 34px; border-top: 1px solid rgba(243, 244, 255, .18); }
.sums dt { color: var(--ink-muted); }
.sums dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.project-total .over { color: var(--ink-danger); }
.project-total progress { margin: 12px 0 4px; background: rgba(243, 244, 255, .2); }
.project-total progress::-webkit-progress-bar { background: rgba(243, 244, 255, .2); }
.project-total progress::-webkit-progress-value { background: var(--signal); }
.project-total progress::-moz-progress-bar { background: var(--signal); }
.project-total progress.over::-webkit-progress-value { background: var(--ink-danger); }
.project-total progress.over::-moz-progress-bar { background: var(--ink-danger); }
.project-total .stamp { margin-top: 8px; background: rgba(243, 244, 255, .12); color: var(--ink-danger); }
.project-total .stamp.quiet { color: var(--ink-muted); }
.selection-total { padding: 14px 16px; background: var(--accent-soft); }
.selection-total strong { font-variant-numeric: tabular-nums; }

/* Photos */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.thumb { position: relative; margin: 0; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-sm); background: var(--sep); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb form { margin: 0; }
.thumb-remove {
    position: absolute; top: 4px; right: 4px;
    width: 36px; min-height: 36px; height: 36px; padding: 0;
    border-radius: 50%;
    background: rgba(21, 26, 69, .75);
    color: #fff;
    font-size: 22px; line-height: 1;
}

/* Export */
.choices { margin: 0; padding: 0; border: 0; }
.choices legend { padding: 0 0 6px; font-weight: 600; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0 !important; font-size: 17px !important; color: var(--text) !important; }
.choice input { width: 24px; min-height: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--accent); }

/* Login and offline pages */
.login-box { max-width: 360px; margin: 0 auto; padding: 96px 20px 0; }
.login-box h1 { margin-bottom: 32px; font-size: 40px; }
.login-box button { width: 100%; margin-top: 16px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; }
.backup-status { font-size: 13px; color: var(--text-2); }
.backup-status.bad { color: var(--danger); font-weight: 600; }

/* Helper lines under a field (HT/TVA, exchange rate, OCR status) */
.stack p.muted { margin: -6px 4px 14px; font-size: 13px; }
.stack p:empty { display: none; }
button:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }

/* A label styled as a button (camera / gallery) */
.stack label.btn { display: inline-flex; margin: 0 0 14px; font-size: 16px; color: var(--accent); }

/* Project views: Dépenses | Budget */
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--sep); }
.segmented a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--text-2);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.segmented a.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(20, 24, 60, .12); }

/* Budget table: category > subcategory > line, edited in place */
.budget { display: flex; flex-direction: column; gap: 12px; }
.budget input {
    min-height: 36px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    font-size: 16px;
}
.budget input:hover { background: var(--fill); }
.budget input:focus { background: var(--card); border-color: var(--accent); }
.budget .b-qty, .budget .b-unit { text-align: right; }
.budget .b-qty { width: 56px; }
.budget .b-unit { width: 92px; }
.budget .b-comment { grid-area: comment; min-height: 30px; font-size: 14px; color: var(--text-2); }
.b-row, .b-colhead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 168px 92px 92px 92px 36px;
    column-gap: 4px;
    align-items: center;
    padding: 4px 8px 4px 8px;
}
.b-colhead { padding-top: 0; padding-bottom: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.b-colhead { padding: 0 8px; }
.b-colhead > span:first-child { padding-left: 8px; }
.b-colhead .b-num, .b-colhead .b-qty-unit { font-size: 12px; }
.b-colhead .b-qty-unit { padding-right: 20px; }
.b-line { grid-template-areas: "label qty planned spent left menu" "comment comment comment comment comment comment"; border-top: 1px solid var(--sep); }
.b-line .b-label { grid-area: label; }
.b-line .b-qty-unit { grid-area: qty; }
.b-line .b-planned { grid-area: planned; }
.b-line .b-spent { grid-area: spent; }
.b-line .b-left { grid-area: left; }
.b-line .b-menu { grid-area: menu; }
.b-tag { grid-column: 1 / -1; justify-self: start; margin: 2px 8px; }
.b-qty-unit { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.b-times { color: var(--text-2); }
.b-num { text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; }
.b-spent { color: var(--text); text-decoration: none; }
a.b-spent:hover { text-decoration: underline; }
.b-left.over { color: var(--danger); font-weight: 600; }
.b-group { background: var(--fill); border-top: 1px solid var(--sep); }
.b-group .b-title { color: var(--ink); }
.b-group .b-title { font-size: 17px; font-weight: 700; }
.b-subhead { padding-left: 24px; }
.b-subhead .b-subtitle { font-weight: 600; }
.b-sub .b-line { padding-left: 24px; }
.b-sub { border-top: 1px solid var(--sep); }
.b-archived .b-label, .b-archived .b-qty-unit, .b-archived .b-planned { opacity: .5; text-decoration: line-through; }
.b-add { display: flex; gap: 16px; padding: 0 16px 4px; border-top: 1px solid var(--sep); }
.b-add .link-button { min-height: 44px; font-size: 15px; }
.b-menu { position: relative; }
.b-menu summary { display: flex; justify-content: center; min-height: 36px; width: 36px; border-radius: 8px; color: var(--text-2); font-size: 20px; }
.b-menu summary::after { content: none; }
.b-menu summary:hover { background: var(--fill); }
.b-menu[open] > div {
    position: absolute; right: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px; width: 220px; padding: 12px;
    border-radius: var(--radius-sm); background: var(--card); box-shadow: 0 0 0 1px var(--sep), 0 8px 24px rgba(20, 24, 60, .15);
}
.b-menu[open] > div button { min-height: 40px; }
.b-margin { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.budget .project-total input { width: 64px; min-height: 32px; text-align: right; color: var(--ink-text); border-color: rgba(243, 244, 255, .3); }
.budget .project-total input:hover, .budget .project-total input:focus { background: rgba(243, 244, 255, .12); color: var(--ink-text); }
.project-total a.light { color: inherit; text-decoration: none; }
.project-total a.light:hover { text-decoration: underline; }
.project-total dd.over { color: var(--ink-danger); }

@media (max-width: 700px) {
    .b-colhead { display: none; }
    .b-row { grid-template-columns: 1fr 1fr 1fr 36px; row-gap: 2px; }
    .b-line { grid-template-areas: "label label label menu" "qty qty qty qty" "planned spent left left" "comment comment comment comment"; }
    .b-line .b-qty-unit { justify-content: flex-start; }
    .b-group .b-label { grid-column: 1 / 4; grid-row: 1; }
    .b-subhead .b-label { grid-column: 1 / 3; grid-row: 1; }
    .b-group .b-qty-unit { display: none; }
    .b-subhead .b-qty-unit { grid-column: 3; grid-row: 1; }
    .b-group .b-menu, .b-subhead .b-menu { grid-column: 4; grid-row: 1; }
    .b-group .b-planned, .b-subhead .b-planned { grid-column: 1; grid-row: 2; text-align: left; }
    .b-group .b-spent, .b-subhead .b-spent { grid-column: 2; grid-row: 2; text-align: left; }
    .b-group .b-left, .b-subhead .b-left { grid-column: 3 / 5; grid-row: 2; text-align: left; }
    .b-group .b-planned::before, .b-subhead .b-planned::before { content: 'Prévu '; }
    .b-group .b-spent::before, .b-subhead .b-spent::before { content: 'Dépensé '; }
    .b-group .b-left::before, .b-subhead .b-left::before { content: 'Reste '; }
    .b-group .b-num, .b-subhead .b-num, .b-line .b-num { font-size: 13px; color: var(--text-2); padding-left: 8px; white-space: nowrap; }
    .b-line .b-planned, .b-line .b-spent, .b-line .b-left { text-align: left; font-size: 14px; color: var(--text-2); }
    .b-line .b-left.over { color: var(--danger); }
    .b-line .b-planned::before { content: 'Prévu '; }
    .b-line .b-spent::before { content: 'Dépensé '; }
    .b-line .b-left::before { content: 'Reste '; }
}

@media (prefers-contrast: more) {
    :root { --sep: #8e8e93; --text-2: #3a3a3f; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Desktop: tabs become a pill floating at the top, content gets a reading column */
@media (min-width: 900px) {
    body { max-width: 760px; padding: 24px 0 48px; font-size: 16px; }
    body:has(.budget) { max-width: 1040px; }
    .binding { min-height: 96px; padding-top: 24px; }
    button, .btn { min-height: 44px; }
    .btn-block, button.btn-block { width: auto; align-self: flex-start; }
    form .btn-block, .stack .btn-block, .stack button { width: 100%; }
    .stack, .login-box { max-width: 520px; }
    .thumbs { grid-template-columns: repeat(4, 1fr); }
}

/* Budget import / export */
.b-io { margin-top: 16px; border: 1px solid var(--sep); border-radius: 12px; background: var(--card); }
.b-io summary { padding: 12px 16px; font-weight: 600; cursor: pointer; }
.b-io-body { padding: 0 16px 16px; display: grid; gap: 10px; }
.b-io-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.b-io form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--fill); color: var(--text); }

/* Budget line picker (expense form) */
.picker-button {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 48px;
    padding: 10px 14px; border: 1px solid var(--sep); border-radius: 12px; background: var(--card);
    color: var(--text); font: inherit; text-align: left;
}
.picker-button span:first-child { overflow-wrap: anywhere; }
.sheet {
    width: 100%; max-width: 560px; height: 100%; max-height: 100dvh; margin: 0 auto; padding: 0; border: 0;
    background: var(--card); color: var(--text); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(10, 14, 30, .5); }
.sheet-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--sep); }
.sheet-head input { flex: 1; min-width: 0; }
.sheet-head button { width: 48px; padding: 0; font-size: 22px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 12px calc(16px + env(safe-area-inset-bottom)); }
.sheet-cat h3 { margin: 16px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.sheet-cat h4 { margin: 8px 0 2px 8px; font-size: 14px; color: var(--text-2); }
.sheet-option {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 52px;
    padding: 10px 14px; margin: 3px 0; border: 1px solid var(--sep); border-radius: 12px; background: var(--card);
    color: var(--text); font: inherit; text-align: left;
}
.sheet-option[hidden], .sheet-cat[hidden], [data-group][hidden] { display: none; }
.sheet-option.selected { border-color: var(--text); background: var(--fill); font-weight: 600; }
.sheet-label { overflow-wrap: anywhere; }
.sheet-left { white-space: nowrap; font-size: 13px; color: var(--text-2); }
.sheet-left.over { color: var(--danger); }
@media (min-width: 700px) {
    .sheet { height: auto; max-height: 80vh; margin: auto; border-radius: 16px; }
}

/* Expense form as a centered popup card over a dimmed backdrop */
body.modal-page {
    max-width: none; padding: 0; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--text) 45%, var(--bg));
}
.modal-card {
    position: relative; width: 100%; max-width: 560px; min-height: 100dvh; padding: 0 20px 28px;
    background: var(--bg); text-align: center;
}
.modal-head {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
    min-height: calc(64px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
    margin: 0 -20px 12px; background: var(--bg); border-bottom: 1px solid var(--sep);
}
.modal-head h1 { margin: 0; font-size: 18px; }
.modal-close {
    position: absolute; right: 12px; top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center;
    justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--sep);
    color: var(--text); font-size: 26px; line-height: 1; text-decoration: none;
}
.modal-card .stack { max-width: none; margin: 0 auto; }
.modal-card .stack label, .modal-card h2 { margin-left: 0; text-align: center; }
.modal-card input, .modal-card select { text-align: center; text-align-last: center; }
.modal-card .stack p.muted { margin-left: 0; margin-right: 0; }
.modal-card .inline-fields { justify-content: center; }
.modal-card .picker-button { justify-content: center; text-align: center; }
.modal-card .picker-button span[aria-hidden] { display: none; }
.modal-card .thumbs { justify-content: center; }
.modal-card details.danger-zone { margin-top: 16px; text-align: center; }
@media (min-width: 700px) {
    body.modal-page { padding: 32px 16px; align-items: center; }
    .modal-card {
        min-height: 0; max-height: calc(100dvh - 64px); overflow-y: auto; border-radius: 20px;
        box-shadow: 0 24px 64px rgba(10, 14, 30, .35);
    }
    .modal-head { border-radius: 20px 20px 0 0; }
    .modal-close { top: 10px; }
}
.modal-card .picker-button { margin-bottom: 14px; border-color: transparent; }

/* Export popup: option lists left-aligned, box and label on one line */
.modal-card .choices { margin-bottom: 14px; text-align: left; }
.modal-card .choices legend { width: 100%; padding: 8px 0 8px; text-align: center; }
.modal-card .stack .choice {
    display: flex; align-items: center; justify-content: flex-start; gap: 12px; min-height: 52px;
    padding: 0 14px; background: var(--card); border-top: 1px solid var(--sep); text-align: left;
}
.modal-card .choices legend + .choice { border-top: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.modal-card .choices .choice:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.modal-card .choices legend + .choice:last-child { border-radius: var(--radius-sm); }
.modal-card .choice input { width: 24px; height: 24px; min-height: 24px; margin: 0; padding: 0; flex: none; }
.modal-card .choice > span { min-width: 0; line-height: 1.3; }
.modal-card > p.muted { margin: 16px 0 8px; }

/* Read-only members: the server refuses their changes anyway, this just removes the controls */
.read-only [data-action] { display: none; }
.read-only .b-row input { pointer-events: none; }

/* Admin */
.binding-title { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 8px 0 14px; }
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.page > h2 { padding: 24px 4px 0; }
.account-row { grid-template-columns: 1fr auto; align-items: center; }
.account-row .chevron { color: var(--text-2); font-size: 22px; line-height: 1; }
.stack label.choice { display: flex; align-items: flex-start; margin: 0 0 14px !important; padding-top: 4px; }
.stack label.choice input { margin-top: 1px; }
.stack .choices { margin: 8px 0 20px; }
.stack .choices legend { margin-bottom: 4px; font-size: 17px; }
.access-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--sep); }
.access-row:first-of-type { border-top: 0; }
.stack .access-row label { margin: 0; font-size: 17px; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.access-row select { margin: 0; }
input[type="file"] { padding: 10px 14px; line-height: 1.3; font-size: 15px; color: var(--text-2); }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Sharing */
.member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--sep); }
.bleed > .member-row:first-child, .bleed > .invite-row:first-child { border-top: 0; }
.member-row .what strong, .member-row .what .sub { display: block; }
.member-row .what .sub { font-size: 14px; color: var(--text-2); }
.member-row .what .sub:empty { display: none; }
.member-row select { width: 190px; min-height: 40px; margin: 0; background-color: var(--fill); }
.member-row .link-button { grid-column: 1 / -1; min-height: 32px; justify-self: end; font-size: 15px; }
.member-row > .muted { text-align: right; }
.member-row [data-autosubmit] ~ .link-button:not(.danger-text) { display: none; }
.danger-text { color: var(--danger); }
.invite-row { display: block; padding: 12px 16px; border-top: 1px solid var(--sep); }
.invite-link { margin: 8px 0; min-height: 44px; font-size: 14px; background: var(--fill); }
.invite-actions { display: flex; gap: 12px; align-items: center; }
.invite-actions form { margin: 0; }
.invite-actions button { margin: 0; min-height: 44px; }
