:root {
    --bg: #f8f6ff;
    --panel: #ffffff;
    --panel-strong: #ffffff;
    --text: #24105E;
    --muted: #6f6688;
    --primary: #6238D6;
    --primary-dark: #40208F;
    --accent: #7548F3;
    --primary-soft: #E9E4FF;
    --primary-soft-strong: #C8BEFB;
    --border: #C8BEFB;
    --shadow: 0 24px 60px rgba(64, 32, 143, 0.12);
    --radius: 22px;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(103, 61, 230, 0.14), transparent 26%),
        radial-gradient(circle at bottom right, rgba(140, 133, 255, 0.16), transparent 22%),
        var(--bg);
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; }
p { color: var(--muted); line-height: 1.6; }
code { background: #E9E4FF; padding: 2px 6px; border-radius: 8px; word-break: break-word; }

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: rgba(255,255,255,0.9);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(12px);
    padding: 28px;
}
.sidebar-stack {
    position: sticky;
    top: 28px;
    display: grid;
    gap: 24px;
    align-content: start;
}
.brand { font-size: 1.4rem; font-weight: 700; }
.brand-subtitle { color: var(--muted); margin-top: 6px; }
.nav-menu { display: grid; gap: 12px; }
.nav-link {
    padding: 14px 16px;
    border-radius: 16px;
    background: #F3F0FF;
    color: var(--text);
    font-weight: 700;
}
.sidebar-footer { display: grid; gap: 12px; }
.main-content {
    min-width: 0;
    padding: 28px;
    overflow-x: hidden;
}
.page-header, .section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}
.page-header { margin-bottom: 24px; }
.project-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    align-items: start;
}
.project-header-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 18px 0 14px;
    background: linear-gradient(to bottom, rgba(248,246,255,.98), rgba(248,246,255,.90));
    backdrop-filter: blur(8px);
}

.project-title-with-logo {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.project-title-with-logo > div {
    min-width: 0;
}

.project-logo {
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 100px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px;
    flex-shrink: 0;
}

.report-brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.report-company-logo {
    width: auto;
    height: auto;
    max-width: 120px;
    max-height: 78px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    flex-shrink: 0;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 10px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card, .panel-card, .login-card {
    background: var(--panel);
    border: 1px solid rgba(231, 221, 207, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card { padding: 18px 20px; }
.stat-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 1.75rem; }
.panel-card { padding: 24px; margin-bottom: 24px; overflow: hidden; min-width: 0; }
.badge {
    background: #e6fffb;
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}
.table-responsive { overflow-x: auto; max-width: 100%; width: 100%; }
.small-table table td, .small-table table th { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; }
th, td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 14px 10px;
    vertical-align: top;
}
th { color: var(--muted); font-weight: 700; }
.filter-bar, .form-grid, .compact-form, .compact-grid {
    display: grid;
    gap: 14px;
}
.filter-bar {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}
.compact-filter-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
}
.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.compact-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label { display: grid; gap: 8px; font-weight: 600; }
label span { color: var(--muted); font-size: 0.92rem; }
input, textarea, select, button { font: inherit; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text);
}
textarea.code-block {
    font-family: Consolas, monospace;
    min-height: 110px;
    white-space: pre;
    overflow: auto;
}
.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #E9E4FF; color: #321477; border:1px solid #C8BEFB; }
.btn-secondary:hover { background:#C8BEFB; color:#24105E; text-decoration:none; }
.btn-block { width: 100%; }
.actions-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.align-end { align-items: end; }
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    min-width: 0;
}
.chart-card { min-height: 320px; }
.chart-frame {
    position: relative;
    height: 260px;
}
.chart-frame.compact { height: 190px; }
.chart-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    font-weight: 600;
}
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-success { background: #ecfdf5; color: #047857; }
.guest-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.guest-wrapper { width: min(100%, 480px); }
.login-card { padding: 32px; display: grid; gap: 20px; }
.login-help {
    padding: 14px 16px;
    border-radius: 16px;
    background: #f5efe4;
    color: var(--muted);
    line-height: 1.6;
}
.report-cover {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.report-meta { display: grid; gap: 8px; color: var(--muted); }
.script-heading { align-items: center; }
.script-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.section-copy {
    margin: 0;
    max-width: 760px;
}
.copy-feedback {
    min-height: 22px;
    margin-top: 10px;
    color: var(--primary-dark);
    font-weight: 600;
}
.whatsapp-config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.wa-config-card {
    background: #fffaf1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}
.filters-box { margin-bottom: 18px; }
.detail-panel {
    padding-top: 0;
}
.detail-header-sticky,
.detail-filters-sticky {
    position: sticky;
    z-index: 8;
    background: var(--panel);
}
.detail-header-sticky {
    top: 0;
    padding: 24px 24px 14px;
    margin: 0 -24px 0;
    border-bottom: 1px solid rgba(231, 221, 207, 0.6);
}
.detail-filters-sticky {
    top: 92px;
    padding: 18px 24px 18px;
    margin: 0 -24px 0;
    border-bottom: 1px solid rgba(231, 221, 207, 0.6);
}
.no-print { print-color-adjust: exact; }

@media (max-width: 1200px) {
    .project-header,
    .whatsapp-config-grid,
    .grid-2,
    .form-grid,
    .compact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-stack { position: static; }
    .compact-filter-form,
    .filter-bar { grid-template-columns: 1fr; }
    .project-title-with-logo,
    .report-brand-block {
        align-items: flex-start;
    }
    .project-logo {
        max-width: 96px;
        max-height: 72px;
        padding: 8px;
    }
    .report-company-logo {
        max-width: 96px;
        max-height: 64px;
        padding: 6px;
    }
    .project-header-sticky,
    .detail-header-sticky,
    .detail-filters-sticky {
        position: static;
        margin: 0;
        padding: 0;
        border-bottom: 0;
        background: transparent;
    }
}

.wide-table {
    width: max-content;
    min-width: 1950px;
    max-width: none;
    table-layout: auto;
}

.wide-table th,
.wide-table td {
    white-space: nowrap;
}

.visit-detail-table-wrap {
    overflow: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: 72vh;
    padding-bottom: 6px;
}

.visit-detail-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--panel-strong);
    box-shadow: inset 0 -1px 0 var(--border);
}


.full-width {
    grid-column: 1 / -1;
}

@media (min-width: 1280px) {
    .grid-3-xl {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.report-insights-card {
    display: grid;
    gap: 1.25rem;
}

.report-summary-text {
    margin: 0;
    color: var(--muted, #5b6b84);
    line-height: 1.7;
}

.compact-insights-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.report-insights-grid {
    align-items: start;
}

.subpanel-card {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(12, 37, 63, 0.08);
    border-radius: 1rem;
    padding: 1.1rem 1.15rem;
    box-shadow: 0 12px 30px rgba(12, 37, 63, 0.05);
}

.subpanel-card h3 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
}

.insight-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted, #5b6b84);
    line-height: 1.65;
}

.insight-list li + li {
    margin-top: 0.55rem;
}


/* v4.3: usuarios, 2FA y claves de reporting */
.project-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: .9rem;
    background: rgba(255,255,255,.65);
}

.check-card input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: .15rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.secret-code {
    overflow-wrap: anywhere;
    word-break: break-word;
    user-select: all;
}

.security-note {
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: .9rem;
    background: rgba(255,255,255,.72);
    color: var(--muted, #5b6b84);
}


/* v4.4: tablas filtrables con scroll vertical y cabecera fija */
.data-scroll {
    overflow: auto;
    width: 100%;
    max-width: 100%;
    max-height: 58vh;
    min-height: 180px;
    padding-bottom: 6px;
    scrollbar-gutter: stable both-edges;
}
.data-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--panel-strong);
    box-shadow: inset 0 -1px 0 var(--border);
}
.section-filter-form {
    margin: 14px 0 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.48);
}

/* v4.4: bloques de configuración plegables */
.config-details {
    margin-bottom: 18px;
    border: 1px solid rgba(231, 221, 207, .9);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.config-details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    font-weight: 800;
    color: var(--text);
    user-select: none;
}
.config-details > summary::-webkit-details-marker { display: none; }
.config-details > summary span { font-size: 1.05rem; }
.config-details > summary small {
    color: var(--muted);
    font-weight: 600;
    text-align: right;
}
.config-details > summary::after {
    content: "▾";
    color: var(--primary);
    font-size: 1.1rem;
    transition: transform .18s ease;
}
.config-details[open] > summary::after { transform: rotate(180deg); }
.config-details-body { padding: 0 14px 14px; }
.config-details-body > .panel-card {
    margin: 0;
    box-shadow: none;
    border-radius: 14px;
}
@media (max-width: 720px) {
    .config-details > summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .config-details > summary small { text-align: left; }
    .data-scroll { max-height: 68vh; }
}

.temporary-password-row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.temporary-password-row code { font-size:1.05rem; padding:12px 14px; background:#f3ede3; border-radius:12px; word-break:break-all; }
.user-actions { flex-wrap:wrap; }
.password-once-card { border-color:rgba(15,118,110,.35); }

/* v4.8.1: cabecera multiweb, scroll compacto y utilidades de integración */
.project-url-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 2px 0 6px;
}
.project-url-list a {
    font-size: .92rem;
    word-break: break-all;
}
.compact-data-scroll {
    max-height: min(42vh, 360px);
    min-height: 0;
}
.copy-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.shopify-webhook-box {
    border-color: rgba(15,118,110,.28);
}
.report-view-mode-note {
    margin: 0;
    font-size: .92rem;
}
.report-chart-grid {
    margin-bottom: 24px;
}
.report-chart-section .chart-card {
    margin-bottom: 0;
}
@media (max-width: 720px) {
    .copy-input-row { grid-template-columns: 1fr; }
}

/* v4.8.2: 2FA persistente y responsive móvil */
.twofactor-setup-card,
.twofactor-challenge-card {
    width: 100%;
    min-width: 0;
}
.twofactor-heading h1 {
    font-size: clamp(1.65rem, 5vw, 2.15rem);
    line-height: 1.15;
}
.twofactor-heading p { margin-bottom: 0; }
.twofactor-info-grid {
    display: grid;
    gap: 12px;
}
.twofactor-data-card {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f7f1e8;
}
.twofactor-data-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 700;
}
.twofactor-account {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.twofactor-secret-row,
.twofactor-uri-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.twofactor-secret {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: .92rem;
    line-height: 1.5;
    letter-spacing: .035em;
}
.twofactor-uri-details {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255,255,255,.58);
    padding: 12px 14px;
}
.twofactor-uri-details summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}
.twofactor-uri-details p {
    margin: 8px 0 10px;
    font-size: .9rem;
}
.twofactor-uri {
    display: block;
    min-width: 0;
    max-height: 110px;
    overflow: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: .78rem;
    line-height: 1.45;
}
.twofactor-copy-feedback {
    display: block;
    min-height: 0;
    margin-top: 6px;
    font-size: .82rem;
}
.twofactor-code-input {
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: .35em;
    padding-left: calc(14px + .35em);
}

@media (max-width: 720px) {
    body { font-size: 15px; }
    .guest-body {
        display: block;
        padding: 12px;
    }
    .guest-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    .login-card {
        padding: 20px 16px;
        gap: 16px;
        border-radius: 18px;
    }
    .twofactor-secret-row,
    .twofactor-uri-row {
        grid-template-columns: 1fr;
    }
    .twofactor-copy-btn { width: 100%; }

    .sidebar { padding: 14px; }
    .sidebar-stack { gap: 14px; }
    .nav-menu {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 8px;
    }
    .nav-link {
        padding: 11px 12px;
        font-size: .92rem;
        text-align: center;
    }
    .main-content { padding: 14px; }
    .page-header,
    .section-heading,
    .report-cover {
        flex-direction: column;
        align-items: stretch;
    }
    .panel-card { padding: 16px; border-radius: 18px; }
    .stat-card { padding: 14px 15px; }
    .stats-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 10px;
    }
    .stat-card strong { font-size: 1.4rem; }
    .actions-row {
        flex-wrap: wrap;
        width: 100%;
    }
    .actions-row > .btn,
    .actions-row > button,
    .actions-row > a.btn {
        flex: 1 1 140px;
    }
    .project-title-with-logo,
    .report-brand-block {
        flex-direction: column;
    }
    .project-url-list { flex-direction: column; gap: 4px; }
    .form-grid,
    .compact-grid,
    .filter-bar,
    .compact-filter-form {
        grid-template-columns: 1fr !important;
    }
    .chart-card { min-height: 280px; }
    .chart-frame { height: 230px; }
    .wide-table { min-width: 1250px; }
}

@media (max-width: 420px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card span { font-size: .84rem; }
    .stat-card strong { font-size: 1.25rem; }
    .nav-menu { grid-template-columns: 1fr; }
    .twofactor-code-input { font-size: 1.15rem; }
}

/* v4.9.0 - diagnóstico del tracker por web */
.tracker-health-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 10px 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.55);
    font-size: .86rem;
    overflow-wrap: anywhere;
}
@media (max-width: 720px) {
    .tracker-health-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
}


/* v4.9.1 - alta de 2FA por QR local */
.twofactor-qr-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; align-items:center; padding:20px; margin:18px 0; border:1px solid var(--border); border-radius:20px; background:#fff; }
.twofactor-qr-card h2 { margin:4px 0 8px; font-size:1.18rem; }
.twofactor-qr-card p { margin:0; color:var(--muted); line-height:1.55; }
.totp-qr { width:240px; min-width:240px; min-height:240px; display:grid; place-items:center; padding:8px; border:1px solid var(--border); border-radius:16px; background:#fff; overflow:hidden; }
.totp-qr svg { display:block; width:100%; height:auto; }
.twofactor-manual-intro { margin:18px 0 10px; color:var(--muted); }
.looker-csv-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.looker-csv-note { padding:12px 14px; border-radius:14px; background:rgba(15,118,110,.08); border:1px solid rgba(15,118,110,.16); }
@media (max-width: 700px) { .twofactor-qr-card { grid-template-columns:1fr; } .totp-qr { width:min(240px,100%); min-width:0; margin:0 auto; } .looker-csv-actions .btn { width:100%; justify-content:center; } }

/* v4.9.3 - rebranding Trackly y simplificación visual */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.brand-logo {
    display: block;
    width: 138px;
    max-width: 100%;
    height: auto;
}
.brand-wordmark {
    font-size: 0;
}
.guest-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 10px 4px;
    color: var(--text);
    justify-content: center;
}
.guest-brand-logo {
    width: 148px;
    max-width: 55vw;
    height: auto;
    display: block;
}
.guest-brand strong {
    display: block;
    font-size: 1.05rem;
}
.guest-brand span {
    display: block;
    font-size: .92rem;
    color: var(--muted);
}
.report-cover-enhanced {
    gap: 24px;
}
.report-platform-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.report-platform-brand img {
    width: 108px;
    height: auto;
    display: block;
}
.report-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.report-meta-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(255,255,255,.68);
}
.report-meta-card span {
    display: block;
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.report-meta-card strong {
    display: block;
    font-size: .96rem;
    overflow-wrap: anywhere;
}
.report-summary-text {
    margin-top: 16px;
}
.report-limit-note,
.table-limit-note {
    margin-top: 10px;
    font-size: .88rem;
    color: var(--muted);
}
.load-more-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}
.module-note {
    margin: 6px 0 0;
    font-size: .85rem;
    color: var(--muted);
}
.module-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255,255,255,.55);
    padding: 14px 16px;
}
.module-card .checkbox-row {
    margin-bottom: 0;
}
.module-section {
    padding-top: 2px;
}
.module-section[hidden] {
    display: none !important;
}
.simple-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}
.simple-kpi {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255,255,255,.72);
}
.simple-kpi span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .9rem;
}
.simple-kpi strong {
    display: block;
    font-size: 1.55rem;
}
.report-chart-grid .chart-card {
    min-height: 330px;
}
.report-chart-grid .chart-frame {
    height: 265px;
}
.inline-muted {
    color: var(--muted);
    font-size: .9rem;
}

/* Ajuste QR: texto arriba y QR debajo */
.twofactor-qr-card {
    grid-template-columns: 1fr;
    justify-items: start;
    align-items: start;
}
.totp-qr {
    margin-top: 6px;
}
.twofactor-qr-copy {
    max-width: 620px;
}

@media (max-width: 720px) {
    .brand-logo { width: 120px; }
    .guest-brand { align-items: flex-start; }
    .guest-brand-logo { width: 128px; }
    .report-chart-grid .chart-card { min-height: 300px; }
    .report-chart-grid .chart-frame { height: 235px; }
    .simple-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* v4.9.5 - logos resilientes */
.project-logo-fallback,
.report-logo-fallback {
    display: grid;
    place-items: center;
    background: rgba(15,118,110,.10);
    color: #0f766e;
    font-weight: 800;
    letter-spacing: .03em;
    border: 1px solid rgba(15,118,110,.18);
}
.project-logo-fallback {
    min-width: 56px;
    min-height: 56px;
    border-radius: 14px;
}
.report-logo-fallback {
    width: 86px;
    height: 64px;
    border-radius: 12px;
    font-size: 1.15rem;
}

/* v4.9.6 - graficas sin dependencia externa */
.chart-frame canvas.chart-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.dashboard-chart-grid,
.report-chart-grid {
    align-items: stretch;
}
.chart-card-wide {
    grid-column: span 2;
}
@media (min-width: 1240px) {
    .dashboard-chart-grid .chart-card-wide,
    .report-chart-grid .chart-card-wide {
        grid-column: span 2;
    }
}
@media (max-width: 900px) {
    .chart-card-wide {
        grid-column: auto;
    }
}

/* v4.9.8 - mayor espacio inferior para etiquetas de gráficas */
.dashboard-chart-grid .chart-frame,
.report-chart-grid .chart-frame {
    height: 290px;
}
@media (max-width: 720px) {
    .dashboard-chart-grid .chart-frame,
    .report-chart-grid .chart-frame {
        height: 270px;
    }
}


/* Trackly v5.0.0 */
.brand-logo-wordmark { width: min(190px,100%); height:auto; max-height:52px; object-fit:contain; object-position:left center; }
.guest-brand-wordmark { width:min(240px,72vw); height:auto; max-height:68px; object-fit:contain; }
.checkbox-row input[type="checkbox"] { width:1.05rem; height:1.05rem; flex:0 0 auto; margin:0; }
.btn-danger { background:#b42318; color:#fff; border-color:#b42318; }
.btn-danger:hover { background:#912018; text-decoration:none; }
.pagination-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:14px; padding-top:12px; border-top:1px solid var(--border); color:var(--muted); font-weight:700; }
.journey-cell { min-width:300px; max-width:520px; white-space:normal!important; line-height:1.45; }
.section-help-tip { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; margin-left:7px; border-radius:999px; border:1px solid var(--border); color:var(--primary); background:#fff; font-size:12px; font-weight:800; cursor:help; vertical-align:middle; }
.section-help-tip:hover::after { content:attr(data-help); position:absolute; z-index:50; max-width:300px; padding:10px 12px; margin:34px 0 0 0; border:1px solid var(--border); border-radius:12px; background:#25164f; color:#fff; box-shadow:var(--shadow); font-weight:600; line-height:1.4; }
@media (max-width:720px) {
  .brand-logo-wordmark { width:165px; }
  .page-header .actions-row,.section-heading .actions-row { width:100%; }
  .actions-row { flex-wrap:wrap; }
  .actions-row .btn { flex:1 1 150px; justify-content:center; }
  .pagination-row { align-items:stretch; flex-direction:column; }
  .pagination-row .actions-row .btn { width:100%; }
  .wide-table { font-size:.82rem; }
  .form-grid,.compact-grid { grid-template-columns:1fr!important; }
  .guest-brand { justify-content:center; }
}

/* Ajustes finales de identidad v5 sobre reglas heredadas */
.nav-link { background:#f0edff; }
.project-header-sticky { background:linear-gradient(to bottom,rgba(245,243,255,.98),rgba(245,243,255,.90)); }
code,.temporary-password-row code { background:#f0edff; }
.twofactor-data-card { background:#f7f5ff; }
.password-once-card,.shopify-webhook-box { border-color:rgba(103,61,230,.30); }
.looker-csv-note { background:rgba(103,61,230,.08); border-color:rgba(103,61,230,.18); }


/* Trackly v5.1.0 - clientes, navegación y paleta visual consistente */
.nav-link:hover { background:#E9E4FF; color:#321477; text-decoration:none; }
.nav-icon { display:inline-grid; place-items:center; width:25px; min-width:25px; height:25px; border-radius:9px; background:#E9E4FF; color:#40208F; font-size:.82rem; line-height:1; }
.btn-accent { background:#7548F3; color:#fff; border:1px solid #7548F3; }
.btn-accent:hover { background:#6238D6; color:#fff; text-decoration:none; }
.btn-outline { background:#fff; color:#40208F; border:1px solid #8C6AF5; }
.btn-outline:hover { background:#E9E4FF; color:#24105E; text-decoration:none; }
.btn-compact { padding:9px 12px; border-radius:12px; }
.user-actions .btn { min-height:40px; white-space:nowrap; }
.user-actions form { margin:0; }

.sidebar-brand-row { position:relative; min-width:0; }
.brand-lockup { text-decoration:none; min-height:54px; }
.brand-lockup:hover { text-decoration:none; }
.brand-logo-mark { display:none; width:44px; height:44px; object-fit:contain; }
.sidebar-toggle { position:absolute; right:-14px; top:12px; width:30px; height:30px; border:1px solid #C8BEFB; border-radius:999px; background:#fff; color:#40208F; cursor:pointer; display:grid; place-items:center; font-size:22px; font-weight:800; box-shadow:0 8px 20px rgba(64,32,143,.12); z-index:5; }
.sidebar-toggle:hover { background:#E9E4FF; }
.app-shell { transition:grid-template-columns .2s ease; }
.sidebar { transition:padding .2s ease; }
body.sidebar-collapsed .app-shell { grid-template-columns:92px minmax(0,1fr); }
body.sidebar-collapsed .sidebar { padding:22px 14px; }
body.sidebar-collapsed .brand-logo-wordmark,
body.sidebar-collapsed .brand-subtitle,
body.sidebar-collapsed .nav-link span,
body.sidebar-collapsed .sidebar-user,
body.sidebar-collapsed .sidebar-logout span { display:none; }
body.sidebar-collapsed .brand-logo-mark { display:block; margin:0 auto; }
body.sidebar-collapsed .brand-lockup { justify-content:center; }
body.sidebar-collapsed .nav-link,
body.sidebar-collapsed .sidebar-logout { padding:12px; justify-content:center; }
body.sidebar-collapsed .sidebar-toggle { right:-10px; transform:rotate(180deg); }
body.sidebar-collapsed .sidebar-stack { gap:18px; }

.project-groups { display:grid; gap:30px; }
.project-group-block { display:grid; gap:16px; }
.project-group-heading { display:flex; align-items:end; justify-content:space-between; gap:16px; padding:0 4px; }
.project-group-heading h2 { margin:2px 0 0; }
.project-group-heading h2 a { color:#24105E; }
.project-visual-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(245px,1fr)); gap:18px; }
.project-visual-card { display:flex; flex-direction:column; min-width:0; background:#fff; border:1px solid #C8BEFB; border-radius:20px; overflow:hidden; box-shadow:0 12px 30px rgba(64,32,143,.07); transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease; }
.project-visual-card:hover { transform:translateY(-2px); border-color:#8C6AF5; box-shadow:0 18px 34px rgba(64,32,143,.12); }
.project-visual-link { display:grid; grid-template-rows:150px auto; color:inherit; text-decoration:none; flex:1; }
.project-visual-link:hover { text-decoration:none; }
.project-visual-logo { display:grid; place-items:center; background:linear-gradient(145deg,#fff,#F3F0FF); border-bottom:1px solid #E9E4FF; padding:20px; }
.project-visual-logo img { display:block; max-width:100%; max-height:110px; object-fit:contain; }
.project-visual-logo span { display:grid; place-items:center; width:76px; height:76px; border-radius:22px; background:#E9E4FF; color:#40208F; font-size:1.45rem; font-weight:800; }
.project-visual-copy { padding:17px 18px 14px; min-width:0; }
.project-visual-copy h3 { color:#24105E; margin-bottom:6px; }
.project-visual-copy p { margin:0 0 12px; overflow-wrap:anywhere; }
.project-card-meta { display:flex; gap:9px; flex-wrap:wrap; color:#6f6688; font-size:.82rem; font-weight:700; }
.project-card-meta span { padding:5px 8px; border-radius:999px; background:#F3F0FF; }
.project-card-actions { padding:0 18px 18px; display:flex; gap:9px; flex-wrap:wrap; }
.project-card-actions form { margin:0; }

.client-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:20px; }
.client-card { background:#fff; border:1px solid #C8BEFB; border-radius:22px; box-shadow:0 14px 34px rgba(64,32,143,.08); overflow:hidden; }
.client-card-main { display:grid; grid-template-columns:auto minmax(0,1fr); gap:18px; padding:22px; color:inherit; text-decoration:none; }
.client-card-main:hover { text-decoration:none; background:#FBFAFF; }
.client-avatar { width:58px; height:58px; display:grid; place-items:center; border-radius:18px; background:#6238D6; color:#fff; font-weight:900; font-size:1.05rem; }
.client-avatar-lg { width:72px; height:72px; border-radius:22px; font-size:1.25rem; }
.client-meta { display:flex; gap:8px; flex-wrap:wrap; color:#6f6688; font-size:.85rem; font-weight:700; }
.client-meta span { background:#E9E4FF; padding:5px 9px; border-radius:999px; }
.client-title-row { display:flex; align-items:center; gap:18px; }
.empty-state { text-align:center; padding:42px 24px; }

.dashboard-project-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:14px; margin-top:18px; }
.dashboard-project-card { display:grid; grid-template-columns:72px minmax(0,1fr); gap:14px; align-items:center; padding:14px; border:1px solid #E9E4FF; border-radius:17px; color:inherit; background:#fff; }
.dashboard-project-card:hover { background:#F8F6FF; border-color:#A994F8; text-decoration:none; }
.dashboard-project-logo { width:72px; height:62px; display:grid; place-items:center; border-radius:14px; background:#F3F0FF; overflow:hidden; }
.dashboard-project-logo img { max-width:62px; max-height:52px; object-fit:contain; }
.dashboard-project-logo span { font-weight:900; color:#40208F; }
.dashboard-project-copy { min-width:0; display:grid; gap:3px; }
.dashboard-project-copy strong { color:#24105E; }
.dashboard-project-copy small { color:#6238D6; font-weight:800; }
.dashboard-project-copy span { color:#6f6688; font-size:.82rem; }

.web-switcher-card { margin-bottom:24px; }
.web-switcher-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:12px; margin-top:14px; }
.web-switcher-item { display:grid; gap:4px; padding:14px 16px; border:1px solid #C8BEFB; border-radius:16px; background:#fff; color:#24105E; min-width:0; }
.web-switcher-item:hover { text-decoration:none; background:#F8F6FF; border-color:#8C6AF5; }
.web-switcher-item.is-active { background:#E9E4FF; border-color:#6238D6; box-shadow:inset 0 0 0 1px #6238D6; }
.web-switcher-item span { color:#6f6688; font-size:.84rem; overflow-wrap:anywhere; }
.web-switcher-item small { color:#6238D6; font-weight:800; }

.danger-zone { margin-top:20px; padding:16px; border:1px solid #fecaca; background:#fffafa; border-radius:16px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.danger-zone p { margin:4px 0 0; }
.sales-chart-grid { margin-top:0; }

@media (max-width:980px) {
    body.sidebar-collapsed .app-shell { grid-template-columns:1fr; }
    .sidebar-toggle { right:0; }
    body.sidebar-collapsed .sidebar { padding:14px; }
    body.sidebar-collapsed .brand-logo-wordmark { display:block; }
    body.sidebar-collapsed .brand-logo-mark { display:none; }
    body.sidebar-collapsed .brand-lockup { justify-content:flex-start; }
    body.sidebar-collapsed .brand-subtitle { display:block; }
    body.sidebar-collapsed .nav-menu,
    body.sidebar-collapsed .sidebar-footer { display:none; }
    body.sidebar-collapsed .sidebar-toggle { right:0; }
}
@media (max-width:720px) {
    .project-visual-grid,.client-grid,.dashboard-project-grid,.web-switcher-grid { grid-template-columns:1fr; }
    .project-group-heading,.client-detail-header,.danger-zone { align-items:flex-start; flex-direction:column; }
    .client-card-main { grid-template-columns:1fr; }
    .client-avatar { width:52px; height:52px; }
    .sales-chart-grid { grid-template-columns:1fr; }
}


/* Trackly v5.1.1 - filtros de proyectos y contraste visual */
.project-search-panel { margin-bottom:24px; }
.project-search-form {
    display:grid;
    grid-template-columns:minmax(240px,2fr) minmax(190px,1fr) auto;
    gap:14px;
    align-items:end;
}
.project-search-actions { align-items:end; }
.project-search-actions .btn { min-height:46px; }
.config-details > summary { cursor:pointer; }
.config-details:not([open]) > summary { margin-bottom:0; }
@media (max-width:900px) {
    .project-search-form { grid-template-columns:1fr; }
    .project-search-actions { width:100%; }
    .project-search-actions .btn { flex:1 1 140px; }
}

/* Trackly v5.2.0 - Bootstrap Icons, sidebar preciso y comparación de periodos */
.nav-link,
.sidebar-logout {
    display:flex;
    align-items:center;
    gap:12px;
    min-height:52px;
}
.nav-icon {
    display:inline-grid;
    place-items:center;
    width:34px;
    min-width:34px;
    height:34px;
    border-radius:11px;
    background:#E9E4FF;
    color:#40208F;
    font-size:1.05rem;
    line-height:1;
    font-weight:400;
}
.nav-link:hover .nav-icon,
.sidebar-logout:hover .nav-icon {
    background:#C8BEFB;
    color:#24105E;
}
.sidebar-toggle {
    width:34px;
    height:34px;
    padding:0;
    right:-17px;
    top:10px;
    font-size:1rem;
    line-height:1;
}
.sidebar-toggle .bi {
    display:grid;
    place-items:center;
    width:100%;
    height:100%;
    line-height:1;
}
.brand-logo-mark {
    width:48px;
    height:48px;
    border-radius:13px;
    object-fit:contain;
    object-position:center;
}
body.sidebar-collapsed .nav-link,
body.sidebar-collapsed .sidebar-logout {
    width:56px;
    height:56px;
    min-height:56px;
    padding:0;
    margin-inline:auto;
    border-radius:16px;
    justify-content:center;
}
body.sidebar-collapsed .nav-icon {
    width:34px;
    min-width:34px;
    height:34px;
    margin:0;
}
body.sidebar-collapsed .sidebar-toggle {
    transform:none;
}
body.sidebar-collapsed .brand-lockup {
    min-height:56px;
    align-items:center;
}

.comparison-details { margin:22px 0; }
.comparison-panel { margin:0; }
.comparison-form {
    grid-template-columns:repeat(4,minmax(150px,1fr));
    align-items:end;
}
.comparison-period-labels {
    display:grid;
    grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr);
    gap:10px 14px;
    align-items:center;
    padding:14px 16px;
    margin:18px 0 12px;
    border-radius:15px;
    background:#F8F6FF;
    border:1px solid #E9E4FF;
}
.comparison-period-labels strong { color:#321477; }
.comparison-period-labels span { color:#6f6688; font-weight:700; }
.comparison-table th:nth-child(n+2),
.comparison-table td:nth-child(n+2) { text-align:right; }
.comparison-up { color:#40208F; font-weight:800; }
.comparison-down { color:#9f1239; font-weight:800; }
.comparison-flat { color:#6f6688; font-weight:700; }
.comparison-alert { margin-top:16px; }

@media (max-width:980px) {
    .comparison-form { grid-template-columns:repeat(2,minmax(150px,1fr)); }
    body.sidebar-collapsed .nav-link,
    body.sidebar-collapsed .sidebar-logout { width:auto; height:auto; min-height:52px; margin:0; padding:12px 14px; justify-content:flex-start; }
}
@media (max-width:720px) {
    .comparison-form { grid-template-columns:1fr; }
    .comparison-period-labels { grid-template-columns:1fr; }
}

/* Trackly v5.2.4 · detalle CRM Lucid */
.inline-details > summary{cursor:pointer;color:#5127B0;font-weight:700;white-space:nowrap}
.contact-detail-grid{display:grid;grid-template-columns:minmax(120px,auto) minmax(180px,1fr);gap:7px 12px;min-width:360px;max-width:680px;padding:12px 0 4px}
.contact-detail-grid strong{color:#24105E}
.contact-detail-grid span{white-space:normal;overflow-wrap:anywhere}
@media(max-width:700px){.contact-detail-grid{grid-template-columns:1fr;min-width:240px}}

/* v5.2.5 · progreso de sincronización Google Sheets */
.sheets-sync-progress{margin-top:14px;padding:14px 16px;border:1px solid #C8BEFB;border-radius:14px;background:#faf9ff}
.sheets-sync-progress.is-error{border-color:#ef4444;background:#fff7f7}
.sheets-sync-progress-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:9px;color:#24105E}
.sheets-sync-progress-track{height:9px;border-radius:999px;background:#E9E4FF;overflow:hidden;margin-bottom:8px}
.sheets-sync-progress-track>span{display:block;width:3%;height:100%;border-radius:inherit;background:#6238D6;transition:width .2s ease}
.sheets-sync-progress.is-error .sheets-sync-progress-track>span{background:#dc2626}
@media(max-width:720px){.sheets-sync-progress-head{align-items:flex-start;flex-direction:column}}


/* Trackly v5.5.0 · selección y descarga de filas */
.row-select-cell{width:42px;min-width:42px;text-align:center!important;vertical-align:middle}
.row-select-cell input{width:17px;height:17px;accent-color:#6238D6;cursor:pointer}
.selected-export-button:disabled{opacity:.55;cursor:not-allowed}
.selected-export-actions{margin-left:auto}
@media(max-width:720px){.selected-export-actions{margin-left:0;width:100%}.selected-export-button{width:100%}}

/* Trackly v5.5.1 · selector de columnas de exportación */
.export-column-picker,
.selected-column-picker {
    margin: 12px 0 16px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: var(--surface, #fff);
}
.export-column-picker > summary,
.selected-column-picker > summary {
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.export-column-picker > summary small { font-weight: 400; opacity: .75; }
.export-column-picker-body { padding: 0 14px 14px; }
.export-column-presets { margin-bottom: 12px; flex-wrap: wrap; }
.export-column-grid,
.selected-column-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 12px;
}
.selected-column-grid { padding: 10px 12px 12px; min-width: 320px; }
.export-column-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .92rem;
}
.selected-column-picker { margin: 0; position: relative; }
.selected-column-picker[open] { z-index: 40; }
.selected-column-picker > summary { padding: 8px 10px; font-size: .9rem; }
@media (max-width: 760px) {
    .export-column-grid,
    .selected-column-grid { grid-template-columns: 1fr 1fr; min-width: 0; }
    .export-column-picker > summary { align-items: flex-start; flex-direction: column; }
}

/* Trackly v5.5.2 · paneles de informe con actualización AJAX */
[data-report-panel] {
    position: relative;
}
[data-report-panel].report-panel-loading {
    opacity: .58;
    pointer-events: none;
    transition: opacity .15s ease;
}
[data-report-panel].report-panel-loading::after {
    content: "Actualizando informe…";
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 30;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(90,64,180,.18);
    box-shadow: 0 6px 18px rgba(36,16,94,.12);
    font-size: 12px;
    font-weight: 700;
}
.section-filter-form input[type="date"],
.detail-filters-sticky input[type="date"] {
    min-width: 150px;
}
.pagination-row > span {
    font-variant-numeric: tabular-nums;
}


/* Trackly v5.6.0 · navegación modular de proyectos */
.project-workspace-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
    margin: -8px 0 20px;
    border: 1px solid rgba(98,56,214,.16);
    border-radius: 18px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 12px 34px rgba(64,32,143,.08);
    scrollbar-width: thin;
}
.project-workspace-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 13px;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s ease,color .16s ease,box-shadow .16s ease;
}
.project-workspace-tab:hover { background: var(--primary-soft); color: var(--primary-dark); }
.project-workspace-tab.is-active {
    color: #fff;
    background: linear-gradient(135deg,var(--primary),var(--accent));
    box-shadow: 0 8px 22px rgba(98,56,214,.22);
}
.project-workspace-tab:focus-visible { outline: 3px solid rgba(98,56,214,.28); outline-offset: 2px; }

.project-overview-grid {
    display: grid;
    grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr);
    gap: 18px;
    margin-bottom: 20px;
}
.project-health-card,.project-quick-setup-card { margin: 0; }
.project-health-overall {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.project-health-ok { background: #e7f8ef; color: #17663a; }
.project-health-warning { background: #fff4dc; color: #8a5b00; }
.project-health-missing { background: #f1eef8; color: var(--muted); }
.project-health-grid {
    display: grid;
    grid-template-columns: repeat(5,minmax(130px,1fr));
    gap: 10px;
    margin-top: 14px;
}
.project-health-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(98,56,214,.12);
    border-radius: 14px;
    background: linear-gradient(180deg,#fff,rgba(248,246,255,.7));
}
.project-health-item span,.project-health-item small { display: block; }
.project-health-item span { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.project-health-item strong { display: block; margin-bottom: 4px; font-size: 14px; overflow-wrap: anywhere; }
.project-health-item small { color: var(--muted); line-height: 1.35; }
.project-quick-snippet { min-height: 100px; }

@media screen {
    body.project-tabs-ready.project-tab-resumen [data-project-area]:not([data-project-area="resumen"]),
    body.project-tabs-ready.project-tab-trafico [data-project-area]:not([data-project-area="trafico"]),
    body.project-tabs-ready.project-tab-crm [data-project-area]:not([data-project-area="crm"]),
    body.project-tabs-ready.project-tab-ventas [data-project-area]:not([data-project-area="ventas"]),
    body.project-tabs-ready.project-tab-integraciones [data-project-area]:not([data-project-area="integraciones"]),
    body.project-tabs-ready.project-tab-datos [data-project-area]:not([data-project-area="datos"]),
    body.project-tabs-ready.project-tab-configuracion [data-project-area]:not([data-project-area="configuracion"]),
    body.project-tabs-ready.project-tab-diagnostico [data-project-area]:not([data-project-area="diagnostico"]) {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    .project-overview-grid { grid-template-columns: 1fr; }
    .project-health-grid { grid-template-columns: repeat(3,minmax(140px,1fr)); }
}
@media (max-width: 760px) {
    .project-workspace-nav { margin-top: 0; padding: 6px; border-radius: 14px; }
    .project-workspace-tab { min-height: 40px; padding: 8px 11px; font-size: 13px; }
    .project-health-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
    .project-health-grid { grid-template-columns: 1fr; }
}

/* Trackly v5.6.1 · consolidación CRM, Integraciones y Datos/API */
.project-center-card { margin-bottom: 18px; }
.integration-status-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 12px;
}
.integration-status-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 15px;
    border: 1px solid rgba(98,56,214,.14);
    border-radius: 16px;
    background: linear-gradient(180deg,#fff,rgba(249,247,255,.72));
}
.integration-status-card > div { display:flex; align-items:center; gap:8px; }
.integration-status-card > div i { color:var(--primary); font-size:18px; }
.integration-status-card > span { font-size:12px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.integration-status-card > small { color:var(--muted); line-height:1.4; min-height:34px; }
.integration-status-card.is-connected { border-color:rgba(31,143,87,.22); box-shadow:inset 0 3px 0 rgba(31,143,87,.12); }
.integration-status-card.is-connected > span { color:#17663a; }
.integration-status-card.is-pending { border-color:rgba(181,126,0,.18); }
.integration-status-card .btn { margin-top:auto; align-self:flex-start; padding:7px 10px; min-height:34px; font-size:12px; }
.integration-dataset-badges { margin:14px 0; flex-wrap:wrap; }
.integration-guide-list { padding-left:22px; line-height:1.7; }
.status-pill { display:inline-flex; align-items:center; min-height:30px; padding:5px 10px; border-radius:999px; font-size:12px; font-weight:800; }
.status-ok { background:#e7f8ef; color:#17663a; }
.status-muted { background:#f1eef8; color:var(--muted); }

.crm-master-panel { overflow:visible; }
.crm-summary-grid { margin-bottom:16px; }
.crm-master-table td { vertical-align:top; }
.table-secondary-line { display:block; margin-top:4px; color:var(--muted); font-size:11px; line-height:1.35; }
.crm-outcome { display:inline-flex; align-items:center; min-height:25px; padding:3px 8px; border-radius:999px; background:#f1eef8; color:var(--muted); font-size:11px; font-weight:800; text-transform:uppercase; }
.crm-outcome-won,.crm-outcome-ganado,.crm-outcome-paid { background:#e7f8ef; color:#17663a; }
.crm-outcome-lost,.crm-outcome-perdido { background:#ffe9e7; color:#9a2b22; }
.crm-outcome-open,.crm-outcome-abierto { background:#fff4dc; color:#8a5b00; }
.crm-row-detail { min-width:110px; }
.crm-row-detail > summary { cursor:pointer; color:var(--primary); font-weight:800; white-space:nowrap; }
.crm-row-detail[open] { min-width:min(680px,70vw); }
.crm-detail-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(150px,1fr));
    gap:10px;
    margin-top:10px;
    padding:12px;
    border:1px solid rgba(98,56,214,.14);
    border-radius:14px;
    background:#fff;
    box-shadow:0 12px 28px rgba(39,22,87,.10);
}
.crm-detail-grid > div { min-width:0; padding:8px; border-radius:10px; background:rgba(248,246,255,.72); }
.crm-detail-grid span,.crm-detail-grid strong { display:block; overflow-wrap:anywhere; }
.crm-detail-grid span { color:var(--muted); font-size:11px; margin-bottom:4px; }
.crm-detail-grid strong { font-size:12px; }
.crm-detail-wide { grid-column:1 / -1; }

@media (max-width: 1200px) {
    .integration-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .crm-detail-grid { grid-template-columns:repeat(2,minmax(140px,1fr)); }
}
@media (max-width: 700px) {
    .integration-status-grid { grid-template-columns:1fr; }
    .crm-detail-grid { grid-template-columns:1fr; }
    .crm-detail-wide { grid-column:auto; }
    .crm-row-detail[open] { min-width:min(520px,84vw); }
}


/* Trackly v5.6.2 · configuración simplificada y diagnóstico separado */
.configuration-center-grid,
.diagnostic-center-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.diagnostic-center-grid .integration-status-card { background:linear-gradient(180deg,#fff,rgba(245,247,252,.82)); }
.diagnostic-relocation-note {
    display:flex;
    align-items:flex-start;
    gap:8px;
    margin-top:12px;
    padding:10px 12px;
    border:1px solid rgba(181,126,0,.18);
    border-radius:12px;
    background:#fffaf0;
}
.site-technical-details {
    margin-top:12px;
    border:1px solid rgba(98,56,214,.12);
    border-radius:14px;
    background:rgba(248,246,255,.55);
    overflow:hidden;
}
.site-technical-details > summary {
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:11px 13px;
    font-weight:800;
    color:var(--primary-dark);
}
.site-technical-details > summary small { color:var(--muted); font-weight:500; text-align:right; }
.site-technical-body { padding:0 13px 13px; }
.site-technical-body .tracker-health-row { margin:4px 0 12px; }
.badge-success { background:#e7f8ef !important; color:#17663a !important; }
.badge-muted { background:#f1eef8 !important; color:var(--muted) !important; }
#diagnostic-center .badge { white-space:nowrap; }
@media (max-width: 1100px) {
    .configuration-center-grid,
    .diagnostic-center-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
    .configuration-center-grid,
    .diagnostic-center-grid { grid-template-columns:1fr; }
    .site-technical-details > summary { align-items:flex-start; flex-direction:column; }
    .site-technical-details > summary small { text-align:left; }
}
