:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #171b22;
    --muted: #5c6678;
    --line: #d8dde6;
    --head-bg: #243447;
    --head-text: #f3f7fb;
    --accent: #0a7a36;
    --accent-soft: #dff7e8;
    --warn: #ab1e1e;
    --champion-orange: #e65a2c;
    --champion-blue: #0a3b6e;
    --champion-blue-dark: #052848;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(circle at top left, #eef2f7 0, var(--bg) 48%);
    color: var(--text);
}

img,
svg {
    max-width: 100%;
    height: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 8px 24px -22px rgba(10, 27, 58, 0.85);
}

.site-topline {
    background: var(--champion-orange);
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.25px;
}

.site-topline-inner {
    width: min(1540px, 96vw);
    margin: 0 auto;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.site-topline nav {
    display: flex;
    gap: 14px;
}

.site-topline a {
    color: #fff;
    text-decoration: none;
    opacity: 0.92;
}

.site-mainbar {
    background: linear-gradient(180deg, var(--champion-blue) 0%, var(--champion-blue-dark) 100%);
    color: #fff;
}

.site-mainbar-inner {
    width: min(1540px, 96vw);
    margin: 0 auto;
    min-height: 68px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
}

.site-mainbar-inner > * {
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    min-width: 180px;
}

.brand img {
    max-height: 44px;
    width: auto;
    display: block;
}

.brand-mark {
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.brand-text {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.1;
    letter-spacing: 0.35px;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #dce9f6;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a.is-active {
    color: #fff;
    border-bottom-color: #fff;
}

.main-cta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cta-btn {
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    white-space: nowrap;
}

.cta-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.cta-live {
    border-color: #ffbdbd;
    background: #b81d1d;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.cta-live .yt-icon {
    width: 18px;
    height: 12px;
    border-radius: 4px;
    background: #fff;
    position: relative;
    display: inline-block;
    flex: 0 0 18px;
}

.cta-live .yt-icon::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent #cf2525;
}

.container {
    width: min(1540px, 96vw);
    margin: 22px auto 40px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

h1 {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.center-nav {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 10px;
}

.planillas-tabs-fechas {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

.planillas-tab-item {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    font-weight: 600;
    color: #384357;
    cursor: pointer;
}

.planillas-tab-item:last-child {
    border-bottom: 0;
}

.planillas-tab-item.is-active {
    background: #183f66;
    color: #f3f8ff;
}

.planillas-area-blanca {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 10px;
    min-width: 0;
}

.planillas-panel-contenido {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.planillas-fila-evento {
    width: 100%;
    border: 1px solid #cdd7e4;
    border-radius: 10px;
    background: #fbfdff;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.planillas-fila-evento span:first-child {
    font-weight: 700;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.planillas-fila-evento span:last-child {
    color: #66758d;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.planillas-fila-evento:hover {
    border-color: #6f96c0;
}

.planillas-fila-evento.status-corriendo {
    border-color: #2f9b52;
    background: #eefcf2;
}

.planillas-fila-evento.status-corriendo span:last-child::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #14c85a;
    box-shadow: 0 0 0 0 rgba(20, 200, 90, 0.75);
    animation: live-pulse 1.4s infinite;
    flex: 0 0 9px;
}

.planillas-fila-evento.is-selected {
    border-color: #183f66;
    background: #eaf3ff;
}

.planillas-fila-evento:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.meta {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.meta > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.88rem;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge.error {
    background: #fde8e8;
    color: var(--warn);
}

.table-wrap {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: auto;
    background: var(--surface);
    box-shadow: 0 12px 28px -26px rgba(16, 34, 72, 0.62);
}

.tabla-envivo {
    width: 100%;
    border-collapse: collapse;
    min-width: 1220px;
}

.tabla-envivo thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    background: var(--head-bg);
    color: var(--head-text);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.45px;
    white-space: nowrap;
    text-transform: uppercase;
    padding: 10px 8px;
    border-right: 1px solid #3f5164;
}

.tabla-envivo td {
    vertical-align: top;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 8px 8px;
    font-size: 0.84rem;
    line-height: 1.22rem;
    white-space: pre-line;
}

.tabla-envivo tr:nth-child(even) td {
    background: #f9fbff;
}

.tabla-envivo tr.changed td {
    animation: changed-cell 1300ms ease-out;
}

.foot {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer {
    margin-top: 22px;
}

.footer-main {
    background: linear-gradient(180deg, #22252d 0%, #171a22 100%);
    color: #f4f7fc;
}

.footer-main-inner {
    width: min(1540px, 96vw);
    margin: 0 auto;
    padding: 30px 0 38px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.footer-main h3 {
    margin: 0 0 8px;
    font-size: 1.03rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}

.footer-main p {
    margin: 4px 0;
    color: #cad4e4;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.footer-main a {
    color: #f7fbff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-main a:hover {
    color: #9fd1ff;
}

code {
    background: #eef2f7;
    border-radius: 5px;
    padding: 1px 4px;
}

@keyframes changed-cell {
    0% {
        background: #fff2b2;
    }
    100% {
        background: transparent;
    }
}

@keyframes live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(20, 200, 90, 0.75);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(20, 200, 90, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(20, 200, 90, 0);
    }
}

@media (max-width: 1100px) {
    .site-mainbar-inner {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px 0 10px;
    }

    .brand {
        min-width: 0;
    }

    .main-nav {
        justify-content: flex-start;
        gap: 12px;
    }

    .main-cta {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .site-topline-inner {
        min-height: 28px;
        font-size: 0.66rem;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 6px 0;
        gap: 4px;
    }

    .site-topline nav {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
    }

    .site-topline a {
        flex: 0 0 auto;
    }

    .site-mainbar-inner {
        gap: 6px;
        padding: 7px 0 9px;
    }

    .brand {
        min-width: 0;
    }

    .main-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
        width: 100%;
        padding-bottom: 0;
    }

    .main-nav a {
        font-size: 0.7rem;
        white-space: normal;
        text-align: center;
        line-height: 1.15;
        padding: 6px 2px;
    }

    .main-cta {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
        overflow: visible;
        padding-bottom: 0;
    }

    .main-cta .cta-btn {
        width: 100%;
        min-height: 42px;
        font-size: 0.68rem;
        text-align: center;
        justify-content: center;
        padding: 9px 10px;
        white-space: normal;
        line-height: 1.2;
        letter-spacing: 0.2px;
        overflow-wrap: anywhere;
    }

    .top {
        flex-direction: column;
    }

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

    .planillas-tabs-fechas {
        display: flex;
        gap: 0;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        scrollbar-width: thin;
    }

    .planillas-tab-item {
        flex: 0 0 auto;
        min-width: 170px;
        border-right: 1px solid var(--line);
        border-bottom: 0;
    }

    .planillas-tab-item:last-child {
        border-right: 0;
    }

    .planillas-fila-evento {
        padding: 11px;
    }

    .planillas-fila-evento span:first-child {
        font-size: 0.88rem;
    }

    .planillas-fila-evento span:last-child {
        font-size: 0.75rem;
    }

    .meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .footer-main-inner {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 22px 0 28px;
    }
}

@media (max-width: 820px) {
    .site-header {
        position: static;
    }

    body {
        background: var(--bg);
    }

    .container {
        width: calc(100vw - 16px);
        margin: 8px auto 22px;
    }

    h1 {
        font-size: 1.18rem;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .table-wrap {
        margin-top: 10px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        overflow: visible;
    }

    .tabla-envivo {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .tabla-envivo thead {
        display: none;
    }

    .tabla-envivo tbody,
    .tabla-envivo tr,
    .tabla-envivo td {
        display: block;
        width: 100%;
    }

    .tabla-envivo tr {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 8px 8px 10px;
        overflow: hidden;
    }

    .tabla-envivo tr:nth-child(even) td {
        background: transparent;
    }

    .tabla-envivo td {
        border: 0;
        border-top: 1px dashed #dce2eb;
        padding: 8px 8px 8px 43%;
        min-height: 32px;
        font-size: 0.84rem;
        line-height: 1.22rem;
        position: relative;
        white-space: pre-line;
        overflow-wrap: anywhere;
    }

    .tabla-envivo td:first-child {
        border-top: 0;
        padding-left: 8px;
        background: #eef4ff;
        border-radius: 8px;
        font-weight: 800;
        margin-bottom: 6px;
    }

    .tabla-envivo td:first-child::before {
        display: none;
    }

    .tabla-envivo td::before {
        content: attr(data-label);
        position: absolute;
        left: 8px;
        top: 8px;
        width: 38%;
        color: var(--muted);
        font-size: 0.67rem;
        font-weight: 800;
        letter-spacing: 0.45px;
        text-transform: uppercase;
        line-height: 1.1rem;
    }

    .tabla-envivo tr.changed {
        animation: changed-cell 1300ms ease-out;
    }
}

@media (max-width: 480px) {
    .site-topline-inner {
        width: calc(100vw - 14px);
    }

    .site-mainbar-inner,
    .container,
    .footer-main-inner {
        width: calc(100vw - 14px);
    }

    .planillas-tab-item {
        min-width: 145px;
        font-size: 0.82rem;
        padding: 9px 10px;
    }

    .main-cta .cta-btn {
        font-size: 0.64rem;
        min-height: 40px;
        padding: 8px 8px;
    }

    .cta-live .yt-icon {
        width: 16px;
        height: 11px;
        flex: 0 0 16px;
    }

    .tabla-envivo td {
        padding: 7px 8px;
    }

    .tabla-envivo td::before {
        position: static;
        display: block;
        width: auto;
        margin-bottom: 2px;
        line-height: 1.05rem;
    }

    .tabla-envivo td:first-child {
        margin-bottom: 2px;
    }
}
