* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--font-body);
}

a {
    text-decoration: none;
}

.site-shell {
    max-width: 980px;
    margin: 0 auto;
    min-height: 100vh;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 1.5rem 1rem 5rem;
    position: relative;
}

.site-shell::before {
    left: 14%;
}

.site-shell::after {
    right: 14%;
}

.top-nav {
    width: fit-content;
    margin: 0 auto 2.5rem;
    padding: 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 1rem;
    z-index: 40;
}

.top-nav .nav-link,
.top-nav .btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 0.48rem 0.82rem;
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.top-nav .nav-link:hover,
.top-nav .btn:hover {
    color: var(--text);
    background: var(--nav-item-hover-bg);
}

.top-nav .nav-link.active {
    color: var(--text);
    background: var(--nav-item-active-bg);
}

.lang-switch {
    margin-left: 0.2rem;
    border-left: 1px solid var(--line);
    padding-left: 0.45rem;
}

.lang-switch span {
    font-weight: 700;
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.2rem 0.35rem;
}

.lang-switch .btn {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.2rem 0.35rem;
    border-radius: 999px;
}

.lang-switch .btn:hover {
    background: var(--nav-item-hover-bg);
    color: var(--text);
}

.chat-toggle {
    position: fixed;
    right: 1.1rem;
    bottom: 1rem;
    z-index: 60;
    border: 1px solid var(--chat-toggle-border);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    background: var(--chat-toggle-bg);
    color: var(--chat-toggle-text);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.chat-toggle:hover {
    filter: brightness(1.08);
}

.chat-panel {
    position: fixed;
    right: 1rem;
    bottom: 4.2rem;
    width: min(360px, calc(100vw - 2rem));
    border: 1px solid var(--line-strong);
    border-radius: 0.9rem;
    background: var(--chat-panel-bg);
    box-shadow: var(--chat-panel-shadow);
    overflow: hidden;
    z-index: 70;
    display: none;
}

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

.chat-header {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 0.95rem;
    font-family: var(--font-heading);
}

.chat-history {
    max-height: 290px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-msg-row.user {
    justify-content: flex-end;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    object-fit: cover;
    flex: 0 0 28px;
}

.chat-msg {
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    line-height: 1.4;
    font-size: 0.86rem;
    white-space: pre-wrap;
}

.chat-msg.user {
    background: var(--chat-msg-user-bg);
    max-width: 90%;
}

.chat-msg.assistant {
    background: var(--chat-msg-assistant-bg);
    max-width: 95%;
}

.chat-msg.error {
    background: var(--chat-msg-error-bg);
    border: 1px solid var(--chat-msg-error-border);
    max-width: 95%;
}

.chat-msg.typing {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--chat-msg-assistant-bg);
    max-width: 95%;
}

.typing-dot {
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 999px;
    background: var(--typing-dot-bg);
    animation: typingPulse 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingPulse {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: scale(0.9);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-form {
    padding: 0.7rem;
    border-top: 1px solid var(--line);
}

.chat-form .form-control {
    border: 1px solid var(--line-strong);
    background: var(--chat-input-bg);
    color: var(--text);
    font-size: 0.86rem;
}

.chat-form .form-control::placeholder {
    color: var(--muted);
}

.chat-form .btn {
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 700;
    border: 0;
}

.chat-note {
    color: var(--muted);
    font-size: 0.72rem;
    padding: 0 0.75rem 0.6rem;
}

@media (max-width: 700px) {
    .site-shell {
        border-left: 0;
        border-right: 0;
        padding: 1rem 1rem 5rem;
    }

    .site-shell::before,
    .site-shell::after {
        display: none;
    }

    .top-nav {
        width: 100%;
        border-radius: 14px;
    }
}

.company {
    color: var(--bs-gray-600);
}