/* SenMart admin — barre latérale verte, contenu clair, accents or */
:root {
    --bg: #F6F4EC;
    --surface: #FFFFFF;
    --ink: #13281C;
    --muted: #5D6B60;
    --line: #E4DFD0;
    --green: #0B6B3A;
    --green-dark: #08502B;
    --green-ink: #FFFFFF;
    --gold: #F2A900;
    --gold-soft: #FFF3D1;
    --red: #C62828;
    --red-soft: #FDE7E5;
    --blue: #1F5FA8;
    --blue-soft: #E3EEFA;
    --tile: #F1EDE1;
    --display: "Lexend", "Avenir Next", "Segoe UI", sans-serif;
    --body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0F1712; --surface: #17221B; --ink: #EEF3EC; --muted: #A3B0A5; --line: #2A3A2F;
        --green: #2FA866; --green-dark: #0C2416; --green-ink: #07120B; --gold: #F5B91E; --gold-soft: #3A2F10;
        --red: #F0625A; --red-soft: #3A1A18; --blue: #6EA8EE; --blue-soft: #16273B; --tile: #1E2C23;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; text-wrap: balance; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--green-dark); color: #E9F3EC; padding: 22px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand svg { width: 36px; height: 36px; }
.brand b { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; color: #fff; }
.brand b span { color: var(--gold); }
.brand small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; opacity: .7; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; color: #D5E6DA; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: var(--gold); color: #13281C; }
.nav .count { margin-left: auto; background: var(--gold); color: #13281C; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 800; }
.nav a.on .count { background: #13281C; color: var(--gold); }
.side form { margin-top: auto; }
.side .who { font-size: 13px; opacity: .75; padding: 0 12px 8px; overflow-wrap: anywhere; }
.side button { display: flex; gap: 10px; align-items: center; width: 100%; background: transparent; border: 1px solid rgba(255,255,255,.2); color: #E9F3EC; border-radius: 10px; padding: 9px 12px; cursor: pointer; font-weight: 600; }
.side button:hover { background: rgba(255,255,255,.08); }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 36px) 48px; display: flex; flex-direction: column; gap: 22px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 28px; font-weight: 800; }
.head p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; overflow-x: auto; }
    .brand small, .side .who { display: none; }
    .nav { flex-direction: row; }
    .nav a { padding: 8px 10px; white-space: nowrap; }
    .nav a span.t { display: none; }
    .side form { margin: 0 0 0 auto; }
    .side button span { display: none; }
}

/* Panels & cards */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 17px; }
.panel-b { padding: 18px; }
.link { color: var(--green); font-weight: 700; text-decoration: none; font-size: 14px; }
.link:hover { text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.stat .v { font-family: var(--display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .s { font-size: 13px; color: var(--muted); }
.stat.hl { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.stat.hl .k, .stat.hl .s { color: inherit; opacity: .85; }
.stat.warn .v { color: var(--gold); }

.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }

/* Bars chart */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 190px; padding-top: 18px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 46px; background: var(--green); border-radius: 8px 8px 3px 3px; min-height: 3px; position: relative; }
.bar.today i { background: var(--gold); }
.bar small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--tile) 55%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.prod { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--tile); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; color: var(--green); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ico { width: 24px; height: 24px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-pending { background: var(--gold-soft); color: #8A5F00; }
.pill-confirmed { background: var(--blue-soft); color: var(--blue); }
.pill-shipped { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.pill-delivered { background: var(--green); color: var(--green-ink); }
.pill-cancelled { background: var(--red-soft); color: var(--red); }
.pill-off { background: var(--tile); color: var(--muted); }
.pill-sale { background: var(--red-soft); color: var(--red); }
.pill-new { background: var(--gold-soft); color: #8A5F00; }
@media (prefers-color-scheme: dark) { .pill-pending, .pill-new { color: var(--gold); } }
.stock-low { color: var(--red); font-weight: 800; }
.stock-out { color: var(--red); font-weight: 800; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid transparent; border-radius: 10px; padding: 9px 16px; font-weight: 700; text-decoration: none; cursor: pointer; background: var(--green); color: var(--green-ink); white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--green); }
.btn-danger { background: transparent; border-color: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .search { position: relative; flex: 1; min-width: 200px; }
.filters .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; }
.filters .search input { padding-left: 38px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--muted); border: 1px solid var(--line); }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs a span { opacity: .7; margin-left: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
.filters select, .filters input { width: auto; }
textarea { min-height: 110px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .lbl { font-size: 13px; font-weight: 700; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--red); font-weight: 600; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--red); }
.form-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .row2, .row3 { grid-template-columns: 1fr; } }
.affix { position: relative; }
.affix input { padding-right: 62px; }
.affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.check input { accent-color: var(--green); width: 18px; height: 18px; margin-top: 2px; }
.check b { display: block; font-size: 14px; }
.check small { color: var(--muted); }
.preview { aspect-ratio: 1 / 1; max-width: 100%; border-radius: 12px; background: var(--tile); display: grid; place-items: center; overflow: hidden; color: var(--green); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .ico { width: 30%; height: 30%; stroke-width: 1.3; }
.icon-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.icon-pick label { display: grid; place-items: center; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--muted); }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick label:has(input:checked) { border-color: var(--green); color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); }
.icon-pick label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; }

.flash { padding: 12px 16px; border-radius: 12px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.flash-ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.flash-err { background: var(--red-soft); color: var(--red); }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.list { display: flex; flex-direction: column; }
.list-i { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list-i:last-child { border-bottom: 0; }
.list-i .grow { flex: 1; min-width: 0; }
.list-i .grow div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.totals { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .big { font-family: var(--display); font-weight: 800; font-size: 19px; }

.pager { padding: 12px 18px; border-top: 1px solid var(--line); }
.pager nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager svg { width: 18px; height: 18px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 40%),
    radial-gradient(circle at 90% 90%, color-mix(in srgb, var(--green) 20%, transparent), transparent 45%), var(--bg); }
.login-card { width: min(400px, 100%); padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; }
.login-card .brand b { color: var(--ink); font-size: 26px; }
.login-card .brand b span { color: var(--gold); }
.login-card .brand small { color: var(--muted); opacity: 1; }
.login-card h1 { font-size: 22px; }
.login-card .btn { justify-content: center; padding: 12px; }
.flag { display: flex; height: 5px; width: 64px; border-radius: 3px; overflow: hidden; }
.flag span { flex: 1; }

/* Publicités */
.banner-thumb { width: 96px; aspect-ratio: 3 / 1; border-radius: 8px; overflow: hidden; flex-shrink: 0; display: block; }
.banner-thumb img, .banner-thumb video, .banner-preview img, .banner-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-preview { aspect-ratio: 3 / 1; max-width: 100%; border-radius: 12px; overflow: hidden; display: grid; place-items: center; text-align: center; padding: 0; font-size: 13px; }
.banner-preview span { padding: 12px; }
.theme-green { background: #0A5C33; color: #fff; }
.theme-yellow { background: #F2B705; color: #16181A; }
.theme-white { background: #FFFFFF; color: #16181A; border: 1px solid var(--line); }

/* Paramètres */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.settings-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }
.save-bar { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; box-shadow: 0 -6px 20px -12px rgba(0, 0, 0, .25); }
.tabs.panel { padding: 10px 14px; }

/* Galerie produit */
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.g-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.g-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: var(--tile); border: 1px solid var(--line); }
.g-item.g-new img { border: 2px dashed var(--green); }
.g-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.g-opt input { accent-color: var(--green); }
.g-del { color: var(--red); }
.g-del input { accent-color: var(--red); }
.g-item:has(.g-del input:checked) img { opacity: .35; }
