: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;

    --r-1: 16px;
    --r-2: 22px;
}

/* ========= PAGE (mobile-first) ========= */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 14px 22px;
}

.page-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(20px, 3.6vw, 28px);
    line-height: 1.1;
    color: var(--tl-text);
}

.sub {
    margin: 6px 0 0;
    color: var(--tl-muted);
    font-weight: 800;
    line-height: 1.25;
    font-size: clamp(12px, 2.7vw, 14px);
}

/* ========= BUTTON ========= */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 900;
    color: var(--tl-text);
    background: linear-gradient(180deg, var(--tl-pink), var(--tl-pink-2));
    box-shadow: 0 12px 24px rgba(242, 184, 199, .25);
    text-decoration: none;
    transition: transform .15s ease, filter .15s ease, opacity .15s ease;
    width: 100%;
    /* mobile: full width */
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: saturate(1.05);
}

.btn-primary.disabled {
    opacity: .75;
    cursor: not-allowed;
    transform: none;
}

/* ========= STATUS GRID ========= */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* mobile: 1 columna */
    gap: 12px;
    margin-bottom: 14px;
}

.status-card {
    background: var(--tl-card);
    border: 1px solid var(--tl-line);
    border-radius: var(--r-2);
    padding: 14px;
    box-shadow: var(--tl-shadow);
    overflow: hidden;
}

.status-card.alt {
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(242, 226, 189, .30));
}

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

.st-ico {
    font-size: 18px;
}

.st-tag {
    font-size: 12px;
    font-weight: 900;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: #fff;
    color: var(--tl-muted);
    white-space: nowrap;
}

.st-title {
    margin: 0 0 6px;
    font-size: clamp(16px, 3.2vw, 18px);
}

.st-title.ok {
    color: #1f6f4a;
}

.st-title.warn {
    color: #8a5b1f;
}

.st-text {
    margin: 0;
    color: var(--tl-muted);
    font-weight: 750;
    line-height: 1.35;
    font-size: clamp(12px, 2.8vw, 14px);
}

.st-metrics {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    /* mobile: 1 columna */
    gap: 10px;
}

.metric {
    border: 1px solid var(--tl-line);
    border-radius: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, .72);
}

.metric .k {
    display: block;
    color: var(--tl-muted);
    font-weight: 850;
    font-size: 12px;
}

.metric .v {
    display: block;
    color: var(--tl-text);
    font-weight: 950;
    margin-top: 2px;
    word-break: break-word;
}

/* ========= TABLE CARD ========= */
.table-card {
    background: var(--tl-card);
    border: 1px solid var(--tl-line);
    border-radius: var(--r-2);
    box-shadow: var(--tl-shadow);
    overflow: hidden;
}

.table-head {
    display: flex;
    flex-direction: column;
    /* mobile: apila */
    align-items: flex-start;
    gap: 8px;
    padding: 14px 14px 10px;
}

.table-head h2 {
    margin: 0;
    font-size: 16px;
    color: var(--tl-text);
}

.badge {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: #fff;
    color: var(--tl-muted);
    font-weight: 900;
    font-size: 12px;
}

/* IMPORTANTE: en móvil, la tabla debe scrollear horizontal */
.table-wrap {
    padding: 0 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tul-table {
    width: 100%;
    min-width: 620px;
    /* fuerza scroll en pantallas pequeñas */
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 18px;
}

.tul-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--tl-muted);
    border-bottom: 1px solid var(--tl-line);
    background: rgba(242, 184, 199, .14);
    white-space: nowrap;
}

.tul-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid rgba(240, 215, 221, .75);
    color: var(--tl-text);
    font-weight: 750;
    white-space: nowrap;
}

.tul-table tbody tr:hover {
    background: rgba(242, 184, 199, .10);
}

.empty {
    text-align: center;
    color: var(--tl-muted);
    padding: 18px !important;
    white-space: normal !important;
}

.pager {
    padding: 0 14px 14px;
}

.hide {
    display: none;
}

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

/* >= 520px: botón deja de ser full */
@media (min-width:520px) {
    .btn-primary {
        width: auto;
    }

    .table-head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* >= 760px: métricas en 2 columnas */
@media (min-width:760px) {
    .st-metrics {
        grid-template-columns: 1fr 1fr;
    }
}

/* >= 980px: estado en 2 columnas y header en fila */
@media (min-width:980px) {
    .page {
        padding: 18px 16px 26px;
    }

    .page-head {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 14px;
    }

    .status-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
}
