* {
    box-sizing: border-box;
}

:root {
    --surface: #f7f9fb;
    --surface-container: #eceef0;
    --surface-container-low: #f2f4f6;
    --surface-container-lowest: #ffffff;
    --on-surface: #000000;
    --on-surface-variant: #474747;
    --accent-success: #006c49;
    --accent-info: #00397f;
    --accent-error: #ba1a1a;

    /* Backward-compatible aliases for existing pages */
    --page: var(--surface);
    --panel: var(--surface-container-lowest);
    --panel-soft: var(--surface-container-low);
    --sidebar: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
    --text: var(--on-surface-variant);
    --muted: #616874;
    --line: #dde2e8;
    --shadow: 0 36px 64px -4px rgba(16, 24, 40, 0.06);
    --shadow-soft: 0 22px 40px -6px rgba(16, 24, 40, 0.05);
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 9px;
    --accent: var(--on-surface);
    --blue: #dbeafe;
    --green: #dcfce7;
    --purple: #ede9fe;
    --orange: #ffedd5;
    --pink: #fce7f3;
}

html {
    font-size: 14px;
}

body {
    margin: 0;
    font-family: "Inter", "Aptos", "Segoe UI", Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 32%),
        radial-gradient(circle at top right, rgba(232, 237, 242, 0.52), transparent 24%),
        linear-gradient(180deg, #f9fbfd 0%, #f3f6f9 100%);
    color: var(--text);
    position: relative;
    overflow-x: hidden;
    font-feature-settings: "ss01" 1, "cv05" 1;
    text-rendering: optimizeLegibility;
    letter-spacing: 0.006em;
    line-height: 1.48;
}

body.mobile-nav-open {
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
    opacity: 0.08;
    z-index: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong {
    color: var(--on-surface);
}

body.is-loading .content-panel {
    opacity: 0.68;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.88), transparent 35%),
    linear-gradient(180deg, #f9fbfd 0%, #eef3f7 100%);
}

.auth-card,
.card {
    background: var(--panel);
    border-radius: var(--radius-xl);
    border: 0;
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(390px, 100%);
    padding: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(248, 250, 252, 0.7) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06), var(--shadow);
}

.auth-stack {
    gap: 14px;
}

.auth-eyebrow {
    margin-bottom: 10px;
}

.auth-demo {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
    font-size: 0.82rem;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    gap: 16px;
    padding: 14px;
    position: relative;
    z-index: 1;
}

.app-shell.role-superadmin .sidebar {
    background:
        radial-gradient(circle at top left, rgba(219, 234, 254, 0.58), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, #eff5fb 100%);
    box-shadow: 0 28px 54px -10px rgba(11, 53, 120, 0.16);
}

.app-shell.role-superadmin .topbar-title h1 {
    color: #0b3d91;
}

.app-shell.role-superadmin .topbar-user {
    background: linear-gradient(135deg, rgba(243, 248, 255, 0.88), rgba(233, 242, 255, 0.9));
    box-shadow: inset 0 0 0 1px rgba(11, 61, 145, 0.16), var(--shadow-soft);
}

.app-shell.role-superadmin .content-panel {
    border: 1px solid rgba(11, 61, 145, 0.12);
}

.app-shell.role-superadmin .sidebar-link.active .nav-icon {
    background: #0b3d91;
}

.sidebar {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 28%),
        var(--sidebar);
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 14px;
    align-self: start;
    overflow: hidden;
}

.sidebar-brand {
    padding: 6px 8px 14px;
}

.sidebar-brand-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.018em;
}

.brand-subtitle {
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.5;
}

.mobile-menu-trigger {
    display: none;
}

.mobile-menu-trigger svg,
.sidebar-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-close {
    width: 34px;
    height: 34px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
    color: #334155;
    cursor: pointer;
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1040;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.sidebar-section-label {
    padding: 10px 14px 2px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 800;
}

.sidebar-link,
.sidebar-logout {
    width: 100%;
    border: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    color: #4a5565;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover,
.sidebar-logout:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06), 0 10px 22px -10px rgba(17, 24, 39, 0.18);
    color: var(--on-surface);
    transform: translateY(0);
}

.nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 800;
    flex: none;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-link.active .nav-icon {
    background: #111827;
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(243, 246, 249, 0.96) 100%);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #111827, #475569);
    color: #fff;
    font-weight: 800;
}

.avatar.small {
    width: 44px;
    height: 44px;
    border-radius: 8px;
}

.main-area {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    padding: 8px 4px;
}

.topbar-title h1 {
    margin: 0;
    font-size: clamp(1.35rem, 1.6vw, 1.8rem);
    font-weight: 850;
    letter-spacing: -0.02em;
}

.topbar-title p {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06), var(--shadow-soft);
    color: #475569;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06), var(--shadow-soft);
}

.content-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(244, 247, 250, 0.72) 100%);
    backdrop-filter: blur(18px);
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.content-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.06), transparent 26%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 28%);
    pointer-events: none;
}

.content-panel-loading {
    position: relative;
}

.content-panel-loading::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 18px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid #d1d5db;
    border-top-color: #111827;
    animation: spin 0.7s linear infinite;
}

.card {
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    align-items: center;
    gap: 20px;
    background:
        radial-gradient(circle at top right, rgba(0, 57, 127, 0.06), transparent 26%),
        radial-gradient(circle at bottom left, rgba(0, 0, 0, 0.04), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.55fr);
    gap: 30px;
    align-items: stretch;
    padding: 30px 32px;
}

.dashboard-hero-copy {
    display: grid;
    align-content: start;
    gap: 8px;
    max-width: 760px;
}

.dashboard-hero-copy h2 {
    margin-top: 6px;
}

.dashboard-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.dashboard-hero-aside {
    display: grid;
    gap: 16px;
    align-content: start;
}

.dashboard-hero-stat {
    padding: 18px 20px;
    border-radius: 10px;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.8), transparent 28%),
        linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
}

.dashboard-hero-stat span {
    display: block;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.dashboard-hero-stat strong {
    display: block;
    margin-top: 10px;
    font-size: 1.85rem;
    font-weight: 850;
    letter-spacing: -0.015em;
}

.dashboard-hero-stat p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.dashboard-flow {
    display: grid;
    gap: 28px;
}

.dashboard-quick-actions {
    padding: 22px 24px;
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(247, 249, 251, 0.94) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05), var(--shadow-soft);
    display: grid;
    gap: 18px;
}

.dashboard-quick-actions-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.dashboard-quick-actions .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard-ai-panel {
    display: grid;
    gap: 18px;
}

.dashboard-ai-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-ai-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dashboard-ai-coverage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-ai-coverage .mini-item {
    min-height: 100%;
}

.dashboard-ai-summary {
    padding: 18px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 248, 251, 0.96) 100%);
}

.dashboard-ai-summary strong {
    display: block;
    margin-bottom: 10px;
}

.dashboard-ai-summary p {
    margin: 0;
    color: #334155;
    line-height: 1.7;
}

.dashboard-ai-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-ai-list {
    margin: 14px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    color: #334155;
}

.dashboard-ai-list li {
    line-height: 1.6;
}

.dashboard-metrics .metric-card:nth-child(1) {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.03) 0%, #ffffff 28%);
}

.dashboard-metrics .metric-card:nth-child(2) {
    background: linear-gradient(180deg, rgba(0, 108, 73, 0.08) 0%, #ffffff 28%);
}

.dashboard-metrics .metric-card:nth-child(3) {
    background: linear-gradient(180deg, rgba(0, 57, 127, 0.08) 0%, #ffffff 28%);
}

.dashboard-panel {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.7), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(249, 250, 252, 0.97) 100%);
    padding: 26px 28px;
}

.dashboard-panel-primary {
    border-color: rgba(216, 180, 254, 0.38);
}

.dashboard-panel-secondary {
    border-color: rgba(148, 163, 184, 0.26);
}

.dashboard-action-grid .feature-tile {
    min-height: 160px;
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05), var(--shadow-soft);
}

.dashboard-action-grid .feature-tile:nth-child(1) {
    background: linear-gradient(180deg, rgba(186, 26, 26, 0.08) 0%, #ffffff 28%);
}

.dashboard-action-grid .feature-tile:nth-child(2) {
    background: linear-gradient(180deg, rgba(0, 108, 73, 0.08) 0%, #ffffff 28%);
}

.dashboard-action-grid .feature-tile:nth-child(3) {
    background: linear-gradient(180deg, rgba(0, 57, 127, 0.08) 0%, #ffffff 28%);
}

.dashboard-action-grid .feature-tile:nth-child(4) {
    background: linear-gradient(180deg, rgba(186, 26, 26, 0.08) 0%, #ffffff 28%);
}

.dashboard-mini-list .mini-item,
.dashboard-payment-grid .feature-tile {
    min-height: 128px;
}

.dashboard-payment-grid .feature-tile {
    justify-content: space-between;
}

.dashboard-payment-grid .feature-tile .metric-value {
    margin-top: auto;
}

.hero-card h2 {
    margin: 0;
    font-size: clamp(2rem, 2.5vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: -0.022em;
}

.hero-card p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.hero-icon {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(226, 232, 240, 0.9)),
        linear-gradient(135deg, #f8fafc, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: #475569;
    justify-self: end;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), var(--shadow-soft);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.header h1,
.header h2,
.auth-card h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.016em;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.section-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #3730a3;
    font-weight: 800;
    flex: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.eyebrow {
    margin-bottom: 8px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 800;
}

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

.grid {
    display: grid;
    gap: 20px;
}

.grid.metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid.features {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid.asymmetric {
    grid-template-columns: 1.15fr 1fr;
}

.stack {
    display: grid;
    gap: 12px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
    padding: 20px 18px;
    min-height: 112px;
}

.metric-card:hover,
.feature-tile:hover,
.mini-item:hover,
.payment-outstanding-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    flex: none;
}

.metric-icon.blue { background: var(--blue); color: #1d4ed8; }
.metric-icon.green { background: var(--green); color: #166534; }
.metric-icon.purple { background: var(--purple); color: #6d28d9; }
.metric-icon.orange { background: var(--orange); color: #c2410c; }
.metric-icon.pink { background: var(--pink); color: #be185d; }

.metric-value {
    font-size: 1.45rem;
    font-weight: 800;
    margin: 6px 0 0;
    letter-spacing: -0.008em;
}

.metric-value.metric-value-text {
    font-size: 1.2rem;
    line-height: 1.3;
}

.feature-tile {
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 250, 252, 0.98) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05), var(--shadow-soft);
    padding: 18px;
    display: grid;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.feature-tile::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(17, 24, 39, 0.06), transparent);
    opacity: 0.22;
}

.resident-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.resident-hero h1 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.018em;
}

.resident-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.resident-stat {
    min-height: 150px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.resident-stat-label {
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #334155;
    font-weight: 800;
}

.resident-stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.012em;
}

.resident-stat-meta {
    color: var(--muted);
    font-weight: 600;
}

.resident-directory-shell {
    padding: 0;
    overflow: hidden;
}

.resident-mobile-list {
    display: none;
    gap: 14px;
    padding: 0 24px 24px;
}

.resident-mobile-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff 0%, #f9fafc 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.resident-mobile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.resident-mobile-meta div {
    display: grid;
    gap: 6px;
}

.resident-mobile-meta span {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.resident-directory-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 0;
}

.resident-directory-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.resident-directory-title h2 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: -0.015em;
}

.resident-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-weight: 700;
}

.resident-searchbar {
    min-width: min(400px, 100%);
}

.resident-searchbar label {
    display: none;
}

.resident-person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.resident-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #1e293b;
    font-weight: 800;
    flex: none;
}

.resident-table thead th {
    background: #f8fafc;
}

.resident-pill-row {
    display: grid;
    gap: 8px;
}

.resident-inline-note {
    font-size: 0.8rem;
    font-weight: 700;
}

.resident-form-page-head {
    align-items: flex-start;
}

.resident-form-card {
    padding: 22px;
}

.resident-form-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) 292px;
    gap: 18px;
}

.resident-form-main {
    display: grid;
    gap: 14px;
}

.resident-form-section {
    padding: 18px;
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.04), transparent 22%),
        linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    border: 1px solid #e8edf3;
    box-shadow: var(--shadow-soft);
}

.resident-form-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.resident-form-section-head h2,
.resident-guide-card h3 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: -0.01em;
}

.resident-form-section-head p {
    max-width: 320px;
    margin: 0;
}

.form-grid.form-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field small {
    color: #64748b;
    line-height: 1.45;
}

.field-error {
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 700;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.choice-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-card {
    position: relative;
    display: block;
    cursor: pointer;
}

.choice-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.choice-card span {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7dde5;
    background: #fff;
    font-weight: 700;
    color: #334155;
    text-align: center;
    transition: 0.18s ease;
}

.choice-card input:checked + span {
    border-color: #111827;
    background: #111827;
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.resident-form-aside {
    display: grid;
    gap: 16px;
    align-content: start;
}

.resident-guide-card {
    padding: 18px;
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(180deg, #111827 0%, #1f2937 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.resident-guide-card.soft {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: var(--text);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-soft);
}

.resident-guide-card.soft .eyebrow,
.resident-guide-card.soft .muted {
    color: #64748b;
}

.resident-guide-list {
    margin: 18px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    line-height: 1.55;
}

.resident-summary-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.resident-summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.resident-summary-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.resident-summary-list span {
    color: #64748b;
}

.resident-summary-list strong {
    text-align: right;
}

.resident-form-footer {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.feature-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.feature-head .metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
}

.mini-list {
    display: grid;
    gap: 16px;
}

.mini-item {
    padding: 20px 18px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.95) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.resident-dashboard-badges .badge {
    font-weight: 700;
}

.resident-dashboard-layout {
    align-items: start;
}

.resident-dashboard-main,
.resident-dashboard-side {
    gap: 18px;
}

.resident-dashboard-panel {
    display: grid;
    gap: 18px;
}

.resident-dashboard-highlight {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(248, 250, 252, 0.94) 0%, rgba(255, 255, 255, 0.98) 52%, rgba(241, 245, 249, 0.96) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
}

.resident-bill-overview {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 252, 0.95) 100%);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
}

.resident-bill-overview-detail {
    display: grid;
    gap: 6px;
}

.resident-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.resident-summary-tile {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
}

.resident-summary-tile strong {
    font-size: 1.1rem;
    line-height: 1.3;
}

.resident-summary-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.resident-bill-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    padding: 10px 16px;
    margin-top: 8px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.resident-bill-status-success {
    background: #dcfce7;
    color: #166534;
}

.resident-bill-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.resident-subsection-title {
    margin-top: 4px;
}

.resident-queue-list {
    gap: 12px;
}

.resident-queue-item {
    display: grid;
    gap: 8px;
}

.resident-queue-period,
.resident-queue-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.resident-queue-meta {
    color: #475569;
    font-size: 0.94rem;
}

.resident-payment-panel {
    background:
        radial-gradient(circle at top right, rgba(191, 219, 254, 0.24), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.resident-payment-shell {
    display: grid;
    grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
    gap: 18px;
    align-items: start;
}

.resident-payment-copy-card,
.resident-payment-form {
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
}

.resident-checklist {
    margin: 10px 0 0;
    padding-left: 18px;
    color: #475569;
    display: grid;
    gap: 10px;
}

.resident-checklist li {
    line-height: 1.55;
}

.resident-form-grid {
    align-items: end;
}

.resident-form-block {
    display: grid;
    gap: 6px;
}

.resident-proof-input {
    padding: 14px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.8);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.7), rgba(255, 255, 255, 0.95));
}

.change-log-form-layout {
    align-items: start;
}

.change-log-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.change-log-main {
    min-width: 0;
    flex: 1;
}

.change-log-meta {
    min-width: 180px;
    display: grid;
    gap: 4px;
    text-align: right;
}

.change-log-title-link {
    display: inline-block;
    color: var(--on-surface);
    font-size: 1.08rem;
    font-weight: 800;
    text-decoration: none;
}

.change-log-title-link:hover {
    color: var(--accent);
}

.change-log-audit-list {
    display: grid;
    gap: 10px;
    max-height: 480px;
    overflow: auto;
    padding-right: 4px;
}

.change-log-audit-option,
.change-log-reference-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
}

.change-log-reference-card {
    grid-template-columns: 1fr;
}

.change-log-audit-check {
    padding-top: 3px;
}

.change-log-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.change-log-detail-meta div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.92);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
}

.change-log-detail-meta span {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.change-log-detail-body {
    white-space: pre-line;
    line-height: 1.7;
    color: #334155;
}

.resident-bill-list-item {
    align-items: center;
}

.resident-transaction-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.resident-transaction-amount {
    font-weight: 800;
    white-space: nowrap;
}

.resident-transaction-amount-income {
    color: #166534;
}

.resident-transaction-amount-expense {
    color: #b45309;
}

.nav,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: 0;
    border-radius: var(--radius-lg);
    padding: 9px 14px;
    background: var(--surface-container-lowest);
    color: var(--on-surface);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.06), var(--shadow-soft);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn.primary {
    background: linear-gradient(135deg, #000000 0%, #333b50 100%);
    color: #fff;
    box-shadow: 0 18px 34px -10px rgba(17, 24, 39, 0.28);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.btn.tertiary {
    background: transparent;
    box-shadow: none;
    color: var(--on-surface-variant);
    text-decoration: underline;
    text-decoration-color: rgba(71, 71, 71, 0.45);
    text-underline-offset: 4px;
}

.btn.tertiary:hover {
    color: var(--on-surface);
    text-decoration-color: rgba(0, 0, 0, 0.8);
}

.filters,
.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

input,
select,
textarea {
    width: 100%;
    border: 0;
    background: var(--surface-container-low);
    border-radius: 10px;
    padding: 9px 11px;
    color: var(--on-surface);
    letter-spacing: 0.008em;
    box-shadow: inset 0 0 0 1px rgba(198, 198, 198, 0);
    transition: box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: var(--surface-container-lowest);
    box-shadow: inset 0 0 0 1px rgba(198, 198, 198, 0.15), 0 0 0 4px rgba(0, 57, 127, 0.1);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

th,
td {
    text-align: left;
    padding: 11px 8px;
    border-bottom: 0;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
}

tbody tr {
    background: rgba(255, 255, 255, 0.86);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05);
}

tbody tr td:first-child {
    border-radius: 10px 0 0 10px;
}

tbody tr td:last-child {
    border-radius: 0 10px 10px 0;
}

tbody tr:hover {
    background: #fbfcfd;
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap.table-compact table {
    border-spacing: 0 6px;
}

.table-wrap.table-compact th,
.table-wrap.table-compact td {
    padding: 9px 8px;
}

.table-wrap.table-compact tbody tr td:first-child {
    border-radius: 8px 0 0 8px;
}

.table-wrap.table-compact tbody tr td:last-child {
    border-radius: 0 8px 8px 0;
}

.table-wrap.table-compact tbody tr {
    background: rgba(255, 255, 255, 0.9);
}

:where(a, button, .btn, input, select, textarea, .sidebar-link, .sidebar-logout):focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.96), 0 0 0 5px rgba(0, 57, 127, 0.35);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.badge.success {
    background: rgba(0, 108, 73, 0.1);
    color: var(--accent-success);
}

.badge.warning {
    background: rgba(186, 26, 26, 0.1);
    color: #9f3a24;
}

.badge.neutral {
    background: rgba(71, 71, 71, 0.1);
    color: #374151;
}

.badge.danger {
    background: rgba(186, 26, 26, 0.1);
    color: var(--accent-error);
}

.badge.info {
    background: rgba(0, 57, 127, 0.1);
    color: var(--accent-info);
}

.cash-chart {
    min-height: 250px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    padding: 18px;
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 24%),
        linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
    border: 1px solid var(--line);
}

.cash-chart-group {
    display: grid;
    gap: 10px;
    justify-items: center;
}

.cash-chart-bars {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 10px;
}

.cash-bar {
    width: calc(50% - 5px);
    min-width: 18px;
    border-radius: 10px 10px 4px 4px;
    box-shadow: var(--shadow-soft);
}

.cash-bar.income {
    background: linear-gradient(180deg, #bbf7d0 0%, #22c55e 100%);
}

.cash-bar.expense {
    background: linear-gradient(180deg, #fde68a 0%, #f97316 100%);
}

.cash-chart-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
}

.payment-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.2fr);
    gap: 18px;
    align-items: start;
}

.payment-column {
    align-self: start;
}

.payment-column-list {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    min-height: 0;
}

.payment-column-detail {
    position: sticky;
    top: 22px;
}

.payment-column-list-head {
    display: grid;
    gap: 16px;
    flex: none;
}

.payment-outstanding-scroll {
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #dbe3ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.payment-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.payment-filter {
    min-width: min(280px, 100%);
}

.payment-summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.payment-bulk-form {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 16px;
}

.payment-bulk-bar {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    padding: 16px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 247, 250, 0.96) 100%);
    border: 1px solid #dbe3ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.payment-bulk-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.payment-bulk-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.payment-bulk-checkbox {
    padding-top: 4px;
}

.payment-bulk-checkbox input {
    width: 18px;
    height: 18px;
}

.payment-search-box {
    display: grid;
    gap: 8px;
}

.payment-bulk-list {
    display: grid;
    gap: 12px;
}

.payment-outstanding-list {
    display: grid;
    gap: 12px;
}

.payment-outstanding-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.payment-outstanding-scroll::-webkit-scrollbar-track {
    background: rgba(203, 213, 225, 0.55);
    border-radius: 999px;
}

.payment-outstanding-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    border-radius: 999px;
    border: 2px solid rgba(248, 250, 252, 0.98);
}

.payment-outstanding-scroll::before,
.payment-outstanding-scroll::after {
    content: "";
    position: sticky;
    left: 0;
    right: 0;
    height: 18px;
    display: block;
    z-index: 2;
    pointer-events: none;
}

.payment-outstanding-scroll::before {
    top: -12px;
    margin-bottom: -18px;
    background: linear-gradient(180deg, rgba(238, 242, 247, 0.98) 0%, rgba(238, 242, 247, 0) 100%);
}

.payment-outstanding-scroll::after {
    bottom: -12px;
    margin-top: -18px;
    background: linear-gradient(0deg, rgba(238, 242, 247, 0.98) 0%, rgba(238, 242, 247, 0) 100%);
}

.payment-outstanding-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff 0%, #f9fafc 100%);
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.payment-outstanding-item.is-paid {
    opacity: 0.9;
}

.payment-outstanding-item.is-filter-hidden {
    display: none !important;
}

.payment-outstanding-item.selected {
    border-color: #111827;
    background:
        radial-gradient(circle at top right, rgba(17, 24, 39, 0.04), transparent 28%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.payment-outstanding-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.payment-outstanding-meta {
    display: grid;
    gap: 6px;
    text-align: right;
}

.payment-detail-link {
    display: inline-block;
}

.payment-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.payment-detail-card {
    padding: 18px;
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.04), transparent 22%),
        linear-gradient(180deg, #fafbfd 0%, #f3f6fa 100%);
    border: 1px solid var(--line);
}

.payment-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.payment-detail-grid div {
    display: grid;
    gap: 6px;
}

.payment-detail-grid span {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Legacy vote classes (used by admin views) ─────────────────────── */
.vote-list {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: var(--surface-container-low);
    border-radius: 12px;
}

.vote-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 10px;
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.05), var(--shadow-soft);
    transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.vote-card:hover {
    background: #fbfcfd;
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.07), var(--shadow);
}

.vote-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.vote-card-head h3 {
    margin: 10px 0 8px;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.vote-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vote-stats {
    min-width: 110px;
    text-align: right;
}

.vote-stats strong {
    display: block;
    font-size: 1.45rem;
    letter-spacing: -0.01em;
}

.vote-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    background: var(--surface-container-low);
}

.vote-detail-grid div {
    display: grid;
    gap: 6px;
}

.vote-detail-grid span {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.vote-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vote-option-row input {
    flex: 1;
    width: auto;
}

.btn-remove-option {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 0;
    background: var(--surface-container-lowest);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.1);
    color: #ef4444;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
    padding: 0;
}

.btn-remove-option:hover:not(:disabled) {
    background: #fef2f2;
    box-shadow: inset 0 0 0 1px rgba(186, 26, 26, 0.25);
}

.btn-remove-option:disabled {
    color: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
    cursor: not-allowed;
}

/* Admin vote creation form — tighter spacing */
.vote-create-card.stack {
    gap: 8px;
    align-self: start;
}

.vote-create-form.stack {
    gap: 10px;
}

.vote-create-form .form-grid {
    gap: 10px;
}

.vote-create-form label {
    margin-bottom: 4px;
}

.vote-create-form .stack {
    gap: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    flex: none;
}

.vote-choice-confirmation {
    padding: 14px 16px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-weight: 700;
}

.vote-results-list {
    display: grid;
    gap: 16px;
}

.vote-result-row {
    display: grid;
    gap: 10px;
}

.vote-result-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.vote-progress {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
}

.vote-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #111827 0%, #475569 100%);
}

/* ── Resident Voting Portal — redesigned ─────────────────────────────── */

.vp-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.vp-hero h1 {
    margin: 4px 0 6px;
}

.vp-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.vp-list {
    display: grid;
    gap: 18px;
}

/* ── Vote card ── */

.vp-card {
    display: grid;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.06), var(--shadow-soft);
}

.vp-card--open {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, var(--surface-container-lowest) 26%);
}

.vp-card--voted {
    background: linear-gradient(180deg, rgba(0, 108, 73, 0.08) 0%, var(--surface-container-lowest) 24%);
}

.vp-card--pending {
    background: linear-gradient(180deg, rgba(186, 26, 26, 0.08) 0%, var(--surface-container-lowest) 24%);
}

/* ── Card header ── */

.vp-card-header {
    padding: 22px 22px 18px;
}

.vp-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}

.vp-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
    line-height: 1.3;
}

.vp-card-desc {
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.6;
}

/* ── Period bar ── */

.vp-period {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 22px;
    background: var(--surface-container-low);
    flex-wrap: wrap;
}

.vp-period-item {
    display: grid;
    gap: 2px;
}

.vp-period-item strong {
    font-size: 0.85rem;
}

.vp-period-label {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.vp-period-divider {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.vp-period-spacer {
    flex: 1;
}

.vp-period-item--right {
    text-align: right;
}

/* ── Notices ── */

.vp-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 22px;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-top: 8px;
    border-radius: 10px;
    margin-left: 14px;
    margin-right: 14px;
}

.vp-notice--pending {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* ── Voted confirmation ── */

.vp-voted-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 22px;
    background: #f0fdf4;
    margin: 8px 14px 0;
    border-radius: 10px;
    color: #15803d;
}

.vp-voted-banner svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.vp-voted-option {
    font-size: 0.82rem;
    margin-top: 3px;
    opacity: 0.8;
}

/* ── Options ── */

.vp-options {
    display: grid;
    gap: 10px;
    padding: 18px 22px 0;
}

.vp-option {
    display: block;
    cursor: pointer;
}

.vp-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vp-option-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.vp-option:hover .vp-option-inner {
    border-color: #94a3b8;
    background: #f8fafc;
}

.vp-option input:checked + .vp-option-inner {
    border-color: #111827;
    background: #111827;
    box-shadow: 0 2px 12px rgba(17, 24, 39, 0.18);
}

.vp-option input:checked + .vp-option-inner .vp-option-label {
    color: #fff;
}

.vp-option input:checked + .vp-option-inner .vp-option-radio {
    border-color: #fff;
    background: #fff;
}

.vp-option input:checked + .vp-option-inner .vp-option-check {
    opacity: 1;
    color: #111827;
}

.vp-option-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.vp-option-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.92rem;
    color: #1e293b;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.vp-option-check {
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
    background: #fff;
    border-radius: 50%;
    padding: 1px;
}

/* ── Submit row ── */

.vp-submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px 22px;
    flex-wrap: wrap;
}

.vp-submit-btn {
    min-width: 140px;
}

.vp-submit-hint {
    font-size: 0.8rem;
}

/* ── Results link ── */

.vp-results-link {
    padding: 14px 22px;
}

.vp-results-anchor {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: color 0.15s ease;
}

.vp-results-anchor:hover {
    color: #111827;
}

/* ── Empty state ── */

.vp-empty {
    padding: 48px 20px;
    text-align: center;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.vp-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    margin-bottom: 14px;
}

.vp-empty strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 6px;
}

/* ── Results page ── */

.vr-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.vr-summary-item {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.05);
    display: grid;
    gap: 4px;
}

.vr-summary-item:last-child {
    border-right: 0;
}

.vr-summary-label {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.vr-summary-value {
    font-size: 0.97rem;
    font-weight: 700;
    color: #111827;
}

.vr-results-card {
    padding: 0;
    overflow: hidden;
}

.vr-results-list {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: var(--surface-container-low);
}

.vr-row {
    padding: 18px 20px;
    display: grid;
    gap: 12px;
    border-radius: 10px;
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.05);
    transition: background 0.12s ease;
}

.vr-row:last-child {
    border-bottom: 0;
}

.vr-row--winner {
    background: linear-gradient(180deg, rgba(0, 108, 73, 0.08) 0%, #f8fffe 100%);
}

.vr-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.vr-row-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vr-winner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
}

.vr-row-title {
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
}

.vr-row-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.vr-pct {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #475569;
    line-height: 1;
}

.vr-pct--winner {
    color: #15803d;
}

.vr-count {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

.vr-bar-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #dde2e8;
    overflow: hidden;
}

.vr-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #334155 0%, #64748b 100%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

.vr-bar--winner {
    background: linear-gradient(90deg, #15803d 0%, #22c55e 100%);
}

/* ── Voting responsive ──────────────────────────────────────────────── */

@media (max-width: 720px) {
    .vp-period {
        gap: 8px 16px;
    }

    .vp-period-spacer {
        display: none;
    }

    .vp-period-item--right {
        text-align: left;
    }

    .vp-options {
        padding: 14px 14px 0;
    }

    .vp-card-header {
        padding: 18px 14px 14px;
    }

    .vp-period {
        padding: 12px 14px;
    }

    .vp-voted-banner,
    .vp-notice,
    .vp-results-link {
        padding-left: 14px;
        padding-right: 14px;
    }

    .vp-submit-row {
        padding: 14px 14px 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .vp-submit-btn {
        width: 100%;
    }

    .vr-summary {
        flex-direction: column;
    }

    .vr-summary-item {
        border-right: 0;
        border-bottom: 0;
    }

    .vr-summary-item:last-child {
        border-bottom: 0;
    }

    .vr-row {
        padding: 18px 16px;
    }

    .vr-pct {
        font-size: 1.2rem;
    }
}

.alert {
    padding: 15px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert.success {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.actions form {
    margin: 0;
}

.empty {
    padding: 30px 16px;
    text-align: center;
    color: var(--muted);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(243, 246, 250, 0.92) 100%);
    border: 1px dashed rgba(203, 213, 225, 0.9);
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.pagination-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
}

.pagination-links .active {
    background: var(--accent);
    color: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .mobile-menu-trigger {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(84vw, 320px);
        max-width: 320px;
        height: 100dvh;
        border-radius: 0 16px 16px 0;
        transform: translateX(-108%);
        transition: transform 0.24s ease;
        z-index: 1060;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-top: 14px;
    }

    .sidebar-close {
        display: inline-flex;
    }

    body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    body.mobile-nav-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .grid.asymmetric {
        grid-template-columns: 1fr;
    }

    .grid.metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-hero,
    .dashboard-quick-actions-head,
    .dashboard-ai-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-hero-aside {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-panel,
    .dashboard-hero,
    .dashboard-quick-actions,
    .dashboard-ai-panel {
        padding: 22px;
    }

    .resident-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .resident-directory-top,
    .resident-hero,
    .resident-form-section-head,
    .resident-form-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .resident-searchbar {
        min-width: 100%;
        width: 100%;
    }

    .payment-workspace,
    .payment-detail-grid,
    .dashboard-ai-grid,
    .dashboard-ai-coverage {
        grid-template-columns: 1fr;
    }

    .payment-bulk-fields {
        grid-template-columns: 1fr 1fr;
    }

    .payment-column-list {
        max-height: none;
        overflow: visible;
    }

    .payment-column-detail {
        position: static;
        top: auto;
    }

    .payment-outstanding-scroll {
        max-height: none;
        overflow: visible;
        margin-top: 16px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .payment-panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-bulk-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-filter {
        min-width: 100%;
        width: 100%;
    }

    .vote-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .vote-stats {
        text-align: left;
    }

    .resident-form-shell {
        grid-template-columns: 1fr;
    }

    .choice-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.form-grid-wide {
        grid-template-columns: 1fr;
    }

    .cash-chart {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        gap: 16px;
        padding: 14px;
    }

    .content-panel {
        padding: 18px;
        border-radius: 26px;
    }

    .dashboard-flow {
        gap: 20px;
    }

    .dashboard-panel,
    .dashboard-hero,
    .dashboard-quick-actions,
    .dashboard-ai-panel,
    .metric-card,
    .feature-tile,
    .mini-item {
        padding: 18px;
    }

    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .topbar-tools {
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
    }

    .topbar-user {
        min-width: 0;
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .grid.metrics {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-aside {
        grid-template-columns: 1fr;
    }

    .resident-metrics {
        grid-template-columns: 1fr;
    }

    .resident-directory-top {
        padding-bottom: 18px;
    }

    .resident-mobile-list {
        display: grid;
    }

    .resident-table,
    .payment-history-table table {
        min-width: 680px;
    }

    .resident-form-card,
    .resident-form-section,
    .resident-guide-card {
        padding: 18px;
    }

    .resident-bill-overview,
    .resident-transaction-item {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }

    .resident-summary-grid,
    .resident-payment-shell,
    .change-log-detail-meta {
        grid-template-columns: 1fr;
    }

    .resident-queue-period,
    .resident-queue-meta,
    .change-log-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .change-log-meta {
        min-width: 0;
        text-align: left;
    }

    .payment-bulk-fields {
        grid-template-columns: 1fr;
    }

    .choice-grid,
    .choice-grid-four {
        grid-template-columns: 1fr;
    }

    .cash-chart {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-icon {
        justify-self: start;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    th,
    td {
        white-space: nowrap;
    }
}

/* ── Magic Link / WhatsApp Invite UI ─────────────────────────────────── */

.btn.wa-btn {
    background: #25d366;
    color: #fff;
    border-color: #25d366;
}

.btn.wa-btn:hover {
    background: #1ebe5b;
    border-color: #1ebe5b;
}

.magic-link-flash {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.magic-link-flash-inner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.magic-link-flash-url {
    font-size: 0.78rem;
    word-break: break-all;
    margin-top: 4px;
    max-width: 540px;
}

.magic-link-flash-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.flash.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 12px 16px;
    color: #991b1b;
    font-size: 0.85rem;
}

.magic-link-card {
    padding: 18px 20px;
}

.magic-link-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.magic-link-hint {
    font-size: 0.8rem;
    line-height: 1.5;
}

.magic-link-card-disabled {
    padding: 14px 18px;
}

/* Expired token page */
.magic-link-expired-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 16px 20px;
    font-size: 0.88rem;
    line-height: 1.6;
}

.magic-link-expired-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.magic-link-expired-box ul {
    margin: 6px 0 10px 18px;
    padding: 0;
}

.magic-link-expired-box li {
    margin-bottom: 3px;
}

@media (max-width: 720px) {
    .magic-link-flash-inner {
        flex-direction: column;
    }

    .magic-link-card-head {
        flex-direction: column;
    }
}
