.softchat {
    --softchat-accent: #0d6efd;
    --softchat-accent-dark: #0a58ca;
    --softchat-success: #198754;
    --softchat-border: rgba(15, 23, 42, 0.12);
    --softchat-muted: #64748b;
    --softchat-text: #0f172a;
    --softchat-bg: #ffffff;
    --softchat-panel: rgba(255, 255, 255, 0.96);
    color: var(--softchat-text);
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.softchat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1045;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--softchat-accent), var(--softchat-success));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 34px rgba(13, 110, 253, 0.28);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.softchat-fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 18px 40px rgba(13, 110, 253, 0.34);
}

.softchat-fab__pulse {
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(13, 110, 253, 0.45);
    border-radius: inherit;
    opacity: 0;
    animation: softchatPulse 2.2s infinite;
    pointer-events: none;
}

.softchat-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.softchat-icon__dots {
    fill: currentColor;
    stroke: none;
}

.softchat-icon--close,
.softchat--open .softchat-icon--open {
    display: none;
}

.softchat--open .softchat-icon--close {
    display: inline-block;
}

@keyframes softchatPulse {
    0% {
        transform: scale(0.94);
        opacity: 0.85;
    }
    100% {
        transform: scale(1.32);
        opacity: 0;
    }
}

.softchat-drawer {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 1044;
    width: min(440px, calc(100vw - 32px));
    height: min(650px, calc(100vh - 122px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--softchat-border);
    border-radius: 14px;
    background: var(--softchat-panel);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transform-origin: right bottom;
}

.softchat--open .softchat-drawer {
    display: flex;
    animation: softchatDrawerEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes softchatDrawerEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(18px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.softchat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--softchat-border);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1), rgba(25, 135, 84, 0.07));
}

.softchat-header__left,
.softchat-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.softchat-header__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--softchat-accent);
    border: 1px solid rgba(13, 110, 253, 0.18);
    flex: 0 0 auto;
}

.softchat-header__title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.softchat-header__name {
    font-size: 0.9rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--softchat-text);
}

.softchat-header__status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    color: var(--softchat-success);
    font-weight: 700;
}

.softchat-header__status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--softchat-success);
    animation: softchatDot 1.5s infinite;
}

@keyframes softchatDot {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

.softchat-header__icon-btn {
    width: 31px;
    height: 31px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--softchat-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.softchat-header__icon-btn:hover {
    background: #ffffff;
    color: var(--softchat-accent);
}

.softchat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.softchat-bubble {
    max-width: 88%;
    padding: 11px 13px;
    font-size: 0.82rem;
    line-height: 1.55;
    word-break: break-word;
}

.softchat-bubble p {
    margin: 7px 0;
}

.softchat-bubble--bot {
    align-self: flex-start;
    max-width: 100%;
    background: #f8fafc;
    border: 1px solid var(--softchat-border);
    border-radius: 5px 16px 16px 16px;
    color: var(--softchat-text);
}

.softchat-bubble--bot strong {
    color: var(--softchat-accent-dark);
}

.softchat-bubble h1,
.softchat-bubble h2,
.softchat-bubble h3,
.softchat-bubble h4 {
    margin: 10px 0 7px;
    color: var(--softchat-text);
    font-weight: 800;
    line-height: 1.25;
}

.softchat-bubble h1 { font-size: 1.08rem; }
.softchat-bubble h2 { font-size: 1rem; }
.softchat-bubble h3 { font-size: 0.94rem; }
.softchat-bubble h4 { font-size: 0.88rem; }

.softchat-bubble ul,
.softchat-bubble ol {
    margin: 7px 0;
    padding-left: 19px;
}

.softchat-bubble li {
    margin: 4px 0;
}

.softchat-bubble blockquote {
    margin: 9px 0;
    padding: 8px 10px;
    border-left: 3px solid var(--softchat-accent);
    background: rgba(13, 110, 253, 0.06);
    border-radius: 0 8px 8px 0;
    color: #334155;
}

.softchat-bubble a {
    color: var(--softchat-accent-dark);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(13, 110, 253, 0.32);
}

.softchat-bubble a:hover {
    color: var(--softchat-success);
    border-bottom-color: currentColor;
}

.softchat-bubble--user {
    align-self: flex-end;
    background: var(--softchat-accent);
    color: #ffffff;
    border-radius: 16px 5px 16px 16px;
    box-shadow: 0 8px 18px rgba(13, 110, 253, 0.14);
}

.softchat-bubble code.inline-code {
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--softchat-accent-dark);
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 0.86em;
}

.softchat-bubble pre {
    margin: 10px 0;
    padding: 11px;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--softchat-border);
    background: #0f172a;
    color: #e2e8f0;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 0.76rem;
    line-height: 1.55;
}

.softchat-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--softchat-border);
    border-radius: 8px;
    background: #ffffff;
}

.softchat-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 280px;
    font-size: 0.74rem;
}

.softchat-table-wrap th,
.softchat-table-wrap td {
    padding: 8px 9px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
    vertical-align: top;
}

.softchat-table-wrap th {
    background: rgba(13, 110, 253, 0.07);
    color: var(--softchat-text);
    font-weight: 800;
}

.softchat-table-wrap tr:last-child td {
    border-bottom: 0;
}

.softchat-spacer {
    height: 5px;
}

.softchat-chart {
    margin: 9px 0;
    padding: 11px;
    border: 1px solid var(--softchat-border);
    border-radius: 8px;
    background: #ffffff;
}

.softchat-chart > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--softchat-text);
}

.softchat-chart__row {
    display: grid;
    grid-template-columns: 76px 1fr 44px;
    gap: 7px;
    align-items: center;
    margin: 6px 0;
    font-size: 0.68rem;
    color: var(--softchat-muted);
}

.softchat-chart__row div {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(13, 110, 253, 0.09);
}

.softchat-chart__row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--softchat-accent), var(--softchat-success));
}

.softchat-chart__row b {
    text-align: right;
    color: var(--softchat-text);
}

.softchat-line-chart {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 8px;
}

.softchat-line-chart__grid {
    stroke: rgba(15, 23, 42, 0.12);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.softchat-line-chart text {
    fill: var(--softchat-muted);
    font-size: 9px;
    font-weight: 700;
}

.softchat-chart__links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.softchat-chart__links span a {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.06);
    font-size: 0.7rem;
    line-height: 1;
}

.softchat-suggestions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 11px;
}

.softchat-suggest-pill {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--softchat-border);
    background: #ffffff;
    color: var(--softchat-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.softchat-suggest-pill:hover {
    border-color: rgba(13, 110, 253, 0.32);
    color: var(--softchat-accent-dark);
    background: rgba(13, 110, 253, 0.06);
}

.softchat-footer {
    border-top: 1px solid var(--softchat-border);
    background: #ffffff;
    padding: 7px 10px;
}

.softchat-form {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
}

.softchat-input {
    flex: 1;
    min-width: 0;
    height: 31px;
    padding: 0 10px;
    border: 1px solid var(--softchat-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--softchat-text);
    font-size: 0.76rem;
    font-weight: 500;
    outline: none;
}

.softchat-input:focus {
    border-color: rgba(13, 110, 253, 0.55);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.softchat-send-btn {
    width: 31px;
    height: 31px;
    border: 0;
    border-radius: 8px;
    background: var(--softchat-accent);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.softchat-send-btn:hover {
    background: var(--softchat-accent-dark);
}

.softchat-send-btn:disabled,
.softchat-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.softchat-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 4px;
}

.softchat-typing__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--softchat-muted);
    animation: softchatBounce 1.4s infinite ease-in-out both;
}

.softchat-typing__dot:nth-child(1) { animation-delay: -0.32s; }
.softchat-typing__dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes softchatBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@media (max-width: 480px) {
    .softchat-fab {
        right: 16px;
        bottom: 16px;
    }

    .softchat-drawer {
        right: 12px;
        left: 12px;
        bottom: 84px;
        width: auto;
        height: min(640px, calc(100vh - 104px));
    }
}
