/* ==========================================================================
   Logisticiel — design system maison (aucun framework CSS).
   Identité volontairement distincte de GoldCompta : palette pétrole/ambre,
   Plus Jakarta Sans, coquille app "sidebar" plutôt que navbar top classique.
   ========================================================================== */

:root {
  --lgc-bg: #f4f5f7;
  --lgc-surface: #ffffff;
  --lgc-border: #e3e6eb;
  --lgc-text: #16202b;
  --lgc-text-muted: #667085;
  --lgc-primary: #133b4f;
  --lgc-primary-dark: #0c2733;
  --lgc-primary-soft: #e6edf0;
  --lgc-accent: #ff7a3d;
  --lgc-accent-dark: #e0632a;
  --lgc-success: #17845a;
  --lgc-success-soft: #e4f5ec;
  --lgc-danger: #d3352f;
  --lgc-danger-soft: #fbe9e8;
  --lgc-warning: #b8710a;
  --lgc-warning-soft: #fdf1e0;
  --lgc-info: #1c7fb8;
  --lgc-info-soft: #e5f3fa;
  --lgc-radius: 10px;
  --lgc-radius-sm: 6px;
  --lgc-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --lgc-shadow-md: 0 6px 20px rgba(16, 24, 40, .08);
  --lgc-sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14.5px;
  color: var(--lgc-text);
  background: var(--lgc-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
a { color: var(--lgc-primary); text-decoration: none; }
a:hover { color: var(--lgc-accent-dark); }
p { margin: 0 0 .5rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--lgc-sidebar-w);
  background: var(--lgc-primary-dark);
  color: #cfe0e6;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .2s ease;
}
.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.25rem 1.25rem 1rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
}
.app-sidebar__brand svg { flex-shrink: 0; color: var(--lgc-accent); }
.app-sidebar__nav { flex: 1; overflow-y: auto; padding: .5rem .75rem; }
.app-nav-group-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6f8b96;
  padding: .9rem .6rem .3rem;
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .65rem;
  border-radius: var(--lgc-radius-sm);
  color: #cfe0e6;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: .1rem;
}
.app-nav-link svg { flex-shrink: 0; opacity: .85; }
.app-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav-link.is-active { background: var(--lgc-accent); color: #fff; }
.app-nav-link.is-active svg { opacity: 1; }
.app-sidebar__foot { padding: .75rem 1.25rem 1rem; font-size: .72rem; color: #5f7d88; }

.app-main { flex: 1; margin-left: var(--lgc-sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--lgc-surface);
  border-bottom: 1px solid var(--lgc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  gap: 1rem;
}
.app-topbar__title { font-size: 1.05rem; font-weight: 700; }
.app-topbar__actions { display: flex; align-items: center; gap: .75rem; }
.app-menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer; color: var(--lgc-text);
  padding: .35rem;
}

.app-content { padding: 1.75rem; max-width: 1180px; width: 100%; margin: 0 auto; }

.app-sidebar-backdrop { display: none; }

@media (max-width: 960px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--lgc-shadow-md); }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .app-menu-toggle { display: inline-flex; }
  .app-sidebar-backdrop.is-open {
    display: block; position: fixed; inset: 0; background: rgba(12,20,26,.45); z-index: 39;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .95rem;
  border-radius: var(--lgc-radius-sm);
  border: 1px solid transparent;
  font-size: .87rem; font-weight: 600;
  cursor: pointer;
  background: var(--lgc-surface);
  color: var(--lgc-text);
  line-height: 1.3;
}
.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--lgc-accent); color: #fff; }
.btn-primary:hover { background: var(--lgc-accent-dark); color: #fff; }
.btn-secondary { background: var(--lgc-primary-soft); color: var(--lgc-primary); }
.btn-outline { background: transparent; border-color: var(--lgc-border); color: var(--lgc-text); }
.btn-danger { background: var(--lgc-danger-soft); color: var(--lgc-danger); }
.btn-danger:hover { background: var(--lgc-danger); color: #fff; }
.btn-sm { padding: .3rem .65rem; font-size: .78rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-link { background: none; border: none; padding: 0; color: var(--lgc-primary); font-weight: 600; cursor: pointer; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .35rem; color: var(--lgc-text); }
.field .hint { display: block; font-size: .76rem; color: var(--lgc-text-muted); margin-top: .3rem; }
.input, .select, .textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--lgc-border);
  border-radius: var(--lgc-radius-sm);
  font-size: .88rem;
  font-family: inherit;
  background: var(--lgc-surface);
  color: var(--lgc-text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--lgc-primary);
  box-shadow: 0 0 0 3px var(--lgc-primary-soft);
}
.textarea { resize: vertical; }
.check-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; }
.check-row input { width: 16px; height: 16px; accent-color: var(--lgc-accent); }
fieldset { border: none; padding: 0; margin: 0; }
fieldset[disabled] .input, fieldset[disabled] .select { background: var(--lgc-bg); color: var(--lgc-text-muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--lgc-surface);
  border: 1px solid var(--lgc-border);
  border-radius: var(--lgc-radius);
  box-shadow: var(--lgc-shadow-sm);
}
.card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--lgc-border);
  font-weight: 700;
  font-size: .95rem;
}
.card__body { padding: 1.25rem; }

.stat-card { padding: 1.1rem 1.25rem; }
.stat-card__label { font-size: .78rem; color: var(--lgc-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-card__value { font-size: 1.6rem; font-weight: 700; margin-top: .3rem; }
.stat-card__sub { font-size: .78rem; color: var(--lgc-text-muted); margin-top: .15rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--lgc-surface); border: 1px solid var(--lgc-border); border-radius: var(--lgc-radius); }
table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { padding: .7rem 1rem; text-align: left; font-size: .86rem; }
table.table thead th {
  background: var(--lgc-bg);
  color: var(--lgc-text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--lgc-border);
}
table.table tbody tr { border-bottom: 1px solid var(--lgc-border); }
table.table tbody tr:last-child { border-bottom: none; }
table.table tbody tr:hover { background: var(--lgc-bg); }
.text-end { text-align: right; }
.text-center { text-align: center; }
.empty-row { padding: 2.5rem 1rem; text-align: center; color: var(--lgc-text-muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .74rem; font-weight: 700;
  background: var(--lgc-primary-soft); color: var(--lgc-primary);
}
.badge-success { background: var(--lgc-success-soft); color: var(--lgc-success); }
.badge-danger { background: var(--lgc-danger-soft); color: var(--lgc-danger); }
.badge-warning { background: var(--lgc-warning-soft); color: var(--lgc-warning); }
.badge-info { background: var(--lgc-info-soft); color: var(--lgc-info); }
.badge-neutral { background: #eef0f2; color: var(--lgc-text-muted); }

/* ---------- Alerts / flash ---------- */
.alert {
  position: relative;
  padding: .75rem 2.5rem .75rem 1rem;
  border-radius: var(--lgc-radius-sm);
  font-size: .86rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--lgc-success-soft); color: var(--lgc-success); border-color: #bfe6d3; }
.alert-danger { background: var(--lgc-danger-soft); color: var(--lgc-danger); border-color: #f3c3c0; }
.alert-warning { background: var(--lgc-warning-soft); color: var(--lgc-warning); border-color: #f3ddb0; }
.alert-info { background: var(--lgc-info-soft); color: var(--lgc-info); border-color: #bfe0f0; }
.alert__close {
  position: absolute; top: .5rem; right: .6rem;
  background: none; border: none; cursor: pointer; color: inherit; opacity: .6;
  font-size: 1rem; line-height: 1;
}
.alert__close:hover { opacity: 1; }

/* ---------- Dropdown (entreprise switcher, user menu) ---------- */
.dropdown { position: relative; }
.dropdown-trigger { display: flex; align-items: center; gap: .4rem; cursor: pointer; background: none; border: none; font: inherit; color: var(--lgc-text); padding: .3rem .5rem; border-radius: var(--lgc-radius-sm); }
.dropdown-trigger:hover { background: var(--lgc-bg); }
.dropdown-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--lgc-surface);
  border: 1px solid var(--lgc-border);
  border-radius: var(--lgc-radius-sm);
  box-shadow: var(--lgc-shadow-md);
  min-width: 200px;
  padding: .4rem;
  z-index: 50;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: .5rem .6rem; border-radius: var(--lgc-radius-sm);
  background: none; border: none; font: inherit; color: var(--lgc-text); cursor: pointer;
  font-size: .85rem;
}
.dropdown-item:hover { background: var(--lgc-bg); }
.dropdown-item.is-active { font-weight: 700; color: var(--lgc-primary); }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: .35rem; } .gap-2 { gap: .6rem; } .gap-3 { gap: 1rem; }
.stack > * + * { margin-top: .85rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: .85rem; }
.mb-3 { margin-bottom: 1.25rem; } .mb-4 { margin-bottom: 1.75rem; }
.mt-3 { margin-top: 1.25rem; } .mt-4 { margin-top: 1.75rem; }
.text-muted { color: var(--lgc-text-muted); }
.text-sm { font-size: .8rem; }
.w-full { width: 100%; }
.grid { display: grid; gap: 1rem; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; } }
.max-w-sm { max-width: 420px; }
.max-w-md { max-width: 560px; }
.max-w-lg { max-width: 680px; }
