/* FlatCare: one stylesheet, mobile first (designed at 360px), no build step. */

:root {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --text: #17202c;
    --muted: #5f6b7a;
    --line: #e1e5ea;
    --line-strong: #c9d0d8;
    --primary: #0f766e;
    --primary-dark: #0b5c55;
    --primary-soft: #e6f3f1;
    --primary-text: #ffffff;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --ok-bg: #e7f5ee;
    --ok-text: #0b5a3f;
    --error-bg: #fdecea;
    --error-text: #8d1d1d;
    --dev-bg: #fff6d9;
    --dev-text: #6b4e00;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
    --font: "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --topbar-h: 60px;
    --sidebar-w: 260px;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }

h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 1rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .6rem; font-weight: 700; }

.muted, small { color: var(--muted); }
.center { text-align: center; }
.inline { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
p { margin: .4rem 0; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; border-radius: 4px; }

/* ---------- Forms: labels above fields, 44px tap targets ---------- */
.stack { display: flex; flex-direction: column; gap: .55rem; }
label { font-weight: 600; font-size: .95rem; }

input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date],
input[type=email], input[type=month], input[type=search], input[type=datetime-local], input[type=time],
select, textarea {
    width: 100%; min-height: 44px; padding: .55rem .8rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    font: inherit; background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 88px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #aab4bf; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .18);
}
input[type=file] {
    width: 100%; padding: .55rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); font: inherit; font-size: .9rem;
}
input[type=file]::file-selector-button {
    margin-right: .75rem; padding: .4rem .8rem; border: 0; border-radius: 6px;
    background: var(--primary-soft); color: var(--primary-dark); font: inherit; font-weight: 600; cursor: pointer;
}
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.code-input { font-size: 1.6rem; letter-spacing: .4rem; text-align: center; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0; }
legend { font-weight: 600; padding: 0 .35rem; }

/* ---------- Buttons: every button looks like one ---------- */
button, a.button, .search button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 44px; padding: 0 1.1rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:hover, a.button:hover { border-color: #aab4bf; background: var(--surface-2); }
button:active, a.button:active { transform: translateY(1px); }

button.primary, a.button, .search button, a.button.primary-big {
    background: var(--primary); border-color: var(--primary); color: var(--primary-text);
}
button.primary:hover, a.button:hover, .search button:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--primary-text); }
button.primary { min-height: 48px; font-size: 1.02rem; }
form.stack > button.primary, form.stack > button { align-self: flex-start; margin-top: .35rem; }

a.button.secondary, button.secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
a.button.secondary:hover, button.secondary:hover { background: var(--primary-soft); color: var(--primary-dark); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: #912018; border-color: #912018; }

button.link {
    min-height: auto; padding: .25rem .35rem; border: 0; background: none;
    color: var(--primary); font-weight: 600; text-decoration: underline;
}
button.link:hover { background: none; color: var(--primary-dark); }
button.link.active { font-weight: 700; text-decoration: none; color: var(--text); }

/* ---------- Flash banners: text and colour, never colour alone ---------- */
.flash {
    padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
    border: 1px solid transparent; font-weight: 500;
}
.flash ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); border-color: #bfe3d0; }
.flash-error { background: var(--error-bg); color: var(--error-text); border-color: #f4c7c2; }
.flash-dev { background: var(--dev-bg); color: var(--dev-text); border-color: #f1dd9c; font-weight: 700; }

/* ---------- Guest pages ---------- */
body.guest {
    display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 1rem;
    background: linear-gradient(160deg, #e6f3f1 0%, var(--bg) 45%);
}
.guest-card {
    width: 100%; max-width: 420px; margin-top: 3rem; padding: 1.5rem;
    background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.guest-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.brand { font-size: 1.1rem; font-weight: 700; }

/* ---------- Logged-in layout: sticky top bar, sidebar on wide screens ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(6px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    min-height: var(--topbar-h); padding: .4rem 1rem; max-width: 1400px; margin: 0 auto; flex-wrap: wrap;
}
.topbar .brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; }
.topbar .brand img { border-radius: 8px; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .92rem; }
.topbar-link { text-decoration: none; }
.topbar select { width: auto; min-height: 36px; padding: .25rem .5rem; font-size: .9rem; }
.topbar .locale-toggle button.link { padding: .2rem; }
.bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; text-decoration: none; font-size: 1.1rem;
}
.bell:hover { background: var(--surface-2); }
.bell-count {
    position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

.shell { max-width: 1400px; margin: 0 auto; }
.page { padding: 1.25rem 1rem 2rem; max-width: 1080px; margin: 0 auto; min-width: 0; }

/* Staff menu: collapsible on phones, grouped sidebar on wide screens */
.menu-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.staff-menu-toggle {
    display: flex; align-items: center; gap: .5rem; margin: .75rem 1rem 0; padding: .6rem 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
    font-weight: 600; box-shadow: var(--shadow);
}
.menu-toggle-input:focus-visible + .staff-menu-toggle { outline: 3px solid #f2b705; outline-offset: 2px; }
.staff-nav { display: none; margin: .5rem 1rem 0; padding: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu-toggle-input:checked ~ .staff-nav { display: block; }
.menu-tools { display: flex; gap: .4rem; margin-bottom: .5rem; }
.menu-search {
    flex: 1; min-width: 0; padding: .45rem .7rem; font: inherit; font-size: .9rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
}
.menu-search:focus { outline: 2px solid var(--primary); outline-offset: 0; background: var(--surface); }
.menu-collapse {
    display: none; width: 2.1rem; flex: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--muted); cursor: pointer; font-size: 1rem;
}
.menu-collapse:hover { color: var(--primary-dark); background: var(--primary-soft); }
.nav-group + .nav-group { margin-top: .15rem; }
.nav-group-title {
    display: flex; align-items: center; gap: .55rem; padding: .45rem .7rem; border-radius: var(--radius-sm);
    font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
    cursor: pointer; list-style: none; user-select: none;
}
.nav-group-title::-webkit-details-marker { display: none; }
.nav-group-title::after { content: "▸"; margin-left: auto; font-size: .75rem; transition: transform .15s; }
.nav-group[open] > .nav-group-title::after { transform: rotate(90deg); }
.nav-group-title:hover { background: var(--surface-2); color: var(--text); }
.nav-group[data-active] > .nav-group-title { color: var(--primary-dark); }
.nav-group[open] > .nav-group-title { margin-bottom: .1rem; }
.nav-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--danger, #c0392b); }
.nav-group[open] .nav-dot { display: none; }
.nav-icon { width: 1.35rem; flex: none; text-align: center; font-size: 1rem; line-height: 1; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-nav a {
    display: flex; align-items: center; gap: .55rem; margin-left: .35rem;
    padding: .42rem .7rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-size: .94rem;
}
.staff-nav a:hover { background: var(--surface-2); }
.staff-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; box-shadow: inset 3px 0 0 var(--primary); }
.nav-count {
    min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--danger, #c0392b); color: #fff;
    font-size: .74rem; font-weight: 700; line-height: 1.4rem; text-align: center;
}
.menu-empty { margin: .5rem .7rem; color: var(--muted); font-size: .9rem; }

@media (min-width: 960px) {
    body.has-sidebar .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 0; }
    .sidebar {
        position: sticky; top: var(--topbar-h); align-self: start;
        height: calc(100vh - var(--topbar-h)); overflow-y: auto;
        border-right: 1px solid var(--line); background: var(--surface);
    }
    .staff-menu-toggle { display: none; }
    .staff-nav, .menu-toggle-input:checked ~ .staff-nav { display: block; margin: 0; padding: .75rem .6rem 2rem; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
    /* Auto margins would shrink a grid item to its content; fill the column instead. */
    body.has-sidebar .page { width: 100%; max-width: 1200px; margin: 0; padding: 1.75rem 2rem 3rem; }
    .menu-collapse { display: block; }

    /* Icon-only sidebar: groups flatten into a column of icons, names show as tooltips. */
    body.menu-collapsed { --sidebar-w: 4.25rem; }
    body.menu-collapsed .staff-nav { padding-left: .45rem; padding-right: .45rem; }
    body.menu-collapsed .menu-tools { justify-content: center; }
    body.menu-collapsed .menu-search,
    body.menu-collapsed .nav-text,
    body.menu-collapsed .nav-group-title { display: none; }
    body.menu-collapsed .nav-group:not([open]) > a { display: flex; }
    body.menu-collapsed .nav-group + .nav-group { margin-top: .35rem; padding-top: .35rem; border-top: 1px solid var(--line); }
    body.menu-collapsed .staff-nav a { position: relative; justify-content: center; margin: 0; padding: .5rem 0; }
    body.menu-collapsed .nav-count { position: absolute; top: .1rem; right: .1rem; min-width: 1rem; line-height: 1rem; padding: 0 .25rem; font-size: .62rem; }
}

/* Users screen: row actions (edit, unlock, unblock, block with reason) */
.user-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin-bottom: .75rem; }
td .user-actions { margin-bottom: 0; }
.user-actions form { margin: 0; }
.user-actions .small, .user-actions a.button.small { min-height: 34px; padding: 0 .75rem; font-size: .86rem; margin: 0; }
.block-form summary { display: inline-flex; align-items: center; min-height: 34px; padding: 0 .75rem; border: 1px solid var(--danger); border-radius: var(--radius-sm); color: var(--danger); font-size: .86rem; font-weight: 600; cursor: pointer; list-style: none; }
.block-form summary::-webkit-details-marker { display: none; }
.block-form[open] summary { background: var(--danger-soft); }
.block-form form { margin-top: .4rem; min-width: 220px; }
.page-head h1 .badge { vertical-align: middle; font-size: .8rem; }
.field-hint { margin: 0 0 .5rem; font-size: .85rem; }
/* Platform admin screens */
.admin-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.admin-tabs a { padding: .4rem .85rem; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; }
.admin-tabs a:hover { background: var(--surface-2); }
.admin-tabs a.active { background: var(--primary); color: var(--primary-text); }
.admin-badge { margin-right: .5rem; padding: .25rem .7rem; border-radius: 999px; background: #efe7fb; color: #4b2a85; font-size: .8rem; font-weight: 700; }
.admin-stats { margin-bottom: 1rem; }
.user-stats a.is-on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.filter-panel-short { grid-template-columns: minmax(200px, 1fr) auto; }
.card + .card { margin-top: 1rem; }
.inline-panel { margin-top: .75rem; }
.inline-panel > summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); }
.add-to-flat { max-width: 560px; margin-bottom: .75rem; }
.add-to-flat .inline-panel { margin-top: 0; }
.role-chip { display: inline-flex; align-items: center; gap: .25rem; margin: 0 .25rem .25rem 0; padding: .1rem .2rem .1rem .6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; }
.role-chip.is-blocked { background: var(--danger-soft); border-color: var(--danger); text-decoration: line-through; }
.role-chip form { margin: 0; }
.chip-x { min-height: 0; width: 1.4rem; height: 1.4rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: .75rem; line-height: 1; }
.chip-x:hover { background: var(--danger); color: #fff; }
.danger-zone { border-color: var(--danger); }
.danger-zone summary { list-style: none; display: inline-flex; cursor: pointer; }
.danger-zone summary::-webkit-details-marker { display: none; }
.danger-zone form { margin-top: .75rem; }

/* Manager dashboard: user management card */
.user-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .25rem 0 .9rem; }
.user-stats a { display: flex; flex-direction: column; align-items: center; padding: .6rem .3rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); text-decoration: none; text-align: center; }
.user-stats a:hover { border-color: var(--primary); }
.user-stats strong { font-size: 1.35rem; line-height: 1.2; }
.user-stats span { font-size: .8rem; color: var(--muted); }
.user-stats a.is-warn { background: #fff8e1; border-color: #f2d27a; }
.user-stats a.is-alert { background: var(--danger-soft); border-color: var(--danger); }
.user-stats a.is-alert strong { color: var(--danger); }
.small-note { font-size: .82rem; margin: .4rem 0 0; }
@media (max-width: 420px) { .user-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plain-fieldset label { display: block; margin-top: .5rem; }
.plain-fieldset label.check { display: flex; margin-top: 0; }

/* Verify page: "code sent to …" and, in the local environment only, the code itself */
.otp-sent { margin: 0 0 1rem; padding: .7rem 1rem; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary-dark); }
.otp-sent p { margin: 0; }
.dev-otp { margin-top: .25rem !important; font-weight: 700; }
.dev-otp-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .08em; background: none; cursor: copy; user-select: all; }

/* ---------- Page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }

.choice-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
@media (min-width: 720px) { .choice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice-list form { margin: 0; }
.choice {
    width: 100%; min-height: 64px; padding: .9rem 1.1rem; text-align: left;
    display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
    text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.choice:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); color: var(--text); }
.choice span { color: var(--muted); font-size: .9rem; font-weight: 400; }

.search { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.search input, .search select { flex: 1 1 160px; width: auto; }
.empty {
    padding: 1.5rem 1rem; text-align: center; background: var(--surface);
    border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted);
}
.form-narrow { max-width: 560px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; } }
.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow);
}
.panel > h2:first-child { margin-top: 0; }
details.panel > summary, .panel summary { cursor: pointer; min-height: 32px; font-weight: 600; color: var(--primary-dark); }
details[open] > summary { margin-bottom: .75rem; }
.plain-list { padding-left: 1.2rem; }
.plain-list li { margin: .3rem 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin: 0 0 1.1rem; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; box-shadow: var(--shadow); }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: .1rem 0 0; font-weight: 700; font-size: 1.02rem; }
.actions form { margin: 0 0 .25rem; }
.actions details summary { color: var(--danger); cursor: pointer; }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar form { margin: 0; }
.toolbar button.primary { margin-top: 0; }
.toolbar a.active { font-weight: 700; color: var(--text); text-decoration: none; }

/* ---------- Tables: scroll sideways on small screens; every financial list has a total row ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
    position: sticky; top: 0; background: var(--surface-2); font-size: .8rem; font-weight: 700;
    color: var(--muted); white-space: nowrap; text-transform: uppercase; letter-spacing: .03em;
}
tbody tr:hover { background: #fafcfc; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line); border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid input { min-width: 90px; min-height: 36px; padding: .3rem .5rem; text-align: right; }
table.grid th small { display: block; font-weight: 400; }
tr.muted td { color: var(--muted); }

/* ---------- Status badges: text and colour ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600; background: #eef0f4; color: var(--text); white-space: nowrap;
}
.badge-owner_occupied, .badge-paid, .badge-verified { background: #e3f4ea; color: #0b5a3f; }
.badge-rented, .badge-issued { background: #e6effc; color: #1d4f91; }
.badge-vacant, .badge-draft { background: #eef0f4; color: #5d6677; }
.badge-partial, .badge-pending { background: #fff1cc; color: #7a5200; }
.badge-overdue, .badge-rejected { background: #fdecea; color: #8d1d1d; }
.badge-void { background: #eef0f4; color: #5d6677; text-decoration: line-through; }
.badge-billing { background: #efe7fb; color: #4b2a85; }

/* ---------- Portal: the total due is the first thing an owner sees (docs/08 §8.5) ---------- */
.due-card {
    background: linear-gradient(135deg, var(--primary) 0%, #14907f 100%); color: #fff;
    border-radius: 16px; padding: 1.5rem 1.25rem; text-align: center; margin-bottom: 1.25rem; box-shadow: var(--shadow-lg);
}
.due-card .muted, .due-card small { color: rgba(255, 255, 255, .85); }
.due-label { margin: .25rem 0; font-weight: 600; opacity: .95; }
.due-amount { font-size: 2.25rem; font-weight: 800; margin: .25rem 0 1rem; letter-spacing: -.01em; }
.due-card a.button, .due-card a.button.primary-big { background: #fff; color: var(--primary-dark); border-color: #fff; }
.due-card a.button:hover { background: #f0faf8; color: var(--primary-dark); }
a.button.primary-big { min-height: 56px; font-size: 1.15rem; padding: 0 2rem; }

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; text-align: center; padding: .8rem .25rem; min-height: 58px; text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 600; }
.bottom-nav a.active { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; padding-top: .5rem; padding-bottom: .5rem; font-size: .82rem; }
.bottom-icon { font-size: 1.25rem; line-height: 1; }
.more-group + .more-group { margin-top: 1.25rem; }
.more-group h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .5rem; }
body:has(.bottom-nav) .page { padding-bottom: 6rem; }

.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .65rem .95rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.active { border-color: var(--primary); color: var(--text); }

.launcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 720px) { .launcher { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.big-button {
    display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 1rem; text-align: center;
    background: var(--primary); color: var(--primary-text); border: 0; border-radius: var(--radius);
    font-size: 1.1rem; font-weight: 700; text-decoration: none; box-shadow: var(--shadow);
}
.big-button:hover { background: var(--primary-dark); color: var(--primary-text); }
.flat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.flat-tile {
    display: flex; align-items: center; justify-content: center; min-height: 56px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); font-weight: 700; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.flat-tile:hover { border-color: var(--primary); color: var(--primary-dark); }

/* Pagination bar (partials/pagination): summary + per page | go to page | « ‹ 1 2 … › » */
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1rem; margin: 1rem 0 1.5rem; padding: .55rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pager-info { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.pager-summary { font-size: .88rem; color: var(--muted); white-space: nowrap; }
.pager-summary b { color: var(--text); }
.pager form { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.pager-per-page { padding-left: 1rem; border-left: 1px solid var(--line); }
.pager label { margin: 0; font-weight: 500; color: var(--muted); }
.pager select, .pager input[type=number] { width: auto; min-height: 34px; height: 34px; padding: 0 .5rem; font-size: .88rem; font-weight: 600; }
.pager input[type=number] { width: 4.2rem; text-align: center; }
.pager button.small { min-height: 34px; padding: 0 .8rem; margin: 0; font-size: .85rem; background: var(--primary-soft); color: var(--primary-dark); border-color: transparent; }
.pager button.small:hover { background: var(--primary); color: var(--primary-text); }
.pager-nav { display: flex; align-items: center; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 .55rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .88rem; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
a.pager-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); transform: translateY(-1px); }
.pager-btn.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); box-shadow: 0 2px 6px rgba(15, 118, 110, .3); }
.pager-btn.disabled { opacity: .35; background: transparent; border-color: transparent; }
.pager-gap { display: inline-flex; min-width: 18px; justify-content: center; color: var(--muted); }
@media (max-width: 760px) {
    .pager { justify-content: center; }
    .pager-info { justify-content: center; }
    .pager-per-page { border-left: 0; padding-left: 0; }
}

/* List filters: labelled fields, applied live (public/js/pager.js), chips for active filters */
.filter-panel { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: .6rem .75rem; align-items: end; margin-bottom: .6rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-field label { display: block; margin: 0 0 .25rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.filter-field input, .filter-field select { width: 100%; margin: 0; }
.filter-actions button { margin: 0; }
.filter-summary { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .5rem; margin-bottom: .75rem; font-size: .88rem; }
.filter-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .65rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.filter-chip:hover { background: var(--danger-soft); color: var(--danger); }
.filter-clear { color: var(--danger); font-weight: 600; }
.th-sort { display: inline-flex; align-items: center; gap: .3rem; color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort span { font-size: .75rem; opacity: .5; }
.th-sort.is-on, .th-sort:hover { color: var(--primary-dark); }
.th-sort.is-on span { opacity: 1; }
@media (max-width: 960px) { .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-search { grid-column: 1 / -1; } }
@media (max-width: 520px) { .filter-panel { grid-template-columns: 1fr; } }

/* ---------- Dashboards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat {
    display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none;
}
a.stat:hover { border-color: var(--primary); color: var(--text); }
.stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .82rem; color: var(--muted); }
.stat-accent { background: linear-gradient(135deg, var(--primary) 0%, #14907f 100%); border-color: transparent; color: #fff; }
.stat-accent .stat-label, .stat-accent .stat-sub { color: rgba(255, 255, 255, .85); }
.meter { display: block; height: 8px; margin: .35rem 0 .1rem; background: rgba(15, 118, 110, .15); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.stat-accent .meter { background: rgba(255, 255, 255, .25); }
.stat-accent .meter > span { background: #fff; }

.dash-grid { display: grid; gap: 1rem; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0;
}
.dash-grid .card { margin-bottom: 0; }
.card > h2:first-child, .card-head h2 { margin-top: 0; }
.card h3 { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.card-notice { border-left: 4px solid #2b6cb0; }
.card-warn { border-left: 4px solid #d29b00; }
.kv-row, .attention-row {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .55rem 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.kv-row:last-child, .attention-row:last-child { border-bottom: 0; }
a.attention-row:hover { color: var(--primary-dark); background: var(--surface-2); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 6px; }

.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 180px; padding-top: .5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; }
.bar-in, .dot-in { background: var(--primary); }
.bar-out, .dot-out { background: #f0a35e; }
.bar-label { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.legend { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); margin-top: .5rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: .5rem; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin-bottom: 1.25rem; }
.quick-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 92px;
    padding: .75rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow);
}
.quick-link span { font-size: 1.6rem; }
.quick-link:hover { border-color: var(--primary); color: var(--primary-dark); }
/* Portal home: shortcuts at the top, compact; one swipeable row on phones so the dues card stays in view */
.quick-links-top { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.quick-links-top .quick-link { min-height: 74px; padding: .55rem .4rem; font-size: .84rem; line-height: 1.25; gap: .25rem; }
.quick-links-top .quick-link span { font-size: 1.35rem; }
@media (max-width: 640px) {
    .quick-links-top { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .35rem; margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; scrollbar-width: none; }
    .quick-links-top::-webkit-scrollbar { display: none; }
    .quick-links-top .quick-link { flex: 0 0 92px; scroll-snap-align: start; }
}
.big-button-light { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.big-button-light:hover { background: var(--primary-soft); color: var(--primary-dark); }

.portal-grid { display: grid; gap: 1rem; }
@media (min-width: 900px) { .portal-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }

/* Notices, tickets, notifications */
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); margin: 0 6px 6px 0; border: 1px solid var(--line); }
.panel-internal { border-left: 4px solid #b7791f; }
.panel-unread { border-left: 4px solid #2b6cb0; }

/* ---------- Report screens print without menus and filters; phone numbers are masked on paper ---------- */
.print-only { display: none; }
.export-links { margin: 0 0 .75rem; }
@media print {
    .topbar, .sidebar, .bottom-nav, .no-print, .screen-only, .flash, .search, .toolbar { display: none !important; }
    body.has-sidebar .shell { display: block; }
    .print-only { display: inline; }
    .page { max-width: none; padding: 0; }
    .table-wrap, .panel, .facts div { border: 0; overflow: visible; box-shadow: none; }
    body { background: #fff; }
}

/* ---------- Printables (docs/09 §9.3): A4 by default, A5 for receipts when the society prefers ---------- */
.print-page { background: #e9ebef; }
.print-actions { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem; }
.print-actions button.primary { margin: 0; padding: 0 1.5rem; }
.print-sheet { position: relative; background: #fff; max-width: 210mm; margin: 0 auto 2rem; padding: 14mm; overflow: hidden; box-shadow: var(--shadow-lg); }
.print-a5 .print-sheet { max-width: 148mm; padding: 10mm; }
.print-header { text-align: center; border-bottom: 2px solid var(--text); padding-bottom: .5rem; margin-bottom: 1rem; }
.print-building { font-size: 1.3rem; }
.print-title { font-size: 1.1rem; margin: .5rem 0 0; }
.print-muted { color: var(--muted); font-size: .9rem; }
.print-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
.print-meta dt { font-size: .8rem; color: var(--muted); }
.print-meta dd { margin: 0 0 .25rem; font-weight: 600; }
.print-table { margin: 1rem 0; }
.print-table th, .print-table td { padding: .35rem .5rem; }
.print-amount { font-size: 1.6rem; font-weight: 800; }
.print-box { border: 1px solid var(--line); padding: .5rem 1rem; margin-top: 1rem; }
.print-footer { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.print-void { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 8rem; font-weight: 900; color: rgba(180, 35, 24, .18); transform: rotate(-25deg); pointer-events: none; }
.print-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.print-thumbs img { max-width: 45%; max-height: 120mm; border: 1px solid var(--line); }
.print-notice-title { font-size: 1.6rem; margin: 1rem 0; }
.print-notice-body { font-size: 1.15rem; line-height: 1.7; }
.print-signature { margin-top: 3rem; text-align: right; }
.print-verify { margin-top: 1rem; font-size: .8rem; }
.print-verify-link { word-break: break-all; }
@media print {
    .print-page { background: #fff; }
    .print-actions { display: none; }
    .print-sheet { margin: 0; padding: 0; max-width: none; box-shadow: none; }
    @page { size: A4; margin: 12mm; }
}

/* Settings */
.form-wide { max-width: 760px; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem 1rem; }
.module-option { padding: .25rem .5rem; border-radius: var(--radius-sm); }
.module-option:hover { background: var(--surface-2); }
