:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #1d2330;
    --muted: #6b7280;
    --border: #e3e6ec;
    --primary: #2e5aac;
    --primary-dark: #244a8f;
    --danger-bg: #fdecec;
    --danger-ink: #a32d2d;
    --radius: 10px;
}

* { box-sizing: border-box; }

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

/* Barre du haut */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; letter-spacing: .2px; }
.topnav { display: flex; align-items: center; gap: 1.25rem; font-size: .9rem; }
.who { color: var(--muted); }
.role {
    display: inline-block;
    margin-left: .35rem;
    padding: .1rem .5rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: #eef2fb;
    color: var(--primary-dark);
    border-radius: 999px;
}
.logout { color: var(--primary); text-decoration: none; }
.logout:hover { text-decoration: underline; }

/* Conteneur principal */
.container { max-width: 960px; margin: 2.5rem auto; padding: 0 1.5rem; }
.muted { color: var(--muted); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }

/* Carte de connexion */
.login-card {
    max-width: 380px;
    margin: 8vh auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.login-card h1 { margin-bottom: .25rem; }

/* Formulaire */
.form { display: flex; flex-direction: column; margin-top: 1.25rem; }
.form label { font-size: .85rem; font-weight: 500; margin-bottom: .3rem; }
.form input {
    padding: .6rem .7rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}
.form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #2e5aac22; }
.btn {
    padding: .65rem 1rem;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }

/* Alertes */
.alert { padding: .65rem .8rem; border-radius: 8px; font-size: .9rem; margin-top: 1rem; }
.alert-error { background: var(--danger-bg); color: var(--danger-ink); }

/* Cartes du tableau de bord */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.card {
    display: block;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }

/* --- Module Produits --- */
.navlink { color: var(--primary); text-decoration: none; font-weight: 500; }
.navlink:hover { text-decoration: underline; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.page-head h1 { margin: 0; }
.back { text-decoration: none; }

.alert-success { background: #e7f5ec; color: #1d6b3c; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: .9rem;
}
.table th, .table td {
    padding: .6rem .7rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.table thead th {
    background: #f8f9fb;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--muted);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; }
.table tr.is-inactive { color: var(--muted); background: #fbfbfc; }

.actions { display: flex; gap: .6rem; align-items: center; }
.actions a { color: var(--primary); text-decoration: none; }
.actions a:hover { text-decoration: underline; }
.inline { display: inline; margin: 0; }
.link-danger {
    background: none; border: 0; padding: 0;
    color: var(--danger-ink); cursor: pointer; font-size: inherit;
}
.link-danger:hover { text-decoration: underline; }

/* Formulaire large */
.form-wide { max-width: 560px; }
.form-wide textarea {
    padding: .6rem .7rem; border: 1px solid var(--border);
    border-radius: 8px; font-size: 1rem; font-family: inherit; margin-bottom: 1rem; resize: vertical;
}
.form-wide select {
    padding: .6rem .7rem; border: 1px solid var(--border);
    border-radius: 8px; font-size: 1rem; margin-bottom: 1rem; background: #fff;
}
.form .checkbox {
    flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; margin-bottom: 1rem;
}
.form .checkbox input { width: auto; margin: 0; }
fieldset.sensitive {
    border: 1px solid #e6dcc6; background: #fdfbf4;
    border-radius: 8px; padding: 1rem 1rem .25rem; margin: .5rem 0 1rem;
}
fieldset.sensitive legend {
    font-size: .8rem; font-weight: 500; color: #8a6d1f; padding: 0 .4rem;
}

/* --- Couleurs produit --- */
h2.section { font-size: 1.05rem; margin: 1.8rem 0 .8rem; }

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.color-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .8rem;
}
.color-visual {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: .6rem;
}
.color-visual img { max-width: 100%; max-height: 100%; object-fit: contain; }
.no-img { color: var(--muted); font-size: .82rem; }
.color-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.swatch {
    width: 18px; height: 18px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15); flex: none;
}
.color-name { font-weight: 500; }
.color-actions { display: flex; flex-direction: column; gap: .5rem; }
.row-form { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.row-form input[type=file] { font-size: .8rem; }
.btn-small {
    padding: .35rem .6rem; font-size: .82rem;
    background: var(--primary); color: #fff; border: 0; border-radius: 6px; cursor: pointer;
}
.btn-small:hover { background: var(--primary-dark); }
.form-wide input[type=color] {
    width: 56px; height: 38px; padding: 2px; border: 1px solid var(--border);
    border-radius: 8px; background: #fff; margin-bottom: 1rem; cursor: pointer;
}
.form-wide input[type=file] {
    margin-bottom: 1rem; font-size: .9rem;
}

.link-primary {
    background: none; border: 0; padding: 0;
    color: var(--primary); cursor: pointer; font-size: inherit;
}
.link-primary:hover { text-decoration: underline; }
