/* ============================================================
   DevOps Reports — paleta corporativa Wembley
   Magenta marca + Azul marino + Cyan + grises cálidos
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta Wembley (del logo) */
    --w-magenta:        #FF0C69;
    --w-magenta-dark:   #e10b5e;
    --w-magenta-soft:   #fff0f6;
    --w-navy:           #1B1F4E;
    --w-navy-dark:      #14173c;
    --w-cyan:           #02D7DB;
    --w-cyan-soft:      #e0fbfc;

    /* Aliases legacy (mapeados a la nueva paleta para retro-compat) */
    --primary:          var(--w-magenta);
    --primary-dark:     var(--w-magenta-dark);

    /* Neutros */
    --bg:               #F5F5F7;
    --white:            #ffffff;
    --text:             #1A1A1A;
    --text-light:       #7A7776;
    --border:           #E5E5E5;
    --row-alt:          #FAFAFB;

    --success:          #0e9e6e;
    --warning:          #c07d00;
    --danger:           #d13438;
    --shadow:           0 2px 6px rgba(20, 23, 60, 0.06);
}

.horas-estimadas { color: var(--warning); font-weight: 600; }
.horas-reales    { color: var(--success); font-weight: 600; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header (estilo Wembley: fondo blanco, logo a la izquierda, nav minimalista) */
/* Solo el header de página (hijo directo de body). Acotado para no afectar a
   <header> anidados (p.ej. .ad-card-head en admin), que si no heredarían
   sticky + z-index y se solaparían sobre los submenús desplegados del nav. */
body > header {
    background: var(--white);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(20, 23, 60, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Línea inferior con gradient sutil magenta→cyan→magenta */
body > header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    background: linear-gradient(90deg,
        var(--w-magenta) 0%,
        var(--w-cyan) 50%,
        var(--w-magenta) 100%);
    opacity: 0.85;
    pointer-events: none;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.logo {
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.logo img,
.logo svg {
    height: 36px;
    width: auto;
    display: block;
}

/* Separador vertical con el degradado de marca (magenta→cyan) */
.logo-sep {
    width: 2px;
    height: 30px;
    border-radius: 2px;
    background: linear-gradient(var(--w-magenta), var(--w-cyan));
    flex-shrink: 0;
}

/* Lockup del nombre de producto + bajada (eyebrow) */
.logo-lockup {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.logo-name {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--w-navy);
}

.logo-name-accent { color: var(--w-magenta); }

.logo-eyebrow {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-light);
    margin-top: 3px;
}

nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

nav a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    position: relative;
}

nav a:hover {
    color: var(--w-magenta);
    background: var(--w-magenta-soft);
}

/* Activo en menú top-level: subrayado pegado al texto vía box-shadow (no afecta layout) */
nav > a.nav-active,
.dropdown > .dropdown-btn.nav-active {
    color: var(--w-magenta);
    font-weight: 600;
    box-shadow: inset 0 -3px 0 var(--w-magenta);
    border-radius: 6px 6px 2px 2px;
}
/* Activo en submenú: solo fondo + color, sin barra */
.dropdown-content a.nav-active {
    background: var(--w-magenta-soft);
    color: var(--w-magenta);
    font-weight: 600;
    border-left: 3px solid var(--w-magenta);
    padding-left: 13px;
}

/* User info */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--w-magenta), var(--w-cyan));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.82rem;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(255, 12, 105, 0.22);
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative; overflow: hidden;
}
.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(255, 12, 105, 0.32);
}
.user-avatar img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0;
}
.user-avatar.has-img img { opacity: 1; }
.user-avatar.has-img .user-avatar-initials { opacity: 0; }
.user-avatar-initials { transition: opacity 0.2s; }

.user-name {
    color: var(--w-navy);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    color: var(--text-light);
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    cursor: pointer;
}
.logout-btn svg { display: block; }

.logout-btn:hover {
    background: var(--w-magenta-soft);
    color: var(--w-magenta);
    transform: translateX(2px);
}

@media (max-width: 768px) {
    .user-name { display: none; }
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.dropdown-btn:hover {
    background: var(--w-magenta-soft);
    color: var(--w-magenta);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-radius: 6px;
    overflow: hidden;
    z-index: 200;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text);
    display: block;
    padding: 10px 16px;
    border-radius: 0;
    font-size: 0.88rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: var(--w-magenta-soft);
    color: var(--w-magenta);
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px;
    width: 100%;
    flex: 1;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--w-navy);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 28px 0 14px;
    color: var(--w-navy);
    letter-spacing: -0.01em;
}

/* Filter Form */
.filter-form {
    background: var(--white);
    padding: 22px 22px 12px 22px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    max-width: 180px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-group select,
.filter-group input {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: inherit;
    min-width: 100px;
    max-width: 170px;
    background: var(--white);
    transition: border-color 0.15s;
    height: 32px;
}
.filter-group select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: inherit;
    min-width: 100px;
    max-width: 170px;
    background: var(--white);
    transition: border-color 0.15s;
    height: 32px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--w-magenta);
    box-shadow: 0 0 0 3px rgba(255, 12, 105, 0.12);
}

.filter-form button {
    padding: 9px 22px;
    background: var(--w-magenta);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    align-self: flex-start;
    margin-top: 25px;
    letter-spacing: 0.01em;
}

.filter-form button:hover {
    background: var(--w-magenta-dark);
}
.filter-form button:active { transform: translateY(1px); }

/* Tables */
.report-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}

.report-table thead th {
    background: #f0f2f5;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
}

.report-table thead th:hover {
    background: #e4e8ed;
}

.report-table thead th::after {
    content: ' ⇕';
    font-size: 0.75rem;
    color: #bbb;
}

.report-table thead th.sort-asc::after {
    content: ' ▲';
    color: var(--w-magenta);
}

.report-table thead th.sort-desc::after {
    content: ' ▼';
    color: var(--w-magenta);
}

.report-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.report-table tbody tr:nth-child(even) {
    background: var(--row-alt);
}

.report-table tbody tr:hover {
    background: var(--w-magenta-soft);
}

.table-info {
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: right;
}

/* Autosuggest */
.autosuggest-wrap {
    position: relative;
    display: inline-block;
}

.autosuggest-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.autosuggest-list li {
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.autosuggest-list li:last-child {
    border-bottom: none;
}

.autosuggest-list li:hover,
.autosuggest-list li.active {
    background: var(--w-magenta-soft);
    color: var(--w-magenta);
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s, transform 0.15s;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
}

.card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--w-navy);
    letter-spacing: -0.01em;
}

.card:hover h3 { color: var(--w-magenta); }

.card p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.card .card-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

/* Summary cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
    border-top: 3px solid var(--w-magenta);
}

.summary-card .value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--w-navy);
    letter-spacing: -0.02em;
}

.summary-card .label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Messages */
.no-data {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #795548;
    padding: 16px 20px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
}

.error-msg {
    background: #fde7e9;
    border: 1px solid #f5c6cb;
    color: var(--danger);
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.info-msg {
    background: var(--w-cyan-soft);
    border: 1px solid var(--w-cyan);
    color: var(--w-navy);
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 16px 20px;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
footer p { margin: 0; }

/* Enlaces de ayuda del footer (FAQ + tour guiado) */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}
.footer-link {
    background: none;
    border: none;
    padding: 2px 4px;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--w-magenta);
    cursor: pointer;
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.footer-link:hover {
    color: var(--w-magenta-dark);
    text-decoration: underline;
}
.footer-sep { color: var(--border); }

/* ── FAQ (modal de preguntas frecuentes) ─────────────────────────── */
.faq-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 23, 60, 0.45);
    backdrop-filter: blur(3px);
}
.faq-backdrop[hidden] { display: none; }
.faq-modal {
    background: var(--white);
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(20, 23, 60, 0.28);
    overflow: hidden;
    text-align: left;
    animation: faq-pop 0.16s ease-out;
}
@keyframes faq-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.faq-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    background: var(--w-navy);
    color: #fff;
}
.faq-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.faq-close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
}
.faq-close:hover { background: rgba(255, 255, 255, 0.28); }
.faq-search-wrap {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
}
.faq-search {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.faq-search:focus {
    border-color: var(--w-magenta);
    box-shadow: 0 0 0 3px var(--w-magenta-soft);
    background: #fff;
}
.faq-body {
    padding: 8px 22px 22px;
    overflow-y: auto;
}
.faq-cat { margin-top: 18px; }
.faq-cat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
}
.faq-cat-icon { font-size: 1rem; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 2px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.faq-q:hover { color: var(--w-magenta); }
.faq-q-chevron {
    flex: none;
    color: var(--text-light);
    transition: transform 0.18s;
}
.faq-item.open .faq-q-chevron { transform: rotate(180deg); }
.faq-a {
    display: none;
    padding: 0 2px 14px;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.6;
}
.faq-item.open .faq-a { display: block; }
.faq-a ul { margin: 4px 0 0; padding-left: 20px; }
.faq-a li { margin-bottom: 6px; }
.faq-a b { color: var(--w-navy); }
.faq-empty {
    padding: 24px 2px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}
.faq-empty[hidden] { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }
    /* La nav pasa a segunda línea: que reparta y envuelva con holgura */
    body > header nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px 8px;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-group select,
    .filter-group input {
        min-width: 100%;
    }

    .report-table {
        display: block;
        overflow-x: auto;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
