:root {
    --green-900: #075e54;
    --green-700: #128c7e;
    --green-500: #25d366;
    --blue-700: #2d77ea;
    --blue-900: #123a73;
    --bg-1: #eaf3fb;
    --bg-2: #f7fbff;
    --panel: #ffffff;
    --panel-soft: #f4f7fb;
    --text-main: #1f2d3d;
    --text-soft: #697586;
    --border: #dbe4ee;
    --danger: #cf4b4b;
    --bubble-mine: #d9fdd3;
    --bubble-other: #ffffff;
    --shadow: 0 24px 80px rgba(24, 63, 117, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Manrope', sans-serif;
    color: var(--text-main);
}

body {
    min-height: 100vh;
}

img,
video {
    display: block;
    max-width: 100%;
}

button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.landing-body,
.visitor-body,
.admin-body,
.widget-entry-body,
.widget-chat-body {
    background:
        radial-gradient(circle at top left, rgba(37, 211, 102, 0.1), transparent 24%),
        radial-gradient(circle at top right, rgba(45, 119, 234, 0.12), transparent 26%),
        linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

.landing-shell,
.admin-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.hero-card {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 440px;
    gap: 24px;
    align-items: center;
}

.hero-copy,
.visitor-copy {
    padding: 28px 16px;
}

.hero-copy h1,
.visitor-copy h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
    color: var(--blue-900);
}

.hero-copy p,
.visitor-copy p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-soft);
}

.hero-points,
.identity-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.hero-points span,
.identity-list span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 10px 30px rgba(24, 63, 117, 0.08);
    color: var(--blue-900);
    font-weight: 600;
}

.entry-card,
.support-widget {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.entry-card {
    padding: 28px;
}

.widget-entry-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.widget-entry-card {
    width: min(100%, 420px);
}

.entry-card-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.entry-card-head strong {
    display: block;
    font-size: 1.15rem;
}

.entry-card-head p {
    margin: 4px 0 0;
    color: var(--text-soft);
}

.brand-mark,
.brand-avatar {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(145deg, var(--green-900), var(--green-500));
    font-size: 1.45rem;
}

.brand-avatar.small {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.05rem;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green-700);
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 8px;
}

.login-form span {
    font-size: 0.94rem;
    font-weight: 700;
}

.login-form input,
.search-box input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    background: #fff;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus,
.search-box input:focus,
textarea:focus {
    outline: none;
    border-color: var(--green-700);
    box-shadow: 0 0 0 4px rgba(18, 140, 126, 0.12);
}

.btn-primary,
.send-btn,
.composer-attach {
    border: 0;
    border-radius: 18px;
    font-weight: 800;
}

.btn-primary {
    padding: 14px 18px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--green-900), var(--green-500));
    color: #fff;
}

.demo-box,
.alert-error {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
}

.demo-box {
    background: var(--panel-soft);
    color: var(--text-soft);
}

.alert-error {
    background: rgba(207, 75, 75, 0.1);
    color: var(--danger);
    border: 1px solid rgba(207, 75, 75, 0.16);
}

.visitor-page {
    min-height: 100vh;
    padding: 24px;
}

.visitor-stage {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 28px;
    align-items: center;
    min-height: calc(100vh - 48px);
}

.widget-chat-shell {
    min-height: 100vh;
    padding: 0;
}

.support-widget {
    display: flex;
    flex-direction: column;
    min-height: 720px;
    max-height: calc(100vh - 64px);
    overflow: hidden;
}

.embedded-support-widget {
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}

.support-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    color: #fff;
    background: linear-gradient(135deg, #0f6bf2, #2d77ea);
}

.support-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.support-brand strong {
    display: block;
}

.support-brand span {
    font-size: 0.88rem;
    opacity: 0.96;
}

.status-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
}

.online-dot.online {
    background: #62f38a;
    box-shadow: 0 0 0 4px rgba(98, 243, 138, 0.18);
}

.widget-link {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.support-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background:
        linear-gradient(rgba(229, 221, 213, 0.88), rgba(229, 221, 213, 0.9)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d5cec7' fill-opacity='.45'%3E%3Cpath d='M36 34c0-2.21 1.79-4 4-4h18c2.21 0 4 1.79 4 4v18c0 2.21-1.79 4-4 4H40c-2.21 0-4-1.79-4-4V34zm34 34c0-2.21 1.79-4 4-4h12c2.21 0 4 1.79 4 4v12c0 2.21-1.79 4-4 4H74c-2.21 0-4-1.79-4-4V68zM8 78c0-2.21 1.79-4 4-4h16c2.21 0 4 1.79 4 4v16c0 2.21-1.79 4-4 4H12c-2.21 0-4-1.79-4-4V78zm76-62c0-2.21 1.79-4 4-4h20c2.21 0 4 1.79 4 4v20c0 2.21-1.79 4-4 4H88c-2.21 0-4-1.79-4-4V16z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.support-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
}

.composer-attach {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--green-900);
    background: rgba(7, 94, 84, 0.08);
}

.composer-stack {
    display: grid;
    gap: 8px;
}

textarea {
    min-height: 56px;
    max-height: 136px;
    resize: none;
}

.send-btn {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--green-900), var(--green-500));
}

.file-preview {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(18, 140, 126, 0.08);
}

.file-preview strong {
    display: block;
}

.file-preview button {
    border: 0;
    background: transparent;
    color: var(--danger);
    font-size: 1rem;
    cursor: pointer;
}

.file-meta {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.message-row {
    display: flex;
    margin-bottom: 12px;
}

.message-row.mine {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(84%, 420px);
    padding: 12px 14px 10px;
    border-radius: 18px 18px 18px 6px;
    background: var(--bubble-other);
    box-shadow: 0 8px 22px rgba(28, 48, 77, 0.08);
}

.message-row.mine .message-bubble {
    background: var(--bubble-mine);
    border-radius: 18px 18px 6px 18px;
}

.message-media {
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.05);
}

.message-media img,
.message-media video {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.message-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.74rem;
    color: var(--text-soft);
}

.empty-state {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-soft);
}

.admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
}

.admin-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(219, 228, 238, 0.8);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
}

.admin-sidebar-head,
.admin-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid rgba(219, 228, 238, 0.8);
    background: rgba(255, 255, 255, 0.85);
}

.profile-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.profile-chip img {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    object-fit: cover;
    background: #d4dce6;
}

.profile-chip strong {
    display: block;
}

.profile-chip span {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.search-box {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(219, 228, 238, 0.8);
}

.search-box i {
    position: absolute;
    top: 50%;
    left: 30px;
    transform: translateY(-50%);
    color: var(--text-soft);
}

.search-box input {
    padding-left: 44px;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(219, 228, 238, 0.7);
    cursor: pointer;
    transition: background 0.2s ease;
}

.contact-item:hover,
.contact-item.active {
    background: rgba(18, 140, 126, 0.08);
}

.contact-top,
.contact-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.contact-main {
    min-width: 0;
}

.contact-main strong,
.contact-meta,
.contact-snippet {
    display: block;
}

.contact-snippet,
.contact-meta {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.contact-snippet {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.unread-badge {
    min-width: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    text-align: center;
    background: var(--green-700);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
}

.admin-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-messages {
    flex: 1;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 0;
    background: rgba(31, 45, 61, 0.06);
    color: var(--text-main);
    text-decoration: none;
}

.subtle-btn {
    background: rgba(31, 45, 61, 0.06);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(7, 94, 84, 0.06);
}

::-webkit-scrollbar-thumb {
    background: rgba(7, 94, 84, 0.32);
    border-radius: 999px;
}

@media (max-width: 980px) {
    .hero-card,
    .visitor-stage,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .support-widget {
        min-height: 70vh;
        max-height: none;
    }

    .admin-sidebar {
        min-height: 42vh;
    }

    .admin-chat-panel {
        min-height: 58vh;
    }
}
