/* CCTVControl — Panel, Páginas y Landing (Tema Dark Negro y Amarillo) */

/* ── Shell & Sidebar ────────────────────────────── */
.app-shell { min-height: 100vh; display: flex; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 24px 14px 16px;
    color: #c0c0c0;
    background: #111111;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 24px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 8px;
}
.sidebar-top .brand-small { color: #fff; font-size: 20px; font-weight: 800; text-decoration: none; }
.sidebar-top .brand-small span { color: var(--accent); }
.brand-small { font-size: 20px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; display: inline-flex; }
.brand-small span { color: var(--accent); }
.sidebar-close, .mobile-bar, .sidebar-toggle, .sidebar-backdrop { display: none; }

.sidebar-label {
    color: #666;
    margin: 16px 12px 6px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: 10.5px;
    font-weight: 800;
}

.sidebar-nav { display: grid; gap: 3px; }
.sidebar-nav a {
    color: #aaa;
    text-decoration: none;
    min-height: 42px;
    padding: 0 12px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: color .15s ease, background .15s ease;
}
.sidebar-nav a:hover { color: #fff; background: var(--surface-2); }
.sidebar-nav a.nav-active {
    color: var(--accent-text);
    background: var(--accent);
    font-weight: 750;
    box-shadow: 0 4px 14px rgba(245, 196, 0, .25);
}
.sidebar-nav a.nav-active svg { stroke: var(--accent-text); }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-spacer { flex: 1; min-height: 20px; }

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 4px 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.sidebar-avatar {
    width: 36px; height: 36px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 800;
}
.sidebar-account > div { min-width: 0; display: grid; gap: 2px; }
.sidebar-account strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account span { color: #777; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav .nav-exit { color: #e57373; }
.sidebar-nav .nav-exit:hover { color: #ff8a80; background: var(--danger-soft); }

.app-main { flex: 1; min-height: 100vh; margin-left: 260px; background: var(--bg); }
.app-wrap { max-width: 1240px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 40px) 40px; }

/* ── Encabezado de página ──────────────────────── */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Banner de suscripción ─────────────────────── */
.plan-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    margin-bottom: 22px;
    background: #1a1500;
    border: 1px solid #4a3c00;
    border-radius: var(--radius-lg);
    font-size: 13.5px;
    color: #f5c400;
}
.plan-banner-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.plan-banner > div { flex: 1; display: grid; gap: 2px; }
.plan-banner strong { color: #fff; font-weight: 700; }
.plan-banner span { color: #d4a800; font-size: 12.5px; }
.plan-banner-close button {
    background: transparent; border: 0; color: #888; font-size: 18px; line-height: 1; padding: 4px 8px; cursor: pointer;
}
.plan-banner-close button:hover { color: #fff; }
.plan-banner.is-warning { background: #2b1100; border-color: #612800; color: #ffb74d; }

/* ── Métricas / Stats ───────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: var(--border);
}
.stat-card.highlight::after { background: var(--accent); }
.stat-card .label { font-size: 12px; font-weight: 750; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 32px; font-weight: 800; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card.highlight .value { color: var(--accent); }
.stat-card .note { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }

/* ── Ficha de cliente: Tabs & Secciones ─────────── */
.client-profile-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}
.client-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}
.client-info-item .info-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.client-info-item .info-val { font-size: 14.5px; color: #fff; }

.tab-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 650;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    margin-bottom: -1px;
}
.tab-link:hover { color: #fff; }
.tab-link.active, .tab-link:target { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Bóveda de credenciales ─────────────────────── */
.vault-grid { display: grid; gap: 14px; }
.vault-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    transition: border-color .15s ease;
}
.vault-card:hover { border-color: #444; }
.vault-meta { display: grid; gap: 4px; min-width: 220px; }
.vault-meta .label-title { font-weight: 750; font-size: 15px; color: #fff; }
.vault-meta .meta-sub { font-size: 12.5px; color: var(--text-muted); }
.vault-secret {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    font-size: 13.5px;
}
.vault-secret .secret-hidden { letter-spacing: 2px; color: #888; }
.vault-secret .secret-plain { color: var(--accent); font-weight: bold; }
.vault-actions { display: flex; align-items: center; gap: 8px; }

/* ── Timeline de historial ──────────────────────── */
.timeline { display: grid; gap: 18px; position: relative; padding-left: 24px; }
.timeline::before {
    content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border);
}
.timeline-item { position: relative; display: grid; gap: 6px; }
.timeline-item::before {
    content: ""; position: absolute; left: -24px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg);
}
.timeline-date { font-size: 12.5px; font-weight: 750; color: var(--accent); }
.timeline-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.timeline-card p { font-size: 14px; line-height: 1.5; margin-top: 4px; }

/* ── Landing Page (Pública) ─────────────────────── */
.l-wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 36px); }
.l-hero {
    padding: 72px 0 64px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 48px;
    align-items: center;
}
.l-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    background: #1a1600;
    border: 1px solid #4a3c00;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 20px;
}
.l-hero h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 850; line-height: 1.1; margin-bottom: 20px; color: #fff; }
.l-hero h1 em { color: var(--accent); font-style: normal; }
.l-lead { font-size: clamp(16px, 2vw, 19px); line-height: 1.55; color: #aaa; margin-bottom: 30px; }
.l-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.l-reassure { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13.5px; color: #888; }
.l-reassure span { display: inline-flex; align-items: center; gap: 6px; }
.l-reassure svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 2.5; }

.l-hero-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.l-section { padding: 68px 0; border-top: 1px solid var(--border); }
.l-section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.l-section-head h2 { font-size: 32px; color: #fff; margin-bottom: 12px; }
.l-section-head p { color: var(--text-muted); font-size: 16px; }

.l-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.l-feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform .15s ease, border-color .15s ease;
}
.l-feature:hover { transform: translateY(-3px); border-color: #444; }
.l-feature-icon {
    width: 44px; height: 44px; border-radius: 10px;
    background: #1a1600; border: 1px solid #4a3c00;
    display: grid; place-items: center; color: var(--accent);
}
.l-feature-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.l-feature h3 { font-size: 18px; color: #fff; }
.l-feature p { font-size: 14px; color: #888; line-height: 1.55; }

.l-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.l-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    position: relative;
}
.l-step-num {
    display: inline-block; width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: var(--accent-text); font-weight: 800;
    text-align: center; line-height: 32px; margin-bottom: 16px; font-size: 14px;
}
.l-step h3 { font-size: 18px; color: #fff; margin-bottom: 8px; }
.l-step p { font-size: 14px; color: #888; line-height: 1.5; }

/* Precios */
.l-pricing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; max-width: 1040px; margin: 0 auto; }
.pricing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 26px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}
.pricing-card.is-featured {
    border-color: var(--accent);
    box-shadow: 0 0 24px rgba(245, 196, 0, .15);
}
.pricing-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: var(--accent-text);
    padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.pricing-name { font-size: 20px; font-weight: 750; color: #fff; }
.pricing-price { font-size: 38px; font-weight: 850; color: #fff; display: flex; align-items: baseline; gap: 4px; }
.pricing-price span { font-size: 15px; color: var(--text-muted); font-weight: 500; }
.pricing-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; color: #bbb; }
.pricing-features li { display: flex; align-items: center; gap: 9px; }
.pricing-features svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 2.5; flex: none; }

.l-faq { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.l-faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
}
.l-faq summary { font-weight: 700; font-size: 16px; color: #fff; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.l-faq summary::-webkit-details-marker { display: none; }
.l-faq summary::after { content: "+"; font-size: 20px; color: var(--accent); font-weight: bold; }
.l-faq details[open] summary::after { content: "−"; }
.l-faq p { margin-top: 12px; font-size: 14.5px; color: #aaa; line-height: 1.6; }

.l-final {
    padding: 80px 0;
    text-align: center;
    background: radial-gradient(circle at center, #1f1b00 0%, #0a0a0a 70%);
    border-top: 1px solid var(--border);
}
.l-final h2 { font-size: 36px; color: #fff; margin-bottom: 12px; }
.l-final p { font-size: 17px; color: #aaa; margin-bottom: 28px; }

/* ── Mobile & Responsive ────────────────────────── */
@media (max-width: 840px) {
    /* El shell deja de ser una fila: la barra móvil va arriba y el panel debajo */
    .app-shell { display: block; }

    /* Sidebar: oculto por defecto, desliza desde la izquierda */
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
    }
    .app-main { margin-left: 0; }

    /* Barra móvil superior */
    .mobile-bar {
        display: flex;
        position: sticky; top: 0; z-index: 45;
        align-items: center; justify-content: space-between;
        padding: 10px 16px;
        background: #111;
        border-bottom: 1px solid var(--border);
        min-height: 54px;
    }
    .menu-trigger {
        width: 40px; height: 40px; display: grid; place-content: center; gap: 5px;
        border-radius: 8px; cursor: pointer; flex: none;
    }
    .menu-trigger span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }
    .sidebar-toggle:checked ~ .app-sidebar { transform: translateX(0); }
    .sidebar-toggle:checked ~ .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 35;
    }
    .sidebar-close { display: block; font-size: 26px; color: #888; cursor: pointer; }

    /* Contenido principal */
    .app-wrap { padding: 18px 14px 32px; }

    /* Encabezado de página: apila título y botones */
    .page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
    }
    .page-head h1 { font-size: 22px; }
    .page-actions {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    .page-actions .btn { flex: 1 1 auto; min-width: 130px; justify-content: center; }

    /* Stats */
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 26px; }

    /* Grillas de contenido */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }

    /* Tarjetas: reduce padding interno */
    .card-head, .card-header { padding: 14px 16px 0; }
    .card-body { padding: 14px 16px; }

    /* Banner de suscripción: apila en móvil */
    .plan-banner { flex-wrap: wrap; gap: 8px; padding: 10px 14px; font-size: 13px; }
    .plan-banner > div { flex: 1 1 100%; }
    .plan-banner-close { margin-left: auto; }

    /* Split: apila verticalmente */
    .split { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* Tabs de cliente: scroll horizontal sin recorte */
    .tab-nav { flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }

    /* Bóveda: ajusta el secreto en pantallas pequeñas */
    .vault-meta { min-width: 0; width: 100%; }
    .vault-secret { flex-wrap: wrap; max-width: 100%; word-break: break-all; font-size: 12px; }
    .vault-actions { flex-wrap: wrap; }

    /* Landing */
    .l-hero { grid-template-columns: 1fr; padding: 40px 0; }
    .l-grid-3, .l-steps, .l-pricing { grid-template-columns: 1fr; }
    .l-hero-preview { display: none; }
    .l-final h2 { font-size: 26px; }
    .l-final p { font-size: 15px; }

    /* Tabla: asegurar scroll horizontal */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table th, .table td { padding: 8px 10px; font-size: 13px; }

    /* Perfil de cliente */
    .client-profile-header { padding: 16px; }
    .client-info-grid { margin-top: 12px; padding-top: 12px; gap: 10px; }
}

@media (max-width: 520px) {
    .stat-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card .value { font-size: 30px; }
    .app-wrap { padding: 14px 12px 28px; }

    /* Botones de acción en columna en pantallas muy pequeñas */
    .page-actions { flex-direction: column; }
    .page-actions .btn { width: 100%; }

    /* Vault */
    .vault-card { flex-direction: column; align-items: flex-start; }
    .vault-secret { width: 100%; }

    /* Card head: apila en column */
    .card-head, .card-header { flex-direction: column; gap: 10px; }
    .card-head .btn, .card-header .btn { align-self: flex-start; }

    /* Tabla simplificada */
    .table { font-size: 12.5px; }
    .table th, .table td { padding: 7px 8px; }
}

/* Tablas del dashboard en móvil: cada fila se lee como una tarjeta */
@media (max-width: 680px) {
    .dashboard-table { display: block; }
    .dashboard-table thead { display: none; }
    .dashboard-table tbody { display: block; }
    .dashboard-table tr {
        display: block;
        margin-bottom: 10px;
        padding: 12px;
        background: var(--surface-2);
        border: 1px solid var(--border-soft);
        border-radius: 10px;
    }
    .dashboard-table tr:last-child { margin-bottom: 0; }
    .dashboard-table td {
        display: grid;
        gap: 2px;
        width: 100%;
        padding: 6px 0;
        border: 0;
        text-align: left;
    }
    .dashboard-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 10.5px;
        font-weight: 750;
        letter-spacing: .06em;
        text-transform: uppercase;
    }
    .dashboard-table td.num { text-align: left; }
    .dashboard-table td .btn { justify-self: start; margin-top: 2px; }
}

/* ── Lightbox / Visor de Fotos y QR ─────────────── */
.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    background: #000;
}
.lightbox-caption {
    margin-top: 12px;
    color: var(--accent);
    font-weight: 700;
    font-size: 14.5px;
    text-align: center;
}
.lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease;
}
.lightbox-close:hover {
    background: var(--accent);
    color: var(--accent-text);
}
.file-drop-area:hover {
    border-color: var(--accent) !important;
}

