/**
 * Race Lens design tokens - tune sizes/colours here.
 * Maps to HedgerPro theme where useful; bumped for readability.
 */
 #rl-root {
    /* Typography */
    --rl-font: var(--font, 'Montserrat'), system-ui, sans-serif;
    --rl-base: 12px;
    --rl-text-xs: 11px;
    --rl-text-sm: 12px;
    --rl-text-md: 13px;
    --rl-text-lg: 15px;
    --rl-text-xl: 17px;
    --rl-text-title: 26px;
    --rl-lh-tight: 1;
    --rl-lh-normal: 1.4;
    --rl-lh-relaxed: 1.5;
    --rl-fw-normal: 500;
    --rl-fw-semibold: 600;
    --rl-fw-bold: 700;

    /* Colours (from theme + aliases) */
    --rl-bg-page: var(--white, #fff);
    --rl-bg-pane: var(--gray-brighter, #f5f5f5);
    --rl-bg-tab: var(--gray-lighter, #e8e8e8);
    --rl-bg-tab-hover: var(--gray-mid, #c8c8c8);
    --rl-bg-tab-active: linear-gradient(var(--blue-mid), var(--blue-light));
    --rl-bg-block: var(--gray-brightest, #fafafa);
    --rl-bg-row-alt: var(--gray-brightest, #fafafa);
    --rl-bg-row-warn: var(--yellow-lightest, #fffbeb);
    --rl-bg-race-selected: linear-gradient(var(--blue-mid), var(--blue-light));
    --rl-text: var(--black, #131313);
    --rl-text-muted: var(--gray-dark, #5c5c5c);
    --rl-text-subtle: var(--gray-mid, #888);
    --rl-text-on-accent: var(--white, #fff);
    --rl-text-title-color: var(--blue-accent, hsl(217, 66%, 41%));
    --rl-text-block-title: var(--blue-dark, hsl(217, 18%, 37%));
    --rl-border: var(--gray-mid, #b0b0b0);
    --rl-border-light: var(--gray-light, #d0d0d0);
    --rl-border-block: var(--gray-light, #d4d4d4);
    --rl-accent: var(--blue-accent);
    --rl-accent-mid: var(--blue-mid);
    --rl-pos: var(--green-dark, #1a7a3a);
    --rl-neg: var(--red-dark, #b32d2d);
    --rl-err: var(--red-dark, #b32d2d);
    --rl-warn: var(--orange-dark, #c45c00);

    /* Spacing */
    --rl-space-2xs: 2px;
    --rl-space-xs: 3px;
    --rl-space-sm: 4px;
    --rl-space-md: 8px;
    --rl-space-lg: 12px;
    --rl-space-xl: 16px;
    --rl-space-2xl: 20px;
    --rl-radius: var(--radius, 2px);
    --rl-sidebar-width: 280px;
    --rl-tab-width: 5.5rem;
    --rl-race-border-selected: 3px;

    /* Controls */
    --rl-input-pad-y: 6px;
    --rl-input-pad-x: 8px;
    --rl-input-font: var(--rl-text-md);
    --rl-checkbox-size: 18px;
    --rl-tol-input-width: 3.5rem;

    /* Runners table columns */
    --rl-col-hash: 40px;
    --rl-col-num: 66px;
    font-family: var(--rl-font);
    font-size: var(--rl-base);
    line-height: var(--rl-lh-normal);
    color: var(--rl-text);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--rl-bg-page);
}

/* Header */
#rl-root .rl-header {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    gap: var(--rl-space-lg);
    padding: var(--rl-space-md);
    /* border-bottom: 1px solid var(--rl-border); */
    background: var(--rl-bg-page);
    justify-content: center;
}

#rl-root .rl-title {
    margin: 0;
    font-size: var(--rl-text-title);
    font-weight: 700;
    line-height: var(--rl-lh-tight);
    text-transform: uppercase;
    color: var(--blue-dark);
}

#rl-root .rl-today {
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-normal);
    color: var(--rl-text-muted);
    display: none;
}

/* Main layout */
#rl-root .rl-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    gap: 5px;
    margin: 0 5px 5px 5px;
}

/* Sidebar: vertical tabs + panel */
#rl-root .rl-sidebar {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rl-border);
    border-radius: 3px;
    background: var(--rl-bg-page);
    min-height: 0;
    /* overflow: hidden; */
    width: 300px;
}

#rl-root .rl-tabs {
    display: flex;
    border-right: 1px solid var(--rl-border);
    background: var(--rl-bg-pane);
}

#rl-root .rl-tab {
    border: none;
    border-bottom: 1px solid var(--rl-border-light);
    padding: 6px;
    font-family: var(--rl-font);
    font-size: var(--rl-text-sm);
    font-weight: var(--rl-fw-semibold);
    line-height: var(--rl-lh-tight);
    text-transform: uppercase;
    text-align: center;
    background: var(--rl-bg-tab);
    color: var(--rl-text);
    cursor: pointer;
    flex: 1;
}

#rl-root .rl-tab:hover {
    background: var(--rl-bg-tab-hover);
}

#rl-root .rl-tab.selected,
#rl-root .rl-tab.selected:hover {
    color: var(--rl-text-on-accent);
    background: var(--rl-bg-tab-active);
}

#rl-root .rl-panels {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
    /* padding: 4px 0 0 0; */
    background: var(--rl-bg-pane);
}

#rl-root .rl-panel {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-md);
    min-height: 0;
    padding: 4px 0 4px 0;
}

#rl-root .rl-panel.hidden {
    display: none;
}

/* Race list (Cards tab) */
#rl-root .race-list {
    list-style: none;
    margin: 0;
    padding: var(--rl-space-2xs) 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#rl-root .race-list li {
    padding: var(--rl-space-sm) var(--rl-space-md);
    cursor: pointer;
    border-left: var(--rl-race-border-selected) solid transparent;
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-normal);
    background: #dfdcdc;
}

#rl-root .race-list li:hover {
    background: var(--rl-bg-tab);
}

#rl-root .race-list li.selected {
    background: var(--blue-dark);
    color: var(--rl-text-on-accent);
    border-left-color: hsl(140.42deg 100% 43.36%);
}

#rl-root .race-row {
    display: flex;
    gap: var(--rl-space-sm);
    min-width: 0;
}

#rl-root .race-time {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: var(--rl-fw-semibold);
}

#rl-root .race-venue {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#rl-root .race-list li.selected .race-venue {
    color: var(--gray-lightest, #e8e8e8);
}

/* Settings blocks */
#rl-root .rl-block {
    background: var(--rl-bg-block);
    border: 1px solid var(--rl-border-block);
    border-radius: var(--rl-radius);
    padding: var(--rl-space-sm);
    margin: 0 4px;
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-sm);
}

#rl-root .rl-block-title {
    margin: 0 0 var(--rl-space-xs);
    font-size: var(--rl-text-sm);
    font-weight: var(--rl-fw-bold);
    line-height: var(--rl-lh-tight);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--rl-text-block-title);
    border-bottom: 1px solid var(--rl-border-light);
    padding-bottom: var(--rl-space-xs);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-sm);
}

/* Eye on a filter block title: show every row, or only the rows in use. */
#rl-root .rl-block-eye {
    flex: 0 0 auto;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--rl-text-muted);
    font-size: var(--rl-text-sm);
    line-height: 1;
    cursor: pointer;
}

#rl-root .rl-block-eye:hover {
    color: var(--rl-text);
}

#rl-root .rl-block-eye.is-on {
    color: var(--rl-accent);
}

#rl-root .rl-field {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-2xs);
    font-size: var(--rl-text-xs);
    font-weight: var(--rl-fw-semibold);
    line-height: var(--rl-lh-tight);
    text-transform: uppercase;
    color: var(--rl-text-muted);
}

#rl-root .rl-block.rl-block-general .rl-field {

flex-direction: row;

justify-content: space-between;

align-items: center;
}

#rl-root .rl-field input {
    padding: 3px;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    font-family: var(--rl-font);
    font-size: var(--rl-input-font);
    line-height: var(--rl-lh-normal);
    color: var(--rl-text);
    background: var(--rl-bg-page);
    width: 62px;
}

#rl-root .rl-field-row {
    display: flex;
    gap: var(--rl-space-sm);
}

#rl-root .rl-field-row .rl-field {
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
}

#rl-root .rl-check {
    display: flex;
    align-items: center;
    gap: var(--rl-space-sm);
    font-size: var(--rl-text-md);
    font-weight: var(--rl-fw-normal);
    line-height: var(--rl-lh-normal);
    cursor: pointer;
    text-transform: uppercase;
}

#rl-root .rl-check input[type="checkbox"] {
    width: var(--rl-checkbox-size);
    height: var(--rl-checkbox-size);
    accent-color: var(--rl-accent);
}

#rl-root .rl-filter-row {
    display: flex;
    align-items: center;
    gap: var(--rl-space-sm);
    min-width: 0;
    /* background: var(--gray-lightest); */
    padding: 2px 4px 2px 0;
}

#rl-root .rl-filter-row .rl-check {
    flex: 1 1 auto;
    min-width: 0;
}

#rl-root .rl-tol-wrap {
    display: flex;
    align-items: center;
    gap: var(--rl-space-xs);
    flex: 0 0 auto;
}

#rl-root .rl-tol-prefix,
#rl-root .rl-tol-suffix {
    font-size: var(--rl-text-lg);
    font-weight: var(--rl-fw-semibold);
    color: var(--rl-text-muted);
    line-height: 1;
    cursor: pointer;
}

#rl-root .rl-tol-wrap input {
    width: var(--rl-tol-input-width);
    padding: var(--rl-space-xs) var(--rl-space-sm);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    font-family: var(--rl-font);
    font-size: var(--rl-input-font);
    background: var(--rl-bg-page);
}

#rl-root .rl-tol-wrap input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--rl-bg-pane);
}

#rl-root .rl-profile-row {
    display: flex;
    align-items: flex-end;
    gap: var(--rl-space-sm);
    min-width: 0;
}

#rl-root .rl-profile-row--actions {
    align-items: center;
}

#rl-root .rl-field--inline {
    flex: 1;
    min-width: 0;
}

#rl-root .rl-field--inline select,
#rl-root .rl-field--inline input[type="text"] {
    padding: 4px 0px;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    font-family: var(--rl-font);
    font-size: var(--rl-input-font);
    line-height: var(--rl-lh-normal);
    color: var(--rl-text);
    background: var(--rl-bg-page);
    min-width: 69px;
}

#rl-root .rl-btn {
    flex: 0 0 auto;
    padding: var(--rl-input-pad-y) var(--rl-space-md);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    background: var(--rl-bg-tab);
    font-family: var(--rl-font);
    font-size: var(--rl-text-xs);
    font-weight: var(--rl-fw-semibold);
    line-height: 18px;
    text-transform: uppercase;
    color: var(--rl-text);
    cursor: pointer;
    width: 58px;
}

#rl-root .rl-btn:hover:not(:disabled) {
    background: var(--rl-bg-tab-hover);
}

#rl-root .rl-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#rl-root .rl-btn--accent {
    background: var(--rl-accent);
    border-color: var(--rl-accent);
    color: var(--rl-text-on-accent);
}

#rl-root .rl-btn--accent:hover:not(:disabled) {
    filter: brightness(1.05);
}

#rl-root .rl-btn--danger {
    color: var(--rl-err);
    border-color: var(--rl-border-light);
}

#rl-root .rl-profile-msg {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--rl-text-sm);
    color: var(--rl-text-muted);
    text-transform: none;
    font-weight: var(--rl-fw-normal);
}

#rl-root .rl-hint {
    margin: 0;
    font-size: var(--rl-text-sm);
    line-height: var(--rl-lh-relaxed);
    color: var(--rl-text-muted);
    text-transform: none;
    font-weight: var(--rl-fw-normal);
    display: none;
}

/* Detail / runners */
#rl-root .rl-detail {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: var(--rl-space-md);
    /* background: var(--rl-bg-page); */
    border: 1px solid var(--rl-border);
    border-radius: 3px;
}

#rl-root .rl-detail-head {
    flex: 0 0 auto;
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-normal);
    color: var(--rl-text-muted);
    padding-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#rl-root .rl-detail-head strong {
    color: var(--rl-text);
    font-weight: var(--rl-fw-semibold);
    font-size: var(--rl-text-xl);
}

#rl-root .rl-err {
    color: var(--rl-err);
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-normal);
    /* min-height: 1.2em; */
}

#rl-root .rl-warn {
    color: var(--rl-warn);
    font-size: var(--rl-text-sm);
    line-height: var(--rl-lh-relaxed);
    /* min-height: 1.2em; */
    display: none;
}

#rl-root .runners-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    /* border: 1px solid var(--rl-border); */
    /* padding: var(--rl-space-md); */
    position: relative;
}

#rl-root .rl-race-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--rl-space-sm);
    background: rgba(255, 255, 255, 0.82);
    font-family: var(--rl-font);
    font-size: var(--rl-text-md);
    font-weight: var(--rl-fw-semibold);
    color: var(--rl-text-muted);
    text-transform: uppercase;
}

#rl-root .rl-race-loading.hidden {
    display: none;
}

#rl-root .rl-race-loading .fa-spinner {
    color: var(--rl-accent);
}

#rl-root .rl-table {
    /* width: 100%; */
    /* table-layout: fixed; */
    border-collapse: collapse;
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-normal);
}

#rl-root .rl-table .col-name {
 text-align:left;   
}

#rl-root .rl-table .col-hash {
    width: var(--rl-col-hash);
    text-align: center;
    width: 50px;
}

#rl-root .rl-table .col-num {
    width: 50px;
}


#rl-root .rl-table .col-value {
    text-align: center;
    padding: 5px;
    width: 50px;
}
#rl-root .rl-table .col-value div {
    text-align: center;
    padding: 5px;
    background: #d2d2d2;
    border: 1px solid #868686;
    border-radius: 2px;
}

#rl-root .rl-table .col-name {
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

#rl-root .rl-table th,
#rl-root .rl-table td {
    padding: 1px 3px;
    border: 1px solid var(--rl-border-light);
    white-space: nowrap;
    font-weight: 600;
    height: 25px;
    font-variant: tabular-nums;
}

#rl-root .rl-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--rl-bg-tab);
    color: var(--rl-text);
    font-weight: var(--rl-fw-semibold);
    font-size: var(--rl-text-md);
    line-height: var(--rl-lh-tight);
    text-transform: uppercase;
}

#rl-root .rl-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    background-color: var(--blue-dark);
    color: #fff;
}

#rl-root .rl-table th.sortable:hover {
    background: var(--rl-bg-tab-hover);
}

#rl-root .rl-table th.sortable.sorted[sort-order='desc']:after,
#rl-root .rl-table th.sortable.sorted[sort-order='asc']:before {
    content: "";
    border-top: 2px solid #ffe700;
    display: block;
    left: 0;
    right: 0;
    top: 0;
    position: absolute;
}

#rl-root .rl-table th.sortable.sorted[sort-order='asc']:before {
    border-top-color: #ff6b6b;
}


#rl-root .rl-table tbody tr:nth-child(even) {
    background: var(--rl-bg-row-alt);
}

#rl-root .rl-table .num {
    text-align: center;
    font-family: var(--rl-font);
}

#rl-root .rl-table tr.row-muted td {
    color: #000;
}

#rl-root .rl-table tr.low-n {
}

#rl-root .pos {
    color: var(--rl-pos);
    font-weight: var(--rl-fw-semibold);
}

#rl-root .neg {
    color: var(--rl-neg);
    font-weight: var(--rl-fw-semibold);
}

/* Profile quick actions (Cards-style) */
#rl-root .rl-profile-picker {
    display: flex;
    align-items: flex-end;
    gap: var(--rl-space-sm);
    min-width: 0;
}

#rl-root .rl-profile-edit-toggle {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    background: var(--rl-bg-tab);
    color: var(--rl-text-muted);
    font-size: var(--rl-text-md);
    line-height: 1;
    cursor: pointer;
}

#rl-root .rl-profile-edit-toggle:hover,
#rl-root .rl-profile-edit-toggle.open {
    background: var(--rl-bg-tab-hover);
    color: var(--rl-text);
}

#rl-root .rl-profile-quick {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-xs);
    margin-top: var(--rl-space-sm);
    padding: var(--rl-space-sm);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    background: var(--rl-bg-pane);
}

#rl-root .rl-profile-quick.hidden {
    display: none;
}

#rl-root .rl-pqa-row {
    display: flex;
    gap: var(--rl-space-xs);
    min-width: 0;
}

#rl-root .rl-pqa-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: var(--rl-input-pad-y) var(--rl-space-sm);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    background: var(--rl-bg-tab);
    font-family: var(--rl-font);
    font-size: var(--rl-text-xs);
    font-weight: var(--rl-fw-semibold);
    line-height: 1.3;
    text-transform: uppercase;
    color: var(--rl-text);
    cursor: pointer;
}

#rl-root .rl-pqa-btn:hover {
    background: var(--rl-bg-tab-hover);
}

#rl-root .rl-pqa-btn--accent {
    background: var(--rl-accent);
    border-color: var(--rl-accent);
    color: var(--rl-text-on-accent);
}

#rl-root .rl-pqa-btn--accent:hover {
    filter: brightness(0.95);
}

#rl-root .rl-pqa-btn--danger {
    background: var(--rl-danger, #dc3545);
    border-color: var(--rl-danger, #dc3545);
    color: #fff;
}

#rl-root .rl-pqa-btn--danger:hover {
    filter: brightness(0.95);
}

#rl-root .rl-pqa-name {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-xs);
}

#rl-root .rl-pqa-name.hidden {
    display: none;
}

#rl-root .rl-profile-quick.mode-name > .rl-pqa-row {
    display: none;
}

#rl-root .rl-profile-quick.mode-name .rl-pqa-name {
    display: flex;
}

#rl-root .rl-pqa-label {
    font-size: var(--rl-text-sm);
    color: var(--rl-text-muted);
}

#rl-root .rl-pqa-label.is-error {
    color: var(--rl-neg);
}

#rl-root #profileNameInput {
    padding: var(--rl-input-pad-y) var(--rl-input-pad-x);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    font-family: var(--rl-font);
    font-size: var(--rl-input-font);
    color: var(--rl-text);
    background: var(--rl-bg-page);
}

#rl-root .rl-profile-quick .rl-profile-msg {
    flex: none;
    width: 100%;
    text-align: center;
    padding: var(--rl-space-2xs) 0;
    border-radius: var(--rl-radius);
    background: var(--rl-bg-tab);
}

@media (max-width: 768px) {
    #rl-root {
        --rl-sidebar-width: 100%;
    }
    #rl-root .rl-main {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(10rem, 35vh) minmax(0, 1fr);
    }
    #rl-root .rl-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--rl-border);
        max-height: 35vh;
    }
}
