.rychat-root {
    position: fixed;
    bottom: 20px;
    z-index: 1040;
    font-family: inherit;
}

.rychat-root--right { right: 20px; }
.rychat-root--left { left: 20px; }

.rychat-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--rychat-color, #d98a96);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}

.rychat-toggle:hover { transform: scale(1.06); }
.rychat-toggle svg { width: 28px; height: 28px; }

.rychat-panel {
    position: absolute;
    bottom: 72px;
    width: 340px;
    max-height: min(560px, calc(100vh - 120px));
    background: #f4f2f3;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    overflow: hidden;
    display: none;
}

.rychat-root--right .rychat-panel { right: 0; }
.rychat-root--left .rychat-panel { left: 0; }

.rychat-panel--open { display: block; }

.rychat-view {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    min-height: 320px;
}

/* ---- home ---- */

.rychat-hero {
    background: var(--rychat-color, #d98a96);
    color: #fff;
    padding: 20px 20px 24px;
}

.rychat-hero-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.rychat-hero-text {
    font-size: .88rem;
    margin: 0 0 14px;
    opacity: .92;
    line-height: 1.4;
}

.rychat-hero-icons {
    display: flex;
    gap: 10px;
}

.rychat-hero-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
}

.rychat-hero-icon svg { width: 16px; height: 16px; }

.rychat-cards {
    padding: 0 14px 14px;
    margin-top: -12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rychat-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
    padding: 14px;
}

.rychat-card-title {
    font-weight: 600;
    font-size: .95rem;
    margin: 0 0 4px;
    color: #222;
}

.rychat-card-text {
    font-size: .8rem;
    color: #777;
    margin: 0 0 10px;
}

.rychat-cardbtn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid #e4dde0;
    background: #fff;
    border-radius: 9px;
    padding: 9px 12px;
    margin-top: 8px;
    font-size: .88rem;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s ease;
}

.rychat-cardbtn:hover { background: #faf6f7; color: #333; }

.rychat-cardbtn-icon,
.rychat-channel-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.rychat-cardbtn-icon svg { width: 15px; height: 15px; }

.rychat-cardbtn-icon--brand { background: var(--rychat-color, #d98a96); }
.rychat-cardbtn-icon--plain { background: #6c757d; }

.rychat-icon--whatsapp { background: #25d366; }
.rychat-icon--email { background: #6c757d; }
.rychat-icon--instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.rychat-icon--facebook { background: #0084ff; }

/* ---- sub views ---- */

.rychat-subheader {
    background: var(--rychat-color, #d98a96);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px;
}

.rychat-back {
    background: none;
    border: 0;
    color: #fff;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.rychat-back svg { width: 20px; height: 20px; }

.rychat-subheader-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

/* ---- chat ---- */

.rychat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #faf7f8;
    min-height: 220px;
}

.rychat-msg {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: .88rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.rychat-msg--visitor {
    align-self: flex-end;
    background: var(--rychat-color, #d98a96);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.rychat-msg--agent {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.rychat-msg-sender {
    font-size: .72rem;
    opacity: .65;
    margin-bottom: 2px;
}

.rychat-inputrow {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #f0e8ea;
    background: #fff;
}

.rychat-inputrow input[type="text"],
.rychat-inputrow input[type="email"],
.rychat-orderform input[type="text"],
.rychat-orderform input[type="email"] {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: .88rem;
    min-width: 0;
}

.rychat-send {
    border: 0;
    border-radius: 8px;
    background: var(--rychat-color, #d98a96);
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
    font-size: .88rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rychat-send svg { width: 17px; height: 17px; }
.rychat-send--wide { width: 100%; padding: 10px; }

/* ---- order ---- */

.rychat-orderform {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: #fff;
}

.rychat-orderresult {
    padding: 0 14px 14px;
    background: #fff;
    flex: 1;
}

@media (max-width: 767px) {
    .rychat-root--hide-mobile { display: none; }
    .rychat-panel { width: calc(100vw - 40px); max-width: 340px; }
}

.rychat-select,
.rychat-textarea {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: .88rem;
    font-family: inherit;
    background: #fff;
    width: 100%;
}

.rychat-textarea { resize: vertical; }

.rychat-formstatus {
    font-size: .82rem;
    color: #555;
    min-height: 1.2em;
}

.rychat-attach {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .85rem;
    color: #444;
    cursor: pointer;
    width: fit-content;
}

.rychat-attach svg { width: 15px; height: 15px; }

.rychat-filelist {
    font-size: .78rem;
    color: #777;
    word-break: break-word;
}
