/* Intranet Wiśniewo Messenger */
:root {
    --im-blue: #3478f6;
    --im-violet: #7767ff;
    --im-green: #25b67a;
    --im-red: #ef476f;
}

body.pw-modern .im-top-button {
    position: relative;
    display: grid !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 1px solid var(--pw-border) !important;
    border-radius: 14px !important;
    color: var(--pw-text) !important;
    background: var(--pw-surface-soft) !important;
    box-shadow: none !important;
}

body.pw-modern .im-top-button svg {
    width: 20px;
    height: 20px;
}

body.pw-modern .im-badge {
    position: absolute;
    right: -4px;
    top: -5px;
    display: none;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--pw-surface-strong);
    border-radius: 999px;
    color: #fff;
    font-size: 9px;
    font-weight: 850;
    background: var(--im-red);
}

body.pw-modern .im-badge.has-value {
    display: flex;
}

body.pw-modern .im-online-panel {
    position: fixed;
    z-index: 1080;
    right: 16px;
    bottom: 16px;
    width: 278px;
    max-height: min(520px, calc(100vh - 130px));
    overflow: hidden;
    border: 1px solid var(--pw-border);
    border-radius: 22px;
    background: var(--pw-surface-strong);
    box-shadow: 0 24px 68px rgba(26,39,69,.20);
    backdrop-filter: blur(28px) saturate(145%);
    -webkit-backdrop-filter: blur(28px) saturate(145%);
    transition: width .2s ease, height .2s ease, transform .2s ease;
}

body.pw-modern .im-online-panel.is-collapsed {
    width: 58px;
    height: 58px;
    border-radius: 18px;
}

body.pw-modern .im-online-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px 10px 14px;
    border-bottom: 1px solid var(--pw-border);
}

body.pw-modern .im-online-panel.is-collapsed .im-online-header {
    width: 58px;
    height: 58px;
    padding: 7px;
    border: 0;
}

body.pw-modern .im-online-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

body.pw-modern .im-online-dot,
body.pw-modern .im-contact-status {
    display: block;
    width: 9px;
    min-width: 9px;
    height: 9px;
    border: 2px solid var(--pw-surface-strong);
    border-radius: 50%;
    background: var(--im-green);
    box-shadow: 0 0 0 2px rgba(37,182,122,.13);
}

body.pw-modern .im-online-title strong {
    display: block;
    font-size: 12px;
}

body.pw-modern .im-online-title span {
    display: block;
    margin-top: 2px;
    color: var(--pw-muted);
    font-size: 9px;
}

body.pw-modern .im-online-toggle {
    display: grid !important;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 11px !important;
    color: var(--pw-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.pw-modern .im-online-toggle svg {
    width: 17px;
    height: 17px;
}

body.pw-modern .im-online-panel.is-collapsed .im-online-title > div,
body.pw-modern .im-online-panel.is-collapsed .im-online-toggle {
    display: none !important;
}

body.pw-modern .im-online-panel.is-collapsed .im-online-title {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--im-blue), var(--im-violet));
    cursor: pointer;
}

body.pw-modern .im-online-panel.is-collapsed .im-online-dot {
    width: 11px;
    height: 11px;
    border-color: #fff;
}

body.pw-modern .im-online-list {
    display: grid;
    max-height: 420px;
    padding: 7px;
    overflow-y: auto;
}

body.pw-modern .im-online-panel.is-collapsed .im-online-list {
    display: none;
}

body.pw-modern .im-contact {
    display: flex;
    width: 100%;
    min-height: 49px;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border: 0;
    border-radius: 13px;
    color: var(--pw-text);
    text-align: left;
    background: transparent;
    cursor: pointer;
}

body.pw-modern .im-contact:hover {
    background: rgba(52,120,246,.08);
}

body.pw-modern .im-avatar {
    position: relative;
    display: grid;
    width: 36px;
    min-width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    background: linear-gradient(145deg, var(--im-blue), var(--im-violet));
}

body.pw-modern .im-avatar .im-contact-status {
    position: absolute;
    right: -3px;
    bottom: -3px;
}

body.pw-modern .im-contact-copy {
    min-width: 0;
    flex: 1 1 auto;
}

body.pw-modern .im-contact-copy strong {
    display: block;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.pw-modern .im-contact-copy span {
    display: block;
    margin-top: 3px;
    color: var(--pw-muted);
    font-size: 9px;
}

body.pw-modern .im-contact-unread {
    display: grid;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    font-size: 9px;
    font-weight: 850;
    background: var(--im-red);
}

body.pw-modern .im-empty {
    padding: 25px 14px;
    color: var(--pw-muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

body.pw-modern .im-drawer-overlay {
    position: fixed;
    z-index: 1190;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    background: rgba(8,13,24,.32);
    backdrop-filter: blur(8px);
    transition: opacity .18s ease, visibility .18s ease;
}

body.pw-modern .im-drawer-overlay.is-open {
    visibility: visible;
    opacity: 1;
}

body.pw-modern .im-drawer {
    position: fixed;
    z-index: 1200;
    right: 16px;
    top: 88px;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100vh - 108px);
    overflow: hidden;
    border: 1px solid var(--pw-border);
    border-radius: 23px;
    opacity: 0;
    transform: translateX(22px) scale(.985);
    background: var(--pw-surface-strong);
    box-shadow: 0 30px 90px rgba(15,25,48,.30);
    backdrop-filter: blur(28px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

body.pw-modern .im-drawer.is-open {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

body.pw-modern .im-drawer-header {
    display: flex;
    min-height: 67px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px 12px 17px;
    border-bottom: 1px solid var(--pw-border);
}

body.pw-modern .im-drawer-header h2 {
    margin: 0 !important;
    font-size: 19px !important;
}

body.pw-modern .im-drawer-close {
    display: grid !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 11px !important;
    color: var(--pw-muted) !important;
    background: var(--pw-surface-soft) !important;
    box-shadow: none !important;
}

body.pw-modern .im-notification-prompt {
    display: none;
    margin: 11px;
    padding: 12px;
    border: 1px solid rgba(52,120,246,.16);
    border-radius: 14px;
    background: rgba(52,120,246,.06);
}

body.pw-modern .im-notification-prompt.is-visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.pw-modern .im-notification-prompt > div {
    min-width: 0;
    flex: 1;
}

body.pw-modern .im-notification-prompt strong {
    display: block;
    font-size: 11px;
}

body.pw-modern .im-notification-prompt span {
    display: block;
    margin-top: 3px;
    color: var(--pw-muted);
    font-size: 9px;
    line-height: 1.4;
}

body.pw-modern .im-notification-enable {
    min-height: 34px !important;
    padding: 7px 10px !important;
    font-size: 9px !important;
}

body.pw-modern .im-drawer-search {
    padding: 0 11px 10px;
}

body.pw-modern .im-drawer-list {
    display: grid;
    max-height: calc(100vh - 265px);
    padding: 0 7px 9px;
    overflow-y: auto;
}

body.pw-modern .im-conversation {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 62px;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 0;
    border-radius: 14px;
    color: var(--pw-text);
    text-align: left;
    background: transparent;
    cursor: pointer;
}

body.pw-modern .im-conversation:hover {
    background: rgba(52,120,246,.08);
}

body.pw-modern .im-conversation-copy {
    min-width: 0;
}

body.pw-modern .im-conversation-copy strong,
body.pw-modern .im-conversation-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.pw-modern .im-conversation-copy strong {
    font-size: 11px;
}

body.pw-modern .im-conversation-copy span {
    margin-top: 4px;
    color: var(--pw-muted);
    font-size: 9px;
}

body.pw-modern .im-conversation-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
    color: var(--pw-muted);
    font-size: 8px;
}

body.pw-modern .im-chat-stack {
    position: fixed;
    z-index: 1150;
    right: 310px;
    bottom: 16px;
    display: flex;
    max-width: calc(100vw - 340px);
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: none;
}

body.pw-modern .im-chat-window {
    display: flex;
    width: 340px;
    height: min(510px, calc(100vh - 115px));
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--pw-border);
    border-radius: 21px;
    background: var(--pw-surface-strong);
    box-shadow: 0 28px 78px rgba(15,25,48,.29);
    backdrop-filter: blur(28px);
    pointer-events: auto;
}

body.pw-modern .im-chat-header {
    display: flex;
    min-height: 60px;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--pw-border);
}

body.pw-modern .im-chat-user {
    min-width: 0;
    flex: 1;
}

body.pw-modern .im-chat-user strong,
body.pw-modern .im-chat-user span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.pw-modern .im-chat-user strong {
    font-size: 11px;
}

body.pw-modern .im-chat-user span {
    margin-top: 3px;
    color: var(--pw-muted);
    font-size: 9px;
}

body.pw-modern .im-chat-close {
    display: grid !important;
    width: 33px !important;
    min-width: 33px !important;
    height: 33px !important;
    min-height: 33px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 10px !important;
    color: var(--pw-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.pw-modern .im-chat-messages {
    display: flex;
    min-height: 0;
    padding: 13px;
    overflow-y: auto;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 7px;
    background:
        radial-gradient(circle at 0 0, rgba(52,120,246,.05), transparent 32%),
        transparent;
}

body.pw-modern .im-message {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

body.pw-modern .im-message.is-mine {
    justify-content: flex-end;
}

body.pw-modern .im-message-bubble {
    max-width: 78%;
    padding: 8px 10px;
    border-radius: 15px 15px 15px 5px;
    color: var(--pw-text);
    font-size: 11px;
    line-height: 1.48;
    background: var(--pw-surface-soft);
}

body.pw-modern .im-message.is-mine .im-message-bubble {
    color: #fff;
    border-radius: 15px 15px 5px 15px;
    background: linear-gradient(135deg, var(--im-blue), var(--im-violet));
}

body.pw-modern .im-message-time {
    display: block;
    margin-top: 4px;
    opacity: .66;
    font-size: 7px;
}

body.pw-modern .im-message-attachment {
    display: block;
    margin-top: 7px;
    color: inherit;
    font-weight: 750;
    text-decoration: none;
}

body.pw-modern .im-message-image {
    display: block;
    max-width: 210px;
    max-height: 190px;
    margin-top: 7px;
    border-radius: 11px;
    object-fit: contain;
    background: rgba(255,255,255,.10);
}

body.pw-modern .im-chat-file-preview {
    display: none;
    margin: 0 9px 7px;
    padding: 8px 10px;
    border: 1px solid var(--pw-border);
    border-radius: 11px;
    color: var(--pw-muted);
    font-size: 9px;
    background: var(--pw-surface-soft);
}

body.pw-modern .im-chat-file-preview.is-visible {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

body.pw-modern .im-chat-form {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 38px;
    gap: 7px;
    padding: 9px;
    border-top: 1px solid var(--pw-border);
}

body.pw-modern .im-chat-attach,
body.pw-modern .im-chat-send {
    display: grid !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    place-items: center !important;
    border-radius: 11px !important;
}

body.pw-modern .im-chat-attach {
    color: var(--pw-muted) !important;
    border: 1px solid var(--pw-border) !important;
    background: var(--pw-surface-soft) !important;
    box-shadow: none !important;
    cursor: pointer;
}

body.pw-modern .im-chat-attach input {
    display: none !important;
}

body.pw-modern .im-chat-send {
    color: #fff !important;
    border: 0 !important;
    background: linear-gradient(135deg, var(--im-blue), var(--im-violet)) !important;
}

body.pw-modern .im-chat-input {
    min-height: 36px !important;
    max-height: 90px;
    padding: 8px 10px !important;
    resize: none;
    border-radius: 11px !important;
    font-size: 11px !important;
}

body.pw-modern .im-toast-stack {
    position: fixed;
    z-index: 2000;
    right: 16px;
    top: 90px;
    display: grid;
    width: min(360px, calc(100vw - 32px));
    gap: 8px;
}

body.pw-modern .im-toast {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
    border: 1px solid var(--pw-border);
    border-radius: 15px;
    background: var(--pw-surface-strong);
    box-shadow: var(--pw-shadow);
    animation: imToastIn .22s ease both;
}

body.pw-modern .im-toast strong {
    display: block;
    font-size: 11px;
}

body.pw-modern .im-toast span {
    display: block;
    margin-top: 3px;
    color: var(--pw-muted);
    font-size: 9px;
    line-height: 1.42;
}

@keyframes imToastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 920px) {
    body.pw-modern .im-online-panel {
        width: 58px;
        height: 58px;
        border-radius: 18px;
    }

    body.pw-modern .im-online-panel .im-online-header {
        width: 58px;
        height: 58px;
        padding: 7px;
        border: 0;
    }

    body.pw-modern .im-online-panel .im-online-title > div,
    body.pw-modern .im-online-panel .im-online-toggle,
    body.pw-modern .im-online-panel .im-online-list {
        display: none !important;
    }

    body.pw-modern .im-online-panel .im-online-title {
        display: grid;
        width: 44px;
        height: 44px;
        place-items: center;
        border-radius: 14px;
        background: linear-gradient(145deg, var(--im-blue), var(--im-violet));
    }

    body.pw-modern .im-chat-stack {
        right: 16px;
        max-width: calc(100vw - 32px);
    }
}

@media (max-width: 620px) {
    body.pw-modern .im-drawer {
        right: 8px;
        top: 74px;
        width: calc(100vw - 16px);
        max-height: calc(100vh - 84px);
    }

    body.pw-modern .im-chat-stack {
        inset: 0;
        display: block;
        max-width: none;
        pointer-events: none;
    }

    body.pw-modern .im-chat-window {
        position: fixed;
        inset: 8px;
        width: auto;
        height: auto;
        border-radius: 20px;
    }

    body.pw-modern .im-online-panel {
        right: 10px;
        bottom: 76px;
    }

    body.pw-modern .im-message-bubble {
        max-width: 86%;
    }
}


/* =========================================================
   Intranet Messenger 2.1
   ========================================================= */

body.pw-modern .im-drawer-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 10px 11px 9px;
    padding: 4px;
    border: 1px solid var(--pw-border);
    border-radius: 13px;
    background: var(--pw-surface-soft);
}

body.pw-modern .im-drawer-tab {
    display: flex !important;
    min-height: 36px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    padding: 7px 9px !important;
    border: 0 !important;
    border-radius: 10px !important;
    color: var(--pw-muted) !important;
    font-size: 10px !important;
    font-weight: 760 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.pw-modern .im-drawer-tab.is-active {
    color: var(--pw-blue) !important;
    background: var(--pw-surface-strong) !important;
    box-shadow: 0 5px 14px rgba(38,54,88,.08) !important;
}

body.pw-modern .im-tab-count {
    display: grid;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    place-items: center;
    border-radius: 999px;
    color: inherit;
    font-size: 8px;
    font-weight: 850;
    background: rgba(52,120,246,.09);
}

body.pw-modern .im-list-section-heading {
    padding: 10px 10px 7px;
}

body.pw-modern .im-list-section-heading strong,
body.pw-modern .im-list-section-heading span {
    display: block;
}

body.pw-modern .im-list-section-heading strong {
    color: var(--pw-text);
    font-size: 11px;
}

body.pw-modern .im-list-section-heading span {
    margin-top: 3px;
    color: var(--pw-muted);
    font-size: 8px;
}

body.pw-modern .im-person-action {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 9px;
    color: var(--pw-blue);
    background: rgba(52,120,246,.07);
}

body.pw-modern .im-person-action svg {
    width: 14px;
    height: 14px;
}

body.pw-modern .im-empty-conversations {
    display: grid;
    gap: 7px;
}

body.pw-modern .im-empty-conversations strong {
    color: var(--pw-text);
    font-size: 11px;
}

body.pw-modern .im-empty-conversations span {
    color: var(--pw-muted);
    font-size: 9px;
}

body.pw-modern .im-empty-open-people {
    min-height: 34px !important;
    margin: 5px auto 0 !important;
    padding: 7px 11px !important;
    color: var(--pw-blue) !important;
    border: 1px solid rgba(52,120,246,.15) !important;
    background: rgba(52,120,246,.07) !important;
    box-shadow: none !important;
}

/* Subtelniejsze przyciski załącznika i wysyłania */
body.pw-modern .im-chat-form {
    grid-template-columns: 32px minmax(0, 1fr) 32px !important;
    gap: 5px !important;
    padding: 8px 9px !important;
}

body.pw-modern .im-chat-attach,
body.pw-modern .im-chat-send {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    border-radius: 10px !important;
}

body.pw-modern .im-chat-attach {
    color: var(--pw-muted) !important;
    border: 0 !important;
    background: transparent !important;
}

body.pw-modern .im-chat-attach:hover {
    color: var(--pw-blue) !important;
    background: rgba(52,120,246,.07) !important;
}

body.pw-modern .im-chat-send {
    color: var(--pw-blue) !important;
    border: 0 !important;
    background: rgba(52,120,246,.09) !important;
    box-shadow: none !important;
}

body.pw-modern .im-chat-send:hover {
    color: #fff !important;
    background: linear-gradient(135deg, var(--im-blue), var(--im-violet)) !important;
}

body.pw-modern .im-chat-attach svg,
body.pw-modern .im-chat-send svg {
    width: 15px !important;
    height: 15px !important;
}

body.pw-modern .im-chat-input {
    min-height: 32px !important;
    padding: 7px 9px !important;
}


/* Intranet Messenger 2.2 — subtelniejsze akcje wiadomości */
body.pw-modern .im-chat-form {
    grid-template-columns: 29px minmax(0, 1fr) 29px !important;
    gap: 4px !important;
}

body.pw-modern .im-chat-attach,
body.pw-modern .im-chat-send {
    width: 29px !important;
    min-width: 29px !important;
    height: 29px !important;
    min-height: 29px !important;
    opacity: .68;
    border-radius: 9px !important;
    color: var(--pw-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.pw-modern .im-chat-attach:hover,
body.pw-modern .im-chat-send:hover {
    opacity: 1;
    color: var(--pw-blue) !important;
    background: rgba(52,120,246,.07) !important;
}

body.pw-modern .im-chat-attach svg,
body.pw-modern .im-chat-send svg {
    width: 13px !important;
    height: 13px !important;
    stroke-width: 1.8;
}

body.pw-modern .im-chat-input {
    min-height: 30px !important;
    padding: 6px 9px !important;
}


/* e-Wiśniewo 3.0 — status dostarczenia i odczytu */
body.pw-modern .im-message-time {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

body.pw-modern .im-message:not(.is-mine) .im-message-time {
    justify-content: flex-start;
}

body.pw-modern .im-message-status {
    font-size: 7px;
    font-weight: 700;
    opacity: .72;
}

body.pw-modern .im-message-status[data-read="1"] {
    opacity: .95;
}
