/*
 * Vendofy — moduł B2B, style frontendu.
 *
 * Zakładki „Moje konto" partnera, tabela progów hurtowych i przełącznik
 * modeli współpracy. Neutralne, żeby wpasowały się w dowolny motyw:
 * kolor akcentu bierzemy ze zmiennej, którą motyw może nadpisać.
 *
 * Copyright (c) 2024-obecnie Igor Roman. Wszelkie prawa zastrzeżone.
 */

:root {
    --vendo-b2b-accent: #7c3aed;
    --vendo-b2b-accent-dark: #6d28d9;
    --vendo-b2b-accent-soft: #f5f3ff;
    --vendo-b2b-border: #e5e7eb;
    --vendo-b2b-text: #1f2937;
    --vendo-b2b-muted: #6b7280;
}

/* ===========================================================================
   WSPÓLNE
   =========================================================================== */

.vendo-b2b-panel { font-size: 15px; color: var(--vendo-b2b-text); }

.vendo-b2b-lead {
    margin: 0 0 20px;
    color: var(--vendo-b2b-muted);
    font-size: 14px;
    line-height: 1.6;
}

.vendo-b2b-h3 {
    margin: 28px 0 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--vendo-b2b-text);
}
.vendo-b2b-h3:first-child { margin-top: 0; }

.vendo-b2b-muted { color: var(--vendo-b2b-muted); font-size: 13px; }

.vendo-b2b-empty {
    padding: 24px;
    background: #f9fafb;
    border: 1px dashed var(--vendo-b2b-border);
    border-radius: 6px;
    color: var(--vendo-b2b-muted);
    text-align: center;
}

.vendo-b2b-notice {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-left: 4px solid var(--vendo-b2b-accent);
    background: var(--vendo-b2b-accent-soft);
    border-radius: 4px;
    font-size: 14px;
}
.vendo-b2b-notice.is-ok   { border-left-color: #16a34a; background: #f0fdf4; }
.vendo-b2b-notice.is-warn { border-left-color: #d97706; background: #fffbeb; }
.vendo-b2b-notice ul { margin: 8px 0 0 18px; }

/* --- Przyciski --- */
.vendo-b2b-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--vendo-b2b-accent);
    border-radius: 4px;
    background: #fff;
    color: var(--vendo-b2b-accent);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.vendo-b2b-btn:hover {
    background: var(--vendo-b2b-accent);
    color: #fff;
}
.vendo-b2b-btn-primary {
    background: var(--vendo-b2b-accent);
    color: #fff;
}
.vendo-b2b-btn-primary:hover { background: var(--vendo-b2b-accent-dark); border-color: var(--vendo-b2b-accent-dark); }
.vendo-b2b-btn-sm { padding: 5px 11px; font-size: 13px; }
.vendo-b2b-btn-ghost { border-color: var(--vendo-b2b-border); color: var(--vendo-b2b-muted); }

/* --- Pola --- */
.vendo-b2b-input,
.vendo-b2b-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box; /* pole daty nie wystaje poza kolumnę (motywy ustawiają to tylko polom tekstowym) */
    padding: 10px 12px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--vendo-b2b-text);
}
.vendo-b2b-input:focus,
.vendo-b2b-textarea:focus {
    outline: none;
    border-color: var(--vendo-b2b-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.vendo-b2b-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.vendo-b2b-label {
    display: block;
    margin: 18px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--vendo-b2b-text);
}

.vendo-b2b-form .vendo-b2b-btn { margin-top: 18px; }

.vendo-b2b-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 18px;
}
.vendo-b2b-toolbar .vendo-b2b-input { width: auto; flex: 1 1 220px; }

/* --- Tabele --- */
.vendo-b2b-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-size: 14px;
}
.vendo-b2b-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--vendo-b2b-accent-soft);
    color: var(--vendo-b2b-accent-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 2px solid #ede9fe;
}
.vendo-b2b-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}
.vendo-b2b-table tr:hover td { background: #fafafa; }

.vendo-b2b-tiers { margin: 0; padding: 0; list-style: none; }
.vendo-b2b-tiers li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    border-bottom: 1px dotted #e5e7eb;
    font-size: 13px;
}
.vendo-b2b-tiers li:last-child { border-bottom: none; }

.vendo-b2b-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--vendo-b2b-accent-soft);
    color: var(--vendo-b2b-accent-dark);
    font-size: 11px;
    font-weight: 700;
}
.vendo-b2b-tag.is-ok { background: #dcfce7; color: #166534; }

.vendo-b2b-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: #f3f4f6;
    color: #4b5563;
}
.vendo-b2b-status.is-approved { background: #dcfce7; color: #166534; }
.vendo-b2b-status.is-paid     { background: #dbeafe; color: #1e40af; }
.vendo-b2b-status.is-pending  { background: #fef3c7; color: #92400e; }
.vendo-b2b-status.is-cancelled { background: #fee2e2; color: #991b1b; }

/* ===========================================================================
   KOKPIT PARTNERA
   =========================================================================== */

.vendo-b2b-dash { margin: 0 0 32px; }

.vendo-b2b-models {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 13px;
}
.vendo-b2b-models-label { color: var(--vendo-b2b-muted); }

.vendo-b2b-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}
.vendo-b2b-pill.is-active {
    background: var(--vendo-b2b-accent);
    color: #fff;
}

.vendo-b2b-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 0 0 26px;
}
.vendo-b2b-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.vendo-b2b-tile:hover {
    border-color: var(--vendo-b2b-accent);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.1);
}
.vendo-b2b-tile-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--vendo-b2b-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.vendo-b2b-tile-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--vendo-b2b-text);
    line-height: 1.2;
}
.vendo-b2b-tile-value .woocommerce-Price-amount { font-size: inherit; }
.vendo-b2b-tile-meta { font-size: 12px; color: var(--vendo-b2b-muted); }

/* --- Ostatnio zamawiane --- */
.vendo-b2b-recent {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.vendo-b2b-recent-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    text-align: center;
}
.vendo-b2b-recent-item a { text-decoration: none; color: inherit; }
.vendo-b2b-recent-item img { width: 100%; height: auto; border-radius: 4px; }
.vendo-b2b-recent-name {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}
.vendo-b2b-recent-meta { font-size: 11px; color: var(--vendo-b2b-muted); }

/* ===========================================================================
   XML / KODY — pole do kopiowania
   =========================================================================== */

.vendo-b2b-feed { margin: 0 0 26px; }

.vendo-b2b-copy {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 4px;
    margin: 8px 0;
}
.vendo-b2b-copy code {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    background: none;
    padding: 0;
    font-size: 13px;
    color: var(--vendo-b2b-text);
}

.vendo-b2b-code-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin: 8px 0 12px;
}
.vendo-b2b-code-card .vendo-b2b-copy { margin: 0; flex: 1 1 260px; }
.vendo-b2b-code-card code { font-size: 18px; font-weight: 700; letter-spacing: 0.05em; }
.vendo-b2b-code-value {
    padding: 6px 14px;
    border-radius: 14px;
    background: #dcfce7;
    color: #166534;
    font-size: 13px;
    font-weight: 700;
}

/* ===========================================================================
   SALDO — postęp poleceń
   =========================================================================== */

.vendo-b2b-progress-row {
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f6;
}
.vendo-b2b-progress-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}
.vendo-b2b-progress {
    height: 10px;
    border-radius: 5px;
    background: #ede9fe;
    overflow: hidden;
}
.vendo-b2b-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--vendo-b2b-accent), #a78bfa);
    border-radius: 5px;
    transition: width 0.4s ease;
}

.vendo-b2b-terms { margin: 0 0 20px 18px; font-size: 14px; line-height: 1.9; }

/* ===========================================================================
   TABELA PROGÓW HURTOWYCH (shortcode na stronie produktu)
   =========================================================================== */

.vendo-b2b-pricetable {
    margin: 22px 0;
    padding: 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-pricetable-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--vendo-b2b-text);
}
.vendo-b2b-pricetable-note {
    margin: 0 0 12px;
    padding: 8px 12px;
    background: var(--vendo-b2b-accent-soft);
    border-radius: 4px;
    font-size: 13px;
    color: var(--vendo-b2b-accent-dark);
}
.vendo-b2b-pricetable-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.vendo-b2b-pricetable-grid th {
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--vendo-b2b-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #f3f4f6;
}
.vendo-b2b-pricetable-grid td {
    padding: 10px;
    border-bottom: 1px solid #f3f4f6;
}
.vendo-b2b-pricetable-grid tr:last-child td { border-bottom: none; }
.vendo-b2b-pricetable-price { font-weight: 700; color: var(--vendo-b2b-text); }
.vendo-b2b-save {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 700;
}
.vendo-b2b-pricetable-cta {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--vendo-b2b-muted);
}

/* ===========================================================================
   PRZEŁĄCZNIK MODELI
   =========================================================================== */

.vendo-b2b-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    font-size: 13px;
}
.vendo-b2b-switcher-label { color: var(--vendo-b2b-muted); font-weight: 600; }
.vendo-b2b-switcher-select {
    padding: 7px 10px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    font-family: inherit;
    color: var(--vendo-b2b-text);
}
.vendo-b2b-switcher-btn {
    padding: 6px 14px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 14px;
    background: #fff;
    color: var(--vendo-b2b-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.vendo-b2b-switcher-btn:hover { border-color: var(--vendo-b2b-accent); color: var(--vendo-b2b-accent); }
.vendo-b2b-switcher-btn.is-active {
    background: var(--vendo-b2b-accent);
    border-color: var(--vendo-b2b-accent);
    color: #fff;
}

/* --- Etykieta przy cenie w sklepie --- */
.vendo-b2b-price-label {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--vendo-b2b-accent-soft);
    color: var(--vendo-b2b-accent-dark);
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
}

.vendo-b2b-dropship-price { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.vendo-b2b-dropship-label { font-weight: 600; color: var(--vendo-b2b-muted); font-size: 13px; }

/* ===========================================================================
   PROGRAM PARTNERSKI (1.50.0) — Wyniki i zarobki, Kody i linki, Wypłaty
   Wykres, lista zamówień i statusy: vendo-b2b-program.css
   =========================================================================== */

.vendo-b2b-tiles-5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.vendo-b2b-tile.is-accent {
    border-color: #c4b5fd;
    background: var(--vendo-b2b-accent-soft);
}
.vendo-b2b-tile-value { font-variant-numeric: tabular-nums; }
.vendo-b2b-tile-meta { line-height: 1.45; }

.vendo-b2b-delta { font-weight: 700; white-space: nowrap; }
.vendo-b2b-delta.is-up   { color: #15803d; }
.vendo-b2b-delta.is-down { color: #b91c1c; }

/* --- Filtry listy --- */
.vendo-b2b-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
}
.vendo-b2b-filterbar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--vendo-b2b-muted);
}
.vendo-b2b-filterbar .vendo-b2b-input {
    width: auto;
    min-width: 140px;
    padding: 8px 10px;
}
.vendo-b2b-custom-range { display: contents; }
.vendo-b2b-custom-range[hidden] { display: none !important; }
.vendo-b2b-filterbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.vendo-b2b-ledger,
.vendo-b2b-codes-table { font-size: 13.5px; }
.vendo-b2b-ledger th,
.vendo-b2b-codes-table th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.vendo-b2b-ledger th,
.vendo-b2b-ledger td,
.vendo-b2b-codes-table th,
.vendo-b2b-codes-table td { padding: 10px 8px; }
.vendo-b2b-ledger td { vertical-align: middle; }
.vendo-b2b-ledger .vendo-b2b-col-code { min-width: 110px; }
.vendo-b2b-ledger th.vendo-b2b-col-toggle,
.vendo-b2b-ledger td.vendo-b2b-col-toggle { width: 30px; padding-left: 2px; padding-right: 2px; }
.woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-ledger th,
.woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-ledger td,
.woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-codes-table th,
.woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-codes-table td { padding: 10px 7px !important; }
.woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-ledger .vendo-b2b-col-toggle { padding-left: 2px !important; padding-right: 2px !important; }
.woocommerce-MyAccount-content .vendo-b2b-ledger th a {
    color: inherit !important;
    text-decoration: none !important;
}
.woocommerce-MyAccount-content .vendo-b2b-ledger th a:hover { text-decoration: underline !important; }
.vendo-b2b-nowrap { white-space: nowrap; }

/* „Moje konto" (vendo-account.css) maluje każdy button[type=submit] jako
   przycisk główny i podkreśla każdy link — tu potrzebne są wyjątki. */
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn,
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn[type="submit"] {
    display: inline !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--vendo-b2b-accent) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
}
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn:hover,
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn[type="submit"]:hover {
    background: none !important;
    color: var(--vendo-b2b-accent-dark) !important;
}
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn.is-danger,
.woocommerce-MyAccount-content button.vendo-b2b-linkbtn.is-danger:hover { color: #b91c1c !important; }
.woocommerce-MyAccount-content button.vendo-b2b-btn-sm[type="submit"] {
    padding: 6px 12px !important;
    font-size: 13px !important;
}
.woocommerce-MyAccount-content a.vendo-b2b-tile {
    color: var(--vendo-b2b-text) !important;
    text-decoration: none !important;
}

/* --- Warunki --- */
.vendo-b2b-terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin: 0 0 24px;
}
.vendo-b2b-terms-card {
    padding: 16px 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-terms-card.is-campaign {
    border-color: #ddd6fe;
    background: var(--vendo-b2b-accent-soft);
}
.vendo-b2b-terms-card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.vendo-b2b-terms-card .vendo-b2b-plain li { padding: 3px 0; font-size: 14px; }
.vendo-b2b-terms-card p { margin: 10px 0 0; }
/* 1.50.5 — „Jak dostaniesz wypłatę" (sklep nie przechowuje danych do przelewu) */
.vendo-b2b-payout-info p { margin: 0; line-height: 1.6; }
.vendo-b2b-payout-info p + p { margin-top: 8px; }
.vendo-b2b-payout-info a { overflow-wrap: anywhere; }
.vendo-b2b-payout-info + .vendo-b2b-muted { margin-top: 10px; }

/* 1.62.0 — termin zestawienia i „Poproś o zestawienie" */
.vendo-b2b-request {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin: 0 0 24px;
    padding: 16px 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-request.is-sent {
    border-color: #ddd6fe;
    background: var(--vendo-b2b-accent-soft);
}
.vendo-b2b-request-body { flex: 1 1 320px; min-width: 0; }
.vendo-b2b-request-body p { margin: 0; line-height: 1.6; }
.vendo-b2b-request-body p + p { margin-top: 6px; }
.vendo-b2b-request-state { color: var(--vendo-b2b-muted); font-size: 14px; }
.vendo-b2b-request-state a { overflow-wrap: anywhere; }
.vendo-b2b-request-form { flex: 0 0 auto; margin: 0; }
.vendo-b2b-btn:disabled,
.vendo-b2b-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.vendo-b2b-btn-primary:disabled:hover {
    background: var(--vendo-b2b-accent);
    border-color: var(--vendo-b2b-accent);
}
.vendo-b2b-payout-asked {
    display: block;
    margin-top: 2px;
    color: var(--vendo-b2b-muted);
    font-size: 12px;
    font-weight: 400;
}
/* 1.64.0 — opis rozliczenia „inaczej" pod statusem zestawienia */
.vendo-b2b-payout-note {
    display: block;
    margin-top: 4px;
    color: var(--vendo-b2b-muted);
    font-size: 12px;
    line-height: 1.45;
}

/* 1.64.0 — „Prześlij fakturę" */
.vendo-b2b-invoice { margin: 0 0 24px; }
.vendo-b2b-invoice > .vendo-b2b-muted { margin: -4px 0 12px; line-height: 1.6; }
.vendo-b2b-invoice-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin: 0 0 10px;
    padding: 14px 16px;
    border: 1px solid var(--vendo-b2b-border);
    border-left: 3px solid var(--vendo-b2b-accent);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-invoice-row.is-sent { border-left-color: #16a34a; }
.vendo-b2b-invoice-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; flex: 1 1 280px; min-width: 0; }
.vendo-b2b-invoice-number { font-size: 15px; }
.vendo-b2b-invoice-amount { font-weight: 700; }
.vendo-b2b-invoice-state { flex-basis: 100%; color: var(--vendo-b2b-muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.vendo-b2b-invoice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vendo-b2b-file input[type="file"] { max-width: 260px; font-size: 13px; }
.vendo-b2b-file .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* 1.70.0 — „Płać prowizją w sklepie" (Panel → Wypłaty) */
.vendo-b2b-wallet {
    margin: 0 0 24px;
    padding: 16px 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-wallet > .vendo-b2b-h3 { margin-top: 0; }
.vendo-b2b-wallet > .vendo-b2b-muted { margin: -4px 0 12px; line-height: 1.6; }
.vendo-b2b-wallet-balance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 12px;
}
.vendo-b2b-wallet-balance strong { font-size: 18px; }
.vendo-b2b-wallet .vendo-b2b-table-wrap { margin-bottom: 0; }
/* kasa: saldo pod opisem metody płatności */
.vendo-b2b-wallet-note { margin: 6px 0 0; font-size: 0.92em; opacity: 0.85; }
/* Kody rabatowe: zakupy dla siebie */
.vendo-b2b-own-use { margin: 14px 0 0; line-height: 1.6; }

@media (max-width: 600px) {
    .vendo-b2b-wallet-balance .vendo-b2b-btn { width: 100%; justify-content: center; }
    .vendo-b2b-request-form,
    .vendo-b2b-request-form .vendo-b2b-btn { width: 100%; justify-content: center; }
    .vendo-b2b-invoice-actions,
    .vendo-b2b-invoice-actions .vendo-b2b-file,
    .vendo-b2b-invoice-actions .vendo-b2b-btn { width: 100%; justify-content: center; }
    .vendo-b2b-file input[type="file"] { max-width: 100%; width: 100%; }
}

/* --- Nowy kod --- */
.vendo-b2b-limits { margin: -4px 0 14px; color: var(--vendo-b2b-muted); font-size: 13px; }

.vendo-b2b-code-form {
    margin: 0 0 26px;
    padding: 4px 18px 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 16px;
}
.vendo-b2b-field { min-width: 0; }
.vendo-b2b-field-wide { grid-column: 1 / -1; }
.vendo-b2b-field .vendo-b2b-label { margin-top: 14px; }

.vendo-b2b-field-help {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--vendo-b2b-muted);
}
.vendo-b2b-field-help.is-ok    { color: #15803d; font-weight: 600; }
.vendo-b2b-field-help.is-error { color: #b91c1c; font-weight: 600; }

.vendo-b2b-input-group { display: flex; align-items: stretch; }
.vendo-b2b-input-addon {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--vendo-b2b-border);
    border-right: 0;
    border-radius: 4px 0 0 4px;
    background: #f9fafb;
    color: var(--vendo-b2b-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    white-space: nowrap;
}
.vendo-b2b-input-addon + .vendo-b2b-input { border-radius: 0 4px 4px 0; min-width: 0; }
.vendo-b2b-field-code .vendo-b2b-input {
    text-transform: uppercase;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
}

/* --- Kalkulator --- */
.vendo-b2b-calc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 6px;
    background: var(--vendo-b2b-accent-soft);
    font-size: 14px;
}
.vendo-b2b-calc label { margin: 0; font-weight: 600; }
.vendo-b2b-calc .vendo-b2b-calc-input { width: 110px; padding: 6px 8px; }
.vendo-b2b-calc-out { font-weight: 700; color: var(--vendo-b2b-accent-dark); font-variant-numeric: tabular-nums; }
.vendo-b2b-calc p { flex-basis: 100%; margin: 2px 0 0; }

/* --- Lista kodów --- */
.vendo-b2b-code-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f3f4f6;
    color: var(--vendo-b2b-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.vendo-b2b-codes-table tr.is-paused .vendo-b2b-code-chip { opacity: 0.6; }
.vendo-b2b-codes-table tr.is-archived td { color: var(--vendo-b2b-muted); }

.vendo-b2b-linkbtn {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    color: var(--vendo-b2b-accent);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.vendo-b2b-linkbtn:hover { color: var(--vendo-b2b-accent-dark); }
.vendo-b2b-linkbtn.is-danger { color: #b91c1c; }

.vendo-b2b-code-actions { min-width: 170px; }
.vendo-b2b-code-actions .vendo-b2b-inline-form {
    display: inline-flex;
    margin: 0 10px 4px 0;
}
.vendo-b2b-inline-edit { margin: 0 0 6px; }
.vendo-b2b-inline-edit summary {
    cursor: pointer;
    color: var(--vendo-b2b-accent);
    font-size: 13px;
    font-weight: 600;
}
.vendo-b2b-inline-edit form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
}
.vendo-b2b-inline-edit .vendo-b2b-input { width: 84px; padding: 5px 8px; }

.vendo-b2b-archive { margin: 0 0 24px; }
.vendo-b2b-archive summary {
    margin: 0 0 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--vendo-b2b-muted);
}

/* --- Dane do wypłaty --- */
.vendo-b2b-payout-form {
    padding: 4px 18px 18px;
    border: 1px solid var(--vendo-b2b-border);
    border-radius: 8px;
    background: #fff;
}
.vendo-b2b-payout-form .vendo-b2b-muted { margin: 14px 0 0; }

/* ===========================================================================
   RESPONSYWNOŚĆ
   =========================================================================== */

@media (max-width: 600px) {
    .vendo-b2b-table { display: block; overflow-x: auto; }
    .vendo-b2b-table-wrap .vendo-b2b-table { display: table; }
    .vendo-b2b-filterbar { align-items: stretch; }
    .vendo-b2b-filterbar label,
    .vendo-b2b-filterbar .vendo-b2b-input { width: 100%; min-width: 0; }
    .vendo-b2b-filterbar-actions { margin-left: 0; width: 100%; }
    .vendo-b2b-tile-value { font-size: 21px; }
    .vendo-b2b-copy { flex-direction: column; align-items: stretch; }
    .vendo-b2b-copy code { white-space: normal; word-break: break-all; }
    .vendo-b2b-toolbar { flex-direction: column; align-items: stretch; }
    .vendo-b2b-toolbar .vendo-b2b-input { width: 100%; }

    /* Lista zamówień i kody jako karty — etykiety z atrybutów data-label. */
    .vendo-b2b-table-wrap .vendo-b2b-table.vendo-b2b-ledger,
    .vendo-b2b-table-wrap .vendo-b2b-table.vendo-b2b-codes-table,
    .vendo-b2b-table-wrap .vendo-b2b-table.vendo-b2b-wallet-table { display: block; }
    .vendo-b2b-ledger thead,
    .vendo-b2b-codes-table thead,
    .vendo-b2b-wallet-table thead { display: none; }
    .vendo-b2b-ledger tbody,
    .vendo-b2b-ledger tfoot,
    .vendo-b2b-codes-table tbody,
    .vendo-b2b-wallet-table tbody { display: block; }
    .vendo-b2b-ledger tr.vendo-b2b-ledger-row,
    .vendo-b2b-ledger tfoot tr,
    .vendo-b2b-codes-table tbody tr,
    .vendo-b2b-wallet-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px 14px;
        padding: 14px 2px;
        border-bottom: 1px solid var(--vendo-b2b-border);
    }
    .woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-ledger td,
    .woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-codes-table td,
    .woocommerce-MyAccount-content .vendo-b2b-table.vendo-b2b-wallet-table td,
    .vendo-b2b-ledger td,
    .vendo-b2b-codes-table td,
    .vendo-b2b-wallet-table td {
        display: block;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: none !important;
        text-align: left !important;
        white-space: normal;
    }
    .vendo-b2b-ledger td[data-label]::before,
    .vendo-b2b-codes-table td[data-label]::before,
    .vendo-b2b-wallet-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 1px;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: var(--vendo-b2b-muted);
    }
    .vendo-b2b-ledger td:empty,
    .vendo-b2b-ledger tfoot td:not([data-label]):not(:first-child) { display: none; }
    .vendo-b2b-ledger tfoot td:first-child,
    .vendo-b2b-ledger td.vendo-b2b-col-toggle,
    .vendo-b2b-codes-table td:first-child,
    .vendo-b2b-codes-table td.vendo-b2b-code-actions,
    .vendo-b2b-wallet-table td.vendo-b2b-wallet-where { grid-column: 1 / -1; }
    .vendo-b2b-ledger .vendo-b2b-col-code { min-width: 0; }
    .vendo-b2b-ledger tr.vendo-b2b-ledger-details:not([hidden]) { display: block; }
    .vendo-b2b-ledger tr.vendo-b2b-ledger-details > td { display: block; padding: 4px 2px 14px !important; }
    .vendo-b2b-ledger .vendo-b2b-row-toggle { width: auto; padding: 0 10px; gap: 6px; }
    .vendo-b2b-ledger .vendo-b2b-row-toggle .screen-reader-text {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
        white-space: nowrap !important;
    }
}
