:root {
    --tl-bg: #fbf6f7;
    --tl-card: #ffffff;
    --tl-line: #f0d7dd;
    --tl-shadow: 0 18px 40px rgba(60, 20, 35, .08);
    --tl-text: #2a1b22;
    --tl-muted: #7a5a66;

    --tl-pink: #f2b8c7;
    --tl-pink-2: #f7c6d3;

    --tl-gold: #d6b06a;
    --tl-gold-2: #f2e2bd;
}

/* layout wrapper */
.dash-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 14px 24px;
}

/* HERO (mobile-first) */
.dash-hero {
    background: linear-gradient(135deg, rgba(242, 184, 199, .35), rgba(214, 176, 106, .14));
    border: 1px solid var(--tl-line);
    border-radius: 22px;
    padding: 16px;
    box-shadow: var(--tl-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* left */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, var(--tl-gold-2), var(--tl-gold));
    box-shadow: 0 8px 18px rgba(214, 176, 106, .25);
}

.brand-text h1 {
    margin: 0;
    font-size: clamp(22px, 4.2vw, 28px);
    letter-spacing: .3px;
    color: var(--tl-text);
    line-height: 1.05;
}

.brand-text p {
    margin: 3px 0 0;
    color: var(--tl-muted);
    font-weight: 700;
    font-size: clamp(12px, 2.8vw, 13px);
}

/* WHO block */
.who {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* fila rol + usuario */
.who-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.who-user {
    color: var(--tl-muted);
    font-weight: 800;
}

/* pills */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .72);
    font-weight: 950;
    font-size: 12px;
    color: var(--tl-text);
    white-space: nowrap;
}

.pill.role {
    background: rgba(255, 255, 255, .80);
}

.pill.ok {
    border-color: rgba(47, 138, 87, .22);
    background: rgba(47, 138, 87, .08);
    color: #1f6f4a;
}

.pill.warn {
    border-color: rgba(138, 91, 31, .22);
    background: rgba(138, 91, 31, .08);
    color: #8a5b1f;
}

/* status responsive: 2 columnas en móvil, 3 en tablet/desktop */
.who-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: start;
}

/* acciones */
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

.pill-btn {
    text-decoration: none;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .80);
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 950;
    font-size: 13px;
    color: var(--tl-text);
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
    white-space: nowrap;
}

.pill-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(60, 20, 35, .08);
}

.pill-btn.disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===========================
   ✅ ANALÍTICA
=========================== */
.dash-analytics {
    margin-top: 14px;
}

.analytics-card {
    background: var(--tl-card);
    border: 1px solid var(--tl-line);
    border-radius: 22px;
    box-shadow: var(--tl-shadow);
    padding: 16px;
}

.analytics-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.analytics-title h2 {
    margin: 0;
    font-size: clamp(18px, 3.8vw, 22px);
    color: var(--tl-text);
    letter-spacing: .2px;
}

.analytics-title p {
    margin: 6px 0 0;
    color: var(--tl-muted);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.35;
}

/* Filtros responsive */
.analytics-filters {
    display: grid;
    grid-template-columns: 1fr;
    /* móvil */
    gap: 12px;
    margin-bottom: 12px;
}

.f-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f-item label {
    font-size: 12px;
    color: var(--tl-muted);
    font-weight: 900;
    letter-spacing: .3px;
}

/* Select pro (con flecha) */
.f-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .9);
    outline: none;
    font-weight: 850;
    font-size: 13px;
    color: var(--tl-text);
    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-image:
        linear-gradient(45deg, transparent 50%, var(--tl-muted) 50%),
        linear-gradient(135deg, var(--tl-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

.f-select:focus {
    box-shadow: 0 0 0 4px rgba(242, 184, 199, .25);
    border-color: rgba(242, 184, 199, .75);
}

.f-select:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.hint {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 800;
    color: var(--tl-muted);
}

/* Chart container */
.analytics-chart {
    border-radius: 18px;
    padding: 12px;
    border: 1px dashed rgba(214, 176, 106, .55);
    background: linear-gradient(135deg, rgba(242, 184, 199, .16), rgba(242, 226, 189, .18));
}

/* ===========================
   GRID CARDS (mobile-first)
=========================== */
.grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.card {
    display: block;
    text-decoration: none;
    color: var(--tl-text);
    background: var(--tl-card);
    border: 1px solid var(--tl-line);
    border-radius: 22px;
    padding: 16px;
    box-shadow: var(--tl-shadow);
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 46px rgba(60, 20, 35, .12);
}

.card::before {
    content: "";
    position: absolute;
    inset: -40px -60px auto auto;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle at 30% 30%, rgba(242, 184, 199, .55), rgba(214, 176, 106, .18));
    border-radius: 999px;
    transform: rotate(12deg);
    pointer-events: none;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-ico {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(242, 184, 199, .25);
    border: 1px solid rgba(240, 215, 221, .9);
    font-size: 20px;
}

.chip {
    font-size: 12px;
    font-weight: 950;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .72);
    color: var(--tl-muted);
}

.card h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.card p {
    margin: 0 0 12px;
    color: var(--tl-muted);
    font-weight: 700;
    line-height: 1.35;
}

.card-go {
    font-weight: 950;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-go span {
    font-size: 18px;
    line-height: 0;
}

/* accents */
.card-caja .card-ico {
    background: rgba(214, 176, 106, .18);
}

.card-ventas .card-ico {
    background: rgba(242, 184, 199, .22);
}

.card-reporte .card-ico {
    background: rgba(242, 226, 189, .35);
}

.card-maint .card-ico {
    background: rgba(242, 184, 199, .18);
}

.card-sec .card-ico {
    background: rgba(214, 176, 106, .14);
}

/* ========== BREAKPOINTS ========== */

/* >= 640px */
@media (min-width:640px) {
    .dash-wrap {
        padding: 18px 16px 26px;
    }

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

    .who-status {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* filtros: 2 columnas */
    .analytics-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* >= 980px */
@media (min-width:980px) {
    .dash-hero {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 16px;
    }

    .hero-actions {
        justify-content: flex-end;
    }

    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* filtros: 4 columnas */
    .analytics-filters {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
