:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #ffffff;
  --ink: #202018;
  --muted: #6c695f;
  --line: #ded8ca;
  --primary: #2f6f4e;
  --primary-dark: #24583e;
  --accent: #c26a2e;
  --soft-green: #e8f2ea;
  --soft-amber: #f8eadf;
  --shadow: 0 18px 40px rgba(32, 32, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 111, 78, 0.08), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 5vw, 56px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 32px) 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.status-pill {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(32, 32, 24, 0.08);
}

.hero-panel {
  min-height: 230px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: clamp(22px, 5vw, 42px);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(20, 29, 20, 0.82), rgba(20, 29, 20, 0.42)),
    url("/wood-stack.svg") center/cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-panel p {
  max-width: 620px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.55;
}

.home-actions,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.action-card,
.summary-grid article,
.form-shell,
.list-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(32, 32, 24, 0.08);
}

.action-card {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-color: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.action-card:hover,
.action-card:focus-visible {
  outline: 3px solid rgba(47, 111, 78, 0.22);
  border-color: var(--primary);
}

.action-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-green);
  color: var(--primary-dark);
  font-weight: 900;
}

.summary-grid {
  margin: 18px 0;
}

.summary-grid article {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
}

.summary-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.summary-label,
.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-shell,
.list-section {
  margin-bottom: 18px;
  padding: clamp(18px, 4vw, 28px);
}

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

.section-title h2 {
  margin-bottom: 0;
}

form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

textarea,
label:has(textarea),
form .primary-button,
.form-actions {
  grid-column: 1 / -1;
}

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

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 800;
}

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

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

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-dark);
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.filter-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 800;
}

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

.filter-count {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-green);
  color: var(--primary-dark);
  font-weight: 800;
  white-space: nowrap;
}

.danger-button {
  min-height: 40px;
  border: 1px solid #d8b7a7;
  border-radius: 8px;
  background: #fff7f3;
  color: #8b2f16;
  padding: 9px 12px;
  font-weight: 800;
}

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

.form-actions {
  align-items: center;
}

.hidden {
  display: none !important;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item strong {
  display: block;
  margin-bottom: 4px;
}

.badge {
  justify-self: end;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--soft-amber);
  color: #7a3e1d;
  font-weight: 800;
  white-space: nowrap;
}

.badge.success {
  background: var(--soft-green);
  color: var(--primary-dark);
}

.item-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.item-actions button {
  min-height: 40px;
  padding: 9px 12px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-actions,
  .summary-grid,
  form {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 260px;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

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

  .badge,
  .item-side {
    justify-self: start;
    justify-items: start;
  }
}


.header-actions { display: flex; align-items: center; gap: 10px; }
.auth-page { display: grid; place-items: center; padding: 20px; }
.auth-main { width: min(460px, 100%); padding: 0; }
.auth-card { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); padding: clamp(24px, 6vw, 40px); }
.auth-card h1 { margin-bottom: 12px; }
.auth-form { display: grid; grid-template-columns: 1fr; margin-top: 24px; }
.auth-form .primary-button { grid-column: 1; }
.auth-message { min-height: 1.4em; margin: 16px 0 0; color: #9b2c2c; font-weight: 700; }
.auth-help { margin: 14px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
@media (max-width: 620px) { .app-header { align-items: flex-start; } .header-actions { flex-direction: column; align-items: stretch; } }

.home-actions {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stats-heading {
  margin-bottom: 18px;
}

.stats-summary {
  margin-top: 0;
}

.chart-card {
  margin-bottom: 18px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(32, 32, 24, 0.08);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.chart-header h2 {
  margin-bottom: 4px;
}

.chart-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.year-picker {
  min-width: 130px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 3px;
}

.legend-swatch.entries,
.chart-bar.entries {
  background: var(--primary);
}

.legend-swatch.burned,
.chart-bar.burned {
  background: var(--accent);
}

.legend-swatch.category-burned,
.chart-bar.category-burned {
  background: #7a5a36;
}

.legend-swatch.category-current,
.chart-bar.category-current {
  background: #47734f;
}

.legend-swatch.stock-age,
.chart-bar.stock-age {
  background: #8a6a3d;
}

.legend-swatch.storage-duration,
.chart-bar.storage-duration {
  background: #596f87;
}

.storage-duration-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}

.storage-duration-summary article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, white 90%, var(--primary) 10%);
}

.storage-duration-summary .summary-value {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

@media (max-width: 760px) {
  .storage-duration-summary {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 460px) {
  .storage-duration-summary {
    grid-template-columns: 1fr;
  }
}

.bar-chart {
  min-height: 300px;
  display: grid;
  grid-template-columns: repeat(12, minmax(46px, 1fr));
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  padding: 20px 4px 4px;
  border-top: 1px solid var(--line);
}

.annual-chart {
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.category-chart {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.age-chart {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.chart-column {
  min-width: 46px;
  height: 250px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  text-align: center;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.chart-bar {
  width: min(22px, 42%);
  min-height: 0;
  position: relative;
  border-radius: 5px 5px 0 0;
}

.chart-bar[data-value]:not([data-value="0"])::before {
  content: attr(data-value);
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-column-button {
  appearance: none;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
}

.chart-column-button:hover,
.chart-column-button:focus-visible,
.chart-column-button.selected {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 3px;
}

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

.chart-detail-placeholder {
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

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

.chart-detail-header h3,
.chart-detail-header p {
  margin: 0;
}

.chart-detail-header p {
  margin-top: 4px;
  color: var(--muted);
}

.chart-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.chart-detail-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.chart-detail-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.oldest-stock-list {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.oldest-stock-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.oldest-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, white);
  font-weight: 800;
}

.oldest-stock-main {
  display: grid;
  gap: 3px;
}

.oldest-stock-main span {
  color: var(--muted);
  font-size: 0.86rem;
}

.oldest-stock-age {
  text-align: right;
  white-space: nowrap;
}

.chart-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-empty {
  grid-column: 1 / -1;
  align-self: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 680px) {
  .chart-header {
    display: grid;
  }

  .year-picker {
    width: 100%;
  }

  .age-chart {
    grid-template-columns: repeat(4, minmax(105px, 1fr));
  }

  .oldest-stock-item {
    grid-template-columns: auto 1fr;
  }

  .oldest-stock-age {
    grid-column: 2;
    text-align: left;
  }
}

.stats-group-title {
  margin: 26px 0 14px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line);
}

.stats-group-title h3 {
  margin: 2px 0 4px;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.stats-group-title p:last-child {
  margin: 0;
  color: var(--muted);
}

.priority-stock-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 20px;
  align-items: center;
  margin: 18px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 6px solid #8a6a3d;
  border-radius: 12px;
  background: color-mix(in srgb, white 92%, #8a6a3d 8%);
}

.priority-stock-card h2 { margin: 3px 0 8px; }
.priority-stock-card p { margin-bottom: 0; color: var(--muted); }
.priority-stock-result {
  display: grid;
  gap: 5px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.priority-stock-result strong { font-size: clamp(1.35rem, 3vw, 2rem); }
.priority-stock-result span { color: var(--muted); font-weight: 700; }

@media (max-width: 700px) {
  .priority-stock-card { grid-template-columns: 1fr; }
}

.autonomy-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(320px, 1.9fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
  box-shadow: var(--shadow);
}

.autonomy-main h2,
.autonomy-main p {
  margin-top: 0;
}

.autonomy-main strong {
  display: block;
  margin: 8px 0;
  color: var(--accent);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.autonomy-main p:last-child,
.autonomy-period {
  color: var(--muted);
}

.autonomy-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
}

.autonomy-metrics article {
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.autonomy-period {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .autonomy-card {
    grid-template-columns: 1fr;
  }

  .autonomy-metrics {
    grid-template-columns: 1fr;
  }
}

.stock-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin: 1.25rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 6px solid #64748b;
  border-radius: 18px;
  background: var(--surface);
}

.stock-alert.normal { border-left-color: #2f855a; background: #f0fff4; }
.stock-alert.warning { border-left-color: #d97706; background: #fff8e6; }
.stock-alert.critical { border-left-color: #c53030; background: #fff5f5; }
.stock-alert h2 { margin: .1rem 0 .35rem; font-size: 1.15rem; }
.stock-alert p { margin-bottom: 0; }
.stock-alert-setting { min-width: 150px; margin: 0; }
.stock-alert-setting span { display: flex; align-items: center; gap: .45rem; margin-top: .35rem; }
.stock-alert-setting input { width: 78px; }

@media (max-width: 680px) {
  .stock-alert { align-items: stretch; flex-direction: column; }
  .stock-alert-setting { min-width: 0; }
}

.export-intro {
  max-width: 760px;
  color: var(--muted);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.export-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.export-card h3 { margin: 4px 0 10px; }
.export-card p:last-child { margin-bottom: 0; color: var(--muted); }
.export-card .primary-button { align-self: flex-start; }

@media (max-width: 720px) {
  .export-grid { grid-template-columns: 1fr; }
}


.restore-card { grid-column: 1 / -1; min-height: 0; }
.file-picker { display: flex; flex-direction: column; gap: 8px; margin: 0; font-weight: 700; }
.file-picker input { padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--background); }
.restore-preview { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--background); }
.restore-preview strong { display: block; margin-bottom: 6px; }
.restore-preview p { margin: 3px 0; }
.restore-preview.error { border-color: #c53030; background: #fff5f5; color: #9b2c2c; }
.danger-button { align-self: flex-start; border: 0; border-radius: 10px; padding: 11px 16px; background: #b42318; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }


.quick-search {
  margin: 18px 0;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(32, 32, 24, 0.08);
}

.quick-search-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.quick-search-heading h2 {
  margin-bottom: 6px;
}

.quick-search-heading p:last-child {
  margin-bottom: 14px;
  color: var(--muted);
}

.quick-search-field {
  display: block;
}

.quick-search-field input {
  min-height: 52px;
  font-size: 1rem;
}

.quick-search-count {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.quick-search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.quick-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 620px) {
  .quick-search-heading,
  .quick-search-result {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-search-result .badge {
    align-self: flex-start;
  }
}

/* Optimisation mobile et tactile */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  touch-action: manipulation;
}

@media (max-width: 760px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
  }

  .app-header .eyebrow {
    display: none;
  }

  .app-header h1 {
    overflow: hidden;
    font-size: 1.35rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .status-pill {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    font-size: 0.86rem;
  }

  .header-actions .secondary-button {
    min-height: 42px;
    padding: 9px 11px;
    font-size: 0.86rem;
  }

  main {
    padding: 14px 12px 30px;
  }

  .hero-panel {
    min-height: 170px;
    margin-bottom: 12px;
    padding: 20px;
    background-position: center 58%;
  }

  .hero-panel h2 {
    margin-bottom: 6px;
    font-size: 1.45rem;
  }

  .hero-panel p {
    font-size: 0.94rem;
    line-height: 1.4;
  }

  .home-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .action-card {
    min-height: 88px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    font-size: 0.94rem;
    line-height: 1.25;
  }

  .action-icon {
    width: 36px;
    height: 36px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
  }

  .summary-grid article {
    min-width: 0;
    padding: 12px 8px;
    text-align: center;
  }

  .summary-value {
    font-size: 1.55rem;
  }

  .summary-label {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .form-shell,
  .list-section,
  .quick-search,
  .chart-card {
    margin-bottom: 12px;
    padding: 16px 14px;
  }

  .section-title {
    gap: 10px;
    margin-bottom: 14px;
  }

  .section-title > .secondary-button,
  .stats-heading > .secondary-button {
    width: 100%;
  }

  input,
  select,
  textarea {
    min-height: 50px;
    font-size: 16px;
  }

  textarea {
    min-height: 110px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .item-actions button {
    min-height: 48px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-actions button,
  .export-card .primary-button,
  .export-card .danger-button {
    width: 100%;
  }

  .item {
    gap: 12px;
    padding: 14px 12px;
  }

  .item-side {
    width: 100%;
  }

  .item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .item-actions button:only-child {
    grid-column: 1 / -1;
  }

  .badge {
    max-width: 100%;
    white-space: normal;
  }

  .segmented-control {
    width: 100%;
    overflow: hidden;
  }

  .filter-button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 5px;
    font-size: 0.84rem;
  }

  .filter-count {
    align-self: flex-start;
  }

  .stock-alert,
  .autonomy-card,
  .priority-stock-card {
    margin: 12px 0;
    padding: 16px 14px;
    border-radius: 12px;
  }

  .autonomy-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .autonomy-metrics article {
    min-width: 0;
    padding: 10px 7px;
    text-align: center;
  }

  .autonomy-metrics .summary-value {
    font-size: 1.15rem;
  }

  .autonomy-metrics .summary-label {
    font-size: 0.7rem;
  }

  .chart-header {
    gap: 10px;
  }

  .chart-legend {
    gap: 10px 14px;
    margin: 12px 0;
    font-size: 0.86rem;
  }

  .bar-chart {
    min-height: 270px;
    margin-inline: -8px;
    padding: 20px 8px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
  }

  .chart-column,
  .chart-column-button {
    scroll-snap-align: center;
  }

  .chart-detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-detail-header .secondary-button {
    width: 100%;
  }

  .chart-detail-list {
    grid-template-columns: 1fr;
  }

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

  .quick-search-field input {
    min-height: 54px;
  }

  .quick-search-heading .secondary-button {
    width: 100%;
  }

  .toast {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0));
    left: 10px;
    max-width: none;
    text-align: center;
  }

  .export-card {
    min-height: 0;
    padding: 18px 16px;
  }
}

@media (max-width: 430px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .status-pill {
    display: none;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .action-card {
    min-height: 66px;
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
  }

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

  .summary-value {
    font-size: 1.35rem;
  }

  .storage-duration-summary,
  .autonomy-metrics {
    grid-template-columns: 1fr;
  }

  .item-actions {
    grid-template-columns: 1fr;
  }

  .oldest-stock-item {
    grid-template-columns: 1fr;
  }

  .oldest-stock-age {
    grid-column: 1;
  }
}

@media (hover: none) and (pointer: coarse) {
  button,
  [role="button"],
  .chart-column-button {
    -webkit-tap-highlight-color: rgba(47, 111, 78, 0.16);
  }

  .action-card:hover,
  .primary-button:hover {
    outline: none;
  }
}

/* Confirmation renforcée avant suppression */
.confirm-dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  color: var(--text, #172033);
}
.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(2px);
}
.confirm-dialog-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  background: #fff;
}
.confirm-dialog-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fee4e2;
  color: #b42318;
  font-size: 1.55rem;
  font-weight: 900;
}
.confirm-dialog h2 { margin: 2px 0 10px; }
.confirm-dialog p { margin-top: 0; }
.confirm-dialog-target {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #f3b8b3;
  border-radius: 12px;
  background: #fff7f6;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.confirm-dialog-warning {
  color: #7a271a;
  font-size: .94rem;
  line-height: 1.45;
}
.confirm-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
@media (max-width: 560px) {
  .confirm-dialog-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    padding: 19px;
  }
  .confirm-dialog-icon { width: 42px; height: 42px; }
  .confirm-dialog-actions { flex-direction: column-reverse; }
  .confirm-dialog-actions button { width: 100%; min-height: 48px; }
}


/* Journal des actions */
.journal-toolbar { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:18px 0; padding:16px; background:#fff; border:1px solid var(--border, #d9e2dc); border-radius:16px; }
.journal-toolbar label { min-width:min(320px, 100%); }
.journal-list { display:grid; gap:10px; }
.journal-entry { display:grid; grid-template-columns:150px minmax(0,1fr) 150px; gap:18px; align-items:start; padding:16px 18px; background:#fff; border:1px solid var(--border, #d9e2dc); border-radius:14px; }
.journal-date { font-variant-numeric:tabular-nums; color:var(--muted, #667085); font-size:.9rem; }
.journal-main { display:grid; gap:3px; }
.journal-main p { margin:4px 0 0; color:var(--muted, #667085); }
.journal-target { font-weight:700; color:#2f6f4e; }
.journal-user { display:grid; justify-items:end; text-align:right; }
.journal-user small { color:var(--muted, #667085); overflow-wrap:anywhere; }
@media (max-width:700px) {
  .journal-toolbar { align-items:stretch; flex-direction:column; }
  .journal-entry { grid-template-columns:1fr; gap:7px; }
  .journal-user { justify-items:start; text-align:left; grid-template-columns:auto 1fr; gap:8px; }
}


/* Diagnostic et gestion des sauvegardes */
.diagnostic-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; margin:1rem 0 1.5rem; }
.diagnostic-grid article { background:var(--surface, #fff); border:1px solid var(--border, #ddd); border-radius:16px; padding:1rem; display:flex; flex-direction:column; gap:.35rem; }
.diagnostic-grid strong { font-size:1.05rem; overflow-wrap:anywhere; }
.diagnostic-grid small { color:var(--muted, #687066); }
.diagnostic-files,.backup-list { display:grid; gap:.75rem; }
.diagnostic-file,.backup-item { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem; border:1px solid var(--border, #ddd); border-radius:14px; background:var(--surface, #fff); }
.diagnostic-file.error { border-color:#b83a3a; }
.backup-item .meta { overflow-wrap:anywhere; }
@media (max-width:900px){ .diagnostic-grid{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width:600px){ .diagnostic-grid{grid-template-columns:1fr;} .diagnostic-file,.backup-item{align-items:stretch;flex-direction:column;} .backup-item .item-actions{display:grid;grid-template-columns:1fr 1fr;} }

.import-card select { width: 100%; min-height: 44px; margin-top: .4rem; }
.import-card .restore-preview small { overflow-wrap: anywhere; }


/* ==========================================================
   Thème harmonisé avec le site Inventaire
   ========================================================== */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #cbd5e1;
  --primary: #3154e8;
  --primary-dark: #2446c5;
  --accent: #3154e8;
  --soft-green: #eef2ff;
  --soft-amber: #fff7ed;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  --sidebar-width: 232px;
  --sidebar-compact: 64px;
}
body { background:#fff; font-size:14px; overflow-x:hidden; }
.brandbar { height:44px; display:flex; align-items:center; justify-content:space-between; padding:0 18px; color:#3154e8; border-bottom:1px solid #e5e7eb; background:#fff; position:sticky; top:0; z-index:40; }
.brand-left,.brand-right { display:flex; align-items:center; gap:10px; }
.brandbar strong { font-size:18px; }
.menu-button { display:none; width:34px; height:34px; border:0; background:transparent; color:#3154e8; font-size:23px; cursor:pointer; }
.brand-logout { border:0; background:transparent; color:#64748b; font-weight:700; cursor:pointer; padding:7px 9px; }
.brand-logout:hover { color:#3154e8; background:#f1f5f9; }
.status-pill { padding:6px 10px; border:1px solid #d8dee8; border-radius:4px; box-shadow:none; background:#f8fafc; color:#3154e8; font-size:12px; }
.app-shell { display:flex; min-height:calc(100vh - 44px); }
.sidebar { width:var(--sidebar-width); flex:none; padding:18px 10px 14px; border-right:1px solid #cbd5e1; background:#fff; display:flex; flex-direction:column; transition:width .2s ease,transform .2s ease; overflow:hidden; z-index:30; }
.sidebar-header { display:flex; align-items:center; justify-content:space-between; min-height:40px; margin-bottom:8px; }
.sidebar h2 { margin:0 12px; font-size:15px; color:#64748b; text-transform:uppercase; letter-spacing:.05em; white-space:nowrap; }
.sidebar-toggle { width:30px; height:30px; flex:none; border:1px solid #d8dee8; background:#fff; color:#3154e8; font-size:22px; line-height:1; cursor:pointer; border-radius:5px; }
.sidebar-nav { display:grid; gap:2px; }
.nav-item { display:flex; align-items:center; gap:11px; width:100%; min-height:44px; padding:10px 12px; border:0; background:transparent; color:#111827; text-align:left; font-size:15px; cursor:pointer; white-space:nowrap; overflow:hidden; }
.nav-item:hover { background:#f1f5f9; }
.nav-item.active { background:#dbe5ff; color:#244ee8; border-right:3px solid #3154e8; font-weight:700; }
.nav-icon { display:grid; place-items:center; width:24px; min-width:24px; font-size:20px; }
.nav-label { overflow:hidden; text-overflow:ellipsis; }
.sidebar-spacer { flex:1; }
.version { padding:10px 12px; color:#94a3b8; font-size:12px; line-height:1.5; white-space:nowrap; }
.sidebar-overlay { display:none; position:fixed; inset:44px 0 0; z-index:20; border:0; background:rgba(15,23,42,.48); }
body.sidebar-collapsed .sidebar { width:var(--sidebar-compact); }
body.sidebar-collapsed .sidebar h2,body.sidebar-collapsed .nav-label,body.sidebar-collapsed .version { display:none; }
body.sidebar-collapsed .sidebar-header { justify-content:center; }
body.sidebar-collapsed .sidebar-toggle { transform:rotate(180deg); }
body.sidebar-collapsed .nav-item { justify-content:center; padding-left:8px; padding-right:8px; }
.app-main { flex:1; min-width:0; width:auto; max-width:none; margin:0; padding:22px 18px 34px; overflow:hidden; }

.hero-panel { min-height:auto; align-items:center; margin-bottom:16px; padding:18px 20px; border:1px solid #cbd5e1; border-radius:0; background:#fff; color:#111827; box-shadow:none; }
.hero-panel h2 { color:#3154e8; font-size:20px; }
.hero-panel p { max-width:none; color:#64748b; }
.eyebrow { color:#64748b; }
h1,h2,h3 { color:#111827; }
.section-title { border-bottom:1px solid #cbd5e1; padding-bottom:12px; }
.section-title h2,.stats-heading h2,.stats-group-title h3 { color:#3154e8; }
.home-actions { grid-template-columns:repeat(4,minmax(150px,1fr)); gap:10px; }
.action-card { min-height:72px; padding:12px 14px; border:1px solid #d8dee8; border-radius:0; box-shadow:none; background:#fff; font-weight:700; }
.action-card:hover,.action-card:focus-visible { outline:none; border-color:#3154e8; background:#f8faff; }
.action-icon { width:34px; height:34px; border-radius:4px; background:#eef2ff; color:#3154e8; }
.summary-grid { gap:10px; }
.summary-grid article,.form-shell,.list-section,.quick-search,.stock-alert,.chart-card,.autonomy-card,.priority-stock-card,.export-card,.journal-card,.diagnostic-card { border:1px solid #cbd5e1; border-radius:0 !important; box-shadow:none !important; background:#fff; }
.summary-grid article { padding:14px; }
.summary-value { color:#3154e8; font-size:1.7rem; }
.form-shell,.list-section { padding:18px; }
input,select,textarea { min-height:40px; border:1px solid #cbd5e1; border-radius:0; padding:9px 10px; }
input:focus,select:focus,textarea:focus { outline:2px solid rgba(49,84,232,.18); border-color:#3154e8; }
.primary-button,.secondary-button,.danger-button,.filter-button { min-height:38px; border-radius:0; padding:9px 13px; }
.primary-button { background:#3154e8; }
.primary-button:hover { background:#2446c5; }
.secondary-button { border:1px solid #cbd5e1; color:#3154e8; background:#eef2f7; }
.segmented-control { border-radius:0; padding:0; gap:0; }
.filter-button { border-right:1px solid #d8dee8; }
.filter-button:last-child { border-right:0; }
.filter-button.active { background:#3154e8; }
.filter-count { border-radius:0; background:#eef2ff; color:#3154e8; }
.item-card,.search-result-card,.backup-card { border-radius:0 !important; box-shadow:none !important; }
.item-card:hover,.search-result-card:hover { border-color:#3154e8; background:#f8faff; }
.toast { border-radius:4px; }
.confirm-dialog-card { border-radius:0; }

/* Authentification dans la même charte */
.auth-page { background:#f8fafc; }
.auth-main { min-height:100vh; display:grid; place-items:center; padding:20px; }
.auth-card { width:min(440px,100%); border:1px solid #cbd5e1; border-radius:0; box-shadow:0 20px 50px rgba(15,23,42,.14); padding:28px; background:#fff; }
.auth-card h1 { color:#3154e8; font-size:26px; }

@media(max-width:1000px){ .home-actions{grid-template-columns:repeat(2,minmax(150px,1fr));} }
@media(max-width:800px){ .app-main{padding:16px 10px}.home-actions{grid-template-columns:repeat(2,1fr)} }
@media(max-width:600px){
  .menu-button{display:block}.brandbar{padding:0 10px}.brandbar strong{font-size:16px}.brand-right .status-pill{display:none}
  .sidebar{position:fixed;left:0;top:44px;bottom:0;width:min(86vw,290px);transform:translateX(-105%);box-shadow:8px 0 25px rgba(15,23,42,.18)}
  body.mobile-menu-open .sidebar{transform:translateX(0)}body.mobile-menu-open .sidebar-overlay{display:block}
  .sidebar-toggle{display:none}.sidebar h2,.nav-label,.version,body.sidebar-collapsed .sidebar h2,body.sidebar-collapsed .nav-label,body.sidebar-collapsed .version{display:block}
  .nav-item,body.sidebar-collapsed .nav-item{justify-content:flex-start;padding:10px 12px}
  .app-main{padding:12px 7px 28px}.home-actions{grid-template-columns:1fr}.action-card{min-height:58px}
  .hero-panel{padding:14px}.summary-grid{grid-template-columns:repeat(3,1fr)}.summary-grid article{padding:10px}.summary-value{font-size:1.35rem}.summary-label{font-size:.78rem}
}

/* Tableau de bord d'accueil inspiré du site Inventaire */
.dashboard-home { background:#172235; margin:-22px -18px -34px; padding:14px 12px 30px; min-height:calc(100vh - 44px); }
.dashboard-titlebar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 2px 10px; border-bottom:1px solid #526078; }
.dashboard-titlebar h2 { margin:0; color:#f8fafc; font-size:19px; }
.dashboard-titlebar .eyebrow { color:#8ea3c3; }
.dashboard-titlebar .secondary-button { background:#f8fafc; border-color:#d8e0eb; }
.dashboard-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:10px 0; }
.dashboard-metric { min-height:76px; display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid #d9e0ea; border-radius:10px; background:#fff; box-shadow:0 2px 8px rgba(15,23,42,.14); }
.dashboard-metric > div { display:grid; gap:3px; min-width:0; }
.dashboard-metric strong { color:#0f172a; font-size:24px; line-height:1; font-variant-numeric:tabular-nums; }
.dashboard-metric span:last-child { color:#64748b; font-size:12px; }
.metric-icon { width:40px; height:40px; flex:none; display:grid; place-items:center; border-radius:9px; font-size:20px; font-weight:900; }
.metric-icon.blue { color:#3154e8; background:#edf1ff; }
.metric-icon.green { color:#12834d; background:#dcfce7; }
.metric-icon.purple { color:#7047d8; background:#f0eafe; }
.metric-icon.amber { color:#bc6a00; background:#fff2c7; }
.metric-icon.cyan { color:#087b9b; background:#dff6fc; }
.metric-icon.rose { color:#c24164; background:#ffe7ee; }
.dashboard-search { padding:12px 14px; margin-bottom:10px; border:1px solid #485872; border-radius:9px; background:#1b283b; }
.dashboard-search-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.dashboard-search h3 { color:#f8fafc; margin:0 0 3px; font-size:15px; }
.dashboard-search p { color:#8ea3c3; margin:0; font-size:12px; }
.dashboard-search .quick-search-field { margin-top:10px; }
.dashboard-search input { border-color:#607089; background:#f8fafc; }
.dashboard-search .quick-search-count { margin:7px 0 0; }
.dashboard-search .quick-search-results { margin-top:8px; }
.dashboard-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.dashboard-panel { min-height:300px; padding:14px 13px; border:1px solid #485872; border-radius:9px; background:#1b283b; color:#f8fafc; overflow:hidden; }
.dashboard-panel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:0 3px 11px; margin-bottom:10px; border-bottom:1px solid #7d8aa0; }
.dashboard-panel-head h3 { margin:0 0 3px; color:#f8fafc; font-size:16px; }
.dashboard-panel-head p { margin:0; color:#8ea3c3; font-size:12px; }
.dashboard-link { flex:none; border:0; background:transparent; color:#5f78ff; font-size:12px; font-weight:800; padding:2px 0; }
.dashboard-link:hover { color:#91a2ff; text-decoration:underline; }
.dashboard-alerts { display:grid; gap:8px; }
.dashboard-alert-row { display:grid; grid-template-columns:36px minmax(0,1fr); gap:10px; align-items:center; padding:10px 11px; border:1px solid #43526a; background:#202f45; }
.dashboard-alert-row strong { color:#fff; }
.dashboard-alert-row p { margin:3px 0 0; color:#a6b6cf; font-size:12px; line-height:1.4; }
.dashboard-alert-symbol { width:32px; height:32px; display:grid; place-items:center; border-radius:7px; font-weight:900; background:#33445d; }
.dashboard-alert-row.warning .dashboard-alert-symbol { color:#b66700; background:#fff0c2; }
.dashboard-alert-row.critical .dashboard-alert-symbol { color:#b42318; background:#fee4e2; }
.dashboard-alert-row.normal .dashboard-alert-symbol { color:#13814d; background:#d9fbe7; }
.dashboard-alert-row.info .dashboard-alert-symbol { color:#3154e8; background:#e4eaff; }
.dashboard-stock-setting { margin-top:10px; padding:10px 11px !important; border-radius:0 !important; border-color:#43526a !important; background:#202f45 !important; color:#f8fafc; box-shadow:none !important; }
.dashboard-stock-setting h2 { color:#fff; font-size:14px; margin-bottom:3px; }
.dashboard-stock-setting p,.dashboard-stock-setting label { color:#a6b6cf; font-size:12px; }
.dashboard-stock-setting input { min-height:32px; width:68px; padding:5px 7px; }
.dashboard-recent { background:#fff; color:#0f172a; }
.dashboard-recent-row { display:flex; justify-content:space-between; gap:14px; padding:10px 12px; border-bottom:1px solid #e2e8f0; }
.dashboard-recent-row:last-child { border-bottom:0; }
.dashboard-recent-row > div { display:grid; gap:3px; min-width:0; }
.dashboard-recent-row strong { font-size:12px; overflow-wrap:anywhere; }
.dashboard-recent-row span { color:#64748b; font-size:11px; overflow-wrap:anywhere; }
.dashboard-recent-row time { flex:none; color:#64748b; font-size:11px; white-space:nowrap; }
.dashboard-distribution { display:grid; gap:12px; padding:4px 5px; }
.dashboard-distribution-row { display:grid; gap:6px; }
.distribution-label { display:flex; justify-content:space-between; gap:10px; color:#c3cfe1; font-size:12px; }
.distribution-label strong { color:#fff; }
.distribution-track { height:14px; overflow:hidden; border-radius:999px; background:#2d3c53; }
.distribution-track span { display:block; height:100%; border-radius:inherit; background:#2ec66d; }
.dashboard-quick-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; padding:4px; }
.quick-action-button { min-height:48px; border:1px solid #d9e0ea; border-radius:5px; background:#f8fafc; color:#193c94; font-weight:800; }
.quick-action-button:hover { border-color:#6f87ff; background:#eef2ff; }
.dashboard-empty { min-height:150px; display:grid; place-items:center; color:#8297b7; text-align:center; }

@media(max-width:1050px){ .dashboard-metrics{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media(max-width:800px){
  .dashboard-home{margin:-16px -10px -28px;padding:12px 8px 24px}
  .dashboard-panels{grid-template-columns:1fr}
  .dashboard-panel{min-height:0}
}
@media(max-width:600px){
  .dashboard-home{margin:-12px -7px -28px;padding:10px 7px 22px}
  .dashboard-titlebar{align-items:stretch;flex-direction:column}
  .dashboard-titlebar .secondary-button{width:100%}
  .dashboard-metrics{grid-template-columns:1fr 1fr;gap:7px}
  .dashboard-metric{min-height:67px;padding:9px;gap:8px}
  .metric-icon{width:34px;height:34px;font-size:16px}
  .dashboard-metric strong{font-size:20px}
  .dashboard-metric span:last-child{font-size:10px}
  .dashboard-panel-head{align-items:stretch;flex-direction:column}
  .dashboard-link{text-align:left}
  .dashboard-recent-row{align-items:flex-start;flex-direction:column;gap:5px}
  .dashboard-quick-actions{grid-template-columns:1fr}
  .dashboard-search-head{align-items:stretch;flex-direction:column}
}

/* Tableau Palox inspire de la liste Inventaire */
.inventory-view {
  color: #edf3ff;
}

.inventory-page-header {
  padding: 6px 0 12px;
  border-bottom: 1px solid #39485f;
  margin-bottom: 10px;
}

.inventory-page-header h2 {
  margin: 0 0 4px;
  color: #7f9cff;
  font-size: 1.25rem;
}

.inventory-page-header p {
  margin: 0;
  color: #9fb0c8;
  font-size: .88rem;
}

.inventory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
}

.inventory-toolbar-actions,
.inventory-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 1px solid #596a84;
  border-radius: 0;
  background: #1a2739;
  color: #e7eefc;
  font-size: 1.15rem;
  font-weight: 900;
}

.toolbar-icon-button.primary {
  border-color: #8298ff;
  background: #7388ef;
  color: #fff;
}

.table-search {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-width: 250px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #46566d;
  background: #172436;
  color: #b8c6d8;
}

.table-search input,
.inventory-toolbar select {
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: #1c2b40;
  color: #edf3ff;
}

.table-search input {
  width: 100%;
  padding: 0;
  background: transparent;
}

.inventory-toolbar select {
  border: 1px solid #46566d;
  padding: 0 10px;
}

.palox-editor {
  margin: 12px 0;
  border-radius: 0;
  border-color: #485a73;
  background: #172437;
  color: #eef4ff;
}

.palox-editor h3 { margin: 0; }

.inventory-table-card {
  border: 1px solid #40516a;
  background: #142135;
}

.table-scroll { overflow-x: auto; }

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: .86rem;
}

.inventory-table th,
.inventory-table td {
  padding: 10px 9px;
  border-right: 1px solid #40516a;
  border-bottom: 1px solid #40516a;
  text-align: left;
  vertical-align: middle;
}

.inventory-table th {
  background: #17263a;
  color: #f6f8ff;
  font-size: .8rem;
  font-weight: 850;
  white-space: nowrap;
}

.inventory-table tbody tr:nth-child(odd) { background: #1b2a3e; }
.inventory-table tbody tr:nth-child(even) { background: #223248; }
.inventory-table tbody tr:hover { background: #2b3d57; }

.table-sort {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 900;
}

.status-pill.ok { background: #28d477; color: #092c1a; }
.status-pill.occupied { background: #f3b74d; color: #392400; }

.table-info-cell {
  max-width: 320px;
  color: #c8d3e2;
}

.table-actions-column { width: 92px; }
.table-row-actions { white-space: nowrap; }

.table-action-button {
  width: 32px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #61718a;
  border-radius: 0;
  background: #23344c;
  color: #fff;
}

.table-action-button.danger {
  border-color: #8e5a61;
  color: #ffb6bd;
}

.table-empty {
  padding: 28px;
  color: #9fb0c8;
  text-align: center;
}

.inventory-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 6px 10px;
  color: #dce6f5;
}

.table-pagination {
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-pagination button {
  width: 34px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #56667d;
  border-radius: 0;
  background: #26364d;
  color: #fff;
}

.table-pagination button:disabled { opacity: .35; }

@media (max-width: 820px) {
  .inventory-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .inventory-toolbar-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .table-search {
    min-width: 0;
    grid-column: 1 / -1;
  }
  .inventory-toolbar select { width: 100%; }
}

.stock-toolbar-filters { flex-wrap: wrap; }
.stock-inventory-table { min-width: 940px; }
.status-pill.burned { background: #718096; color: #f7fafc; }
.stock-editor form { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.stock-editor .form-actions { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .stock-editor form { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 820px) {
  .stock-toolbar-filters { grid-template-columns: 1fr 1fr; }
  .stock-toolbar-filters .table-search { grid-column: 1 / -1; }
  .stock-editor form { grid-template-columns: 1fr; }
}

/* Onglet Catégories harmonisé avec Stock de bois */
.category-inventory-table th:nth-child(1),
.category-inventory-table td:nth-child(1) { min-width: 260px; }
.category-inventory-table th:nth-child(2),
.category-inventory-table td:nth-child(2),
.category-inventory-table th:nth-child(3),
.category-inventory-table td:nth-child(3) { width: 180px; }
.category-inventory-table th:nth-child(4),
.category-inventory-table td:nth-child(4) { width: 150px; }
.status-pill.neutral { background: #718096; color: #f7fafc; }

/* ==========================================================
   Statistiques harmonisées avec Stock de bois
   ========================================================== */
.stats-inventory-view {
  background: #172235;
  margin: -22px -18px -34px;
  padding: 14px 12px 30px;
  min-height: calc(100vh - 44px);
  color: #f8fafc;
}
.stats-page-header {
  margin: 0 0 10px;
  padding: 0 2px 10px;
  border-bottom: 1px solid #526078;
}
.stats-page-header h2 { color: #f8fafc; font-size: 19px; }
.stats-page-header p { color: #8ea3c3; }

.stats-inventory-view .stats-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.stats-inventory-view .stats-summary article {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid #d9e0ea;
  border-radius: 10px !important;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.14) !important;
}
.stats-inventory-view .stats-summary .summary-value { color: #0f172a; font-size: 24px; }
.stats-inventory-view .stats-summary .summary-label { color: #64748b; font-size: 12px; }

.stats-inventory-view .stats-group-title {
  margin: 16px 0 10px;
  padding: 0 3px 9px;
  border-bottom: 1px solid #7d8aa0;
}
.stats-inventory-view .stats-group-title .eyebrow { color: #8ea3c3; }
.stats-inventory-view .stats-group-title h3 { margin: 2px 0 3px; color: #f8fafc; font-size: 16px; }
.stats-inventory-view .stats-group-title p:last-child { color: #8ea3c3; font-size: 12px; }

.stats-inventory-view .chart-card,
.stats-inventory-view .autonomy-card,
.stats-inventory-view .priority-stock-card {
  margin-bottom: 10px;
  padding: 14px 13px;
  border: 1px solid #485872;
  border-radius: 9px !important;
  background: #1b283b;
  color: #f8fafc;
  box-shadow: none !important;
}
.stats-inventory-view .autonomy-card {
  grid-template-columns: minmax(220px, 1.1fr) minmax(320px, 1.9fr);
  gap: 18px;
}
.stats-inventory-view .priority-stock-card {
  grid-template-columns: minmax(0,1.4fr) minmax(240px,.8fr);
  border-left: 1px solid #485872;
}
.stats-inventory-view .chart-header {
  padding: 0 3px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #7d8aa0;
}
.stats-inventory-view .chart-header h2,
.stats-inventory-view .autonomy-main h2,
.stats-inventory-view .priority-stock-card h2 { color: #f8fafc; font-size: 16px; }
.stats-inventory-view .chart-header p,
.stats-inventory-view .autonomy-main p,
.stats-inventory-view .priority-stock-card p,
.stats-inventory-view .autonomy-period { color: #8ea3c3; font-size: 12px; }
.stats-inventory-view .eyebrow { color: #8ea3c3; }
.stats-inventory-view .autonomy-main strong { color: #fff; }
.stats-inventory-view .autonomy-metrics article,
.stats-inventory-view .storage-duration-summary article,
.stats-inventory-view .priority-stock-result {
  border: 1px solid #43526a;
  border-radius: 0;
  background: #202f45;
}
.stats-inventory-view .autonomy-metrics .summary-value,
.stats-inventory-view .storage-duration-summary .summary-value,
.stats-inventory-view .priority-stock-result strong { color: #fff; }
.stats-inventory-view .autonomy-metrics .summary-label,
.stats-inventory-view .storage-duration-summary .summary-label,
.stats-inventory-view .priority-stock-result span { color: #a6b6cf; }

.stats-inventory-view .year-picker { color: #a6b6cf; font-size: 12px; }
.stats-inventory-view .year-picker select {
  min-height: 34px;
  border-color: #607089;
  background: #f8fafc;
  color: #0f172a;
}
.stats-inventory-view .chart-legend { margin: 10px 3px; color: #a6b6cf; font-size: 12px; }
.stats-inventory-view .bar-chart {
  min-height: 285px;
  padding-top: 20px;
  border-top: 0;
  background: #172235;
}
.stats-inventory-view .chart-bars { border-bottom-color: #607089; }
.stats-inventory-view .chart-bar[data-value]:not([data-value="0"])::before { color: #f8fafc; }
.stats-inventory-view .chart-label { color: #a6b6cf; }
.stats-inventory-view .chart-empty,
.stats-inventory-view .chart-detail-placeholder { color: #8ea3c3; }
.stats-inventory-view .chart-column-button:hover,
.stats-inventory-view .chart-column-button:focus-visible,
.stats-inventory-view .chart-column-button.selected {
  background: #263750;
  outline-color: #7086ff;
}
.stats-inventory-view .chart-details {
  border-top-color: #526078;
}
.stats-inventory-view .chart-detail-header h3 { color: #fff; }
.stats-inventory-view .chart-detail-header p { color: #8ea3c3; }
.stats-inventory-view .chart-detail-item {
  border-color: #43526a;
  border-radius: 0;
  background: #202f45;
}
.stats-inventory-view .chart-detail-item strong { color: #fff; }
.stats-inventory-view .chart-detail-item span { color: #a6b6cf; }

@media (min-width: 980px) {
  .stats-inventory-view .chart-card:nth-of-type(4),
  .stats-inventory-view .chart-card:nth-of-type(5) { }
}
@media (max-width: 800px) {
  .stats-inventory-view { margin: -16px -10px -28px; padding: 12px 8px 24px; }
  .stats-inventory-view .autonomy-card,
  .stats-inventory-view .priority-stock-card { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-inventory-view { margin: -12px -7px -28px; padding: 10px 6px 22px; }
  .stats-inventory-view .stats-summary { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .stats-inventory-view .stats-summary article { min-height: 68px; padding: 9px; }
  .stats-inventory-view .stats-summary .summary-value { font-size: 20px; }
}

/* ==========================================================
   Export / Import, Journal et Diagnostic harmonisés
   avec les vues Inventaire
   ========================================================== */
.admin-inventory-view {
  background: #172235;
  margin: -22px -18px -34px;
  padding: 14px 12px 30px;
  min-height: calc(100vh - 44px);
  color: #f8fafc;
}
.admin-inventory-view > .section-title:first-child {
  margin: 0 0 10px;
  padding: 0 2px 10px;
  border-bottom: 1px solid #526078;
}
.admin-inventory-view > .section-title:first-child h2 {
  color: #f8fafc;
  font-size: 19px;
}
.admin-inventory-view > .section-title:first-child p,
.admin-inventory-view .eyebrow {
  color: #8ea3c3;
}
.admin-inventory-view .secondary-button,
.admin-inventory-view .primary-button,
.admin-inventory-view .danger-button {
  min-height: 34px;
  border-radius: 0;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}
.admin-inventory-view .secondary-button {
  border: 1px solid #607089;
  background: #202f45;
  color: #f8fafc;
}
.admin-inventory-view .secondary-button:hover { background: #2a3b55; }
.admin-inventory-view input,
.admin-inventory-view select {
  min-height: 36px;
  border: 1px solid #607089;
  border-radius: 0;
  background: #f8fafc;
  color: #0f172a;
}
.admin-inventory-view label { color: #a6b6cf; }

/* Export / Import */
.export-inventory-view .export-intro {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #485872;
  background: #1b283b;
  color: #a6b6cf;
  font-size: 12px;
}
.export-inventory-view .export-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.export-inventory-view .export-card {
  min-height: 185px;
  padding: 14px;
  border: 1px solid #485872;
  border-radius: 0 !important;
  background: #1b283b;
  color: #f8fafc;
  box-shadow: none !important;
}
.export-inventory-view .export-card h3 { color: #fff; font-size: 16px; }
.export-inventory-view .export-card p:last-child { color: #a6b6cf; font-size: 12px; }
.export-inventory-view .file-picker {
  border: 1px dashed #607089;
  border-radius: 0;
  background: #202f45;
  color: #f8fafc;
}
.export-inventory-view .restore-preview {
  border: 1px solid #43526a;
  border-radius: 0;
  background: #202f45;
  color: #f8fafc;
}

/* Journal */
.journal-inventory-view .journal-toolbar {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #485872;
  border-radius: 0;
  background: #1b283b;
}
.journal-inventory-view .filter-count {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #607089;
  border-radius: 0;
  background: #202f45;
  color: #f8fafc;
}
.journal-inventory-view .journal-list { gap: 0; border: 1px solid #485872; }
.journal-inventory-view .journal-entry {
  grid-template-columns: 145px minmax(0, 1fr) 165px;
  gap: 14px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid #43526a;
  border-radius: 0;
  background: #1b283b;
  color: #f8fafc;
}
.journal-inventory-view .journal-entry:last-child { border-bottom: 0; }
.journal-inventory-view .journal-entry:nth-child(even) { background: #202f45; }
.journal-inventory-view .journal-date,
.journal-inventory-view .journal-main p,
.journal-inventory-view .journal-user small { color: #a6b6cf; }
.journal-inventory-view .journal-target { color: #8fb2ff; }
.journal-inventory-view .journal-user strong { color: #fff; }

/* Diagnostic */
.diagnostic-inventory-view .diagnostic-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.diagnostic-inventory-view .diagnostic-grid article {
  min-height: 86px;
  padding: 12px 14px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15,23,42,.14);
}
.diagnostic-inventory-view .diagnostic-grid strong { color: #0f172a; }
.diagnostic-inventory-view .diagnostic-grid small { color: #64748b; }
.diagnostic-inventory-view .list-section {
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid #485872;
  border-radius: 0 !important;
  background: #1b283b;
  color: #f8fafc;
  box-shadow: none !important;
}
.diagnostic-inventory-view .list-section > .section-title {
  margin: 0 0 10px;
  padding: 0 2px 9px;
  border-bottom: 1px solid #607089;
}
.diagnostic-inventory-view .list-section h2 { color: #fff; font-size: 16px; }
.diagnostic-inventory-view .list-section p { color: #8ea3c3; }
.diagnostic-inventory-view .diagnostic-files,
.diagnostic-inventory-view .backup-list { gap: 0; border: 1px solid #43526a; }
.diagnostic-inventory-view .diagnostic-file,
.diagnostic-inventory-view .backup-item {
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid #43526a;
  border-radius: 0;
  background: #202f45;
  color: #f8fafc;
}
.diagnostic-inventory-view .diagnostic-file:last-child,
.diagnostic-inventory-view .backup-item:last-child { border-bottom: 0; }
.diagnostic-inventory-view .diagnostic-file:nth-child(even),
.diagnostic-inventory-view .backup-item:nth-child(even) { background: #1b283b; }
.diagnostic-inventory-view .diagnostic-file.error { border-left: 4px solid #dc2626; }
.diagnostic-inventory-view .filter-count {
  border: 1px solid #607089;
  border-radius: 0;
  background: #202f45;
  color: #f8fafc;
}

@media (max-width: 900px) {
  .export-inventory-view .export-grid { grid-template-columns: 1fr; }
  .diagnostic-inventory-view .diagnostic-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .journal-inventory-view .journal-entry { grid-template-columns: 1fr; gap: 6px; }
  .journal-inventory-view .journal-user { justify-items: start; text-align: left; }
}
@media (max-width: 600px) {
  .admin-inventory-view { margin: -12px -7px -28px; padding: 10px 6px 22px; }
  .diagnostic-inventory-view .diagnostic-grid { grid-template-columns: 1fr; }
  .diagnostic-inventory-view .diagnostic-file,
  .diagnostic-inventory-view .backup-item { align-items: stretch; flex-direction: column; }
  .diagnostic-inventory-view .backup-item .item-actions { grid-template-columns: 1fr; }
}

/* Paramètres / Diagnostic modernisé */
.settings-inventory-view .section-title.stats-heading {
  align-items: flex-start;
}
.settings-layout {
  display: grid;
  gap: 16px;
  margin: 10px 0 16px;
}
.settings-card {
  padding: 14px;
  border: 1px solid #485872;
  border-radius: 16px;
  background: #1b283b;
  color: #f8fafc;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}
.settings-card h3 {
  margin: 0 0 6px;
  color: #8fb2ff;
  font-size: 1.75rem;
}
.settings-card p {
  margin: 0;
  color: #b8c6da;
  line-height: 1.5;
}
.settings-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.settings-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.4rem;
  font-weight: 700;
  background: #e9eefc;
  color: #3557d8;
}
.settings-icon.red { background: #fae9e9; color: #c62828; }
.settings-icon.violet { background: #ebe9fb; color: #5851d8; }
.settings-note,
.settings-warning {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #42536c;
  border-radius: 10px;
  background: #202f45;
  color: #d3dded;
}
.settings-warning {
  border-color: #824444;
  background: rgba(114, 28, 36, 0.28);
  color: #ffd3d8;
}
.danger-surface {
  border-color: #81404b;
  background: linear-gradient(180deg, rgba(66, 24, 29, 0.95), rgba(41, 20, 28, 0.97));
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.settings-field { display: grid; gap: 8px; color: #fff; }
.settings-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  color: #fff;
  font-weight: 600;
}
.settings-checkbox input {
  margin-top: 4px;
}
.settings-diagnostic-block {
  margin-top: 0 !important;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.theme-option {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #607089;
  border-radius: 14px;
  background: #202f45;
  color: #fff;
  text-align: left;
}
.theme-option strong { font-size: 1rem; }
.theme-option small { color: #a9bdd9; }
.theme-option.active {
  border-color: #7fa4ff;
  box-shadow: 0 0 0 2px rgba(127, 164, 255, 0.22) inset;
}
.theme-current {
  display: none;
  font-style: normal;
  font-size: .78rem;
  font-weight: 700;
  color: #9ab5ff;
}
.theme-option.active .theme-current { display: inline; }
.theme-preview {
  display: grid;
  grid-template-rows: 10px 18px 18px;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.theme-preview i {
  display: block;
  border-radius: 6px;
  background: rgba(255,255,255,0.16);
}
.theme-preview.classic {
  background: #f5f7fb;
}
.theme-preview.classic i:nth-child(1) { background: #cad5ec; }
.theme-preview.classic i:nth-child(2),
.theme-preview.classic i:nth-child(3) { background: #ffffff; }
.theme-preview.modern {
  background: #edf2ff;
}
.theme-preview.modern i:nth-child(1) { background: #8aa7ff; }
.theme-preview.modern i:nth-child(2),
.theme-preview.modern i:nth-child(3) { background: #ffffff; border-radius: 999px; }
.theme-preview.dark {
  background: #0f172a;
}
.theme-preview.dark i:nth-child(1) { background: #293a5f; }
.theme-preview.dark i:nth-child(2),
.theme-preview.dark i:nth-child(3) { background: #172235; }

body[data-theme="classic"] {
  background: #eef2f7;
}
body[data-theme="classic"] .dashboard-metric,
body[data-theme="classic"] .inventory-table-card,
body[data-theme="classic"] .inventory-toolbar,
body[data-theme="classic"] .form-shell,
body[data-theme="classic"] .summary-card,
body[data-theme="classic"] .chart-card,
body[data-theme="classic"] .export-card,
body[data-theme="classic"] .settings-card,
body[data-theme="classic"] .diagnostic-inventory-view .list-section {
  border-radius: 10px !important;
}
body[data-theme="modern"] {
  background: linear-gradient(180deg, #ecf3ff, #f6f9ff 240px);
}
body[data-theme="modern"] .dashboard-metric,
body[data-theme="modern"] .inventory-table-card,
body[data-theme="modern"] .inventory-toolbar,
body[data-theme="modern"] .form-shell,
body[data-theme="modern"] .summary-card,
body[data-theme="modern"] .chart-card,
body[data-theme="modern"] .export-card,
body[data-theme="modern"] .settings-card,
body[data-theme="modern"] .diagnostic-inventory-view .list-section {
  border-radius: 18px !important;
  box-shadow: 0 14px 30px rgba(15,23,42,.12) !important;
}
body[data-theme="dark"] {
  background: #0b1220;
}
body[data-theme="dark"] .brandbar,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .inventory-view,
body[data-theme="dark"] .admin-inventory-view,
body[data-theme="dark"] .dashboard-home,
body[data-theme="dark"] .inventory-toolbar,
body[data-theme="dark"] .inventory-table-card,
body[data-theme="dark"] .dashboard-metric,
body[data-theme="dark"] .chart-card,
body[data-theme="dark"] .summary-card,
body[data-theme="dark"] .form-shell,
body[data-theme="dark"] .export-card {
  box-shadow: none;
}

@media (max-width: 900px) {
  .theme-options {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .settings-card h3 {
    font-size: 1.35rem;
  }
}

/* Correctif thèmes complets v2 */
html[data-theme="classic"], html[data-theme="modern"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* CLASSIQUE : fond clair, tableaux clairs, menu sombre */
html[data-theme="classic"] body {
  --theme-page: #eef2f7;
  --theme-panel: #ffffff;
  --theme-panel-alt: #f6f8fb;
  --theme-text: #111827;
  --theme-muted: #64748b;
  --theme-border: #cbd5e1;
  --theme-accent: #3159d8;
  background: var(--theme-page) !important;
  color: var(--theme-text) !important;
}
html[data-theme="classic"] .app-main,
html[data-theme="classic"] .dashboard-home,
html[data-theme="classic"] .inventory-view,
html[data-theme="classic"] .admin-inventory-view {
  background: var(--theme-page) !important;
  color: var(--theme-text) !important;
}
html[data-theme="classic"] .dashboard-titlebar h2,
html[data-theme="classic"] .inventory-view-header h2,
html[data-theme="classic"] .stats-heading h2,
html[data-theme="classic"] .section-title h2,
html[data-theme="classic"] .section-title h3 {
  color: #244bc1 !important;
}
html[data-theme="classic"] .dashboard-titlebar p,
html[data-theme="classic"] .inventory-view-header p,
html[data-theme="classic"] .stats-heading p,
html[data-theme="classic"] .section-title p,
html[data-theme="classic"] .meta {
  color: var(--theme-muted) !important;
}
html[data-theme="classic"] .inventory-toolbar,
html[data-theme="classic"] .inventory-table-card,
html[data-theme="classic"] .form-shell,
html[data-theme="classic"] .dashboard-panel,
html[data-theme="classic"] .dashboard-search,
html[data-theme="classic"] .chart-card,
html[data-theme="classic"] .summary-card,
html[data-theme="classic"] .export-card,
html[data-theme="classic"] .settings-card,
html[data-theme="classic"] .diagnostic-inventory-view .list-section,
html[data-theme="classic"] .journal-toolbar {
  background: var(--theme-panel) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: 0 3px 12px rgba(15,23,42,.08) !important;
}
html[data-theme="classic"] .settings-card h3,
html[data-theme="classic"] .export-card h3,
html[data-theme="classic"] .dashboard-panel h3,
html[data-theme="classic"] .chart-card h3 { color: #244bc1 !important; }
html[data-theme="classic"] .settings-card p,
html[data-theme="classic"] .export-card p,
html[data-theme="classic"] .dashboard-panel p,
html[data-theme="classic"] .chart-card p { color: var(--theme-muted) !important; }
html[data-theme="classic"] .inventory-table,
html[data-theme="classic"] .inventory-table thead,
html[data-theme="classic"] .inventory-table tbody,
html[data-theme="classic"] .inventory-table-footer { background: var(--theme-panel) !important; color: var(--theme-text) !important; }
html[data-theme="classic"] .inventory-table th {
  background: #e8edf5 !important;
  color: #1e293b !important;
  border-color: var(--theme-border) !important;
}
html[data-theme="classic"] .inventory-table td {
  background: #ffffff !important;
  color: #111827 !important;
  border-color: #d7dee8 !important;
}
html[data-theme="classic"] .inventory-table tbody tr:nth-child(even) td { background: #f5f7fa !important; }
html[data-theme="classic"] .inventory-table .table-sort { color: #1e293b !important; }
html[data-theme="classic"] .diagnostic-file,
html[data-theme="classic"] .backup-item,
html[data-theme="classic"] .journal-entry {
  background: #fff !important;
  color: #111827 !important;
  border-color: var(--theme-border) !important;
}
html[data-theme="classic"] .diagnostic-file:nth-child(even),
html[data-theme="classic"] .backup-item:nth-child(even),
html[data-theme="classic"] .journal-entry:nth-child(even) { background: #f6f8fb !important; }
html[data-theme="classic"] input,
html[data-theme="classic"] select,
html[data-theme="classic"] textarea,
html[data-theme="classic"] .file-picker {
  background: #fff !important;
  color: #111827 !important;
  border-color: #b8c4d4 !important;
}
html[data-theme="classic"] .settings-note {
  background: #f2f5fa !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}
html[data-theme="classic"] .appearance-card .theme-option {
  background: #f8fafc !important;
  color: #111827 !important;
  border-color: #cbd5e1 !important;
}
html[data-theme="classic"] .appearance-card .theme-option small { color: #64748b !important; }
html[data-theme="classic"] .danger-surface {
  background: #fff6f6 !important;
  color: #7f1d1d !important;
  border-color: #e4a8ad !important;
}
html[data-theme="classic"] .danger-surface h3 { color: #b91c1c !important; }
html[data-theme="classic"] .danger-surface p { color: #7f1d1d !important; }
html[data-theme="classic"] .settings-warning { background: #feecef !important; color: #991b1b !important; border-color: #efb2b8 !important; }
html[data-theme="classic"] .settings-checkbox,
html[data-theme="classic"] .settings-field { color: #111827 !important; }

/* MODERNE : clair bleuté et cartes plus douces */
html[data-theme="modern"] body {
  --theme-page: #eaf0ff;
  --theme-panel: rgba(255,255,255,.92);
  --theme-text: #17203a;
  --theme-muted: #65708e;
  --theme-border: #c3d0ef;
  background: linear-gradient(135deg, #e7edff 0%, #f5f8ff 48%, #e9f2ff 100%) fixed !important;
  color: var(--theme-text) !important;
}
html[data-theme="modern"] .app-main,
html[data-theme="modern"] .dashboard-home,
html[data-theme="modern"] .inventory-view,
html[data-theme="modern"] .admin-inventory-view { background: transparent !important; color: var(--theme-text) !important; }
html[data-theme="modern"] .dashboard-titlebar h2,
html[data-theme="modern"] .inventory-view-header h2,
html[data-theme="modern"] .stats-heading h2,
html[data-theme="modern"] .section-title h2,
html[data-theme="modern"] .section-title h3 { color: #3659d9 !important; }
html[data-theme="modern"] .dashboard-titlebar p,
html[data-theme="modern"] .inventory-view-header p,
html[data-theme="modern"] .stats-heading p,
html[data-theme="modern"] .section-title p,
html[data-theme="modern"] .meta { color: var(--theme-muted) !important; }
html[data-theme="modern"] .inventory-toolbar,
html[data-theme="modern"] .inventory-table-card,
html[data-theme="modern"] .form-shell,
html[data-theme="modern"] .dashboard-panel,
html[data-theme="modern"] .dashboard-search,
html[data-theme="modern"] .chart-card,
html[data-theme="modern"] .summary-card,
html[data-theme="modern"] .export-card,
html[data-theme="modern"] .settings-card,
html[data-theme="modern"] .diagnostic-inventory-view .list-section,
html[data-theme="modern"] .journal-toolbar {
  background: var(--theme-panel) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  border-radius: 20px !important;
  box-shadow: 0 14px 32px rgba(59,82,150,.14) !important;
  backdrop-filter: blur(10px);
}
html[data-theme="modern"] .inventory-table-card { overflow: hidden; }
html[data-theme="modern"] .inventory-table th { background: #dbe5ff !important; color: #22335f !important; border-color: #bdcbea !important; }
html[data-theme="modern"] .inventory-table td { background: rgba(255,255,255,.96) !important; color: #17203a !important; border-color: #d7e0f3 !important; }
html[data-theme="modern"] .inventory-table tbody tr:nth-child(even) td { background: #f2f5ff !important; }
html[data-theme="modern"] .inventory-table .table-sort { color: #22335f !important; }
html[data-theme="modern"] .diagnostic-file,
html[data-theme="modern"] .backup-item,
html[data-theme="modern"] .journal-entry { background: #fff !important; color: #17203a !important; border-color: #d2dcf2 !important; }
html[data-theme="modern"] .diagnostic-file:nth-child(even),
html[data-theme="modern"] .backup-item:nth-child(even),
html[data-theme="modern"] .journal-entry:nth-child(even) { background: #f1f5ff !important; }
html[data-theme="modern"] input,
html[data-theme="modern"] select,
html[data-theme="modern"] textarea,
html[data-theme="modern"] .file-picker { background: #fff !important; color: #17203a !important; border-color: #b9c7e8 !important; border-radius: 12px !important; }
html[data-theme="modern"] .settings-card h3,
html[data-theme="modern"] .export-card h3 { color: #3659d9 !important; }
html[data-theme="modern"] .settings-card p,
html[data-theme="modern"] .export-card p { color: #65708e !important; }
html[data-theme="modern"] .settings-note { background: #edf2ff !important; color: #38466a !important; border-color: #c3d0ef !important; }
html[data-theme="modern"] .appearance-card .theme-option { background: #f6f8ff !important; color: #17203a !important; border-color: #becbec !important; border-radius: 16px !important; }
html[data-theme="modern"] .appearance-card .theme-option small { color: #65708e !important; }
html[data-theme="modern"] .danger-surface { background: linear-gradient(135deg,#fff4f5,#ffedf0) !important; border-color: #e8abb2 !important; }
html[data-theme="modern"] .danger-surface h3 { color: #b42335 !important; }
html[data-theme="modern"] .danger-surface p { color: #7f3140 !important; }
html[data-theme="modern"] .settings-warning { background: #ffe8ec !important; color: #92263a !important; border-color: #e8abb2 !important; }
html[data-theme="modern"] .settings-checkbox,
html[data-theme="modern"] .settings-field { color: #17203a !important; }

/* SOMBRE : thème actuel réellement renforcé */
html[data-theme="dark"] body { background: #0b1220 !important; color: #f8fafc !important; }
html[data-theme="dark"] .app-main,
html[data-theme="dark"] .dashboard-home,
html[data-theme="dark"] .inventory-view,
html[data-theme="dark"] .admin-inventory-view { background: #101827 !important; color: #f8fafc !important; }
html[data-theme="dark"] .inventory-toolbar,
html[data-theme="dark"] .inventory-table-card,
html[data-theme="dark"] .form-shell,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .dashboard-search,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .export-card,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .diagnostic-inventory-view .list-section { background: #172235 !important; color: #f8fafc !important; border-color: #42516a !important; }
html[data-theme="dark"] .inventory-table th { background: #1e2b40 !important; color: #f8fafc !important; }
html[data-theme="dark"] .inventory-table td { background: #172235 !important; color: #f8fafc !important; }
html[data-theme="dark"] .inventory-table tbody tr:nth-child(even) td { background: #1c2a3e !important; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .file-picker { background: #202f45 !important; color: #f8fafc !important; border-color: #51617a !important; }

/* Correctif thème sombre : barre latérale et état replié */
html[data-theme="dark"] .sidebar {
  background: #111c2d !important;
  border-right-color: #34445d !important;
  color: #f8fafc !important;
  box-shadow: 8px 0 24px rgba(0, 0, 0, .18);
}
html[data-theme="dark"] .sidebar-header {
  border-bottom-color: #34445d !important;
}
html[data-theme="dark"] .sidebar h2 {
  color: #91a6c5 !important;
}
html[data-theme="dark"] .sidebar-toggle {
  background: #1b2a40 !important;
  color: #9db7ff !important;
  border-color: #465975 !important;
}
html[data-theme="dark"] .sidebar-toggle:hover {
  background: #263955 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .nav-item {
  background: transparent !important;
  color: #d9e3f1 !important;
}
html[data-theme="dark"] .nav-item:hover {
  background: #1b2a40 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .nav-item.active {
  background: #263b63 !important;
  color: #ffffff !important;
  border-right-color: #7297ff !important;
}
html[data-theme="dark"] .nav-icon {
  color: inherit !important;
}
html[data-theme="dark"] .version {
  color: #8094b1 !important;
  border-top-color: #34445d !important;
}
html[data-theme="dark"] .sidebar-overlay {
  background: rgba(3, 8, 18, .72) !important;
}
html[data-theme="dark"] body.sidebar-collapsed .sidebar {
  background: #111c2d !important;
}

/* Colonne Actions du stock placée en première position */
.stock-inventory-table .stock-actions-first {
  min-width: 84px;
  width: 84px;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .stock-inventory-table .stock-actions-first {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #1b283b;
    box-shadow: 4px 0 8px rgba(0,0,0,.18);
  }
  .stock-inventory-table thead .stock-actions-first {
    z-index: 6;
    background: #172235;
  }
  body[data-theme="classic"] .stock-inventory-table .stock-actions-first { background: #fff; }
  body[data-theme="classic"] .stock-inventory-table thead .stock-actions-first { background: #e9eef7; }
  body[data-theme="modern"] .stock-inventory-table .stock-actions-first { background: #f7f9ff; }
  body[data-theme="modern"] .stock-inventory-table thead .stock-actions-first { background: #e7edff; }
}


/* Colonnes Actions placées en première position dans Paloxs et Catégories */
.inventory-table .actions-first {
  min-width: 84px;
  width: 84px;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .inventory-table .actions-first {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #1b283b;
    box-shadow: 4px 0 8px rgba(0,0,0,.18);
  }
  .inventory-table thead .actions-first {
    z-index: 6;
    background: #172235;
  }
  body[data-theme="classic"] .inventory-table .actions-first { background: #fff; }
  body[data-theme="classic"] .inventory-table thead .actions-first { background: #e9eef7; }
  body[data-theme="modern"] .inventory-table .actions-first { background: #f7f9ff; }
  body[data-theme="modern"] .inventory-table thead .actions-first { background: #e7edff; }
}
