/* =========================================================
   INMOBILIARIA ORTIZ — Hoja de estilos principal
   ========================================================= */

:root {
    /* Marca */
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --accent: #f59e0b;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

    /* Superficies y texto */
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --faint: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    --sidebar-text: #cbd5e1;
    --sidebar-muted: #64748b;
    --sidebar-width: 260px;

    /* Estados */
    --success: #059669;
    --success-50: #ecfdf5;
    --danger: #dc2626;
    --danger-600: #b91c1c;
    --danger-50: #fef2f2;
    --info: #2563eb;

    /* Forma */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -4px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .28);
    --ring: 0 0 0 4px rgba(79, 70, 229, .15);

    --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.pre-line { white-space: pre-line; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: middle; }

/* =========================================================
   Layout
   ========================================================= */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 40;
    transition: transform .25s var(--ease);
}
.sidebar-brand {
    display: flex; align-items: center; gap: .8rem;
    padding: 1.4rem 1.25rem;
    color: #fff;
}
.brand-logo {
    display: inline-grid; place-items: center;
    width: 42px; height: 42px; border-radius: var(--radius);
    background: var(--gradient); color: #fff;
    box-shadow: 0 8px 20px -6px rgba(124, 58, 237, .6);
}
.brand-logo .icon { width: 24px; height: 24px; }
.brand-logo-lg { width: 64px; height: 64px; border-radius: var(--radius-lg); }
.brand-logo-lg .icon { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: .95rem; }
.brand-sub { font-weight: 600; letter-spacing: .32em; font-size: .75rem; color: #a5b4fc; }

.sidebar-nav { padding: .5rem .85rem; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-section {
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
    color: var(--sidebar-muted); padding: 1rem .75rem .4rem;
}
.nav-link {
    position: relative;
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem .85rem; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link .nav-icon { width: 20px; height: 20px; color: #94a3b8; transition: color .15s; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link:hover .nav-icon { color: #e2e8f0; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, .35), rgba(124, 58, 237, .15));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .15);
}
.nav-link.active .nav-icon { color: #c7d2fe; }
.nav-link.active::before {
    content: ""; position: absolute; left: -.85rem; top: 22%; bottom: 22%;
    width: 4px; border-radius: 0 4px 4px 0; background: #a5b4fc;
}
.sidebar-footer {
    display: flex; justify-content: space-between;
    padding: 1rem 1.5rem; font-size: .75rem; color: var(--sidebar-muted);
    border-top: 1px solid rgba(255, 255, 255, .06);
}

/* ---------- Main / Topbar ---------- */
.main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 68px;
    background: rgba(255, 255, 255, .8);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem; padding: 0 2rem;
    position: sticky; top: 0; z-index: 20;
}
.topbar-date { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; flex: 1; }
.topbar-date .icon { color: var(--faint); }
.topbar-user { display: flex; align-items: center; gap: .5rem; }
.topbar-user form { margin: 0; }
.user-chip {
    display: flex; align-items: center; gap: .65rem;
    padding: .3rem .85rem .3rem .3rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: .875rem; }
.user-meta small { font-size: .75rem; color: var(--muted); }

.content { padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; width: 100%; max-width: 1400px; }

.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* Contenedor de página: separa header, cards y secciones de forma uniforme */
.page { display: flex; flex-direction: column; gap: 1.5rem; }

/* ---------- Encabezado de página ---------- */
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem 2rem; flex-wrap: wrap;
}
.page-title { font-size: 1.75rem; font-weight: 750; }
.page-subtitle { color: var(--muted); margin-top: .25rem; }

/* =========================================================
   Componentes
   ========================================================= */

/* ---------- Avatar ---------- */
.avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-100); color: var(--primary-600);
    font-weight: 700; font-size: .85rem; letter-spacing: .02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; background: var(--gradient); color: #fff; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; background: var(--gradient); color: #fff; }

/* ---------- Card ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow);
}
.card-flush { padding: 0; overflow: hidden; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .1s, color .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6); }
.btn-primary:hover { box-shadow: 0 10px 22px -6px rgba(79, 70, 229, .7); filter: brightness(1.05); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-600); }
.btn-ghost-danger { background: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-50); }
.btn-light { background: #fff; color: var(--primary-600); box-shadow: var(--shadow); }
.btn-light:hover { background: var(--primary-50); }
.btn-lg { padding: .85rem 1.25rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: transparent; border: none; color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
.icon-btn-danger:hover { background: var(--danger-50); color: var(--danger); }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.form-group label { font-weight: 600; font-size: .85rem; color: #334155; }
input, select, textarea {
    width: 100%;
    font: inherit; font-size: .925rem;
    padding: .68rem .85rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"], input[type="radio"] { width: auto; }

.input-icon { position: relative; }
.input-icon > .icon {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    color: var(--faint); pointer-events: none;
}
.input-icon > input { padding-left: 2.6rem; }

.form-section { border: none; padding: 0; margin: 0; min-width: 0; }
.form-section legend {
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); margin-bottom: .75rem; padding: 0;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.req { color: var(--danger); }

.field-error { color: var(--danger); font-size: .8rem; min-height: 0; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.has-error input:focus, .has-error select:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .12); }

.checkbox-group { display: flex; gap: .6rem; flex-wrap: wrap; }
.check-card {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem .95rem; border: 1px solid var(--border-strong); border-radius: 999px;
    cursor: pointer; font-weight: 500; font-size: .9rem; user-select: none;
    transition: all .15s;
}
.check-card input { accent-color: var(--primary); margin: 0; }
.check-card:hover { border-color: var(--primary); }
.check-card:has(input:checked) { background: var(--primary-50); border-color: var(--primary); color: var(--primary-600); }
.check-card:has(input:focus-visible) { box-shadow: var(--ring); }
.form-section.has-error .check-card { border-color: var(--danger); }

/* ---------- Alertas (login) ---------- */
.alert {
    display: flex; align-items: center; gap: .6rem;
    padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500;
}
.alert-error { background: var(--danger-50); color: var(--danger-600); }
.alert-success { background: var(--success-50); color: var(--success); }

/* ---------- Badges ---------- */
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.badge {
    display: inline-flex; align-items: center; padding: .2rem .6rem;
    border-radius: 999px; font-size: .72rem; font-weight: 650; letter-spacing: .01em;
    background: #f1f5f9; color: var(--muted);
}
.badge-comprador   { background: #dbeafe; color: #1d4ed8; }
.badge-vendedor    { background: #ffedd5; color: #c2410c; }
.badge-inquilino   { background: #ede9fe; color: #6d28d9; }
.badge-propietario { background: #d1fae5; color: #047857; }

/* ---------- Barra de filtros ---------- */
.filter-bar {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.filter-search { flex: 1 1 280px; max-width: 460px; }
.filter-search input { background: var(--surface-2); border-color: var(--border); }
.filter-search input:focus { background: var(--surface); }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-block; padding: .45rem .9rem; border-radius: 999px;
    font-size: .85rem; font-weight: 600; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border);
    transition: all .15s;
}
.chip:hover span { color: var(--text); border-color: var(--border-strong); }
.chip input:checked + span { background: var(--text); color: #fff; border-color: var(--text); }
.chip input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- Tabla ---------- */
.listado { transition: opacity .15s; }
.listado.is-loading { opacity: .45; pointer-events: none; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .9rem 1.25rem; text-align: left; vertical-align: middle; }
.table th {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { border-bottom: 1px solid #f1f5f9; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: #f8faff; }
.table tbody tr:last-child td { border-bottom: none; }
.col-actions { width: 1%; white-space: nowrap; text-align: right !important; }

.cell-person { display: flex; align-items: center; gap: .8rem; min-width: 220px; }
.cell-person > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.cell-person small { font-size: .8rem; }
.cell-stack { display: flex; flex-direction: column; gap: .15rem; font-size: .875rem; }
.cell-stack span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.cell-stack .icon { width: 14px; height: 14px; color: var(--faint); }

.row-actions { display: inline-flex; align-items: center; gap: .35rem; opacity: .55; transition: opacity .15s; }
.table tbody tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }

.list-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .85rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2);
    font-size: .875rem;
}
.pagination { display: flex; align-items: center; gap: .5rem; }

/* ---------- Empty state ---------- */
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
    text-align: center; padding: 3.5rem 1.5rem;
}
.empty-state h3 { font-size: 1.1rem; }
.empty-state .btn { margin-top: .75rem; }
.empty-icon {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
    background: var(--primary-50); color: var(--primary); margin-bottom: .5rem;
}
.empty-icon .icon { width: 28px; height: 28px; }

/* ---------- Dashboard ---------- */
.hero-card {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
    padding: 2rem 2.25rem; border-radius: var(--radius-lg);
    background: var(--gradient); color: #fff;
    box-shadow: 0 20px 40px -18px rgba(79, 70, 229, .7);
}
.hero-card::after {
    content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px;
    border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none;
}
.hero-card h1 { font-size: 1.85rem; font-weight: 750; margin: .35rem 0 .4rem; }
.hero-card p { color: rgba(255, 255, 255, .85); max-width: 560px; }
.hero-kicker {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
    background: rgba(255, 255, 255, .15); padding: .3rem .7rem; border-radius: 999px;
}

.hero-text { min-width: 0; flex: 1 1 300px; position: relative; z-index: 1; }

.section-title {
    font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); margin: 0 0 .75rem;
}

/* Tarjetas de resumen: layout vertical, el texto largo siempre envuelve sin romper la tarjeta */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 1.25rem; }
.stat-card {
    display: flex; flex-direction: column; gap: .3rem; min-width: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem; color: inherit; box-shadow: var(--shadow);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -12px rgba(15, 23, 42, .2); border-color: var(--primary-100); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .6rem; }
.stat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--radius); flex-shrink: 0; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon-blue   { background: #dbeafe; color: #2563eb; }
.stat-icon-green  { background: #d1fae5; color: #059669; }
.stat-icon-amber  { background: #fef3c7; color: #d97706; }
.stat-icon-violet { background: #ede9fe; color: #7c3aed; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-sub { font-size: .8rem; color: var(--faint); overflow-wrap: anywhere; }
.stat-alert { align-self: flex-start; margin-top: .4rem; gap: .3rem; }
.stat-alert .icon { width: 12px; height: 12px; }
.stat-arrow { color: var(--faint); transition: transform .2s, color .2s; }
.stat-card:hover .stat-arrow { transform: translateX(3px); color: var(--primary); }

/* Indicadores (dólar / cemento) */
.indicadores { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1.25rem; }
.indicator-card {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
    padding: 1.2rem 1.35rem; border-radius: var(--radius-lg); min-width: 0;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.indicator-dolar { border-color: #a7f3d0; background: linear-gradient(135deg, #fff 45%, #ecfdf5); }
.indicator-cemento { border-color: #e7e5e4; background: linear-gradient(135deg, #fff 45%, #f5f5f4); }
.indicator-card.is-empty { border-style: dashed; }
.indicator-icon {
    display: grid; place-items: center; width: 50px; height: 50px; border-radius: var(--radius);
    font-weight: 800; font-size: .85rem; letter-spacing: .02em;
}
.indicator-dolar .indicator-icon { background: #d1fae5; color: #047857; }
.indicator-cemento .indicator-icon { background: #e7e5e4; color: #57534e; }
.indicator-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.indicator-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.indicator-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.indicator-meta { font-size: .76rem; color: var(--faint); overflow-wrap: anywhere; }

/* =========================================================
   Modales
   ========================================================= */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .18s ease;
}
.modal-dialog {
    position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 3rem);
    display: flex; flex-direction: column; margin: 0;
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateY(12px) scale(.98);
    transition: opacity .18s ease, transform .18s var(--ease);
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-dialog { opacity: 1; transform: none; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 780px; }

.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: 1.35rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.2rem; font-weight: 700; }
.modal-header p { font-size: .85rem; margin-top: .2rem; }
.modal-body { padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.5rem; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: .6rem;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.confirm-body { align-items: center; text-align: center; gap: .6rem; padding-top: 2rem; }
.confirm-icon {
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
    background: var(--danger-50); color: var(--danger); margin-bottom: .25rem;
}
.confirm-icon .icon { width: 26px; height: 26px; }
.confirm-body h3 { font-size: 1.15rem; }

/* Detalle dentro de modal */
.detail-person { display: flex; align-items: center; gap: 1rem; }
.detail-person h3 { margin-bottom: .35rem; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.5rem; margin: 0; }
.detail-list > div:last-child, .detail-list > div[data-bloque] { grid-column: 1 / -1; }
.detail-list dt {
    display: flex; align-items: center; gap: .4rem;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.detail-list dt .icon { width: 14px; height: 14px; color: var(--faint); }
.detail-list dd { margin: .3rem 0 0; font-weight: 500; word-break: break-word; }

/* =========================================================
   Toasts
   ========================================================= */
.toasts {
    position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 200;
    display: flex; flex-direction: column; gap: .6rem; pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: .65rem;
    min-width: 260px; max-width: 380px;
    padding: .85rem 1.1rem; border-radius: var(--radius);
    background: #0f172a; color: #fff; font-size: .9rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateY(10px);
    transition: opacity .25s ease, transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast::before {
    content: ""; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    background: var(--info); box-shadow: 0 0 0 4px rgba(37, 99, 235, .25);
}
.toast-success::before { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .25); }
.toast-error::before { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .25); }

/* =========================================================
   Login
   ========================================================= */
.auth-body {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: radial-gradient(circle at 20% 20%, #312e81 0%, transparent 45%),
                radial-gradient(circle at 80% 80%, #581c87 0%, transparent 45%),
                #0f172a;
    overflow: hidden; position: relative;
}
.auth-blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .45; pointer-events: none; }
.auth-blob-1 { width: 420px; height: 420px; background: #6366f1; top: -120px; left: -100px; }
.auth-blob-2 { width: 380px; height: 380px; background: #a855f7; bottom: -120px; right: -80px; }

.auth-wrapper { position: relative; width: 100%; max-width: 940px; }
.auth-card {
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--surface); border-radius: 24px; overflow: hidden;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .55);
}
.auth-hero {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; gap: 1.1rem;
    padding: 3rem; color: #fff; background: var(--gradient);
}
.auth-hero::after {
    content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%;
    right: -110px; bottom: -110px; background: rgba(255, 255, 255, .1);
}
.auth-hero .brand-logo { background: rgba(255, 255, 255, .18); box-shadow: none; }
.auth-hero-title { font-size: 2rem; font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.auth-hero-title span { letter-spacing: .4em; font-weight: 600; color: #c7d2fe; font-size: 1.35rem; }
.auth-hero-text { color: rgba(255, 255, 255, .85); max-width: 320px; }
.auth-hero-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.auth-hero-list li {
    display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500;
    background: rgba(255, 255, 255, .12); padding: .55rem .75rem; border-radius: var(--radius-sm);
}

.auth-form { padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; }
.auth-form-header h2 { font-size: 1.6rem; font-weight: 750; margin-bottom: .3rem; }
.auth-footer { font-size: .8rem; text-align: center; }

/* =========================================================
   Componentes v0.3 — Propiedades, Loteos, Dólar
   ========================================================= */

/* ---------- Chip del dólar (topbar) ---------- */
.dolar-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .4rem .85rem; border-radius: 999px; cursor: pointer;
    border: 1px solid #a7f3d0; background: #ecfdf5; color: #065f46;
    font: inherit; font-size: .85rem; transition: all .15s;
}
.dolar-chip:hover { background: #d1fae5; border-color: #6ee7b7; }
.dolar-chip .icon { width: 14px; height: 14px; opacity: .6; }
.dolar-chip-label { font-weight: 600; opacity: .75; }
.dolar-chip.is-empty { border-color: #fde68a; background: #fffbeb; color: #92400e; }


.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; position: relative; z-index: 1; }
.btn-glass { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-glass:hover { background: rgba(255, 255, 255, .25); }

/* ---------- Inputs compuestos ---------- */
.input-prefix, .input-group { display: flex; align-items: stretch; }
.input-prefix > span {
    display: grid; place-items: center; padding: 0 .85rem;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 600;
}
.input-prefix > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > select {
    width: auto; flex: 0 0 auto; border-right: none; background: var(--surface-2); font-weight: 600;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.field-hint { color: var(--faint); font-size: .8rem; }
.field-hint:empty { display: none; }
.form-grid-sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.form-group-wide { grid-column: span 2; }

.segmented { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: .5rem 1rem; border-radius: 6px; font-weight: 600; font-size: .875rem; color: var(--muted); transition: all .15s; }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow-sm), 0 0 0 1px var(--primary-100); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.has-error .segmented { border-color: var(--danger); }

.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; font-weight: 500; margin-top: 1rem; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.filter-select { width: auto; min-width: 180px; background: var(--surface-2); border-color: var(--border); }

/* ---------- Autocompletar ---------- */
.autocomplete { position: relative; }
.autocomplete.has-value input[data-ac-input] { background: var(--primary-50); border-color: var(--primary-100); font-weight: 600; color: var(--primary-600); }
.ac-clear {
    position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center; width: 28px; height: 28px; border: none; border-radius: 6px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.ac-clear:hover { background: var(--surface-2); color: var(--text); }
.ac-clear .icon { width: 16px; height: 16px; }
.ac-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10;
    list-style: none; margin: 0; padding: .35rem; max-height: 240px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.ac-item { display: flex; flex-direction: column; padding: .55rem .7rem; border-radius: 6px; cursor: pointer; }
.ac-item small { color: var(--muted); font-size: .78rem; }
.ac-item:hover, .ac-item.is-active { background: var(--primary-50); }
.ac-empty { padding: .6rem .7rem; color: var(--muted); font-size: .875rem; }

/* ---------- Fotos ---------- */
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.fotos-grid:empty { display: none; }
.fotos-grid + .dropzone, .dropzone + .fotos-grid { margin-top: .75rem; }
.foto-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.foto-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-nueva { outline: 2px dashed var(--primary-100); outline-offset: -2px; }
.foto-del {
    position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
    border: none; background: rgba(15, 23, 42, .7); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer;
}
.foto-del:hover { background: var(--danger); }
.dropzone {
    display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; cursor: pointer;
    border: 2px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted);
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone > .icon { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--primary-50); color: var(--primary); }
.dropzone span { display: flex; flex-direction: column; line-height: 1.3; }
.dropzone small { font-size: .78rem; color: var(--faint); }

.thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.thumb-empty { display: grid; place-items: center; background: var(--surface-2); color: var(--faint); border: 1px solid var(--border); }

.galeria { display: flex; flex-direction: column; gap: .6rem; }
.galeria-main { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.galeria-thumbs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 2px; }
.galeria-thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .6; transition: opacity .15s; border: 2px solid transparent; flex-shrink: 0; }
.galeria-thumbs img:hover, .galeria-thumbs img.is-active { opacity: 1; border-color: var(--primary); }
.galeria-thumbs a img { opacity: 1; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--border); margin-bottom: -.5rem; overflow-x: auto; }
.tab {
    display: inline-flex; align-items: center; gap: .55rem; white-space: nowrap;
    padding: .75rem 1.1rem; border: none; background: none; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary-600); border-bottom-color: var(--primary); }
.tab-count { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tab.is-active .tab-count { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-600); }

/* ---------- Elegir tipo (modal) ---------- */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice-card {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; text-align: left;
    padding: 1.35rem; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface);
    font: inherit; cursor: pointer; transition: all .2s var(--ease);
}
.choice-card:hover { border-color: var(--primary); box-shadow: 0 12px 24px -12px rgba(79, 70, 229, .35); transform: translateY(-2px); }
.choice-card:focus-visible { outline: none; box-shadow: var(--ring); }
.choice-card strong { font-size: 1.05rem; }
.choice-card .text-muted { font-size: .85rem; line-height: 1.45; }
.choice-card-main { border-color: var(--primary-100); background: linear-gradient(160deg, #fff 50%, var(--primary-50)); }
.choice-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--gradient); color: #fff; }
.choice-icon .icon { width: 24px; height: 24px; }
.choice-icon-alt { background: #fef3c7; color: #d97706; }
.choice-tag { position: absolute; top: .9rem; right: .9rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .55rem; border-radius: 999px; background: var(--primary); color: #fff; }

/* ---------- Badges de estado ---------- */
.badge-disponible { background: #d1fae5; color: #047857; }
.badge-reservada, .badge-reservado { background: #fef3c7; color: #b45309; }
.badge-vendida, .badge-vendido { background: #fee2e2; color: #b91c1c; }
.badge-alquilada { background: #ede9fe; color: #6d28d9; }
.badge-activo { background: #d1fae5; color: #047857; }
.badge-finalizado { background: #e2e8f0; color: #475569; }
.badge-op-venta { background: #dbeafe; color: #1d4ed8; }
.badge-op-alquiler { background: #fae8ff; color: #a21caf; }
.badge-servicio { background: var(--primary-50); color: var(--primary-600); }

.dot { display: inline-flex; align-items: center; gap: .35rem; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-disponible::before { background: #10b981; }
.dot-reservado::before { background: #f59e0b; }
.dot-vendido::before { background: #ef4444; }

.progress { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: #d1fae5; }
.progress-lg { height: 10px; }
.progress-vendido { background: #ef4444; }
.progress-reservado { background: #f59e0b; }

/* ---------- Tarjetas de loteo ---------- */
.loteo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.25rem; padding: 1.25rem; }
.loteo-card {
    display: flex; flex-direction: column; color: inherit; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.loteo-card:hover { transform: translateY(-3px); box-shadow: 0 18px 32px -14px rgba(15, 23, 42, .25); border-color: var(--primary-100); }
.loteo-cover {
    position: relative; height: 140px; display: grid; place-items: center;
    background: var(--gradient) center / cover no-repeat;
}
.loteo-cover[style] { background-color: var(--surface-2); }
.loteo-cover-icon { width: 44px; height: 44px; color: rgba(255, 255, 255, .55); }
.loteo-cover .badge { position: absolute; top: .75rem; left: .75rem; box-shadow: var(--shadow-sm); }
.loteo-body { padding: 1.1rem 1.15rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.loteo-body h3 { font-size: 1.05rem; }
.loteo-ubicacion { display: flex; align-items: center; gap: .35rem; font-size: .85rem; margin-top: -.35rem; }
.loteo-ubicacion .icon { width: 14px; height: 14px; color: var(--faint); }
.loteo-stats { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .8rem; color: var(--muted); }
.loteo-stats strong { color: var(--text); }

/* ---------- Detalle de loteo ---------- */
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: -.75rem; width: fit-content; }
.back-link:hover { color: var(--primary); }
.loteo-hero { display: grid; grid-template-columns: 300px 1fr; padding: 0; overflow: hidden; }
.loteo-hero-cover { min-height: 220px; display: grid; place-items: center; background: var(--gradient) center / cover no-repeat; }
.loteo-hero-cover[style] { background-color: var(--surface-2); }
.loteo-hero-body { padding: 1.5rem 1.75rem; display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.loteo-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.loteo-hero-top .page-title { margin: .45rem 0 .3rem; }
.loteo-hero-top .loteo-ubicacion { margin-top: 0; }
.loteo-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--border); }
.loteo-facts dd { margin: .3rem 0 0; font-weight: 600; }
.loteo-descripcion { color: #334155; font-size: .925rem; }

.card-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.25rem; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1.15rem; }
.card-header p { font-size: .85rem; margin-top: .15rem; }

.lotes-resumen { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .8rem; }
.lotes-resumen-nums { display: flex; flex-wrap: wrap; gap: 1rem 2.25rem; }
.lotes-resumen-nums > div { display: flex; align-items: baseline; gap: .5rem; font-size: .85rem; }
.lotes-resumen-nums strong { font-size: 1.35rem; font-weight: 800; }
.lotes-resumen-nums .dot::before { align-self: center; }
.mz { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 .5rem; border-radius: 8px; background: var(--primary-50); color: var(--primary-600); font-weight: 700; font-size: .85rem; }
.cell-note { display: block; font-size: .78rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }


/* =========================================================
   Ventas
   ========================================================= */
.modal-xl { max-width: 980px; }
.text-danger { color: var(--danger); font-weight: 600; }
.badge-venta-activa { background: #dbeafe; color: #1d4ed8; }
.badge-venta-finalizada { background: #d1fae5; color: #047857; }
.badge-venta-anulada { background: #e2e8f0; color: #475569; text-decoration: line-through; }
.badge-vencida, .badge-cuota-vencida { background: #fee2e2; color: #b91c1c; }
.badge-cuota-pagada { background: #d1fae5; color: #047857; }
.badge-cuota-pendiente { background: #f1f5f9; color: #475569; }
.chip-alert input:checked + span { background: var(--danger); border-color: var(--danger); }

.progress-pago { height: 5px; width: 120px; max-width: 100%; background: #e2e8f0; margin-top: .25rem; }
.progress-pagado { background: #10b981; }

.btn-sell { background: #ecfdf5; color: #047857; border-color: #a7f3d0; padding: .4rem .7rem; }
.btn-sell:hover { background: #d1fae5; }
.btn-sell .icon { width: 15px; height: 15px; }

.alert-warning { background: #fffbeb; color: #92400e; }

.segmented-block { display: flex; width: 100%; }
.segmented-block label { flex: 1; text-align: center; }

.subsection { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.subsection .switch { margin-top: 0; }
.subsection-soft { padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }

.resumen-box {
    padding: 1rem 1.15rem; border-radius: var(--radius); font-size: .9rem; line-height: 1.55;
    background: var(--primary-50); border: 1px solid var(--primary-100); color: #312e81;
    display: flex; flex-direction: column; gap: .3rem;
}
.resumen-box b { color: var(--primary-600); }
.resumen-alerta { color: #92400e; background: #fffbeb; border-radius: 6px; padding: .45rem .6rem; margin-top: .25rem; }
.resumen-alerta b { color: #b45309; }

.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 1rem 1.5rem; margin: 0; }
.facts-grid dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts-grid dd { margin: .3rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.fact-big { font-size: 1.2rem; font-weight: 800 !important; }

.table-plan { border: 1px solid var(--border); border-radius: var(--radius); max-height: 420px; overflow: auto; }
.table-plan thead th { position: sticky; top: 0; z-index: 1; }
.table-compact th, .table-compact td { padding: .6rem .9rem; }
.table-compact tbody tr { cursor: default; }
.row-vencida td { background: #fef2f2; }
.row-pagada td { color: var(--muted); }
.table td small { display: block; }

/* =========================================================
   Responsive
   ========================================================= */
html { -webkit-text-size-adjust: 100%; }
img, svg { max-width: 100%; }
.content > *, .page > * { min-width: 0; }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 30;
        background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px);
    }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-grid; }
    .content { padding: 1.5rem; }
    .topbar { padding: 0 1.5rem; }
}

@media (max-width: 760px) {
    /* Evita el zoom automático de iOS al enfocar campos */
    input, select, textarea { font-size: 16px; }

    .topbar { padding: 0 .75rem; gap: .5rem; height: 60px; }
    .topbar-date span, .user-meta, .dolar-chip-label { display: none; }
    .user-chip { padding: .2rem; border: none; }
    .dolar-chip { padding: .35rem .65rem; }
    .content { padding: 1rem .85rem calc(1.5rem + env(safe-area-inset-bottom)); gap: 1rem; }
    .page { gap: 1.1rem; }

    .page-header { align-items: stretch; }
    .page-header > .btn, .page-header .toolbar-actions { width: 100%; }
    .page-title { font-size: 1.4rem; }
    .hero-card { padding: 1.35rem; }
    .hero-card h1 { font-size: 1.5rem; }
    .hero-actions { width: 100%; }
    .hero-actions .btn { flex: 1 1 100%; }

    .card { padding: 1.1rem; border-radius: var(--radius); }
    .card-flush { padding: 0; }
    .filter-bar { padding: .85rem; gap: .65rem; }
    .filter-search { max-width: none; flex-basis: 100%; }
    .filter-select { width: 100%; }
    .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
    .chips::-webkit-scrollbar { display: none; }
    .chip span { white-space: nowrap; }
    .list-footer { padding: .75rem .85rem; justify-content: center; text-align: center; }

    /* Tablas => tarjetas apiladas (requiere data-label en cada td) */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tbody tr { position: relative; padding: .85rem .9rem; border-bottom: 1px solid var(--border); }
    .table-cards tbody tr:last-child { border-bottom: none; }
    .table-cards td {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        padding: .3rem 0; border: none; white-space: normal; text-align: right;
    }
    .table-cards td::before {
        content: attr(data-label); flex-shrink: 0; text-align: left;
        font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    }
    .table-cards td:not([data-label])::before, .table-cards td.cell-main::before { content: none; }
    .table-cards td.cell-main { display: block; text-align: left; padding: 0 0 .5rem; }
    .table-cards td > .badges, .table-cards td > .cell-stack { justify-content: flex-end; align-items: flex-end; }
    .table-cards .cell-person { min-width: 0; }
    .table-cards .cell-stack span { white-space: normal; }
    .table-cards .col-actions { width: 100%; text-align: left !important; padding-top: .5rem; justify-content: flex-end; }
    .table-cards .row-actions { opacity: 1; }
    .table-cards .progress-pago { margin-left: auto; }
    .table-plan { max-height: none; border-radius: var(--radius-sm); }
    .table-plan .table-cards tbody tr { padding: .65rem .75rem; }
    .row-vencida td { background: transparent; }
    .table-cards tr.row-vencida { background: #fef2f2; }

    /* Modales tipo bottom-sheet */
    .modal { padding: 0; align-items: flex-end; }
    .modal-dialog { max-height: 94vh; max-height: 94dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal-header { padding: 1rem 1.1rem; }
    .modal-body { padding: 1.1rem; gap: 1.25rem; }
    .modal-footer { padding: .85rem 1.1rem calc(.85rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
    .modal-footer .spacer { display: none; }
    .modal-footer .btn { flex: 1 1 auto; }
    .form-grid, .form-grid-sm { grid-template-columns: 1fr 1fr; gap: .85rem; }
    .form-grid > .form-group-wide { grid-column: 1 / -1; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-person { gap: .75rem; }
    .avatar-lg { width: 46px; height: 46px; }
    .choice-grid { grid-template-columns: 1fr; }
    .segmented { display: flex; width: 100%; }
    .segmented label { flex: 1; text-align: center; }
    .segmented span { padding: .55rem .5rem; }
    .galeria-main { max-height: 240px; }

    .toasts { left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom)); }
    .toast { max-width: none; min-width: 0; }

    .auth-body { padding: 1rem; align-items: start; }
    .auth-card { grid-template-columns: 1fr; border-radius: 18px; }
    .auth-hero { padding: 1.5rem; flex-direction: row; align-items: center; gap: 1rem; }
    .auth-hero-title { font-size: 1.25rem; }
    .auth-hero-title span { font-size: .95rem; }
    .auth-hero .brand-logo-lg { width: 48px; height: 48px; }
    .auth-hero-list, .auth-hero-text { display: none; }
    .auth-form { padding: 1.5rem; gap: 1.25rem; }

    .loteo-grid { padding: .85rem; gap: .85rem; grid-template-columns: 1fr; }
    .loteo-hero { grid-template-columns: 1fr; }
    .loteo-hero-cover { min-height: 150px; }
    .loteo-hero-body { padding: 1.1rem; }
    .card-header { padding: 1rem .85rem; }
    .card-header .toolbar-actions { width: 100%; }
    .card-header .toolbar-actions .btn { flex: 1; }
    .lotes-resumen { padding: .85rem; }
    .lotes-resumen-nums { gap: .75rem 1.25rem; }

    .indicator-card { grid-template-columns: auto 1fr; }
    .indicator-btn { grid-column: 1 / -1; width: 100%; }
    .tab { padding: .7rem .8rem; }
}

@media (max-width: 420px) {
    .form-grid, .form-grid-sm { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.6rem; }
    .stat-icon { width: 40px; height: 40px; }
    .topbar-date { visibility: hidden; }
    .tab .icon { display: none; }
}

/* =========================================================
   Multi-inmobiliaria: marca, panel admin, usuarios
   ========================================================= */
.brand-text { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; letter-spacing: .02em; }
.brand-sub { letter-spacing: .08em; text-transform: uppercase; font-size: .68rem; }
.brand-logo-img { object-fit: cover; background: #fff; padding: 2px; flex-shrink: 0; }

.avatar-logo { object-fit: cover; background: #fff; border: 1px solid var(--border); }
.code-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .8rem;
    padding: .15rem .5rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: #334155;
    word-break: break-all;
}
.code-chip .icon { width: 13px; height: 13px; color: var(--faint); }
.badge-inactivo { background: #fee2e2; color: #b91c1c; }
.badge-rol-admin { background: var(--primary-50); color: var(--primary-600); }
.stat-card-static:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
.table tbody tr[data-href] { cursor: pointer; }

.inm-hero { display: flex; gap: 1.5rem; align-items: flex-start; }
.inm-logo { width: 96px; height: 96px; border-radius: var(--radius-lg); object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); background: #fff; }
.inm-logo-empty { display: grid; place-items: center; background: var(--gradient); color: #fff; font-size: 1.8rem; font-weight: 800; border: none; }
.inm-hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.inm-hero-body .page-title { margin-top: .45rem; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 1rem; }
.mini-stats > div {
    display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.15rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.mini-stats strong { font-size: 1.5rem; font-weight: 800; }
.mini-stats span { font-size: .8rem; color: var(--muted); }

.logo-field { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.logo-preview {
    display: grid; place-items: center; width: 84px; height: 84px; border-radius: var(--radius);
    border: 2px dashed var(--border-strong); color: var(--faint); overflow: hidden; background: var(--surface-2); flex-shrink: 0;
}
.logo-preview .icon { width: 30px; height: 30px; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.logo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; min-width: 0; flex: 1; }
.check-inline { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; cursor: pointer; }

@media (max-width: 760px) {
    .inm-hero { flex-direction: column; }
    .inm-logo { width: 72px; height: 72px; }
    .brand-name { max-width: 150px; }
}

/* Modo soporte (superadmin usando el sistema como una inmobiliaria) */
.soporte-bar {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
    padding: .6rem 1.5rem; background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a; font-size: .875rem;
}
.soporte-bar > span { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; overflow-wrap: anywhere; }
.soporte-bar .icon { width: 16px; height: 16px; flex-shrink: 0; }
.soporte-bar .btn-sm { padding: .35rem .8rem; font-size: .8rem; background: #92400e; color: #fff; border: none; }
.soporte-bar .btn-sm:hover { background: #78350f; }
@media (max-width: 760px) {
    .soporte-bar { padding: .6rem 1rem; }
    .soporte-bar form, .soporte-bar .btn-sm { width: 100%; }
}

/* =========================================================
   Cobros y recibos
   ========================================================= */
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-sm .icon { width: 15px; height: 15px; }
.d-block { display: block; }
.num { text-align: right; white-space: nowrap; }
.alert-info { background: var(--primary-50); color: var(--primary-600); }
.alert .icon { flex-shrink: 0; }
.header-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.mini-stat-alerta { border-color: #fecaca !important; background: #fef2f2 !important; }
.mini-stat-alerta strong { color: var(--danger); }
.mini-stats .mini-stat-monto { font-size: 1.2rem; overflow-wrap: anywhere; }
.recargo-actual { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin-top: -.5rem; }
.recargo-actual .icon { width: 15px; height: 15px; }

.avatar-recibo { background: var(--primary-50); color: var(--primary-600); }
.avatar-recibo .icon { width: 18px; height: 18px; }
.avatar-lg.avatar-recibo .icon { width: 26px; height: 26px; }
.badge-recibo-emitido { background: #d1fae5; color: #047857; }
.badge-recibo-anulado { background: #fee2e2; color: #b91c1c; text-decoration: line-through; }
.badges .badge .icon { width: 12px; height: 12px; }

/* Formulario de cobro */
.cobro-cuotas { display: flex; flex-direction: column; gap: .6rem; }
.cobro-cuotas.is-loading { opacity: .5; pointer-events: none; }
.cobro-cuotas-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; }
.cobro-cuotas-head .section-title { margin: 0; }
.table-cobro .col-check { width: 40px; }
.table-cobro input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.table-cobro tbody tr { opacity: .6; transition: opacity .15s; }
.table-cobro tbody tr.is-selected { opacity: 1; }
.table-cobro tbody tr.is-selected td { background: var(--primary-50); }
.table-cobro .input-recargo { width: 110px; text-align: right; padding: .4rem .55rem; }
.avisos { display: flex; flex-direction: column; gap: .5rem; }
.avisos:empty { display: none; }
.cobro-total { flex-direction: column; gap: .35rem; }
.cobro-total > div { display: flex; justify-content: space-between; gap: 1rem; }
.cobro-total-final { padding-top: .45rem; border-top: 1px solid var(--primary-100); font-size: 1.1rem; }
.cobro-total-final strong { color: var(--primary-600); }

.input-suffix > input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-suffix > span { order: 2; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }

/* Detalle del recibo */
.recibo-acciones { display: flex; flex-direction: column; gap: .6rem; }
.recibo-botones { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-whatsapp { color: #047857; }
.btn-whatsapp:hover { background: #ecfdf5; }

/* Panel admin: canales de envío */
.canales { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; padding: 1.25rem; }
.canal { display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.canal > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.canal small { overflow-wrap: anywhere; }
.canal-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--primary-50); color: var(--primary-600); flex-shrink: 0; }
.canal-icon .icon { width: 20px; height: 20px; }
.form-section legend .icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: .3rem; }
.probar-email { margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.input-action { display: flex; gap: .5rem; }
.input-action input { flex: 1; min-width: 0; }
.plantilla-info { margin-top: 1rem; font-size: .85rem; }
.plantilla-info summary { cursor: pointer; font-weight: 600; color: var(--primary-600); }
.plantilla-info > div { margin-top: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.plantilla-info pre { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; font-size: .85rem; margin: 0; }

@media (max-width: 760px) {
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; }
    .table-cobro tbody tr { padding-left: 2.75rem; }
    .table-cobro td.col-check { position: absolute; left: .9rem; top: .9rem; width: auto; padding: 0; }
    .table-cobro .input-recargo { width: 130px; }
    .recibo-botones .btn { flex: 1 1 calc(50% - .5rem); }
    .input-action { flex-direction: column; }
}

.link-recibo { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; font-weight: 600; color: var(--primary-600); }
.link-recibo .icon { width: 13px; height: 13px; }

/* Grupos de botones: SIEMPRE con gap. Un <form> dentro del grupo no debe romper el espaciado ni el ancho en mobile. */
.toolbar-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.toolbar-actions form, .header-actions form, .recibo-botones form, .row-actions form { display: contents; }
.empty-state .toolbar-actions { justify-content: center; margin-top: .75rem; }
.empty-state .toolbar-actions .btn { margin-top: 0; }

/* Bloque de observaciones / descripción en los detalles (ventas, recibos, propiedades) */
.detail-notes { padding: .9rem 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.detail-notes[hidden] { display: none; }
.detail-notes dt { display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.detail-notes dt .icon { width: 14px; height: 14px; color: var(--faint); }
.detail-notes dd { margin: .4rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.toast-info::before { background: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .25); }
