/* Pages « Banque de patrons » et « Placement des patrons » (complète app.css) */

.layout.pages { grid-template-columns: 280px minmax(0, 1fr) 330px; }
.side {
  background: var(--pane); padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
  border-right: 1px solid var(--line);
}
.side > * { flex-shrink: 0; }
.side.props { border-right: 0; border-left: 1px solid var(--line); }
.side .card { display: flex; flex-direction: column; gap: 8px; }
.side .card-h { margin-bottom: 2px; }
.hint { margin: 0; color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.danger:hover { color: var(--red) !important; }

/* Champs de formulaire */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.field input, .field select {
  background: var(--field); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px;
  color: var(--text); font-size: 13px; outline: none; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input:disabled, .field select:disabled { opacity: .45; }
.w110 { width: 110px; flex-shrink: 0; }
select.field-select { width: 100%; background: var(--field); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; }
.check.sm { font-size: 12px; line-height: 1.35; align-items: flex-start; }
.check.sm input { margin-top: 2px; }

/* Banque */
.bank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bank ul { list-style: none; margin: 0; padding: 2px 0 0; }
.bank .art { background: var(--card); border-radius: var(--radius); padding: 6px; }
.bank .art.sel { box-shadow: inset 0 0 0 1px rgba(127,184,154,.4); }
.bank .art-h { display: flex; align-items: center; gap: 6px; padding: 4px 6px; cursor: pointer; border-radius: 6px; }
.bank .art-h .nm { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank .meta { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bank .ic {
  background: none; border: 0; color: var(--faint); cursor: pointer; width: 22px; height: 22px; border-radius: 5px; font-size: 13px;
  visibility: hidden;
}
.bank .art-h:hover .ic { visibility: visible; }
.bank .ic:hover { background: #393941; color: var(--text); }
.bank .pat {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: #c9c9cf;
}
.bank .pat svg { flex-shrink: 0; color: var(--accent); }
.bank .pat .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bank .pat .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank .pat:hover { background: var(--hover); }
.bank .pat.sel { background: var(--accent-d); color: var(--text); }
.bank .empty-msg { color: var(--muted); font-size: 12px; padding: 6px; }

/* Éditeur / vue */
.page-patterns .stage canvas, .page-placement .stage canvas { cursor: default; }
.stage canvas.panning, .stage.tool-pan canvas { cursor: grab; }
.stage.tool-draw canvas, .stage.tool-measure canvas { cursor: crosshair; }
.diminfo { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.diminfo > div { background: var(--field); border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.diminfo span { color: var(--muted); font-size: 11px; }
.diminfo b { font-weight: 600; font-variant-numeric: tabular-nums; }
.diminfo .muted { grid-column: 1 / -1; background: none; padding: 0; font-size: 12px; line-height: 1.45; }
.edgebox { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }

/* Placement */

.scale-state { font-size: 12px; line-height: 1.45; }
.scale-state b { color: var(--accent); }
.scale-state.missing b { color: var(--orange); }
.piece-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.piece-list li { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.piece-list li:hover { background: var(--hover); }
.piece-list svg { flex-shrink: 0; }
.piece-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piece-list input { width: 52px; background: var(--field); border: 1px solid var(--line2); border-radius: 5px; padding: 2px 6px; text-align: right; }
.art-pick { display: flex; flex-direction: column; gap: 4px; background: var(--field); border-radius: 8px; padding: 8px; }
.art-pick .art-h { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.art-pick .art-h .nm { flex: 1; }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.results > div { background: var(--field); border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.results span { color: var(--muted); font-size: 11px; }
.results b { font-weight: 600; font-variant-numeric: tabular-nums; }
.results b.r { color: var(--red); } .results b.g { color: var(--accent); }
.missing-list { margin: 0; padding-left: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.missing-list button { margin-left: 6px; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.saved-list li:hover { background: var(--hover); }
.saved-list .meta { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.legend-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--muted); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.next-card { border: 1px solid rgba(127,184,154,.35); }

@media (max-width: 1100px) {
  .layout.pages { grid-template-columns: 240px minmax(0, 1fr) 290px; }
  .steps { display: none; }
}
@media (max-width: 820px) {
  .side, .side.props { border: 0; overflow: visible; }
}

/* Options d'un patron dans le placement */
.optpop {
  position: fixed; z-index: 30; width: 330px; padding: 12px; display: flex; flex-direction: column; gap: 9px;
  background: var(--pane); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.optpop .card-h { margin: 0; }
.optpop .seg { display: flex; margin-top: 2px; }
.optpop .seg button { flex: 1; }
.optpop .row.end { margin-top: 0; }
.piece-list .opt {
  background: none; border: 0; color: var(--faint); cursor: pointer; width: 24px; height: 24px; border-radius: 5px;
  display: grid; place-items: center; flex-shrink: 0;
}
.piece-list .opt svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.piece-list .opt:hover { background: #393941; color: var(--text); }
.piece-list .opt.on { color: var(--accent); }
.piece-list .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.piece-list .tags { font-size: 10.5px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flash { animation: flashcard 1.2s ease-out; }
@keyframes flashcard { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }

/* Plans de coupe */
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.plan-list li { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; cursor: pointer; }
.plan-list li:hover { background: var(--hover); }
.plan-list li.sel { background: var(--accent-d); }
.plan-list canvas { width: 54px; height: 54px; border-radius: 6px; background: var(--field); flex-shrink: 0; }
.plan-list .txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-list .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-list .meta { color: var(--muted); font-size: 11px; }
.ptable { width: 100%; font-size: 12px; }
.ptable td, .ptable th { padding: 3px 4px; }
.exports { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.exports a { text-align: center; text-decoration: none; }
.ptable .kind::before { background: var(--c, var(--red)); }
.ptable tbody tr:hover { background: var(--hover); }
.side .grow-card { flex: 1 0 200px; min-height: 200px; }
.side .tablewrap { overflow-y: auto; flex: 1; min-height: 0; }
.page-plans .stage canvas { cursor: grab; }
.page-plans .stage canvas.panning { cursor: grabbing; }

/* Accueil */
.home { height: calc(100% - 48px); overflow-y: auto; padding: 32px max(24px, calc((100% - 1100px) / 2)); display: flex; flex-direction: column; gap: 28px; }
.newproj {
  width: 100%; display: flex; align-items: center; gap: 18px; text-align: left; cursor: pointer;
  background: var(--accent-d); border: 1.5px dashed rgba(127,184,154,.5); border-radius: 14px; padding: 22px 24px; color: inherit;
  transition: background .12s, border-color .12s;
}
.newproj:hover { background: rgba(127,184,154,.22); border-color: var(--accent); }
.newproj .plus {
  width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 28px; font-weight: 500; flex-shrink: 0;
}
.newproj b { display: block; font-size: 17px; font-weight: 600; margin-bottom: 3px; }
.newproj span span { color: var(--muted); }
.home-list-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.home-list-h h2 { margin: 0; }
.home-list-h .psearch { width: 280px; }
.projgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.projcard { background: var(--card); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid transparent; }
.projcard:hover { border-color: var(--line2); }
.projcard .thumb { display: block; aspect-ratio: 16 / 10; background: #0d0d0f; }
.projcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.projcard .nophoto { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 12px; }
.projcard .body { padding: 10px 12px 4px; display: flex; flex-direction: column; gap: 5px; }
.projcard .nm { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projcard .nm:hover { color: var(--accent); }
.projcard .meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.projcard .acts { display: flex; gap: 2px; padding: 4px 6px 8px; }
.badge2 { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: #34343b; color: #c9c9cf; }
.badge2.o { background: rgba(240,164,58,.15); color: var(--orange); }
.badge2.b { background: rgba(106,169,255,.15); color: #8dbbff; }
.badge2.g { background: var(--accent-d); color: var(--accent); }
.page-title { font-weight: 600; font-size: 13.5px; }
