/* Triune AV Planner — Tela 02 Biblioteca de equipamentos
   Mobile-first. Grid responsivo 1→2→3 colunas. */

.lib { display: flex; flex-direction: column; gap: 14px; }

.lib-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lib-bar > .proj-tabs { flex-shrink: 0; }
.lib-bar > .lib-cat { flex-shrink: 0; }

.lib-cat select {
  height: 36px;
  background: var(--bg-2);
  border: 1px solid var(--line-3);
  border-radius: var(--r-sm);
  padding: 0 30px 0 12px;
  color: var(--txt-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%238A9BB0' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  width: auto;
  max-width: 180px;
}
.lib-cat select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.lib-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.lib-count {
  font-size: 12px;
  color: var(--txt-3);
}

.lib-grid {
  column-count: 1;
  column-gap: 14px;
}
.lib-grid > * {
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
  margin-bottom: 14px;
  display: inline-block;
  width: 100%;
}

@media (min-width: 640px) {
  .lib-grid { column-count: 2; column-gap: 16px; }
  .lib-grid > * { margin-bottom: 16px; }
}
@media (min-width: 1100px) {
  .lib-grid { column-count: 3; }
}
@media (min-width: 1500px) {
  .lib-grid { column-count: 4; }
}

.lib-card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
}
.lib-card:hover { border-color: var(--line); }
.lib-card:focus { outline: 2px solid var(--red); outline-offset: 2px; }

.lib-card-head {
  padding: 14px 16px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.lib-card-headinfo { min-width: 0; flex: 1; }
.lib-card-mfg {
  font-size: 10px;
  color: var(--txt-3);
  letter-spacing: 0.4px;
  font-weight: 500;
}
.lib-card-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--txt);
  margin-top: 3px;
  line-height: 1.25;
  word-break: break-word;
}
.lib-card-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.lib-card-body {
  background: var(--bg-deep);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  padding: 12px 16px;
}
.lib-card-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.lib-card-side {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.lib-card-side.ta-right { align-items: flex-end; }
.lib-card-side-lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--txt-4);
  text-transform: uppercase;
}
.lib-card-side-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--txt);
}
.lib-card-port {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lib-card-side.ta-right .lib-card-port { flex-direction: row; }
.lib-card-port-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.lib-card-port .mono {
  font-size: 10px;
  color: var(--txt-2);
}
.lib-card-mute { color: var(--txt-4); font-size: 10px; }
.lib-card-more { font-size: 9.5px; color: var(--txt-3); background: var(--bg-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; align-self: flex-start; margin-top: 2px; }

.lib-card-foot {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lib-card-meta {
  font-size: 10.5px;
  color: var(--txt-3);
}
.lib-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  min-height: 36px;
}
.lib-card-action:hover { color: #c4241a; }

/* ---- Card com preview visual do nó (estilo Patchify) ---- */
.lib-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px 0; }
.lib-card-u { font-size: 10.5px; color: var(--txt-3); }
.lib-card-preview { padding: 10px 14px 4px; }
.lib-node { background: var(--bg-deep); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.lib-node-top { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--line-2); }
.lib-node-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.lib-node-id { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.lib-node-name { font-size: 12.5px; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-node-mfg { font-size: 8px; font-weight: 600; letter-spacing: .4px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-node-body { display: flex; gap: 10px; padding: 9px 11px 11px; }
.lib-node-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lib-node-col-out { align-items: flex-end; }
.lib-pin { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.lib-pin-out { flex-direction: row; justify-content: flex-end; }
.lib-h { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 2px var(--bg-deep); }
.lib-pl { font-size: 10px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.lib-pin-out .lib-pl { text-align: right; }
.lib-pmore { font-size: 9px; color: var(--txt-3); margin-top: 1px; }

/* Card tracejado "Construir equipamento" */
.lib-card-build {
  background: transparent;
  border: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}
.lib-card-build:hover { border-color: var(--red); background: var(--red-soft); }
.lib-build-ico {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--red);
  display: inline-flex; align-items: center; justify-content: center;
}
.lib-build-title { font-size: 13px; font-weight: 500; color: var(--txt-2); }
.lib-build-desc  { font-size: 11px; font-weight: 300; color: var(--txt-3); }

@media (max-width: 768px) {
  .lib-bar > .proj-search { order: 99; flex: 1 0 100%; }
  .lib-bar > .proj-search input { width: 100%; }
  .lib-bar > .btn-primary { order: 98; flex: 1 0 auto; min-width: 0; }
  .lib-cat select { max-width: none; flex: 1; }
}
