/* ========== Variables ========== */
:root {
    --bg: #f4f5f7;
    --fg: #141414;
    --muted: #5d6068;
    --card: #fff;
    --line: #dcdde2;
    --accent: #5b3df5;
    --accent-text: #5b3df5; /* violet utilisé pour du texte (plus clair en mode sombre) */
    --shot: #141414;
    --ok: #1f9d63;
    --warn: #b86e00;
    --bad: #d6332d;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    color-scheme: light dark; /* barres de défilement et champs suivent le thème */
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Mode sombre : selon le réglage du système, ou selon le choix fait avec le bouton (data-theme) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141414;
        --fg: #f4f5f7;
        --muted: #a3a6ae;
        --card: #1e1e20;
        --line: #333338;
        --accent-text: #9b88ff; /* violet plus clair : lisible en texte sur fond sombre */
        --shot: #2c2c33;
        --ok: #3ecf8e;
        --warn: #f0a63a;
        --bad: #ff6b66;
    }
}

:root[data-theme="dark"] {
    --bg: #141414;
    --fg: #f4f5f7;
    --muted: #a3a6ae;
    --card: #1e1e20;
    --line: #333338;
    --accent-text: #9b88ff; /* violet plus clair : lisible en texte sur fond sombre */
    --shot: #2c2c33;
    --ok: #3ecf8e;
    --warn: #f0a63a;
    --bad: #ff6b66;
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

/* ========== Animations (définitions) ========== */
@keyframes rise {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}

@keyframes fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes logo-in {
    from { opacity: 0; transform: translate(-70px, -50px) rotate(-6deg); }
    to   { opacity: 1; transform: none; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

/* ========== Base ========== */
* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 400 17px/1.6 Sora, system-ui, sans-serif;
}

a {
    color: inherit;
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== En-tête et navigation ========== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand svg {
    width: 34px;
    height: 34px;
    transition: transform 0.4s var(--ease);
}

.brand:hover svg {
    transform: rotate(-10deg) scale(1.08);
}

nav {
    display: flex;
    gap: 6px 22px;
    align-items: center;
    font-size: 15px;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 4px 0;
    transition: color 0.2s;
}

/* Soulignement qui se dessine au survol et sur la page active */
nav a:not(.btn) {
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
    transition: color 0.2s, background-size 0.35s var(--ease);
}

nav a:not(.btn):hover,
nav a:not(.btn).on {
    color: var(--fg);
    background-size: 100% 2px;
}

/* ========== Boutons ========== */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 14px 26px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

nav a.btn {
    padding: 9px 18px;
    font-size: 14px;
    color: #fff;
}

.ghost {
    background: none;
    color: var(--fg);
    box-shadow: inset 0 0 0 2px var(--line);
    margin-left: 8px;
}

.btn:active {
    transform: scale(0.97);
}

@media (hover: hover) {
    .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 24px -10px var(--accent);
    }

    .ghost:hover {
        box-shadow: inset 0 0 0 2px var(--accent);
    }
}

/* Focus visible au clavier */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ========== Pages (une seule visible à la fois) ========== */
.page {
    display: none;
}

.page.on {
    display: block;
    animation: fade 0.4s ease;
}

/* ========== Accueil : bandeau principal ========== */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
    padding: 56px 0 88px;
}

h1 {
    font-size: clamp(36px, 6vw, 66px);
    line-height: 1.04;
    letter-spacing: -0.035em;
    font-weight: 800;
    margin: 0 0 24px;
}

h1.s {
    font-size: clamp(32px, 5vw, 52px);
    max-width: 18ch;
}

.lead {
    color: var(--muted);
    max-width: 50ch;
    margin: 0 0 32px;
}

/* Logo : entre depuis le coin, puis flotte doucement */
.hero > svg {
    width: 100%;
    max-width: 380px;
    justify-self: center;
    --p1: var(--fg);
    --p2: var(--fg); /* remplacer par var(--accent) pour une diagonale violette */
}

.page.on .hero > svg {
    animation:
        logo-in 1s var(--ease) both,
        float 6s ease-in-out 1.2s infinite;
}

/* Texte du bandeau : apparition en cascade */
.page.on .hero > div > * {
    animation: rise 0.8s var(--ease) backwards;
}

.page.on .hero > div > :nth-child(1) { animation-delay: 0.05s; }
.page.on .hero > div > :nth-child(2) { animation-delay: 0.15s; }
.page.on .hero > div > :nth-child(3) { animation-delay: 0.25s; }
.page.on .hero > div > :nth-child(4) { animation-delay: 0.32s; }

/* ========== Apparition au défilement (classes posées par le JavaScript) ========== */
.js .reveal:not(.in) {
    opacity: 0;
}

.reveal.in {
    animation: rise 0.7s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 90ms);
}

/* ========== Sections et cartes ========== */
section {
    padding: 64px 0;
    border-top: 1px solid var(--line);
}

.top {
    padding-top: 32px;
    border: 0;
}

h2 {
    font-size: clamp(26px, 4vw, 40px);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 36px;
    max-width: 22ch;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px 28px 6px 28px;
    padding: 28px;
    transition: transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s var(--ease);
}

.card h3 {
    margin: 0 0 8px;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.card p,
.card li {
    color: var(--muted);
    font-size: 15px;
    margin: 0;
}

.card ul {
    padding-left: 18px;
    margin: 14px 0 0;
}

/* Carte mise en avant (tarifs) */
.hl {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-6px);
        border-color: var(--accent);
        box-shadow: 0 18px 30px -18px var(--accent);
    }

    .hl:hover {
        box-shadow: 0 0 0 2px var(--accent), 0 18px 30px -18px var(--accent);
    }
}

.price {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 8px 0 12px;
}

.price small {
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
}

/* ========== Méthode en 4 étapes ========== */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    counter-reset: s;
}

.steps li {
    counter-increment: s;
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--muted);
    font-size: 15px;
}

.steps li::before {
    content: counter(s);
    display: block;
    font-weight: 800;
    font-size: 28px;
    color: var(--fg);
}

.steps b {
    display: block;
    color: var(--fg);
    font-size: 17px;
}

/* ========== Réalisations ========== */
.shot {
    height: 150px;
    border-radius: 6px 20px 6px 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    background: var(--shot);
}

.shot::after {
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    top: 42%;
    height: 34%;
    background: var(--accent);
    transform: rotate(-14deg);
    transition: transform 0.6s var(--ease);
}

@media (hover: hover) {
    .card:hover .shot::after {
        transform: translateY(-14px) rotate(-8deg);
    }
}

.work .card {
    padding: 16px 16px 22px;
}

.work .card h3,
.work .card p {
    padding: 0 8px;
}

/* ========== Bandeau d'appel à l'action ========== */
/* Fond violet de la marque, avec une bande en diagonale qui rappelle le logo */
.cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--accent);
    color: #fff;
    border-radius: 6px 40px 6px 40px;
    padding: 52px 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin: 24px 0 40px;
}

.cta::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: -10%;
    right: -10%;
    top: 48%;
    height: 46%;
    background: rgba(255, 255, 255, 0.12);
    transform: rotate(-12deg);
}

.cta h2 {
    margin: 0;
    color: #fff;
    max-width: 18ch;
}

.cta .btn {
    background: #fff;
    color: var(--accent);
}

@media (hover: hover) {
    .cta .btn:hover {
        box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.5);
    }
}

/* ========== Deux colonnes et formulaire ========== */
.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}

form {
    display: grid;
    gap: 16px;
}

label {
    font-size: 14px;
    font-weight: 600;
    display: grid;
    gap: 6px;
}

input,
textarea,
select {
    font: inherit;
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 6px 14px 6px 14px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--fg);
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--accent);
}

textarea {
    min-height: 130px;
    resize: vertical;
}

/* ========== Pied de page ========== */
footer {
    border-top: 1px solid var(--line);
    padding: 32px 0 56px;
    color: var(--muted);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

footer a {
    margin-right: 16px;
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent);
}

/* ========== Mobile ========== */
@media (max-width: 760px) {
    .hero,
    .grid,
    .steps,
    .two {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 16px 0 56px;
    }

    .cta {
        padding: 32px 24px;
    }
}

/* ========== Accessibilité : réduire les animations si demandé ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .js .reveal:not(.in) {
        opacity: 1;
    }
}

/* ========== Espace client ========== */
.is-client .cta {
    display: none;
}

.cl {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
}

.cl-nav {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 4px;
}

.cl-user {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--muted);
}

.cl-user b {
    display: block;
    color: var(--fg);
    font-size: 16px;
}

.cl-nav a,
.cl-nav button {
    display: block;
    text-align: left;
    padding: 10px 14px;
    border-radius: 6px 14px 6px 14px;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.cl-nav a:hover,
.cl-nav button:hover {
    color: var(--fg);
    background: var(--card);
}

.cl-nav a.on {
    background: var(--accent);
    color: #fff;
}

.cl-main {
    min-width: 0;
    animation: fade 0.4s ease;
}

.cl-main h1.s {
    margin-bottom: 12px;
}

.cl-main .lead {
    margin-bottom: 28px;
}

.cl-main h3 {
    margin: 0 0 14px;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi {
    padding: 20px;
}

.kpi small {
    color: var(--muted);
    font-size: 13px;
}

.kpi b {
    display: block;
    font-size: 28px;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.duo {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 150px;
}

.bars span {
    flex: 1;
    height: var(--h);
    background: var(--accent);
    border-radius: 4px 4px 0 0;
    transform-origin: bottom;
    animation: grow 0.8s var(--ease) backwards;
    animation-delay: calc(var(--n) * 40ms);
}

@keyframes grow {
    from { transform: scaleY(0); }
}

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.list li {
    font-size: 15px;
    color: var(--muted);
}

.list li b {
    color: var(--fg);
}

.bd {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, currentColor 14%, transparent);
}

.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

.site {
    margin-bottom: 16px;
}

.site header {
    padding: 0 0 12px;
}

.site h3 {
    margin: 0;
}

.dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px 24px;
    margin: 0 0 16px;
    font-size: 14px;
}

.dl dt {
    color: var(--muted);
}

.dl dd {
    margin: 0;
    font-weight: 600;
}

.scroll {
    overflow-x: auto;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.tbl th,
.tbl td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.tbl th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.qty {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.qty button,
.mini {
    min-width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--fg);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.mini {
    padding: 0 14px;
    font-size: 13px;
}

.qty button:hover,
.mini:hover {
    border-color: var(--accent);
}

.qty button:active,
.mini:active {
    transform: scale(0.92);
}

.meter {
    display: block;
    width: 90px;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.meter i {
    display: block;
    height: 100%;
    background: currentColor;
    transition: width 0.4s var(--ease);
}

.cl form {
    max-width: 460px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar input {
    max-width: 280px;
}

.login {
    max-width: 440px;
    margin: 16px auto 0;
}

.note {
    font-size: 13px;
    color: var(--muted);
}

#toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px);
    background: var(--fg);
    color: var(--bg);
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s var(--ease);
    z-index: 10;
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 760px) {
    .cl,
    .duo {
        grid-template-columns: 1fr;
    }

    .kpis {
        grid-template-columns: 1fr 1fr;
    }

    .cl-nav {
        position: static;
        display: flex;
        overflow-x: auto;
        gap: 6px;
    }

    .cl-nav a,
    .cl-nav button {
        white-space: nowrap;
    }

    .cl-user {
        display: none;
    }
}

/* ========== Espace admin ========== */
.sec {
    margin-bottom: 36px;
}

.sec h3 {
    margin-top: 0;
}

.cl form.addrow {
    max-width: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.addrow input,
.addrow select {
    width: auto;
    flex: 1 1 130px;
}

.tbl input,
.tbl select {
    min-width: 90px;
    padding: 8px 10px;
}

.tbl input[type="number"] {
    min-width: 80px;
}

.cl-main textarea {
    margin-bottom: 12px;
}

/* ========== Barres de défilement aux couleurs du site ========== */
.scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    padding: 8px 20px 12px;
}

.scroll::-webkit-scrollbar {
    height: 8px;
}

.scroll::-webkit-scrollbar-track {
    background: transparent;
}

.scroll::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
}

.scroll::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Tableau de la liste des clients : le texte passe à la ligne au lieu de faire défiler */
.tbl.wrap th,
.tbl.wrap td {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ========== Mentions légales ========== */
.legal > * {
    max-width: 70ch;
}

.legal h2 {
    font-size: 22px;
    margin: 36px 0 12px;
}

.legal p,
.legal li {
    color: var(--muted);
    font-size: 16px;
}

.legal li {
    margin-bottom: 8px;
}

.todo {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    color: var(--fg);
    padding: 0 6px;
    border-radius: 4px;
}

/* ========== Version mobile et tablette ========== */
body {
    overflow-wrap: break-word;
}

svg {
    max-width: 100%;
}

/* Bouton du menu (caché sur ordinateur) */
.burger {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    position: relative;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    cursor: pointer;
}

.burger span {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--fg);
    transition: transform 0.3s var(--ease), opacity 0.2s;
}

.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; }
.burger span:nth-child(3) { top: 27px; }

header.open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
header.open .burger span:nth-child(2) { opacity: 0; }
header.open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Tablette */
@media (max-width: 1000px) {
    .grid,
    .steps {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .two,
    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* Téléphone */
@media (max-width: 760px) {
    body {
        font-size: 16px;
    }

    .wrap {
        padding: 0 20px;
    }

    .grid,
    .steps,
    .two,
    .hero,
    .duo,
    .cl {
        grid-template-columns: 1fr;
    }

    section {
        padding: 44px 0;
    }

    .top {
        padding-top: 20px;
    }

    h2 {
        margin-bottom: 28px;
    }

    .card {
        padding: 22px;
    }

    .work .card {
        padding: 14px 14px 20px;
    }

    /* Menu déroulant */
    .wrap > header {
        position: relative;
        flex-wrap: nowrap;
    }

    .burger {
        display: block;
    }

    .wrap > header nav {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        z-index: 20;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 6px 24px 6px 24px;
        box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.45);
    }

    .wrap > header.open nav {
        display: flex;
        animation: fade 0.25s ease;
    }

    .wrap > header nav a {
        padding: 14px 12px;
        font-size: 17px;
    }

    .wrap > header nav a.btn {
        margin-top: 6px;
        padding: 14px 18px;
        font-size: 16px;
        text-align: center;
    }

    /* Accueil */
    .hero {
        padding: 12px 0 48px;
    }

    .hero > svg {
        max-width: 130px;
        order: -1;
        justify-self: start;
    }

    .hero .btn {
        display: block;
        width: 100%;
        margin: 0 0 12px;
        text-align: center;
    }

    .hero .ghost {
        margin-left: 0;
    }

    /* Bandeau d'appel à l'action */
    .cta {
        flex-direction: column;
        align-items: flex-start;
        padding: 36px 24px;
        border-radius: 6px 32px 6px 32px;
    }

    .cta .btn {
        width: 100%;
        text-align: center;
    }

    /* Pied de page */
    footer {
        flex-direction: column;
        gap: 8px;
    }

    footer a {
        display: inline-block;
        padding: 6px 0;
    }

    /* Espace client : les champs d'ajout prennent toute la largeur */
    .addrow input,
    .addrow select,
    .addrow .btn,
    .addrow .mini {
        flex: 1 1 100%;
    }

    .toolbar input {
        max-width: none;
    }
}

/* ========== Thème : liens en violet lisible dans les deux modes ========== */
footer a:hover,
.legal a,
.note a,
.cl-main p a {
    color: var(--accent-text);
}

.todo {
    color: var(--fg);
}

/* ========== Navigation entre pages : fondu doux (navigateurs compatibles) ========== */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    ::view-transition-group(root) {
        animation-duration: 0.25s;
    }
}

/* ========== Espace client : en-tête simplifié ========== */
.app-back {
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s;
}

.app-back:hover {
    color: var(--fg);
}

/* ========== Bouton de thème (clair / sombre) ========== */
.tools {
    display: flex;
    align-items: center;
    gap: 10px;
    order: 3;
}

.theme {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.3s var(--ease);
}

.theme:hover {
    border-color: var(--accent);
    transform: rotate(-12deg);
}

.theme svg {
    grid-area: 1 / 1;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Soleil en mode sombre (pour repasser en clair), lune en mode clair */
.theme .i-sun { display: none; }
.theme[aria-pressed="true"] .i-sun { display: block; }
.theme[aria-pressed="true"] .i-moon { display: none; }

/* ========== Statistiques d'un site ========== */
.sid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--muted);
}

.sid code,
.sinfo code {
    padding: 3px 9px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--fg);
    font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
    user-select: all;
}

.sstats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0 6px;
}

.sstats div {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
}

.sstats small,
.sstats i {
    display: block;
    font-size: 12px;
    font-style: normal;
    color: var(--muted);
}

.sstats b {
    display: block;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.sbars {
    margin: 14px 0 6px;
    height: 90px;
}

.site h4 {
    margin: 14px 0 6px;
    font-size: 14px;
}

.toppages {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.toppages li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}

.toppages span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

@media (max-width: 560px) {
    .sstats { grid-template-columns: 1fr; }
}

/* Jours sans visite : un petit trait pour garder la lecture du graphique */
.sbars span {
    min-height: 3px;
}

.sbars span[title^="0 "] {
    background: var(--line);
}

.sinfo {
    max-width: 640px;
    white-space: normal;
}

/* Quantité modifiable à la main (stocks) */
.qty .qin {
    width: 96px;
    height: 34px;
    padding: 0 8px;
    text-align: center;
    font: inherit;
    font-weight: 700;
    border-radius: 10px;
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty .qin::-webkit-outer-spin-button,
.qty .qin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
