:root {
    --bg-1: #edf5ef;
    --bg-2: #e4efe7;
    --card: rgba(255, 255, 255, 0.76);
    --card-border: rgba(93, 131, 108, 0.18);
    --text: #244031;
    --muted: #5f7868;
    --accent: #7ea68a;
    --accent-2: #a8c5b1;
    --accent-3: #d8e8dc;
    --user-bubble: #dfeee4;
    --bot-bubble: #f7fbf8;
    --shadow: 0 18px 45px rgba(63, 99, 74, 0.10);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
    min-height: 100%;
}

.page-bg {
    position: fixed;
    inset: 0;
    background:
            radial-gradient(circle at top left, rgba(168, 197, 177, 0.20), transparent 28%),
            radial-gradient(circle at bottom right, rgba(126, 166, 138, 0.13), transparent 24%);
    pointer-events: none;
}

.app-shell {
    position: relative;
    max-width: 980px;
    margin: 28px auto;
    padding: 0 18px;
}

.app-header {
    display: flex;
    gap: 18px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #dcecdf, #cde2d3);
    box-shadow: var(--shadow);
    font-size: 28px;
}

.brand h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.brand p {
    margin: 5px 0 0 0;
    color: var(--muted);
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.select-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.select-wrap label {
    font-size: 13px;
    color: var(--muted);
}

select,
input,
button {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    font-size: 15px;
    min-height: 46px;
    outline: none;
}

select,
input {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    padding: 0 14px;
}

select:focus,
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(126, 166, 138, 0.12);
}

.btn {
    padding: 0 16px;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(180deg, #8fb59a, #7aa489);
    color: white;
    border: 0;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
}

.chat-card {
    background: var(--card);
    backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat {
    height: 62vh;
    min-height: 420px;
    max-height: 760px;
    overflow: auto;
    padding: 22px;
    background:
            linear-gradient(180deg, rgba(255,255,255,0.46), rgba(240,247,242,0.72));
}

.msg-row {
    display: flex;
    margin-bottom: 14px;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-row.bot {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: min(76%, 720px);
    border-radius: 20px;
    padding: 14px 16px;
    box-shadow: 0 8px 22px rgba(73, 110, 84, 0.06);
    border: 1px solid rgba(93, 131, 108, 0.10);
}

.msg-bubble.user {
    background: var(--user-bubble);
    border-bottom-right-radius: 8px;
}

.msg-bubble.bot {
    background: var(--bot-bubble);
    border-bottom-left-radius: 8px;
}

.msg-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.msg-text {
    line-height: 1.55;
    font-size: 15px;
}

.system-note {
    margin: 0 auto 14px auto;
    max-width: 720px;
    font-size: 13px;
    color: #6c7f73;
    background: rgba(255,255,255,0.55);
    border: 1px dashed rgba(93,131,108,0.16);
    padding: 10px 12px;
    border-radius: 12px;
    text-align: center;
}

.chat-form {
    display: flex;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid rgba(93, 131, 108, 0.10);
    background: rgba(255,255,255,0.42);
}

.chat-form input {
    flex: 1;
}

.hint {
    padding: 0 18px 18px 18px;
    color: var(--muted);
    font-size: 13px;
}

.typing-bubble {
    min-width: 120px;
}

.typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 16px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8bb199;
    animation: bounce 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.45;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 820px) {
    .app-shell {
        margin: 18px auto;
    }

    .chat {
        height: 58vh;
        min-height: 360px;
    }

    .msg-bubble {
        max-width: 88%;
    }

    .chat-form {
        flex-direction: column;
    }

    .chat-form .btn-primary {
        width: 100%;
    }
}


.hint a {
    color: #1f4d2f;
    text-decoration: none;
    font-weight: 600;
}

.hint a:hover {
    text-decoration: underline;
}