/* Professional workspace layer. Loaded after the legacy stylesheet on purpose. */
:root {
  --ui-bg: #f4f7fb;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f8fafc;
  --ui-border: #dfe6ee;
  --ui-text: #172033;
  --ui-muted: #64748b;
  --ui-primary: var(--color-primary, #0f766e);
  --ui-radius: 14px;
  --ui-shadow: 0 8px 24px rgba(15, 23, 42, .07);
  --ui-shadow-hover: 0 14px 32px rgba(15, 23, 42, .10);
}

html { background: var(--ui-bg); }

body,
body.bg-light {
  color: var(--ui-text);
  background: var(--ui-bg) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6,
.display-4, .display-5, .card-title {
  color: var(--ui-text);
  font-family: inherit;
  letter-spacing: -.02em;
}

.navbar {
  min-height: 64px;
  height: auto;
  padding: .7rem 0;
  background: #111827 !important;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .18);
}

.navbar-brand { font-size: 1.2rem !important; font-weight: 750; text-shadow: none; }
.navbar-brand img { max-height: 32px; filter: none; }

.subhead-dark {
  height: auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  background: #1e293b;
  border-bottom: 0;
  box-shadow: none;
}

.subhead-dark .progress { height: 7px !important; background: rgba(255,255,255,.16); }
.subhead-dark .progress-bar { background: #2dd4bf; font-size: 0; }

#calle {
  min-height: 40px;
  padding: .55rem 1rem .55rem 2.5rem !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.09) !important;
  font-size: .92rem !important;
}

#calle:focus {
  border-color: rgba(94,234,212,.8) !important;
  background: rgba(255,255,255,.14) !important;
  box-shadow: 0 0 0 3px rgba(45,212,191,.18) !important;
  transform: none;
}

.workspace-main { max-width: 1540px; }

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.35rem;
}

.workspace-eyebrow {
  color: var(--ui-primary);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.workspace-title { margin: 0; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 760; }
.workspace-subtitle { max-width: 720px; color: var(--ui-muted); }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.overview-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: 0 3px 12px rgba(15, 23, 42, .04);
}

.overview-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: #334155;
  background: #eef2f7;
  border-radius: 11px;
  font-size: 1.15rem;
}

.overview-occupied .overview-icon { color: #b42318; background: #fef3f2; }
.overview-free .overview-icon { color: #067647; background: #ecfdf3; }
.overview-attention .overview-icon { color: #b54708; background: #fffaeb; }
.overview-label { display: block; color: var(--ui-muted); font-size: .78rem; font-weight: 650; }
.overview-card strong { display: block; margin-top: .1rem; font-size: 1.55rem; line-height: 1.1; }

.card,
.mini-kpi {
  overflow: hidden;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface) !important;
  box-shadow: var(--ui-shadow) !important;
  transition: border-color .18s ease, box-shadow .18s ease !important;
}

.card::before, .mini-kpi::before { display: none !important; }
.card:hover, .mini-kpi:hover { transform: none !important; border-color: #cbd5e1 !important; box-shadow: var(--ui-shadow-hover) !important; }
.card-body { padding: 1.25rem !important; }
.card-header { padding: 1rem 1.25rem !important; background: var(--ui-surface) !important; border-bottom: 1px solid var(--ui-border) !important; }
.card-header h4 { font-size: 1rem; font-weight: 720; }

.section-heading h3 { font-size: 1.25rem; font-weight: 740; }
.section-meta { color: var(--ui-muted); }

.piso-card {
  min-height: 82px;
  padding: 1.1rem 1.25rem !important;
  border-radius: 0 !important;
  background: var(--ui-surface) !important;
  outline: none;
}

.piso-card::before, .piso-card h6::before, .piso-card small::before { display: none !important; }
.piso-card:hover { transform: none !important; background: var(--ui-surface-soft) !important; box-shadow: none; }
.piso-card:focus-visible { box-shadow: inset 0 0 0 3px rgba(15,118,110,.22); }
.piso-card h5, .piso-card h6 { margin: 0 !important; font-size: 1rem !important; font-weight: 700; }
.piso-card small, .piso-card span { font-size: .84rem !important; }
.expansion .card-body { background: #f8fafc !important; }

.property-trigger {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  border: 0;
  color: inherit;
  text-align: left;
}
.property-symbol { display: grid; place-items: center; width: 42px; height: 42px; color: var(--ui-primary); background: #ecfdf5; border-radius: 11px; }
.property-main { min-width: 0; }
.property-main strong { display: block; overflow: hidden; font-size: .98rem; text-overflow: ellipsis; white-space: nowrap; }
.property-main > span { display: block; margin-top: .16rem; color: var(--ui-muted); font-size: .78rem !important; }
.property-stats { display: flex; align-items: center; gap: .5rem; }
.property-stats > span { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .5rem; border-radius: 7px; font-weight: 650; white-space: nowrap; }
.property-free { color: #067647; background: #ecfdf3; }
.property-occupied { color: #b42318; background: #fef3f2; }
.property-chevron { color: #64748b; transition: transform .2s ease; }
.property-trigger[aria-expanded="true"] .property-chevron { transform: rotate(180deg); }
.property-filters .btn-link { color: var(--ui-muted); text-decoration: none; }
.property-loading { display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 100px; color: var(--ui-muted); }
.property-card .expansion.is-open { max-height: none !important; opacity: 1 !important; overflow: visible; }

.empty-state {
  display: grid;
  justify-items: center;
  gap: .5rem;
  padding: 2.5rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: var(--ui-radius);
  color: var(--ui-muted);
  background: #fff;
  text-align: center;
}
.empty-state > i { font-size: 1.8rem; }
.empty-state > strong { color: var(--ui-text); }

.mobile-filter-panel {
  margin-bottom: 1rem;
  padding: .85rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #fff;
}
.mobile-filter-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .65rem; }
.mobile-filter-copy strong { font-size: .88rem; }
.mobile-filter-copy span { color: var(--ui-muted); font-size: .72rem; }
.mobile-filter-scroll { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: none; scroll-snap-type: x proximity; }
.mobile-filter-scroll::-webkit-scrollbar { display: none; }
.mobile-filter-scroll .btn { flex: 0 0 auto; min-height: 36px; padding: .4rem .65rem !important; color: #475569; background: #f8fafc !important; border: 1px solid #e2e8f0 !important; scroll-snap-align: start; }
.mobile-filter-scroll .btn.active { color: #fff; background: var(--ui-primary) !important; border-color: var(--ui-primary) !important; }

.mobile-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1045;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 62px;
  padding: .35rem max(.35rem, env(safe-area-inset-right)) calc(.35rem + env(safe-area-inset-bottom)) max(.35rem, env(safe-area-inset-left));
  border-top: 1px solid #dbe3ec;
  background: rgba(255,255,255,.96);
  box-shadow: 0 -8px 24px rgba(15,23,42,.08);
  backdrop-filter: blur(14px);
}
.mobile-bottom-nav a, .mobile-bottom-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
  border: 0;
  border-radius: 9px;
  color: #64748b;
  background: transparent;
  font-size: .65rem;
  font-weight: 650;
  text-decoration: none;
}
.mobile-bottom-nav i { font-size: 1.15rem; }
.mobile-bottom-nav .active { color: var(--ui-primary); background: #ecfdf5; }

.hab-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.hab-list > div { min-width: 0; }
.hab-chip,
.hab2.centered {
  height: 100%;
  margin: 0 !important;
  padding: 1rem !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 12px;
  background: var(--ui-surface);
  box-shadow: none;
}

.hab-chip::before { display: none; }
.hab-chip:hover { transform: none; border-color: #94a3b8 !important; background: #fff; box-shadow: 0 6px 18px rgba(15,23,42,.06); }
.hab2-title { font-size: 1rem; font-weight: 720; }
.hab2-sub { color: var(--ui-muted); font-size: .82rem; }
.hab2-status-row { margin-top: .8rem; }
.hab2-pill, .hab2-badge, .pill {
  min-height: 34px;
  height: auto;
  padding: .45rem .7rem !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-size: .75rem !important;
  letter-spacing: 0;
  text-transform: none;
}

.pill-libre { color: #067647; background: #ecfdf3; border: 1px solid #abefc6; }
.pill-ocupada { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; }
.pill-caducada { color: #b54708; background: #fffaeb; border: 1px solid #fedf89; }
.pill-reservada { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }
.pill-libre::before, .pill-ocupada::before, .pill-caducada::before { display: none !important; }
.hab2-actions { gap: .55rem; }
.hab2-actions .btn + .btn { margin-left: 0; }

.btn,
.btn-sm,
.btn-lg {
  width: auto;
  min-height: 40px;
  padding: .55rem .9rem !important;
  border-radius: 9px !important;
  font-size: .86rem !important;
  font-weight: 680 !important;
  letter-spacing: 0;
  box-shadow: none !important;
  transform: none !important;
  justify-content: center;
}

.btn::before { display: none; }
.btn-primary { background: var(--ui-primary) !important; border: 1px solid var(--ui-primary) !important; }
.btn-primary:hover { filter: brightness(.92); }
.btn-success { background: #087a4b !important; border: 1px solid #087a4b !important; }
.btn-danger { background: #c4322b !important; border: 1px solid #c4322b !important; }
.btn-warning { color: #fff !important; background: #c76114 !important; border: 1px solid #c76114 !important; }
.btn-secondary { background: #475569 !important; border: 1px solid #475569 !important; }
.btn-outline-primary, .btn-outline-success, .btn-outline-danger, .btn-outline-warning,
.btn-outline-info, .btn-outline-secondary { background: #fff !important; border: 1px solid #cbd5e1 !important; }
.btn-outline-primary { color: var(--ui-primary) !important; }
.btn-outline-success { color: #067647 !important; }
.btn-outline-danger { color: #b42318 !important; }
.btn-outline-warning { color: #b54708 !important; }
.btn-outline-info { color: #175cd3 !important; }
.btn-outline-secondary { color: #475569 !important; }
.btn[class*="btn-outline-"]:hover { color: var(--ui-text) !important; background: #f1f5f9 !important; border-color: #94a3b8 !important; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: 3px solid rgba(15,118,110,.22); outline-offset: 2px; }

.form-control, .form-select, .input-group-text {
  min-height: 42px;
  padding: .6rem .75rem !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 9px !important;
  font-size: .9rem !important;
}
.form-control:focus, .form-select:focus { border-color: var(--ui-primary) !important; box-shadow: 0 0 0 3px rgba(15,118,110,.12) !important; transform: none; }
.form-label { margin-bottom: .4rem !important; color: #344054 !important; font-size: .86rem !important; font-weight: 650 !important; }

.alert { padding: .9rem 1rem !important; border: 1px solid var(--ui-border) !important; border-radius: 11px !important; box-shadow: none; font-size: .88rem !important; font-weight: 500; }
.alert::before { display: none !important; }
.badge { padding: .38rem .58rem !important; border-radius: 7px !important; box-shadow: none; font-size: .7rem !important; letter-spacing: .01em; text-transform: none; }

.mini-kpi { margin-bottom: 1rem; padding: 1.15rem !important; }
.mini-kpi h5 { margin-bottom: .9rem; font-size: .93rem; }
.mini-kpi .display-4 { font-size: 2.2rem; background: none; color: var(--ui-primary); -webkit-text-fill-color: currentColor; }
.sidebar { top: calc(var(--nav-height) + var(--subhead-height) + 1rem); }

.v-item, .cad-item {
  margin-bottom: .7rem !important;
  padding: 1rem !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 11px !important;
  box-shadow: none;
}
.v-item::before, .cad-item::before { display: none; }
.v-item:hover, .cad-item:hover { transform: none; box-shadow: 0 5px 16px rgba(15,23,42,.06); }
.v-acciones { gap: .45rem; margin-top: .8rem; }
.v-acciones .btn { min-width: 0; flex: 0 1 auto; }

.modal-content { border: 1px solid var(--ui-border) !important; border-radius: 16px !important; box-shadow: 0 24px 60px rgba(15,23,42,.2) !important; }
.modal-header, .modal-footer { padding: 1rem 1.25rem !important; background: #fff !important; border-color: var(--ui-border) !important; }
.modal-title { font-size: 1.1rem !important; font-weight: 740 !important; }
.modal-body { padding: 1.25rem !important; }
.modal-footer { gap: .5rem; }

#toast-host { top: calc(var(--nav-height) + .75rem) !important; }
.toast { border-radius: 11px; box-shadow: var(--ui-shadow-hover) !important; }
.is-refreshing i { animation: ui-spin .75s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }

.login-container { background: #eef2f7 !important; }
.login-card { border: 1px solid var(--ui-border); border-radius: 18px !important; box-shadow: 0 20px 50px rgba(15,23,42,.12) !important; }
.login-header { background: #fff !important; }
.login-card .logo { background: var(--ui-primary) !important; border-radius: 12px; }

@media (max-width: 991.98px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-column { display: none; }
  .col-lg-9 { width: 100%; }
  .section-meta > .text-muted { display: none; }
  body.has-subhead { padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important; }
  .navbar .btn[data-bs-target="#menuOffcanvas"] { display: none !important; }
  .subhead-dark .row > div:first-child { display: none !important; }
  .subhead-dark .row > div:nth-child(2) { width: 100%; }
  .subhead-dark { min-height: 54px; padding: .4rem 0 !important; }
  .offcanvas.menu-offcanvas { top: var(--nav-height); height: calc(100dvh - var(--nav-height)); }
}

@media (max-width: 767.98px) {
  body { overflow-x: hidden; }
  .workspace-heading { align-items: stretch; flex-direction: column; }
  .workspace-heading { gap: .8rem; margin-bottom: 1rem; }
  .workspace-heading .btn { width: 100%; min-height: 44px; }
  .workspace-subtitle { font-size: .84rem; }
  .workspace-eyebrow { font-size: .67rem; }
  .hab-list { grid-template-columns: 1fr; }
  .v-row-main, .cad-item > .d-flex { flex-direction: column; }
  .v-row-main .text-end, .cad-item .text-end { text-align: left !important; }
  #modalFicha .modal-content { min-height: 100dvh; border: 0 !important; border-radius: 0 !important; }
  #modalFicha .modal-header { position: sticky; top: 0; z-index: 3; padding: .8rem 1rem !important; }
  #modalFicha .modal-body { max-height: none; padding: .9rem !important; }
  #modalFicha .modal-footer { position: sticky; bottom: 0; z-index: 3; padding: .7rem .9rem calc(.7rem + env(safe-area-inset-bottom)) !important; }
  #modalFicha .modal-title { min-width: 0; font-size: 1rem !important; }
  #modalFicha .modal-title small { display: block; overflow: hidden; margin: .15rem 0 0 !important; max-width: 72vw; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
  .modal-footer { align-items: stretch; flex-direction: column; }
  .modal-footer .btn { width: 100%; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .nav-tabs .nav-link { white-space: nowrap; }
  #formularioContrato .card-body { padding: .9rem !important; }
  #formularioContrato .row { --bs-gutter-x: .75rem; }
  #formularioContrato .form-label::before { display: none !important; }
  input.form-control, select.form-select, textarea.form-control { width: 100% !important; min-width: 0 !important; font-size: 16px !important; }
  .pad-firma { width: 100% !important; max-width: 100%; height: 160px !important; touch-action: none; }
  .wizard-contrato { overflow-x: auto; justify-content: flex-start !important; padding-bottom: .35rem; scrollbar-width: none; }
  .wizard-contrato .step { flex: 0 0 auto; min-width: 86px; }
  .table-responsive { margin-right: -.25rem; margin-left: -.25rem; }
  .v-acciones { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-acciones .btn { width: 100%; }
}

@media (max-width: 575.98px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .overview-card { gap: .55rem; padding: .7rem; }
  .overview-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 9px; font-size: .95rem; }
  .overview-label { overflow: hidden; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
  .overview-card strong { font-size: 1.25rem; }
  .workspace-main { padding-left: .8rem !important; padding-right: .8rem !important; }
  .section-heading { align-items: flex-start !important; flex-direction: column; gap: .4rem; }
  .property-trigger { grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; min-height: 76px; padding: .8rem !important; }
  .property-symbol { width: 36px; height: 36px; }
  .property-stats { grid-column: 2 / -1; justify-content: flex-start; }
  .property-chevron { grid-column: 3; grid-row: 1; }
  .property-occupied { display: none !important; }
  .property-filters { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .property-filters .btn { width: 100%; }
  .property-filters .btn-link { grid-column: 1 / -1; }
  .hab2-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hab2-actions .btn { min-width: 0; padding-right: .5rem !important; padding-left: .5rem !important; }
  .card { border-radius: 12px !important; }
  #cardVenc .card-header { align-items: flex-start !important; flex-direction: column; }
  #filtrosVenc { width: 100%; overflow-x: auto; flex-wrap: nowrap !important; padding-bottom: .15rem; }
  #filtrosVenc .btn { flex: 0 0 auto; }
  #alert-caducados > .d-flex { align-items: stretch !important; flex-direction: column; gap: .7rem; }
  #alert-caducados .btn { width: 100%; }
  .toast-container { right: .5rem !important; left: .5rem !important; width: auto !important; padding: 0 !important; }
  .toast { width: 100%; }
}

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