/* Síndico Digital — mobile-first, poucas cores, textos e botões grandes. */
:root {
    --primary: #1d4ed8;
    --primary-strong: #1e40af;
    --primary-soft: #e8efff;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #5b6577;
    --border: #e2e7ef;
    --green: #15803d;
    --green-soft: #e7f6ec;
    --red: #b91c1c;
    --red-soft: #fdecec;
    --amber: #a15c07;
    --amber-soft: #fdf3e2;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
    --tap: 52px;
    --bottombar-h: 68px;
    color-scheme: light;
}

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

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1, h2, strong { overflow-wrap: anywhere; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); }
h1:focus { outline: none; }

.muted { color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: .9rem; margin-top: .75rem; }
.center { text-align: center; }
.mt { margin-top: .75rem; }
.mt-lg { margin-top: 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex-shrink: 0; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: var(--tap); padding: 0 1.25rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 0 .75rem; }
.btn-ghost:hover { color: var(--text); background: rgba(15, 23, 42, .04); }
.btn-link { background: none; color: var(--primary); font-weight: 500; }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.1rem; }
.btn-sm { min-height: 40px; padding: 0 .9rem; font-size: .9rem; }

/* ---------- Formulários ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field > span { font-weight: 600; font-size: .95rem; }
.field input, .field select {
    min-height: var(--tap); padding: 0 .9rem; font: inherit;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text);
}
.field input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; align-items: center; gap: .6rem; margin: .25rem 0 1.25rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }

/* ---------- Cartões / blocos ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.page.narrow, .content.narrow { max-width: 560px; margin-inline: auto; width: 100%; }
.page-head { display: grid; gap: .25rem; }
.section { display: grid; gap: .75rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.group-title { font-size: .95rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.alert { display: flex; gap: .75rem; padding: .9rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-strong { margin: 0; border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }

.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge-paid { background: var(--green-soft); color: var(--green); }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-neutral { background: #eef1f5; color: var(--text-muted); }
.soon { margin-left: auto; white-space: nowrap; font-size: .7rem; color: var(--text-muted); background: #eef1f5; padding: .1rem .45rem; border-radius: 999px; }

.ok-card { display: flex; align-items: center; gap: .6rem; color: var(--green); background: var(--green-soft); padding: 1rem; border-radius: var(--radius-sm); font-weight: 600; }

.loading { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: 3rem 1rem; color: var(--text-muted); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2.5rem 1rem; display: grid; justify-items: center; gap: .6rem; }
.empty-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-body { color: var(--text-muted); max-width: 32ch; display: grid; justify-items: center; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--border); min-height: 64px; }
.list-item:last-child { border-bottom: 0; }
.list-item.is-overdue { box-shadow: inset 4px 0 0 var(--red); }
.list-main { display: grid; gap: .15rem; min-width: 0; }
.list-main small { color: var(--text-muted); font-size: .88rem; }
.list-side { display: grid; justify-items: end; gap: .3rem; text-align: right; }

/* ---------- Topo / navegação ---------- */
.dev-banner { background: #fff7d6; color: #6b4e00; font-size: .8rem; text-align: center; padding: .3rem 1rem; }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar-action { margin-left: auto; }
.topbar-context { color: var(--text-muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-name { white-space: nowrap; }
@media (max-width: 899px) { .admin .brand-name, .platform .brand-name { display: none; } }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 800; font-size: .85rem; letter-spacing: .02em; }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.35rem; }
.condo-select { min-height: 40px; max-width: 50vw; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 .5rem; font: inherit; font-size: .9rem; background: #fff; }
.back-link { padding-left: .25rem; color: var(--primary); }
.content { min-width: 0; padding: 1.25rem 1rem calc(var(--bottombar-h) + 1.5rem); width: 100%; max-width: 1080px; margin-inline: auto; }
.resident .content, .platform .content { padding-bottom: 2rem; }

.sidebar { display: none; }
.bottombar {
    position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--border);
}
.tab { display: grid; justify-items: center; align-content: center; gap: .2rem; font: inherit; font-size: .72rem; color: var(--text-muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
.tab.active { color: var(--primary); font-weight: 700; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 25; }
.sheet { position: fixed; left: 0; right: 0; bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); z-index: 26; background: #fff; border-radius: 20px 20px 0 0; padding: .5rem; display: grid; }
.sheet-link { display: flex; align-items: center; gap: .9rem; min-height: 56px; padding: 0 1rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.sheet-link:hover { background: var(--bg); }

@media (min-width: 900px) {
    .app-shell.admin { grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .admin .topbar { grid-column: 1 / -1; }
    .sidebar { display: grid; align-content: start; gap: .2rem; padding: 1rem .75rem; border-right: 1px solid var(--border); background: #fff; position: sticky; top: 57px; height: calc(100dvh - 57px); }
    .side-link { display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: 0 .9rem; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-weight: 550; }
    .side-link:hover { background: var(--bg); color: var(--text); }
    .side-link.active { background: var(--primary-soft); color: var(--primary); }
    .bottombar { display: none; }
    .content { min-width: 0; padding: 2rem; }
}

/* ---------- Login / escolha ---------- */
.public-shell { min-height: 100dvh; padding: 1.5rem 1rem; display: grid; align-content: center; }
.login-wrap { width: 100%; max-width: 420px; margin: 0 auto; display: grid; gap: 1.5rem; }
.login-brand { text-align: center; display: grid; justify-items: center; gap: .5rem; }
.login-footnote { text-align: center; color: var(--text-muted); font-size: .9rem; }
.greeting { font-size: 1.75rem; }
.choice-list, .big-actions { display: grid; gap: .75rem; }
.choice, .big-action {
    display: flex; align-items: center; gap: 1rem; min-height: 72px; padding: .9rem 1.1rem;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text);
}
.choice:hover, .big-action:hover { box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow); }
.choice > span:nth-child(2) { display: grid; }
.choice small { color: var(--text-muted); }
.choice-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.choice-chevron { margin-left: auto; color: var(--text-muted); }
.big-action { font-weight: 650; font-size: 1.05rem; }
.big-action > .icon:first-child { color: var(--primary); }

/* ---------- Painel do síndico ---------- */
.hero { background: linear-gradient(135deg, var(--primary), #2563eb); color: #fff; display: grid; gap: .4rem; }
.hero-label { opacity: .9; }
.hero-value { font-size: 2.1rem; font-weight: 750; letter-spacing: -.02em; }
.hero-foot { opacity: .9; font-size: .92rem; }
.progress { height: 10px; background: rgba(255, 255, 255, .25); border-radius: 999px; overflow: hidden; margin-top: .35rem; }
.progress > span { display: block; height: 100%; background: #fff; border-radius: inherit; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: grid; gap: .1rem; color: var(--text-muted); }
.stat strong { font-size: 1.9rem; color: var(--text); line-height: 1.1; }
.stat .icon { margin-bottom: .3rem; }
.stat-paid .icon { color: var(--green); }
.stat-pending .icon { color: var(--amber); }
.stat-overdue .icon { color: var(--red); }
.stat-overdue strong { color: var(--red); }
.stat-overdue { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--red) 30%, transparent), var(--shadow); }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.search input { width: 100%; }

/* ---------- Morador ---------- */
.unit-card { display: grid; gap: .9rem; }
.unit-context { color: var(--text-muted); font-size: .95rem; }
.unit-label { font-size: 1.2rem; font-weight: 700; margin-top: -.6rem; }
.charge-box { display: grid; justify-items: center; gap: .3rem; text-align: center; background: var(--primary-soft); border-radius: var(--radius-sm); padding: 1.25rem 1rem; }
.charge-box.is-overdue { background: var(--red-soft); }
.charge-title { text-transform: uppercase; font-size: .8rem; font-weight: 700; letter-spacing: .06em; color: var(--text-muted); }
.charge-amount { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.charge-meta { color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; color: var(--text); }
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.details { display: grid; grid-template-columns: 1fr; gap: .2rem; margin: 0; }
.details dt { color: var(--text-muted); font-size: .85rem; margin-top: .6rem; }
.details dt:first-child { margin-top: 0; }
.details dd { margin: 0; font-weight: 600; }

/* ---------- Feedback ---------- */
.toast-region { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottombar-h) + 1rem); z-index: 50; width: min(92vw, 420px); }
.toast { display: flex; gap: .6rem; align-items: center; padding: .9rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); color: #fff; font-weight: 600; animation: rise .2s ease-out; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Carregamento inicial (antes do Blazor) ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--text-muted); }
.boot .brand-mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

#blazor-error-ui {
    background: #fff7d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .8rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .6rem; }

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

/* ---------- Etapa 2: formulários e ações ---------- */
.small { font-size: .85rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: .25rem; }
.panel h2 { margin-bottom: .5rem; }
.field textarea { min-height: 96px; padding: .75rem .9rem; font: inherit; border: 1.5px solid var(--border); border-radius: var(--radius-sm); resize: vertical; }
.field textarea:focus, .field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.field-row { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .field-row.two { grid-template-columns: 1fr 1fr; } .field-row.three { grid-template-columns: 2fr 1fr 1fr; } }
.list-item.clickable { cursor: pointer; text-decoration: none; color: inherit; }
.list-item.clickable:hover { background: var(--bg); }
.list-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.confirm-row { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.confirm-text { font-size: .9rem; color: var(--red); font-weight: 600; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--amber-soft); color: var(--amber); }
.qr { display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm); padding: .75rem; border: 1px solid var(--border); }
.qr svg { width: 200px; height: 200px; max-width: 100%; }
.code-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; letter-spacing: .05em; background: var(--bg); padding: .6rem .8rem; border-radius: var(--radius-sm); word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.codes span { background: var(--bg); padding: .45rem .6rem; border-radius: 8px; text-align: center; }
.alert-info { background: var(--primary-soft); color: var(--primary-strong); }
.alert-success { background: var(--green-soft); color: var(--green); }
.otp input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.steps { color: var(--text-muted); padding-left: 1.2rem; margin: .25rem 0 .75rem; display: grid; gap: .3rem; }
.section-head .btn { min-height: 44px; }
/* Campos nunca forçam largura maior que a tela. */
.field > input, .field > select, .field > textarea { width: 100%; min-width: 0; }
.password-field { position: relative; display: flex; }
.password-field input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 5.5rem 0 .9rem; font: inherit; border: 1.5px solid var(--border); border-radius: var(--radius-sm); }
.password-field input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.password-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); min-height: 40px; padding: 0 .75rem; border: 0; border-radius: 8px; background: var(--bg); color: var(--primary); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }

/* ---------- Etapa 3: financeiro ---------- */
.month-nav { display: flex; align-items: center; gap: .25rem; }
.month-nav strong { min-width: 9.5rem; text-align: center; }
.small-money { font-size: 1.25rem !important; }
.cancel-form { display: grid; gap: .4rem; margin-top: .4rem; }
.cancel-form input { min-height: 40px; padding: 0 .6rem; border: 1.5px solid var(--border); border-radius: 8px; font: inherit; font-size: .9rem; }
.pay-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pay-choice .btn { min-height: 72px; flex-direction: column; gap: .2rem; font-size: 1.05rem; }
.pay-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .75rem; word-break: break-all; }
.sim-banner { background: #fff7d6; color: #6b4e00; border: 1px solid #f2d27a; border-radius: var(--radius-sm); padding: .75rem 1rem; font-size: .9rem; }
.sim-panel { border: 2px dashed #f2d27a; border-radius: var(--radius); padding: 1rem; display: grid; gap: .6rem; background: #fffdf3; }
.status-line { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.status-line.waiting { color: var(--amber); }
.status-line.done { color: var(--green); }
@media print {
  .topbar, .dev-banner, .no-print, .toast-region { display: none !important; }
  .content { padding: 0 !important; }
}
