/* ==========================================================================
   Logistique JBOOST — Design system
   Style : Data-Dense Dashboard · Accent indigo #5146E0 · Light + Dark
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------- */
:root {
    /* Marque */
    --indigo-50:  #eef0fd;
    --indigo-100: #e0e2fb;
    --indigo-200: #c4c7f6;
    --indigo-500: #5146E0;
    --indigo-600: #4339c4;
    --indigo-700: #372fa6;

    /* Surfaces & texte (light) */
    --bg:          #f4f5fa;
    --surface:     #ffffff;
    --surface-2:   #fafbff;
    --surface-3:   #f3f4fa;
    --text:        #0f172a;
    --muted:       #64748b;
    --faint:       #94a3b8;
    --border:      #e7e9f2;
    --border-soft: #eef0f6;

    /* Sémantique */
    --primary:     var(--indigo-500);
    --primary-ink: #ffffff;
    --success:     #16a34a;
    --warning:     #d97706;
    --danger:      #dc2626;

    /* Élévation */
    --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
    --shadow-sm: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
    --shadow-lg: 0 12px 32px rgba(16,24,40,.12), 0 4px 8px rgba(16,24,40,.06);
    --shadow-indigo: 0 8px 24px rgba(81,70,224,.28);

    /* Rayons */
    --r-xs: 6px;
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 16px;
    --r-xl: 20px;

    /* Rythme */
    --sidebar-w: 248px;
    --topbar-h:  64px;

    /* Transitions */
    --t-fast: 130ms cubic-bezier(.4,0,.2,1);
    --t:      200ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --bg:          #0b0e17;
    --surface:     #141926;
    --surface-2:   #1a2030;
    --surface-3:   #1f2638;
    --text:        #f1f4fb;
    --muted:       #94a3b8;
    --faint:       #64748b;
    --border:      #25304a;
    --border-soft: #1e2638;
    --primary:     #7b72f2;
    --indigo-50:   #1e2438;
    --indigo-100:  #2a3358;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
    --shadow-md: 0 4px 14px rgba(0,0,0,.5);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
    --shadow-indigo: 0 8px 24px rgba(123,114,242,.35);
}

/* ---- Base -------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.num { font-variant-numeric: tabular-nums; }

/* ---- Shell : sidebar + main -------------------------------------------- */
.app { display: flex; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 18px 14px;
    z-index: 40;
}
.brand {
    display: flex; align-items: center; gap: 11px;
    padding: 6px 8px 18px;
}
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
    display: grid; place-items: center; color: #fff; flex: 0 0 auto;
    box-shadow: var(--shadow-indigo);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.brand-sub  { font-size: 11px; color: var(--faint); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-label {
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--faint); padding: 14px 10px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: var(--r-sm);
    color: var(--muted); font-weight: 550; font-size: 13.5px;
    transition: background var(--t-fast), color var(--t-fast);
    position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active {
    background: var(--indigo-50); color: var(--primary);
}
[data-theme="dark"] .nav-item.active { background: rgba(123,114,242,.14); }
.nav-item.active svg { opacity: 1; }
.nav-item .count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: var(--surface-3); color: var(--muted);
    padding: 1px 7px; border-radius: 999px;
}
.nav-item.active .count { background: var(--indigo-100); color: var(--primary); }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---- Topbar ------------------------------------------------------------ */
.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    backdrop-filter: saturate(180%) blur(8px);
    position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { font-size: 12.5px; color: var(--faint); font-weight: 500; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    width: 38px; height: 38px; border-radius: var(--r-sm);
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; color: var(--muted);
    cursor: pointer; transition: all var(--t-fast);
}
.icon-btn:hover { color: var(--primary); border-color: var(--indigo-200); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, var(--danger));
    color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px;
}

.content { padding: 26px 28px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 40px; padding: 0 16px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    transition: all var(--t-fast);
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(.5px) scale(.99); }
.btn-primary {
    background: linear-gradient(180deg, var(--indigo-500), var(--indigo-600));
    color: #fff; box-shadow: var(--shadow-xs);
}
.btn-primary:hover { box-shadow: var(--shadow-indigo); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--indigo-200); color: var(--primary); background: var(--surface-2); }
.btn-subtle { background: var(--surface-3); color: var(--muted); }
.btn-subtle:hover { color: var(--text); }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: var(--border); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---- Cards ------------------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); box-shadow: var(--shadow-sm);
    overflow: hidden;   /* le contenu (tableau) épouse les coins arrondis */
}
.card-pad { padding: 18px 20px; }
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12.5px; color: var(--faint); }

/* ---- KPI cards --------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 18px; position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm); transition: transform var(--t), box-shadow var(--t);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
}
.kpi-ico svg { width: 20px; height: 20px; }
.kpi-ico.i-indigo { background: var(--indigo-50); color: var(--primary); }
.kpi-ico.i-green  { background: #e8f7ee; color: var(--success); }
.kpi-ico.i-amber  { background: #fdf3e3; color: var(--warning); }
.kpi-ico.i-blue   { background: #e6f0fe; color: #2563eb; }
[data-theme="dark"] .kpi-ico.i-indigo { background: rgba(123,114,242,.16); }
[data-theme="dark"] .kpi-ico.i-green  { background: rgba(22,163,74,.16); }
[data-theme="dark"] .kpi-ico.i-amber  { background: rgba(217,119,6,.16); }
[data-theme="dark"] .kpi-ico.i-blue   { background: rgba(37,99,235,.16); }
.kpi-trend { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; }
.kpi-trend.up   { color: var(--success); background: #e8f7ee; }
.kpi-trend.flat { color: var(--muted);   background: var(--surface-3); }
.kpi-value { font-size: 28px; font-weight: 720; letter-spacing: -.02em; margin-top: 14px; }
.kpi-label { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- Badges (statut) --------------------------------------------------- */
.badge {
    --c: var(--muted);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px 3px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* Badge-sélecteur de statut (modifiable directement dans le tableau) */
.statut-pill { --c: var(--muted); position: relative; display: inline-flex; }
.statut-pill select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    font: inherit; font-size: 12px; font-weight: 600; line-height: 1;
    color: var(--c); cursor: pointer;
    padding: 5px 26px 5px 11px; border-radius: 999px;
    background: color-mix(in srgb, var(--c) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 24%, transparent);
    transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.statut-pill select:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.statut-pill select:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.statut-pill::after {
    content: ''; position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
    width: 0; height: 0; pointer-events: none;
    border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
    border-top: 4.5px solid var(--c);
}
.statut-pill select option { color: var(--text); background: var(--surface); font-weight: 500; }
.statut-pill.saving { opacity: .6; }

/* ---- Table ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
    text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; color: var(--faint);
    padding: 12px 16px; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data thead th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
table.data thead th a:hover { color: var(--primary); }
table.data thead th.sorted { color: var(--primary); }
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr { transition: background var(--t-fast); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
.cell-name { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.cell-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }

/* ---- Filter bar -------------------------------------------------------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px;
}
.search {
    position: relative; flex: 1 1 280px; max-width: 380px;
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); }
.input, .select {
    height: 40px; border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--r-sm); color: var(--text); font-size: 13.5px; font-family: inherit;
    padding: 0 12px; transition: border var(--t-fast), box-shadow var(--t-fast);
}
.search .input { width: 100%; padding-left: 36px; }
.input:focus, .select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.select { cursor: pointer; padding-right: 30px; }
.spacer { margin-left: auto; }

/* ---- Forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.field .input, .field .select, .field textarea {
    width: 100%; height: 42px;
}
.field textarea {
    height: auto; min-height: 72px; padding: 10px 12px; resize: vertical;
    border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm);
    color: var(--text); font-size: 13.5px; font-family: inherit;
}
.field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.req { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-grid .col-span { grid-column: 1 / -1; }

/* ---- Collapsible add panel -------------------------------------------- */
details.adder { margin-bottom: 18px; }
details.adder > summary {
    list-style: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px;
}
details.adder > summary::-webkit-details-marker { display: none; }
details.adder[open] > summary .chev { transform: rotate(45deg); }

/* ---- Flash / toast ----------------------------------------------------- */
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 18px;
    font-size: 13.5px; font-weight: 550;
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--success);
    animation: slidein var(--t) ease-out;
}
.flash svg { width: 18px; height: 18px; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Empty state ------------------------------------------------------- */
.empty { text-align: center; padding: 56px 20px; color: var(--faint); }
.empty svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: .6; }
.empty h3 { color: var(--muted); font-size: 15px; margin-bottom: 4px; }

/* ---- Dialog ------------------------------------------------------------ */
dialog {
    border: none; padding: 0; border-radius: var(--r-lg); width: 92%; max-width: 620px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(8,12,24,.5); backdrop-filter: blur(2px); }
dialog[open] { animation: pop var(--t) cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.dlg-head h3 { font-size: 16px; }
.dlg-body { padding: 22px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---- Pipeline (dashboard) ---------------------------------------------- */
.pipe-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.pipe-name { width: 170px; flex: 0 0 170px; font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.pipe-name .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.pipe-track { flex: 1 1 auto; height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.pipe-fill { height: 100%; border-radius: 999px; transition: width var(--t); animation: grow .6s cubic-bezier(.2,.8,.2,1); }
@keyframes grow { from { width: 0 !important; } }
.pipe-count { width: 40px; flex: 0 0 40px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---- Kanban ------------------------------------------------------------ */
.kanban-scroll { overflow-x: auto; padding-bottom: 14px; }
.kanban { display: flex; gap: 14px; min-width: min-content; }
.kcol {
    width: 280px; flex: 0 0 280px;
    background: var(--surface-3); border: 1px solid var(--border-soft);
    border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100dvh - 200px);
}
.kcol-head {
    display: flex; align-items: center; gap: 8px; padding: 12px 14px;
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
    background: var(--surface-3); border-radius: var(--r) var(--r) 0 0; z-index: 2;
}
.kcol-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.kcol-head .title { font-size: 12.5px; font-weight: 650; }
.kcol-head .n { margin-left: auto; font-size: 11.5px; font-weight: 650; color: var(--muted); background: var(--surface); padding: 1px 8px; border-radius: 999px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1 1 auto; min-height: 60px; }
.kcol-body.drag-over { background: color-mix(in srgb, var(--primary) 8%, transparent); outline: 2px dashed color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: -4px; border-radius: var(--r-sm); }
.kcard {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 12px; box-shadow: var(--shadow-xs); cursor: grab;
    transition: box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.kcard:hover { box-shadow: var(--shadow-md); border-color: var(--indigo-200); transform: translateY(-1px); }
.kcard.dragging { opacity: .5; cursor: grabbing; }
.kcard-name { font-weight: 650; font-size: 13.5px; }
.kcard-prod { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kcard-amount { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kcard-resp { font-size: 11px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.kcard-resp .pip { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 700; background: var(--indigo-500); }

/* ---- Suivi des commandes : disposition verticale (lanes) --------------- */
.klanes { display: flex; flex-direction: column; gap: 14px; }
.klane {
    background: var(--surface-3); border: 1px solid var(--border-soft);
    border-radius: var(--r); overflow: hidden; transition: border-color var(--t-fast);
}
.klane-head {
    display: flex; align-items: center; gap: 9px; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.klane-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.klane-head .title { font-weight: 650; font-size: 14px; }
.klane-head .n {
    margin-left: auto; font-size: 11.5px; font-weight: 650; color: var(--muted);
    background: var(--surface-3); padding: 2px 9px; border-radius: 999px;
}
.klane-body {
    padding: 14px; display: flex; flex-wrap: wrap; gap: 10px; min-height: 70px;
    align-content: flex-start; transition: background var(--t-fast);
}
.klane-body.drag-over {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    outline: 2px dashed color-mix(in srgb, var(--primary) 40%, transparent);
    outline-offset: -6px;
}
.klane .kcard { width: 264px; flex: 0 0 264px; }
.lane-empty {
    color: var(--faint); font-size: 13px; font-style: italic;
    padding: 6px 4px; pointer-events: none;
}
@media (max-width: 600px) {
    .klane .kcard { width: 100%; flex: 1 1 100%; }
}

/* ---- Logo cliquable ---------------------------------------------------- */
.brand { text-decoration: none; border-radius: var(--r-sm); transition: opacity var(--t-fast); }
.brand:hover { opacity: .85; }

/* ---- Fiches détail (client / brand) ------------------------------------ */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 14px; }
.back-link:hover { color: var(--primary); }
.detail-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px; }
.detail-avatar { width: 56px; height: 56px; border-radius: 14px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700)); }
.detail-title { font-size: 21px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.detail-meta span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.detail-meta span svg { width: 15px; height: 15px; color: var(--faint); }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.stat-mini { flex: 1 1 150px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 14px 16px; }
.stat-mini .v { font-size: 24px; font-weight: 720; letter-spacing: -.02em; }
.stat-mini .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---- Section spacing --------------------------------------------------- */
.stack-lg > * + * { margin-top: 22px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1080px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .sidebar {
        position: fixed; left: 0; top: 0; transform: translateX(-100%);
        transition: transform var(--t); box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: grid !important; }
    .content { padding: 18px 16px 40px; }
    .topbar { padding: 0 16px; }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(8,12,24,.5); z-index: 35; }
    .scrim.show { display: block; }
}
@media (max-width: 560px) {
    .kpis { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; }

/* ==========================================================================
   Programme de diffusion — composants spécifiques
   ========================================================================== */

/* ---- Étiquette de date (toolbar) --------------------------------------- */
.daytag {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 600; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
    padding: 7px 13px; border-radius: 999px;
}
.daytag svg { color: var(--primary); }

/* ---- Liste des pubs du jour -------------------------------------------- */
.task-list { display: flex; flex-direction: column; }
.task {
    display: flex; flex-direction: column; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
    transition: background var(--t-fast);
}
.task-top { display: flex; align-items: center; gap: 14px; }
.task:last-child { border-bottom: none; }
.task:hover { background: var(--surface-2); }

/* Prix sous la pub */
.task-prices { display: flex; flex-wrap: wrap; gap: 8px; }
.price-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px; border-radius: var(--r-sm);
    background: var(--surface-3); border: 1px solid var(--border-soft);
    font-size: 12px; font-variant-numeric: tabular-nums;
}
.price-chip .pl { color: var(--muted); font-weight: 550; }
.price-chip b { color: var(--text); font-weight: 700; }
.price-chip.comm { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 24%, transparent); }
.price-chip.comm b { color: var(--success); }

/* Boutons d'action (copier) sous la pub */
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Champ prix avec € */
.input-euro { position: relative; }
.input-euro::after { content: '€'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; pointer-events: none; }
.input-euro .input { width: 100%; padding-right: 26px; }

.task-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.task-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; color: var(--muted);
}
.task-status svg { width: 14px; height: 14px; color: var(--success); }
.task-status b { color: var(--text); font-weight: 600; }
.task.done .task-status { color: var(--success); }

/* Bouton publier (toggle) */
.pub-btn {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 14px; border-radius: var(--r-sm);
    font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    transition: all var(--t-fast);
}
.pub-btn:hover { border-color: var(--indigo-200); color: var(--primary); background: var(--surface-2); }
.pub-btn .ico-check { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--faint); transition: all var(--t-fast); }
.pub-btn .ico-check svg { width: 13px; height: 13px; opacity: 0; transition: opacity var(--t-fast); color: #fff; }
.pub-btn:disabled { opacity: .55; cursor: progress; }
.task.done .pub-btn {
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--success);
}
.task.done .pub-btn .ico-check { background: var(--success); border-color: var(--success); }
.task.done .pub-btn .ico-check svg { opacity: 1; }

/* ---- Aperçu de la semaine ---------------------------------------------- */
.week-row {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 8px; border-radius: var(--r-sm);
    transition: background var(--t-fast);
}
.week-row:hover { background: var(--surface-2); }
.week-row.cur { background: var(--indigo-50); }
[data-theme="dark"] .week-row.cur { background: rgba(123,114,242,.12); }
.week-day { flex: 0 0 86px; font-size: 13px; font-weight: 600; }
.week-row.cur .week-day { color: var(--primary); }
.week-track { flex: 1 1 auto; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.week-fill { display: block; height: 100%; border-radius: 999px; transition: width var(--t); }
.week-count { flex: 0 0 44px; text-align: right; font-size: 12.5px; font-weight: 650; color: var(--muted); }

/* ---- Réglages : produit + couleur -------------------------------------- */
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); flex: 0 0 auto; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.plan-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.plan-day-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); font-weight: 650; font-size: 13.5px; }
.plan-day-head .n { margin-left: auto; font-size: 11.5px; font-weight: 650; color: var(--muted); background: var(--surface-3); padding: 1px 8px; border-radius: 999px; }
.plan-chips { padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; align-content: flex-start; }
.chip-rm { display: inline-flex; align-items: center; gap: 6px; }
.chip-rm button { border: none; background: transparent; color: inherit; cursor: pointer; opacity: .6; padding: 0; display: grid; place-items: center; }
.chip-rm button:hover { opacity: 1; }
.chip-rm button svg { width: 13px; height: 13px; }
.plan-add { padding: 10px 14px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; }
.plan-add .select { flex: 1 1 auto; height: 36px; }

/* ==========================================================================
   Contenu des publicités (texte + photos)
   ========================================================================== */

/* La pub du dashboard devient un lien vers son contenu */
a.task-main { text-decoration: none; color: inherit; cursor: pointer; }
.task-go { margin-left: auto; color: var(--faint); display: grid; place-items: center; transition: transform var(--t-fast), color var(--t-fast); }
a.task-main:hover .task-go { color: var(--primary); transform: translateX(2px); }

/* ---- Zone de dépôt des photos ------------------------------------------ */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 26px 16px; text-align: center; cursor: pointer;
    border: 2px dashed var(--border); border-radius: var(--r);
    background: var(--surface-2); color: var(--muted);
    transition: all var(--t-fast);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); color: var(--primary); }
.dropzone svg { color: var(--primary); }
.dropzone span { font-size: 13.5px; }
.dropzone small { font-size: 11.5px; color: var(--faint); }

/* ---- Galerie de photos ------------------------------------------------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 340px)); gap: 16px; justify-content: start; }
.photo { margin: 0; position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-bar {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; gap: 6px; justify-content: center; padding: 8px;
    background: linear-gradient(to top, rgba(8,12,24,.75), transparent);
    opacity: 0; transition: opacity var(--t-fast);
}
.photo:hover .photo-bar { opacity: 1; }
.photo-bar .icon-btn { width: 32px; height: 32px; background: rgba(255,255,255,.92); border: none; color: #0f172a; }
.photo-bar .icon-btn:hover { background: #fff; color: var(--primary); }
.photo-bar form { margin: 0; display: inline; }

/* ---- Cartes de la bibliothèque de contenus ----------------------------- */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.content-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.content-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--indigo-200); }
.content-thumb { height: 150px; flex: 0 0 150px; display: grid; place-items: center; overflow: hidden; background: color-mix(in srgb, var(--c) 12%, var(--surface-3)); color: var(--c); }
.content-thumb img { width: 100%; height: 150px; object-fit: cover; }
.content-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.content-snippet { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; min-height: 38px; }
.content-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--faint); font-weight: 600; margin-top: 2px; }
.content-meta svg { vertical-align: -2px; }
.content-open { color: var(--primary); display: inline-flex; align-items: center; gap: 2px; }

/* ---- Toast (presse-papier) --------------------------------------------- */
.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
    background: #0f172a; color: #fff; padding: 11px 20px; border-radius: 999px;
    font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
    opacity: 0; pointer-events: none; transition: all var(--t); z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Multi-photos, copie par vignette, auto-save
   ========================================================================== */

/* Indicateur d'enregistrement automatique du texte */
.save-state { font-size: 12px; font-weight: 600; color: var(--faint); transition: color var(--t-fast); min-width: 90px; text-align: right; }
.save-state.saving { color: var(--warning); }
.save-state.saved  { color: var(--success); }
.save-state.err    { color: var(--danger); }

/* Indice "Copier une photo :" dans la barre d'actions */
.copy-hint { font-size: 12px; font-weight: 600; color: var(--muted); align-self: center; }
.copy-hint.muted { color: var(--faint); font-weight: 500; }
.copy-hint a { color: var(--primary); }

/* Vignettes-photo cliquables (dashboard) */
.task-photos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-copy {
    position: relative; width: 72px; height: 72px; padding: 0; flex: 0 0 auto;
    border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden;
    background: var(--surface-3); cursor: pointer; transition: all var(--t-fast);
}
.photo-copy img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-copy:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.photo-copy .pc-badge {
    position: absolute; right: 2px; bottom: 2px;
    width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center;
    background: rgba(8,12,24,.65); color: #fff;
}
.photo-copy .pc-badge svg { width: 11px; height: 11px; }
.photo-copy.copying { opacity: .6; cursor: progress; }
.photo-copy.ok { border-color: var(--success); box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 35%, transparent); }
.photo-copy.ok .pc-badge { background: var(--success); }

/* Lightbox (agrandir une photo dans la pub) */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; padding: 30px; background: rgba(8,12,24,.86); backdrop-filter: blur(3px); }
.lightbox.show { display: grid; }
.lightbox img { max-width: 95vw; max-height: 92vh; border-radius: var(--r); box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox-close:hover { background: rgba(255,255,255,.28); }
