/* Cards browser (cards.html). Uses the shared tokens from styles.css so light/dark just work. */
.cards-nav { display: flex; gap: 4px; }
.cards-nav-btn { font: inherit; background: transparent; border: 1px solid transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.cards-nav-btn:hover { color: var(--text); background: var(--surface-2); }
.cards-nav-btn.active { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

.cards-wrap { max-width: 1400px; margin: 0 auto; padding: 20px 24px 60px; }
.cards-browse, .cards-templates { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 20px; align-items: start; }
.cards-side { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
.cards-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; min-height: 60vh; min-width: 0; }
.cards-placeholder { color: var(--muted); padding: 40px 12px; text-align: center; }

.cards-search { display: flex; gap: 8px; }
.cards-search input { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.cards-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.type-chip { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.type-chip.on { border-color: var(--type); color: var(--type); background: color-mix(in srgb, var(--type) 12%, transparent); }
.cards-filter-row { display: flex; gap: 6px; margin-bottom: 8px; }
.cards-filter-row select, .cards-filter-row input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; flex: 1; }
.cards-meta { font-size: 12px; color: var(--muted-2); margin: 6px 2px 8px; }

.cards-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cards-result { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); cursor: pointer; }
.cards-result:hover { background: var(--surface-hover); }
.cards-result.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cards-result-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.cards-result-title { font-weight: 600; margin-top: 4px; }
.cards-result-summary { font-size: 13px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cards-empty { color: var(--muted); padding: 16px; text-align: center; }
.match-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.match-reasons span { font-size: 10.5px; color: var(--muted-2); border: 1px dashed var(--border-strong); border-radius: 6px; padding: 0 5px; }

.card-type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--type); background: color-mix(in srgb, var(--type) 12%, transparent); border-radius: 6px; padding: 1px 7px; }
.short-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.stub-tag, .stale-dot { font-size: 11px; border-radius: 6px; padding: 0 6px; }
.stub-tag { color: var(--muted); border: 1px dashed var(--border-strong); }
.stale-dot, .stale-badge { color: #b26b00; background: rgba(214, 138, 31, .14); }
.stale-badge { font-size: 11px; border-radius: 6px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }
.fresh-date { font-size: 11px; color: var(--muted-2); margin-left: 4px; white-space: nowrap; }

.card-head-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.card-title { font-family: var(--font-heading); font-size: 28px; margin: 8px 0 2px; }
.card-aliases, .card-audit { color: var(--muted); font-size: 13px; }
.card-audit { margin-top: 6px; font-size: 12px; color: var(--muted-2); }
.card-redirect { margin-top: 8px; font-size: 13px; background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; }
.card-status { font-size: 11px; border-radius: 6px; padding: 1px 7px; border: 1px solid var(--border-strong); color: var(--muted); }
.status-active { color: #0f9d74; border-color: rgba(15, 157, 116, .4); }
.status-restricted { color: #d6453a; border-color: rgba(214, 69, 58, .4); }
.card-conf { font-size: 12px; color: var(--muted-2); }

.card-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 16px; overflow-x: auto; }
.card-tab { font: inherit; font-size: 14px; background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; text-transform: capitalize; white-space: nowrap; }
.card-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { font-size: 11px; color: var(--muted-2); background: var(--surface-2); border-radius: 999px; padding: 0 6px; }

.card-summary { font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.card-tags span { font-size: 12px; color: var(--accent); }
.card-fields { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 14px; }
.card-fields th, .card-fields td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.card-fields th { width: 30%; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.card-fields thead th { text-transform: none; font-weight: 600; color: var(--text); }
.tpl-table th { width: auto; text-transform: none; white-space: nowrap; }
.tpl-table td:last-child { min-width: 260px; }
.tpl-table code { font-size: 12.5px; }
.card-fields code { font-size: 12px; word-break: break-all; }
.card-section { margin: 18px 0; }
.card-identifiers { margin-top: 0; }
.card-identifiers th { text-transform: none; }
.card-identifiers a { color: var(--accent); }
.card-section h3, .link-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.md { line-height: 1.6; font-size: 14.5px; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { padding-left: 20px; margin: 0 0 8px; }

.link-group { margin-bottom: 18px; }
.link-group ul { list-style: none; margin: 0; padding: 0; }
.link-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.link-item:hover { background: var(--surface-hover); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.source-list { list-style: none; margin: 0; padding: 0; }
.source-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.source-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.source-list blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border-strong); color: var(--muted); }

.history-list { list-style: none; margin: 0; padding: 0; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-head { font-size: 14px; }
.history-reason { font-size: 13px; color: var(--muted); margin: 3px 0 6px; }
.btn-ghost.small { font-size: 12px; padding: 3px 9px; }
.diff { font-size: 12px; line-height: 1.45; background: var(--surface-2); border-radius: 8px; padding: 10px; overflow: auto; max-height: 420px; white-space: pre-wrap; }
.diff .add { background: rgba(15, 157, 116, .18); display: block; }
.diff .del { background: rgba(214, 69, 58, .16); text-decoration: line-through; display: block; }
.diff .ctx { color: var(--muted-2); display: block; }

.graph-controls { font-size: 13px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.card-graph { height: 560px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }

.cards-proposals { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

@media (max-width: 900px) {
  .cards-browse, .cards-templates { grid-template-columns: 1fr; }
  .cards-side { position: static; max-height: none; }
  .cards-nav { order: 3; width: 100%; }
  .cards-wrap { padding: 12px 16px 40px; }
  .card-graph { height: 400px; }
}
