.ro-timing {
    --ro-border: #e4e4e4;
    --ro-soft: #f5f6f7;
    --ro-text: #171717;
    --ro-muted: #6b6b6b;
    --ro-accent: #d21f26;
    --ro-dark: #151515;
    color: var(--ro-text);
    background: #fff;
    border: 1px solid var(--ro-border);
    border-radius: 10px;
    overflow: hidden;
    font-family: inherit;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.ro-timing__top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--ro-border);
}

.ro-timing__eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ro-accent);
}

.ro-timing__title {
    margin: 2px 0 0;
    font-size: clamp(22px, 3vw, 31px);
    line-height: 1.05;
}

.ro-timing__event {
    margin-top: 5px;
    color: var(--ro-muted);
    font-size: 14px;
    font-weight: 600;
}

.ro-timing__live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--ro-border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.ro-timing__live span,
.ro-timing__pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ro-accent);
    display: inline-block;
}

.ro-timing.is-loading .ro-timing__live span,
.ro-timing.is-loading .ro-timing__pulse {
    animation: roPulse 1s infinite ease-in-out;
}

@keyframes roPulse {
    50% { opacity: .25; transform: scale(.75); }
}

.ro-timing__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 14px;
    padding: 12px 20px;
    background: var(--ro-soft);
    border-bottom: 1px solid var(--ro-border);
}

.ro-timing__select-label,
.ro-timing__filters label {
    display: grid;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: #4c4c4c;
}

.ro-timing__select-label--stage {
    flex: 1 1 360px;
}

.ro-timing select,
.ro-timing input[type="search"] {
    width: 100%;
    min-height: 40px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 5px;
    color: var(--ro-text);
    font: inherit;
    text-transform: none;
}

.ro-timing__tabs {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: #ddd;
    border-radius: 6px;
}

.ro-timing__tab,
.ro-timing__refresh {
    min-height: 36px;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
}

.ro-timing__tab {
    padding: 0 16px;
    background: transparent;
}

.ro-timing__tab.is-active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.ro-timing__tab:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.ro-timing__refresh {
    padding: 0 14px;
    background: var(--ro-dark);
    color: #fff;
}

.ro-timing__refresh:disabled {
    opacity: .5;
    cursor: wait;
}

.ro-timing__filters {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 11px 20px;
    border-bottom: 1px solid var(--ro-border);
}

.ro-timing__count {
    padding-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ro-muted);
    white-space: nowrap;
}

.ro-timing__stagebar {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--ro-border);
}

.ro-timing__stage-title {
    display: block;
    font-size: 16px;
    line-height: 1.15;
}

.ro-timing__stage-meta {
    display: block;
    margin-top: 3px;
    color: var(--ro-muted);
    font-size: 12px;
}

.ro-timing__freshness {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ro-muted);
    font-size: 11px;
    white-space: nowrap;
}

.ro-timing__status {
    padding: 18px 20px;
    color: var(--ro-muted);
}

.ro-timing__status.is-error {
    color: #9a0000;
    background: #fff2f2;
}

.ro-timing__table-wrap {
    width: 100%;
    overflow-x: auto;
}

.ro-timing__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.25;
}

.ro-timing__table th {
    padding: 10px 9px;
    background: var(--ro-dark);
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .055em;
    text-align: left;
    white-space: nowrap;
}

.ro-timing__table td {
    padding: 11px 9px;
    border-bottom: 1px solid var(--ro-border);
    vertical-align: middle;
}

.ro-timing__table tbody tr:nth-child(even) {
    background: #fafafa;
}

.ro-timing__table tbody tr:hover {
    background: #f1f2f3;
}

.ro-timing__table tr.is-leader {
    background: #fff9e7;
}

.ro-timing__table tr.is-second {
    box-shadow: inset 3px 0 0 #b8b8b8;
}

.ro-timing__table tr.is-third {
    box-shadow: inset 3px 0 0 #9c6b45;
}

.ro-col-pos,
.ro-col-num,
.ro-col-grp,
.ro-col-pen,
.ro-col-time,
.ro-col-diff {
    white-space: nowrap;
}

.ro-col-pos { width: 45px; text-align: center !important; }
.ro-col-num { width: 48px; text-align: center !important; }
.ro-col-time,
.ro-col-diff,
.ro-col-pen { text-align: right !important; }

.ro-car-number {
    display: inline-flex;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: var(--ro-dark);
    color: #fff;
    font-weight: 900;
}

.ro-crew strong {
    display: block;
    font-size: 14px;
}

.ro-crew > span {
    display: block;
    margin-top: 2px;
    color: var(--ro-muted);
    font-size: 12px;
}

.ro-vehicle {
    font-size: 12px;
    font-weight: 650;
}

.ro-leader-mark {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    background: var(--ro-accent);
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
}

.ro-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 6px;
    border-radius: 4px;
    background: #ececec;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
}

.ro-badge span {
    display: block;
    margin-top: 2px;
    font-weight: 600;
    text-transform: none;
}

.ro-badge--ret {
    background: #ffe9e9;
    color: #8b0000;
}

.ro-badge--sr {
    background: #fff2cc;
    color: #6f5200;
}

.ro-col-pen strong {
    color: #a40000;
}

.ro-timing__footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 20px;
    font-size: 10px;
    color: var(--ro-muted);
    background: var(--ro-soft);
    border-top: 1px solid var(--ro-border);
}

@media (max-width: 760px) {
    .ro-timing {
        border-radius: 7px;
    }

    .ro-timing__top,
    .ro-timing__controls,
    .ro-timing__filters,
    .ro-timing__stagebar {
        padding-left: 12px;
        padding-right: 12px;
    }

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

    .ro-timing__count {
        padding-bottom: 0;
    }

    .ro-timing__stagebar {
        align-items: flex-start;
        flex-direction: column;
    }

    .ro-timing__freshness {
        white-space: normal;
    }

    .ro-timing__table thead {
        display: none;
    }

    .ro-timing__table,
    .ro-timing__table tbody,
    .ro-timing__table tr,
    .ro-timing__table td {
        display: block;
        width: 100%;
    }

    .ro-timing__table tr {
        padding: 10px 12px;
        border-bottom: 1px solid var(--ro-border);
        position: relative;
    }

    .ro-timing__table td {
        border: 0;
        padding: 4px 0 4px 102px;
        min-height: 25px;
        text-align: left !important;
        white-space: normal;
        position: relative;
    }

    .ro-timing__table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 4px;
        width: 92px;
        color: var(--ro-muted);
        font-size: 9px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .ro-timing__table .ro-col-pos {
        position: absolute;
        right: 12px;
        top: 10px;
        width: auto;
        padding: 0;
        font-size: 20px;
    }

    .ro-timing__table .ro-col-pos::before {
        display: none;
    }

    .ro-timing__table .ro-col-num {
        padding-top: 0;
    }

    .ro-timing__table .ro-col-diff {
        padding-bottom: 0;
    }

    .ro-timing__table tr.is-leader {
        box-shadow: inset 4px 0 0 var(--ro-accent);
    }

    .ro-timing__table tr.is-second,
    .ro-timing__table tr.is-third {
        box-shadow: none;
    }
}


















@media (max-width: 760px) {
}


/* v0.3.1 — classificação mobile compacta estilo tabela */
@media (max-width: 760px) {
    .ro-timing__table-wrap {
        overflow-x: hidden;
    }

    .ro-timing__table {
        display: table;
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 12px;
    }

    .ro-timing__table thead {
        display: table-header-group;
    }

    .ro-timing__table tbody {
        display: table-row-group;
    }

    .ro-timing__table tr {
        display: table-row;
        width: auto;
        padding: 0;
        border: 0;
        position: static;
    }

    .ro-timing__table td,
    .ro-timing__table th {
        display: table-cell;
        width: auto;
        min-height: 0;
        position: static;
        padding: 8px 4px;
        border-bottom: 1px solid var(--ro-border);
        vertical-align: middle;
        text-align: left !important;
        white-space: normal;
    }

    .ro-timing__table td::before {
        display: none !important;
        content: none !important;
    }

    .ro-timing__table th {
        padding: 7px 4px;
        font-size: 9px;
        letter-spacing: .025em;
        white-space: nowrap;
    }

    .ro-timing__table .ro-col-pos {
        position: static;
        width: 28px;
        padding: 8px 2px;
        text-align: center !important;
        font-size: 12px;
    }

    .ro-timing__table .ro-col-num {
        width: 50px;
        text-align: center !important;
        padding-left: 2px;
        padding-right: 2px;
    }

    .ro-car-number {
        min-width: 36px;
        height: 32px;
        padding: 0 5px;
        border: 1px solid #222;
        border-radius: 7px;
        background: #fff;
        color: #111;
        font-size: 13px;
    }

    .ro-timing__table .ro-crew {
        width: auto;
        padding-left: 5px;
        padding-right: 5px;
    }

    .ro-crew strong {
        display: block;
        font-size: 12px;
        line-height: 1.15;
    }

    .ro-crew > span {
        display: block;
        margin-top: 2px;
        font-size: 10px;
        line-height: 1.1;
    }

    .ro-timing__table .ro-col-time {
        width: 58px;
        text-align: right !important;
        font-size: 12px;
        padding-left: 3px;
        padding-right: 3px;
        white-space: nowrap;
    }

    .ro-timing__table .ro-col-diff {
        width: 55px;
        text-align: right !important;
        font-size: 11px;
        padding-left: 2px;
        padding-right: 4px;
        white-space: nowrap;
    }

    /* No telemóvel, escondemos dados secundários para ganhar largura */
    .ro-timing__table .ro-vehicle,
    .ro-timing__table .ro-col-grp,
    .ro-timing__table .ro-col-pen,
    .ro-timing__table th:nth-child(4),
    .ro-timing__table th:nth-child(5),
    .ro-timing__table th:nth-child(6) {
        display: none;
    }

    .ro-timing__table tr.is-leader {
        background: #fff9e7;
        box-shadow: inset 3px 0 0 var(--ro-accent);
    }

    .ro-timing__table tr.is-second,
    .ro-timing__table tr.is-third {
        box-shadow: none;
    }

    .ro-leader-mark {
        padding: 2px 4px;
        font-size: 8px;
    }

    .ro-badge {
        display: block;
        width: fit-content;
        margin-top: 3px;
        padding: 2px 4px;
        font-size: 8px;
    }

    .ro-badge span {
        display: none;
    }

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

    .ro-timing__search {
        font-size: 13px;
    }
}


/* v0.3.5 — cabeçalho e filtros simplificados */
.ro-timing__event--primary {
    margin-top: 0;
    color: var(--ro-text);
    font-size: clamp(18px, 2.4vw, 24px);
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
}

.ro-timing__filters {
    grid-template-columns: minmax(200px, 320px) auto;
}

@media (max-width: 760px) {
    .ro-timing__filters {
        grid-template-columns: 1fr auto;
    }

    .ro-timing__count {
        align-self: end;
        padding-bottom: 10px;
    }
}


/* v0.4.0 — resumo estatístico do rali */
.ro-timing__summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--ro-border);
    background: #fff;
}

.ro-timing__summary-card {
    padding: 13px 20px 14px;
}

.ro-timing__summary-card + .ro-timing__summary-card {
    border-left: 1px solid var(--ro-border);
}

.ro-timing__summary-title {
    margin-bottom: 7px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: var(--ro-muted);
}

.ro-summary-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px dotted #ddd;
    font-size: 12px;
}

.ro-summary-line:last-child {
    border-bottom: 0;
}

.ro-summary-line span {
    font-weight: 750;
}

.ro-summary-line strong {
    flex: 0 0 auto;
    font-size: 12px;
}

.ro-summary-line--leader strong {
    color: var(--ro-accent);
}

.ro-summary-empty {
    color: var(--ro-muted);
    font-size: 11px;
}

@media (max-width: 760px) {
    .ro-timing__summary {
        grid-template-columns: 1fr;
    }

    .ro-timing__summary-card {
        padding: 11px 12px;
    }

    .ro-timing__summary-card + .ro-timing__summary-card {
        border-left: 0;
        border-top: 1px solid var(--ro-border);
    }

    .ro-summary-line {
        font-size: 11px;
    }
}


/* v0.4.1 — ligação para os tempos oficiais Anube */
.ro-timing__anube-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--ro-border);
    border-radius: 999px;
    background: #fff;
    color: var(--ro-text);
    text-decoration: none !important;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}

.ro-timing__anube-link:hover,
.ro-timing__anube-link:focus {
    background: var(--ro-soft);
    border-color: #c7c7c7;
    color: var(--ro-text);
    text-decoration: none !important;
}

.ro-timing__anube-link span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ro-accent);
    display: inline-block;
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .ro-timing__anube-link {
        padding: 7px 9px;
        font-size: 10px;
    }
}
