:root {
    --cop-primary: #0d6e6e;
    --cop-primary-dark: #095555;
    --cop-primary-light: #e6f4f4;
    --cop-accent: #f0a500;
    --cop-success: #198754;
    --cop-warning: #fd7e14;
    --cop-danger: #dc3545;
    --cop-info: #0dcaf0;
    --cop-bg: #f4f7fb;
    --cop-surface: #ffffff;
    --cop-text: #1a2b3c;
    --cop-muted: #6c7a89;
    --cop-border: #e2e8f0;
    --cop-sidebar: #0b3d3d;
    --cop-radius: 16px;
    --cop-shadow: 0 10px 30px rgba(15, 45, 45, 0.08);
    --cop-font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--cop-font);
    color: var(--cop-text);
    background: var(--cop-bg);
    -webkit-font-smoothing: antialiased;
}

/* ─── Auth layout ─── */
.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(13, 110, 110, 0.18), transparent 40%),
        radial-gradient(circle at bottom left, rgba(240, 165, 0, 0.12), transparent 35%),
        linear-gradient(180deg, #f8fbff 0%, #eef4f8 100%);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    gap: 1.25rem;
}

.auth-brand {
    text-align: center;
    max-width: 420px;
}

.auth-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.5rem;
    text-decoration: none;
}

.auth-brand-logo {
    display: block;
    max-width: min(280px, 78vw);
    max-height: 72px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.auth-brand p {
    color: var(--cop-muted);
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
}

.brand-preview-logo {
    max-width: 280px;
    max-height: 90px;
    object-fit: contain;
}

.auth-brand h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.auth-brand-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    color: #fff;
    background: linear-gradient(135deg, var(--cop-primary), var(--cop-primary-dark));
    box-shadow: var(--cop-shadow);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--cop-surface);
    border: 1px solid var(--cop-border);
    border-radius: calc(var(--cop-radius) + 4px);
    padding: clamp(1.5rem, 4vw, 2rem);
    box-shadow: var(--cop-shadow);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    color: var(--cop-muted);
    margin-bottom: 1.5rem;
}

.auth-form .input-group-text {
    background: var(--cop-primary-light);
    border-color: var(--cop-border);
    color: var(--cop-primary-dark);
}

.auth-form .form-control {
    border-color: var(--cop-border);
}

.auth-form .form-control:focus {
    border-color: var(--cop-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 110, 0.15);
}

.btn-primary {
    --bs-btn-bg: var(--cop-primary);
    --bs-btn-border-color: var(--cop-primary);
    --bs-btn-hover-bg: var(--cop-primary-dark);
    --bs-btn-hover-border-color: var(--cop-primary-dark);
    --bs-btn-active-bg: var(--cop-primary-dark);
    --bs-btn-active-border-color: var(--cop-primary-dark);
    font-weight: 600;
    border-radius: 12px;
}

.auth-footer {
    color: var(--cop-muted);
}

/* ─── App shell ─── */
.app-body {
    background: var(--cop-bg);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--cop-sidebar) 0%, #072929 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
    padding: 1.1rem 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.sidebar-logo-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 5.5rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sidebar-logo-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 4.5rem;
    object-fit: contain;
    object-position: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.sidebar-logo-img--custom {
    max-height: 4.25rem;
}

@media (max-width: 991.98px) {
    .sidebar-logo-frame {
        min-height: 4.75rem;
        padding: 0.75rem 0.9rem;
    }

    .sidebar-logo-img,
    .sidebar-logo-img--custom {
        max-height: 3.75rem;
    }
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--cop-accent);
}

.sidebar-link.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    position: relative;
}

.badge-soon {
    margin-left: auto;
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 700;
}

.user-info strong {
    display: block;
    font-size: 0.9rem;
}

.user-info small {
    color: rgba(255, 255, 255, 0.65);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    background: var(--cop-surface);
    border-bottom: 1px solid var(--cop-border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.btn-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--cop-border);
    border-radius: 12px;
    background: #fff;
    color: var(--cop-text);
}

.topbar-title h2 {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    margin: 0;
    font-weight: 700;
}

.topbar-title p {
    font-size: 0.85rem;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.role-admin {
    background: var(--cop-primary-light);
    color: var(--cop-primary-dark);
}

.role-owner {
    background: #fff4e5;
    color: #9a6700;
}

.app-content {
    padding: 1.25rem;
    flex: 1;
}

@media (min-width: 992px) {
    .app-content {
        padding: 1.75rem 2rem;
    }
}

/* ─── Cards & stats ─── */
.stat-card {
    background: var(--cop-surface);
    border: 1px solid var(--cop-border);
    border-radius: var(--cop-radius);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 14px rgba(15, 45, 45, 0.04);
    height: 100%;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: var(--cop-primary-light); color: var(--cop-primary); }
.stat-warning .stat-icon { background: #fff1e6; color: var(--cop-warning); }
.stat-success .stat-icon { background: #e8f7ef; color: var(--cop-success); }
.stat-info .stat-icon { background: #e7f9fd; color: #0891b2; }

.stat-label {
    display: block;
    color: var(--cop-muted);
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.panel-card {
    border: 1px solid var(--cop-border);
    border-radius: calc(var(--cop-radius) + 2px);
    box-shadow: var(--cop-shadow);
}

.panel-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--cop-primary-light);
    color: var(--cop-primary);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
}

.chip-muted {
    background: #eef2f6;
    color: var(--cop-muted);
}

/* ─── Propietario status hero ─── */
.status-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: calc(var(--cop-radius) + 4px);
    color: #fff;
    overflow: hidden;
}

.status-pending {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
}

.status-ok {
    background: linear-gradient(135deg, #43a047, #2e7d32);
}

.status-warning {
    background: linear-gradient(135deg, #fb8c00, #ef6c00);
}

.status-mora {
    background: linear-gradient(135deg, #e53935, #c62828);
}

.status-hero-icon {
    font-size: clamp(2.5rem, 8vw, 4rem);
    opacity: 0.35;
    line-height: 1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.18);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    margin-bottom: 0.65rem;
}

.status-title {
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.status-desc {
    opacity: 0.92;
    max-width: 560px;
}

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

.pasarela-option .pasarela-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--cop-radius);
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}

.pasarela-option input:checked + .pasarela-card {
    border-color: var(--cop-primary);
    background: #eef4ff;
}

.pasarela-option .pasarela-card i { font-size: 1.5rem; color: var(--cop-primary); }

.pasarela-logo-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eef4ff;
    color: var(--cop-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.notif-bell {
    text-decoration: none;
    color: var(--cop-text);
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

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

.firma-tipo-option .firma-tipo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--cop-radius);
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    height: 100%;
    transition: border-color 0.15s, background 0.15s;
}

.firma-tipo-option .firma-tipo-card small {
    font-weight: 400;
    color: var(--cop-muted);
    font-size: 0.75rem;
}

.firma-tipo-option input:checked + .firma-tipo-card {
    border-color: var(--cop-primary);
    background: #eef4ff;
}

.firma-tipo-option .firma-tipo-card i { font-size: 1.35rem; color: var(--cop-primary); }

.firma-preview-electronic {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.65rem;
    color: #1e293b;
}

.firma-preview-img {
    max-width: 240px;
    max-height: 85px;
    object-fit: contain;
}

.firma-preview-box {
    min-height: 120px;
}

.chip-primary {
    background: #eef4ff;
    color: var(--cop-primary);
}

/* ─── Offcanvas desktop sidebar ─── */
@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg {
        position: sticky;
        top: 0;
        height: 100vh;
        transform: none !important;
        visibility: visible !important;
        z-index: auto;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(85vw, 300px);
    }
}

/* ─── Estructura del conjunto (Fase 3) ─── */
.section-tabs-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.section-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.section-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--cop-border);
    background: var(--cop-surface);
    color: var(--cop-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.section-tab:hover {
    border-color: var(--cop-primary);
    color: var(--cop-primary);
}

.section-tab.active {
    background: var(--cop-primary);
    border-color: var(--cop-primary);
    color: #fff;
}

.conjunto-banner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--cop-surface);
    border: 1px solid var(--cop-border);
    border-radius: var(--cop-radius);
}

.coef-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
}

.coef-success { background: #e8f7ef; color: var(--cop-success); }
.coef-warning { background: #fff4e5; color: #9a6700; }
.coef-danger  { background: #fdecec; color: var(--cop-danger); }

.coef-progress {
    height: 10px;
    background: #e9eef3;
    border-radius: 999px;
    overflow: hidden;
}

.coef-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.coef-progress-bar.coef-success { background: linear-gradient(90deg, #198754, #20c997); }
.coef-progress-bar.coef-warning { background: linear-gradient(90deg, #fd7e14, #ffc107); }
.coef-progress-bar.coef-danger  { background: linear-gradient(90deg, #dc3545, #e35d6a); }

.stat-danger .stat-icon { background: #fdecec; color: var(--cop-danger); }

.data-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cop-muted);
    background: #f8fafc;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.data-table tbody td {
    vertical-align: middle;
}

.recent-list .list-group-item {
    border-color: var(--cop-border);
}

.bg-success-subtle { background-color: #e8f7ef !important; }
.bg-secondary-subtle { background-color: #eef2f6 !important; }
.bg-warning-subtle { background-color: #fff4e5 !important; }
.bg-danger-subtle { background-color: #fdecec !important; }
.bg-info-subtle { background-color: #e7f9fd !important; }

.text-success { color: var(--cop-success) !important; }
.text-secondary { color: var(--cop-muted) !important; }
.text-warning { color: #9a6700 !important; }
.text-danger { color: var(--cop-danger) !important; }
.text-info { color: #0891b2 !important; }

/* ─── Propietarios (Fase 4) ─── */
.owner-avatar {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--cop-primary-dark);
    background: var(--cop-primary-light);
}

.owner-meta li {
    padding: 0.35rem 0;
    font-size: 0.92rem;
}

.bg-primary-subtle { background-color: #e7f0ff !important; }
.text-primary { color: var(--cop-primary) !important; }
