/* ===== Topbar w prawym górnym rogu (menu konta + Historia zmian) ===== */

.unified-topbar-wrap {
    position: fixed;
    top: 14px;
    right: 22px;
    z-index: 900;
    display: flex;
    justify-content: flex-end;
    background: transparent;
    pointer-events: none;
}

.unified-topbar-wrap * {
    pointer-events: auto;
}

.unified-account-menu {
    position: relative;
}

.unified-account-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
    font-weight: 700;
    color: #0f172a;
}

.unified-account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
}

.unified-account-trigger .uam-caret {
    font-size: 10px;
    color: #64748b;
    transition: transform .15s ease;
}

.unified-account-menu.open .uam-caret {
    transform: rotate(180deg);
}

.unified-account-badge {
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    padding: 1px 7px;
    line-height: 1.5;
}

.unified-account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 250px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
    padding: 8px;
    display: none;
}

.unified-account-menu.open .unified-account-dropdown {
    display: block;
}

.unified-account-dropdown .uam-name {
    padding: 8px 10px 4px;
    font-weight: 800;
    color: #0f172a;
}

.unified-account-dropdown .uam-role {
    padding: 0 10px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    border-bottom: 1px solid #eef1f5;
    margin-bottom: 6px;
}

.unified-account-dropdown a,
.unified-account-dropdown button.uam-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 10px;
    border-radius: 10px;
    color: #1e293b;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.unified-account-dropdown a:hover,
.unified-account-dropdown button.uam-item:hover {
    background: #f1f5f9;
}

.unified-account-dropdown .uam-danger {
    color: #dc2626;
}

.uam-theme-toggle {
    cursor: pointer;
}

.uam-theme-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 999px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
    font-weight: 800;
}

.uam-theme-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, .18);
}

.uam-theme-toggle[data-theme="dark"] .uam-theme-pill {
    background: #1e293b;
    color: #cbd5e1;
}

.uam-theme-toggle[data-theme="dark"] .uam-theme-pill-dot {
    background: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, .25);
}

/* ===== Rozmiar czcionki — globalne klasy stosowane na <html> ===== */

html.font-small { font-size: 14px; }
html.font-normal { font-size: 16px; }
html.font-large { font-size: 18px; }
html.font-xlarge { font-size: 20px; }

/* ===== Stepper rozmiaru czcionki w menu konta ===== */

.uam-font-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.uam-font-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.uam-font-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    display: grid;
    place-items: center;
    line-height: 1;
}

.uam-font-btn:hover {
    background: #e2e8f0;
}

.uam-font-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.uam-font-label {
    min-width: 64px;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

body.dark-mode .uam-font-row { color: #e5e7eb; }
body.dark-mode .uam-font-btn { background: #0f172a; border-color: #334155; color: #e5e7eb; }
body.dark-mode .uam-font-btn:hover { background: #1e293b; }
body.dark-mode .uam-font-label { color: #94a3b8; }

/* ===== Modal historii zmian ===== */

.chc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px;
    z-index: 1000;
}

.chc-overlay.open {
    display: flex;
}

.chc-modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.chc-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #eef1f5;
}

.chc-modal-head h4 {
    margin: 0;
    font-weight: 900;
    font-size: 18px;
    color: #0f172a;
}

.chc-modal-close {
    border: 0;
    background: #f1f5f9;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: #334155;
}

.chc-modal-body {
    padding: 16px 20px 22px;
    overflow-y: auto;
}

.chc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.chc-you {
    margin-left: 8px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
}

.chc-count {
    color: #64748b;
    font-weight: 700;
    font-size: 13px;
}

.chc-empty {
    text-align: center;
    color: #64748b;
    padding: 28px 10px;
    font-weight: 600;
}

.chc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chc-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    background: #f8fafc;
}

.chc-badge {
    flex: none;
    height: fit-content;
    font-size: 11px;
    font-weight: 900;
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    white-space: nowrap;
}

.chc-badge.chc-score { background: #2563eb; }
.chc-badge.chc-docs { background: #059669; }
.chc-badge.chc-security { background: #d97706; }
.chc-badge.chc-account { background: #64748b; }

.chc-item-body { flex: 1; min-width: 0; }

.chc-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.chc-item-top strong { color: #0f172a; font-size: 14px; }
.chc-item-top time { color: #94a3b8; font-size: 12px; }

.chc-field {
    margin-top: 4px;
    font-size: 13px;
    color: #334155;
    word-break: break-word;
}

.chc-old { color: #b91c1c; text-decoration: line-through; }
.chc-new { color: #15803d; font-weight: 700; }

.chc-meta {
    margin-top: 6px;
    font-size: 11.5px;
    color: #94a3b8;
}

body.dark-mode .unified-account-trigger,
body.dark-mode .unified-account-dropdown,
body.dark-mode .chc-modal {
    background: #1e293b;
    border-color: #334155;
    color: #e5e7eb;
}

body.dark-mode .unified-account-trigger { color: #e5e7eb; }
body.dark-mode .unified-account-dropdown a,
body.dark-mode .unified-account-dropdown button.uam-item { color: #e5e7eb; }
body.dark-mode .unified-account-dropdown a:hover,
body.dark-mode .unified-account-dropdown button.uam-item:hover { background: #0f172a; }
body.dark-mode .chc-modal-head { border-color: #334155; }
body.dark-mode .chc-item { background: #0f172a; border-color: #334155; }
body.dark-mode .chc-modal-close { background: #334155; color: #e5e7eb; }

@media (max-width: 992px) {
    .unified-topbar-wrap { padding: 12px 14px; }
    .chc-modal { max-height: 92vh; }
}
