.library-summary {
  margin: 1rem 0 0;
  padding: .75rem .85rem;
  background: var(--brand-primary-tint);
  border-radius: 7px;
  border: 1px solid #c5c5e8;
}

.lib-tier {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-primary);
  margin: 2rem 0 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.lib-tier:first-of-type { margin-top: 0; }

.lib-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.lib-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
  transition: border-color .15s, box-shadow .15s;
}
.lib-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(1, 0, 128, 0.08);
}
.lib-card.pending {
  background: #fafafa;
  border-style: dashed;
}

.lib-head h3 {
  margin: 0 0 .15rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.lib-head .muted {
  margin: 0 0 .85rem;
  font-size: .82rem;
}

.lib-badge {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.lib-badge.live {
  background: var(--brand-accent-tint);
  color: #4d6618;
  border: 1px solid var(--brand-accent);
}
.lib-badge.pending {
  background: #f4f4f5;
  color: var(--text-muted);
  border: 1px solid #d4d4d8;
}

.lib-kv {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: .35rem .9rem;
  margin: 0;
  font-size: .85rem;
  line-height: 1.5;
}
.lib-kv dt {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-top: .15rem;
}
.lib-kv dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.lib-kv dd a {
  color: var(--brand-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--brand-primary);
  transition: border-style .15s;
}
.lib-kv dd a:hover { border-bottom-style: solid; }

.lib-kv dd code,
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: .82em;
  background: #f4f4f5;
  padding: .1em .35em;
  border-radius: 3px;
  color: #4338ca;
}

.warn {
  color: #b45309;
  font-weight: 500;
}
.warn::before {
  content: "⚠ ";
}

.lib-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
  font-size: .87rem;
  margin-top: 1rem;
}
.lib-table th {
  text-align: left;
  padding: .65rem .85rem;
  background: var(--brand-primary-tint);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-primary);
  border-bottom: 1px solid var(--border);
}
.lib-table td {
  padding: .7rem .85rem;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: top;
}
.lib-table tr:last-child td { border-bottom: none; }

/* ---------- Glossary editor ---------- */
.glossary-toolbar {
  display: flex;
  gap: .65rem;
  align-items: center;
  margin: 1rem 0 .75rem;
  flex-wrap: wrap;
}
.glossary-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: .87rem;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
}
.glossary-table thead {
  background: var(--brand-primary-tint);
}
.glossary-table th {
  text-align: left;
  padding: .65rem .65rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-primary);
  border-bottom: 1px solid var(--border);
}
.glossary-table td {
  padding: .35rem .35rem;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: middle;
}
.glossary-table tr.dirty { background: #fffdf3; }
.glossary-table tr.removed { opacity: .35; text-decoration: line-through; }
.glossary-table tr.low-conf td:first-child::before {
  content: "⚠ ";
  color: #b45309;
}
.glossary-table input,
.glossary-table select,
.glossary-table textarea {
  width: 100%;
  padding: .35rem .5rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: .87rem;
  color: var(--text);
}
.glossary-table input:hover,
.glossary-table select:hover,
.glossary-table textarea:hover {
  border-color: #e5e5e5;
}
.glossary-table input:focus,
.glossary-table select:focus,
.glossary-table textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: white;
  box-shadow: 0 0 0 2px var(--brand-primary-tint);
}
.glossary-table .conf-cell select { font-size: .8rem; padding: .25rem .4rem; }
.glossary-table .row-del {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  padding: .15rem .45rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.glossary-table .row-del:hover {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}
.glossary-table .row-del.restore {
  color: var(--brand-primary);
}
