/* ═══════════════════════════════════════════════════════════════
   Filings Explorer — search + detail
   ═══════════════════════════════════════════════════════════════ */

.filings-main { max-width: 1400px; margin: 0 auto; padding: 24px; }

.filings-view { display: none; }
.filings-view.active { display: block; }

/* ---------- Search panel ---------- */
.filings-search-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.filing-search-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px 16px;
}
.filing-search-grid .field {
  display: flex; flex-direction: column; gap: 6px;
  grid-column: span 3;
}
.filing-search-grid .field.wide  { grid-column: span 6; }
.filing-search-grid .field.actions {
  grid-column: span 12;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}
.filing-search-grid label {
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: #6b7280;
}
.filing-search-grid input,
.filing-search-grid select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #111827;
  transition: border-color .15s, box-shadow .15s;
}
.filing-search-grid input:focus,
.filing-search-grid select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

@media (max-width: 900px) {
  .filing-search-grid .field,
  .filing-search-grid .field.wide { grid-column: span 6; }
}
@media (max-width: 600px) {
  .filing-search-grid .field,
  .filing-search-grid .field.wide { grid-column: span 12; }
}

/* ---------- Results table ---------- */
.filings-table td, .filings-table th { white-space: nowrap; }
.filings-table td.num, .filings-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.filings-table a { color: #1d4ed8; text-decoration: none; font-weight: 600; }
.filings-table a:hover { text-decoration: underline; }
.filings-table .row-actions-h { width: 140px; }
.filings-table .row-actions { display: flex; gap: 6px; }

.btn.tiny {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  line-height: 1.4;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin: 18px 0 6px; flex-wrap: wrap;
}
.pagination button {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid #d1d5db; background: #fff; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: #374151;
}
.pagination button:hover:not(:disabled) { border-color: #2563eb; color: #2563eb; }
.pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.pagination .page-info {
  margin-left: 10px; font-size: 12.5px; color: #6b7280;
}

/* ═══════════════════════ DETAIL VIEW ═══════════════════════ */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid #d1d5db; background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: #374151; margin-bottom: 18px;
}
.back-btn:hover { border-color: #2563eb; color: #2563eb; }

.filing-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap;
  padding: 22px 24px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 14px; margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.filing-detail-header h2 { margin: 0 0 8px; font-size: 22px; color: #111827; }
.filing-detail-sub {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 13px; color: #4b5563;
}
.filing-detail-sub .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f3f4f6; padding: 2px 8px; border-radius: 6px;
}
.filing-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  background: #eef2ff; color: #3730a3;
}
.filing-badge.type-990   { background: #dcfce7; color: #166534; }
.filing-badge.type-990EZ { background: #fef3c7; color: #92400e; }
.filing-badge.type-990PF { background: #ede9fe; color: #5b21b6; }
.filing-badge.type-990T  { background: #fee2e2; color: #991b1b; }

.filing-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* KPI row */
.filing-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.filing-kpis .kpi {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 14px 16px;
}
.filing-kpis .kpi-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: #6b7280; margin-bottom: 6px;
}
.filing-kpis .kpi-value {
  font-size: 18px; font-weight: 700; color: #111827;
  font-variant-numeric: tabular-nums;
}

/* Sections */
.filing-section {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.filing-section > h3 {
  margin: 0 0 14px; font-size: 15px; color: #111827;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid #f3f4f6;
}
.filing-section > h3 .count {
  font-size: 11.5px; font-weight: 600; color: #6b7280;
  background: #f3f4f6; padding: 2px 8px; border-radius: 999px;
}

/* Key–value grid */
.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px 22px;
}
.kv-item { display: flex; gap: 10px; font-size: 13.5px; padding: 4px 0; }
.kv-item dt {
  flex: 0 0 42%; color: #6b7280; font-weight: 500;
  overflow-wrap: anywhere;
}
.kv-item dd {
  flex: 1; margin: 0; color: #111827; font-weight: 500;
  overflow-wrap: anywhere;
}

/* JSON tree */
.json-block {
  background: #0b1020; color: #e2e8f0;
  border-radius: 10px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.55;
  max-height: 460px; overflow: auto;
}
.json-block details { display: block; margin-left: 14px; }
.json-block summary {
  cursor: pointer; color: #7dd3fc;
  list-style: none; padding: 1px 0;
}
.json-block summary::-webkit-details-marker { display: none; }
.json-block summary::before {
  content: "▸ "; color: #64748b; display: inline-block;
  transition: transform .15s;
}
.json-block details[open] > summary::before { transform: rotate(90deg); }
.json-block .jv-key { color: #a5b4fc; margin-right: 8px; }
.json-block .jv-str { color: #86efac; }
.json-block .jv-num { color: #fbbf24; }
.json-block .jv-bool { color: #f472b6; }
.json-block .jv-null { color: #64748b; font-style: italic; }
.json-block .jv-row { padding-left: 4px; }

/* Arrays as tables */
.table-wrap.compact .data-table { font-size: 12.5px; }
.table-wrap.compact .data-table th,
.table-wrap.compact .data-table td { padding: 7px 10px; }

.empty-row, .muted-note { color: #9ca3af; font-size: 13px; text-align: center; }
.filing-section .muted-note { text-align: left; }

/* ═══════════════════════ XML VIEWER ═══════════════════════ */
.xml-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.xml-toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.xml-toolbar-right input[type="search"] {
  padding: 8px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 13.5px; min-width: 220px;
}
.xml-content {
  background: #0b1020; color: #e2e8f0;
  border-radius: 12px; padding: 20px 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6;
  white-space: pre; overflow: auto;
  max-height: calc(100vh - 260px);
  margin: 0;
}
.xml-punct { color: #64748b; }
.xml-tag-name { color: #7dd3fc; }
.xml-attr-name { color: #fbbf24; }
.xml-attr-val { color: #86efac; }
.xml-content mark { background: #facc15; color: #111827; padding: 0 1px; border-radius: 2px; }