main {
  padding-top: calc(var(--toolbar-h) + 12px); /* wysokość headera + margines */
}

/* ===============================
   BACKGROUND THEMES
================================ */

body.bg-white {
  background: #ffffff;
}

body.bg-paper {
  background-color: #efe6d6;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(120, 102, 78, 0.04) 0,
      rgba(120, 102, 78, 0.04) 1px,
      transparent 1px,
      transparent 16px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(120, 102, 78, 0.04) 0,
      rgba(120, 102, 78, 0.04) 1px,
      transparent 1px,
      transparent 16px
    );
  background-attachment: fixed;
}

.background-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  padding: 3px;
  border: 1px solid #d9dee7;
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.bg-btn:hover {
  background: #eef2f7;
  color: #334155;
}

.bg-btn.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

html, body {
  scroll-padding-bottom: calc(var(--annotation-footer-h) + 6px);
}

/* Odstęp z lewej strony dla listy segmentów */
#qaPairsPanel,
#qaPairsOutput {
  padding-left: 6px;   /* możesz zmienić np. na 24px */
  box-sizing: border-box;
  padding-bottom: calc(var(--annotation-footer-h));
}



/* QA potrzebuje układu pionowego (a nie globalnego flex-row) */
.tab-content[data-tab="qa"].active {
  display: flex;
  flex-direction: column;    /* kluczowe */
  align-items: stretch;
  overflow: visible;         /* ważne dla sticky */
}

/* Pasek narzędzi QA doklejony pod #toolbar */
.qa-toolbar-inner {
  position: sticky;
  top: var(--global-header-h);  /* ustawiasz JS-em */
  z-index: 1100;                /* nad treścią, nad #toolbar=1000 */
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  width: 100%;
}

.annotation-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.7em;
  align-items: flex-end;
  background: linear-gradient(to right, #f0f4ff, #f5f7ff);
  padding: 0.5em 0.5em;
  border: 1px solid #d0d8ea;
  border-radius: 12px;
  margin-top: 0.4em;
  margin-bottom: 1em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border-bottom: 2px solid #cdd8f0;

}

.qa-toolbar-container,
.tab-content[data-tab="qa"] { overflow: visible; }


.annotation-group {
  display: flex;
  flex-direction: row;  /* ⬅️ zamiast column */
  align-items: center;  /* ⬅️ żeby input był wyśrodkowany pionowo */
  gap: 0.5em;           /* ⬅️ trochę większy odstęp między elementami */
}



.annotation-toolbar input[type="text"],
.annotation-toolbar select {
  padding: 0.4em 0.6em;
  border-radius: 4px;
  border: 1px solid #bbb;
  font-size: 1em;
  width: 100%;
  max-width: 100%;
}

.annotation-toolbar button {
  padding: 0.6em 1em;
  background-color: #0057b7;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
}

.annotation-toolbar button:disabled {
  background-color: #aaa;
  cursor: not-allowed;
}




.qa-ann.selected {
  outline: 2px dashed #007bff;
  background-color: #eaf2ff;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
  border-radius: 6px;
  transition: all 0.25s ease-in-out;
}

.qa-segment-row {
  display: flex;
  border-bottom: 1px solid #ddd;
  padding: 0.5em 0;
}

body.bg-paper .qa-segment-row {
  border-bottom-color: #cfbea3;
}

.qa-segment-row:last-child {
  border-bottom: none;
}

.qa-ann {
  margin-bottom: 0.7em;
  padding-bottom: 1.8em; /* zwiększamy padding na dole */
  border-bottom: 1px solid #eee;
  position: relative; /* potrzebne, jeśli będziemy używać float */
}

body.bg-paper .qa-ann {
  border-bottom-color: #d8cab1;
}

.qa-ann:last-child {
  border-bottom: none;
}

#qaPairsPanel {
  position: relative;
}

#qaPairsOutput {
  position: relative;
  z-index: 2;
}

.qa-relation-arrows-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}

.qa-rel-arrow-path {
  fill: none;
  stroke: #8ea1b8;
  color: #8ea1b8;
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.96;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  transition:
    stroke 0.14s ease,
    stroke-width 0.14s ease,
    stroke-opacity 0.14s ease,
    filter 0.14s ease;
}

body.bg-paper .qa-rel-arrow-path {
  stroke: #9f8c6a;
  color: #9f8c6a;
}

.qa-rel-arrow-path.is-rel-hovered {
  stroke: #4f7fb8;
  color: #4f7fb8;
  stroke-width: 3.7;
  stroke-opacity: 1;
  filter: drop-shadow(0 1px 2px rgba(79, 127, 184, 0.12));
}

body.bg-paper .qa-rel-arrow-path.is-rel-hovered {
  stroke: #8b7048;
  color: #8b7048;
  filter: drop-shadow(0 1px 2px rgba(139, 112, 72, 0.12));
}

.qa-rel-arrow-path.is-rel-selected {
  stroke: #2563eb;
  color: #2563eb;
  stroke-width: 4.1;
  stroke-opacity: 1;
}

body.bg-paper .qa-rel-arrow-path.is-rel-selected {
  stroke: #7c5b2c;
  color: #7c5b2c;
}

.qa-rel-arrow-hitbox {
  fill: none;
  stroke: transparent;
  stroke-width: 15;
  pointer-events: stroke;
  cursor: pointer;
}

.qa-rel-arrow-label-group {
  pointer-events: auto;
  cursor: pointer;
}

.qa-rel-arrow-label-bg {
  fill: rgba(255,255,255,0.98);
  stroke: #cbd5e1;
  stroke-width: 1.1;
  transition:
    fill 0.14s ease,
    stroke 0.14s ease;
}

body.bg-paper .qa-rel-arrow-label-bg {
  fill: rgba(251, 243, 228, 0.98);
  stroke: #d3c2a3;
}

.qa-rel-arrow-label {
  font-size: 12.5px;
  font-weight: 700;
  fill: #334155;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.qa-rel-arrow-label-id {
  fill: #475569;
  font-weight: 700;
}

.qa-rel-arrow-label-sep {
  fill: #94a3b8;
  font-weight: 700;
}

.qa-rel-arrow-label-main {
  fill: #334155;
  font-weight: 700;
}

.qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-bg {
  fill: #eef4ff;
  stroke: #9bb8e8;
}

body.bg-paper .qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-bg {
  fill: #f4ead9;
  stroke: #cdb58a;
}

.qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label,
.qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-id,
.qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-main {
  fill: #365d92;
}

body.bg-paper .qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label,
body.bg-paper .qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-id,
body.bg-paper .qa-rel-arrow-label-group.is-rel-hovered .qa-rel-arrow-label-main {
  fill: #7a5d2e;
}

.qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-bg {
  fill: #dbeafe;
  stroke: #60a5fa;
}

body.bg-paper .qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-bg {
  fill: #eadcc7;
  stroke: #c7ad7c;
}

.qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label,
.qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-id,
.qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-main {
  fill: #1e40af;
}

body.bg-paper .qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label,
body.bg-paper .qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-id,
body.bg-paper .qa-rel-arrow-label-group.is-rel-selected .qa-rel-arrow-label-main {
  fill: #6d4c1c;
}

.qa-ann-port {
  position: relative;
  display: inline-flex;
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  margin: 0 0.12em 0 0.02em;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #94a3b8;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.96);
  z-index: 3;
  pointer-events: none;
  vertical-align: middle;
  transform: translateY(1px);
}

body.bg-paper .qa-ann-port {
  background: #fbf5ea;
  box-shadow: 0 0 0 2px rgba(248, 240, 225, 0.98);
}

.qa-ann-port.is-rel-selected {
  border-color: #1d4ed8;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.98),
    0 0 0 5px rgba(37,99,235,0.18);
}

body.bg-paper .qa-ann-port.is-rel-selected {
  border-color: #7c5b2c;
  box-shadow:
    0 0 0 2px rgba(248, 240, 225, 0.98),
    0 0 0 5px rgba(124,91,44,0.16);
}

.relation-arrows-toggle-wrap {
  display: inline-flex;
  align-items: center;
}

.relation-arrows-toggle-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease,
    color 0.15s ease;
}

.relation-arrows-toggle-btn:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

.relation-arrows-toggle-btn:active {
  transform: translateY(1px);
}

.relation-arrows-toggle-btn.is-active {
  background: #eaf3ff;
  border-color: #9fc1ea;
  color: #1f4b7a;
}

.qa-ann .relation-chip {
  float: right;
  margin-left: 0.5em;
}

.qa-ann.highlighted {
  box-shadow: 0 0 0 3px #007bff55;
  border-radius: 6px;
}

.relation-label {
  font-size: 0.8em;
  color: #666;
  margin-top: 0.2em;
  margin-left: 0.4em;
  font-style: italic;
}

.relation-chip.active {
  background-color: #e1f0ff;
  border: 2px solid #007bff;
}

.relation-chip {
  background-color: #f0f0f0;
  color: #333;
  padding: 0.3em 0.6em;
  border-radius: 1em;
  font-size: 0.9em;
  font-weight: 500;
  display: inline-block;
  margin-top: 0.2em;
}

/* Plakietka z ID relacji (R1, R2, ...) */
.rel-id-badge{
  display: inline-block;
  font-size: 0.75em;
  line-height: 1.2;
  padding: 0.05em 0.55em;
  margin-right: 0.45em;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  vertical-align: middle;
}

/* Subtelne ID anotacji */
.annotation-tag-row {
  display: flex;
  align-items: center;
  gap: 0.38em;
  flex-wrap: wrap;
  margin-bottom: 0.12em;
}

.annotation-rationale-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 0;
  margin-left: 0.12em;
  font-size: 1.02em;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition:
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.05s ease,
    text-shadow 0.15s ease;
  opacity: 0.72;
}

.annotation-rationale-toggle:hover {
  color: #475569;
  opacity: 1;
}

.annotation-rationale-toggle:active {
  transform: translateY(1px);
}

.annotation-rationale-toggle.has-rationale {
  color: #c58a16;
  opacity: 1;
  text-shadow: 0 0 0.01px #c58a16;
}

.annotation-rationale-toggle.has-rationale:hover {
  color: #a76d08;
}

.ann-id-badge {
  display: inline-block;
  font-size: 0.68em;
  line-height: 1;
  padding: 0;
  margin-right: 0.0em;
  border: 0;
  background: transparent;
  color: #8795a8;
  vertical-align: middle;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.relation-selection-popup {
  position: absolute;
  background: #f9fbff;
  border: 2px solid #007bff;
  padding: 1em;
  border-radius: 10px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  min-width: 220px;
}

.relation-selection-popup {
  max-width: 260px;
  word-break: break-word;
}

.relation-selection-popup {
  background: #eaf4ff;
  border: 2px solid #007bff;
  padding: 0.5em;
  border-radius: 8px;
  box-shadow: 0px 2px 6px rgba(0,0,0,0.2);
}

.timestamp-input {
  font-size: 0.9em;
  padding: 2px 4px;
  width: 60px;
  border: 1px solid #aaa;
  border-radius: 4px;
}

.timestamp-pill {
  display: inline-block;
  background-color: #e6f4ea;
  color: #065f46;
  font-size: 0.8em;
  border-radius: 12px;
  padding: 2px 8px;
  margin-left: 6px;
  font-weight: 500;
  box-shadow: 0 0 0.5px #aaa;
  white-space: nowrap;
}

.segment-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 0.5em;
  align-items: center;
}

.segment-flags label {
  background-color: #eef3f8;
  padding: 0.4em 0.7em;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 0.9em;
  cursor: pointer;
  user-select: none;
}

.segment-flags input[type="checkbox"] {
  margin-right: 0.3em;
  transform: scale(1.1);
}

.annotation-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.85em;
  color: #444;
}

.annotation-features > * {
  white-space: nowrap;
}

.annotation-features {
  font-size: 0.85em;
  color: #444;
  margin-top: 0.3em;
  padding-left: 0.5em;
  border-left: 2px solid #ddd;
}

.logic-structure-sentence {
  margin-top: 0.5em;
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.segment-logic-display {
  font-size: 0.9em;
  color: #555;
  margin-top: 0.3em;
  background: #f4f4f4;
  padding: 0.4em;
  border-radius: 4px;
}

/* === Tag filter dropdown === */
.tag-filter { display:inline-block; position:relative; }
.tag-filter-btn {
  height:32px; padding:0 .75rem; border:1px solid #cbd5e1; border-radius:8px;
  background:#f8fafc; cursor:pointer;
}

.tag-filter-header { display:flex; gap:.5rem; padding:.25rem .25rem .5rem; border-bottom:1px solid #eef2f7; }
.tag-filter-header input { flex:1; height:30px; padding:.25rem .5rem; border:1px solid #cbd5e1; border-radius:6px; }
.tag-filter-groups { max-height:320px; overflow:auto; padding:.5rem .25rem; }
.tag-filter-group { margin-bottom:.5rem; }
.tag-filter-group h4 { margin:.25rem 0 .25rem; font-size:.85rem; color:#475569; font-weight:600; }
.tag-filter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: .32rem 0;
}

.tag-filter-item {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.tag-filter-item input {
  margin-top: .15rem;
  flex: 0 0 auto;
}

.tag-filter-item input { margin-right:.35rem; }
.tag-filter-footer { display:flex; justify-content:flex-end; padding:.5rem .25rem 0; border-top:1px solid #eef2f7; }

.relation-form {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: #f9fbff; /* jaśniejszy niebieski zamiast żółtego */
  padding: 2em;
  border: 2px solid #0057b7;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  width: 700px;
  max-width: 95vw;
  font-size: 1.15em;
  font-family: "Segoe UI", sans-serif;
  transition: all 0.2s ease;
}


.relation-form label {
  display: block;
  margin-top: 0.5em;
}

.relation-form select,
.relation-form button {
  margin-top: 0.3em;
  width: 100%;
}

.relation-form button {
  background-color: #e7f0ff;
  color: #004499;
  text-align: center;
  justify-content: center;
  border: 1px solid #bcd3f2;
  border-radius: 4px;
  padding: 0.3em 0.8em;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition: background-color 0.2s ease;
}

.relation-form button:hover {
  background-color: #d4e7ff;
}

.annotate-btn {
  padding: 0.3em 0.6em;
  font-size: 0.9em;
  cursor: pointer;
  background: #007bff;
  border: none;
  border-radius: 4px;
  color: white;
  margin-top: 0.5em;
}

.annotation-menu {
  margin-top: 0.3em;
  display: flex;
  gap: 0.3em;
}

.annotation-tag {
  padding: 0.5em;
  border-radius: 4px;
  font-size: 0.85em;
}

.annotation-tag strong {
  display: block;
  margin-bottom: 0.25em;
}

.annotation-text {
  color: #111;
  font-size: 1.1em;
  line-height: 1.6;
  font-weight: 400;
  padding: 0.2em 0.3em;
  font-family: Palatino, "Palatino Linotype", serif;
}

.collapsed-summary {
  font-size: 1.25em;
  line-height: 1.6;
  font-weight: 400;
  font-family: Palatino, "Palatino Linotype", serif;
}

.annotation-tag.collapsed .collapsed-summary {
  display: inline;
}

.annotation-tag:not(.collapsed) .collapsed-summary {
  display: none;
}

.annotation-tag.collapsed .annotation-details {
  display: none;
}

.toggle-annotation-btn {
  margin-left: 0.5em;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1em;
  padding: 0;
}

.annotation-comment {
  margin-top: 0.3em;
  font-size: 0.9em;
  background-color: #f6f6f6;
  padding: 4px 8px;
  border-left: 3px solid #ccc;
  border-radius: 3px;
}

.comment-editor {
  position: fixed;
  top: 20%;
  left: 30%;
  background: white;
  border: 1px solid #aaa;
  padding: 1em;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  z-index: 10000;
}

.annotation-interactions {
  margin-top: 0.4em;
  font-size: 0.85em;
  color: #333;
}

.interaction-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-top: 0.2em;
}

.interaction-chip {
  background: #e0f7fa;
  border-radius: 1em;
  padding: 0.4em 1em;
  font-size: 0.95em;
  font-weight: 500;
  border: 1px solid #00acc1;
  color: #004d40;
  white-space: nowrap;
}

.relation-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 1.1em;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.relation-table thead {
  background-color: #f0f4ff;
}

.relation-table th {
  text-align: left;
  padding: 10px;
  font-weight: 600;
  font-size: 0.95em;
  color: #1a1a1a;
  border-bottom: 1px solid #ccc;
}

.relation-table td {
  padding: 10px;
  vertical-align: top;
  border-top: 1px solid #eee;
}

.relation-table tr:hover {
  background-color: #f9fbff;
}

.relation-table td:nth-child(1) {
  text-align: center;
  font-weight: bold;
  color: #555;
}

.relation-table td:nth-child(2),
.relation-table td:nth-child(3),
 {
  white-space: normal;
  word-break: break-word;
}


.relation-table td:nth-child(5) {
  font-weight: 500;
  color: #333;
  font-size: 0.9em;
}

.relation-table td:last-child {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.relation-table button {
  padding: 0.35em 0.6em;
  border-radius: 4px;
  border: none;
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.relation-table button:nth-child(1) {
  background-color: #6c757d;
  color: white;
}
.relation-table button:nth-child(2) {
  background-color: #007bff;
  color: white;
}
.relation-table button:nth-child(3) {
  background-color: #dc3545;
  color: white;
}

.relation-table button:hover {
  opacity: 0.85;
}

.relation-table td:last-child {
  padding-left: 12px;

}

.relation-table button {
  min-width: 80px;
}

.relation-table td:nth-child(4) {
}

.relation-table td:nth-child(1) {
  text-align: center;
  font-weight: bold;
  color: #555;
}

.relation-table td:nth-child(2),
.relation-table td:nth-child(3),
 {
  white-space: normal;
  word-break: break-word;
}

.relation-table td:nth-child(5) {
  font-size: 1.20em !important;
  font-family: Palatino, "Palatino Linotype", serif;
  font-weight: 500;
  color: #333;
  line-height: 1.5;
}

.gold-controls {
  margin-top: 1em;
  padding: 0.5em;
  background: #f8f8f8;
  border-left: 4px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
}

.gold-controls input {
  margin-right: 6px;
  padding: 2px 4px;
}

.gold-controls button {
  margin-right: 6px;
}

.gold-annotations-display ul {
  margin-top: 0.3em;
  margin-bottom: 0.5em;
  padding-left: 1.2em;
}

.gold-annotations-display li {
  margin-bottom: 0.3em;
}

.gold-collapsible-content.collapsed {
  display: none;
}

.collapsed-gold-preview {
  font-style: italic;
  color: #555;
  margin-left: 0.5em;
}

.gold-block-container {
  margin-top: 1em;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.5em;
  background: #fafafa;
}

.toggle-full-gold-btn {
  font-weight: bold;
  margin-bottom: 0.5em;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  padding: 0.3em 0.6em;
  border-radius: 4px;
}

.sentence-features-wrapper {
  background: #f3f3f3;
  padding: 0.5em;
  margin-top: 0.5em;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.bool-flags-container {
  margin-top: 0.5em;
}

.bool-flags-container label {
  margin-right: 1em;
  font-weight: 500;
}

.marker-wrapper {
  margin-top: 0.5em;
  padding: 0.3em;
}

.marker-list {
  margin-top: 0.3em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.marker-chip {
  background: #e0f0ff;
  border-radius: 1em;
  padding: 0.3em 0.8em;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  border: 1px solid #ccc;
}

.marker-chip button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1em;
}

.graph-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.graph-popup-content {
  background: white;
  padding: 1em;
  border-radius: 8px;
  width: 80%;
  height: 80%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  flex-direction: column;
}

.graph-popup-close {
  position: absolute;
  top: 0.5em;
  right: 0.8em;
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: #333;
  z-index: 10;
}

.extended-metadata {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 1.5em;
  border: 1px solid #ccc;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  z-index: 2000;
  max-width: 90vw;
  width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  font-size: 1em;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.extended-metadata label {
  display: block;
  margin-bottom: 0.8em;
  font-size: 1em;
}

.extended-metadata .checkbox-wrapper {
  margin-bottom: 0.5em;
}

.segment-annotations {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

/* placeholder tylko na czas prac – można usunąć gdy włożysz paski */
.qa-toolbar-placeholder {
  font-size: .95rem;
  color: #475569;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: .6rem .75rem;
}

#annotationTypeResults {
  margin-top: 1.5em;
  padding: 1em;
  background-color: #f9f9f9;
  border-left: 4px solid #0073aa;
  border-radius: 6px;
}

#annotationTypeResults h3 {
  margin-top: 0;
  font-size: 1.2em;
  color: #0073aa;
}

/* FORMULARZ CECH Z ZDANIA W ZAKŁADCE ANOTACJA */

.features-panel {
  background-color: #f5f7fa;
  border: 1px solid #ccd6e0;
  border-radius: 8px;
  padding: 1em;
  margin-top: 0.5em;
  font-family: sans-serif;
  font-size: 0.95em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.features-panel label {
  display: block;
  margin: 0.5em 0 0.2em;
  font-weight: 500;
  color: #003366;
}

.features-panel input[type="text"],
.features-panel textarea {
  width: 20%;
  padding: 0.3em;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95em;
  box-sizing: border-box;
}

.features-panel textarea {
  resize: vertical;
}

.features-panel input[type="checkbox"],
.features-panel input[type="radio"] {
  margin-right: 0.3em;
}

.features-panel button {
  margin: 1em auto 0 auto; /* góra: 1em, poziomo: auto (wyśrodkowanie), dół: 0 */
  padding: 0.4em 1.2em;
  background-color: #337ab7;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  display: block;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}


.features-panel button:hover {
  background-color: #286090;
}

.segment-id-tag {
  background-color: #eaf4ff;
  border: 1px solid #b3d7ff;
  border-radius: 12px;
  padding: 0.2em 0.6em;
  font-size: 0.85em;
  color: #003366;
  flex-shrink: 0;
  line-height: 1.4; /* dodane */
}

.segment-text {
  flex: 1;
  font-weight: normal;
  line-height: 1.4; /* dodane */
}

.segment-speaker {
  font-weight: bold !important;
  margin-right: 0.3em;
}

.segment {
  position: relative;
  z-index: 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 1em;
  margin-bottom: 1em;
  background: #fff;
}

.segment.selected {
  border-color: #007bff;
  background: #eaf4ff;
}

.segment-meta {
  font-size: 0.9em;
  color: #555;
  margin-bottom: 0.5em;
}

.segment-text {
  margin-bottom: 0.5em;
  font-size: 1em;
  font-weight: normal;
}

.relation-structure-block::before {
  content: attr(id);
  display: block;
  font-size: 1.40em;
  color: #888;
  margin-bottom: 0.25em;
}

.relation-structure-block {
  background: #fdfdfd;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1em;
  margin-bottom: 1.2em;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.05);
}

.relation-structure-block ul {
  padding-left: 1.2em;
  margin: 0.5em 0;
}

.relation-structure-block {
  max-width: 100%;
  overflow-x: auto;
}

/* FORMULARZ CECH Z ZDANIA W ZAKŁADCE ANOTACJA */

.note-icon {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.6;
}

.note-icon .custom-tooltip {
  position: absolute;;
  top: 50%;
  color: #111;
  left: -30px;
  transform: translate(-100%, -50%);  /* przesuwa cały dymek w lewo i centruje w pionie */
  background: #f9f9f9;
  border: 1px solid #ccc;
  padding: 0.4em 0.7em;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-size: 0.85em;
  white-space: pre-wrap;
  white-space: normal;         /* <-- pozwala na zawijanie */
  max-width: 600px;
  min-width: 350px;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  pointer-events: none;
}

.note-icon:hover .custom-tooltip {
  opacity: 1;
}

.clickable-segment.selected {
  background-color: #eaf4ff;
  border: 1px;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.hidden {
  display: none !important;
}

.relation-select-button {
  background-color: #e0efff;
  border: 1px solid #99c2ff;
  color: #004080;
  padding: 0.4em 0.8em;
  font-size: 0.95em;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
  width: 100%;
  text-align: center;
}

.relation-select-button:hover {
  background-color: #cce5ff;
}

.remove-rel {
  color: #888;
  font-size: 0.9em;
  margin-left: 0.4em;
  cursor: pointer;
}
.remove-rel:hover {
  color: red;
}

.segment-id-tag {
  display: inline-block;
  background-color: #e6f0ff;
  color: #003366;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.9em;
  margin-right: -0.4em;
  margin-bottom: 1em;
  border: 1px solid #ccc;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.segment-id-tag:hover {
  background-color: #cce0ff;
}


.flags {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.flag-chip {
  background-color: #f0f0f0;
  color: #333;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75em;
  font-weight: 500;
}

.sentence-features-toggle-btn {
  font-size: 0.85em;             /* mniejsze emoji, dopasowane do tekstu */
  vertical-align: text-top;      /* lepsze wyrównanie względem tekstu */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 0.4em;
  color: #666;
  line-height: 1;
}

.sentence-features-toggle-btn:hover {
  background-color: #d4e7ff;
}

.argumentative-flag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 0; /* niżej niż panel formularza */
  background: #d8f1f0;
  color: #007b8f;
  font-size: 0.75em;
  padding: 0.2em 0.6em;
  border-radius: 1em;
  border: 1px solid #b2ebf2;
  pointer-events: none; /* nie koliduje z kliknięciami */
}

.argumentative-flag.true {
  background-color: #e0f5e9;  /* pastelowa zieleń tła */
  color: #2e7d32;             /* spokojny, ciemniejszy zielony */
  border-color: #b2dfdb;      /* lekki zielono-miętowy odcień */
}


.argumentative-flag.false {
  background-color: #f0f0f0;
  color: #555;
}

.argumentative-flag.true::before {
  content: "💡 ";
}

.argumentative-flag.false::before {
  content: "✖️ ";
}

.radio-toggle input[type="radio"] {
  display: none;
}

.radio-toggle:has(input[type="radio"]:checked) {
  background-color: #337ab7;
  color: white;
  border-color: #337ab7;
}


.radio-toggle input[type="radio"]:checked + span {
  font-weight: bold;
}

.radio-toggle:has(input[type="radio"]:checked) {
  background-color: #337ab7;
  color: white;
  border-color: #337ab7;
}

.relation-details-box {
  background: #eef6ff;
  font-family: Palatino, "Palatino Linotype", serif;
  border: 1px solid #b3d1f2;
  border-left: 4px solid #007bff;
  padding: 0.75em 1em;
  margin-top: 0.5em;
  border-radius: 6px;
  font-size: 0.92em;
  color: #1a1a1a;
  transition: all 0.3s ease;
}

.relation-details-entry {
  margin-bottom: 0.4em;
}

.relation-details-box.hidden {
  display: none;
}

.relation-details-box div {
  margin-bottom: 0.3em;
}

.relation-details-text {
  font-family: Palatino, "Palatino Linotype", serif;
  font-size: 1.05em;
  margin-bottom: 1.5em !important; /* <-- tutaj zwiększ odstęp */
}

.relation-details-segment {
  display: flex;
  align-items: flex-start; /* <- to przywraca właściwe wyrównanie */
  gap: 1.1em;
  font-family: Arial, sans-serif;
  font-size: 0.95em;
  color: #444;
  line-height: 1.4;
}

.logic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1em;
  margin-bottom: 1em;
}

.logic-row label {
  white-space: nowrap;
}

.logic-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.radio-label {
  margin-right: 1em;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.radio-toggle-group {
  display: flex;
  gap: 1em;
  margin-top: 0.3em;
}

.radio-toggle {
  position: relative;
  display: inline-block;
  padding: 0.4em 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  background-color: #f9f9f9;
  transition: all 0.2s ease-in-out;
  user-select: none;
}

.filtered-annotation-block {
  padding: 0.5em 1em;
  margin-bottom: 1em;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.03);
}

.filtered-annotation-block p {
  margin: 0.4em 0;
  font-size: 0.95em;
}

.filtered-annotation-block strong {
  color: #333;
}

.logic-structure-input {
  width: 40ch;
  max-width: 100%;
  padding: 0.3em 0.6em;
  font-size: 0.95em;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.logic-flags-display {
  font-size: 0.85em;
  color: #444;
  margin: 0.25em 0 0.5em;
  padding: 2px 6px;
  background: #f7f7f7;
  border-left: 3px solid #ccc;
}

:root { --annotation-footer-h: 88px; } /* wysokość „rezerwowa” na dół */

/* Stały footer tylko dla zakładki QA */
#annotation-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1300;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -6px 16px rgba(0,0,0,.06);
  padding: .5rem .75rem;
  min-height: var(--annotation-footer-h);
}

/* W środku używamy Twojego istniejącego stylu paska, ale bez ramek/tła */
#annotation-footer .annotation-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: .6rem;
  align-items: center;
  background: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

/* Żeby treść QA nie chowała się pod stopką – rezerwujemy miejsce na dole */
.tab-content[data-tab="qa"].active {
  padding-bottom: var(--annotation-footer-h);
}

/* Lepsze zachowanie na małych szerokościach */
@media (max-width: 900px) {
  #annotation-footer .annotation-toolbar { gap: .5rem; }
  #annotation-footer { min-height: 104px; } /* trochę więcej miejsca na zawijanie */
}

.data-import-tools {
  margin-top: 0.5em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

.annotation-footer {
  padding: 0.75em 1em;
  border-top: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.annotation-footer .data-import-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

/* === Stopka QA: kompakt i wyrównanie === */

/* ======= Annotation Footer (elegancki pasek) ======= */
.af{
  --af-h: 72px;
  position: sticky;           /* trzyma się dołu widoku */
  bottom: 0;
  z-index: 1000;
  background: color-mix(in oklab, var(--panel) 92%, white 8%);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 22px rgba(0,0,0,.06);
  backdrop-filter: saturate(120%) blur(6px);
}
.af__inner{
  height: var(--af-h);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr; /* lewo / środek / prawo */
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

/* Zabezpieczenie, żeby treść nie wpadała pod stopkę */
/*.tab-content[data-tab="qa"]{
  padding-bottom: calc(var(--af-h) + 14px);
}

/* Kolumny */
.af__left, .af__center, .af__right{
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.af__left{ justify-content: flex-start; }
.af__center{
  justify-content: center;
  flex-wrap: wrap;
}
.af__right{ justify-content: flex-end; }

.af__group{ display: flex; align-items: center; gap: 8px; }
.af__grow{ flex: 1; min-width: 180px; }
.af__label{ color: var(--muted); font-weight: 600; }

/* Pola i selecty spójne z resztą */
.af select,
.af input[type="text"]{
  height: 36px;
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  width: 100%;
}

/* Przyciski – korzystają z global .toolbar-button */
.toolbar-button.btn-primary{
  background: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 70%, white 30%);
  color: #fff;
}
.toolbar-button.btn-primary:hover{
  filter: brightness(1.05);
}

/* File inputs – ukryte, klikamy w label */
.af__file{ display: none; }

/* Warstwy */
.layer-tabs{
  display: flex; gap: .4rem; flex-wrap: wrap;
}
.layer-tab{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: .35rem .7rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color .15s ease, background .15s ease;
}
.layer-tab:hover{ border-color:#cbd5e1; background:#f8fafc; }
.layer-tab.active{ color: var(--accent); border-color:#bfd3ff; }

/* Tag filter – tylko kosmetyka przycisku, resztę masz już w CSS-ie */
#qaTagFilter{ position: relative; }

/* Responsywność – zwijamy w jedną kolumnę */
@media (max-width: 1100px){
  .af__inner{ grid-template-columns: 1fr; height: auto; padding: 12px 14px; gap: 10px; }
  .af__left, .af__center, .af__right{ justify-content: stretch; flex-wrap: wrap; }
  .tab-content[data-tab="qa"]{ padding-bottom: 18px; }
}

/* Poprawka: filtr etykiet otwiera się NAD przyciskiem */
#annotation-footer { overflow: visible; }            /* nie obcinaj popovera */
#qaTagFilter { position: relative; overflow: visible; }

#tagFilterMenu{
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: auto;
  right: 0;
  z-index: 2001;

  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 820px;
  max-width: calc(100vw - 24px);
  min-width: 320px;
  max-height: 60vh;
  overflow: auto;
  padding: 10px;
  box-sizing: border-box;
}

#tagFilterMenu[hidden]{ display: none !important; }

/* Mały „dzióbek” wskazujący przycisk */
#tagFilterMenu::after{
  content: "";
  position: absolute;
  bottom: -8px;
  right: 16px;
  border: 8px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.06));
}

/* Gdy ekran niski – ogranicz wysokość, by zawsze się mieściło */
@media (max-height: 620px){
  #tagFilterMenu{ max-height: calc(100vh - 140px); }
}

.annotation-group.type-select  {
  flex: 0 0 320px;
  max-width: 320px;
  min-width: 320px;
}

.annotation-group.type-select #typeSelect,
.annotation-group.type-select .select2-container {
  width: 100% !important;
  min-width: 0 !important;
}

.annotation-group.type-select .select2-selection--single {
  width: 100% !important;
  box-sizing: border-box;
}

.annotation-group.custom-tag  {
  flex: 0 0 180px;
  max-width: 200px;
}

.annotation-group.flex-grow   {
  flex: 1 1 auto;
  min-width: 300px;
}

.annotation-group.add-button  {
  flex: 0 0 60px;
  max-width: 120px;
}


/* Styl lekki, zgodny z tagmemaybe.org */
input[type="file"].file-input {
  padding: 0.3em 0.8em;
  font-size: 0.95em;
  color: #333;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Styl przycisku w input[type=file] */
input[type="file"]::file-selector-button {
  background-color: #f5f7fb;
  color: #333;
  border: 1px solid #ccc;
  padding: 0.3em 0.8em;
  margin-right: 0.6em;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

input[type="file"].file-input {
  max-width: 250px;
  width: 100%;
}



/* Hover: delikatna zmiana tła i ramki */
input[type="file"]::file-selector-button:hover {
  background-color: #e8eef9;
  border-color: #999;
}

#addAnnotationToSegmentBtn {
  height: 36px;
  padding: 0 1em;
  font-size: 1em;
  font-weight: 500;
  background-color: #f4f4f4;
  color: #4b5563;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em; /* odstęp między ikoną a tekstem */
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

#addAnnotationToSegmentBtn:hover:not(:disabled) {
  background-color: #d4dafe;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#addAnnotationToSegmentBtn:disabled {
  background-color: #f0f0f0;
  color: #aaa;
  border: 1px solid #ddd;
  cursor: not-allowed;
  box-shadow: none;
}

#addAnnotationToSegmentBtn {
  font-size: 1em;
  line-height: 1;
}

/* 🟦 Styl pola Select2 */
.select2-container--default .select2-selection--single {
  height: 36px;
  padding: 6px 12px;
  border: 1px solid #bbb;
  border-radius: 8px;
  background-color: #fff;
  font-size: 1em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
}

/* szerokość Select2 kontrolujemy lokalnie, nie globalnie */

/* 🔽 Styl ikonki rozwijania */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 10px;
}

/* ✏️ Styl tekstu wybranego */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0;
  font-size: 1em;
  color: #222;
}

/* 🔍 Styl listy rozwijanej */
.select2-container--default .select2-results > .select2-results__options {
  font-size: 0.95em;
}

/* 💡 Hover i zaznaczenie */
.select2-results__option--highlighted {
  background-color: #dbeafe !important;
  color: #111 !important;
}

.select2-results__option--selected {
  background-color: #bfdbfe !important;
  color: #111 !important;
}

/* Nadpisz selektora z większą siłą */
.annotation-toolbar .select2-container--default .select2-selection--single {
  height: 36px !important;
  padding: 6px 12px !important;
  border: 1px solid #bbb !important;
  border-radius: 8px !important;
  background-color: #fff !important;
  font-size: 1em !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
  display: flex !important;
  align-items: center !important;
}

.annotation-toolbar .select2-selection__rendered {
  font-size: 1em !important;
  color: #222 !important;
  padding-left: 0 !important;
}

.annotation-toolbar .select2-selection__arrow {
  height: 100% !important;
  right: 10px !important;
}

.btn-export-json {
  background: linear-gradient(to right, #0057b7, #007bff);
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  padding: 0.6em 1.2em;
  font-size: 1em;
  box-shadow: 0 4px 12px rgba(0, 87, 183, 0.3);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.btn-export-json:hover {
  background: linear-gradient(to right, #004a9f, #0066e0);
  box-shadow: 0 6px 16px rgba(0, 87, 183, 0.45);
  cursor: pointer;
}

.copy-segment-button button {
  font-size: 1.2em;
  padding: 0.4em 0.7em;
  background: #e0f2fe;           /* jasny błękit zamiast szarości */
  border: 1px solid #38bdf8;     /* niebieska ramka */
  border-radius: 8px;
  color: #0369a1;                /* ikona/tekst też niebieski */
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.copy-segment-button button:hover {
  background: #bae6fd;           /* mocniejszy błękit przy hoverze */
  transform: translateY(-1px);   /* lekkie uniesienie */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* delikatny cień */
}

.copy-segment-button button:active {
  transform: translateY(0);      /* wrażenie „kliknięcia” */
  background: #7dd3fc;
}

/* Select2: dropdown zawsze ponad stopką i z lekkim odstępem */
.select2-container .select2-dropdown{
  z-index: 4000 !important;          /* #annotation-footer ma ~1300 */
}
.select2-container--open.select2-container--below .select2-dropdown{
  margin-top: 6px;                   /* odstęp od pola */
}
.select2-container--open.select2-container--above .select2-dropdown{
  margin-bottom: 6px;                /* gdy otworzy się w górę */
}

/* Pozwól przeciągać róg listy Select2 */
.select2-container .select2-dropdown{
  resize: both;                /* łapka w prawym-dolnym rogu */
  overflow: auto;              /* pokaż scroll, gdy trzeba */
  width: 320px;
  min-width: 320px;
  min-height: 160px;
  max-width: min(90vw, 720px);
  max-height: 70vh;
  box-sizing: border-box;
}

/* Domyślnie Select2 ogranicza wysokość opcji – zdejmujemy limit */
.select2-results,
.select2-results > .select2-results__options{
  max-height: none !important;
}

/* Stylowanie listy Select2 */
.select2-container .select2-dropdown {
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
  font-size: 14px;
}

/* Nagłówki grup (np. "Speech Acts", "Argument Mining") */
.select2-results__group {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  background: #f7f7f9;
  padding: 6px 10px;
  margin-top: 4px;
  border-radius: 4px;
}

/* Opcje */
.select2-results__option {
  padding: 6px 12px;
  border-radius: 4px;
  margin: 2px 4px;
}


/* 🌳 Ikona drzewka w rogu segmentu (obok 📎) */
.tree-icon {
  position: absolute;
  right: 36px;              /* 📎 ma right:10px – ustawiamy obok */
  bottom: 6px;
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.65;
}
.tree-icon:hover { opacity: 0.95; }


/* Stopka modala */
.hierarchy-actions {
  display: flex; justify-content: flex-end; gap: .5em; margin-top: .8em;
}
.hierarchy-actions .btn {
  border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; padding: .5em .9em; cursor: pointer;
}
.hierarchy-actions .btn.primary { background: #2563eb; color: white; border-color: #2563eb; }
.hierarchy-actions .btn.primary:hover { filter: brightness(1.05); }

.hierarchy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 40px 1fr; /* kolumna na strzałki + reszta */
}

.hierarchy-item {
  display: contents; /* pozwala gridowi używać dzieci jako wierszy */
}

.hierarchy-item .order-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
}

.hierarchy-item .content {
  display: flex;
  align-items: center;
  gap: .5em;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: .3em .5em;
  margin-bottom: .35em;
  background: #f8fafc;
}

/* 🌳 Hierarchia tagów – zawijanie długich tytułów, bez zmiany układu */
.hierarchy-item .title{
  flex: 1 1 auto;
  min-width: 0;              /* kluczowe dla zawijania w flex w Chrome */
  white-space: normal;       /* pozwól zawijać */
  overflow-wrap: anywhere;   /* nowoczesny wrap */
  word-break: break-word;    /* fallback */
  text-overflow: clip;       /* bez wielokropka */
}

.hierarchy-item .lvl   { width: 48px; text-align: right; color: #64748b; font-size: .85em; }
.hierarchy-item .indent-controls { display: flex; gap: .3em; margin-left: .5em; }

.content[data-level="0"] { margin-left: 0; }
.content[data-level="1"] { margin-left: 24px; }
.content[data-level="2"] { margin-left: 48px; }
.content[data-level="3"] { margin-left: 72px; }

/* === Wizualizacja hierarchii w QA: strzałki przy dzieciach === */
.qa-ann[data-id] {
  position: relative;
}

.qa-ann[data-id][style*="margin-left"]::before {
  content: "↳";
  position: absolute;
  left: -18px;       /* odległość od treści */
  top: 0.25em;       /* pionowe wyrównanie */
  font-size: 1.1em;
  color: #64748b;    /* neutralny szary */
  pointer-events: none;
}



.toolbar-button.btn-primary{
  background: #2563eb; color:#fff; border: 1px solid #1d4ed8;
}
.toolbar-button.btn-primary:hover{ filter: brightness(1.05); }

/* === Tryb super-anotacji === */
.gold-mode-btn {
  background: #fff8db;
  border: 1px solid #facc15;
  color: #7c6300;
  font-weight: 600;
  border-radius: 10px;
  transition: all .2s ease;
}
.gold-mode-btn:hover {
  background: #fef3c7;
}
.gold-mode-btn.active {
  background: #fde68a;
  border-color: #eab308;
  color: #633c00;
}

.segment-text {
  margin-top: 0.2em;
}

.segment-translations {
  margin-top: 0.5em;
  padding-left: 0.6em;
  border-left: 2px solid #e5e7eb;
  color: #4b5563;
  font-size: 0.95em;
}

.segment-translation {
  margin-top: 0.25em;
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
}

.lang-pill {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-size: 0.75em;
  line-height: 1.4;
  color: #374151;
  background: #f9fafb;
  flex: 0 0 auto;
}

.translation-text {
  flex: 1 1 auto;
}

.translations-toggle-wrap {
  margin-right: 0.75em;
}

.translations-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.9em;
  color: #374151;
  user-select: none;
}

/* ===============================
   TRANSLATIONS VISIBILITY
================================ */

.hide-translations .segment-translation {
  display: none;
}

/* ─── Search (Stats) ───────────────────────────── */
.search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem .8rem;
  align-items: center;
  margin: .8rem 0 1rem;
}

.search-controls label {
  font-weight: 600;
  color: #374151;
  margin-right: .2rem;
}

.search-controls select {
  min-width: 160px;
  padding: .45rem .55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
}

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

.search-result .search-meta {
  font-size: .95rem;
  color: #111827;
  margin-bottom: .35rem;
}

.search-result .search-text {
  color: #374151;
  margin: .25rem 0 .35rem;
}

.search-result .search-ann {
  color: #6b7280;
  font-size: .92rem;
}

.search-result .search-rel {
  color: #374151;
  margin: .25rem 0;
}

/* Manage Tag modal */
#manageTagModal textarea {
  resize: vertical;
}

/* Manage Tag modal – dopasowanie szerokości (korzysta ze stylu .config-content) */
.manage-tag-content{
  width: min(820px, 94vw);
}

/* ===============================
   TAG I18N + ANN TEXT I18N
================================ */

.tag-i18n-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-left: 0.45em;
  padding: 0.22em 0.6em;
  border-radius: 999px;
  border: 1px solid #bcd3f2;
  background: #eef5ff;
  color: #355070;
  font-size: 0.8em;
  line-height: 1.3;
  vertical-align: middle;
}

.tag-i18n-lang {
  display: inline-block;
  padding: 0.02em 0.4em;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.78em;
  font-weight: 600;
}

.annotation-text-i18n {
  margin-top: 0.45em;
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
  padding-left: 0.2em;
  color: #4b5563;
  font-size: 0.95em;
}

.hierarchy-main-text {
  margin-left: 0.25em;
}

.relation-details-type .tag-i18n-chip {
  margin-left: 0.45em;
}

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

.rel-arrow-out {
  color: #2e7d32;   /* zielony */
}

.rel-arrow-in {
  color: #1565c0;   /* niebieski */
}

.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;
}

.show-rel-neighborhood {
  display: inline-block;
  line-height: 1;
}

.show-rel-neighborhood:hover {
  transform: scale(1.08);
}

/* ===============================
   KOMENTARZ EKSPERCKI SEGMENTU
================================ */

.expert-fields {
  margin-top: 0.9em;
  padding-top: 0.8em;
  border-top: 1px solid #dbe3ef;
}

.expert-fields-header {
  font-weight: 700;
  color: #234;
  margin-bottom: 0.4em;
}

.difficulty-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin-top: 0.35em;
}

.difficulty-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.45em 0.8em;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease-in-out;
}

.difficulty-chip input[type="radio"] {
  display: none;
}

.difficulty-chip:has(input[type="radio"]:checked) {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #0f3b78;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.difficulty-clear-btn {
  margin-top: 0.6em;
  padding: 0.35em 0.75em;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.difficulty-clear-btn:hover {
  background: #f8fafc;
}

/* 📝 Ikona notatki eksperckiej */
.expert-note-icon {
  position: absolute;
  right: 62px;   /* przed 🌳 i 📎 */
  bottom: 6px;
  font-size: 1.18em;
  cursor: pointer;
  opacity: 0.72;
  z-index: 2;
}

.expert-note-icon:hover {
  opacity: 1;
}

/* 🧾 Ikona uzasadnienia anotacji */
.expert-rationale-icon {
  position: absolute;
  right: 88px;   /* na lewo od 📝 */
  bottom: 6px;
  font-size: 1.18em;
  cursor: default;
  opacity: 0.82;
  z-index: 2;
}

/* 🙂🧐😵 Ikona trudności */
.expert-difficulty-icon {
  position: absolute;
  right: 114px;   /* na lewo od 🧾 */
  bottom: 6px;
  font-size: 1.18em;
  cursor: default;
  opacity: 0.82;
  z-index: 2;
}

/* Modal komentarza eksperckiego */
.expert-comment-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 16000;
  padding: 24px;
}

.expert-comment-modal.open {
  display: flex;
}

.expert-comment-modal__dialog {
  width: min(2300px, 99vw);
  max-height: min(99vh, 1200px);
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
}

.expert-comment-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5edf7;
  background: #f8fbff;
}

.expert-comment-modal__title {
  font-size: 1.06em;
  font-weight: 700;
  color: #1f3552;
}

.expert-comment-modal__meta {
  margin-top: 0.2em;
  color: #64748b;
  font-size: 0.92em;
}

.expert-comment-modal__close {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 0.2em 0.65em;
  font-size: 1.2em;
  cursor: pointer;
  line-height: 1;
}

.expert-comment-modal__close:hover {
  background: #f8fafc;
}

.expert-comment-modal__body {
  padding: 18px;
  overflow-y: auto;
  font-size: 0.98em;
  line-height: 1.55;
  color: #111827;
}

.expert-comment-row + .expert-comment-row {
  margin-top: 1.15em;
}

.expert-comment-label {
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.45em;
}

.expert-comment-lang-grid {
  display: grid;
  gap: 0.7em;
}

.expert-comment-lang-card {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  padding: 0.8em 0.95em;
  background: #ffffff;
}

.expert-comment-lang-card--pl {
  background: #f8fbff;
}

.expert-comment-lang-card--en {
  background: #fbfcfe;
}

.expert-comment-lang-head {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin-bottom: 0.45em;
}

.expert-comment-value {
  color: #111827;
  white-space: pre-wrap;
  line-height: 1.6;
}

.expert-comment-empty {
  color: #64748b;
  font-style: italic;
}

@media (min-width: 860px) {
  .expert-comment-lang-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Kontekst segmentu w modalu komentarza eksperckiego */
.expert-context-box {
  margin-bottom: 0.7em;
  padding: 0.8em 1em 0.75em;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fbff;
}

.expert-context-box--compact {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.expert-context-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em;
  font-size: 1.02em;
  line-height: 1.2;
  margin-bottom: 0.08em;
}

.expert-context-segid {
  font-weight: 700;
  color: #1f3552;
}

.expert-context-speaker {
  font-weight: 600;
  color: #334155;
}

.expert-context-text {
  white-space: pre-wrap;
  line-height: 1.32;
  margin: 0;
}

.expert-context-text--compact {
  font-size: 1.01em;
  color: #111827;
  margin-bottom: 0.18em;
}

.expert-context-meta {
  margin-top: 0.4em;
}

.expert-context-subtitle {
  font-size: 0.88em;
  font-weight: 700;
  color: #52657a;
  margin-bottom: 0.45em;
}

.expert-context-annotations {
  margin-top: 0.75em;
}

.expert-context-ann-list {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
}

.expert-context-ann {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.7em 0.85em;
}

.expert-context-ann-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45em;
  margin-bottom: 0.3em;
}

.expert-context-ann-id {
  display: inline-block;
  font-size: 0.78em;
  line-height: 1;
  color: #8795a8;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.expert-context-ann-tag .annotation-tag {
  vertical-align: middle;
}

.expert-context-ann-text {
  color: #111827;
  white-space: pre-wrap;
  line-height: 1.5;
}

.expert-context-ann-rationale {
  margin-top: 0.65em;
  padding-top: 0.65em;
  border-top: 1px solid #e8eef7;
}

.expert-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
}

.expert-mini-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28em 0.7em;
  border-radius: 999px;
  font-size: 0.88em;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #334155;
}

.expert-mini-chip--tag {
  background: #eef5ff;
  border-color: #bfd3f2;
  color: #274c77;
}

.expert-mini-chip--rel {
  background: #f6f8fb;
  border-color: #d7dee8;
  color: #475569;
}

.expert-comment-section {
  margin-top: 0.2em;
}

/* ===== Filtr etykiet — estetyka przycisków i panelu ===== */

#tagFilterMenu .tag-filter-actions-top,
#tagFilterMenu .tag-filter-actions-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

#tagFilterMenu .tag-filter-actions-top {
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  padding: 4px 0 10px 0;
  z-index: 2;
}

#tagFilterMenu .tag-filter-actions-bottom {
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 10px 0 2px 0;
  z-index: 2;
  border-top: 1px solid #eef2f7;
}

#tagFilterMenu button {
  appearance: none;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#tagFilterMenu button:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

#tagFilterMenu button:active {
  transform: translateY(1px);
}

#tagFilterMenu button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

#tagFilterClear {
  color: #49627f;
  background: #f8fbff;
}

#tagFilterClose {
  color: #26415f;
  background: #f4f8fd;
}

#tagFilterSearch {
  width: 100%;
  border: 1px solid #cfe0f5;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #fcfdff;
  color: #24364b;
  box-sizing: border-box;
}

#tagFilterSearch::placeholder {
  color: #8aa0b8;
}

#tagFilterSearch:focus {
  outline: none;
  border-color: #9fc1ea;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
  background: #fff;
}

#tagFilterMenu {
  background: #ffffff;
}

#tagFilterGroups {
  border-top: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
  padding: 10px 2px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.tag-filter-item {
  padding: 4px 6px;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.tag-filter-item:hover {
  background: #f8fbff;
}

/* ===============================
   MENU TŁUMACZEŃ W STOPCE
================================ */

.translations-menu {
  position: relative;
  display: inline-block;
}

.translations-menu-btn {
  appearance: none;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}

.translations-menu-btn:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

.translations-menu-btn:active {
  transform: translateY(1px);
}

.translations-menu-btn.is-active {
  background: #eaf3ff;
  border-color: #9fc1ea;
  color: #1f4b7a;
}

.translations-menu-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 2100;
  min-width: 290px;
  max-width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  padding: 10px;
  box-sizing: border-box;
}

.translations-menu-panel[hidden] {
  display: none !important;
}

.translations-menu-header {
  font-size: 0.86rem;
  font-weight: 700;
  color: #52657a;
  padding: 2px 4px 8px 4px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 8px;
}

.translations-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 8px 10px;
  border-radius: 10px;
  color: #24364b;
  font-size: 0.95rem;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.12s ease;
}

.translations-menu-item:hover {
  background: #f8fbff;
}

.translations-menu-item input {
  margin-top: 0.15rem;
  flex: 0 0 auto;
}

/* ===============================
   FILTR RELACJI
================================ */

.relation-filter {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.relation-filter-btn {
  appearance: none;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}

.relation-filter-btn:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

.relation-filter-btn:active {
  transform: translateY(1px);
}

.relation-filter-btn.is-active {
  background: #eaf3ff;
  border-color: #9fc1ea;
  color: #1f4b7a;
}

.relation-filter-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 2100;
  width: 420px;
  max-width: calc(100vw - 24px);
  min-width: 280px;
  max-height: 60vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  padding: 10px;
  box-sizing: border-box;
}

.relation-filter-menu[hidden] {
  display: none !important;
}

.relation-filter-menu::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 16px;
  border: 8px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.06));
}

.relation-filter-header,
.relation-filter-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.relation-filter-header {
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  padding: 4px 0 10px 0;
  z-index: 2;
}

.relation-filter-footer {
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 10px 0 2px 0;
  z-index: 2;
  border-top: 1px solid #eef2f7;
}

.relation-filter-menu button {
  appearance: none;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.relation-filter-menu button:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

#relationFilterSearch {
  width: 100%;
  border: 1px solid #cfe0f5;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #fcfdff;
  color: #24364b;
  box-sizing: border-box;
}

#relationFilterSearch::placeholder {
  color: #8aa0b8;
}

#relationFilterSearch:focus {
  outline: none;
  border-color: #9fc1ea;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
  background: #fff;
}

#relationFilterGroups {
  border-top: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
  padding: 10px 2px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.relation-filter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: .32rem 0;
}

.relation-filter-item {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  padding: 5px 8px;
  border-radius: 10px;
  transition: background 0.12s ease;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.relation-filter-item:hover {
  background: #f8fbff;
}

.relation-filter-item input {
  margin-top: .15rem;
  flex: 0 0 auto;
}

.relation-select-button--add {
  background-color: #f8fbff;
  border: 1px dashed #99c2ff;
  color: #0f4c81;
  font-weight: 600;
}

.relation-select-button--add:hover {
  background-color: #eaf4ff;
}

.relation-add-inline-input {
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.95rem;
  background: #fcfdff;
  color: #24364b;
}

.relation-add-inline-input:focus {
  outline: none;
  border-color: #9fc1ea;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
  background: #fff;
}

/* ===============================
   UJEDNOLICENIE PRZYCISKÓW W FOOTERZE
================================ */

#annotation-footer #downloadAutosaveBtn,
#annotation-footer #showTranscriptBtn,
#annotation-footer .tag-filter-btn,
#annotation-footer .relation-filter-btn,
#annotation-footer .translations-menu-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #cfe0f5;
  background: #f8fbff;
  color: #2c4a6b;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease,
    color 0.15s ease;
}

#annotation-footer #downloadAutosaveBtn:hover,
#annotation-footer #showTranscriptBtn:hover,
#annotation-footer .tag-filter-btn:hover,
#annotation-footer .relation-filter-btn:hover,
#annotation-footer .translations-menu-btn:hover {
  background: #eef6ff;
  border-color: #b8d0ee;
}

#annotation-footer #downloadAutosaveBtn:active,
#annotation-footer #showTranscriptBtn:active,
#annotation-footer .tag-filter-btn:active,
#annotation-footer .relation-filter-btn:active,
#annotation-footer .translations-menu-btn:active {
  transform: translateY(1px);
}

#annotation-footer #downloadAutosaveBtn:focus-visible,
#annotation-footer #showTranscriptBtn:focus-visible,
#annotation-footer .tag-filter-btn:focus-visible,
#annotation-footer .relation-filter-btn:focus-visible,
#annotation-footer .translations-menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

#annotation-footer .tag-filter-btn.is-active,
#annotation-footer .relation-filter-btn.is-active,
#annotation-footer .translations-menu-btn.is-active {
  background: #eaf3ff;
  border-color: #9fc1ea;
  color: #1f4b7a;
}

/* lekka kosmetyka exportu, żeby siedział w tej samej rodzinie gabarytowo */
#annotation-footer #exportJsonBtn {
  min-height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===============================
   MANAGE TAG MODAL
================================ */

.config-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 15000;
  padding: 24px;
}

.config-content {
  width: min(880px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
}

.manage-tag-content {
  width: min(820px, 94vw);
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5edf7;
  background: #f8fbff;
}

.config-header h2 {
  margin: 0;
  font-size: 1.06em;
  font-weight: 700;
  color: #1f3552;
}

.config-close {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 0.2em 0.65em;
  font-size: 1.2em;
  cursor: pointer;
  line-height: 1;
}

.config-close:hover {
  background: #f8fafc;
}

.config-body {
  padding: 18px;
  overflow-y: auto;
}

.config-section {
  margin-top: 0.6em;
}

.config-table-wrap {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
}

.config-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 18px;
  border-top: 1px solid #e5edf7;
  background: #fcfdff;
}

.config-footer-left,
.config-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.annotation-rationale-meta {
  margin-bottom: 1em;
  padding: 0.9em 1em;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fbff;
}

.annotation-rationale-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45em;
  margin-bottom: 0.45em;
}

.annotation-rationale-meta-text {
  color: #111827;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* =========================================
   ANNOTATION — PAPER MODE EXTENSION
   wklej na sam koniec pliku
========================================= */

:root {
  --ann-surface: #ffffff;
  --ann-surface-soft: #f8fafc;
  --ann-surface-elevated: rgba(255, 255, 255, 0.96);
  --ann-border: #d9dee7;
  --ann-border-strong: #cbd5e1;
  --ann-text: #111827;
  --ann-muted: #475569;

  --ann-toolbar-bg: rgba(255, 255, 255, 0.96);
  --ann-footer-bg: rgba(255, 255, 255, 0.96);

  --ann-switch-bg: #f8fafc;
  --ann-btn-bg: #ffffff;
  --ann-btn-hover-bg: #eef2f7;
  --ann-btn-active-bg: #ffffff;
  --ann-btn-active-text: #1d4ed8;

  --ann-menu-bg: #ffffff;
  --ann-menu-border: #dbe7f3;

  --ann-chip-bg: #f8fbff;
  --ann-chip-border: #cfe0f5;
  --ann-chip-border-strong: #b8d0ee;

  --ann-panel-soft: #f8fbff;
  --ann-panel-border: #dbe3ef;

  --ann-rel-chip-bg: #f6f8fb;
  --ann-rel-chip-border: #d7dee8;

  --ann-shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
  --ann-shadow-panel: 0 2px 12px rgba(15, 23, 42, 0.05);
}

body.bg-white {
  --ann-surface: #ffffff;
  --ann-surface-soft: #f8fafc;
  --ann-surface-elevated: rgba(255, 255, 255, 0.96);
  --ann-border: #d9dee7;
  --ann-border-strong: #cbd5e1;
  --ann-text: #111827;
  --ann-muted: #475569;

  --ann-toolbar-bg: rgba(255, 255, 255, 0.96);
  --ann-footer-bg: rgba(255, 255, 255, 0.96);

  --ann-switch-bg: #f8fafc;
  --ann-btn-bg: #ffffff;
  --ann-btn-hover-bg: #eef2f7;
  --ann-btn-active-bg: #ffffff;
  --ann-btn-active-text: #1d4ed8;

  --ann-menu-bg: #ffffff;
  --ann-menu-border: #dbe7f3;

  --ann-chip-bg: #f8fbff;
  --ann-chip-border: #cfe0f5;
  --ann-chip-border-strong: #b8d0ee;

  --ann-panel-soft: #f8fbff;
  --ann-panel-border: #dbe3ef;

  --ann-rel-chip-bg: #f6f8fb;
  --ann-rel-chip-border: #d7dee8;
}

body.bg-paper {
  --ann-surface: #fbf5ea;
  --ann-surface-soft: #f7efdf;
  --ann-surface-elevated: rgba(248, 240, 225, 0.96);
  --ann-border: #dccfb8;
  --ann-border-strong: #cdbd9f;
  --ann-text: #2e2a24;
  --ann-muted: #6f6557;

  --ann-toolbar-bg: rgba(245, 236, 220, 0.94);
  --ann-footer-bg: rgba(245, 236, 220, 0.94);

  --ann-switch-bg: #f8efdf;
  --ann-btn-bg: #f9f1e3;
  --ann-btn-hover-bg: #f4ead9;
  --ann-btn-active-bg: #e8ddc7;
  --ann-btn-active-text: #6b4e17;

  --ann-menu-bg: #fbf5ea;
  --ann-menu-border: #dccfb8;

  --ann-chip-bg: #fcf4e6;
  --ann-chip-border: #ddcfb6;
  --ann-chip-border-strong: #ccb993;

  --ann-panel-soft: #f7efdf;
  --ann-panel-border: #ddcfb6;

  --ann-rel-chip-bg: #f4ecdc;
  --ann-rel-chip-border: #d5c4a5;
}

/* ===== header ===== */

#toolbar {
  background: var(--ann-toolbar-bg);
  border-bottom: 1px solid var(--ann-border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(10px);
}

#toolbar .file-indicator,
#toolbar #annotatorName,
#toolbar .toolbar-button.btn-ghost {
  background: var(--ann-surface-elevated);
  border: 1px solid var(--ann-border);
  color: var(--ann-muted);
  box-shadow: var(--ann-shadow-soft);
}

#toolbar #annotatorName {
  color: var(--ann-text);
}

#toolbar .nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#toolbar .user-switch-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 40px;
}

#toolbar #annotatorName.annotator-name-compact {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

#toolbar #loadedFileName.file-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 260px;
  padding-left: 12px;
  padding-right: 12px;
  white-space: nowrap;
  overflow: hidden;
}

#toolbar #loadedFileName .file-indicator-icon {
  flex: 0 0 auto;
}

#toolbar #loadedFileName .file-indicator-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1500px) {
  #toolbar #annotatorName.annotator-name-compact {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
  }

  #toolbar .user-switch-btn {
    width: 36px;
    min-width: 36px;
    flex-basis: 36px;
  }

  #toolbar #loadedFileName.file-indicator {
    max-width: 180px;
  }
}

@media (max-width: 1280px) {
  #toolbar #loadedFileName.file-indicator {
    max-width: 140px;
  }
}

body.bg-paper #toolbar .tab-button.active {
  background: #f7eddb;
  border-color: #d7c7ab;
  box-shadow: none;
}

/* ===== background switcher ===== */

.background-switcher {
  border-color: var(--ann-border);
  background: var(--ann-switch-bg);
  box-shadow: var(--ann-shadow-soft);
}

.bg-btn {
  color: var(--ann-muted);
}

.bg-btn:hover {
  background: var(--ann-btn-hover-bg);
  color: var(--ann-text);
}

.bg-btn.active {
  background: var(--ann-btn-active-bg);
  color: var(--ann-btn-active-text);
  box-shadow: var(--ann-shadow-soft);
}

/* ===== footer ===== */

#annotation-footer {
  background: var(--ann-footer-bg);
  border-top: 1px solid var(--ann-border);
  box-shadow: 0 -6px 16px rgba(0,0,0,.06);
  backdrop-filter: blur(10px);
}

#annotation-footer .annotation-toolbar {
  background: none;
}

/* wspólna baza przycisków / inputów w stopce */
#annotation-footer .toolbar-button,
#annotation-footer .tag-filter-btn,
#annotation-footer .relation-filter-btn,
#annotation-footer .translations-menu-btn,
#annotation-footer input[type="file"].file-input,
#annotation-footer select,
#annotation-footer input[type="text"] {
  background: var(--ann-btn-bg);
  border: 1px solid var(--ann-border);
  color: var(--ann-text);
  box-shadow: var(--ann-shadow-soft);
}

#annotation-footer .toolbar-button:hover,
#annotation-footer .tag-filter-btn:hover,
#annotation-footer .relation-filter-btn:hover,
#annotation-footer .translations-menu-btn:hover,
#annotation-footer input[type="file"].file-input:hover,
#annotation-footer select:hover,
#annotation-footer input[type="text"]:hover {
  background: var(--ann-btn-hover-bg);
  border-color: var(--ann-border-strong);
}

#annotation-footer .tag-filter-btn.is-active,
#annotation-footer .relation-filter-btn.is-active,
#annotation-footer .translations-menu-btn.is-active {
  background: var(--ann-btn-active-bg);
  border-color: var(--ann-chip-border-strong);
  color: var(--ann-btn-active-text);
}

/* ===== popupy / menu ===== */

#tagFilterMenu,
.relation-filter-menu,
.translations-menu-panel {
  background: var(--ann-menu-bg);
  border: 1px solid var(--ann-menu-border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
}

#tagFilterMenu .tag-filter-actions-top,
#tagFilterMenu .tag-filter-actions-bottom,
.relation-filter-header,
.relation-filter-footer,
.translations-menu-header {
  background: var(--ann-menu-bg);
}

#tagFilterSearch,
#relationFilterSearch {
  background: var(--ann-btn-bg);
  border: 1px solid var(--ann-border);
  color: var(--ann-text);
}

#tagFilterSearch:focus,
#relationFilterSearch:focus,
.relation-add-inline-input:focus {
  border-color: var(--ann-chip-border-strong);
  background: var(--ann-surface);
}

/* ===== treść anotacji / chipy ===== */

body.bg-paper .qa-ann.selected {
  background-color: #f3ead8;
  box-shadow: 0 0 0 4px rgba(139, 111, 71, 0.10);
}

body.bg-paper .clickable-segment.selected {
  background-color: #f3ead8;
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.14);
}

.relation-chip {
  background-color: var(--ann-rel-chip-bg);
  border: 1px solid var(--ann-rel-chip-border);
  color: #334155;
}

.relation-chip.active {
  background-color: color-mix(in oklab, var(--ann-btn-active-bg) 78%, white 22%);
  border: 2px solid #60a5fa;
}

.rel-id-badge {
  background: var(--ann-surface);
  border-color: var(--ann-border);
  color: #475569;
}

.tag-i18n-chip {
  background: color-mix(in oklab, var(--ann-btn-bg) 88%, white 12%);
  border-color: var(--ann-chip-border);
  color: #355070;
}

.tag-i18n-lang,
.lang-pill {
  background: var(--ann-surface);
  border-color: var(--ann-border);
  color: #475569;
}

.segment-translations {
  border-left-color: var(--ann-border);
  color: var(--ann-muted);
}

.annotation-text-i18n {
  color: var(--ann-muted);
}

/* ===== panele, formularze, modale ===== */

.features-panel,
.relation-form,
.relation-selection-popup,
.relation-table,
.gold-block-container,
.sentence-features-wrapper,
.segment-logic-display,
.logic-flags-display,
.relation-details-box,
.graph-popup-content,
.extended-metadata,
.comment-editor,
.expert-comment-modal__dialog,
.expert-comment-lang-card,
.expert-context-box,
.expert-context-ann {
  background: var(--ann-surface);
  border-color: var(--ann-panel-border);
}

.expert-comment-modal__header,
.expert-context-box,
.features-panel,
.segment-logic-display,
.logic-flags-display {
  background: var(--ann-panel-soft);
}

.expert-comment-modal__header {
  border-bottom-color: var(--ann-border);
}

.expert-comment-modal__close {
  background: var(--ann-btn-bg);
  border-color: var(--ann-border);
  color: var(--ann-muted);
}

.expert-comment-modal__close:hover {
  background: var(--ann-btn-hover-bg);
}

/* ===== delikatne ocieplenie w paper mode dla ikon i detali ===== */

body.bg-paper .annotation-rationale-toggle.has-rationale {
  color: #a76d08;
}

body.bg-paper .note-icon,
body.bg-paper .tree-icon,
body.bg-paper .expert-note-icon,
body.bg-paper .expert-rationale-icon,
body.bg-paper .expert-difficulty-icon {
  opacity: 0.78;
}

body.bg-paper .segment-id-tag {
  background-color: #f1e6d2;
  border-color: #d7c7ab;
  color: #6b4e17;
}

body.bg-paper .segment-id-tag:hover {
  background-color: #eadcc3;
}

/* =========================================
   PAPER MODE — ANNOTATION RATIONALE MODAL
   wklej na sam koniec pliku
========================================= */

body.bg-paper #annotationRationaleModal .config-content {
  background: #fbf5ea;
  border-color: #dccfb8;
}

body.bg-paper #annotationRationaleModal .config-header {
  background: #f7efdf;
  border-bottom-color: #dccfb8;
}

body.bg-paper #annotationRationaleModal .config-header h2 {
  color: #4b3a20;
}

body.bg-paper #annotationRationaleModal .config-close {
  background: #f9f1e3;
  border-color: #d6c5a7;
  color: #5b4a2f;
}

body.bg-paper #annotationRationaleModal .config-close:hover {
  background: #f2e7d2;
}

body.bg-paper #annotationRationaleModal .config-footer {
  background: #f8efdf;
  border-top-color: #dccfb8;
}

body.bg-paper #annotationRationaleModal .annotation-rationale-meta {
  background: #f7efdf;
  border-color: #dccfb8;
}

body.bg-paper #annotationRationaleModal .annotation-rationale-meta-text {
  color: #2e2a24;
}

body.bg-paper #annotationRationaleModal label {
  color: #5f5344 !important;
}

body.bg-paper #annotationRationaleModal textarea {
  background: #fcf6eb;
  border: 1px solid #d6c5a7;
  color: #2e2a24;
}

body.bg-paper #annotationRationaleModal textarea::placeholder {
  color: #8a7c68;
}

body.bg-paper #annotationRationaleModal textarea:focus {
  outline: none;
  border-color: #c7b18a;
  box-shadow: 0 0 0 3px rgba(199, 177, 138, 0.18);
}

body.bg-paper #annotationRationaleModal .toolbar-button.btn-ghost {
  background: #f9f1e3;
  border-color: #d6c5a7;
  color: #5b4a2f;
}

body.bg-paper #annotationRationaleModal .toolbar-button.btn-ghost:hover {
  background: #f2e7d2;
}

body.bg-paper #annotationRationaleModal .toolbar-button.btn-primary {
  background: #d8c19a;
  border-color: #c7ae84;
  color: #3f2d12;
}

body.bg-paper #annotationRationaleModal .toolbar-button.btn-primary:hover {
  background: #cfb487;
}

/* === Header tabs: kliknięcie nie zmienia wyglądu nieaktywnej pastylki === */
#toolbar .tabs .tab-button:not(.active):visited,
#toolbar .tabs .tab-button:not(.active):focus,
#toolbar .tabs .tab-button:not(.active):focus-visible,
#toolbar .tabs .tab-button:not(.active):active {
  color: #334155 !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: none !important;
  transform: none !important;
}

body.bg-paper #toolbar .tabs .tab-button:not(.active):visited,
body.bg-paper #toolbar .tabs .tab-button:not(.active):focus,
body.bg-paper #toolbar .tabs .tab-button:not(.active):focus-visible,
body.bg-paper #toolbar .tabs .tab-button:not(.active):active {
  color: #5b4a2f !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* =========================================
   HEADER TABS — aktywna jasna, reszta piaskowa
========================================= */

#toolbar .tabs .tab-button {
  background: #efe6d6 !important;
  border: 1px solid #d6c5a7 !important;
  color: #5b4a2f !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

#toolbar .tabs .tab-button:hover {
  background: #f4ecde !important;
  border-color: #ccb894 !important;
  color: #4e3d24 !important;
}

#toolbar .tabs .tab-button.active,
#toolbar .tabs .tab-button[aria-current="page"] {
  background: #ffffff !important;
  border: 1px solid #d9dee7 !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06) !important;
}

#toolbar .tabs .tab-button.active:hover,
#toolbar .tabs .tab-button[aria-current="page"]:hover {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #111827 !important;
}

/* zachowaj neutralny wygląd nieaktywnych także po visited/focus */
#toolbar .tabs .tab-button:not(.active):visited,
#toolbar .tabs .tab-button:not(.active):focus,
#toolbar .tabs .tab-button:not(.active):focus-visible,
#toolbar .tabs .tab-button:not(.active):active {
  background: #efe6d6 !important;
  border-color: #d6c5a7 !important;
  color: #5b4a2f !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transform: none !important;
}

/* =========================================
   HEADER TABS — bez ukrytego suwaka na mniejszych ekranach
========================================= */

@media (max-width: 1500px) {
  #toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 10px;
  }

  #toolbar .nav-left {
    order: 1;
    flex: 0 0 auto;
  }

  #toolbar .tab-bar {
    order: 2;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
  }

  #toolbar .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    width: 100%;
    padding: 0;
    overflow: visible !important;
  }

  #toolbar .nav-right {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    padding-left: 0;
  }

  #toolbar .tabs .tab-button {
    padding: 9px 14px !important;
    font-size: 0.96rem !important;
  }

  #toolbar #loadedFileName {
    max-width: 100%;
  }
}

@media (max-width: 1200px) {
  #toolbar .tabs {
    gap: 6px;
  }

  #toolbar .tabs .tab-button {
    padding: 8px 12px !important;
    font-size: 0.92rem !important;
  }

  #toolbar .nav-right {
    gap: 6px;
  }
}

/* =========================================
   HEADER TABS — restore white mode look
========================================= */

body.bg-white #toolbar .tabs .tab-button {
  background: #ffffff !important;
  border: 1px solid #d9dee7 !important;
  color: #334155 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

body.bg-white #toolbar .tabs .tab-button:hover {
  background: #f8fbff !important;
  border-color: #cbd5e1 !important;
  color: #1f2937 !important;
}

body.bg-white #toolbar .tabs .tab-button.active,
body.bg-white #toolbar .tabs .tab-button[aria-current="page"] {
  background: #eef5ff !important;
  border: 1px solid #bfd3f2 !important;
  color: #1f3552 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
}

body.bg-white #toolbar .tabs .tab-button.active:hover,
body.bg-white #toolbar .tabs .tab-button[aria-current="page"]:hover {
  background: #eef5ff !important;
  border-color: #bfd3f2 !important;
  color: #1f3552 !important;
}

body.bg-white #toolbar .tabs .tab-button:not(.active):visited,
body.bg-white #toolbar .tabs .tab-button:not(.active):focus,
body.bg-white #toolbar .tabs .tab-button:not(.active):focus-visible,
body.bg-white #toolbar .tabs .tab-button:not(.active):active {
  background: #ffffff !important;
  border-color: #d9dee7 !important;
  color: #334155 !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transform: none !important;
}

body.bg-white #toolbar .tabs .tab-button.active:visited,
body.bg-white #toolbar .tabs .tab-button.active:focus,
body.bg-white #toolbar .tabs .tab-button.active:focus-visible,
body.bg-white #toolbar .tabs .tab-button.active:active {
  background: #eef5ff !important;
  border-color: #bfd3f2 !important;
  color: #1f3552 !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  transform: none !important;
}

/* =========================================
   EXPORT JSON — ma się wyróżniać w obu trybach
========================================= */

#annotation-footer #exportJsonBtn,
#annotation-footer #exportJsonBtn.toolbar-button,
#annotation-footer #exportJsonBtn.btn-export-json {
  appearance: none;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid #1d4ed8 !important;
  background: linear-gradient(to right, #0057b7, #007bff) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 87, 183, 0.30) !important;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.05s ease,
    filter 0.2s ease;
}

#annotation-footer #exportJsonBtn:hover,
#annotation-footer #exportJsonBtn.toolbar-button:hover,
#annotation-footer #exportJsonBtn.btn-export-json:hover {
  background: linear-gradient(to right, #004a9f, #0066e0) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(0, 87, 183, 0.45) !important;
}

#annotation-footer #exportJsonBtn:active,
#annotation-footer #exportJsonBtn.toolbar-button:active,
#annotation-footer #exportJsonBtn.btn-export-json:active {
  transform: translateY(1px);
}

#annotation-footer #exportJsonBtn:focus-visible,
#annotation-footer #exportJsonBtn.toolbar-button:focus-visible,
#annotation-footer #exportJsonBtn.btn-export-json:focus-visible {
  outline: none;
  box-shadow:
    0 6px 16px rgba(0, 87, 183, 0.38),
    0 0 0 3px rgba(96, 165, 250, 0.24) !important;
}

/* paper mode — ciut cieplejszy cień, ale ten sam niebieski priorytet */
body.bg-paper #annotation-footer #exportJsonBtn,
body.bg-paper #annotation-footer #exportJsonBtn.toolbar-button,
body.bg-paper #annotation-footer #exportJsonBtn.btn-export-json {
  box-shadow: 0 4px 12px rgba(0, 87, 183, 0.24), 0 1px 0 rgba(120, 102, 78, 0.10) !important;
}

body.bg-paper #annotation-footer #exportJsonBtn:hover,
body.bg-paper #annotation-footer #exportJsonBtn.toolbar-button:hover,
body.bg-paper #annotation-footer #exportJsonBtn.btn-export-json:hover {
  box-shadow: 0 6px 16px rgba(0, 87, 183, 0.34), 0 1px 0 rgba(120, 102, 78, 0.12) !important;
}