:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1f2430;
    --muted: #6b7280;
    --line: #e4e7ec;
    --brand: #ff6600;
    --brand-dark: #e25100;
    --accent: #2b4162;
    --ok: #137333;
    --warn: #b06000;
    --danger: #c5221f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
    background: var(--accent);
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 58px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow);
}
header.topbar .brand { font-weight: 700; font-size: 1.2em; color: #fff; }
header.topbar .brand span { color: var(--brand); }
header.topbar nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
header.topbar nav a { color: #dbe4f0; font-size: .95em; }
header.topbar nav a:hover { color: #fff; }
header.topbar .session { display: flex; gap: 12px; align-items: center; font-size: .9em; }
header.topbar .session a, header.topbar .session span { color: #dbe4f0; }
header.topbar .badge-admin {
    background: var(--brand); color: #fff; border-radius: 4px;
    padding: 1px 7px; font-size: .78em; font-weight: 600;
}

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

h1 { font-size: 1.6em; margin: 0 0 4px; }
h2 { font-size: 1.2em; margin: 24px 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }

.searchbar { display: flex; gap: 8px; margin: 0 0 24px; }
.searchbar input { flex: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.card .thumb {
    aspect-ratio: 3 / 2; background: #eef1f5; display: flex; align-items: center; justify-content: center;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .body h3 { margin: 0; font-size: 1.02em; }
.card .body h3 a { color: var(--ink); }
.card .price { font-weight: 700; color: var(--accent); font-size: 1.1em; }
.card .meta { color: var(--muted); font-size: .85em; }

.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}

button, .btn {
    background: var(--brand); color: #fff; border: 0; border-radius: 8px;
    padding: 9px 16px; font-size: .95em; font-weight: 600; cursor: pointer;
    display: inline-block;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.ghost:hover { background: #f0f2f5; }
button.danger { background: var(--danger); }
button.small { padding: 5px 10px; font-size: .85em; }

input, textarea, select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
    font-size: .95em; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: .88em; font-weight: 600; margin: 12px 0 4px; }
.field { margin-bottom: 4px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82em; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

.stars { color: var(--brand); letter-spacing: 2px; }
.pill { border-radius: 999px; padding: 2px 10px; font-size: .8em; font-weight: 600; display: inline-block; }
.pill.pending { background: #fef3e2; color: var(--warn); }
.pill.approved { background: #e6f4ea; color: var(--ok); }
.pill.shipped { background: #e8eefb; color: var(--accent); }

.review { border-bottom: 1px solid var(--line); padding: 14px 0; }
.review:last-child { border-bottom: 0; }
.review .who { font-weight: 600; font-size: .92em; }
.review .when { color: var(--muted); font-size: .82em; }
.review .content { margin-top: 6px; }

.toast {
    position: fixed; bottom: 22px; right: 22px; z-index: 50;
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px;
    box-shadow: var(--shadow); opacity: 0; transform: translateY(10px);
    transition: opacity .2s, transform .2s; max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

.notice { padding: 10px 14px; border-radius: 8px; font-size: .9em; margin: 10px 0; }
.notice.info { background: #e8eefb; color: var(--accent); }
.notice.warn { background: #fef3e2; color: var(--warn); }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85em; }
.flex { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.right { text-align: right; }
.mt { margin-top: 16px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* Back-office */
body.admin header.topbar { background: #11161f; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tabs a {
    padding: 8px 14px; border-radius: 8px; color: var(--accent); font-weight: 600; font-size: .9em;
}
.admin-tabs a.active { background: var(--accent); color: #fff; }
.admin-tabs a:hover { text-decoration: none; background: #eef1f5; }
.admin-tabs a.active:hover { background: var(--accent); }

@media (max-width: 620px) {
    header.topbar { flex-wrap: wrap; padding: 8px 14px; }
    .row { flex-direction: column; }
}

/* Table en div (évite le foster-parenting HTML avec les boucles Mustache) */
.dtable { width: 100%; }
.dtable .drow { display: flex; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.dtable .drow:last-child { border-bottom: 0; }
.dtable .drow.head { font-size: .8em; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); }
.dtable .dcell { flex: 1; min-width: 0; }
.dtable .dcell.grow { flex: 2; }
.dtable .dcell.right { text-align: right; }
.dtable .dcell.narrow { flex: 0 0 60px; }
