/* ============================================================
   Console Anoukis — Feuille de styles principale
   Design system : Hanken Grotesk + IBM Plex Mono
   ============================================================ */

/* --- Variables --- */
:root {
    --accent: #3b9cb0;
    --accent-bg: color-mix(in srgb, var(--accent) 11%, #fff);
    --accent-bg2: color-mix(in srgb, var(--accent) 13%, #fff);
    --bg: #f1efe8;
    --surface: #ffffff;
    --surface2: #faf9f5;
    --surface3: #f0ede5;
    --border: #e7e3d9;
    --border-light: #f0ede5;
    --border-alt: #efece4;
    --border-field: #e0dcd2;
    --text: #2b2b28;
    --text2: #6b675e;
    --text3: #9a948a;
    --text4: #b3ada1;
    --neg: #b06a4f;
    --neg-bg: #fdf7f4;
    --neg-border: #d8b7ab;
    --warn-fg: #b08a3e;
    --warn-bg: #f7f1e3;
    --info-fg: #5e7891;
    --info-bg: #eef2f5;
    --neutral-fg: #8a857c;
    --neutral-bg: #f1efe9;
    --shadow-card: 0 1px 2px rgba(43,43,40,.03);
    --shadow-drop: 0 16px 40px -12px rgba(43,43,40,.22);
    --r-card: 12px;
    --r-btn: 9px;
    --r-sm: 6px;
    --h-header: 58px;
    --w-rail: 250px;
    --font-mono: 'IBM Plex Mono', monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 13px;
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8d4ca; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --- Animations --- */
@keyframes acFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.app-header {
    height: var(--h-header);
    flex: none;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 60;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: none;
}
.logo-square {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.02em;
    flex: none;
}
.logo-square-sm {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 10px;
    flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--text4); }

.header-sep { width: 1px; height: 26px; background: var(--border); flex: none; }
.header-spacer { flex: 1; }

/* --- Site Switcher --- */
.site-switcher {
    position: relative;
}
.site-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 11px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    cursor: pointer;
    min-width: 228px;
    text-align: left;
}
.site-btn:hover { background: var(--surface3); }
.site-btn-info { flex: 1; display: flex; flex-direction: column; line-height: 1.1; overflow: hidden; }
.site-btn-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-btn-domain { font-size: 10.5px; color: var(--text3); white-space: nowrap; }

.site-menu {
    position: absolute;
    top: 46px;
    left: 0;
    width: 330px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-drop);
    padding: 8px;
    z-index: 80;
    animation: acFade .14s ease;
}
.site-menu-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text4);
    padding: 6px 9px 4px;
}
.site-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 9px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background .1s;
}
.site-menu-item:hover { background: var(--surface2); }
.site-menu-item.active { background: var(--accent-bg); }
.site-menu-item-info { flex: 1; line-height: 1.15; overflow: hidden; }
.site-menu-item-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-menu-item-domain { font-size: 10px; color: var(--text3); white-space: nowrap; }
.type-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 5px;
    white-space: nowrap;
}

/* --- Nav Tabs --- */
.nav-tabs { display: flex; align-items: center; gap: 3px; margin-left: 6px; }
.nav-tab {
    height: 38px;
    padding: 0 14px;
    border: none;
    border-radius: var(--r-btn);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text2);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background .1s, color .1s;
}
.nav-tab:hover { background: var(--surface2); }
.nav-tab.active {
    background: var(--accent-bg);
    color: var(--accent);
}

/* --- Header right controls --- */
.header-search {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 0 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    min-width: 190px;
    color: var(--text3);
    cursor: text;
}
.header-search span { font-size: 12.5px; }
.header-search .kbd {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    border: 1px solid var(--border-field);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text4);
}
.header-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    cursor: pointer;
    color: var(--text2);
    position: relative;
}
.header-icon-btn:hover { background: var(--surface3); }
.notif-dot {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neg);
    border: 1.5px solid var(--surface2);
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3a4233, #6b7558);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    flex: none;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
}
.card-body { padding: 16px 18px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}
.card-title { font-weight: 600; font-size: 14px; }
.card-subtitle { font-size: 11.5px; color: var(--text3); margin-top: 1px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--r-btn);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .1s, color .1s, border-color .1s;
}
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-outline { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-outline:hover { background: var(--surface2); }
.btn-danger { background: transparent; color: var(--neg); border-color: var(--neg-border); }
.btn-danger:hover { background: var(--neg-bg); }
.btn-link { background: transparent; color: var(--accent); border-color: transparent; padding: 0; height: auto; font-size: 12.5px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-control {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    background: var(--surface2);
    border: 1px solid var(--border-field);
    border-radius: var(--r-btn);
    font-size: 13px;
    color: var(--text);
    transition: border-color .15s, background .15s;
    outline: none;
}
.form-control:focus { background: var(--surface); border-color: var(--accent); }
.form-control.mono { font-family: var(--font-mono); font-size: 12.5px; }
.form-control.error { border-color: var(--neg-border); background: var(--neg-bg); }
textarea.form-control { height: auto; padding: 9px 11px; resize: vertical; }
select.form-control { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%239a948a' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.form-row { display: grid; grid-template-columns: 104px 1fr; align-items: start; gap: 10px; margin-bottom: 10px; }
.form-row-inline { display: flex; align-items: center; gap: 10px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); padding-top: 10px; line-height: 1.3; }
.form-label.required { color: var(--neg); }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }
.form-hint a { color: #3f7ca8; }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge-success { color: var(--accent); background: var(--accent-bg); }
.badge-warning { color: var(--warn-fg); background: var(--warn-bg); }
.badge-error { color: var(--neg); background: var(--neg-bg); }
.badge-info { color: var(--info-fg); background: var(--info-bg); }
.badge-neutral { color: var(--neutral-fg); background: var(--neutral-bg); }
.badge-count {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--neg);
    border-radius: 20px;
    padding: 2px 8px;
}

/* ============================================================
   MONO LABEL (section headers)
   ============================================================ */
.mono-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text4);
}
.mono-label-sm {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text4);
}

/* ============================================================
   SEGMENTED CONTROL
   ============================================================ */
.seg-group {
    display: flex;
    gap: 3px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    flex: none;
}
.seg-btn {
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text2);
    transition: background .1s, color .1s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.seg-btn:hover { background: var(--surface3); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(43,43,40,.06); }

/* ============================================================
   TABLES
   ============================================================ */
.table-header {
    display: grid;
    gap: 0;
    padding: 9px 16px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text4);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
}
.table-row {
    display: grid;
    align-items: center;
    gap: 0;
    padding: 10px 16px;
    border-bottom: 1px solid #f6f3ec;
    transition: background .1s;
}
.table-row:hover { background: var(--surface2); }
.table-row:last-child { border-bottom: none; }
.col-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text2); }
.col-right { text-align: right; }
.col-name { font-weight: 600; font-size: 12.5px; }
.col-meta { font-size: 10.5px; color: var(--text3); }
.thumb-placeholder {
    width: 34px;
    height: 46px;
    border-radius: 5px;
    background: repeating-linear-gradient(135deg, #f3f0e9, #f3f0e9 5px, #ece8df 5px, #ece8df 10px);
    flex: none;
}
.thumb-sq {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: repeating-linear-gradient(135deg, #f3f0e9, #f3f0e9 5px, #ece8df 5px, #ece8df 10px);
    flex: none;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-track {
    height: 9px;
    background: var(--surface3);
    border-radius: 20px;
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 20px;
    transition: width .3s;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.switch-wrap { display: flex; align-items: center; gap: 10px; }
.switch-label { font-size: 12.5px; font-weight: 500; color: var(--text2); }
.switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex: none;
    cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 20px;
    transition: background .2s;
}
.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked ~ .switch-thumb { transform: translateX(16px); }

/* ============================================================
   CUSTOM CHECKBOX
   ============================================================ */
.checkbox-custom {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid #cfc9bd;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
    transition: background .1s, border-color .1s;
}
.checkbox-custom.checked {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox-custom.checked::after {
    content: '';
    width: 9px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(0px, -1px);
    display: block;
}
.lang-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
    font-size: 12.5px;
}
.lang-item:hover { background: var(--surface2); }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}
.admin-rail {
    width: var(--w-rail);
    flex: none;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    height: calc(100vh - var(--h-header));
    position: sticky;
    top: var(--h-header);
    overflow-y: auto;
    padding-bottom: 16px;
}
.rail-header {
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}
.rail-site-name { font-size: 13px; font-weight: 600; }
.rail-site-type { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--text4); margin-top: 1px; }
.module-group { padding: 12px 10px 4px; }
.module-group-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text4);
    padding: 0 6px;
    margin-bottom: 4px;
}
.module-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--text2);
    font-size: 12.5px;
    transition: background .1s, color .1s;
}
.module-item:hover { background: #f0ece2; }
.module-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.module-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
    opacity: .4;
}
.module-item.active .module-dot { opacity: 1; }
.module-dot.alert { background: #df252d !important; opacity: 1 !important; }
.module-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text3);
}
.module-count.error { color: var(--neg); font-weight: 600; }
.rail-footer { padding: 16px 10px 8px; border-top: 1px solid var(--border-light); margin-top: 8px; }

.admin-panel {
    flex: 1;
    overflow: auto;
    padding: 18px 22px 40px;
}

/* ============================================================
   VIEW HEADERS
   ============================================================ */
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.view-supertitle { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--text4); margin-bottom: 5px; }
.view-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.view-title-sm { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.live-indicator { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); flex: none; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-card { padding: 15px 16px; }
.kpi-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 9px; }
.kpi-value { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.kpi-delta { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12px; }
.kpi-delta-val { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kpi-sub { color: var(--text4); }

/* ============================================================
   HOME VIEW
   ============================================================ */
.home-main { flex: 1; padding: 18px 20px 36px; display: flex; flex-direction: column; gap: 16px; }
.ca-grid { display: grid; grid-template-columns: 1fr 312px; gap: 14px; }
.orders-map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.ca-amount { font-size: 31px; font-weight: 600; letter-spacing: -.025em; }
.ca-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; color: var(--accent); }
.ca-period { font-size: 12px; color: var(--text4); }

.donut-wrap { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; margin: 6px 0; }
.donut-center { position: absolute; text-align: center; }
.donut-pct { font-size: 30px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.donut-sub { font-size: 11px; color: var(--text3); }
.donut-footer { display: flex; justify-content: space-between; font-size: 12px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.donut-footer-label { color: var(--text3); font-size: 11px; }
.donut-footer-val { font-weight: 600; }

.orders-table-grid { grid-template-columns: 64px 1fr 96px 120px; }
.map-placeholder { flex: 1; min-height: 330px; position: relative; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; color: #c4beb2; }

.perf-row { display: grid; grid-template-columns: 180px 1fr 92px 70px; align-items: center; gap: 14px; }
.perf-delta-pos { color: var(--accent); font-weight: 600; }
.perf-delta-neg { color: var(--neg); font-weight: 600; }

/* ============================================================
   STATS VIEW
   ============================================================ */
.stats-main { flex: 1; padding: 18px 20px 36px; display: flex; flex-direction: column; gap: 16px; }
.stats-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 14px; }
.stats-grid-ecom { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 14px; }

/* ============================================================
   MODULE: FICHE
   ============================================================ */
.fiche-sel-grid { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fiche-main-grid { display: grid; grid-template-columns: minmax(0,1.55fr) 1fr 1fr; gap: 14px; align-items: start; }
.cover-preview { width: 90px; height: 122px; border-radius: 6px; background: repeating-linear-gradient(135deg, #f3f0e9, #f3f0e9 5px, #ece8df 5px, #ece8df 10px); flex: none; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
.cover-preview-label { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--text4); }
.cover-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text2); }
.cover-meta a { color: var(--accent); font-weight: 500; }
.card-footer-actions { padding: 12px 16px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lang-list { max-height: 560px; overflow-y: auto; }

/* ============================================================
   MODULE: IMPORT
   ============================================================ */
.import-grid { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.import-meta-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 12.5px; }
.import-meta-row:last-child { border-bottom: none; }
.import-meta-label { color: var(--text3); }
.import-table-grid { grid-template-columns: 140px 1fr 120px 110px; }

/* ============================================================
   MODULE: PRODUITS
   ============================================================ */
.produits-table-grid { grid-template-columns: 1fr 116px 96px 96px 92px 110px; }
.stock-low { color: var(--neg); }

/* ============================================================
   MODULE: COMMANDES
   ============================================================ */
.commandes-table-grid { grid-template-columns: 96px 1fr 116px 96px 120px 130px; }
.order-seg-tabs { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r-btn); overflow: hidden; }
.order-tab { height: 34px; padding: 0 14px; border: none; background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text2); border-right: 1px solid var(--border); transition: background .1s; }
.order-tab:last-child { border-right: none; }
.order-tab:hover { background: var(--surface2); }
.order-tab.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* ============================================================
   MODULE: SOON
   ============================================================ */
.soon-wrap { display: flex; align-items: center; justify-content: center; min-height: 400px; }
.soon-card { max-width: 460px; width: 100%; padding: 36px; text-align: center; }
.soon-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: var(--text3); }
.soon-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.soon-text { font-size: 13px; color: var(--text3); line-height: 1.6; margin-bottom: 22px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    padding: 8vh 20px 20px;
    gap: 20px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(43,43,40,.07);
    padding: 36px 36px 32px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .logo-square { width: 36px; height: 36px; border-radius: 9px; font-size: 18px; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.login-brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.login-brand-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text4); margin-top: 2px; }
.login-heading { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 5px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 26px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.login-field .form-control { width: 100%; }
.login-submit { margin-top: 20px; }
.login-error {
    background: var(--neg-bg);
    border: 1px solid var(--neg-border);
    border-radius: var(--r-btn);
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--neg);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-footer { font-family: var(--font-mono); font-size: 10px; color: var(--text4); text-align: center; }

/* ============================================================
   MODULE: GESTION DES MODULES (explorateur)
   ============================================================ */
.gm-box { margin-bottom: 18px; overflow: hidden; }
.gm-box-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface2);
}
.gm-box-title { font-weight: 600; font-size: 14px; flex: 1; }
.gm-box-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--text4); margin-top: 1px; }
.gm-box-actions { display: flex; gap: 7px; }

.gm-tree { padding: 8px 10px 12px; }
.gm-empty { padding: 22px 14px; text-align: center; font-size: 12.5px; color: var(--text3); }

.gm-cat { border-radius: var(--r-sm); margin-bottom: 2px; }
.gm-cat.drag-over-cat > .gm-cat-head { box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: var(--r-sm); }
.gm-cat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .1s;
}
.gm-cat-head:hover { background: #f0ece2; }
.gm-chevron { color: var(--text3); transition: transform .15s; flex: none; display: flex; }
.gm-cat.collapsed .gm-chevron { transform: rotate(-90deg); }
.gm-cat.collapsed .gm-children { display: none; }
.gm-folder-ic { color: #c9a25e; flex: none; display: flex; }
.gm-cat-name { flex: 1; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-count { font-family: var(--font-mono); font-size: 10px; color: var(--text4); }

.gm-children { padding: 2px 0 4px 26px; min-height: 12px; }
.gm-mod {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    transition: background .1s;
    cursor: default;
}
.gm-mod:hover { background: var(--surface2); }
.gm-mod.inactive { opacity: .5; }
.gm-file-ic { color: var(--text4); flex: none; display: flex; }
.gm-mod-name { flex: 1; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-panel-badge {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .03em;
    color: var(--text3);
    background: var(--surface3);
    border-radius: 5px;
    padding: 2px 6px;
    white-space: nowrap;
}
.gm-panel-badge.empty { color: var(--text4); font-style: italic; }

.gm-grip { color: #cfc9bd; cursor: grab; flex: none; display: flex; touch-action: none; }
.gm-grip:active { cursor: grabbing; }
.gm-row-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .1s; }
.gm-cat-head:hover .gm-row-actions,
.gm-mod:hover .gm-row-actions { opacity: 1; }
.gm-icon-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--text3);
}
.gm-icon-btn:hover { background: var(--surface3); color: var(--text); }
.gm-icon-btn.danger:hover { background: var(--neg-bg); color: var(--neg); }

.gm-dragging { opacity: .35; }
.gm-drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.gm-drop-after  { box-shadow: inset 0 -2px 0 var(--accent); }

/* Mini toggle (réutilise .switch mais plus petit dans la ligne) */
.gm-toggle { transform: scale(.85); }

/* ── Modale ── */
.gm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(43,43,40,.34);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn .12s ease;
    padding: 20px;
}
.gm-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-drop);
    width: 100%;
    max-width: 430px;
    padding: 22px 22px 18px;
    animation: acFade .14s ease;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}
.gm-modal-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.gm-modal-sub { font-size: 12px; color: var(--text3); margin-bottom: 18px; }
.gm-field { margin-bottom: 14px; }
.gm-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.gm-modal-error { font-size: 12px; color: var(--neg); margin-bottom: 12px; display: none; }
.gm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ============================================================
   MODULE: GESTION DES UTILISATEURS
   ============================================================ */
.users-grid { grid-template-columns: 46px 1.5fr 1.6fr 130px 104px 150px 78px; }
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f7c8e, var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11.5px;
    font-family: var(--font-mono);
    flex: none;
    letter-spacing: .02em;
}
.user-name-cell { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-login { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.user-you-tag {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-bg);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
}
.gm-field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gm-field.row2 > div label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }

/* ============================================================
   MODULE: GESTION DES SITES
   ============================================================ */
.sites-grid     { grid-template-columns: 24px 46px 1.6fr 2fr 120px 44px 72px 72px 72px 72px 70px; }
.adis-cli-grid  { grid-template-columns: 55px 90px 1.4fr 1.2fr 1.6fr 120px 1.2fr 60px 70px 70px; }
#adis-body .adis-row { cursor:pointer; }
.adis-pro-grid { grid-template-columns: 83px 145px 88px 2fr 1.1fr 115px 85px 85px 90px 115px 55px 100px; }
.cms-wrap { position:relative; }
.cms-dropdown { position:absolute; top:calc(100% + 3px); left:0; right:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-drop); z-index:60; padding:4px 0; max-height:200px; overflow-y:auto; }
.cms-dropdown label { display:flex; align-items:center; gap:8px; padding:6px 12px; font-size:12px; cursor:pointer; font-weight:normal; color:var(--text1); }
.cms-dropdown label:hover { background:var(--surface2,#f5f3ef); }
.cms-dropdown input[type="checkbox"] { width:14px; height:14px; accent-color:var(--accent); flex-shrink:0; }
.adis-pro-grid > :nth-child(9) { padding-right: 16px; }
.modal-tabs { display:flex; gap:1px; margin-bottom:18px; border-bottom:1px solid var(--border-light); }
.modal-tab-btn { padding:7px 14px; font-size:12px; font-family:var(--font); border:none; background:none; cursor:pointer; color:var(--text3); border-bottom:2px solid transparent; margin-bottom:-1px; }
.modal-tab-btn.active { color:var(--text1); border-bottom-color:var(--accent); font-weight:600; }
.modal-tab-btn:hover { color:var(--text2); }
.modal-panel { overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }
.adis-sort { cursor:pointer; user-select:none; }
.adis-sort:hover { color:var(--text2); }
.adis-drop-zone { border:2px dashed var(--border);border-radius:6px;padding:20px 16px;text-align:center;cursor:pointer;transition:border-color .15s,background .15s;color:var(--text3);font-size:12px; }
.adis-drop-zone:hover,.adis-drop-zone.dz-over { border-color:var(--accent);background:var(--bg2); }
.adis-drop-zone p { margin:4px 0 0; }
.adis-img-grid { display:flex;flex-wrap:wrap;gap:6px;margin:8px 0; }
.adis-img-thumb { position:relative;width:64px;height:64px;flex-shrink:0; }
.adis-img-thumb img { width:64px;height:64px;object-fit:cover;border-radius:3px;border:1px solid var(--border-light); }
.adis-img-del { position:absolute;top:2px;right:2px;width:16px;height:16px;border-radius:50%;background:rgba(0,0,0,.65);color:#fff;border:none;cursor:pointer;font-size:13px;line-height:16px;text-align:center;padding:0; }
.adis-img-thumb[draggable] { cursor:grab; }
.adis-img-thumb[draggable]:active { cursor:grabbing; }
.adis-img-thumb.dz-over img { outline:2px solid var(--accent);border-radius:3px; }
.adis-sort[data-sort]::after { content:''; display:inline-block; margin-left:5px; width:0; height:0; vertical-align:middle; border-left:4px solid transparent; border-right:4px solid transparent; }
.adis-sort[data-sort="asc"]::after  { border-bottom:5px solid var(--accent); }
.adis-sort[data-sort="desc"]::after { border-top:5px solid var(--accent); }
.sites-flag { display:flex; align-items:center; justify-content:center; }
.sites-flag input[type="checkbox"] { width:15px; height:15px; cursor:pointer; accent-color:var(--accent); }
.drag-handle { cursor: grab; color: var(--text3); display:flex; align-items:center; justify-content:center; }
.drag-handle:active { cursor: grabbing; }
.table-row.drag-over { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ============================================================
   MODULE: ASSISTANCE - PRODUITS
   ============================================================ */
.aprod-grid { grid-template-columns: 2fr 1.2fr 110px 80px 110px 70px; }

/* ============================================================
   MODULE: ASSISTANCE - CLIENTS
   ============================================================ */
.aclients-grid { grid-template-columns: 40px 2fr 1fr 1.5fr 130px 120px 80px 70px; }

/* ============================================================
   MODULE: ASSISTANCE - FACTURES
   ============================================================ */
.afactures-grid { grid-template-columns: 100px 70px 2.2fr 130px 110px 70px; }
.afac-line-row { display: grid; grid-template-columns: 1fr 2.6fr 45px 80px 80px 65px 65px 85px 28px; gap: 4px; align-items: start; margin-bottom: 5px; }
#gm-fac-modal input[type=number]::-webkit-inner-spin-button,
#gm-fac-modal input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#gm-fac-modal input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.afac-line-head { font-size: 11px; font-weight: 600; color: var(--text3); align-items: center; margin-bottom: 8px; }
.afac-totaux { border-top: 1px solid var(--border); padding: 12px 4px 4px; text-align: right; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.afac-total-ttc { font-weight: 700; font-size: 15px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-18 { gap: 18px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.ml-auto { margin-left: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-accent { color: var(--accent); }
.color-neg { color: var(--neg); }
.color-muted { color: var(--text3); }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }
.font-mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
