:root {
    --marine:  #1B3A5C;
    --verdure: #1B5E35;
    --brique:  #B53226;
    --amber:   #C68A00;
    --argile:  #78716C;
    --s50:  #FAFAF9;
    --s100: #F5F4F0;
    --s200: #E7E5E4;
    --s500: #78716C;
    --s700: #44403C;
    --s900: #1C1917;
    --sidebar-w:     224px;
    --sidebar-brand: #A8D5B5;
    --f-mono: 'DM Mono', ui-monospace, monospace;
}

.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: hsl(var(--primary));
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.layout_main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.sidebar_brand {
    padding: 1.1rem .9rem .8rem;
    flex-shrink: 0;
}
.sidebar_logo {
    font-size: 1.05rem;
    font-weight: 700;
    color: hsl(var(--primary-foreground));
    text-decoration: none;
    letter-spacing: -.015em;
    display: flex;
    align-items: center;
    gap: .45rem;
}
.sidebar_logo_icon {
    display: block;
    flex-shrink: 0;
    color: hsl(var(--primary-foreground));
}

.sidebar_search {
    padding: 0 .85rem .85rem;
    flex-shrink: 0;
}
.nav_search { position: relative; }
.sidebar_search_input {
    width: 100%;
    height: 1.85rem;
    padding: 0 .65rem;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 5px;
    font-size: .82rem;
    background: rgba(255,255,255,.08);
    color: hsl(var(--primary-foreground));
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s, background .15s;
}
.sidebar_search_input::placeholder { color: rgba(255,255,255,.35); }
.sidebar_search_input:focus { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); }

.sidebar_body {
    flex: 1;
    overflow-y: auto;
    padding: .25rem 0;
}

.sidebar_item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .48rem .9rem;
    font-size: .855rem;
    font-weight: 500;
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: color .1s, background .1s;
    margin: .04rem .45rem;
    border-radius: 5px;
}
.sidebar_item:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.07); }
.sidebar_item.active { color: hsl(var(--primary-foreground)); background: rgba(255,255,255,.12); }
.sidebar_item_icon { flex-shrink: 0; }
.sidebar_item_sm { font-size: .8em; padding: .1rem .9rem; color: rgba(255,255,255,.38); gap: .4rem; margin: 0 .45rem; }

.sidebar_auth {
    flex-shrink: 0;
    padding: .35rem 0;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar_footer {
    flex-shrink: 0;
    padding: .35rem 0 .5rem;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar_copy {
    margin: .5rem .75rem 0;
    font-size: .65rem;
    color: rgba(255,255,255,.25);
    line-height: 1.4;
}

a:not([class]):hover,
a.uk-text-muted:hover,
a.uk-text-meta:hover,
a.uk-text-emphasis:hover {
    color: hsl(var(--card-foreground));
}

.score_high   { background: var(--verdure); color: hsl(var(--primary-foreground)); border-color: transparent; }
.score_medium { background: var(--amber); color: hsl(var(--primary-foreground)); border-color: transparent; }
.score_low    { background: hsl(var(--border)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }

.uk-label-success { background-color: var(--verdure); color: #fff; border-color: transparent; }
.uk-label-warning { background-color: var(--amber);   color: #fff; border-color: transparent; }

.uk-alert-success { background: color-mix(in srgb, var(--verdure) 10%, transparent); border: 1px solid color-mix(in srgb, var(--verdure) 30%, transparent); color: var(--verdure); }

.evol { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.mono { font-family: var(--f-mono); font-size: .82rem; }

.dash_card_header    { padding: .75rem 1rem; gap: .6rem; }
.dash_card_header_sm { padding: .5rem 1rem; }
.dash_card_title     { font-size: .95rem; }
.dash_card_title_sm  { font-size: .82rem; }

.dash_kpi_card { padding: .1rem 0; box-shadow: 0 1px 3px hsl(var(--foreground) / .06); }
.dash_kpi_row  { display: flex; flex-wrap: wrap; align-items: center; }
.dash_kpi_item { flex: 1 1 110px; padding: .45rem 1.25rem; }
.dash_kpi_item + .dash_kpi_item { border-left: 1px solid hsl(var(--border)); }
.dash_kpi_val  { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.dash_kpi_lbl  { margin-top: .1rem; font-size: .72rem; }

.tip_icon { display: inline-flex; vertical-align: middle; }

.gap_3  { gap: .3rem; }
.gap_35 { gap: .35rem; }
.gap_4  { gap: .4rem; }
.gap_5  { gap: .5rem; }
.gap_75 { gap: .75rem; }
.gap_05 { gap: .5rem; }
.gap_1  { gap: 1rem; }
.gap_15 { gap: 1.5rem; }

.tbl_nowrap { white-space: nowrap; }
.card_flush { padding: 0 !important; }

.nav_search_drop {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    overflow: hidden;
    z-index: 500;
}
.nav_search_item {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    padding: .3rem .5rem;
    cursor: pointer;
    border-bottom: 1px solid hsl(var(--muted));
    transition: background .08s;
}
.nav_search_item:last-child { border-bottom: none; }
.nav_search_item:hover,
.nav_search_item.active { background: hsl(var(--muted)); }

.nav_search_item .uk-badge {
    flex-shrink: 0;
    font-size: .72rem;
    min-width: 1.6rem;
}

.nsr_body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .05rem;
}
.nsr_nom {
    font-size: .84rem;
    font-weight: 500;
    color: hsl(var(--primary));
    line-height: 1.2;
}
.nsr_meta {
    font-family: var(--f-mono);
    font-size: .71rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.2;
}

.gate_full_wrap {
    max-width: 380px;
    margin: 4rem auto;
}
.gate_page_inner {
    padding: 2rem 2rem 2rem;
}
.gate_page_icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--muted));
    border-radius: 4px;
    margin-bottom: 1.25rem;
    color: hsl(var(--foreground));
}
.gate_page_feature {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.015em;
    margin-bottom: .5rem;
    color: hsl(var(--foreground));
}
.gate_page_desc {
    font-size: .82rem;
    color: hsl(var(--muted-foreground));
    margin: 0 0 1.5rem;
    line-height: 1.5;
}
.gate_page_actions {
    display: flex;
    gap: .5rem;
}
.gate_section {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}
.gate_blur {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}
.gate_overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: hsl(var(--background) / .82);
    gap: .6rem;
    text-align: center;
    padding: 2rem;
    backdrop-filter: blur(2px);
}
.gate_overlay_sm { padding: .75rem; gap: .5rem; }
.gate_overlay_label { color: hsl(var(--foreground)); font-weight: 500; }
.gate_quota_banner {
    margin-bottom: 1rem;
}
.shrink_0 { flex-shrink: 0; }

.cl_filters { padding: 1rem 1.1rem !important; }
.cl_filters .uk-form-label { margin-bottom: .5rem; display: block; }
.cl_filters .uk-margin-small-top { margin-top: 1rem !important; }

.mobile_topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    background: hsl(var(--primary));
    z-index: 101;
    padding: 0 1rem;
    flex-shrink: 0;
}
.mob_hamburger {
    background: none;
    border: none;
    color: hsl(var(--primary-foreground));
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}
.mob_logo { flex-shrink: 0; }
.mob_search_wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}
.mob_search_input {
    width: 100%;
    height: 1.75rem;
    padding: 0 .6rem;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 5px;
    font-size: .82rem;
    background: rgba(255,255,255,.1);
    color: hsl(var(--primary-foreground));
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s, background .15s;
}
.mob_search_input::placeholder { color: rgba(255,255,255,.4); }
.mob_search_input:focus { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.15); }

.sidebar_brand_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar_close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    padding: .25rem;
    line-height: 0;
    border-radius: 4px;
    transition: color .1s, background .1s;
    flex-shrink: 0;
}
.sidebar_close:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.1); }

.sidebar_overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 100;
}

.mob_table_cards { display: flex; flex-direction: column; gap: .6rem; }
.mob_card_link { display: block; text-decoration: none; color: inherit; }
.mob_card_link:hover .mob_table_card { background: hsl(var(--accent)); }
.mob_table_card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 6px; overflow: hidden; }
.mob_card_head { display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; background: hsl(var(--muted) / .3); border-bottom: 1px solid hsl(var(--border)); }
.mob_card_title { flex: 1; min-width: 0; font-size: .87rem; font-weight: 500; line-height: 1.35; }
.mob_card_head > button { flex-shrink: 0; }
.mob_card_body { display: grid; grid-template-columns: 1fr 1fr; padding: .35rem .7rem .5rem; }
.mob_kv { display: flex; flex-direction: column; gap: .06rem; padding: .25rem 0; border-bottom: 1px solid hsl(var(--border) / .45); }
.mob_kv:nth-last-child(-n+2) { border-bottom: none; }
.mob_k { font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: hsl(var(--muted-foreground)); line-height: 1.2; }
.mob_v { font-size: .82rem; font-variant-numeric: tabular-nums; line-height: 1.35; white-space: normal; overflow: hidden; }

@media (max-width: 959px) {
    :root { --sidebar-w: 0px; }

    .mobile_topbar { display: flex; }

    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 102;
    }
    .sidebar.sidebar_open { transform: translateX(0); }
    .sidebar_overlay.sidebar_overlay_open { display: block; }
    .sidebar_close { display: flex; }
    .sidebar_search_desktop { display: none; }

    .layout_main {
        margin-left: 0;
        padding-top: 48px;
    }
    .uk-overflow-auto { -webkit-overflow-scrolling: touch; }

    .uk-overflow-auto .uk-table th,
    .uk-overflow-auto .uk-table td { white-space: nowrap; }
    .uk-table .uk-text-right { white-space: nowrap; }

    .cl_filters [uk-grid] > .uk-width-expand { flex: none; width: 50%; }
    .cl_filters [uk-grid] > .uk-width-auto   { flex: none; width: 100%; }

    .uk-overflow-auto:has(.uk-table) {
        background:
            linear-gradient(to right, hsl(var(--card)), hsl(var(--card))),
            linear-gradient(to right, hsl(var(--foreground) / .12), transparent),
            linear-gradient(to left, hsl(var(--card)), hsl(var(--card))),
            linear-gradient(to left, hsl(var(--foreground) / .12), transparent);
        background-position: left center, left center, right center, right center;
        background-repeat: no-repeat;
        background-size: 30px 100%, 14px 100%, 30px 100%, 14px 100%;
        background-attachment: local, scroll, local, scroll;
    }
    .dash_kpi_row { flex-wrap: wrap; }
    .dash_kpi_item { flex: 1 1 calc(50% - 1px); min-width: 0; }
    .dash_kpi_item + .dash_kpi_item { border-left: none; }
    .dash_kpi_item:nth-child(even) { border-left: 1px solid hsl(var(--border)); }
    .dash_kpi_item:nth-child(n+3)  { border-top: 1px solid hsl(var(--border)); }
    .gate_full_wrap { margin: 1.5rem auto; }
    .dash_dist_label { width: 7rem; }
    .uk-heading-small { font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.2; margin-bottom: .35rem; }
}

@media (max-width: 479px) {
    .dash_kpi_item { flex-basis: 100%; }
    .dash_kpi_item:nth-child(even) { border-left: none; }
    .dash_kpi_item:nth-child(n+2)  { border-top: 1px solid hsl(var(--border)); }
}
