* {
    box-sizing: border-box;
    font-family: system-ui, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
}

body {
    background: linear-gradient(145deg, #f5f7fc 0%, #eef2f8 100%);
    margin: 0;
    height: 100vh;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

.card {
    max-width: 1300px;
    width: 100%;
    height: calc(100vh - 3rem);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
    border-radius: 1rem;
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2edf7;
    position: relative;
}

.header-sticky-wrapper {
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid #e2edf7;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: #1e2a3e;
    padding: 1rem 1.5rem;
    color: white;
}

.top-bar h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.control-group {
    background: #f8fafd;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eef3fc;
}

.counter-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.slider-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.slider-left, .slider-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.memory-toggle, .case-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid #cbdde9;
    padding: 0.45rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.memory-toggle input, .case-toggle input {
    cursor: pointer;
    margin: 0;
    width: 15px;
    height: 15px;
}

select {
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #cbdde9;
    border-radius: 0.5rem;
    background: #ffffff;
    color: #2c3e50;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    outline: none;
    transition: 0.2s;
    display: none;
}

select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

input[type="number"] {
    width: 70px;
    padding: 0.45rem 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid #cbdde9;
    border-radius: 0.5rem;
    background: white;
    text-align: center;
    box-shadow: inset 0 1px 2px #00000005;
    transition: 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

button {
    background: #2c3e50;
    border: none;
    padding: 0.45rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.1s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

button:hover { background: #1e2f3f; }
.global-swap-btn { background: #5a738e; }
.global-swap-btn:hover { background: #41566e; }
.global-clear-btn { background: #dc2626; }
.global-clear-btn:hover { background: #b91c1c; }

.pairs-toggle-header {
    background: #ffffff;
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e2f3f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e9edf2;
}

.pairs-toggle-header:hover {
    color: #3b82f6;
    background: #fafbfe;
}

.pairs-stats-badge {
    font-size: 0.8rem;
    background: #eef2ff;
    color: #2563eb;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-weight: 500;
    border: 1px solid #dbeafe;
    margin-left: auto;
    margin-right: 0.75rem;
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: #64748b;
}

.header-sticky-wrapper.collapsed-pairs .toggle-icon {
    transform: rotate(-90deg);
}




.sub-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.5px;
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pair-card.template-readonly {
    background: #f1f5f9;
    border-color: #cbd5e1;
    opacity: 0.85;
}

.pair-card.template-readonly input {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.pair-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #eef3fc;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
}

.pair-card:hover:not(.template-readonly) {
    background: #fbfdff;
    border-color: #cfe0ef;
}

.pair-meta-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 2rem;
}

.pair-index {
    font-weight: 600;
    background: #eef2ff;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    color: #1f3a5f;
    font-size: 0.8rem;
}

.pair-index.template-idx {
    background: #e2e8f0;
    color: #475569;
}

.pair-counter {
    font-size: 0.7rem;
    font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    display: none;
}

.pair-inputs {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.input-box {
    flex: 1;
    min-width: 140px;
}

.input-box label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5b7a9a;
    margin-bottom: 0.25rem;
}

.input-box input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 1px solid #cfe0ef;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    background: #ffffff;
    transition: 0.1s;
}

.input-box input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.pair-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.row-action-btn {
    background: #e2edf7;
    color: #1f3a5f;
    border: none;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.swap-btn:hover { background: #cbdde9; color: #3b82f6; }
.clear-btn { background: #fff5f5; color: #e11d48; }
.clear-btn:hover { background: #ffe4e6; color: #be123c; }

.content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1; 
    background: #ffffff;
    scroll-behavior: smooth;
}

.textarea-panel {
    margin: 0 0 1.25rem 0;
}

.textarea-panel label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.4rem;
    color: #1e2f3f;
    font-size: 0.9rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #c9ddec;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    resize: vertical;
    background: #fefefe;
    line-height: 1.45;
}

textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.result-area {
    background: #f1f5f9;
    border-radius: 0.75rem;
    padding: 0.2rem 1rem 1rem;
    margin-top: 0.75rem;
    border-left: 4px solid #2c5f8a;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.75rem 0 0.5rem 0;
}

.result-label {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1f3b4c;
}

.copy-btn {
    background: #2c5f8a;
    padding: 0.35rem 1rem;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.copy-btn:hover { background: #1e4a6e; }
.copy-btn.copied { background: #10b981; }

.result-box {
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'SF Mono', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #e0eefa;
    min-height: 150px;
    max-height: 1000px;
    overflow-y: auto;
}

.total-summary-bar {
    display: none;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.scroll-nav-container {
    position: absolute;
    bottom: 2rem;
    right: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 200;
    pointer-events: none;
}

.scroll-nav-btn {
    width: 1.5rem;      /* Jeszcze mniejsza szerokość */
    height: 1.5rem;     /* Jeszcze mniejsza wysokość */
    border-radius: 4px; /* Delikatne zaokrąglenie rogów */
    background: #1e2a3e;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;  /* Malutka strzałka w środku */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: auto;
}

.scroll-nav-btn:hover {
    background: #3b82f6;
    transform: scale(1.08);
}

.scroll-nav-btn:active { transform: scale(0.95); }

.scroll-nav-btn.visible {
    opacity: 0.85;
    transform: translateY(0) scale(1);
}

/* NOWE OKNO LOGÓW FULL DEBUG (ZGODNIE Z PROŚBĄ) */
.debug-panel {
    background: #111827;
    border-top: 2px solid #374151;
    color: #10b981;
    font-family: 'Fira Code', 'SF Mono', monospace;
    font-size: 0.75rem;
    height: 140px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.debug-header {
    background: #1f2937;
    padding: 0.35rem 1rem;
    font-weight: bold;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-console {
    padding: 0.5rem 1rem;
    overflow-y: auto;
    flex: 1;
    line-height: 1.4;
}

.debug-row { margin-bottom: 0.25rem; white-space: pre-wrap; word-break: break-all; }
.debug-row.error { color: #f87171; }
.debug-row.warn { color: #fbbf24; }
.debug-row.info { color: #60a5fa; }

@media (max-width: 640px) {
    body { padding: 0.5rem; overflow: auto; height: auto; }
    .card { height: auto; border-radius: 0.5rem; }
    .header-sticky-wrapper { position: static; }
    .content { padding: 1rem; overflow: visible; }
    .pairs-grid { max-height: none; padding: 0.75rem 1rem; }
    .slider-area, .slider-left, .slider-right { width: 100%; flex-direction: column; align-items: stretch; gap: 0.5rem; }
    select, input[type="number"] { width: 100%; }
    .pair-card { align-items: flex-start; }
    .pair-meta-box { flex-direction: row; width: 100%; justify-content: space-between; border-bottom: 1px dashed #e2edf7; padding-bottom: 0.25rem; }
    .pair-inputs { width: 100%; flex-direction: column; align-items: center; gap: 0.5rem; }
    .input-box { width: 100%; }
    .pair-actions { width: 100%; gap: 0.5rem; }
    .row-action-btn { flex: 1; }
    .result-header { flex-direction: column; align-items: flex-start; }
    .scroll-nav-container { right: 1rem; bottom: 1rem; }
}






.pairs-toggle-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}









/* Główny kontener par ze wspólnym scrollem dla całej sekcji */
/* ---- POPRAWKA SYSTEMOWA DLA SCROLLA SEKCJI PAR ---- */

.header-sticky-wrapper {
    max-height: calc(100vh - 100px); /* Zabezpieczenie przed wyjścizeniem poza ekran */
    display: flex;
    flex-direction: column;
}

.pairs-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 320px !important;  /* Stały limit wysokości całej sekcji par */
    overflow-y: auto !important;   /* Wymuszenie jawnego scrolla pionowego */
    overflow-x: hidden !important;
    background: #fdfefe;
    padding: 0.75rem 1.5rem;
    flex-shrink: 1;
}

/* Stan zwinięcia głównego kontenera */
.header-sticky-wrapper.collapsed-pairs .pairs-grid {
    display: none !important;
    padding: 0 !important;
    max-height: 0 !important;
}

/* Wewnętrzne kontenery harmonijek wewnątrz scrollowalnego kontenera */
.pairs-grid .collapsible-content {
    overflow: visible !important; /* Zawartość nie ma własnego scrolla, scrolluje całe .pairs-grid */
    transition: max-height 0.25s ease-out, opacity 0.2s ease-out;
    max-height: 2000px;
    opacity: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pairs-grid .collapsible-content.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
}

/* ============================================================
   REFAKTOR: KLASY ZASTĘPUJĄCE INLINE STYLES
   ============================================================ */

/* Globalna reguła dla atrybutu hidden (zastępuje display:none z JS) */
[hidden] { display: none !important; }

/* select #templateSelect — ukrywany/pokazywany przez atrybut hidden */
select { display: inline-block; }   /* ← ZMIEŃ starą regułę select { display:none } na to */

/* Nagłówki harmonijek wewnątrz kontenera par */
.toggle-header-row {
    margin-top: 0.5rem;
    cursor: pointer;
}

/* Wiersz z tytułem i przyciskiem "Wyczyść" szablonu */
.template-title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Przycisk "❌ Wyczyść" aktywny szablon */
.tpl-clear-btn {
    background: #dc2626;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0.35rem;
    color: white;
    border: none;
    cursor: pointer;
}
.tpl-clear-btn:hover { background: #b91c1c; }

/* Zablokowany przycisk swap w szablonie (ma atrybut disabled) */
.row-action-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ============================================================
   REFAKTOR: KLASY ZASTĘPUJĄCE CSSOM W JS
   ============================================================ */

/* .pair-counter — domyślnie ukryty (już jest display:none w CSS) */
.pair-counter.visible { display: inline-flex; }

/* .total-summary-bar — pokazywany przez klasę */
.total-summary-bar.visible { display: block; }

/* .copy-btn — dodatkowy stan błędu (czerwony) */
.copy-btn.error { background: #dc2626; }
.copy-btn.warning { background: #dc2626; }   /* dla "Brak tekstu!" */

/* ============================================================
   UNIWERSALNE ZWIJANIE .collapsible-content
   (działa też poza .pairs-grid — np. dla #headerContentWrapper)
   ============================================================ */

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.25s ease-out, opacity 0.2s ease-out;
    max-height: 2000px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
}
/* --- Nowe przyciski czyszczenia --- */
.clear-pairs-btn { background: #d97706; }
.clear-pairs-btn:hover { background: #b45309; }
.clear-text-btn { background: #7c3aed; }
.clear-text-btn:hover { background: #6d28d9; }

/* --- Grupa przycisków kopiowania --- */
.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.no-prompt-btn { background: #475569; }
.no-prompt-btn:hover { background: #334155; }

/* ========== PRZYCISK ⚙️ ========== */
.btn-manage-tpl {
    padding: 0.45rem 0.7rem;
    background: #334155;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    line-height: 1;
}
.btn-manage-tpl:hover { background: #1e293b; }

/* ========== MODAL ========== */
.tpl-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}
.tpl-modal {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    width: 100%; max-width: 640px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.tpl-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem;
    background: #1e2a3e; color: #fff;
}
.tpl-modal-header h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.tpl-modal-close {
    background: transparent; color: #fff;
    border: none; font-size: 1.6rem; line-height: 1;
    cursor: pointer; padding: 0 0.3rem;
    box-shadow: none;
}
.tpl-modal-close:hover { background: rgba(255,255,255,0.15); border-radius: 4px; }

.tpl-modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.tpl-modal-add {
    width: 100%; margin-bottom: 1rem;
    background: #10b981; padding: 0.65rem;
    font-weight: 600;
}
.tpl-modal-add:hover { background: #059669; }
.tpl-modal-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tpl-modal-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e2edf7;
    border-radius: 0.5rem;
    background: #f8fafd;
}
.tpl-modal-name { flex: 1; font-weight: 600; color: #1e2f3f; }
.tpl-modal-id { font-size: 0.75rem; color: #64748b; font-family: 'SF Mono', monospace; }
.tpl-modal-actions { display: flex; gap: 0.3rem; }
.tpl-modal-edit { background: #3b82f6; padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.tpl-modal-edit:hover { background: #2563eb; }
.tpl-modal-del { background: #dc2626; padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.tpl-modal-del:hover { background: #b91c1c; }

/* ========== FORMULARZ ========== */
.tpl-form label {
    display: block; margin-bottom: 0.5rem;
    font-weight: 600; font-size: 0.85rem; color: #1e2f3f;
}
.tpl-form input[type="text"],
.tpl-form input[type="password"] {
    width: 100%; padding: 0.5rem 0.75rem; margin-top: 0.25rem;
    border: 1px solid #cbdde9; border-radius: 0.5rem; font-size: 0.85rem;
    box-sizing: border-box;
    background: #fff;
    color: #1e2f3f;
    font-family: inherit;
}
.tpl-form input[type="text"]:focus,
.tpl-form input[type="password"]:focus {
    outline: none; border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.tpl-form input[type="password"] {
    letter-spacing: 1px;
}
.tpl-form-pairs {
    display: flex; flex-direction: column; gap: 0.4rem;
    margin: 1rem 0;
}
.tpl-pair-row {
    display: flex; gap: 0.4rem; align-items: center;
}
.tpl-pair-row input { flex: 1; }
.tpl-pair-remove {
    background: #fff5f5; color: #e11d48;
    padding: 0.5rem; border-radius: 0.4rem;
    flex-shrink: 0;
}
.tpl-pair-remove:hover { background: #ffe4e6; color: #be123c; }
.tpl-form-add-pair {
    background: #e2edf7; color: #1f3a5f;
    padding: 0.45rem 0.9rem; font-size: 0.8rem;
}
.tpl-form-add-pair:hover { background: #cbdde9; }
.tpl-form-actions {
    display: flex; justify-content: flex-end; gap: 0.5rem;
    margin-top: 1rem; padding-top: 1rem;
    border-top: 1px solid #e2edf7;
}
.tpl-form-cancel { background: #94a3b8; }
.tpl-form-cancel:hover { background: #64748b; }
.tpl-form-save { background: #10b981; }
.tpl-form-save:hover { background: #059669; }

@media (max-width: 640px) {
    .tpl-modal-row { flex-wrap: wrap; }
    .tpl-pair-row { flex-wrap: wrap; }
}

/* --- TOAST --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: auto;
    animation: toastIn 0.25s ease-out;
    max-width: 380px;
    min-width: 200px;
}
.toast-success { background: #10b981; }
.toast-error   { background: #dc2626; }
.toast-warn    { background: #d97706; }
.toast-info    { background: #3b82f6; }
.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}
@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(20px); opacity: 0; }
}

/* --- CONFIRM DIALOG --- */
.tpl-modal-confirm { max-width: 420px; }
.tpl-confirm-msg {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #1e2f3f;
    line-height: 1.5;
}

/* ========== AUTH ========== */
.btn-login { background: #10b981; }
.btn-login:hover { background: #059669; }
.btn-logout { background: #64748b; }
.btn-logout:hover { background: #475569; }
.user-badge {
    padding: 0.45rem 0.7rem;
    background: #eef2ff;
    color: #1e40af;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ========== TOKEN W PARZE SZABLONU ========== */
.tpl-pair-token {
    background: #eef2ff;
    color: #1e40af;
    padding: 0.5rem;
    border-radius: 0.4rem;
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.tpl-pair-token:hover {
    background: #dbeafe;
    color: #1e3a8a;
}
.tpl-pair-token:active {
    transform: scale(0.92);
}

/* --- AUTO IP MASK --- */
.ip-mask-toggle {
    border-color: #f59e0b !important;
    transition: background 0.2s, border-color 0.2s;
}
.ip-mask-toggle:has(input:checked) {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

/* --- IP SUSPICIOUS WARNING --- */
.ip-suspicious-warning {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-left: 6px solid #d97706;
    color: #78350f;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.ip-suspicious-warning strong {
    display: block;
    margin-bottom: 0.4rem;
    color: #92400e;
    font-size: 0.9rem;
}
.ip-suspicious-warning ul {
    margin: 0.4rem 0 0 1.2rem;
    padding: 0;
}
.ip-suspicious-warning li {
    margin-bottom: 0.25rem;
}
.ip-suspicious-warning code {
    background: #fde68a;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #78350f;
    font-weight: 600;
}

/* --- Przycisk czyszczenia mapy maskowania --- */
.clear-map-btn { background: #0891b2; }
.clear-map-btn:hover { background: #0e7490; }


/* --- PAIR OUTPUT COLLISION WARNING --- */
.pair-collision-warning {
    background: #fef2f2;
    border: 2px solid #dc2626;
    border-left: 6px solid #b91c1c;
    color: #7f1d1d;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.pair-collision-warning strong {
    display: block;
    margin-bottom: 0.4rem;
    color: #991b1b;
    font-size: 0.9rem;
}
.pair-collision-warning ul {
    margin: 0.4rem 0 0 1.2rem;
    padding: 0;
}
.pair-collision-warning li { margin-bottom: 0.25rem; }
.pair-collision-warning code {
    background: #fecaca;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #7f1d1d;
    font-weight: 600;
}