/* ============================================================
   Dubo Inventaire — Espace Client v4.0
   Design system aligned with maquette proto
   ============================================================ */

/* L'attribut [hidden] doit toujours masquer, y compris les éléments dont une
   classe impose display:grid/flex (gating de permissions RBAC côté SPA). */
[hidden] { display: none !important; }

:root {
  --blue-950: #002e5d;
  --blue-900: #0f3f78;
  --blue-800: #232d56;
  --blue-100: #eaf2ff;
  --orange-500: #f9b233;
  --orange-600: #ea492e;
  --green-500: #0f9f57;
  --yellow-100: #fff4cf;
  --ink-950: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --line: #d7e2f2;
  --paper: #ffffff;
  --paper-soft: #f7faff;
  --shadow-soft: 0 10px 24px rgba(0, 46, 93, 0.08);
  --shadow-strong: 0 20px 45px rgba(0, 46, 93, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink-950);
  background: radial-gradient(circle at 10% 10%, #edf4ff, #ffffff 45%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ---------- Layout ---------- */

.container {
  width: min(1220px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ---------- Top stripe ---------- */

.top-stripe {
  height: 8px;
  background: linear-gradient(90deg, var(--blue-950) 0%, var(--blue-800) 55%, var(--orange-500) 100%);
}

/* ---------- Header ---------- */

.app-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(0, 46, 93, 0.12);
  box-shadow: 0 6px 16px rgba(0, 46, 93, 0.05);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: var(--shadow-soft);
}

.brand strong {
  color: var(--blue-950);
  display: block;
  line-height: 1.1;
  font-size: 1.1rem;
}

.brand span {
  color: var(--orange-600);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-chip {
  color: var(--blue-950);
  padding: 0.35rem 0;
  font-size: 0.86rem;
  font-weight: 400;
}

/* ---------- Buttons ---------- */

.btn,
.button,
button {
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 1.05rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
}

.btn-primary,
.button.primary,
button.primary {
  background: var(--orange-500);
  color: var(--blue-950);
}

.btn-secondary,
.button.secondary,
button.secondary {
  background: #fff;
  color: var(--blue-950);
  border: 1px solid #bad0f1;
}

.btn-danger {
  background: #ffe6e2;
  color: #9d2b11;
  border: 1px solid #ffc6bb;
}

/* ---------- Landing ---------- */

.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.landing-grid {
  width: min(980px, 100%);
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-strong);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--orange-600);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-card h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.hero-copy {
  margin: 1rem 0 0;
  max-width: 720px;
  color: var(--ink-700);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.hero-list {
  display: grid;
  gap: 0.45rem;
  margin: 1.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-700);
}

/* ---------- Promo banner ---------- */

.promo {
  margin-top: 0.9rem;
  border: 1px solid #ffd38a;
  background: linear-gradient(120deg, #fff5df, #fff8f0);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.promo strong {
  color: var(--blue-950);
}

.promo p {
  margin: 0.25rem 0 0;
  color: #7a5b2d;
}

/* ---------- Module navigation (7-module grid) ---------- */

.module-nav {
  margin-top: 1rem;
  position: relative;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.module-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
}

.module-link {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid #bfd4f3;
  background: linear-gradient(160deg, #ffffff, #f2f7ff);
  color: var(--blue-950);
  box-shadow: 0 4px 10px rgba(0, 46, 93, 0.08);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 46, 93, 0.16);
}

.module-link.is-active {
  border-color: #f0b444;
  color: #fff;
  background: linear-gradient(130deg, var(--blue-950), var(--blue-800));
}

/* ---------- Page layout ---------- */

.shell {
  width: min(1240px, calc(100% - 2rem));
  margin-inline: auto;
  padding: 1.25rem 0 2.5rem;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.brand-block {
  display: grid;
  align-content: center;
  min-height: 184px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffffff 0%, #edf4ff 100%);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}

.brand-block .page-title {
  margin: 0.25rem 0 0;
  color: var(--blue-950);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.98;
}

.brand-block .subtle {
  max-width: 720px;
  margin: 0.85rem 0 0;
  color: var(--ink-700);
  line-height: 1.5;
}

.surface {
  background: rgba(255, 255, 255, 0.96);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.hero-panel h2,
.hero-panel h3,
.view h3 {
  margin: 0.2rem 0 0;
  color: var(--blue-950);
}

.hero-panel .hero-copy {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.hero-panel > aside.panel {
  background: #f8fbff;
  box-shadow: none;
}

.hero-panel > aside.panel .form-grid {
  grid-template-columns: 1fr;
}

.hero-panel > aside.panel .inline-actions {
  margin-top: 0.9rem;
}

.hero-panel > aside.panel button {
  justify-content: center;
  width: 100%;
}

.nav-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding: 0.65rem;
}

.tab-button {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid #bfd4f3;
  background: #fff;
  color: var(--blue-950);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.tab-button.active {
  border-color: var(--blue-950);
  background: var(--blue-950);
  color: #fff;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.view.panel {
  margin-bottom: 1rem;
}

.grid.two {
  grid-template-columns: minmax(0, 0.8fr) minmax(360px, 1.2fr);
  align-items: start;
}

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

.page {
  padding-bottom: 2rem;
}

.page-title {
  margin-top: 1.2rem;
  margin-bottom: 0.7rem;
}

.page-title h1 {
  margin: 0;
  font-size: 1.7rem;
  color: var(--blue-950);
}

.page-title p {
  margin: 0.35rem 0 0;
  color: var(--ink-700);
}

/* ---------- Grid system ---------- */

.grid {
  display: grid;
  gap: 0.95rem;
}

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

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

/* ---------- Cards ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.card h2,
.card h3 {
  margin-top: 0;
  color: var(--blue-950);
}

.card p,
.card li,
.card td,
.card th,
.card label,
.card input,
.card select,
.card textarea {
  font-size: 0.92rem;
}

.card p,
.card li {
  color: var(--ink-700);
}

/* ---------- Typography helpers ---------- */

.subtle {
  color: var(--ink-500);
  font-size: 0.86rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--orange-600);
}

/* ---------- List ---------- */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.list li {
  padding: 0.3rem 0;
  color: var(--ink-700);
}

/* ---------- KPI ---------- */

.kpi {
  border: 1px solid #c8ddff;
  background: linear-gradient(145deg, #ffffff, #f1f7ff);
  border-radius: var(--radius-sm);
  padding: 0.82rem;
}

.kpi strong {
  display: block;
  color: var(--blue-950);
  font-size: 1.3rem;
}

.kpi span {
  display: block;
  margin-top: 0.18rem;
  color: var(--ink-700);
  font-size: 0.84rem;
}

/* ---------- Filters ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: end;
}

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

/* ---------- Forms ---------- */

label {
  display: grid;
  gap: 0.32rem;
  color: var(--blue-950);
  font-weight: 600;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdd3f4;
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  font: inherit;
  background: #fff;
  color: var(--ink-950);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #9bc0f7;
  border-color: #6898e4;
}

/* ---------- Table ---------- */

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue-950);
}

tr:last-child td {
  border-bottom: none;
}

/* ---------- Status pills ---------- */

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.status.done {
  background: #dcf8ea;
  border: 1px solid #7dd6a9;
  color: #0e7a45;
}

.status.waiting {
  background: #fff7df;
  border: 1px solid #ffd27e;
  color: #8c5f12;
}

/* Legacy pill class */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(0, 46, 93, 0.1);
  color: var(--blue-950);
}

.pill.success {
  background: #dcf8ea;
  color: #0e7a45;
}

.pill.warning {
  background: #fff7df;
  color: #8c5f12;
}

.pill.danger {
  background: #ffe6e2;
  color: #9d2b11;
}

/* ---------- Legend ---------- */

.legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px dashed #f1c04f;
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  background: var(--yellow-100);
  color: #7d550a;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ---------- Actions ---------- */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.action-pill {
  border-radius: 999px;
  border: 1px solid #bfd4f3;
  background: #f7fbff;
  color: var(--blue-950);
  padding: 0.22rem 0.54rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease;
}

.action-pill:hover {
  background: #e0ecff;
}

/* ---------- Empty state ---------- */

.empty {
  border: 1px dashed #bfd4f3;
  background: #f8fbff;
  border-radius: 12px;
  padding: 1rem;
  color: var(--ink-700);
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--ink-500);
}

/* ---------- Footer ---------- */

.footer {
  margin-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 0.82rem;
  padding: 1rem 0 2rem;
  text-align: center;
}

/* ---------- Form grid ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.inline-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

/* ---------- Login ---------- */

.login-shell {
  min-height: calc(100vh - 8px);
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.login-card {
  width: min(520px, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}

.login-head {
  background: linear-gradient(130deg, var(--blue-950), var(--blue-800));
  color: #fff;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.login-head img {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.login-body {
  padding: 1rem;
}

.login-note {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  color: var(--ink-500);
}

/* ---------- Notice ---------- */

.notice {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: #f3f8ff;
  border: 1px solid var(--line);
  color: var(--ink-700);
}

.notice.error {
  border-color: #ffc6bb;
  color: #9d2b11;
  background: #fff5f3;
}

.notice.success {
  border-color: #7dd6a9;
  color: #0e7a45;
  background: #f0faf5;
}

/* ---------- Metric stack (legacy compat) ---------- */

.metric-stack {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  color: var(--ink-500);
  font-size: 0.82rem;
}

.metric-row strong {
  color: var(--blue-950);
  text-align: right;
}

/* ---------- Animations ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section.view {
  display: none;
}

section.view.active {
  display: block;
  animation: rise 260ms ease;
}

/* ---------- Responsive ---------- */

@media (max-width: 1160px) {
  .module-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar,
  .hero-panel,
  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .shell {
    width: min(100% - 1rem, 1240px);
    padding-top: 0.75rem;
  }

  .brand-block {
    min-height: auto;
  }

  .brand img {
    width: 48px;
    height: 48px;
  }

  .header-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .session-info {
    justify-content: flex-start;
  }

  .grid-3,
  .grid-2,
  .grid.two,
  .filters,
  .filters.two,
  .form-grid,
  .form-grid.cols-2 {
    grid-template-columns: 1fr;
  }

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

  .module-link {
    min-height: 44px;
  }
}

/* ============================================================
   Ajustements revue graphique — juillet 2026
   (voir MODIFICATIONS.md : A2, A3, A6, F2, G1, G2)
   ============================================================ */

.btn-ghost {
  background: transparent;
  color: var(--blue-950);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(0, 46, 93, 0.08);
  transform: none;
}

.promo-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.promo-close {
  background: transparent;
  border: 0;
  color: #7a5b2d;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.promo-close:hover {
  background: rgba(122, 91, 45, 0.14);
  transform: none;
}

.results-count {
  margin: 0;
  align-self: end;
  justify-self: end;
  padding-bottom: 0.6rem;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.results-count strong {
  color: var(--blue-950);
  font-size: 1.05rem;
}

.infos-grid {
  grid-template-columns: 1fr;
  max-width: 760px;
}

.login-backoffice {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.8rem;
}

.login-backoffice a {
  color: var(--ink-500);
  text-decoration: underline;
}

.login-backoffice a:hover {
  color: var(--blue-950);
}
