*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1c1f26;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #6c1cd1;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

.topbar {
    background: #1a1030;
    color: #fff;
    padding: 1rem 1.5rem;
}
.topbar h1 { margin: 0; font-size: 1.15rem; }
.topbar h1 a { color: #fff; text-decoration: none; }
.topbar .subtitle { color: #c9c2e0; font-size: .85rem; }

main { padding: 1.25rem 1.5rem 2.5rem; }

/* --- Filtres --- */
.filters {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .8rem 1.1rem;
}
.filters label.sel {
    display: flex;
    flex-direction: column;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    font-weight: 600;
    gap: .3rem;
}
.filters label.check {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--ink);
    font-weight: 500;
}

/* Groupes de filtres à choix multiple */
.chipset { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.chipset-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    font-weight: 700;
    margin-right: .1rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .82rem;
    background: #fff;
    cursor: pointer;
    user-select: none;
}
.chip input { margin: 0; }
.chip.on {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, #fff);
    font-weight: 600;
}
.filters select {
    font-size: .9rem;
    padding: .4rem .5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    min-width: 9rem;
}
.filters .reset {
    margin-left: auto;
    align-self: center;
    font-size: .85rem;
    color: var(--accent);
    text-decoration: none;
}
.filters .reset:hover { text-decoration: underline; }

/* --- Curseurs --- */
.sliders {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.1rem 1.6rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
}
.slider-box { font-size: .8rem; }
.slider-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .9rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: .72rem;
}
.slider-head output {
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
}
.slider { margin: 0 .4rem; }
.noUi-connect { background: var(--accent); }
.noUi-horizontal { height: 6px; }
.noUi-horizontal .noUi-handle {
    width: 16px; height: 16px;
    top: -6px; right: -8px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.noUi-handle::before, .noUi-handle::after { display: none; }

.count { color: var(--muted); margin: .3rem 0 1rem; }
.count strong { color: var(--ink); }

/* --- Tableau --- */
.table-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
}
table.catalog {
    border-collapse: collapse;
    width: 100%;
    min-width: 980px;
}
table.catalog th, table.catalog td {
    padding: .5rem .55rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.catalog th.cpu, table.catalog td.cpu { white-space: normal; min-width: 130px; max-width: 190px; }
table.catalog thead th {
    position: sticky;
    top: 0;
    background: #fafafe;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    z-index: 1;
}
table.catalog thead th a.sort {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
table.catalog thead th a.sort:hover { color: var(--accent); }
table.catalog thead th a.sort.on { color: var(--ink); font-weight: 700; }

td.freq .turbo { color: var(--muted); }
.rpn-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: 0 .35rem;
    border-radius: 4px;
    background: #eef2ff;
    color: #3730a3;
}
td.raid { cursor: help; }

td.year span { cursor: help; }
td.year span.old { color: #c2410c; font-weight: 700; }
td.win { white-space: nowrap; }
.win-tag {
    display: inline-block;
    min-width: 1.3em;
    text-align: center;
    margin-right: .2rem;
    font-size: .68rem;
    font-weight: 700;
    padding: .05rem .3rem;
    border-radius: 4px;
    background: #f1f1f4;
    color: #9ca3af;
}
.win-tag.ok { background: #dbeafe; color: #1d4ed8; }
.pve-tag {
    display: inline-block;
    min-width: 1.3em;
    text-align: center;
    margin-right: .2rem;
    font-size: .68rem;
    font-weight: 700;
    padding: .05rem .3rem;
    border-radius: 4px;
    background: #f1f1f4;
    color: #9ca3af;
}
.pve-tag.ok { background: #ffe4cc; color: #b6470a; }
table.catalog td.num, table.catalog th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.catalog tbody tr { border-left: 4px solid var(--range, transparent); }
table.catalog tbody tr:hover { background: #f7f5fd; }
td.model { font-weight: 600; }
td.raidcol { text-align: center; }
.raid-tag {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: .1rem .45rem;
    border-radius: 4px;
}
.raid-tag.soft { background: #dbeafe; color: #1d4ed8; }
.raid-tag.hard { background: #fef3c7; color: #92400e; }
.upgrade-tag {
    display: inline-block;
    padding: .05rem .35rem;
    border-radius: 4px;
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 700;
    cursor: help;
    border-bottom: 1px dashed #6d28d9;
}
td.price { font-weight: 700; white-space: nowrap; }
td.price .was {
    display: block;
    font-weight: 400;
    font-size: .78em;
    color: var(--muted);
    text-decoration: line-through;
}
td.price .disc {
    display: inline-block;
    margin-left: .25rem;
    font-size: .72rem;
    font-weight: 700;
    color: #15803d;
}
td.price .na {
    display: block;
    font-weight: 500;
    font-size: .72rem;
    color: var(--muted);
    cursor: help;
}
td.empty, .empty { text-align: center; color: var(--muted); padding: 2rem; }

.pill {
    display: inline-block;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: .12rem .5rem;
    border-radius: 999px;
}
.muted { color: var(--muted); font-size: .82em; }
.bench {
    display: inline-block;
    margin-left: .4rem;
    padding: 0 .35rem;
    font-size: .72rem;
    background: #eef0f4;
    border-radius: 4px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    padding: .1rem .45rem;
    border-radius: 4px;
}
.badge.ok   { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef9c3; color: #854d0e; }
.badge.err  { background: #fee2e2; color: #991b1b; }

.topbar .subtitle a { color: #fff; }

.topnav { margin-top: .4rem; display: flex; gap: 1.2rem; }
.topnav a {
    color: #c9c2e0;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
    padding-bottom: .15rem;
    border-bottom: 2px solid transparent;
}
.topnav a:hover { color: #fff; }
.topnav a.on { color: #fff; border-bottom-color: #fff; }

section.opt { margin: 1.6rem 0 2.2rem; }
section.opt h2 { margin-bottom: .3rem; }
.opt-table { min-width: 480px; }
.opt-table td.model .block { display: block; font-weight: 400; margin-top: .15rem; }
.muted.block { display: block; }

.opt-table tr.oneshot td.price { color: #6d28d9; }
.opt-table .tag {
    display: inline-block;
    margin-left: .35rem;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 0 .35rem;
    border-radius: 4px;
    background: #ede9fe;
    color: #6d28d9;
    vertical-align: middle;
}
.legal { font-size: .78rem; color: var(--muted); margin: .5rem 0 0; }
.feature-list { margin: .5rem 0 0; padding-left: 1.1rem; }
.feature-list li { margin: .25rem 0; }

/* --- Admin --- */
.login-form, .edit-form { display: flex; flex-direction: column; gap: .9rem; }
.login-form label, .edit-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; }
.login-form input, .edit-form input {
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: .95rem;
}
.login-error { color: #b91c1c; font-weight: 600; }
.ok-msg {
    background: #dcfce7; color: #166534;
    padding: .6rem .8rem; border-radius: 6px; font-size: .88rem;
}
button {
    align-self: flex-start;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
}
button.secondary { background: #6b7280; }
.edit-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
td.logmsg { white-space: normal; max-width: 420px; font-size: .82rem; }
.admin-bar {
    display: flex;
    align-items: center;
    gap: .9rem;
    flex-wrap: wrap;
    margin: .6rem 0 1rem;
}
.admin-bar button { align-self: auto; }

td.net { white-space: nowrap; }
.bw-up {
    display: inline-block;
    margin-left: .3rem;
    font-size: .68rem;
    font-weight: 700;
    padding: 0 .3rem;
    border-radius: 4px;
    background: #dcfce7;
    color: #166534;
    cursor: help;
}
.dcs { white-space: normal; max-width: 210px; }
.dc {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .1rem .4rem;
    margin: .1rem .15rem .1rem 0;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 4px;
    cursor: help;
}
.dc.hds { border-color: #99f6e4; background: #f0fdfa; color: #0f766e; }

.stock { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.stock.in { color: #15803d; }
.stock.in .units { color: var(--muted); font-weight: 700; }
.stock.in.low { color: #b45309; font-weight: 700; cursor: help; }
.stock.in.low .units {
    background: #fed7aa;
    color: #9a3412;
    font-weight: 800;
    padding: 0 .4rem;
    border-radius: 999px;
    margin-left: .15rem;
}
.stock.out { color: #b91c1c; }
.stock.unk { color: var(--muted); cursor: help; }

.footer {
    padding: 1rem 1.5rem 2rem;
    color: var(--muted);
    font-size: .8rem;
}
.footer code { background: #eceef2; padding: .05rem .3rem; border-radius: 3px; }

@media (max-width: 640px) {
    main { padding: 1rem; }
    .filters .reset { margin-left: 0; }
}
