/* =====================================================================
   Mind26 : feuille de style unique
   1. Thème (variables)    2. Base           3. Structure (shell)
   4. Composants           5. Pages          6. Responsive
   Tout le thème passe par les variables : changer une couleur = changer :root.
   ===================================================================== */

/* ---------- 1. Thème ---------- */
:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f4f5f9;
    --surface-3: #eceef4;
    --border: #e7e9f0;
    --border-strong: #d8dbe5;
    --text: #12142a;
    --text-2: #4b5168;
    --text-3: #8b90a5;
    --accent: #5b5bd6;
    --accent-hover: #4f4fc4;
    --accent-2: #8b5cf6;
    --accent-soft: rgba(91, 91, 214, .10);
    --accent-ring: rgba(91, 91, 214, .28);
    --pos: #109a4d;
    --neg: #e5484d;
    --pos-soft: rgba(16, 154, 77, .10);
    --neg-soft: rgba(229, 72, 77, .10);
    --amber: #d97706;  --amber-soft: rgba(245, 158, 11, .14);
    --blue: #2563eb;   --blue-soft: rgba(37, 99, 235, .11);
    --violet: #7c3aed; --violet-soft: rgba(124, 58, 237, .11);
    --green: #109a4d;  --green-soft: rgba(16, 154, 77, .11);
    --rose: #e11d48;   --rose-soft: rgba(225, 29, 72, .10);
    --indigo: #5b5bd6; --indigo-soft: rgba(91, 91, 214, .11);
    --chart-bar: rgba(91, 91, 214, .22);
    --chart-area: rgba(91, 91, 214, .22);
    --tooltip: #12142a;
    --shadow-sm: 0 1px 2px rgba(18, 20, 42, .05);
    --shadow: 0 1px 2px rgba(18, 20, 42, .04), 0 4px 16px -4px rgba(18, 20, 42, .08);
    --shadow-lg: 0 24px 48px -12px rgba(18, 20, 42, .25);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-w: 252px;
    --topbar-h: 64px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
    color-scheme: light;
}

/* Thème sombre : suit le système, sauf si l'utilisateur a forcé le clair (data-theme). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0c11; --surface: #13151c; --surface-2: #191c25; --surface-3: #222633;
        --border: #242836; --border-strong: #303547;
        --text: #eceef6; --text-2: #a8aec3; --text-3: #6e758e;
        --accent: #8b8cf6; --accent-hover: #9d9ef8; --accent-soft: rgba(139, 140, 246, .14); --accent-ring: rgba(139, 140, 246, .35);
        --pos: #3dd68c; --neg: #ff6b70; --pos-soft: rgba(61, 214, 140, .12); --neg-soft: rgba(255, 107, 112, .12);
        --amber: #fbbf24; --blue: #60a5fa; --violet: #a78bfa; --green: #3dd68c; --rose: #fb7185; --indigo: #8b8cf6;
        --chart-bar: rgba(139, 140, 246, .28); --chart-area: rgba(139, 140, 246, .25); --tooltip: #222633;
        --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02); --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0b0c11; --surface: #13151c; --surface-2: #191c25; --surface-3: #222633;
    --border: #242836; --border-strong: #303547;
    --text: #eceef6; --text-2: #a8aec3; --text-3: #6e758e;
    --accent: #8b8cf6; --accent-hover: #9d9ef8; --accent-soft: rgba(139, 140, 246, .14); --accent-ring: rgba(139, 140, 246, .35);
    --pos: #3dd68c; --neg: #ff6b70; --pos-soft: rgba(61, 214, 140, .12); --neg-soft: rgba(255, 107, 112, .12);
    --amber: #fbbf24; --blue: #60a5fa; --violet: #a78bfa; --green: #3dd68c; --rose: #fb7185; --indigo: #8b8cf6;
    --chart-bar: rgba(139, 140, 246, .28); --chart-area: rgba(139, 140, 246, .25); --tooltip: #222633;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02); --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100dvh;
    font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.icon { flex-shrink: 0; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- 3. Structure ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-logo { width: 84px; height: 84px; filter: drop-shadow(0 16px 32px rgba(124, 58, 237, .45)); animation: breathe 1.6s ease-in-out infinite; }

.shell { display: flex; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column; gap: 8px;
    padding: 18px 14px;
    background: var(--surface); border-right: 1px solid var(--border);
    z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-img { width: 34px; height: 34px; filter: drop-shadow(0 6px 12px rgba(124, 58, 237, .35)); transition: transform .25s; }
.brand:hover .brand-img { transform: rotate(-6deg) scale(1.06); }
.brand-logo {
    width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700;
    box-shadow: 0 6px 16px -6px var(--accent);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 10px;
    color: var(--text-2); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active .icon { stroke-width: 2.3; }
.sidebar-foot { margin-top: auto; padding: 0 6px; }
/* Signature en bas du menu */
.sidebar-sign { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.sidebar-sign img { width: 18px; height: 18px; border-radius: 5px; }

/* Logo dans la barre du haut (mobile, quand le menu est replié) */
.topbar-logo { place-items: center; }
.topbar-logo img { width: 30px; height: 30px; display: block; }

.backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
    padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.view { padding: 28px; width: 100%; max-width: 1440px; outline: none; animation: fade-in .25s ease; }

/* ---------- 4. Composants ---------- */

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 15px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 4px 14px -6px var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-danger { background: var(--neg); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--neg); filter: brightness(1.08); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-ghost.btn-danger { color: var(--neg); background: transparent; }
.btn-ghost.btn-danger:hover { background: var(--neg-soft); filter: none; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.loading::after, .btn-danger.loading::after { border-color: #fff transparent #fff transparent; }
.btn.copied { border-color: var(--pos); }

.icon-btn {
    width: 38px; height: 38px; display: inline-grid; place-items: center; position: relative;
    border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.bell-count {
    position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 9px; border: 2px solid var(--bg);
    background: var(--neg); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
}

/* Menu utilisateur */
.dropdown { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 8px 0 4px; margin-left: 4px;
    border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text);
    font: 600 13.5px var(--font); cursor: pointer;
}
.user-btn:hover { border-color: var(--border-strong); }
.user-btn .icon { color: var(--text-3); transition: transform .2s; }
.dropdown.open .user-btn .icon { transform: rotate(180deg); }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top right;
    transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head small { color: var(--text-3); }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px;
    border: 0; background: none; color: var(--text-2); font: 500 13.5px var(--font); text-align: left; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu [data-logout] { color: var(--neg); }

/* Cartes */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow);
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 32px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.grid { display: grid; gap: 20px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid-detail { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
.grid-prompt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }

/* En-têtes de page & barres d'outils */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { margin: 0 0 2px; color: var(--text-3); font-weight: 500; }
.dash-hello { display: flex; align-items: center; gap: 14px; }
.dash-hello img { width: 52px; height: 52px; filter: drop-shadow(0 10px 20px rgba(124, 58, 237, .35)); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.filters select { width: auto; min-width: 170px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 36px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 500; margin-bottom: 16px; }
.back-link:hover { color: var(--text); }
.toolbar .back-link { margin-bottom: 0; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 11px; }
.segmented a {
    display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px; border-radius: 8px;
    color: var(--text-2); font-weight: 550; font-size: 13px; white-space: nowrap; transition: background .15s, color .15s;
}
.segmented a:hover { color: var(--text); }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field-hint { color: var(--text-3); font-size: 12px; }
.field-error { color: var(--neg); font-size: 12px; font-weight: 500; }
input, select, textarea {
    width: 100%; min-height: 40px; padding: 9px 12px;
    font: 14px var(--font); color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
select {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b90a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.invalid, .invalid:focus { border-color: var(--neg); box-shadow: 0 0 0 4px var(--neg-soft); }
input[type="color"] { width: 64px; padding: 4px; cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.card .form-actions { flex-direction: row; justify-content: flex-end; margin-top: 18px; }
.profile .form-actions { flex-direction: row; justify-content: flex-end; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.inline { display: flex; gap: 8px; }
.help { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 10px; font-size: 12.5px; color: var(--text-2); }
.help p { margin: 6px 0 0; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--text-2); min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; flex-shrink: 0; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-ring); }

/* Badges, tags, avatars */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
    font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new { background: var(--amber-soft); color: var(--amber); }
.badge-ordered { background: var(--blue-soft); color: var(--blue); }
.badge-shipped { background: var(--violet-soft); color: var(--violet); }
.badge-delivered, .badge-p-active { background: var(--green-soft); color: var(--green); }
.badge-cancelled { background: var(--neg-soft); color: var(--neg); }
.badge-p-paused { background: var(--amber-soft); color: var(--amber); }
.badge-p-draft, .badge-p-archived { background: var(--surface-3); color: var(--text-3); }
.tag { display: inline-block; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

.avatar {
    --c: var(--accent);
    display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%;
    background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--c);
    font-weight: 700; letter-spacing: -.02em; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent);
}
.avatar-xs { width: 20px; height: 20px; font-size: 9px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-md { width: 38px; height: 38px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-empty { background: var(--surface-3); color: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--text); font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red, .tone-rose { background: var(--rose-soft); color: var(--rose); }
.tone-indigo { background: var(--indigo-soft); color: var(--indigo); }
.dot.tone-amber { background: var(--amber); } .dot.tone-blue { background: var(--blue); } .dot.tone-violet { background: var(--violet); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
    display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; min-width: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.kpi-label { color: var(--text-2); font-weight: 550; font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { color: var(--text-3); font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-link:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow), 0 8px 24px -12px rgba(18, 20, 42, .2); }
.kpi-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 4px 0 2px; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); }

.chart-box { position: relative; height: 320px; }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 11px 16px; text-align: left; white-space: nowrap;
    font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr[data-href] { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.cell-main a { color: var(--text); }
.cell-main a:hover { color: var(--accent); }
.cell-main small { font-size: 12px; }
.cell-actions { width: 1%; text-align: right; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.pagination .muted { margin-right: auto; }

/* États vides, squelettes, erreurs */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 56px 24px; color: var(--text-2); }
.empty-state p { color: var(--text-3); margin: 0 0 8px; max-width: 360px; }
/* Logo de l'appli + pastille avec l'icône du contexte */
.empty-icon { position: relative; width: 60px; height: 60px; margin-bottom: 10px; }
.empty-icon img { width: 100%; height: 100%; border-radius: 17px; box-shadow: 0 14px 30px -14px rgba(124, 58, 237, .7); }
.empty-icon span {
    position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; background: var(--surface); color: var(--text-2);
    box-shadow: 0 0 0 3px var(--bg), var(--shadow);
}
.boot-error { min-height: 100dvh; display: grid; place-items: center; }
.skeleton-page { display: flex; flex-direction: column; gap: 14px; }
.sk { border-radius: 12px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-title { height: 30px; width: 240px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.sk-card { height: 110px; border-radius: 16px; }
.sk-line { height: 46px; }

/* Toasts */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 11px; max-width: 380px;
    padding: 12px 16px 12px 12px; border-radius: 14px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    font-weight: 500; animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
a.toast:hover { color: var(--text); border-color: var(--accent); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--pos-soft); color: var(--pos); }
.toast-error .toast-icon { background: var(--neg-soft); color: var(--neg); }
.toast-info .toast-icon { background: var(--accent-soft); color: var(--accent); }

/* Modales */
.modal {
    width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 18px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal-sm { width: min(440px, calc(100vw - 32px)); }
.modal-lg { width: min(860px, calc(100vw - 32px)); }
.modal[open] { animation: modal-in .2s ease-out; }
.modal::backdrop { background: rgba(10, 12, 24, .45); backdrop-filter: blur(3px); animation: fade-in .2s; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 12px 20px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--amber-soft); color: var(--text); font-size: 13px; }
.notice .icon { color: var(--amber); margin-top: 1px; }

/* ---------- 5. Pages ---------- */

/* Connexion */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }

/* Panneau décoratif : sobre et immobile. Fond sombre, un seul halo doux, logo au centre. */
.login-art {
    position: relative; overflow: hidden; display: grid; place-items: center;
    background:
        radial-gradient(60% 50% at 50% 45%, rgba(109, 93, 252, .28) 0%, transparent 70%),
        linear-gradient(180deg, #121326 0%, #0b0c16 100%);
    color: rgba(255, 255, 255, .5);
}
.art-center { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.art-logo { width: 112px; height: 112px; filter: drop-shadow(0 24px 40px rgba(124, 58, 237, .45)); }
/* Grand « m » en filigrane, coupé par le bord du panneau */
.art-mark { position: absolute; width: 72%; right: -16%; bottom: 6%; opacity: .09; transform: rotate(-8deg); pointer-events: none; user-select: none; }
.art-center { position: relative; }
.art-name { color: rgba(255, 255, 255, .85); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.art-foot { position: absolute; left: 40px; right: 40px; bottom: 32px; display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; letter-spacing: .02em; }

/* Formulaire */
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 14px; }
.login-logo { width: 60px; height: 60px; margin: 0 0 14px -4px; filter: drop-shadow(0 12px 22px rgba(124, 58, 237, .4)); }
.login-name { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; color: var(--text); }
.login-sub { color: var(--text-3); font-size: 15px; font-weight: 500; }
.login-remember { min-height: 0; margin: -2px 0 4px; font-size: 13.5px; }

/* Profil : appareils connectés */
.devices-card { margin-top: 20px; }
.device-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.device-list li { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.device-list li.current { border-color: var(--accent); background: var(--accent-soft); }
.device-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.device-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.device-main strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Tableau de bord */
.partners { display: flex; flex-direction: column; gap: 4px; }
.partner { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 0 -10px; border-radius: 12px; }
.partner:hover { background: var(--surface-2); }
.partner-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.partner-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.ranking li + li { border-top: 1px dashed var(--border); }
.rank { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--text-2); flex-shrink: 0; }
.ranking li:first-child .rank { background: var(--accent); color: #fff; }
.ranking-title { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.ranking-title small { font-weight: 400; }
.ranking strong { font-variant-numeric: tabular-nums; }

/* Fiche commande */
.hero-card {
    display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
    padding: 22px 24px; margin-bottom: 20px; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero-main { min-width: 0; flex: 1; }
.hero-main h2 { font-size: 22px; font-weight: 700; letter-spacing: -.025em; margin: 10px 0 4px; }
.hero-main p { margin: 0; }
.hero-badges { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-side { display: flex; align-items: center; gap: 14px; }
.assignee { display: flex; flex-direction: column; gap: 4px; }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 12px; font-weight: 550; color: var(--text-3); position: relative; padding-top: 2px; }
.step::before { content: ""; position: absolute; top: 13px; left: 30px; right: 4px; height: 2px; border-radius: 2px; background: var(--border); }
.step:last-child::before { display: none; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 11.5px; font-weight: 700; position: relative; }
.step.done { color: var(--text-2); }
.step.done .step-dot { background: var(--pos); color: #fff; }
.step.done::before { background: var(--pos); }
.step.current { color: var(--accent); }
.step.current .step-dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-ring); }

.ledger { margin: 0 0 14px; display: flex; flex-direction: column; }
.ledger div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.ledger dt { color: var(--text-2); }
.ledger dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 550; }
.ledger-total { border-bottom: 0 !important; padding-top: 12px !important; }
.ledger-total dt { color: var(--text); font-weight: 650; }
.ledger-total dd { font-size: 18px; font-weight: 750; }
.address { margin: 10px 0 0; padding: 14px; border-radius: 12px; background: var(--surface-2); font: 13.5px/1.6 var(--font); white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-transferred::before { background: var(--amber); }
.timeline .tl-status::before { background: var(--accent); }
.timeline .tl-tracking::before { background: var(--violet); }
.timeline .tl-assigned::before, .timeline .tl-created::before { background: var(--pos); }
.timeline .tl-edited::before { background: var(--blue); }
.timeline small { font-size: 12px; }

/* Expéditions */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-width: 0; }
.board-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.board-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.board-head small { font-size: 12px; }
.count { min-width: 26px; height: 22px; padding: 0 8px; display: grid; place-items: center; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 700; }
.board-list { display: flex; flex-direction: column; gap: 10px; }
.ship-card {
    display: flex; flex-direction: column; gap: 10px; padding: 14px; margin: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, border-color .15s;
}
.ship-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ship-card.late { box-shadow: inset 3px 0 0 var(--neg), var(--shadow-sm); }
.ship-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ship-top a { color: var(--text); line-height: 1.35; }
.ship-top a:hover { color: var(--accent); }
.ship-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-3); }
.ship-meta span, .ship-meta a { display: inline-flex; align-items: center; gap: 4px; }
.ship-card input { min-height: 36px; padding: 7px 10px; font-size: 13px; }
.ship-card .btn { align-self: flex-start; }
.tracking { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
/* Expéditions — affichage « Onglets » : une étape à la fois (pratique sur mobile) */
.ship-tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-3); border-radius: 14px; }
.ship-tabs button {
    flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 10px; border: 0; border-radius: 11px; background: none; color: var(--text-2);
    font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .15s, color .15s;
}
.ship-tabs button span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship-tabs button:hover { color: var(--text); }
.ship-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.ship-tabs .count { background: var(--surface-2); }
.ship-tab-hint { margin: 10px 4px 12px; }
.ship-tab-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }

/* Expéditions — affichage « Liste » : lignes compactes regroupées par étape */
.ship-list { display: flex; flex-direction: column; gap: 22px; }
.ship-group .board-head { padding: 0 4px 10px; }
.ship-rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.ship-card.ship-row {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: 16px;
    padding: 12px 16px; border: 0; border-radius: 0; box-shadow: none;
}
.ship-card.ship-row + .ship-row { border-top: 1px solid var(--border); }
.ship-card.ship-row:hover { box-shadow: none; background: var(--surface-2); }
.ship-card.ship-row.late { box-shadow: inset 3px 0 0 var(--neg); }
.ship-row .btn { align-self: center; }
.ship-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.board-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 26px 10px; color: var(--text-3); border: 1.5px dashed var(--border-strong); border-radius: 14px; font-size: 13px; }

/* Produits */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 12px; }

/* Bascule d'affichage (grille / liste / colonnes…) */
.view-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 11px; }
.view-switch button {
    width: 34px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px;
    background: none; color: var(--text-3); cursor: pointer; transition: background .15s, color .15s;
}
.view-switch button:hover { color: var(--text); }
.view-switch button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Produits — affichage « Liste » */
.product-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.product-row {
    display: grid; grid-template-columns: 52px minmax(0, 1fr) 96px 130px 76px 104px 130px; align-items: center; gap: 14px;
    padding: 12px 16px; color: var(--text); transition: background .15s;
}
.product-row + .product-row { border-top: 1px solid var(--border); }
.product-row:hover { color: var(--text); background: var(--surface-2); }
.pr-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.pr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pr-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pr-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); min-width: 0; }
.pr-meta > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-price { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pr-price strong { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-cost, .pr-stock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-cost small, .pr-stock small { font-size: 11.5px; }
.pr-owner { display: flex; justify-content: flex-end; min-width: 0; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.product-card {
    display: flex; flex-direction: column; overflow: hidden; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.product-card:hover { color: var(--text); transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow), 0 14px 30px -16px rgba(18, 20, 42, .3); }
/* Image en tête, badges posés dessus */
.pc-media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.pc-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.product-card:hover .pc-media img { transform: scale(1.03); }
.pc-noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.pc-media:has(.pc-noimg) { aspect-ratio: auto; height: 88px; } /* pas d'image : bandeau réduit */
.pc-status { position: absolute; top: 10px; left: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); background-color: var(--surface); }
.pc-tags { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.pc-tags .tag { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.tag-other { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface); color: var(--text-2); letter-spacing: .03em; }
/* Contenu */
.pc-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 12px; flex: 1; }
.pc-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.pc-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-price { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pc-price > div { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pc-price strong { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-price small { font-size: 11.5px; white-space: nowrap; }
.pc-margin { flex-shrink: 0; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-margin.up { background: var(--pos-soft); color: var(--pos); }
.pc-margin.down { background: var(--neg-soft); color: var(--neg); }
.pc-cost { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
/* Pied */
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pc-foot .chip { font-size: 12.5px; }
.pc-stats { display: flex; gap: 10px; color: var(--text-3); white-space: nowrap; }
.pc-stats span + span::before { content: "·"; margin-right: 10px; color: var(--border-strong); }
.margin-box { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.margin-box small { color: var(--text-3); }
.margin-box strong { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }

/* Prompts */
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.prompt-card {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    transition: transform .15s, border-color .15s;
}
.prompt-card:hover { color: var(--text); transform: translateY(-2px); border-color: var(--accent); }
.prompt-card h3 { font-size: 16px; }
.prompt-card p { font-size: 13px; margin: 0; flex: 1; }
.prompt-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; background: linear-gradient(135deg, var(--accent-soft), var(--violet-soft)); color: var(--accent); }
.prompt-cta { display: inline-flex; align-items: center; gap: 2px; margin-top: 10px; font-weight: 600; font-size: 13px; color: var(--accent); }
.output-card { position: sticky; top: calc(var(--topbar-h) + 20px); }
.prompt-output { margin: 0 0 10px; padding: 16px; min-height: 260px; max-height: 60vh; overflow: auto; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font: 13px/1.7 var(--mono); white-space: pre-wrap; word-break: break-word; }
.var-filled { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 2px; }
.var-empty { color: var(--text-3); background: var(--surface-3); border-radius: 4px; padding: 0 2px; }

/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 6px; }
.notif-list a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: var(--text-2); }
.notif-list a:hover { background: var(--surface-2); color: var(--text); }
.notif-list a.unread { color: var(--text); font-weight: 550; }
.notif-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-3); }
.unread .notif-icon { background: var(--accent-soft); color: var(--accent); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-text small { font-weight: 400; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* Paramètres */
.account-list { display: flex; flex-direction: column; gap: 10px; }
.account { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.account-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: linear-gradient(135deg, #e53238, #0064d2 40%, #f5af02 70%, #86b817); color: #fff; font-weight: 800; font-size: 18px; }
.account-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-main small { font-size: 12px; }
.rotation { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.rotation-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); }
.rotation-item > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rotation-item.next { border-color: var(--accent); background: var(--accent-soft); }

/* CJ Dropshipping */
.tag-cj { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #fff1e6; color: #c2410c; letter-spacing: .03em; }
.tag-review { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); }
.filter-switch { min-height: 40px; font-size: 13.5px; white-space: nowrap; }
.cj-panel { margin-bottom: 20px; }
.cj-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.cj-foot .field-label { font-size: 12px; }
.cj-product { margin-top: 20px; max-width: 760px; }
.review-banner {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 20px;
    border-radius: var(--radius-lg); background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
}
.review-banner > .icon { color: var(--amber); }
.review-banner > div:not(.head-actions) { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.cj-results { margin-top: 16px; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.cj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.cj-item {
    display: flex; flex-direction: column; gap: 6px; padding: 10px; text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font: inherit;
    transition: border-color .15s, transform .15s;
}
.cj-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.cj-item img, .cj-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); }
.cj-name { font-size: 13px; font-weight: 550; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cj-name small { display: block; font-weight: 400; }
.cj-meta { font-size: 12.5px; color: var(--text-3); }
.cj-meta strong { color: var(--text); }
.cj-head { display: flex; align-items: center; gap: 12px; }
.cj-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.cj-variants { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow: auto; }
.cj-variant { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 400; }
.cj-variant:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cj-variant input { width: auto; min-height: 0; }
.cj-variant img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.cj-variant .cj-name { flex: 1; }

/* Boutiques eBay (via CJ), synchronisation, diagnostic */
.tag-ebay { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #e8f0fe; color: #0064d2; letter-spacing: .03em; }
.tag-source { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.shop-block { margin: 8px 0 16px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.shop-list { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 99px; font-weight: 550; }
.shop-pill.off { opacity: .55; }
.shop-pill .account-logo { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
.sync-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 0; text-align: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.sync-summary { margin: 8px 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.diag-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.diag { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.diag.ko { border-color: color-mix(in srgb, var(--neg) 40%, transparent); }
.diag summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; color: var(--text); }
.diag-sample { margin: 6px 0 0; padding: 10px; border-radius: 8px; background: var(--surface-2); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }

.cj-raw summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.cj-raw[open] summary { margin-bottom: 10px; }
.cj-raw .diag-sample { max-height: 320px; margin-bottom: 10px; }

/* Préférences de notifications */
.prefs { margin-top: 16px; }
.prefs-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.prefs-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 4px; border-bottom: 1px solid var(--border); }
.prefs-table th:not(:first-child), .prefs-table td:not(:first-child) { text-align: center; width: 70px; }
.prefs-table td { padding: 6px 4px; border-bottom: 1px dashed var(--border); }
.prefs-table .switch { min-height: 0; justify-content: center; }
.prefs-table input:disabled + span { opacity: .4; }

/* Journal d'audit */
.audit-banner { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; background: linear-gradient(135deg, var(--accent-soft), transparent 55%), var(--surface); }
.audit-banner-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px var(--accent); }
.audit-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.audit-banner .head-actions { flex-shrink: 0; }
.verify { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.verify.ok { background: var(--pos-soft); color: var(--text); }
.verify.ok .icon { color: var(--pos); margin-top: 1px; }
.verify.ko { background: var(--neg-soft); color: var(--text); }
.verify.ko .icon { color: var(--neg); margin-top: 1px; }
.audit-filters input[type="date"] { width: auto; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-item { border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: 0; }
.audit-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.audit-item:hover .audit-row { background: var(--surface-2); }
.audit-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 4px var(--surface-3); }
.dot-green { background: var(--green); } .dot-red { background: var(--neg); } .dot-blue { background: var(--blue); }
.dot-amber { background: var(--amber); } .dot-indigo { background: var(--indigo); } .dot-gray { background: var(--text-3); }
.audit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.audit-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 12.5px; color: var(--text-3); }
.audit-meta span { display: inline-flex; align-items: center; gap: 5px; }
.audit-meta .chip { color: var(--text-2); font-weight: 500; }
.audit-item .icon-btn .icon { transition: transform .2s; }
.audit-item.open .icon-btn .icon { transform: rotate(180deg); }
.audit-details { display: none; padding: 4px 16px 16px 40px; }
.audit-item.open .audit-details { display: block; }
.audit-hash { margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; table-layout: fixed; }
.diff th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.diff td { padding: 7px 10px; border-bottom: 1px dashed var(--border); vertical-align: top; word-break: break-word; white-space: pre-wrap; }
.diff td:first-child { color: var(--text-2); font-weight: 550; width: 22%; }
.diff-old { color: var(--neg); background: var(--neg-soft); }
.diff-new { color: var(--pos); background: var(--pos-soft); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; white-space: pre-wrap; }

/* Profil */
.profile { max-width: 820px; display: flex; flex-direction: column; gap: 20px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-head h2 { font-size: 20px; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes breathe { 50% { transform: scale(.94); opacity: .8; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 6. Responsive ---------- */
.only-mobile { display: none; }

@media (max-width: 1200px) {
    .grid-dash, .grid-detail { grid-template-columns: minmax(0, 1fr); }
    .sticky-side, .output-card { position: static; }
}

/* Tablette & mobile : la barre latérale devient un tiroir avec fond cliquable. */
/* Connexion sur mobile et tablette : pas de panneau décoratif, formulaire seul et centré. */
@media (max-width: 900px) {
    .login { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .login-head { align-items: center; text-align: center; }
}

@media (max-width: 1024px) {
    .only-mobile { display: inline-grid; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: auto;
        transform: translateX(-100%); transition: transform .25s cubic-bezier(.3, .8, .3, 1);
        box-shadow: var(--shadow-lg);
    }
    .drawer-open .sidebar { transform: none; }
    .backdrop {
        display: block; position: fixed; inset: 0; z-index: 35;
        background: rgba(10, 12, 24, .45); backdrop-filter: blur(2px);
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .drawer-open .backdrop { opacity: 1; pointer-events: auto; }
    .drawer-open { overflow: hidden; }
    .topbar { padding: 0 16px 0 10px; }
    .view { padding: 22px 20px; }
    .board { grid-template-columns: repeat(3, minmax(280px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 -20px; padding-inline: 20px; }
    .board-col { scroll-snap-align: start; }
    .form-layout, .grid-prompt, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1400px) {
    .product-row { grid-template-columns: 52px minmax(0, 1fr) 96px 130px 104px; }
    .pr-cost, .pr-owner { display: none; }
}

@media (max-width: 900px) {
    .ship-card.ship-row { grid-template-columns: minmax(0, 1fr) auto; }
    .ship-row .ship-info { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    /* Liste produits : vignette, titre, prix + marge */
    .product-row { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; }
    .pr-thumb { width: 48px; height: 48px; }
    .pr-status, .pr-stock { display: none; }
    .pr-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13.5px; line-height: 1.3; }
    /* Expéditions : onglets collés sous la barre du haut, cartes en une colonne, lignes empilées */
    .ship-tabs { position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 5; box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .25); }
    .ship-tabs button { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 12.5px; }
    .ship-tabs .dot { display: none; }
    .ship-tab-panel { grid-template-columns: minmax(0, 1fr); }
    .ship-card.ship-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px; }
    .ship-row .btn { justify-self: stretch; }
    .toolbar.toolbar-row { flex-direction: row; align-items: center; gap: 8px; }
    .toolbar-row .segmented { flex: 1; width: auto; min-width: 0; }
    .toolbar-row .segmented a { padding-inline: 6px; font-size: 12.5px; }
    .toolbar-row .view-switch button { width: 30px; }
    .pc-title { min-height: 0; } /* une seule colonne : pas besoin d'aligner les hauteurs de titre */
    .audit-banner { flex-direction: column; }
    .audit-banner .head-actions .btn { flex: 1; }
    .audit-title { white-space: normal; }
    .audit-details { padding-left: 16px; }
    .audit-filters input[type="date"] { width: 100%; }
    :root { --topbar-h: 58px; }
    .view { padding: 16px; }
    .board { margin: 0 -16px; padding-inline: 16px; grid-template-columns: repeat(3, 86%); }
    .user-name { display: none; }
    .user-btn { padding: 0 6px 0 3px; }
    .page-title { font-size: 22px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; }
    .kpi-value { font-size: 20px; }
    .kpi-icon { width: 28px; height: 28px; }
    .kpi-icon .icon { width: 15px; height: 15px; }
    .card { padding: 16px; border-radius: 14px; }
    .card-flush { padding: 0; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar > .btn, .toolbar > a.btn { width: 100%; }
    .toolbar:has(> .back-link) { flex-direction: row; align-items: center; }
    .toolbar:has(> .back-link) > .btn { width: auto; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters select, .search { width: 100%; max-width: none; min-width: 0; }
    .segmented { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .segmented a { flex: 1 0 auto; justify-content: center; }
    .head-actions { width: 100%; }
    .chart-box { height: 240px; }
    .hero-card { padding: 18px; }
    .hero-main h2 { font-size: 19px; }
    .hero-side { width: 100%; justify-content: space-between; }
    .steps span:not(.step-dot) { display: none; }
    .step { align-items: center; }
    .step::before { left: calc(50% + 17px); right: calc(-50% + 17px); }
    .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
    .toast { max-width: none; }
    .login-panel { align-items: start; padding-top: 12vh; }
    .modal { margin: auto auto 0; width: 100vw; max-width: none; border-radius: 20px 20px 0 0; }
    .modal-sm { width: 100vw; }
    .modal-actions .btn { flex: 1; }

    /* Tableaux → cartes empilées : chaque cellule affiche son libellé (data-label). */
    .table-responsive thead { display: none; }
    .table-responsive, .table-responsive tbody, .table-responsive tr, .table-responsive td { display: block; }
    .table-responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
    .table-responsive tbody tr:last-child { border-bottom: 0; }
    .table-responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
    .table-responsive td.num { text-align: right; }
    .table-responsive td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; font-weight: 500; text-align: left; }
    .table-responsive .cell-main { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0; padding-bottom: 8px; padding-right: 36px; }
    .table-responsive .cell-actions { position: absolute; top: 8px; right: 6px; width: auto; padding: 0; }
}
