/* Nuvia Estate · estilos de la aplicación (complementa Bootstrap 5.3) */
:root {
  --brand: #0f766e;
  --brand-rgb: 15, 118, 110;
  --sidebar-w: 264px;
  --sidebar-bg: #0b1f2a;
  --sidebar-ink: #b8c7d1;
  --sidebar-ink-strong: #ffffff;
  --topbar-h: 62px;
  --radius: 14px;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: .935rem;
}
[data-bs-theme="light"] { --bs-body-bg: #f4f6f8; --surface: #ffffff; --line: #e6eaee; --muted-bg: #f8fafb; }
[data-bs-theme="dark"]  { --bs-body-bg: #0b1218; --surface: #121c24; --line: #213039; --muted-bg: #16222b; --sidebar-bg: #081218; }

body { min-height: 100vh; }
a { color: var(--brand); }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 85%, #000); --bs-btn-active-bg: color-mix(in srgb, var(--brand) 75%, #000); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; color: #fff; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .55); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15); }
.nav-pills .nav-link.active { background: var(--brand); }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background: var(--brand); border-color: var(--brand); }

/* ---- Estructura ---- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-ink); position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; transition: width .2s ease, transform .2s ease; }
.sidebar .brand { height: var(--topbar-h); display: flex; align-items: center; gap: .65rem; padding: 0 1.1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); flex: none; }
.sidebar .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; overflow: hidden; }
.sidebar .brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .brand-name { font-weight: 700; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav { overflow-y: auto; padding: .75rem .6rem 2rem; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar .nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(184,199,209,.55); padding: .9rem .75rem .35rem; white-space: nowrap; }
.sidebar .nav-link { color: var(--sidebar-ink); border-radius: 10px; padding: .48rem .75rem; display: flex; align-items: center; gap: .7rem; font-size: .9rem; white-space: nowrap; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; flex: none; }
.sidebar .nav-link:hover { color: var(--sidebar-ink-strong); background: rgba(255,255,255,.06); }
.sidebar .nav-link.active { color: #fff; background: rgba(var(--brand-rgb), .9); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; transition: margin .2s ease; }
.topbar { height: var(--topbar-h); position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; }
.topbar .search { max-width: 420px; flex: 1; }
.topbar .search .form-control { border-radius: 999px; padding-left: 2.3rem; background: var(--muted-bg); border-color: transparent; }
.topbar .search i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.content { padding: 1.5rem 1.5rem 3rem; max-width: 1480px; }
body.sidebar-collapsed .sidebar { width: 76px; }
body.sidebar-collapsed .sidebar .brand-name, body.sidebar-collapsed .sidebar .nav-group, body.sidebar-collapsed .sidebar .nav-link span { display: none; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; }
body.sidebar-collapsed .main { margin-left: 76px; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  .content { padding: 1rem; }
}

/* ---- Componentes ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--bs-secondary-color); margin-top: .25rem; }
.breadcrumb { font-size: .8rem; margin-bottom: .35rem; }
.breadcrumb a { text-decoration: none; color: var(--bs-secondary-color); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .9rem 1.15rem; font-weight: 600; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 1.15rem; }
.kpi { padding: 1rem 1.1rem; height: 100%; }
.kpi .label { color: var(--bs-secondary-color); font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.45rem; font-weight: 700; margin-top: .3rem; white-space: nowrap; letter-spacing: -.01em; }
.kpi .foot { font-size: .78rem; color: var(--bs-secondary-color); margin-top: .15rem; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem; float: right; }
.ico-brand { background: rgba(var(--brand-rgb), .12); color: var(--brand); }
.ico-info { background: rgba(13,202,240,.12); color: #0aa2c0; }
.ico-warning { background: rgba(255,193,7,.16); color: #b58105; }
.ico-danger { background: rgba(220,53,69,.12); color: #dc3545; }
.ico-success { background: rgba(25,135,84,.12); color: #198754; }
.ico-primary { background: rgba(13,110,253,.12); color: #0d6efd; }
.ico-secondary { background: rgba(108,117,125,.14); color: #6c757d; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .85rem; border-color: var(--line); }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 600; background: var(--muted-bg); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(var(--brand-rgb), .04); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { font-weight: 600; }
.badge-soft-success { background: rgba(25,135,84,.14) !important; color: #157347 !important; }
.badge-soft-warning { background: rgba(255,193,7,.2) !important; color: #997404 !important; }
.badge-soft-info { background: rgba(13,202,240,.16) !important; color: #087990 !important; }
.badge-soft-primary { background: rgba(13,110,253,.13) !important; color: #0a58ca !important; }
.badge-soft-danger { background: rgba(220,53,69,.14) !important; color: #b02a37 !important; }
.badge-soft-secondary { background: rgba(108,117,125,.15) !important; color: #5c636a !important; }
.badge-soft-dark { background: rgba(33,37,41,.14) !important; color: #495057 !important; }
[data-bs-theme="dark"] .badge-soft-success { color: #75d6a6 !important; }
[data-bs-theme="dark"] .badge-soft-warning { color: #ffd666 !important; }
[data-bs-theme="dark"] .badge-soft-info { color: #6edff6 !important; }
[data-bs-theme="dark"] .badge-soft-primary { color: #8bb9fe !important; }
[data-bs-theme="dark"] .badge-soft-danger { color: #f1959e !important; }
[data-bs-theme="dark"] .badge-soft-secondary, [data-bs-theme="dark"] .badge-soft-dark { color: #c4c9ce !important; }
.form-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.25rem; margin-bottom: 1rem; background: var(--surface); }
.form-section legend { float: none; width: auto; font-size: .95rem; font-weight: 700; padding: 0 .4rem; margin: 0 0 .4rem -.4rem; }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }
.multi-check { max-height: 180px; overflow: auto; background: var(--surface); }
.color-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: -1px; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--bs-secondary-color); }
.empty-state i { font-size: 2.4rem; opacity: .5; display: block; margin-bottom: .6rem; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem 1.25rem; }
.dl-grid dt { font-size: .75rem; color: var(--bs-secondary-color); font-weight: 500; }
.dl-grid dd { margin: .1rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(var(--brand-rgb), .15); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filters .form-control, .filters .form-select { width: auto; min-width: 160px; }
.filters .search-input { min-width: 240px; flex: 1; max-width: 340px; }
.progress { height: .5rem; border-radius: 999px; background: var(--muted-bg); }
.progress-bar { background: var(--brand); }
.toast-container { z-index: 1090; }
.skeleton { background: linear-gradient(90deg, var(--muted-bg) 25%, var(--line) 37%, var(--muted-bg) 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 8px; min-height: 1rem; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- Propiedades ---- */
.prop-card { overflow: hidden; height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.prop-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.08); }
.prop-thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, rgba(var(--brand-rgb), .85), #0b3d4a); position: relative; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.prop-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prop-thumb .code { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; position: relative; }
.prop-thumb .badge { position: absolute; top: .6rem; left: .6rem; }
.matrix { display: inline-flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--muted-bg); }
.matrix .floor { display: flex; gap: 6px; align-items: center; }
.matrix .floor .lvl { width: 2.4rem; font-size: .72rem; color: var(--bs-secondary-color); text-align: right; padding-right: .3rem; }
.unit { width: 74px; height: 48px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; text-decoration: none; border: 1px solid transparent; line-height: 1.15; }
.unit small { font-weight: 500; font-size: .64rem; opacity: .85; }
.unit:hover { outline: 2px solid var(--bs-body-color); outline-offset: 1px; }
.u-AVAILABLE { background: #d1f2e1; color: #0f5132; border-color: #a3e1c1; }
.u-RESERVED { background: #fff1c2; color: #7a5b00; border-color: #f5d97a; }
.u-FINANCING { background: #cff4fc; color: #055160; border-color: #9eeaf9; }
.u-SOLD { background: #cfe2ff; color: #052c65; border-color: #9ec5fe; }
.u-BLOCKED { background: #e2e3e5; color: #41464b; border-color: #c4c8cb; }
.u-INACTIVE { background: #343a40; color: #f8f9fa; }
.legend-dot { display: inline-block; width: .85rem; height: .85rem; border-radius: 4px; vertical-align: -2px; margin-right: .3rem; }

/* ---- Kanban ---- */
.kanban { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kanban-col { flex: 0 0 290px; background: var(--muted-bg); border-radius: var(--radius); border: 1px solid var(--line); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-col-head { padding: .75rem .9rem; border-bottom: 1px solid var(--line); border-top: 4px solid var(--stage, #64748b); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col-head .title { font-weight: 700; font-size: .9rem; }
.kanban-list { padding: .6rem; overflow-y: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; gap: .55rem; }
.kanban-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; cursor: grab; font-size: .82rem; }
.kanban-card:active { cursor: grabbing; }
.kanban-card .name { font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--bs-body-color); }
.kanban-card .meta { color: var(--bs-secondary-color); display: flex; align-items: center; gap: .35rem; margin-top: .2rem; }
.kanban-card.overdue { border-left: 4px solid #dc3545; }
.sortable-ghost { opacity: .4; }
.sortable-chosen { box-shadow: 0 10px 25px rgba(0,0,0,.15); }

/* ---- Línea de tiempo ---- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 1.1rem 3rem; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); color: var(--brand); }

/* ---- Asistente ---- */
.wizard-steps { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1.25rem; counter-reset: step; }
.wizard-steps .step { flex: 1 0 140px; padding: .65rem .8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: .82rem; font-weight: 600; color: var(--bs-secondary-color); display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.wizard-steps .step .n { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--muted-bg); font-size: .75rem; flex: none; }
.wizard-steps .step.active { border-color: var(--brand); color: var(--bs-body-color); }
.wizard-steps .step.active .n, .wizard-steps .step.done .n { background: var(--brand); color: #fff; }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; }
.summary-table td { padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.summary-table td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-table tr.total td { border-bottom: 0; font-size: 1.05rem; }

/* ---- Login ---- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at 10% 10%, rgba(255,255,255,.08), transparent), linear-gradient(140deg, var(--brand), #0b1f2a 75%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 55%; opacity: .9; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--surface); }
.auth-form .inner { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---- Impresión ---- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .toast-container, .btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
  body { background: #fff !important; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
.doc-sheet { max-width: 820px; margin: 0 auto; }
.btn-icon { background: transparent; border: 0; color: var(--bs-body-color); }
.btn-icon:hover, .btn-icon:focus-visible, .btn-icon.show { background: var(--muted-bg); color: var(--bs-body-color); }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #1c2a33; --bs-btn-border-color: #24343f; --bs-btn-color: #dbe4ea; --bs-btn-hover-bg: #24343f; --bs-btn-hover-border-color: #2c3f4b; --bs-btn-hover-color: #fff; }
