html { scroll-behavior: smooth; }
body { font-family: 'Poppins', sans-serif; background-color: #f4f7fa; padding: 28px; }
.container { max-width: 1120px; margin: auto; background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
h1 { font-size: 22px; font-weight: 600; margin-bottom: 24px; color: #000; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 4px 8px; border: 1px solid #ddd; white-space: nowrap; }
td.td-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 500px; }
th { background-color: #2c3e50; color: #fff; text-transform: uppercase; }
table tbody > tr:nth-child(even of :where(:not(.filtr-info-row):not(.dashboard-lazy-hidden):not([hidden]):not([style*="display: none"]):not([style*="display:none"]))) { background-color: #fff; }
table tbody > tr:hover { background-color: #e7e7e7; transition: background-color 0.2s ease-in-out; }
.shop-link { color: #109d4b; text-decoration: none; font-weight: 500; }
.url-link { color: #e77815; text-decoration: none; font-weight: 500; }
.shop-link:hover, .url-link:hover { text-decoration: underline; }
.copyable { cursor: pointer; transition: color 0.2s; }
.copyable:hover { color: #2980b9; text-decoration: underline; }
.img-zestaw { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; }
.sku-badge { background: #eee; padding: 2px 6px; border-radius: 4px; font-weight: 600; font-family: monospace; cursor: pointer; }
.sygnatura-badge { background: #dff9fb; color: #130f40; padding: 2px 6px; border-radius: 4px; font-weight: 600; font-family: monospace; border: 1px solid #c7ecee; cursor: pointer; }
.btn-mail-apilo { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: #b35900; color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1; vertical-align: middle; margin-left: 8px; padding: 0; transition: background 0.2s; }
.btn-mail-apilo:hover { background: #e67300; }
.modal-apilo-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; justify-content: center; align-items: center; }
.modal-apilo-overlay.active { display: flex; }
.modal-apilo { background: #fff; border-radius: 12px; padding: 24px; max-width: 700px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.modal-apilo h3 { margin: 0 0 6px; font-size: 18px; color: #333; }
.modal-apilo .mail-meta { font-size: 13px; color: #666; margin-bottom: 12px; }
.modal-apilo .mail-body { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 16px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; font-family: 'Poppins', sans-serif; max-height: 400px; overflow-y: auto; }
.modal-apilo .mail-actions { margin-top: 16px; display: flex; gap: 10px; }
.modal-apilo .btn-mail { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.modal-apilo .btn-mail-send { background: #b35900; color: #fff; }
.modal-apilo .btn-mail-send:hover { background: #e67300; }
.modal-apilo .btn-mail-copy { background: #eee; color: #333; }
.modal-apilo .btn-mail-copy:hover { background: #ddd; }
.modal-apilo .btn-mail-close { background: #ccc; color: #333; }
.modal-apilo .btn-mail-close:hover { background: #bbb; }
.zestawy-sekcja { margin-bottom: 50px; padding-bottom: 10px; }
.btn-pobierz { display: inline-flex; align-items: center; background-color: #2ecc71; color: white; padding: 8px 16px; text-decoration: none; border-radius: 4px; font-weight: 500; font-size: 12px; text-transform: uppercase; border: none; cursor: pointer; }
.btn-pobierz:hover { background-color: #27ae60; color: white; transform: translateY(-1px); }
.btn-toggle-form { background: #34495e; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; }
.btn-toggle-wystawione { background: #95a5a6; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; }
#form-zestaw { display: none; background: #fff; padding: 20px; border: 1px solid #ddd; border-radius: 8px; margin-top: 20px; }
#wystawione-sekcja { display: none; margin-top: 40px; }
.btn-usun-bulk { background: #e74c3c; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-usun-bulk:hover { background: #c0392b; }
.check-zestaw { width: 22px; height: 22px; cursor: pointer; }
.actions-bar { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.drop-zone { border: 2px dashed #ccc; padding: 15px; text-align: center; color: #666; cursor: pointer; border-radius: 8px; transition: 0.3s; background: #fafafa; }
.drop-zone.dragover { border-color: #2ecc71; background: #eafaf1; color: #2ecc71; }
.file-info { font-size: 11px; color: #444; margin-top: 5px; line-height: 1.4; }
.input-komentarz { background: transparent; border: none; outline: none; box-shadow: none; width: 100%; min-width: 120px; padding: 0; margin: 0; font-family: inherit; font-size: inherit; color: inherit; }
.input-komentarz:focus { background: rgba(255,255,255,0.5); border-radius: 2px; }
.komentarz-wrap { position: relative; display: inline-block; width: 100%; min-width: 120px; }
.komentarz-tooltip { position: fixed; background: #333; color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 13px; max-width: 320px; width: max-content; white-space: pre-wrap; word-break: break-word; display: none; z-index: 9999; box-shadow: 0 2px 8px rgba(0,0,0,0.25); pointer-events: none; }
.komentarz-tooltip__date { font-size: 11px; opacity: 0.9; }

/* Szeroki audyt cen: glowne dane w jednym rzedzie, wyliczenie pod spodem. */
#sek-ceny-zestawy .price-bundle-audit-table,
#sek-ceny-zestawy .price-bundle-audit-table thead,
#sek-ceny-zestawy .price-bundle-audit-table tbody { display: block; width: 100%; }
#sek-ceny-zestawy .price-bundle-audit-table { table-layout: auto !important; }
#sek-ceny-zestawy .price-bundle-audit-table tr {
    display: grid;
    grid-template-columns: 42px minmax(200px, 1fr) 132px 88px 108px 82px 112px 150px;
    width: 100%;
    align-items: stretch;
}
#sek-ceny-zestawy .price-bundle-audit-table th,
#sek-ceny-zestawy .price-bundle-audit-table td { min-width: 0; box-sizing: border-box; }
#sek-ceny-zestawy .price-bundle-audit-table thead th {
    width: auto !important;
    max-width: none !important;
    overflow: hidden;
    white-space: nowrap;
}
#sek-ceny-zestawy .price-bundle-audit-table th:not(:nth-child(7)),
#sek-ceny-zestawy .price-bundle-audit-table td:not(.price-bundle-title):not(.price-bundle-formula) {
    display: flex;
    align-items: center;
}
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(1),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(2),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(3),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(3) { grid-column: 3; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(4),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(4) { grid-column: 4; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(5),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(5) { grid-column: 5; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(6),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(6) { grid-column: 6; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(7) { display: none; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(8),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(8) { grid-column: 7; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table th:nth-child(9),
#sek-ceny-zestawy .price-bundle-audit-table td:nth-child(9) { grid-column: 8; grid-row: 1; }
#sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(4),
#sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(5),
#sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(6) { justify-content: flex-end; }
#sek-ceny-zestawy .price-bundle-audit-table thead th:nth-child(4),
#sek-ceny-zestawy .price-bundle-audit-table thead th:nth-child(5),
#sek-ceny-zestawy .price-bundle-audit-table thead th:nth-child(6) {
    justify-content: flex-end;
    text-align: right;
}
#sek-ceny-zestawy .price-bundle-title {
    white-space: normal !important;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
#sek-ceny-zestawy .price-bundle-formula {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal !important;
    overflow-wrap: anywhere;
    line-height: 1.45;
    padding: 6px 10px !important;
    background: rgba(107, 26, 58, 0.045);
    border-top: 0 !important;
}
#sek-ceny-zestawy .price-bundle-formula::before {
    content: attr(data-label);
    display: inline-block;
    margin-right: 8px;
    color: #6b1a3a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
#sek-ceny-zestawy .price-bundle-comment .komentarz-wrap,
#sek-ceny-zestawy .price-bundle-comment .input-komentarz { min-width: 0; box-sizing: border-box; }

@media (max-width: 900px) {
    #sek-ceny-zestawy .price-bundle-audit-table thead { display: none; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody tr {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        margin-bottom: 10px;
        border: 1px solid #d9dde1;
    }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start !important;
        justify-content: center !important;
        white-space: normal !important;
        border: 0 !important;
        border-bottom: 1px solid #e6e8ea !important;
    }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:not(.price-bundle-title):not(.price-bundle-formula)::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        color: #77808a;
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
    }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(1) { grid-column: 1 / 2; grid-row: 2; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(3) { grid-column: 2 / -1; grid-row: 2; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(5) { grid-column: 3 / 5; grid-row: 3; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(6) { grid-column: 5 / 7; grid-row: 3; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(7) { grid-column: 1 / -1; grid-row: 4; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(8) { grid-column: 1 / 3; grid-row: 5; }
    #sek-ceny-zestawy .price-bundle-audit-table tbody td:nth-child(9) { grid-column: 3 / -1; grid-row: 5; }
    #sek-ceny-zestawy .price-bundle-title {
        display: block !important;
        font-weight: 600;
        -webkit-line-clamp: unset;
    }
    #sek-ceny-zestawy .price-bundle-formula { border-bottom: 1px solid #e6e8ea !important; }
}
   
#toast {
    visibility: hidden;
    min-width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

.dashboard-lazy-fade { display:block; position:relative; z-index:2; height:80px; margin-top:-80px; pointer-events:none; background:linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,.85) 50%, #fff); }
.dashboard-lazy-btn { display:inline-block; position:relative; z-index:3; margin-top:8px; padding:6px 18px; background:#f0f0f0; border:1px solid #ccc; border-radius:6px; font-family:inherit; font-size:13px; font-weight:500; color:#333; cursor:pointer; transition:background .2s,border-color .2s; }
.dashboard-lazy-btn:hover { background:#e0e0e0; border-color:#aaa; }
.dashboard-lazy-btn:disabled { cursor:wait; opacity:.65; }
tr.dashboard-lazy-row.dashboard-lazy-hidden { display:none !important; }

/* ===== DESIGN V2 (aktywowany przez body.v2) ===== */
.design-toggle { position: fixed; bottom: 20px; right: 20px; z-index: 999; padding: 8px 14px; border-radius: 8px; border: 1px solid #ccc; background: #fff; color: #333; font-size: 12px; font-family: inherit; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.15); transition: background 0.2s; }
.design-toggle:hover { background: #f0f0f0; }
body.v2 .design-toggle { background: #2c3e50; color: #fff; border-color: #2c3e50; }
body.v2 .design-toggle:hover { background: #34495e; }

/* V2: Sekcje - biala karta + lewy border */
body.v2 [id^="sek-"] { background: #fff !important; border: none !important; border-left: 4px solid var(--sc, #dee2e6) !important; border-radius: 6px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
body.v2 [id^="sek-"] > h2 { padding-bottom: 10px; border-bottom: 1px solid #eee; margin-bottom: 12px; }

/* V2: Tabele - jasne headery */
body.v2 th { background-color: #f8f9fa !important; color: #2c3e50 !important; text-transform: none !important; font-weight: 600; font-size: 13px; border-bottom: 2px solid #dee2e6; }
body.v2 thead tr { background: none !important; }
body.v2 table tbody > tr:nth-child(even of :where(:not(.filtr-info-row):not(.dashboard-lazy-hidden):not([hidden]):not([style*="display: none"]):not([style*="display:none"]))) { background-color: #fafbfc; }
body.v2 table tbody > tr:hover { background-color: #f0f4f8; }

/* V2: Komentarze - widoczne */
body.v2 .input-komentarz { background: #f8f9fa; border: 1px solid #e0e3e6; border-radius: 4px; padding: 3px 6px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
body.v2 .input-komentarz:focus { background: #fff; border-color: #80bdff; box-shadow: 0 0 0 2px rgba(0,123,255,0.12); }

/* V2: Sticky podsumowanie */
body.v2 .summary-bar { position: sticky; top: 0; z-index: 50; margin: 0 -30px; padding: 10px 30px; background: #fff; transition: box-shadow 0.3s; border-bottom: 1px solid transparent; }
body.v2 .summary-bar.stuck { box-shadow: 0 2px 12px rgba(0,0,0,0.08); border-bottom-color: #eee; }

/* V2: Cache bar */
body.v2 .cache-bar { border: none !important; border-left: 4px solid #28a745 !important; background: #f8f9fa !important; border-radius: 6px !important; }
body.v2 .cache-bar.cache-stale { border-left-color: #ffc107 !important; background: #fffdf5 !important; }

/* V2: Przyciski */
body.v2 .btn-v2 { display: inline-flex; align-items: center; padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 13px; text-decoration: none; font-family: inherit; transition: background 0.2s, transform 0.1s; }
body.v2 .btn-v2:hover { transform: translateY(-1px); filter: brightness(1.1); }

/* Ignorowane SKU */
.btn-ign { margin-left:8px; padding:1px 7px; border-radius:10px; font-size:11px; cursor:pointer; vertical-align:middle; font-weight:400; position:relative; top:-3px; background:color-mix(in srgb, var(--sc, #888) 8%, white); border:1px solid color-mix(in srgb, var(--sc, #888) 30%, white); color:var(--sc, #666); }
.btn-ign:hover { background:color-mix(in srgb, var(--sc, #888) 15%, white); }
.btn-ign.has-ign { background:color-mix(in srgb, var(--sc, #888) 15%, white); border-color:color-mix(in srgb, var(--sc, #888) 45%, white); font-weight:500; }
.btn-section-copy { margin-left:8px; width:26px; height:22px; padding:0; border:1px solid #c4c8cc; border-radius:4px; background:#eceff1; color:#4f5962; cursor:pointer; vertical-align:middle; position:relative; top:-3px; display:inline-flex; align-items:center; justify-content:center; }
.btn-section-copy:hover { background:#dde1e4; border-color:#aeb4b9; color:#30363b; }
.btn-section-copy:disabled { cursor:wait; opacity:.7; }
.btn-section-copy.copied { background:#e2f2e7; border-color:#85b695; color:#24713d; }
.btn-section-copy svg { width:14px; height:14px; display:block; pointer-events:none; }
.ign-popup { display:none; background:#fff; border:1px solid #ccc; border-radius:8px; padding:12px; box-shadow:0 4px 12px rgba(0,0,0,.15); width:320px; cursor:default; }
.ign-popup textarea { width:100%; height:55px; font-size:12px; font-family:monospace; padding:4px 6px; border:1px solid #ccc; border-radius:4px; box-sizing:border-box; resize:vertical; }
.ign-popup .ign-actions { margin-top:6px; display:flex; gap:6px; }
.ign-popup .ign-actions button { padding:4px 12px; border:none; border-radius:4px; cursor:pointer; font-size:12px; }
.ign-popup .ign-save { background:#2c3e50; color:#fff; }
.ign-popup .ign-save:hover { background:#1a252f; }
.ign-popup .ign-cls { background:#eee; border:1px solid #ccc !important; }
.account-tabs { display:flex; flex-wrap:nowrap; gap:3px; margin: -10px 0 12px; }
.account-context { position:sticky; top:calc(12px - var(--account-sticky-offset, 48px)); z-index:100; margin: 0 0 18px; padding: 14px 16px; background: #f8fbff; border: 1px solid #d6e5f2; border-radius: 8px; box-shadow:0 4px 14px rgba(44,62,80,.12); }
.account-context-title { margin: 0 0 12px; color: #2c3e50; font-size: 14px; font-weight: 600; }
.account-context .account-tabs { margin: 0; }
.account-tab { position:relative; flex:0 0 auto; border:1px solid #cfd6de; background:#f6f8fa; color:#2c3e50; border-radius:5px; padding:4px 7px; font-family:inherit; font-size:12px; font-weight:600; white-space:nowrap; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; }
.account-tab:hover { background:#e9eef3; }
.account-tab:visited { color:#2c3e50; }
.account-tab.active { background:#2c3e50; border-color:#2c3e50; color:#fff; }
.account-tab.active:visited { color:#fff; }
.account-tab:hover::after { content:attr(data-tooltip); position:absolute; left:50%; top:calc(100% + 6px); transform:translateX(-50%); background:#2c3e50; color:#fff; padding:5px 8px; border-radius:4px; box-shadow:0 2px 8px rgba(0,0,0,.18); font-size:11px; font-weight:500; line-height:1.35; text-align:left; white-space:pre; width:max-content; min-width:170px; z-index:20; pointer-events:none; }
.account-tab:hover::before { content:""; position:absolute; left:50%; top:100%; transform:translateX(-50%); border:5px solid transparent; border-bottom-color:#2c3e50; z-index:21; pointer-events:none; }
.account-panel { margin-top: 8px; }
.account-empty { padding:12px 14px; background:#f8f9fa; border:1px solid #dee2e6; border-radius:6px; color:#495057; font-size:13px; }

@media (max-width: 1220px) {
    .account-tabs { overflow-x:auto; overflow-y:hidden; padding-bottom:3px; }
}
