/* Page-specific layer for fiches.html. Everything here is additive to the
   design system in main.css / components.css — tokens only, no raw hex. */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--fg-dim);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-invert);
}

/* .chip.is-active outranks .chip:hover, so the deepening has to be restated. */
.chip.is-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--fg-invert);
}

.chip__count {
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}

/* Row states ------------------------------------------------------------- */

.table tbody tr[data-id] {
  cursor: pointer;
}

.table tbody tr[data-id]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.cell-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.cell-muted {
  color: var(--fg-dim);
}

.cell-num {
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  white-space: nowrap;
}

.empty-row {
  padding: var(--sp-10) var(--sp-4);
  text-align: center;
  color: var(--fg-dim);
}

/* Drawer ----------------------------------------------------------------- */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 40;
  cursor: pointer;
  pointer-events: auto;
  animation: fade-in var(--dur) var(--ease);
}

/* `hidden` itself is enforced globally in main.css ([hidden] { display:none }). */

/* Modal drawer: the page behind must not scroll while it is open. */
body.body--no-scroll {
  overflow: hidden;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 100vw);
  max-width: 100vw;
  overflow: hidden;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  z-index: 41;
  display: flex;
  flex-direction: column;
  animation: drawer-in var(--dur-slow) var(--ease);
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.drawer__eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.drawer__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
}

.drawer__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--gray-25);
}

/* Meta grid inside drawer */
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.meta__item {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.meta__k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 3px;
}

.meta__v {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
}

.drawer h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: var(--sp-6) 0 var(--sp-3);
}

.drawer h3:first-child {
  margin-top: 0;
}

.corpus {
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  padding: var(--sp-4);
  border-left: 2px solid var(--accent-soft);
  background: var(--bg-inset);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.list {
  margin: 0;
  padding-left: var(--sp-5);
  font-size: 14px;
  line-height: 1.7;
}

/* Two-column activity table inside the drawer */
.act {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.act__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

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

.act__col {
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  line-height: 1.65;
}

.act__col + .act__col {
  border-left: 1px solid var(--border);
  color: var(--fg-dim);
}

.act__col p {
  margin: 0 0 6px;
}

.act__col p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .act__cols { grid-template-columns: 1fr; }
  .act__col + .act__col {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .drawer { width: 100vw; }
}

/* Mes fiches modal ---------------------------------------------------------- */

.mf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  background: var(--gray-25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mf-search {
  flex: 1;
  min-width: 200px;
}

.mf-filter {
  min-width: 160px;
}

.mf-list {
  max-height: 55vh;
  overflow-y: auto;
}

.mf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}

.mf-row:hover {
  background: var(--gray-25);
}

.mf-row:last-child {
  border-bottom: none;
}

.mf-info {
  flex: 1;
  min-width: 0;
}

.mf-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-meta {
  font-size: 12.5px;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.mf-actions .btn {
  padding: 4px 8px;
  font-size: 13px;
}

.mf-empty {
  padding: var(--sp-6);
  text-align: center;
  color: var(--fg-dim);
}

/* Steps modal --------------------------------------------------------------- */

.mf-toolbar { /* reuse for steps modal toolbar */ }

@media (max-width: 720px) {
  .mf-actions .btn {
    padding: 4px 6px;
    font-size: 12px;
  }
  .mf-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .mf-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
