#stw-support-root {
    --stw-accent: #4A90E2;
    --stw-accent-dark: #357abd;
    --stw-bg: #ffffff;
    --stw-text: #1a202c;
    --stw-muted: #718096;
    --stw-border: #e2e8f0;
    --stw-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 99990;
}

#stw-support-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--stw-accent);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--stw-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    z-index: 99991;
}

#stw-support-launcher:hover {
    transform: scale(1.05);
    background: var(--stw-accent-dark);
}

#stw-support-launcher svg {
    width: 26px;
    height: 26px;
}

#stw-support-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

#stw-support-badge.visible {
    display: flex;
}

#stw-support-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: var(--stw-bg);
    border-radius: 16px;
    box-shadow: var(--stw-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99992;
    border: 1px solid var(--stw-border);
}

#stw-support-panel.open {
    display: flex;
}

.stw-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #4A90E2, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.stw-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.stw-header-actions button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 4px;
    font-size: 16px;
}

.stw-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f7fafc;
}

.stw-view { display: none; flex-direction: column; height: 100%; }
.stw-view.active { display: flex; }

.stw-ticket-item {
    background: #fff;
    border: 1px solid var(--stw-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.stw-ticket-item:hover { border-color: var(--stw-accent); }
.stw-ticket-item.unread { border-left: 3px solid var(--stw-accent); }

.stw-ticket-item .stw-subject {
    font-weight: 600;
    font-size: 14px;
    color: var(--stw-text);
    margin-bottom: 4px;
}

.stw-ticket-item .stw-meta {
    font-size: 12px;
    color: var(--stw-muted);
    display: flex;
    justify-content: space-between;
}

.stw-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.stw-status-open { background: #bee3f8; color: #2b6cb0; }
.stw-status-pending { background: #feebc8; color: #c05621; }
.stw-status-answered { background: #c6f6d5; color: #276749; }
.stw-status-closed { background: #e2e8f0; color: #4a5568; }

.stw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.stw-msg {
    max-width: 85%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.stw-msg.client {
    margin-left: auto;
    background: var(--stw-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.stw-msg.admin {
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--stw-border);
    border-bottom-left-radius: 4px;
}

.stw-msg.system {
    margin: 8px auto;
    background: #edf2f7;
    color: var(--stw-muted);
    font-size: 12px;
    text-align: center;
    max-width: 95%;
}

.stw-msg-time {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 4px;
}

.stw-compose {
    padding: 10px 12px;
    border-top: 1px solid var(--stw-border);
    background: #fff;
    flex-shrink: 0;
}

.stw-compose textarea,
.stw-form input,
.stw-form select,
.stw-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--stw-border);
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.stw-file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stw-attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.stw-attach-hint {
    font-size: 11px;
    color: var(--stw-muted);
    line-height: 1.3;
}

.stw-btn-attach {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--stw-border);
    border-radius: 8px;
    background: #f7fafc;
    color: var(--stw-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.stw-btn-attach:hover {
    background: #edf2f7;
    border-color: var(--stw-accent);
    color: var(--stw-accent);
}

.stw-btn-attach svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.stw-compose-bar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.stw-compose-bar .stw-btn-attach {
    padding: 10px;
    margin-bottom: 2px;
}

.stw-compose-bar .stw-btn-attach span {
    display: none;
}

.stw-compose-bar textarea {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 100px;
    margin: 0;
    resize: none;
}

.stw-btn-send {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    margin-bottom: 2px;
}

.stw-btn-send svg {
    width: 18px;
    height: 18px;
}

.stw-files-list {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stw-files-list:empty {
    display: none;
}

.stw-file-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 8px;
    background: #edf2f7;
    border-radius: 6px;
    color: var(--stw-text);
}

.stw-file-chip-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stw-file-chip-remove {
    border: none;
    background: transparent;
    color: var(--stw-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.stw-file-chip-remove:hover {
    color: #e53e3e;
}

.stw-compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.stw-btn {
    background: var(--stw-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.stw-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.stw-btn-ghost {
    background: transparent;
    color: var(--stw-muted);
    border: 1px solid var(--stw-border);
}

.stw-empty {
    text-align: center;
    color: var(--stw-muted);
    padding: 32px 16px;
    font-size: 14px;
}

.stw-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 8px 0 4px;
    color: var(--stw-muted);
}

.stw-error {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 6px;
}

@media (max-width: 480px) {
    #stw-support-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    #stw-support-launcher {
        bottom: 16px;
        right: 16px;
    }
}
