:root {
    color-scheme: light;
    --bg: #f4f7f3;
    --ink: #18201b;
    --muted: #667268;
    --line: #dfe7df;
    --panel: #ffffff;
    --primary: #1f7a4f;
    --primary-dark: #155d3b;
    --danger: #b43c2e;
    --danger-dark: #8f2d23;
    --soft: #edf5ef;
    --shadow: 0 18px 45px rgba(27, 42, 32, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 28px clamp(16px, 4vw, 48px) 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1, h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
}

h2 {
    font-size: 1.15rem;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 56px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.tabs a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 8px;
}

.tabs a.active,
.tabs a:hover {
    color: var(--ink);
    background: var(--soft);
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    background: #e6f4eb;
    color: #174c31;
    border: 1px solid #bfe2cc;
}

.flash.error {
    background: #fff0ee;
    color: #84271f;
    border-color: #f0c0ba;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metrics article,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metrics article {
    min-height: 134px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metrics span,
.muted {
    color: var(--muted);
}

.metrics span {
    font-size: 0.86rem;
    font-weight: 800;
}

.metrics strong {
    display: block;
    font-size: clamp(1.55rem, 3.2vw, 2.15rem);
    line-height: 1.08;
}

.metrics small {
    color: var(--muted);
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: #e8eee9;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.danger {
    background: var(--danger);
    color: #fff;
}

.button.danger:hover {
    background: var(--danger-dark);
}

.panel {
    padding: 20px;
    margin-top: 18px;
}

.panel.narrow {
    max-width: 680px;
    margin-inline: auto;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-head a {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.form {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

textarea {
    resize: vertical;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.badge {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 0.78rem;
}

.badge.in {
    color: #155d3b;
    background: #e4f4eb;
}

.badge.out {
    color: #84271f;
    background: #fff0ee;
}

.allocation-row td {
    background: #fafcf9;
    color: var(--muted);
    font-size: 0.9rem;
}

.allocation-row span {
    display: inline-block;
    margin: 3px 12px 3px 0;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.stats-page {
    display: grid;
    gap: 20px;
}

.stats-page > h2 {
    font-size: clamp(1.9rem, 4vw, 2.45rem);
}

.stats-intro {
    margin: -8px 0 6px;
    color: var(--muted);
    font-size: 1.08rem;
}

.chart-card {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(24, 32, 27, 0.06);
}

.chart-card h3 {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid #d8d8d8;
    background: #fbfbfb;
    font-size: 1.08rem;
}

.chart-scroll {
    overflow-x: auto;
    padding: 16px 18px 18px;
}

.stats-svg {
    width: 100%;
    min-width: 920px;
    height: auto;
    display: block;
}

.grid-line {
    stroke: rgba(0, 0, 0, 0.12);
    stroke-width: 1;
}

.v-grid-line {
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 1;
}

.axis-label,
.x-label,
.axis-title,
.chart-legend text {
    fill: #666;
    font-size: 13px;
}

.axis-title {
    font-weight: 700;
}

.x-label {
    text-anchor: middle;
    font-weight: 700;
}

.in-fill {
    fill: rgba(91, 173, 238, 0.58);
    stroke: #37a3f5;
}

.out-fill {
    fill: rgba(255, 113, 143, 0.58);
    stroke: #ff637f;
}

.zero-fill {
    fill: #ddd;
}

.bar-stroke {
    stroke-width: 1.2;
}

.bar-inner-label,
.bar-top-label,
.line-value {
    fill: #111;
    font-size: 13px;
    font-weight: 900;
    text-anchor: middle;
}

.line-legend {
    fill: rgba(91, 173, 238, 0.38);
    stroke: #37a3f5;
    stroke-width: 2;
}

.avg-line {
    fill: none;
    stroke: #37a3f5;
    stroke-width: 2.4;
}

.avg-dot {
    fill: #37a3f5;
}

.chart-empty {
    padding: 24px 18px;
}

.detail-table th,
.detail-table td {
    text-align: right;
    font-size: 1rem;
}

.detail-table th:first-child,
.detail-table td:first-child {
    text-align: left;
}

.bar-chart {
    display: flex;
    align-items: end;
    gap: 12px;
    min-height: 280px;
    overflow-x: auto;
    padding: 18px 2px 4px;
}

.bar-item {
    flex: 1 0 64px;
    min-width: 64px;
    display: grid;
    grid-template-rows: auto 170px auto auto;
    gap: 8px;
    text-align: center;
}

.bar-value {
    color: var(--ink);
    font-weight: 900;
    font-size: 0.9rem;
}

.bar-track {
    height: 170px;
    display: flex;
    align-items: end;
    justify-content: center;
    border-radius: 8px;
    background: #f4f0e6;
    overflow: hidden;
    border: 1px solid #d8c9aa;
}

.bar-fill {
    width: 100%;
    min-height: 8px;
    background: linear-gradient(180deg, #2d9b68 0%, var(--primary) 100%);
    border-radius: 8px 8px 0 0;
}

.bar-item.empty .bar-value {
    color: var(--muted);
}

.bar-item.empty .bar-fill {
    background: #cfd9d1;
}

.bar-label {
    color: var(--ink);
    font-weight: 900;
    font-size: 0.82rem;
    white-space: nowrap;
}

.bar-sub {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.backup-form {
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.delete-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.mini-link {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

@media (max-width: 880px) {
    .topbar {
        position: static;
        display: block;
    }

    .tabs {
        justify-content: flex-start;
        margin-top: 16px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .tabs a {
        white-space: nowrap;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split {
        grid-template-columns: 1fr;
    }

    .stats-svg {
        min-width: 860px;
    }
}

@media (max-width: 560px) {
    main {
        width: min(100% - 20px, 1180px);
        margin-top: 12px;
    }

    .topbar {
        padding: 18px 12px 12px;
    }

    .metrics {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metrics article {
        min-height: 112px;
    }

    .actions {
        display: grid;
    }

    .panel {
        padding: 14px;
    }

    table {
        min-width: 640px;
    }

    .bar-chart {
        gap: 10px;
        min-height: 240px;
    }

    .bar-item {
        flex-basis: 52px;
        min-width: 52px;
        grid-template-rows: auto 140px auto auto;
    }

    .bar-track {
        height: 140px;
    }

    .stats-page > h2 {
        font-size: 1.7rem;
    }

    .chart-card h3 {
        font-size: 0.98rem;
        padding: 12px;
    }

    .chart-scroll {
        padding: 12px;
    }
}

/* Sélecteur d'année des statistiques */
.stats-year-selector {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 0 0 1rem;
}
.stats-year-selector a {
    display: inline-block;
    padding: .48rem .8rem;
    border: 1px solid #d6ddd7;
    border-radius: 999px;
    background: #fff;
    color: #526057;
    font-weight: 700;
    text-decoration: none;
}
.stats-year-selector a.active {
    background: #1f8654;
    border-color: #1f8654;
    color: #fff;
}

/* Totaux et valorisations du graphique mensuel */
.in-value-label {
    fill: #1787d8;
}
.out-value-label {
    fill: #d9304f;
}
.chart-totals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 18px 12px;
    border: 1px solid #dce8f5;
    border-radius: 10px;
    overflow: hidden;
    background: #fbfdff;
}
.chart-total {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    min-width: 0;
}
.chart-total + .chart-total {
    border-left: 1px solid #e1e5e8;
}
.chart-total-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 10px;
    font-size: 30px;
    line-height: 1;
    font-weight: 500;
}
.chart-total-in .chart-total-icon {
    color: #168bf0;
    background: #e8f3ff;
}
.chart-total-out .chart-total-icon {
    color: #ed4168;
    background: #fff0f4;
}
.chart-total-title {
    color: #59645d;
    font-size: .95rem;
    margin-bottom: 2px;
}
.chart-total-value {
    color: #182019;
    font-size: 1.28rem;
    font-weight: 850;
    white-space: nowrap;
}
.chart-total-in .chart-total-value {
    color: #168bf0;
}
.chart-total-out .chart-total-value {
    color: #ed4168;
}
.chart-total-value span {
    color: #606760;
    padding: 0 8px;
    font-weight: 600;
}
.chart-valuation-note {
    margin: 0 18px 16px;
    color: var(--muted);
    font-size: .9rem;
}
@media (max-width: 680px) {
    .chart-totals {
        grid-template-columns: 1fr;
    }
    .chart-total + .chart-total {
        border-left: 0;
        border-top: 1px solid #e1e5e8;
    }
    .chart-total-value {
        white-space: normal;
    }
}

/* ===== Pellet Manager : tableau de bord Woodstock ===== */
:root{--navy:#10233a;--navy2:#0b1b2e;--blue:#286bc2;--green:#2d9b52;--orange:#f47a1f;--page:#f5f7f8;--dash-border:#e5e9ed;--dash-shadow:0 8px 25px rgba(21,38,55,.07)}
body{background:var(--page)}
.app-shell{min-height:100vh;display:grid;grid-template-columns:230px minmax(0,1fr)}
.sidebar{position:sticky;top:0;height:100vh;background:linear-gradient(180deg,var(--navy),var(--navy2));color:#fff;display:flex;flex-direction:column;box-shadow:4px 0 16px rgba(12,30,48,.12);z-index:10}
.brand{display:flex;align-items:center;gap:10px;padding:17px 16px 15px;color:#fff;text-decoration:none;border-bottom:1px solid rgba(255,255,255,.08)}
.brand img{width:42px;height:58px;object-fit:contain;filter:drop-shadow(0 4px 6px rgba(0,0,0,.22))}.brand strong{display:block;font-size:1.12rem}.brand small{display:block;color:#42d171;text-transform:uppercase;font-weight:900;font-size:.67rem;margin-top:3px}
.side-nav{display:grid;padding:12px 0}.side-nav a{display:flex;align-items:center;gap:11px;color:#dce7f2;text-decoration:none;padding:11px 16px;border-left:3px solid transparent;font-size:.9rem}.side-nav a:hover{background:rgba(255,255,255,.06);color:#fff}.side-nav a.active{background:linear-gradient(90deg,#286bc2,#255e9f);border-left-color:#61a5ff;color:#fff}.nav-icon{width:20px;text-align:center;font-size:1.12rem}.sidebar-foot{margin-top:auto;padding:16px;color:#a9b9c9;font-size:.78rem}.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#46ca70;margin-right:7px}
.app-main{min-width:0}.app-main main{width:auto;max-width:1500px;margin:0 auto;padding:20px 22px 46px}
.dashboard-heading{padding:0 2px 12px}.dash-title{display:flex;align-items:center;gap:13px}.dash-title img{width:58px;height:72px;object-fit:contain;filter:drop-shadow(0 5px 7px rgba(0,0,0,.12))}.dash-title h1{font-size:2rem;color:#112238}.dash-title p{margin:2px 0 0;color:#258746;text-transform:uppercase;font-weight:900;font-size:.82rem}
.dashboard-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:8px}.kpi{background:#fff;border:1px solid var(--dash-border);border-radius:10px;box-shadow:var(--dash-shadow);padding:15px 16px;min-height:112px}.kpi>span{display:block;text-transform:uppercase;font-size:.69rem;font-weight:900;color:#5d6b78;margin-bottom:9px}.kpi-line{display:flex;align-items:center;gap:10px}.kpi-line strong{font-size:1.8rem;line-height:1;color:#17304c}.kpi-icon{width:34px;height:34px;display:grid;place-items:center;border-radius:50%;font-size:1.35rem;background:#eef2f6;color:#286bc2}.kpi small{display:block;margin-top:7px;color:#66737f;font-size:.75rem;font-weight:700}.kpi-stock>span,.kpi-in>span{color:#286bc2}.kpi-value>span{color:#2b8a45}.kpi-out>span{color:#e56d20}.kpi-value .kpi-icon{background:#eaf7ed;color:#35a653}.kpi-value .kpi-line strong{color:#2d9b52}.kpi-out .kpi-icon{background:#fff1e8;color:#f47a1f}.kpi-out .kpi-line strong{color:#f47a1f}.kpi-in .kpi-line strong{color:#286bc2}
.dashboard-grid{display:grid;grid-template-columns:minmax(280px,.8fr) minmax(520px,1.8fr);gap:12px;margin-top:12px}.dash-card{background:#fff;border:1px solid var(--dash-border);border-radius:10px;box-shadow:var(--dash-shadow);padding:14px}.card-title{display:flex;align-items:center;gap:8px;margin-bottom:13px}.card-title h2{font-size:.93rem}.card-title>span,.card-title>div>span{color:#286bc2;font-weight:900}.card-title.with-link{justify-content:space-between}.card-title.with-link>div{display:flex;align-items:center;gap:8px}.card-title a{font-size:.72rem;color:#286bc2;background:#f4f8ff;border:1px solid #dfeaff;padding:5px 9px;border-radius:7px;text-decoration:none;font-weight:800}
.quick-form{display:grid;gap:11px}.quick-form label{font-size:.76rem;color:#56636f}.qty-stepper{display:grid;grid-template-columns:34px 54px 34px auto;align-items:center}.qty-stepper button,.qty-stepper input{height:36px;min-height:36px;border:1px solid #dfe4e8;background:#fff;text-align:center;padding:0}.qty-stepper button{font-size:1.1rem;cursor:pointer}.qty-stepper button:first-child{border-radius:7px 0 0 7px}.qty-stepper button:nth-of-type(2){border-radius:0 7px 7px 0}.qty-stepper input{border-left:0;border-right:0;border-radius:0}.qty-stepper span{font-size:.75rem;margin-left:8px;color:#4e5a64}.quick-note{min-height:38px;height:38px}.quick-submit{background:linear-gradient(180deg,#2c78da,#2466bd)!important;color:#fff!important;width:100%;font-size:.78rem;min-height:40px}
.compact-table-wrap{overflow-x:auto}.compact-table{min-width:600px;font-size:.76rem}.compact-table th,.compact-table td{padding:8px 7px}.compact-table th{font-size:.65rem}.move-type.in,.value.in{color:#287bd5}.move-type.out,.value.out{color:#e6662b}.stock-ok{color:#249047;font-weight:900}
.supplier-content{display:flex;align-items:center;gap:20px;padding:6px}.donut{width:94px;height:94px;border-radius:50%;background:conic-gradient(#4f8fd1 var(--fill),#e7edf2 0);position:relative;display:grid;place-items:center;flex:0 0 94px}.donut:after{content:"";position:absolute;inset:17px;background:white;border-radius:50%}.donut>div{position:relative;z-index:1;font-size:1.15rem;font-weight:900;text-align:center;color:#17304c}.donut small{display:block;font-size:.62rem;color:#7a8791}.supplier-list{flex:1;display:grid;gap:8px}.supplier-list div{display:grid;grid-template-columns:10px 1fr auto;align-items:center;gap:7px;font-size:.73rem}.supplier-list i{width:8px;height:8px;border-radius:2px;background:#4f8fd1}.lots-preview{grid-column:2}.supplier-card{grid-column:1}
.content-title{margin-bottom:16px}.content-title h1{font-size:1.8rem;color:#112238}.content-title p{color:var(--muted);margin:5px 0 0}.stock-page-kpis{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:14px}.panel,.chart-card{border-radius:10px;box-shadow:var(--dash-shadow);border-color:var(--dash-border)}
@media(max-width:1050px){.dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-grid{grid-template-columns:1fr}.lots-preview,.supplier-card{grid-column:auto}}
@media(max-width:820px){.app-shell{display:block}.sidebar{position:static;height:auto}.brand{padding:10px 14px}.brand img{width:30px;height:38px}.side-nav{display:flex;overflow-x:auto;padding:5px}.side-nav a{white-space:nowrap;border-left:0;border-bottom:3px solid transparent;padding:8px 10px}.side-nav a.active{border-bottom-color:#61a5ff}.sidebar-foot{display:none}.app-main main{padding:14px 12px 34px}.dash-title img{width:44px;height:55px}.dash-title h1{font-size:1.55rem}}
@media(max-width:560px){.dashboard-kpis,.stock-page-kpis{grid-template-columns:1fr 1fr}.kpi{min-height:96px;padding:12px}.kpi-line strong{font-size:1.45rem}.dashboard-grid{gap:10px}.dash-card{padding:12px}.supplier-content{align-items:flex-start}.compact-table{min-width:560px}.dash-title{margin-bottom:4px}}


/* ===== Correctif responsive mobile v3 ===== */
.mobile-menu-toggle{display:none}

@media(max-width:820px){
  body{overflow-x:hidden}
  .app-shell{display:block;min-width:0}
  .sidebar{
    position:sticky;top:0;height:auto;z-index:50;
    display:grid;grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    background:linear-gradient(180deg,var(--navy),var(--navy2));
    box-shadow:0 3px 14px rgba(12,30,48,.18)
  }
  .brand{min-width:0;border-bottom:0;padding:9px 12px;gap:9px}
  .brand img{width:28px!important;height:38px!important;flex:0 0 28px;object-fit:contain}
  .brand strong{font-size:1rem;white-space:nowrap}
  .brand small{font-size:.58rem;margin-top:1px}
  .mobile-menu-toggle{
    display:grid;place-items:center;width:42px;height:42px;margin-right:9px;
    border:1px solid rgba(255,255,255,.18);border-radius:9px;
    background:rgba(255,255,255,.08);color:#fff;font-size:1.35rem;line-height:1;
    cursor:pointer
  }
  .side-nav{
    display:none;grid-column:1/-1;padding:6px 8px 10px;
    grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;
    max-height:calc(100vh - 66px);overflow-y:auto
  }
  .sidebar.menu-open .side-nav{display:grid}
  .side-nav a{
    min-width:0;white-space:normal;border:0!important;border-radius:8px;
    padding:9px 10px;font-size:.78rem;line-height:1.15;background:rgba(255,255,255,.035)
  }
  .side-nav a.active{background:#286bc2}
  .nav-icon{width:18px;flex:0 0 18px}
  .sidebar-foot{display:none}
  .app-main main{width:100%;max-width:none;margin:0;padding:12px 10px 30px}
  .dashboard-heading{padding:2px 1px 10px}
  .dash-title{gap:9px}
  .dash-title img{width:38px!important;height:48px!important;flex:0 0 38px}
  .dash-title h1{font-size:1.4rem;line-height:1.05}
  .dash-title p{font-size:.65rem}
  .dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:2px}
  .kpi{min-width:0;min-height:94px;padding:11px;border-radius:9px}
  .kpi>span{font-size:.6rem;margin-bottom:7px}
  .kpi-line{gap:7px}
  .kpi-line strong{font-size:1.35rem;min-width:0;overflow-wrap:anywhere}
  .kpi-icon{width:29px;height:29px;font-size:1.05rem;flex:0 0 29px}
  .kpi small{font-size:.65rem;margin-top:5px;line-height:1.15}
  .dashboard-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:9px;margin-top:9px}
  .dash-card,.supplier-card,.lots-preview{grid-column:auto!important;min-width:0;padding:11px;border-radius:9px}
  .card-title{margin-bottom:10px}
  .card-title h2{font-size:.88rem}
  .quick-form{gap:9px}
  .qty-stepper{grid-template-columns:38px 56px 38px auto}
  .quick-submit{min-height:42px;font-size:.82rem}
  .supplier-content{gap:13px;padding:2px 0;align-items:center}
  .donut{width:78px;height:78px;flex-basis:78px}
  .donut:after{inset:14px}
  .supplier-list div{font-size:.68rem}
  .compact-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}
  .compact-table{min-width:560px}
  .content-title h1{font-size:1.45rem}
  .panel{padding:12px;margin-top:10px;min-width:0}
  .stock-page-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stats-page{min-width:0}
  .chart-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .stats-svg{min-width:760px}
  .chart-totals{margin-inline:0}
  .chart-valuation-note{margin-inline:0}
}

@media(max-width:430px){
  .dashboard-kpis,.stock-page-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kpi-line strong{font-size:1.22rem}
  .kpi>span{font-size:.56rem}
  .kpi small{font-size:.61rem}
  .side-nav{grid-template-columns:1fr}
  .dash-title img{width:34px!important;height:44px!important}
  .dash-title h1{font-size:1.28rem}
  .supplier-content{align-items:flex-start}
}

/* ===== Harmonisation générale des pages V5 ===== */
.page-hero{
  display:flex;align-items:center;gap:14px;margin:2px 0 14px;padding:16px 18px;
  background:linear-gradient(135deg,#fff 0%,#f7f9fb 100%);border:1px solid var(--dash-border);
  border-radius:12px;box-shadow:0 5px 18px rgba(21,38,55,.045)
}
.page-hero-icon{width:46px;height:46px;display:grid;place-items:center;flex:0 0 46px;border-radius:12px;font-size:1.5rem;font-weight:900;background:#edf4fd;color:var(--blue)}
.page-hero.hero-in .page-hero-icon{background:#e9f7ed;color:var(--green)}
.page-hero.hero-out .page-hero-icon{background:#fff0e7;color:var(--orange)}
.page-hero h1{font-size:1.48rem!important;line-height:1.12;margin:0;color:#112238}.page-hero p{margin:4px 0 0!important;font-size:.84rem;color:#6b7782;line-height:1.35}

.panel-heading{display:flex;align-items:center;gap:11px;margin:-2px 0 18px;padding-bottom:14px;border-bottom:1px solid #edf0f2}
.panel-heading-icon{width:36px;height:36px;display:grid;place-items:center;border-radius:10px;background:#edf4fd;color:var(--blue);font-weight:900;font-size:1.05rem;flex:0 0 36px}
.panel-heading-icon.in{background:#eaf7ed;color:var(--green)}.panel-heading-icon.out{background:#fff0e8;color:var(--orange)}
.panel-heading h2{font-size:1.05rem;color:#1a2732}.panel-heading p{margin:2px 0 0;color:#7b8790;font-size:.76rem;line-height:1.3}

.form-panel{max-width:900px!important;padding:22px 24px!important;background:linear-gradient(180deg,#fff 0%,#fdfefe 100%)}
.form-panel .form{gap:16px}.form-panel label{gap:7px;color:#52615a;font-size:.86rem;font-weight:800}
.form-panel input,.form-panel textarea,.form-panel select{border:1px solid #d9e2dc;border-radius:10px;background:#fbfcfb;min-height:48px;padding:11px 13px;box-shadow:inset 0 1px 1px rgba(20,40,28,.02);transition:border-color .18s,box-shadow .18s,background .18s}
.form-panel input:focus,.form-panel textarea:focus,.form-panel select:focus{outline:none;border-color:#7ab498;background:#fff;box-shadow:0 0 0 3px rgba(45,155,82,.10)}
.form-panel textarea{min-height:96px;line-height:1.4}.form-panel .button{border-radius:10px;min-height:48px;padding-inline:22px;box-shadow:0 4px 12px rgba(25,45,34,.08)}
.form-panel .button.primary{background:linear-gradient(180deg,#2ea25a,#258b4b)}.form-panel .button.danger{background:linear-gradient(180deg,#e56d39,#ca4d2e)}
.delivery-panel .delivery-form{grid-template-columns:repeat(2,minmax(0,1fr))}.delivery-panel .delivery-form label:nth-of-type(6),.delivery-panel .delivery-form label:nth-of-type(7),.delivery-panel .delivery-form>.button,.delivery-panel .delivery-form>.form-actions{grid-column:1/-1}
.out-panel{max-width:760px!important}.out-panel .form{grid-template-columns:repeat(2,minmax(0,1fr))}.out-panel .form label:nth-of-type(3),.out-panel .form>.button,.out-panel .form>.form-actions{grid-column:1/-1}
.settings-panel{max-width:760px!important}.settings-panel .form:first-of-type{grid-template-columns:repeat(2,minmax(0,1fr))}.settings-panel .form:first-of-type>.button{grid-column:1/-1}.backup-form{margin-top:20px;background:#f7f9fb;border:1px dashed #cfd8df!important;border-radius:10px;padding:15px!important}
.delete-form{margin-top:22px;padding:15px;border:1px solid #f1d1cb!important;border-radius:10px;background:#fff8f6}.delete-form:before{content:'Zone sensible';display:block;margin-bottom:10px;color:#ad4938;font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}

.data-panel{padding:18px 20px}.data-panel .table-wrap{border:1px solid #edf0f2;border-radius:10px;overflow:auto;background:#fff}.data-panel table{margin:0}.data-panel th{background:#f7f9fa;color:#67737d;font-size:.69rem;padding:11px 10px;position:sticky;top:0}.data-panel td{padding:11px 10px}.data-panel tbody tr:hover td{background:#fafcfd}.data-panel tbody tr:last-child td{border-bottom:0}
.badge{padding:5px 9px}.mini-link{display:inline-flex;padding:5px 8px;border-radius:6px;background:#f2f7fd;color:#286bc2}

.stats-page>.stats-intro{background:#fff;border:1px solid var(--dash-border);border-radius:10px;padding:12px 14px;margin:0;box-shadow:var(--dash-shadow)}
.chart-card{border-radius:12px!important;overflow:hidden}.chart-card h3{background:linear-gradient(180deg,#fff,#fafbfc);padding:15px 17px!important;color:#1a2732}

@media(min-width:821px){
  .content-title:not(.page-hero){padding:15px 17px;background:#fff;border:1px solid var(--dash-border);border-radius:12px;box-shadow:0 5px 18px rgba(21,38,55,.04)}
}
@media(max-width:820px){
  .page-hero{padding:12px 13px;gap:10px;border-radius:10px;margin-bottom:10px}.page-hero-icon{width:38px;height:38px;flex-basis:38px;border-radius:9px;font-size:1.16rem}.page-hero h1{font-size:1.18rem!important}.page-hero p{font-size:.72rem}
  .form-panel{padding:14px!important;border-radius:10px!important;margin-top:0!important}.panel-heading{margin-bottom:13px;padding-bottom:11px}.panel-heading-icon{width:31px;height:31px;flex-basis:31px}.panel-heading h2{font-size:.95rem}.panel-heading p{font-size:.68rem}
  .delivery-panel .delivery-form,.out-panel .form,.settings-panel .form:first-of-type{grid-template-columns:1fr}.delivery-panel .delivery-form label,.delivery-panel .delivery-form>.button,.delivery-panel .delivery-form>.form-actions,.out-panel .form label,.out-panel .form>.button,.out-panel .form>.form-actions,.settings-panel .form:first-of-type>*{grid-column:auto!important}
  .form-panel input,.form-panel textarea,.form-panel select{min-height:46px;font-size:16px}.form-panel label{font-size:.8rem}.form-panel textarea{min-height:86px}.form-panel .button{width:100%;min-height:46px}
  .form-actions{display:grid;grid-template-columns:1fr;gap:8px}.data-panel{padding:11px}.data-panel .panel-heading{margin-bottom:10px}.data-panel .table-wrap{border-radius:8px}
}

/* Filtres de période — Mouvements / Lots FIFO */
.period-filter { margin: 0 0 18px; }
.empty-state { padding: 24px; text-align: center; color: var(--muted, #6b7785); }
@media (max-width: 760px) {
  .period-filter { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .period-filter a { flex: 0 0 auto; white-space: nowrap; }
}

/* V8 — saison globale */
.dashboard-heading-with-filter {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    flex-wrap:wrap;
}
.dashboard-period {
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:7px;
}
.dashboard-period > span {
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.06em;
    font-weight:800;
    color:#6d7884;
}
.dashboard-period .period-filter { margin:0; }
.quick-season-note {
    margin:10px 2px 0;
    font-size:12px;
    line-height:1.4;
    color:#74808b;
}
.quick-season-note strong { color:#268a46; }
@media (max-width: 760px) {
    .dashboard-heading-with-filter { align-items:flex-start; gap:14px; }
    .dashboard-period { width:100%; align-items:flex-start; }
    .dashboard-period .period-filter { width:100%; overflow-x:auto; padding-bottom:3px; }
    .quick-season-note { font-size:11px; }
}

/* Espacement quantité - bouton consommation rapide */
.quick-submit [data-qty-label] {
    margin: 0 0.25em;
}
/* ===== Clarification stock actuel / période consultée ===== */
.kpi-current{position:relative;border-top-width:3px;padding-top:13px;padding-right:92px}
.kpi-stock.kpi-current{border-top-color:#286bc2}
.kpi-value.kpi-current{border-top-color:#2d9b52}
.kpi-current-badge{position:absolute;top:11px;right:12px;display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eef4fb;color:#286bc2;font-size:.59rem;font-style:normal;font-weight:900;line-height:1;text-transform:uppercase;letter-spacing:.02em}
.kpi-value .kpi-current-badge{background:#eaf7ed;color:#2b8a45}
.kpi .kpi-period-note{margin-top:6px;padding-top:6px;border-top:1px solid #edf0f2;color:#7a8791;font-size:.64rem;font-weight:700;line-height:1.2}
@media(max-width:560px){
  .kpi-current{padding-right:12px;padding-top:34px}
  .kpi-current-badge{top:9px;left:11px;right:auto;font-size:.53rem;padding:4px 7px}
  .kpi .kpi-period-note{font-size:.58rem}
}

