.spna-conversation,
.spna-conversation * {
    font-family: inherit;
}

.spna-sidebar a {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spna-sidebar-badge {
    margin-inline-start: auto;
    min-width: 22px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    padding: 2px 7px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

.spna-conversation {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(340px, 58vh) auto auto;
    max-width: 820px;
    border: 1px solid #dfe4ee;
    border-radius: 18px;
    background: #f8fafc;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
    overflow: hidden;
    overflow-anchor: none;
}

.spna-conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    padding: 14px 16px;
}

.spna-conversation-header strong {
    display: block;
    font-size: 17px;
}

.spna-conversation-header span {
    color: #64748b;
    font-size: 13px;
}

.spna-conversation-sound,
.spna-conversation-compose button {
    border: 0;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.spna-conversation-sound {
    width: 38px;
    height: 38px;
}

.spna-conversation-sound[aria-pressed="false"] {
    background: #94a3b8;
}

.spna-conversation-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 18px;
    overscroll-behavior: contain;
    overflow-anchor: none;
    scrollbar-gutter: stable;
}

.spna-chat-message {
    align-self: flex-start;
    max-width: min(72%, 560px);
    border-radius: 18px 18px 18px 6px;
    background: #fff;
    color: #172033;
    padding: 10px 12px 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
    overflow-wrap: anywhere;
}

.spna-chat-message.is-mine {
    align-self: flex-end;
    border-radius: 18px 18px 6px 18px;
    background: #dff7ef;
}

.spna-chat-message.is-theirs {
    align-self: flex-start;
}

.spna-chat-message.is-error {
    outline: 1px solid #ef4444;
}

.spna-chat-message p {
    margin: 0;
    white-space: pre-wrap;
}

.spna-chat-message footer {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 5px;
    color: #64748b;
    font-size: 11px;
}

.spna-chat-attachment {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
    color: #0f766e;
    text-decoration: none;
}

.spna-chat-attachment img {
    width: 120px;
    height: 90px;
    border-radius: 12px;
    object-fit: cover;
}

.spna-conversation-typing {
    padding: 0 18px 8px;
    color: #64748b;
    font-size: 13px;
}

.spna-conversation-compose {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 42px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding: 12px;
}

.spna-conversation-compose textarea {
    min-height: 42px;
    max-height: 130px;
    border: 1px solid #dfe4ee;
    border-radius: 16px;
    padding: 10px 12px;
    resize: none;
    font: inherit;
}

.spna-conversation-compose button {
    min-height: 42px;
}

.spna-upload-preview {
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding: 10px 12px;
}

.spna-upload-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
}

.spna-upload-item img,
.spna-upload-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eef2f7;
    display: grid;
    place-items: center;
    object-fit: cover;
    font-weight: 700;
}

.spna-upload-progress {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-top: 6px;
}

.spna-upload-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: #0f766e;
}

.spna-upload-remove {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
}

.spna-conversation-drop {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    place-items: center;
    pointer-events: none;
    background: rgba(15, 118, 110, .12);
    color: #0f766e;
    font-weight: 800;
    backdrop-filter: blur(2px);
}

.spna-conversation.is-dragging .spna-conversation-drop {
    display: grid;
}

.spna-admin-conversation-search {
    margin: 14px 0;
}

.spna-admin-conversation-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
}

.spna-admin-conversation-list {
    display: grid;
    align-content: start;
    gap: 8px;
}

.spna-admin-conversation-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    border: 1px solid #dfe4ee;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    text-decoration: none;
}

.spna-admin-conversation-list a.is-active {
    border-color: #0f766e;
}

.spna-admin-conversation-list span {
    grid-column: 1 / -1;
    color: #64748b;
}

.spna-admin-conversation-list b {
    min-width: 22px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    text-align: center;
}

.spna-chat-widget,
.spna-chat-widget * {
    box-sizing: border-box;
}

.spna-chat-widget {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 99998;
    font-family: inherit;
}

.spna-chat-widget.is-rtl {
    direction: rtl;
}

.spna-chat-widget-toggle {
    --spna-chat-widget-ring: #1474f2;
    --spna-chat-widget-bg: #1473e6;
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 10px;
    padding: 0;
    background: var(--spna-chat-widget-bg, #1473e6);
    color: var(--spna-chat-widget-icon, #e8b14e);
    box-shadow: 0 10px 24px rgba(13, 24, 43, 0.22);
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease;
    overflow: hidden;
}

.spna-chat-widget-toggle:hover {
    box-shadow: 0 14px 28px rgba(13, 24, 43, 0.28);
    transform: translateY(-2px) scale(1.02);
}

.spna-chat-widget-toggle:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 3px;
}

.spna-chat-widget-ring {
    position: absolute;
    inset: 0;
    width: 56px;
    height: 56px;
    display: block;
    overflow: visible;
    transform: rotate(-90deg);
}

.spna-chat-widget-ring-track,
.spna-chat-widget-ring-indicator {
    fill: none;
    stroke-width: 4;
}

.spna-chat-widget-ring-track {
    stroke: rgba(13, 24, 43, 0.14);
}

.spna-chat-widget-ring-indicator {
    stroke: var(--spna-chat-widget-ring);
    stroke-linecap: round;
    stroke-dasharray: 151;
    stroke-dashoffset: 0;
}

.spna-chat-widget-icon-wrap {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: currentColor;
    line-height: 1;
}

.spna-chat-widget-icon {
    width: 24px;
    height: 24px;
    display: block;
    color: var(--spna-chat-widget-icon, #e8b14e);
}

.spna-chat-widget-icon,
.spna-chat-widget-icon [fill]:not([fill="none"]) {
    fill: currentColor !important;
}

.spna-chat-widget-icon,
.spna-chat-widget-icon [stroke]:not([stroke="none"]) {
    stroke: currentColor !important;
}

.spna-chat-widget-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

.spna-chat-widget-panel {
    position: absolute;
    left: 0;
    bottom: 76px;
    width: min(390px, calc(100vw - 28px));
    max-height: calc(100vh - 116px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dbe4ef;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(15, 23, 42, .20);
}

.spna-chat-widget-panel[hidden],
.spna-chat-widget-auth[hidden],
.spna-chat-widget-conversation[hidden] {
    display: none;
}

.spna-chat-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid #e5edf7;
    background: #fff;
}

.spna-chat-widget-header strong {
    font-size: 15px;
}

.spna-chat-widget-header button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    cursor: pointer;
    font: inherit;
    font-size: 22px;
    line-height: 1;
}

.spna-chat-widget-auth {
    flex: 0 1 auto;
    overflow-y: auto;
    padding: 16px;
}

.spna-chat-widget-auth p {
    margin: 0 0 14px;
    color: #475569;
    font-size: 14px;
    line-height: 1.8;
}

.spna-chat-widget-auth form {
    display: grid;
    gap: 12px;
}

.spna-chat-widget-auth-step {
    display: grid;
    gap: 12px;
}

.spna-chat-widget-auth-step[hidden] {
    display: none;
}

.spna-chat-widget-auth label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-size: 13px;
}

.spna-chat-widget-auth input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    padding: 9px 12px;
    font: inherit;
}

.spna-chat-widget-auth button[type="submit"] {
    min-height: 43px;
    border: 0;
    border-radius: 999px;
    background: #1473e6;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.spna-chat-widget-back {
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    cursor: pointer;
    font: inherit;
}

.spna-chat-widget-auth button[type="submit"]:disabled {
    cursor: wait;
    opacity: .65;
}

.spna-chat-widget-alert {
    border-radius: 12px;
    padding: 9px 11px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 13px;
}

.spna-chat-widget-alert.is-success {
    background: #dcfce7;
    color: #166534;
}

.spna-chat-widget-conversation {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    grid-template-rows: minmax(220px, 44vh) auto auto;
}

.spna-chat-widget-conversation .spna-conversation-messages {
    min-height: 0;
    padding: 14px;
}

.spna-chat-widget-conversation .spna-conversation-compose {
    grid-template-columns: 60px minmax(0, 1fr) 40px;
    padding: 10px;
}

@media (max-width: 820px) {
    .spna-conversation {
        grid-template-rows: auto minmax(52vh, 1fr) auto auto;
        max-width: 100%;
        border-radius: 12px;
    }

    .spna-chat-message {
        max-width: 88%;
    }

    .spna-admin-conversation-layout {
        grid-template-columns: 1fr;
    }

    .spna-chat-widget-conversation {
        grid-template-rows: minmax(220px, 44vh) auto auto;
        border-radius: 0;
    }
}

@media (max-width: 520px) {
    .spna-chat-widget {
        left: 16px;
        bottom: 16px;
    }

    .spna-chat-widget-toggle {
        width: 52px;
        height: 52px;
    }

    .spna-chat-widget-ring {
        width: 52px;
        height: 52px;
    }

    .spna-chat-widget-panel {
        left: 0;
        bottom: 68px;
        width: calc(100vw - 32px);
        max-height: calc(100vh - 96px);
        border-radius: 16px;
    }

    .spna-chat-widget-conversation {
        grid-template-rows: minmax(210px, 48vh) auto auto;
    }
}
