/**
 * Linkbraid — premium UI (ui3).
 * Wymaga tokens.css (fonty + zmienne). Wszystkie dotychczasowe klasy lbraid-*
 * zachowują działanie; zmienia się wyłącznie warstwa wizualna.
 */

/* ============================= Baza ============================= */
.lbraid-wrap {
    max-width: 1520px;
    margin: 24px 24px 48px 4px;
    color: var(--r-ink);
    font: 400 13.5px/1.55 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.lbraid-wrap * { box-sizing: border-box; }
.lbraid-wrap [hidden] { display: none !important; }
.lbraid-wrap a { color: var(--r-brand-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.lbraid-wrap a:hover { color: var(--r-brand-900); }
.lbraid-wrap :focus-visible { outline: 2px solid var(--r-brand-600); outline-offset: 2px; border-radius: 4px; }
.lbraid-muted, .lbraid-subtitle { color: var(--r-muted); }

.lbraid-wrap h2 { font-size: 15px; font-weight: 800; line-height: 1.4; color: var(--r-ink); margin: 0 0 12px; letter-spacing: -.01em; }
.lbraid-wrap h3 { font-size: 14px; font-weight: 800; margin: 26px 0 10px; letter-spacing: -.01em; }
.lbraid-wrap h4 { font-size: 11px; font-weight: 800; margin: 0 0 10px; color: var(--r-faint); text-transform: uppercase; letter-spacing: .07em; }

.lbraid-icon {
    width: 16px; height: 16px; flex: none;
    stroke: currentColor; fill: none; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -3px;
}
h2 > .lbraid-icon { color: var(--r-brand-600); margin-right: 2px; }

/* ============================= Nagłówek strony ============================= */
.lbraid-header {
    position: relative;
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: 14px;
    box-shadow: var(--r-shadow-card);
    padding: 22px 28px 24px;
    margin: 0 0 24px;
    overflow: hidden;
}
.lbraid-header::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--r-gradient);
}
.lbraid-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
    color: var(--r-gold-700); margin: 0 0 7px;
}
.lbraid-eyebrow::before {
    content: ""; width: 22px; height: 3px; border-radius: 2px; flex: none;
    background: var(--r-gradient-gold);
}
.lbraid-header h1 {
    font: 800 25px/1.25 'Inter', sans-serif;
    padding: 0; margin: 0 0 7px; color: var(--r-ink); letter-spacing: -.02em;
}
.lbraid-header h1 .dashicons { display: none; }
.lbraid-subtitle { margin: 0; font-size: 14px; max-width: 860px; }

/* ============================= Przyciski i pola ============================= */
.lbraid-wrap .button {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1;
    min-height: 34px; padding: 0 15px;
    border: 1px solid var(--r-line-strong); border-radius: var(--r-radius-sm);
    background: var(--r-surface); color: var(--r-ink);
    box-shadow: var(--r-shadow-xs); cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: border-color .15s, color .15s, background .15s, box-shadow .15s, transform .1s;
}
.lbraid-wrap .button:hover {
    background: var(--r-brand-50); border-color: var(--r-brand-600); color: var(--r-brand-700);
    box-shadow: var(--r-shadow-xs);
}
.lbraid-wrap .button:active { transform: translateY(1px); }
.lbraid-wrap .button-primary,
.lbraid-wrap input[type=submit].button-primary {
    background: var(--r-brand-900); border-color: transparent; color: #fff;
    box-shadow: 0 4px 14px -4px rgba(20, 26, 60, .45);
}
.lbraid-wrap .button-primary:hover { background: #1E2650; border-color: transparent; color: #fff; box-shadow: 0 6px 18px -4px rgba(20, 26, 60, .5); }
.lbraid-wrap .button:disabled { opacity: .45; cursor: default; transform: none; }

.lbraid-wrap input, .lbraid-wrap select, .lbraid-wrap textarea {
    font-family: inherit; font-size: 13.5px; color: var(--r-ink);
    background: var(--r-surface);
    border: 1px solid var(--r-line-strong); border-radius: var(--r-radius-sm);
    min-height: 34px; padding: 4px 12px;
    transition: border-color .15s, box-shadow .15s;
}
.lbraid-wrap input:focus, .lbraid-wrap select:focus, .lbraid-wrap textarea:focus {
    border-color: var(--r-brand-600); box-shadow: 0 0 0 3px rgba(123, 97, 255, .13); outline: none;
}
.lbraid-wrap input[type=checkbox] { min-height: 16px; flex-shrink: 0; padding: 0; accent-color: var(--r-brand-600); }
.lbraid-wrap input[type=radio] { accent-color: var(--r-brand-600); }
.lbraid-wrap input[type=number] { width: 76px; }
.lbraid-wrap label { font-weight: 600; }
.lbraid-wrap ::placeholder { color: var(--r-faint); }

/* ============================= Powiadomienia ============================= */
.lbraid-notices .notice {
    margin: 0 0 16px; padding: 11px 16px;
    background: var(--r-surface);
    border: 1px solid var(--r-line); border-left: 3px solid var(--r-brand-600);
    border-radius: 10px; box-shadow: var(--r-shadow-xs); font-size: 13px;
}
.lbraid-notices .notice-success { border-left-color: var(--r-green-700); }
.lbraid-notices .notice-error { border-left-color: var(--r-red-600); }
.lbraid-notices .notice p { margin: 0 0 6px; }

/* ============================= Kafelki statystyk ============================= */
.lbraid-stats-grid {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px;
    margin: 0 0 24px;
}
.lbraid-stat-card {
    background: var(--r-surface); border: 1px solid var(--r-line);
    border-radius: var(--r-radius); box-shadow: var(--r-shadow-card);
    padding: 16px 18px;
    transition: box-shadow .18s, transform .18s, border-color .18s;
}
.lbraid-stat-card:hover { box-shadow: var(--r-shadow-hover); transform: translateY(-1px); }
.lbraid-stat-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 0 12px;
    background: var(--r-brand-50); color: var(--r-brand-600);
}
.lbraid-stat-icon .lbraid-icon { width: 18px; height: 18px; }
.lbraid-stat-card:nth-child(2) .lbraid-stat-icon { background: var(--r-green-50); color: var(--r-green-700); }
.lbraid-stat-card:nth-child(3) .lbraid-stat-icon { background: var(--r-brand-100); color: var(--r-brand-700); }
.lbraid-stat-card:nth-child(4) .lbraid-stat-icon { background: var(--r-gold-100); color: var(--r-gold-700); }
.lbraid-stat-card:nth-child(5) .lbraid-stat-icon { background: var(--r-green-50); color: var(--r-green-700); }
.lbraid-stat-card:nth-child(6) .lbraid-stat-icon { background: var(--r-gold-100); color: var(--r-gold-700); }
.lbraid-stat-number {
    font-size: 28px; font-weight: 800; line-height: 1.15;
    font-variant-numeric: tabular-nums; letter-spacing: -.02em;
    margin-bottom: 3px; color: var(--r-ink);
}
.lbraid-stat-label { font-size: 12px; font-weight: 700; color: var(--r-muted); }

/* ============================= Panele / karty ============================= */
.lbraid-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.lbraid-dashboard-main { min-width: 0; }
.lbraid-actions-panel, .lbraid-settings-section {
    background: var(--r-surface); border: 1px solid var(--r-line);
    border-radius: var(--r-radius); box-shadow: var(--r-shadow-card);
    padding: 20px 24px; margin: 0 0 20px;
}
.lbraid-review-panel { position: relative; overflow: hidden; }
.lbraid-review-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--r-gradient-gold); }
.lbraid-actions-row, .lbraid-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lbraid-actions-row { row-gap: 10px; }
.lbraid-toolbar { margin-bottom: 14px; }
.lbraid-toolbar input[type=search] { width: 320px; max-width: 100%; }
.lbraid-toolbar #lbraid-total { margin-left: auto; font-weight: 600; }
.lbraid-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; }
.lbraid-section-heading h2 { margin: 0; }

.lbraid-wrap progress {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 12px; border: 0; border-radius: var(--r-radius-pill);
    background: #E7E9F2; overflow: hidden; margin: 8px 0 4px;
}
.lbraid-wrap progress::-webkit-progress-bar { background: #E7E9F2; border-radius: var(--r-radius-pill); }
.lbraid-wrap progress::-webkit-progress-value { background: var(--r-gradient); border-radius: var(--r-radius-pill); transition: width .4s ease; }
.lbraid-wrap progress::-moz-progress-bar { background: linear-gradient(90deg, #FF6A45 0%, #7B61FF 52%, #2ED3A5 100%); border-radius: 999px; }

.lbraid-wrap details { margin: 16px 0 0; }
.lbraid-wrap summary { font-size: 13px; font-weight: 700; color: var(--r-brand-700); cursor: pointer; }
.lbraid-wrap details ul { list-style: disc; padding-left: 20px; }
#job-counts { font-variant-numeric: tabular-nums; font-weight: 600; }
#priority-form > label { display: block; margin-bottom: 8px; }
#priority-post-select { min-width: 280px; max-width: 100%; }

/* ============================= Pigułki statusu ============================= */
.lbraid-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 11px; border-radius: var(--r-radius-pill);
    background: var(--r-brand-50); color: var(--r-brand-700);
    font-size: 11.5px; font-weight: 800; white-space: nowrap; letter-spacing: .01em;
}
.lbraid-badge--ok { background: var(--r-green-50); color: var(--r-green-700); }
.lbraid-badge--muted { background: var(--r-amber-50); color: var(--r-amber-700); }
.lbraid-count-zero { color: var(--r-red-600); font-weight: 800; font-variant-numeric: tabular-nums; }
.lbraid-count-ok { color: var(--r-green-700); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ============================= Tabela treści ============================= */
.lbraid-posts-table-wrap {
    overflow: auto; background: var(--r-surface);
    border: 1px solid var(--r-line); border-radius: var(--r-radius);
    box-shadow: var(--r-shadow-card);
}
.lbraid-wrap .lbraid-posts-table { border: 0; border-collapse: collapse; width: 100%; box-shadow: none; background: transparent; }
.lbraid-posts-table th {
    background: var(--r-surface-2); color: var(--r-faint);
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    padding: 12px 16px; border-bottom: 1px solid var(--r-line);
    white-space: nowrap; text-align: left;
}
.lbraid-posts-table td { font-size: 13.5px; padding: 13px 16px; vertical-align: middle; border-bottom: 1px solid #EDEFF5; background: transparent; }
.lbraid-posts-table tbody tr { transition: background .12s; }
.lbraid-posts-table tbody tr:hover { background: #F3F1FF; }
.lbraid-posts-table tbody tr:last-child td { border-bottom: 0; }
.lbraid-posts-table td:first-child { min-width: 240px; max-width: 430px; }
.lbraid-posts-table td:first-child > strong > a { font-weight: 800; font-size: 14px; text-decoration: none; color: var(--r-ink); }
.lbraid-posts-table td:first-child > strong > a:hover { color: var(--r-brand-700); }
.lbraid-row-meta { display: block; font-size: 12px; color: var(--r-faint); margin-top: 3px; overflow-wrap: anywhere; }
.lbraid-row-actions { min-width: 230px; }
.lbraid-row-actions .button { margin: 2px; min-height: 30px; padding: 0 12px; font-size: 12.5px; }
.lbraid-sort { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
.lbraid-sort:hover { color: var(--r-brand-700); }
.lbraid-wrap .lbraid-star {
    border: 0; background: transparent; color: var(--r-gold-600);
    font-size: 24px; min-width: 34px; padding: 0; line-height: 1.2;
    cursor: pointer; transition: transform .12s;
}
.lbraid-wrap .lbraid-star:hover { transform: scale(1.18); }
.lbraid-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 14px 0; color: var(--r-muted); font-weight: 600; }
.lbraid-empty { text-align: center; color: var(--r-muted); padding: 48px 20px !important; font-size: 14px; }

/* ============================= Modal ============================= */
.lbraid-modal-overlay {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(23, 18, 43, .5);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lbraid-modal {
    width: 1180px; max-width: 100%; max-height: 92vh;
    background: var(--r-surface); display: flex; flex-direction: column; overflow: hidden;
    border: 0; border-radius: 16px; box-shadow: var(--r-shadow-modal);
}
.lbraid-modal-header { padding: 18px 26px; border-bottom: 1px solid var(--r-line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lbraid-modal-header h2 { font-size: 18px; margin: 0; }
.lbraid-modal-header .lbraid-eyebrow { margin-bottom: 4px; }
.lbraid-modal-close {
    border: 0; background: var(--r-surface-2); border-radius: 50%;
    width: 34px; height: 34px; flex: none;
    font-size: 22px; line-height: 1; color: var(--r-muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.lbraid-modal-close:hover { background: var(--r-red-50); color: var(--r-red-600); }
.lbraid-modal-body { padding: 6px 26px 26px; overflow: auto; min-height: 180px; background: var(--r-bg); }
.lbraid-modal-footer { display: flex; justify-content: space-between; gap: 12px; padding: 15px 26px; border-top: 1px solid var(--r-line); background: var(--r-surface); }

/* karty propozycji */
.lbraid-suggestion-card {
    background: var(--r-surface); border: 1px solid var(--r-line);
    border-radius: var(--r-radius); box-shadow: var(--r-shadow-xs);
    margin: 14px 0; padding: 18px 20px;
}
.lbraid-suggestion-heading { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.lbraid-suggestion-heading .lbraid-badge { margin-left: auto; }
.lbraid-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 14px 0; border: 1px solid var(--r-line); border-radius: 10px; overflow: hidden; }
.lbraid-diff section { padding: 16px 18px; min-width: 0; background: var(--r-surface-2); overflow-wrap: anywhere; }
.lbraid-diff section:last-child { background: #EDFBF6; border-left: 1px solid #BFE9DB; }
.lbraid-diff section h4 { border-bottom: 1px solid var(--r-line); padding-bottom: 8px; }
.lbraid-preview { font-size: 14px; line-height: 1.7; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.lbraid-preview p { margin: 0 0 10px; }
.lbraid-preview a { background: #D3F5EA; color: #0B6B51; text-decoration: underline; border-radius: 3px; padding: 0 2px; }
.lbraid-suggestion-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--r-line); padding-top: 14px; margin-top: 16px; }
.lbraid-suggestion-card details label { display: block; margin: 12px 0; }
.lbraid-suggestion-card details input, .lbraid-suggestion-card details textarea { display: block; width: 100%; margin-top: 6px; }
.lbraid-suggestion-card details textarea { min-height: 95px; }

.lbraid-existing-links-list { display: flex; gap: 8px; flex-wrap: wrap; }
.lbraid-existing-link-item {
    border: 1px solid var(--r-line); border-left: 3px solid var(--r-gold-400);
    border-radius: var(--r-radius-sm); background: var(--r-surface);
    box-shadow: var(--r-shadow-xs); padding: 9px 13px; max-width: 100%;
}
.lbraid-existing-link-item small { display: block; color: var(--r-faint); font-size: 12px; }
.lbraid-error { color: #8a2424; background: var(--r-red-50); border: 1px solid #f2c9c9; border-left: 3px solid var(--r-red-600); border-radius: var(--r-radius-sm); padding: 12px 14px; }
.lbraid-history-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--r-line); padding: 12px 0; }
.lbraid-report-row { border-bottom: 1px solid var(--r-line); padding: 13px 0; overflow-wrap: anywhere; }
.lbraid-report-row:last-child { border-bottom: 0; }
.lbraid-report-row p { margin: 4px 0; color: var(--r-muted); }

/* ============================= Ustawienia ============================= */
.lbraid-settings-form { max-width: 1120px; }
.lbraid-settings-form .form-table th { width: 240px; font-weight: 700; color: var(--r-ink); font-size: 13.5px; }
.lbraid-settings-form .description { max-width: 660px; color: var(--r-muted); }
.lbraid-settings-section .form-table { margin: 0; }
.lbraid-settings-section .form-table td { padding-top: 12px; padding-bottom: 12px; }

.lbraid-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--r-line); margin: 0 0 22px; flex-wrap: wrap; }
.lbraid-tab {
    position: relative; border: 0; background: none; cursor: pointer;
    padding: 11px 16px 13px; font: 700 13.5px/1 'Inter', sans-serif;
    color: var(--r-muted); border-radius: 8px 8px 0 0;
    display: inline-flex; align-items: center; gap: 7px;
    transition: color .15s, background .15s;
}
.lbraid-tab:hover { color: var(--r-brand-700); background: var(--r-brand-50); }
.lbraid-tab[aria-selected="true"] { color: var(--r-brand-900); }
.lbraid-tab[aria-selected="true"]::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
    height: 3px; border-radius: 3px; background: var(--r-gradient);
}

.lbraid-provider-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.lbraid-modal h2 a { text-decoration: none; color: inherit; }
.lbraid-modal h2 a:hover { color: #5A43D6; }
.lbraid-modal-view { font-size: .8em; }
.lbraid-provider-card {
    flex: 1; min-width: 240px; display: flex; gap: 12px; align-items: flex-start;
    border: 1.5px solid var(--r-line); border-radius: var(--r-radius);
    background: var(--r-surface); padding: 15px 17px; cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.lbraid-provider-card:hover { border-color: var(--r-brand-600); }
.lbraid-provider-card.is-active {
    border-color: var(--r-brand-600); background: var(--r-brand-50);
    box-shadow: 0 0 0 3px rgba(123, 97, 255, .12);
}
.lbraid-provider-card input[type=radio] { margin-top: 3px; }
.lbraid-provider-card strong { display: block; font-size: 14px; font-weight: 800; }
.lbraid-provider-card span { display: block; font-size: 12.5px; color: var(--r-muted); font-weight: 400; margin-top: 2px; }

.lbraid-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.lbraid-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.lbraid-toggle .lbraid-toggle-track {
    width: 40px; height: 22px; flex: none; border-radius: var(--r-radius-pill);
    background: var(--r-line-strong); position: relative; transition: background .18s;
}
.lbraid-toggle .lbraid-toggle-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s;
}
.lbraid-toggle input:checked + .lbraid-toggle-track { background: var(--r-brand-600); }
.lbraid-toggle input:checked + .lbraid-toggle-track::after { transform: translateX(18px); }
.lbraid-toggle input:focus-visible + .lbraid-toggle-track { outline: 2px solid var(--r-brand-600); outline-offset: 2px; }

.lbraid-chip-check { display: inline-flex; margin: 0 8px 8px 0; cursor: pointer; }
.lbraid-chip-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.lbraid-chip-check .lbraid-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1.5px solid var(--r-line-strong); border-radius: var(--r-radius-pill);
    background: var(--r-surface); padding: 6px 14px;
    font-size: 12.5px; font-weight: 700; color: var(--r-muted);
    transition: border-color .15s, background .15s, color .15s;
}
.lbraid-chip-check .lbraid-chip code { background: none; font-size: 11px; color: var(--r-faint); padding: 0; }
.lbraid-chip-check:hover .lbraid-chip { border-color: var(--r-brand-600); color: var(--r-brand-700); }
.lbraid-chip-check input:checked + .lbraid-chip { border-color: var(--r-brand-600); background: var(--r-brand-50); color: var(--r-brand-900); }
.lbraid-chip-check input:focus-visible + .lbraid-chip { outline: 2px solid var(--r-brand-600); outline-offset: 2px; }

.lbraid-gsc-status {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 13px 17px; border-radius: var(--r-radius-sm); margin-bottom: 16px;
    font-size: 13px;
}
.lbraid-gsc-status--connected { background: var(--r-green-50); border: 1px solid #A9E6D2; color: var(--r-green-700); }
.lbraid-gsc-status--disconnected { background: var(--r-amber-50); border: 1px solid #FFD2C0; color: var(--r-amber-700); }
.lbraid-gsc-status .dashicons { display: none; }
.lbraid-gsc-site { background: #fff; padding: 2px 9px; border-radius: 5px; font-family: Consolas, Monaco, monospace; font-size: 12px; border: 1px solid var(--r-line); color: var(--r-ink); }
.lbraid-gsc-sync { color: var(--r-muted); font-size: 12px; margin-left: auto; }

/* ============================= Tooltipy (CSS) ============================= */
.lbraid-wrap [data-r-tip] { position: relative; }
.lbraid-wrap [data-r-tip]::after {
    content: attr(data-r-tip);
    position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%) translateY(2px);
    background: var(--r-ink); color: #fff;
    font-size: 12px; font-weight: 500; line-height: 1.45; text-transform: none; letter-spacing: 0;
    padding: 7px 11px; border-radius: 7px;
    width: max-content; max-width: 260px; white-space: normal; text-align: left;
    opacity: 0; pointer-events: none; z-index: 100010;
    transition: opacity .15s, transform .15s;
}
.lbraid-wrap [data-r-tip]::before {
    content: ""; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: var(--r-ink);
    opacity: 0; pointer-events: none; z-index: 100010; transition: opacity .15s;
}
.lbraid-wrap [data-r-tip]:hover::after, .lbraid-wrap [data-r-tip]:focus-visible::after,
.lbraid-wrap [data-r-tip]:hover::before, .lbraid-wrap [data-r-tip]:focus-visible::before {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ============================= Mapa linków ============================= */
.lbraid-map-container {
    height: 620px;
    background: radial-gradient(1100px 560px at 50% -10%, #1A2150 0%, #10142E 60%);
    border: 0; border-radius: 14px; box-shadow: var(--r-shadow-card);
    position: relative; overflow: hidden;
}
.lbraid-map-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.lbraid-map-stat {
    background: #F4F5FB; border-radius: 10px; padding: 7px 13px;
    font-size: 12.5px; font-weight: 600; color: var(--r-muted);
}
.lbraid-map-stat strong { color: var(--r-ink); font-weight: 800; margin-left: 5px; }
.lbraid-map-stat--focus, .lbraid-map-stat--radius { background: #141A3C; color: #9BA3C7; }
.lbraid-map-stat--focus strong { color: #2ED3A5; }
.lbraid-map-stat--radius strong { color: #7B61FF; }
.lbraid-map-stat a { font-weight: 700; }

/* Overview chart: the end dot sits outside the stretched SVG so it stays round. */
.lbraid-chart-wrap { position: relative; }
.lbraid-chart-dot {
    position: absolute; width: 9px; height: 9px; border-radius: 50%;
    background: #141A3C; border: 2px solid #fff; box-sizing: content-box;
    transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(20,26,60,.15);
}

/* Cannibalization: one flex row per competing page, notes on their own line. */
.lbraid-cannibal-page { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 7px 0 0; }
.lbraid-cannibal-role { width: 14px; text-align: center; color: #FF6A45; font-weight: 800; }
.lbraid-cannibal-title { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbraid-cannibal-page--winner .lbraid-cannibal-title a { font-weight: 800; }
.lbraid-cannibal-note { margin: 1px 0 4px 26px; font-size: 12px; }

.lbraid-domain-detail td { background: #FAFAFF; }
.lbraid-map-container svg { width: 100%; height: 100%; }
.lbraid-map-controls, .lbraid-map-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 14px 0; }
.lbraid-map-legend { color: var(--r-muted); font-weight: 600; font-size: 12.5px; }
.lbraid-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.lbraid-legend-dot--normal { background: #7B61FF; }
.lbraid-legend-dot--priority { background: #FF6A45; }
.lbraid-legend-dot--orphan { background: #ef4444; }
.lbraid-legend-dot--isolated { background: #8A8FA5; }
.lbraid-legend-dot--strands { background: conic-gradient(#FF6A45, #FFC53D, #2ED3A5, #4CC9F0, #7B61FF, #F072B6, #FF6A45); }
.lbraid-legend-dot--nostrand { background: #4A527A; }
.lbraid-legend-dot--priority-ring { background: transparent; border: 3px solid #FF6A45; box-sizing: border-box; }
.lbraid-legend-dot--orphan-ring { background: transparent; border: 2px dashed #ef4444; box-sizing: border-box; }
.lbraid-map-tooltip {
    position: fixed; background: #fff; padding: 12px 15px;
    border: 1px solid var(--r-line); border-radius: 10px; box-shadow: var(--r-shadow-hover);
    pointer-events: none; z-index: 100001; max-width: 300px; font-size: 12.5px;
}
.lbraid-tooltip-title { font-weight: 800; margin-bottom: 4px; }
.lbraid-loading { padding: 24px; color: #9BA3C7; }

/* ============================= Strony priorytetowe ============================= */
.lbraid-priority-table td { vertical-align: top; }
.lbraid-priority-table td:first-child { width: 27%; min-width: 230px; }
.lbraid-priority-table td:last-child { width: 23%; min-width: 190px; }
.lbraid-priority-table label { display: block; margin: 14px 0 8px; }
.lbraid-anchor-editor { min-width: 350px; }
.lbraid-anchor-editor textarea { width: 100%; resize: vertical; padding: 10px 12px; line-height: 1.6; margin-bottom: 8px; }
.lbraid-anchor-editor select { width: 100%; }
.lbraid-anchor-editor .lbraid-muted { font-size: 12px; }
.lbraid-anchor-ai { display: flex; gap: 6px; flex-wrap: wrap; }
.lbraid-anchor-ai .lbraid-anchor-chip {
    white-space: normal; text-align: left; min-height: 28px;
    background: var(--r-brand-50); border-color: var(--r-brand-100); color: var(--r-brand-700);
    border-radius: var(--r-radius-pill); font-weight: 600;
}
.lbraid-anchor-ai .lbraid-anchor-chip:hover { border-color: var(--r-brand-600); }
.lbraid-anchor-warning {
    border: 1px solid #FFD2C0; border-left: 3px solid var(--r-gold-600);
    background: var(--r-amber-50); color: var(--r-amber-700);
    border-radius: var(--r-radius-sm); padding: 9px 13px; font-size: 12.5px;
}

/* ============================= Zdrowie linkowania ============================= */
.lbraid-badge--bad { background: var(--r-red-50); color: var(--r-red-600); }
.lbraid-health-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 10px 36px; align-items: start; }
.lbraid-gauge-col { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.lbraid-gauge { position: relative; width: 168px; height: 168px; }
.lbraid-gauge-svg { width: 100%; height: 100%; display: block; }
.lbraid-gauge-score { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2px; }
.lbraid-gauge-score strong { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--r-ink); font-variant-numeric: tabular-nums; }
.lbraid-gauge-score span { font-size: 14px; font-weight: 700; color: var(--r-faint); margin-top: 14px; }
.lbraid-gauge-note { margin: 0; font-size: 12px; text-align: center; }
.lbraid-health-components { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.lbraid-health-components h2 { margin: 0 0 2px; }
.lbraid-hcomp { display: flex; flex-direction: column; gap: 6px; }
.lbraid-hcomp-top { display: flex; align-items: center; gap: 10px; }
.lbraid-hcomp-label { font-weight: 700; font-size: 13.5px; }
.lbraid-hcomp-points { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--r-muted); font-variant-numeric: tabular-nums; }
.lbraid-hbar { height: 8px; border-radius: var(--r-radius-pill); background: #E7E9F2; overflow: hidden; }
.lbraid-hbar > span { display: block; height: 100%; border-radius: var(--r-radius-pill); background: var(--r-gradient); transition: width .5s ease; }
.lbraid-hcomp-detail { color: var(--r-faint); font-size: 12px; }

/* ============================= Zadania priorytetowe ============================= */
.lbraid-dashboard-aside { min-width: 0; }
.lbraid-task-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--r-line); }
.lbraid-task-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.lbraid-task-count { flex: none; min-width: 34px; text-align: center; padding: 3px 8px; border-radius: var(--r-radius-pill); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lbraid-task-count--bad { background: var(--r-red-50); color: var(--r-red-600); }
.lbraid-task-count--warn { background: var(--r-amber-50); color: var(--r-amber-700); }
.lbraid-task-count--info { background: var(--r-brand-50); color: var(--r-brand-700); }
.lbraid-task-label { font-size: 13px; font-weight: 600; min-width: 0; }
.lbraid-task-action { margin-left: auto; flex: none; font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ============================= Trendy i wykres ============================= */
.lbraid-trend { margin-top: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .01em; }
.lbraid-trend--up { color: var(--r-green-700); }
.lbraid-trend--down { color: var(--r-red-600); }
.lbraid-trend--flat { color: var(--r-faint); }
.lbraid-chart-svg { width: 100%; height: 150px; display: block; }
.lbraid-chart-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--r-muted); }
.lbraid-chart-footer strong { font-size: 15px; font-weight: 800; color: var(--r-ink); font-variant-numeric: tabular-nums; }

/* ============================= Stany puste ============================= */
.lbraid-empty-state { text-align: center; padding: 26px 16px 20px; }
.lbraid-empty-state h3 { margin: 0 0 6px; font-size: 16px; }
.lbraid-empty-state p { max-width: 520px; margin: 0 auto 16px; }

/* ============================= Responsywność ============================= */
@media (max-width: 1200px) {
    .lbraid-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lbraid-dashboard-grid { grid-template-columns: minmax(0, 1fr) 300px; }
    .lbraid-posts-table { min-width: 950px; }
}
@media (max-width: 960px) {
    .lbraid-dashboard-grid { grid-template-columns: 1fr; }
    .lbraid-diff { grid-template-columns: 1fr; }
    .lbraid-diff section:last-child { border-left: 0; border-top: 1px solid #BFE9DB; }
    .lbraid-health-grid { grid-template-columns: 1fr; }
    .lbraid-gauge-col { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 782px) {
    .lbraid-wrap { margin: 16px 12px 32px 2px; }
    .lbraid-header { padding: 18px 20px; }
    .lbraid-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .lbraid-stat-card { padding: 14px; }
    .lbraid-stat-number { font-size: 24px; }
    .lbraid-actions-panel, .lbraid-settings-section { padding: 16px; }
    .lbraid-wrap .button { min-height: 38px; }
    .lbraid-wrap input, .lbraid-wrap select { min-height: 38px; max-width: 100%; }
    .lbraid-wrap input[type=checkbox] { min-height: 16px; }
    .lbraid-toolbar input[type=search] { width: 100%; }
    .lbraid-toolbar #lbraid-total { margin-left: 0; }
    .lbraid-modal-overlay { padding: 8px; }
    .lbraid-modal { max-height: 96vh; border-radius: 12px; }
    .lbraid-modal-header, .lbraid-modal-footer { padding: 12px 16px; }
    .lbraid-modal-body { padding: 0 12px 16px; }
    .lbraid-modal-footer, .lbraid-suggestion-heading { flex-wrap: wrap; }
    .lbraid-history-row { flex-direction: column; align-items: flex-start; }
    .lbraid-suggestion-card { padding: 13px; }
    .lbraid-settings-form .form-table th { width: auto; }
    .lbraid-map-container { height: 440px; }
    .lbraid-wrap .lbraid-priority-table { min-width: 0; }
    .lbraid-priority-table thead { display: none; }
    .lbraid-priority-table tbody, .lbraid-priority-table tr, .lbraid-priority-table td { display: block; width: 100% !important; min-width: 0 !important; max-width: none !important; }
    .lbraid-priority-table tr { border-bottom: 2px solid var(--r-line-strong); }
    .lbraid-priority-table td { border: 0; }
    .lbraid-priority-table td:last-child { border-top: 1px solid var(--r-line); }
    .lbraid-priority-table .button { white-space: normal; }
    .lbraid-priority-table td:first-child > a { display: block; overflow-wrap: anywhere; }
}

/* ============================= Kreator konfiguracji ============================= */
body.lbraid-wizard-mode #adminmenumain,
body.lbraid-wizard-mode #wpadminbar,
body.lbraid-wizard-mode #wpfooter,
body.lbraid-wizard-mode #screen-meta-links { display: none !important; }
body.lbraid-wizard-mode #wpcontent { margin-left: 0 !important; padding-left: 0 !important; }
html.wp-toolbar:has(body.lbraid-wizard-mode) { padding-top: 0 !important; }

.lbraid-wizard { max-width: none; margin: 0; }
.lbraid-wizard-shell { max-width: 900px; margin: 5vh auto 56px; padding: 0 20px; }
.lbraid-wizard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.lbraid-wizard-skip { border: 0; background: none; color: var(--r-muted); font: 600 13px 'Inter', sans-serif; cursor: pointer; padding: 6px 0; }
.lbraid-wizard-skip:hover { color: var(--r-brand-700); }

.lbraid-wizard-rail { display: flex; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; }
.lbraid-wizard-rail li {
    flex: 1; display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; color: var(--r-faint);
    padding: 10px 6px 0; border-top: 3px solid var(--r-line);
    transition: border-color .2s, color .2s;
}
.lbraid-wizard-rail li span {
    width: 22px; height: 22px; border-radius: 50%; flex: none;
    background: var(--r-line); color: var(--r-muted);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800;
}
.lbraid-wizard-rail li.is-active { border-top-color: var(--r-brand-600); color: var(--r-ink); }
.lbraid-wizard-rail li.is-active span { background: var(--r-gradient); color: #fff; }
.lbraid-wizard-rail li.is-done { border-top-color: var(--r-gold-400); color: var(--r-gold-700); }
.lbraid-wizard-rail li.is-done span { background: var(--r-gold-100); color: var(--r-gold-700); }

.lbraid-wizard-card {
    background: var(--r-surface); border: 1px solid var(--r-line);
    border-radius: 16px; box-shadow: var(--r-shadow-card);
    padding: 34px 40px;
}
.lbraid-wizard-hero h1 { font: 800 30px/1.2 'Inter', sans-serif; margin: 0 0 10px; color: var(--r-ink); letter-spacing: -.02em; padding: 0; }
.lbraid-wizard-props { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 26px 0 4px; }
.lbraid-wizard-prop { border: 1px solid var(--r-line); border-radius: var(--r-radius); padding: 16px 18px; }
.lbraid-wizard-prop .lbraid-icon { width: 22px; height: 22px; color: var(--r-brand-600); }
.lbraid-wizard-prop strong { display: block; font-size: 14px; margin: 10px 0 5px; }
.lbraid-wizard-prop p { margin: 0; font-size: 12.5px; color: var(--r-muted); }

.lbraid-wizard-field { margin: 16px 0; }
.lbraid-wizard-field label { display: block; margin-bottom: 6px; }
.lbraid-wizard-field input { width: 100%; max-width: 520px; }
.lbraid-wizard-actions {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--r-line);
}
.lbraid-wizard-actions > span { display: flex; gap: 8px; }
.lbraid-wizard-results { display: flex; flex-wrap: wrap; gap: 6px; min-height: 20px; margin: 8px 0 18px; }
#wizard-test-results { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 12px; }
#wizard-test-results .lbraid-badge { white-space: normal; text-align: left; }
#wizard-progress { height: 16px; }
.lbraid-wizard-tip {
    margin-top: 14px; padding: 14px 18px; border-radius: 10px;
    background: var(--r-gold-100); border: 1px solid #FFD9C7;
    color: var(--r-gold-700); font-size: 13px; font-weight: 600;
}
.lbraid-wizard-tip::before { content: "Czy wiesz, że?  "; font-weight: 800; }

@media (max-width: 782px) {
    .lbraid-wizard-shell { margin-top: 16px; }
    .lbraid-wizard-card { padding: 20px 18px; }
    .lbraid-wizard-hero h1 { font-size: 24px; }
    .lbraid-wizard-props { grid-template-columns: 1fr; }
    .lbraid-wizard-rail li { font-size: 0; gap: 0; justify-content: center; }
    .lbraid-wizard-rail li span { font-size: 11px; }
    .lbraid-wizard-actions { flex-wrap: wrap; }
}

/* ============================= Metabox w edytorze ============================= */
.lbraid-wrap.lbraid-metabox { margin: 4px 0 6px; max-width: none; }
.lbraid-mb-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lbraid-mb-toolbar .lbraid-badge { font-size: 12.5px; }
.lbraid-metabox #lbraid-mb-body > h3:first-child { margin-top: 8px; }
.lbraid-metabox .lbraid-error .button { margin-left: 8px; }
#lbraid-mb-stale { margin-bottom: 14px; }

.lbraid-word-picker { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 6px; }
.lbraid-word {
    border: 1px solid var(--r-line-strong); background: var(--r-surface);
    border-radius: 6px; padding: 2px 8px; cursor: pointer;
    font: 600 12.5px/1.5 'Inter', sans-serif; color: var(--r-ink);
    transition: border-color .12s, background .12s, color .12s;
}
.lbraid-word:hover { border-color: var(--r-brand-600); color: var(--r-brand-700); }
.lbraid-word.is-selected { background: var(--r-brand-600); border-color: var(--r-brand-600); color: #fff; }

/* ============================= Raporty ============================= */
.lbraid-stats-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.lbraid-toolbar .lbraid-report-export { margin-left: auto; }
[data-lbraid-tab-panel] .lbraid-toolbar { align-items: center; }

/* ============================= GSC „1 klik" ============================= */
.lbraid-gsc-connect {
    border: 1px solid var(--r-brand-100); border-radius: var(--r-radius);
    background: var(--r-brand-50); padding: 18px 22px; margin-bottom: 16px;
}
.lbraid-gsc-connect p:first-child { margin-top: 0; }
.lbraid-gsc-advanced { margin-top: 6px; }
.lbraid-gsc-advanced summary { color: var(--r-muted); }
.lbraid-gsc-advanced[open] summary { margin-bottom: 10px; }

/* ============================= Typografia Linkbraid ============================= */
.lbraid-wrap h1, .lbraid-wrap h2, .lbraid-wrap h3,
.lbraid-stat-number, .lbraid-gauge-score strong, .lbraid-chart-footer strong {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* ============================= Strands ============================= */
.lbraid-strand-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; flex: none; }
.lbraid-strand-detail > td { background: var(--r-surface-2); padding: 16px 18px; }
.lbraid-map-legend strong { color: var(--r-ink); }
