/* Ogólna przestrzeń między elementami */
.stats-tab {
  padding: 80px;
}

/* Pasek nawigacji (przyciski zakładek) — jeśli nieużywane, można skasować */
.stats-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 1em 0;
  border-bottom: 2px solid #eee;
}

.stats-tab-button {
  background-color: #f3f4f6;
  border: 1px solid #ccc;
  padding: 0.5em 1.2em;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.2s;
}

.stats-tab-button:hover {
  background-color: #e0e7ff;
}

.stats-tab-button.active {
  background-color: #4338ca;
  color: white;
  border-color: #4338ca;
}

/* Styl dla kafelków z liczbami */
.stats-metric-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  margin-top: 2em;
}

.stats-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.2em 2em;
  min-width: 180px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: 0.3s;
}

.stats-box:hover {
  background-color: #f3f4f6;
  transform: scale(1.02);
}

.stats-box h3 {
  font-size: 1.2em;
  margin-bottom: 0.3em;
  font-weight: 600;
  color: #374151;
}

.stats-box .value {
  font-size: 1.8em;
  font-weight: 700;
  color: #111827;
}

/* ─────────────── Podstawowe: rozbudowany dashboard ─────────────── */

.basic-dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-top: 1.2rem;
}
.basic-mini-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.basic-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.basic-card__header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.basic-card__header p {
  margin: 0.35rem 0 0;
  font-size: 0.93rem;
  line-height: 1.55;
  color: #64748b;
}

.basic-insights {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.basic-insight {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  line-height: 1.6;
  color: #334155;
}

.basic-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.basic-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.basic-stat__label {
  font-size: 0.86rem;
  color: #64748b;
}

.basic-stat__value {
  margin-top: 0.2rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
}

.basic-stat__meta {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: #64748b;
}

.basic-meta-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.basic-meta-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #eef2f7;
}

.basic-meta-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.basic-meta-label {
  font-weight: 600;
  color: #64748b;
}

.basic-meta-value {
  color: #111827;
  word-break: break-word;
}

.basic-bars {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.95rem;
}

.basic-bar__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 0.75rem;
  align-items: center;
}

.basic-bar__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.basic-bar-label {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155;
  font-weight: 600;
}

.basic-bar-tag {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.basic-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
  position: relative;
}

.basic-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #4338ca);
}

.basic-bar-val {
  text-align: right;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.basic-bar-muted {
  color: #64748b;
}

.basic-empty {
  margin-top: 0.9rem;
  color: #64748b;
}

@media (max-width: 1280px) {
  .basic-dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .basic-mini-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .basic-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .basic-profile-grid {
    grid-template-columns: 1fr;
  }

  .basic-meta-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .basic-bar__row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .basic-bar-val {
    text-align: left;
  }
}

/* Styl dla tabel */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5em;
}

#cooccurrenceResults .stats-table {
  margin-top: 0.5em; /* ciaśniej niż globalne 1.5em */
}


.stats-table th,
.stats-table td {
  border: 1px solid #ddd;
  padding: 0.6em 1em;
  text-align: left;
}

.stats-table th {
  background-color: #f3f4f6;
  font-weight: 600;
  color: #111827;
}

.stats-table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

/* Styl eksportu */
.export-btn {
  margin-top: 1em;
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.5em 1.2em;
  border-radius: 6px;
  cursor: pointer;
}

.export-btn:hover {
  background-color: #1d4ed8;
}

/* Zakładki w stopce */
.stats-footer-tabs {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin-top: 0.5em;
}

footer .stats-tab-button {
  background-color: #f9fafb;
  border: 1px solid #ccc;
  padding: 0.4em 1.2em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  font-family: 'Inter', sans-serif;
}

footer .stats-tab-button.active {
  background-color: #4338ca;
  color: white;
  border-color: #4338ca;
}

/* Layout kolumn */
.tag-stats-container {
  display: flex;
  gap: 2em;
  align-items: flex-start;
  flex-wrap: nowrap;
}

/* Lewa kolumna — sticky (bez scrolla) */
.tag-list-column {
  position: sticky;
  top: 80px;                 /* dopasuj do wysokości headera */
  align-self: flex-start;
  background: white;
  z-index: 10;
  flex: 0 0 22%;
  max-width: 22%;
  min-width: 160px;
  box-shadow: 2px 0 0 rgba(0,0,0,0.04);
}

/* Scroll przeniesiony do wrappera */
.tag-list-scroll {
  max-height: calc(100vh - 100px); /* ≈ top (80) + marginesy */
  overflow-y: auto;
  padding-right: 4px;              /* miejsce na scrollbar */
}


.tag-details-column {
  flex: 1 1 auto;
  min-width: 200px;
  scroll-margin-top: 100px;
  padding-bottom: 120px; /* ✅ DODAJ TO */
}


/* Karty przykładów */
.annotation-card {
  background: #fdfdfd; /* jasny odcień, lekko ciemniejszy niż tło strony */
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1em;
  margin-bottom: 1em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); /* subtelny cień */
}
.annotation-header { font-size: 0.9em; color: #555; margin-bottom: 0.3em; }

.annotation-subheader {
  font-size: 0.9em;
  color: #555;
  margin: 0.6em 0 0.3em;
}


.annotation-segment { margin-bottom: 0.95em; font-style: italic; }

.stats-annotation-card {
  background: #fdfdfd;
}

.stats-card-header-icons {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stats-difficulty-badge {
  font-size: 1.05em;
  line-height: 1;
}

.stats-expert-open-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 1.02em;
  line-height: 1;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

.stats-expert-open-btn:hover {
  opacity: 1;
}

.stats-expert-open-btn:active {
  transform: translateY(1px);
}

.stats-segment-translation,
.stats-annotation-translation {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0.15em 0 0.8em;
  color: #475569;
  font-size: 0.95em;
}

.stats-annotation-block {
  margin-top: 1.05em;
  padding: 1em 1.05em;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.stats-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 0.8em;
}

.stats-tag-i18n-chip {
  background: #eef2ff;
  color: #334155;
  border: 1px solid #c7d2fe;
}

.stats-annotation-text {
  font-size: 1em;
  color: #111827;
  line-height: 1.55;
}

.stats-relation-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.85em;
}

.stats-relation-chip {
  float: none !important;
  margin-left: 0 !important;
  margin-top: 0 !important;

  background-color: #f0f0f0;
  color: #333;
  padding: 0.3em 0.6em;
  border-radius: 1em;
  font-size: 0.9em;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.22em;
  white-space: nowrap;
  border: 1px solid #d6dde8;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.stats-relation-chip .rel-id-badge {
  display: inline-block;
  font-size: 0.75em;
  line-height: 1.2;
  padding: 0.05em 0.55em;
  margin-right: 0.3em;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  vertical-align: middle;
}

.stats-relation-chip .rel-arrow {
  font-weight: 600;
  margin-left: 4px;
  margin-right: 0.18em;
}

.stats-relation-chip .rel-peer-id {
  display: inline-block;
  font-size: 0.78em;
  line-height: 1;
  color: #8795a8;
  font-weight: 600;
  letter-spacing: 0.01em;
  vertical-align: middle;
}

.annotation-card .annotation-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.annotation-rationale-toggle.stats-rationale-open {
  margin-left: 0.12em;
}


/* ─────────────────────────────────────────────
   Wspólna skórka tabel po lewej (Tagi + Relacje)
   ───────────────────────────────────────────── */

.list-table {
  width: 100%;
  table-layout: fixed;         /* stabilny układ bez falowania */
  border-collapse: separate;   /* pozwala ładnie zaokrąglić */
  border-spacing: 0;
  border-radius: 10px;
  overflow: hidden;            /* maskuje rogi */
  font-size: 15px;             /* typografia jak w Relacjach */
}

.list-table th,
.list-table td {
  border: 1px solid #e5e7eb;   /* delikatniejsza siatka */
  padding: 0.65em 1em;
}

.list-table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #111827;              /* kolor nagłówka jak w Relacjach */
}

/* pełny wiersz klikalny + hover/active/focus */
.list-table tbody tr {
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.list-table tbody tr:hover td { background: #f3f6ff; }
.list-table tbody tr.active td { background: #e8edff; border-color: #c7d2fe; }
.list-table tbody tr:focus-visible td {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
}

/* komórki: nazwa + liczba (ta sama szerokość w Tagach i Relacjach) */
.list-name {
  color: #2563eb;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: normal;
}
.list-count {
  width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* (opcjonalnie) węższa kolumna po lewej */
.tag-list-column, {
  flex: 0 0 22%;
  max-width: 22%;
  min-width: 200px;
}

/* Tagi potrzebują wyraźnie więcej miejsca niż relacje */
.tag-stats-container .tag-list-column {
  flex: 0 0 460px;
  max-width: 460px;
  min-width: 460px;
}

.relation-stats-container {
  display: flex;
  gap: 2em;
  align-items: flex-start;
  flex-wrap: nowrap;
}

/* lewa kolumna */
.relation-list-column {
  position: sticky;
  top: 80px;
  align-self: flex-start;
  background: white;
  z-index: 10;
  flex: 0 0 420px;
  max-width: 420px;
  min-width: 420px;
  box-shadow: 2px 0 0 rgba(0,0,0,0.04);
}

.relation-list-scroll {
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
}


/* prawa kolumna */
.relation-details-column {
  flex: 1 1 auto;
  min-width: 280px;
  scroll-margin-top: 100px;
}

/* Strzałka kierunku w karcie relacji */
.rel-direction {
  text-align: center;
  color: #6b7280;
  margin: 0.4em 0 0.6em;
  font-weight: 600;
}

/* delikatne wyszarzenie notki, gdy brak ID anotacji */
.annot-muted {
  color: #6b7280;
  font-style: italic;
}

/* opcjonalny, neutralny badge */
.inline-tag.muted {
  background-color: #eef2ff;
  color: #334155;
}

/* Połączenie między członami relacji */
.rel-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.6em 0;
  color: #6b7280; /* neutralny szary */
  font-size: 1.2em;
  font-weight: 600;
  gap: 0.5em;
}

.rel-line {
  flex: 1;
  height: 1px;
  background-color: #d1d5db; /* jasna szarość */
}

.rel-arrow {
  flex: 0;
  font-size: 1.3em;
  color: #374151; /* ciemniejszy akcent */
}
.rel-connector.labeled {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.6rem 0;
  color: #374151;
}
.rel-connector.labeled .rel-line {
  flex: 1;
  height: 1px;
  background-color: #e5e7eb;
}
.rel-connector.labeled .rel-arrow {
  font-size: 1.2em;
  font-weight: 600;
  color: #374151;
}

/* Styl dla dropdownów w zakładce Współwystępowanie */
#coTag1, #coTag2 {
  appearance: none;              /* usuń natywną strzałkę */
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.4em 1.8em 0.4em 0.8em;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 0.8em;
}

#coTag1:hover, #coTag2:hover {
  border-color: #6366f1;
}

#coTag1:focus, #coTag2:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* Styl dla przycisku Policz */
#countCooccurrenceBtn {
  background: #eef4fb;
  border: 1px solid #cddff5;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #0b3a67;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#countCooccurrenceBtn:hover {
  background: #e1edfa;
  border-color: #80bfff;
  color: #083256;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.12);
}

#oneTagReport .stats-table td,
#oneTagReport .stats-table th { white-space: nowrap; }

#oneTagSelect {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.4em 1.8em 0.4em 0.8em;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 0.8em;
}
#oneTagSelect:hover { border-color: #6366f1; }
#oneTagSelect:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.list-rank {
  width: 36px;
  text-align: right;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list-pct {
  width: 90px;
  text-align: right;
  color: #374151;
  font-variant-numeric: tabular-nums;
}
/* ─── Tagi: szerokości kolumn (nr / etykieta / Nb. / %) ─── */
.list-table {
  table-layout: fixed;          /* stabilne szerokości */
}

/* lokalnie dla zakładki Tagi */
#tab-tags .list-table th:nth-child(1),
#tab-tags .list-table td:nth-child(1) {
  width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tab-tags .list-table th:nth-child(2),
#tab-tags .list-table td:nth-child(2) {
  width: 100%;
}

#tab-tags .list-table th:nth-child(3),
#tab-tags .list-table td:nth-child(3) {
  width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tab-tags .list-table th:nth-child(4),
#tab-tags .list-table td:nth-child(4) {
  width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* trochę ciaśniejsze komórki, żeby zyskać miejsce */
.list-table th,
.list-table td {
  padding: 0.55em 0.8em;
}

@media (max-width: 1100px) {
  #tab-tags .list-table th:nth-child(1),
  #tab-tags .list-table td:nth-child(1) { width: 32px; }

  #tab-tags .list-table th:nth-child(2),
  #tab-tags .list-table td:nth-child(2) { width: 100%; }

  #tab-tags .list-table th:nth-child(3),
  #tab-tags .list-table td:nth-child(3) { width: 60px; }

  #tab-tags .list-table th:nth-child(4),
  #tab-tags .list-table td:nth-child(4) { width: 56px; }

  #tab-relations .list-table th:nth-child(1),
  #tab-relations .list-table td:nth-child(1) { width: 32px; }

  #tab-relations .list-table th:nth-child(2),
  #tab-relations .list-table td:nth-child(2) { width: 100%; }

  #tab-relations .list-table th:nth-child(3),
  #tab-relations .list-table td:nth-child(3) { width: 60px; }

  #tab-relations .list-table th:nth-child(4),
  #tab-relations .list-table td:nth-child(4) { width: 56px; }
}

/* ───────────────  ASOCJACJE (stylowanie)  ─────────────── */

#assocPanel { padding: 0.75rem 0; }

.assoc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 6px 0 14px;
}

/* spójne selecty jak w „Współwystępowaniu” */
#assocTagA, #assocTagB {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 1.9rem 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6em center;
  background-size: .8em;
  min-width: 320px;            /* szerokość zbliżona do selectów w Tagach */
}
#assocTagA:hover, #assocTagB:hover { border-color: #6366f1; }
#assocTagA:focus, #assocTagB:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99,102,241,.3);
}

/* przycisk „Policz” – jak w Twoich lekkich przyciskach */
#assocBtn {
  background: #eef4fb;
  border: 1px solid #cddff5;
  border-radius: 8px;
  padding: .45rem .95rem;
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  color: #0b3a67;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
#assocBtn:hover {
  background: #e1edfa;
  border-color: #80bfff;
  color: #083256;
  box-shadow: 0 0 0 2px rgba(0,123,255,.12);
}

/* kafelki metryk (N, nA, nB, nAB itd.) */
#assocMetrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 12px 0 6px;
}
.assoc-metric {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.assoc-metric .label { font-size: .92rem; color: #475569; }
.assoc-metric .value {
  margin-top: 2px;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
  color: #111827;
}

/* tabela wynikowa z miarami */
#assocResults .stats-table {
  margin-top: 10px;
}
#assocResults .stats-table th,
#assocResults .stats-table td {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
#assocResults .stats-table th:first-child,
#assocResults .stats-table td:first-child {
  text-align: left;            /* pierwsza kolumna – nazwa miary */
  width: 40%;
}

#assocHeatmap table td {
  min-width: 40px;
  text-align: right;
  font-weight: 500;
  transition: background 0.3s;
}
#assocHeatmap table th {
  position: sticky;
  top: 0;
  background: #f0f4ff;
  z-index: 1;
}

#assocPctHeatmap table td {
  min-width: 40px;
  text-align: right;
  font-weight: 500;
  transition: background 0.3s;
}
#assocPctHeatmap table th {
  position: sticky;
  top: 0;
  background: #f0f4ff;
  z-index: 1;
}

/* ——— Kolejność tagów ——— */
.order-tool-card {
  margin-top: 1rem;
}

.order-controls-grid {
  margin-top: 0.25rem;
}

.order-controls-grid .stats-tool-field {
  min-width: 0;
}

.order-field-help {
  margin-top: 0.45rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #64748b;
}

.order-field-help strong {
  color: #334155;
  font-weight: 600;
}

.order-field-help code {
  display: inline-block;
  padding: 0.08rem 0.38rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.82rem;
}

.order-controls-grid .stats-filter-input {
  height: 42px;
}

.order-summary-wrap {
  margin-top: 1.1rem;
}

.order-summary-boxes {
  margin-top: 0;
}

.order-summary-boxes .stats-box {
  min-width: 170px;
}

.order-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.order-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
}

.order-matrix-wrap {
  margin-top: 1.2rem;
}

.order-matrix-scroll {
  overflow: auto;
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.order-matrix-table {
  margin-top: 0;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.order-matrix-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.order-matrix-table thead th:first-child {
  z-index: 2;
}

.order-matrix-table td,
.order-matrix-table th {
  border: 1px solid #e5e7eb;
}

.order-cell {
  min-width: 110px;
  text-align: right !important;
  vertical-align: top;
  padding: 0.45rem !important;
}

.order-cell-btn {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: inherit;
}

.order-cell-btn:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
  border-radius: 12px;
}

.order-cell-box {
  min-height: 62px;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  border: 1px solid transparent;
}

.order-cell-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.order-cell-box.is-active {
  border-color: #6366f1;
  box-shadow: inset 0 0 0 1px #6366f1, 0 4px 12px rgba(79, 70, 229, 0.16);
}

.order-cell-main {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.order-cell-sub {
  margin-top: 0.22rem;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.order-top-transitions {
  margin-top: 1.25rem;
}

.order-top-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.order-top-table-wrap {
  overflow: auto;
}

.order-top-table {
  margin-top: 0.6rem;
}

.order-top-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.order-top-table tbody tr:hover td {
  background: #f6f8ff;
}

.order-top-row.is-active td {
  background: #eef2ff !important;
  border-color: #c7d2fe;
}

.order-top-table td:nth-child(1),
.order-top-table td:nth-child(4),
.order-top-table td:nth-child(5),
.order-top-table td:nth-child(6),
.order-top-table td:nth-child(7),
.order-top-table th:nth-child(1),
.order-top-table th:nth-child(4),
.order-top-table th:nth-child(5),
.order-top-table th:nth-child(6),
.order-top-table th:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-examples {
  margin-top: 1.25rem;
}

.order-examples-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.order-examples-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.order-examples-selected {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.order-example-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #312e81;
  font-weight: 700;
  font-size: 0.92rem;
}

.order-example-count {
  color: #475569;
  font-size: 0.92rem;
  font-weight: 600;
}

.order-example-list {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-top: 0.95rem;
}

.order-example-item {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fcfcfd;
  padding: 0.95rem 1rem;
}

.order-example-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.order-example-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.order-example-pill--kind {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.order-example-pill--index {
  background: #f1f5f9;
  border-color: #dbeafe;
  color: #475569;
}

.order-example-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.order-example-endpoint {
  min-width: 0;
}

.order-example-endpoint-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.order-example-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 1.2rem;
  font-weight: 700;
  padding-top: 3.2rem;
}

.order-example-mini {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: #64748b;
}

.order-examples-more {
  margin-top: 0.9rem;
  color: #64748b;
  font-size: 0.88rem;
}

.order-explainer {
  margin-top: 0.9rem;
  line-height: 1.55;
  max-width: 980px;
}

.muted { color:#6b7280; }

@media (max-width: 980px) {
  .order-matrix-table {
    min-width: 720px;
  }

  .order-cell {
    min-width: 96px;
  }

  .order-cell-main {
    font-size: 0.95rem;
  }

  .order-cell-sub {
    font-size: 0.72rem;
  }

  .order-example-grid {
    grid-template-columns: 1fr;
  }

  .order-example-arrow {
    padding-top: 0;
    transform: rotate(90deg);
  }
}






/* ==== Entropia ==== */
.entropy-intro-card,
.entropy-note-card,
.entropy-interpretation-card {
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.entropy-card-title {
  margin: 0 0 0.65rem 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: #111827;
}

.entropy-intro-card p,
.entropy-note-card p,
.entropy-interpretation-card p {
  margin: 0.55rem 0;
  line-height: 1.6;
  color: #475569;
}

.entropy-intro-card code,
.entropy-note-card code,
.entropy-interpretation-card code {
  display: inline-block;
  padding: 0.08rem 0.38rem;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.84rem;
}

.entropy-kpi-help {
  margin-top: 1rem;
}

.entropy-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.entropy-kpi-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.95rem 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.entropy-kpi-card h4 {
  margin: 0 0 0.45rem 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
}

.entropy-kpi-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #475569;
}

.entropy-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.entropy-legend-item {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.entropy-legend-range {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.3rem;
}

.entropy-legend-text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #475569;
}

.entropy-legend-note {
  margin-top: 0.9rem;
  color: #475569;
  line-height: 1.55;
}

/* ==== Entropia: prosty wykres słupkowy Top 10 ==== */
.bar-chart{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.bar{
  display:flex;
  align-items:center;
  gap:10px;
}

.bar__label{
  width:280px;           /* zwęź/poszerz jeśli potrzeba */
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:14px;
  color:#334155;
}

.bar__track{
  flex:1;
  height:14px;
  background:#eef2f7;
  border-radius:999px;
  position:relative;
}

.bar__fill{
  position:absolute;
  inset:0 auto 0 0;      /* left:0; top:0; bottom:0 */
  width:0%;
  border-radius:999px;
  background:linear-gradient(90deg,#6366f1,#22c1c3);
}

.bar__value{
  width:110px;           /* miejsce na wartość */
  text-align:right;
  font-variant-numeric:tabular-nums;
  color:#0f172a;
  font-size:13px;
}

/* ─── Pozycja w dokumencie ───────────────────────── */
.pos-intro-card,
.pos-summary-card {
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pos-controls {
  margin: 1rem 0 0.75rem;
}

.pos-field {
  max-width: 560px;
}

.pos-field label {
  display: block;
  margin: 0 0 0.38rem;
  font-weight: 600;
  color: #374151;
}

#posTagSelect {
  appearance: none;
  width: 100%;
  min-width: 0;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0.55rem 2.2rem 0.55rem 0.9rem;
  font-size: 0.96rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 0.8em;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

#posTagSelect:hover {
  border-color: #6366f1;
  background-color: #fcfcff;
}

#posTagSelect:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99,102,241,.3);
}

/* jeśli zadziała select2, też ma wyglądać dobrze */
.pos-controls .select2-container {
  width: 100% !important;
  max-width: 560px;
}

.pos-controls .select2-container .select2-selection--single {
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
}

.pos-controls .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 42px;
  padding-left: 0.9rem;
  color: #111827;
  font-size: 0.96rem;
}

.pos-controls .select2-container .select2-selection--single .select2-selection__arrow {
  height: 42px;
  right: 8px;
}

.pos-controls .select2-container--default.select2-container--focus .select2-selection--single,
.pos-controls .select2-container--default .select2-selection--single:hover {
  border-color: #6366f1;
}

.pos-summary-card {
  padding: 0.8rem 1rem;
}

.pos-summary-card p {
  margin: 0.35rem 0;
}

.pos-bars {
  display: grid;
  gap: 0.55rem;
}

.pos-bars--flat {
  margin-top: 0.8rem;
  padding: 0.1rem 0 0.2rem;
}

.pos-bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 96px;
  gap: 0.65rem;
  align-items: center;
}

.pos-bar-label {
  color: #374151;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.88rem;
}

.pos-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
  position: relative;
}

.pos-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg,#6366f1,#4338ca);
}

.pos-bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  font-size: 0.88rem;
}

.pos-bar-label {
  color:#374151;
  font-weight: 600;
  white-space: nowrap;
}

.pos-bar-track {
  height: 14px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
  position: relative;
}

.pos-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg,#6366f1,#4338ca);
}

.pos-bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  font-size: 0.92rem;
}

.pos-bar-val .muted {
  color:#6b7280;
}

.pos-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

@media (max-width: 860px) {
  .pos-bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .pos-bar-val {
    text-align: left;
  }

  #posTagSelect {
    min-width: 240px;
    width: 100%;
  }
}

#speakerStats .num,
#tagBySpeakerTable .num,
#speakerByTagTable .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tab-speakers .speaker-tool-card + .speaker-tool-card {
  margin-top: 1rem;
}

#tab-speakers .speaker-controls-grid {
  margin-top: 0.75rem;
}

#tab-speakers .speaker-table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

#tab-speakers .speaker-table-wrap .stats-table {
  margin-top: 0.5rem;
}

.stats-sortable-table th.is-sortable {
  position: relative;
  cursor: pointer;
  padding-right: 20px;
  user-select: none;
  transition: background-color 0.15s ease;
}

.stats-sortable-table th.is-sortable:hover {
  background-color: #eef2ff;
}

.stats-sortable-table th.sorted-asc::after {
  content: "▲";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72em;
  color: #6366f1;
}

.stats-sortable-table th.sorted-desc::after {
  content: "▼";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72em;
  color: #6366f1;
}

/* Dwie kolumny w karcie "Tagi i relacje per mówca" */
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 1024px) {
  .two-cols { grid-template-columns: 1fr; }
}

/* liczby wyrównane do prawej */
#prsTagTable td.num,
#prsRelTable td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* lekki odstęp pod selectem */
#prsSpeakerSelect {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 1.9rem 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6em center;
  background-size: .8em;
  min-width: 280px;
}
#prsSpeakerSelect:hover { border-color: #6366f1; }
#prsSpeakerSelect:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99,102,241,.3);
}

#distTagSelect,
#distSpeakerSelect {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 1.9rem 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6em center;
  background-size: .8em;
  min-width: 280px;
}

#distTagSelect:hover,
#distSpeakerSelect:hover {
  border-color: #6366f1;
}

#distTagSelect:focus,
#distSpeakerSelect:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99,102,241,.3);
}

/* ─────────────── Wyszukiwarka ─────────────── */

.search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 12px 0 18px;
}

.search-controls label {
  font-weight: 500;
  color: #374151;
  margin-right: 4px;
}

.search-controls select {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 1.9rem 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 0.8em;
}

.search-controls select:hover {
  border-color: #6366f1;
}

.search-controls select:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.search-results {
  margin-top: 1rem;
}

.search-results .result-item {
  background: #fdfdfd;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.search-results .result-item h4 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  color: #111827;
}

.search-results .result-item p {
  margin: 0.2rem 0;
  color: #374151;
  font-size: 0.9rem;
}

/* Styl dla przycisku Szukaj */
#searchBtn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.5em 1.2em;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

#searchBtn:hover {
  background: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* ─── Relacje: szerokości kolumn ─── */
/* ─── Relacje: szerokości kolumn (nr / relacja / Nb. / %) ─── */
#tab-relations .list-table th:nth-child(1),
#tab-relations .list-table td:nth-child(1) {
  width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tab-relations .list-table th:nth-child(2),
#tab-relations .list-table td:nth-child(2) {
  width: 100%;
}

#tab-relations .list-table th:nth-child(3),
#tab-relations .list-table td:nth-child(3) {
  width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tab-relations .list-table th:nth-child(4),
#tab-relations .list-table td:nth-child(4) {
  width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Charakterystyka dokumentu */
.doc-info-box {
  margin-top: 2em;
}

.doc-info-box h2 {
  font-size: 1.4em;
  margin-bottom: 0.6em;
  color: #111827;
}

.doc-info-table th {
  width: 220px;
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
}

.doc-info-table td {
  color: #111827;
}

/* Bufor od dołu, żeby footer nie zasłaniał treści */
.stats-tab {
  padding-bottom: 150px; /* wysokość footera */
}

.section-title {
  font-size: 1.3em;
  font-weight: 600;
  margin: 1.2em 0 0.6em;
  color: #111827;
  display: flex;
  align-items: center;
}

#oneTagReport {
  border-top: 2px solid #eee;
  margin-top: 1.5em;
  padding-top: 1em;
}

#oneTagReport .stats-box .value {
  font-size: 1.5em;
}

.co-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.8em 1em;
  margin: 0.8em 0 1.2em;
  font-size: 0.95em;
}

#tab-cooccrelations h2 {
  margin-top: 1rem;
  margin-bottom: 0.6rem;
}

#tab-cooccrelations .stats-box {
  min-width: 160px;
}

/* Współwystępowanie relacji — lekkie dopieszczenie */
#tab-cooccrelations h2 { margin-top: 0; }
#tab-cooccrelations .cooccurrence-results { margin-top: 12px; }
#tab-cooccrelations .stats-table { margin-top: .5em; }

/* Styl dla dropdownów w zakładce Współwystępowanie relacji */
#coRel1, #coRel2, #oneRelSelect {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.4em 1.8em 0.4em 0.8em;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 0.8em;
}

#coRel1:hover, #coRel2:hover, #oneRelSelect:hover {
  border-color: #6366f1;
}

#coRel1:focus, #coRel2:focus, #oneRelSelect:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* Przyciski w zakładkach statystyk */
.stats-btn {
  background: #eef4fb;
  border: 1px solid #cddff5;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #0b3a67;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.stats-btn:hover {
  background: #e1edfa;
  border-color: #80bfff;
  color: #083256;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.12);
}

.assoc-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.assoc-top-card {
  margin-bottom: 0.75rem;
}

.assoc-section-card,
.assoc-intro-card {
  background: #fcfcfd;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.assoc-intro-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.assoc-results-block .section-title {
  margin: 0 0 0.7rem;
}

.assoc-results-block .assoc-metric-boxes {
  margin-top: 0.2rem;
  gap: 1rem;
}

.assoc-results-block .stats-box {
  min-width: 170px;
  padding: 1rem 1.2rem;
}

.assoc-results-block .assoc-table {
  table-layout: fixed;
  width: 100%;
  margin-top: 0.5rem;
}

.assoc-results-block .assoc-table th,
.assoc-results-block .assoc-table td {
  vertical-align: top;
}

.assoc-results-block .assoc-table td:nth-child(1) {
  width: 140px;
  white-space: nowrap;
}

.assoc-results-block .assoc-table td:nth-child(2) {
  width: 110px;
}

.assoc-results-block .assoc-table td:nth-child(3) {
  line-height: 1.55;
}

@media (max-width: 1100px) {
  .assoc-results-block .assoc-table td:nth-child(1),
  .assoc-results-block .assoc-table td:nth-child(2) {
    width: auto;
    white-space: normal;
  }
}




/* Tabela asocjacji */
.assoc-table td, .assoc-table th {
  padding: 0.5em 0.75em;
  text-align: left;
  vertical-align: top;
}
.assoc-table td:nth-child(2) {
  font-family: 'Roboto Mono', monospace;
  text-align: right;
  white-space: nowrap;
}
.assoc-table td:nth-child(3) {
  color: #555;
  font-size: 0.9em;
}

.pos-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 1rem 0;
  min-height: 140px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #374151;
}

.pos-bar {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.pos-bar-fill {
  width: 100%;
  background: linear-gradient(to top, #6366f1 0%, #a5b4fc 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .2s;
}

.pos-bar-label {
  margin-top: .4rem;
  line-height: 1.2;
}

.pos-bar-count {
  color: #6b7280;
  font-size: .75em;
}

/* multi-select (relacje AND) */
.search-controls select[multiple] {
  padding-right: 0.8rem;
  background-image: none;
  min-height: 74px;
}

.search-controls input[type="text"],
.search-controls input[type="number"] {
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-controls input[type="text"]:focus,
.search-controls input[type="number"]:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.chip-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: #111827;
  cursor: pointer;
  user-select: none;
}
.chip-radio input { accent-color: #2563eb; }

.search-advanced summary {
  cursor: pointer;
  color: #374151;
  font-weight: 600;
  margin-top: 2px;
}

/* Wyniki (nowy markup) */
.search-result {
  background: #fdfdfd;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.9rem 1.05rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.search-meta {
  font-size: 0.95rem;
  color: #111827;
  margin-bottom: 0.35rem;
}
.search-text {
  font-size: 0.95rem;
  color: #374151;
  margin: 0.15rem 0 0.2rem;
}
.search-ann {
  color: #374151;
  font-size: 0.9rem;
}
.search-rel {
  color: #374151;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

#searchClearBtn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  padding: 0.5em 1.0em;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}
#searchClearBtn:hover {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

/* ─────────────── Łańcuchy relacji ─────────────── */

.chains-intro-card,
.chains-controls-card,
.chains-legend-card {
  margin-top: 1rem;
}

.chains-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.chains-help-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  line-height: 1.55;
  color: #475569;
}

.chains-help-item strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #111827;
}

.chains-controls-grid {
  margin-top: 0.5rem;
}

.chains-legend-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  color: #475569;
  line-height: 1.55;
}

#chainsRelType,
#chainsMinLength,
#chainsDirection {
  appearance: none;
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 1.9rem 0.45rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'14'%20height%3D'10'%20viewBox%3D'0%200%2014%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201L7%208L13%201'%20stroke%3D'%236b7280'%20stroke-width%3D'2'%20fill%3D'none'%20stroke-linecap%3D'round'%20/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 0.8em;
}

#chainsRelType:hover,
#chainsMinLength:hover,
#chainsDirection:hover {
  border-color: #6366f1;
}

#chainsRelType:focus,
#chainsMinLength:focus,
#chainsDirection:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.chains-path-cell {
  font-family: inherit;
  font-size: 0.95em;
  white-space: normal;
  word-break: break-word;
  color: #1f2937;
  line-height: 1.7;
}

#chainsSummary .stats-box .value {
  font-size: 1.5em;
}

#chainsTable td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chains-open-btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.chain-node-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  vertical-align: middle;
}

.chain-node-id {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.92em;
  color: #334155;
}

.chain-arrow {
  display: inline-block;
  margin: 0 6px;
  color: #475569;
  font-weight: 600;
}

.chain-sep {
  margin: 0 8px;
  color: #94a3b8;
}

.chains-path-cell {
  font-family: inherit;
  font-size: 0.95em;
  white-space: normal;
  word-break: break-word;
  color: #1f2937;
  line-height: 1.7;
}

.chains-path-cell .inline-tag {
  vertical-align: middle;
}

.stats-relation-card-header {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9em;
}

.stats-relation-card {
  background: #fdfdfd;
}

.stats-relation-two-col {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}

.stats-rel-endpoint {
  padding: 0.15em 0;
}

.stats-rel-endpoint-label {
  display: inline-block;
  margin-bottom: 0.45em;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.stats-rel-connector {
  margin: 0.2em 0 0.35em;
}

.stats-open-graph-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 1.02em;
  line-height: 1;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

.stats-open-graph-btn:hover {
  opacity: 1;
}

.stats-open-graph-btn:active {
  transform: translateY(1px);
}

/* === Stats modal: porządny układ komentarza eksperckiego === */
#statsInfoModal .expert-comment-modal__dialog {
  width: min(1500px, 96vw);
  max-height: min(92vh, 1200px);
}

#statsInfoModal .expert-comment-modal__body {
  padding: 18px 20px 20px;
  line-height: 1.45;
}

#statsInfoModal .expert-comment-row + .expert-comment-row {
  margin-top: 1em;
}

#statsInfoModal .expert-comment-label {
  margin-bottom: 0.3em;
  font-weight: 700;
}

#statsInfoModal .expert-comment-value {
  white-space: normal;
  line-height: 1.58;
}

#statsInfoModal .stats-info-section {
  margin-bottom: 1.1em;
  padding: 0.9em 1em;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

#statsInfoModal .stats-info-section-title {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.55em;
}

#statsInfoModal .stats-info-segment-text {
  font-size: 1.03em;
  line-height: 1.62;
  color: #111827;
  font-style: italic;
}

#statsInfoModal .stats-info-tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.55em;
}

#statsInfoModal .stats-info-ann-text {
  font-size: 1em;
  line-height: 1.58;
  color: #111827;
}

#statsInfoModal .stats-annotation-translation {
  margin: 0.45em 0 0;
}

#statsInfoModal .inline-tag {
  vertical-align: middle;
}

/* ─────────────── Cooccurrence / Cooccrelations refresh ─────────────── */

.stats-cooc-tab {
  padding-top: 72px;
}

.stats-tool-card {
  background: #fcfcfd;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1.2rem 1.25rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-top: 1rem;
}

.stats-tool-card + .stats-tool-card {
  margin-top: 1.25rem;
}

.stats-tool-card--secondary {
  background: #ffffff;
}

.stats-tool-card__header {
  margin-bottom: 1rem;
}

.stats-tool-card__title {
  margin: 0 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 700;
  color: #111827;
}

.stats-tool-card__desc {
  margin: 0;
  color: #6b7280;
  font-size: 0.94rem;
  line-height: 1.45;
}

.stats-tool-grid {
  display: grid;
  gap: 16px 18px;
  align-items: start;
}

.stats-tool-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-tool-grid--1 {
  grid-template-columns: 1fr;
}

.stats-tool-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stats-tool-field label {
  font-weight: 600;
  color: #374151;
}

.stats-tool-field--wide {
  max-width: 640px;
}

.stats-filter-input {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.48rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.stats-filter-input::placeholder {
  color: #9ca3af;
}

.stats-filter-input:hover {
  border-color: #6366f1;
}

.stats-filter-input:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.stats-tool-field select {
  min-width: 0 !important;
  width: 100%;
}

.stats-tool-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}

#cooccurrenceResults,
#cooccurrenceRelResults,
#oneTagReport,
#oneRelReport {
  margin-top: 1rem !important;
}

#tab-cooccurrence .stats-table,
#tab-cooccrelations .stats-table {
  margin-top: 0.75rem;
}

#tab-cooccurrence .stats-metric-boxes,
#tab-cooccrelations .stats-metric-boxes {
  margin-top: 1rem;
}

@media (max-width: 980px) {
  .stats-tool-grid--2 {
    grid-template-columns: 1fr;
  }

  .stats-tool-field--wide {
    max-width: 100%;
  }
}

.stats-searchable-select {
  width: 100%;
}

.stats-tool-field .select2-container {
  width: 100% !important;
}

.stats-tool-field .select2-container--default .select2-selection--single {
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  padding: 0 0.35rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stats-tool-field .select2-container--default .select2-selection--single:hover {
  border-color: #6366f1;
}

.stats-tool-field .select2-container--default.select2-container--focus .select2-selection--single,
.stats-tool-field .select2-container--default.select2-container--open .select2-selection--single {
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.stats-tool-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px;
  color: #111827;
  padding-left: 0.35rem;
  padding-right: 2rem;
  font-size: 0.95rem;
}

.stats-tool-field .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
  right: 8px;
}

.select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.select2-search--dropdown {
  padding: 0.55rem;
  background: #fff;
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.95rem;
}

.select2-search--dropdown .select2-search__field:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.select2-results__option {
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
}

/* ─────────────── Asocjacje: intro + Select2 ─────────────── */

.assoc-intro-card {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.assoc-intro-card p {
  margin: 0.45rem 0 0;
  color: #374151;
  line-height: 1.58;
}

#tab-assoc .stats-tool-card {
  margin-bottom: 1rem;
}

#tab-assoc .stats-searchable-select {
  width: 100%;
}

#tab-assoc .select2-container {
  width: 100% !important;
}

#tab-assoc .select2-container--default .select2-selection--single {
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  padding: 0 0.35rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#tab-assoc .select2-container--default .select2-selection--single:hover {
  border-color: #6366f1;
}

#tab-assoc .select2-container--default.select2-container--focus .select2-selection--single,
#tab-assoc .select2-container--default.select2-container--open .select2-selection--single {
  border-color: #4338ca;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

#tab-assoc .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px;
  color: #111827;
  padding-left: 0.35rem;
  padding-right: 2rem;
  font-size: 0.95rem;
}

#tab-assoc .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
  right: 8px;
}
