/* ═══════════════════════════════════════════════════════
   ERM Core — « Le Registre » layout primitives and motion
   Loaded by every base layout after variables.css and components.css.
   ═══════════════════════════════════════════════════════ */

/* ─── Motion ─── */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mre-fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mre-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mre-scaleIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(184, 53, 43, 0.35); } 100% { box-shadow: 0 0 0 8px rgba(184, 53, 43, 0); } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Page-level containers fade only: a translateY on the whole page overflows
   the viewport for the length of the animation and flashes a scrollbar. */
.container, .portal-main, .home-main, .main-content, .login-wrap { animation: fade 0.3s ease both; }

/* ─── Type ─── */
.eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow-sm { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.display {
  font: 400 24px/1.08 var(--serif);
  letter-spacing: -0.015em;
  text-wrap: pretty;
  color: var(--ink);
}
.display-sm { font: 400 18px/1.1 var(--serif); letter-spacing: -0.01em; color: var(--ink); }
.serif { font-family: var(--serif); font-weight: 400; }
.serif-label { font: 400 14px/1.2 var(--serif); color: var(--ink); }
.lede { font-size: 14px; color: var(--ink-muted); margin-top: 8px; line-height: 1.55; max-width: 640px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font: 400 24px/1 var(--serif); color: var(--ink); }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--bad); }

/* ─── Stat strip ─── */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  margin: 24px 0 20px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  align-items: flex-end;
}
.stat .num { display: block; }
.stat .stat-label { font-size: 13px; color: var(--ink-muted); margin-top: 6px; }
.stat.ok .num, .stat.ok .stat-label { color: var(--ok); }
.stat.warn .num, .stat.warn .stat-label { color: var(--warn); }
.stat.bad .num, .stat.bad .stat-label { color: var(--bad); }
.stat-strip .stat-tools { margin-left: auto; align-self: flex-end; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ─── Segmented control ─── */
.seg {
  display: inline-flex;
  border: 1px solid rgba(28, 27, 24, 0.25);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  background: rgba(255, 255, 255, 0.4);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.seg-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.seg-btn:hover { background: rgba(28, 27, 24, 0.06); }
.seg-btn.active { background: var(--ink); color: var(--paper); }

/* ─── Sort bar (kept for the dashboard list) ─── */
.sort-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); }
.sort-bar .sort-label { margin-right: 4px; }
.sort-btn {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
}
.sort-btn:hover { color: var(--ink); }
.sort-btn.active { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sort-bar .sort-sep { opacity: 0.5; }

/* ─── Lifeline: Déposé → Notifié → Remis ─── */
.lifeline { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lifeline-track { display: flex; align-items: center; }
.lifeline .d { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.lifeline .l { flex: 1; height: 1px; background: var(--off); }
.lifeline .on { background: var(--ink); }
.lifeline .bad { background: var(--bad); }
.lifeline .d.bad { box-shadow: 0 0 0 3px rgba(184, 53, 43, 0.2); }
.lifeline .d.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(138, 90, 18, 0.18); }
.lifeline-caps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.lifeline-caps > span { min-width: 0; }
.lifeline-caps > span:nth-child(2) { text-align: center; }
.lifeline-caps > span:last-child { text-align: right; }
.lifeline-caps .bad { color: var(--bad); background: none; }

/* ─── List rows ─── */
.list { display: flex; flex-direction: column; }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px 160px;
  gap: 18px;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-light);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}
.list-row:hover { background: rgba(255, 255, 255, 0.55); }
.list-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .status { justify-content: flex-end; font-size: 14px; line-height: 1.25; white-space: normal; text-align: right; }

/* ─── Table-like grids ─── */
.tbl-head {
  display: grid;
  gap: 16px;
  padding: 0 8px 8px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--rule);
}
.tbl-row {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
a.tbl-row:hover { background: rgba(255, 255, 255, 0.55); }
.tbl-row .num-sm { font: 400 14px/1 var(--serif); }

/* ─── Kanban ─── */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.kanban-col {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.3);
  min-height: 160px;
}
.kanban-col.bad { border-color: var(--bad-border); background: var(--bad-bg); }
.kanban-col.ok { border-color: var(--ok-border); background: var(--ok-bg); }
.kanban-col.warn { border-color: var(--warn-border); background: rgba(255, 255, 255, 0.3); }
.kanban-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; }
.kanban-head .serif-label { font-size: 14px; }
.kanban-head .kanban-count { font: 400 16px/1 var(--serif); }
.kanban-col.bad .kanban-head { color: var(--bad); }
.kanban-col.ok .kanban-head { color: var(--ok); }
.kanban-col.warn .kanban-head { color: var(--warn); }
.kanban-col .kanban-head .serif-label { color: inherit; }
.kanban-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow 0.2s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card .kanban-tag { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kanban-card .kanban-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.kanban-card .kanban-meta { font-size: 12.5px; color: var(--ink-muted); }
.kanban-card .kanban-action {
  margin-top: 8px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.kanban-note { margin-top: auto; font-size: 12px; line-height: 1.45; color: var(--ink-muted); padding: 4px 2px 0; }
.kanban-empty { font: 400 13px var(--serif); color: var(--ink-faint); padding: 8px 2px; }

/* ─── Rails ─── */
.rail { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 40px; align-items: start; }
.rail-wide { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
.rail-l { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.rail-aside { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Cards ─── */
.paper-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.cta-card {
  display: block;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 26px 24px;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s;
}
.cta-card:hover { transform: translateY(-2px); color: var(--paper); }
.cta-card .cta-title { font: 400 18px/1.1 var(--serif); letter-spacing: -0.01em; }
.cta-card .cta-text { font-size: 13px; opacity: 0.65; margin-top: 10px; line-height: 1.45; }
.cta-card .cta-foot { margin-top: 22px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cta-card .cta-foot .cta-arrow { font-size: 20px; }
.quiet-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}
.quiet-card:hover { background: #fff; }
.quiet-card .quiet-title { font: 400 14px/1.15 var(--serif); }
.quiet-card .quiet-text { font-size: 12.5px; color: var(--ink-muted); margin-top: 6px; line-height: 1.45; }
.ink-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.5;
}
.ink-card .serif-label { color: inherit; font-size: 14px; }
.ink-card .num { color: inherit; font-size: 18px; line-height: 1.2; }
.ink-card .muted { opacity: 0.6; }

/* ─── Dashed drop zone ─── */
.dropzone {
  border: 1.5px dashed rgba(28, 27, 24, 0.3);
  border-radius: var(--radius);
  padding: 22px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.dropzone:hover, .dropzone.over { border-color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.dropzone .dz-title { font: 400 14px var(--serif); }
.dropzone .dz-text { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1.5px dashed rgba(28, 27, 24, 0.3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.3);
}
.empty-state .empty-title { font: 400 16px var(--serif); color: var(--ink); }
.empty-state .empty-text { font-size: 14px; color: var(--ink-muted); margin-top: 8px; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 20px 14px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  box-shadow: 0 20px 40px -16px rgba(28, 27, 24, 0.6);
  animation: toastin 0.3s ease both;
  z-index: 300;
  max-width: 520px;
}

/* ─── Steps (numbered serif discs) ─── */
.disc {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font: 400 13px var(--serif);
}
.disc.hollow { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

/* ─── Responsive ─── */
@media (max-width: 1180px) {
  .rail, .rail-wide, .rail-l, .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .display { font-size: 22px; }
  .list-row { grid-template-columns: minmax(0, 1fr) 100px; }
  .list-row > .lifeline { display: none; }
  .stat-strip { gap: 22px; }
}

/* ─── Print ─── */
@media print {
  body { background: #fff !important; }
  .header { position: static; box-shadow: none; }
  * { animation: none !important; transition: none !important; }
}

/* ─── Reduce motion preference ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
