*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.screen { display: none; width: 100%; max-width: 480px; }
.screen.active { display: flex; justify-content: center; }

.chat-card {
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #2563eb;
    color: #fff;
}

.avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.header-title { font-weight: 600; font-size: 1rem; }
.header-sub   { font-size: .8rem; opacity: .85; margin-top: 2px; }

/* Start form */
.chat-body {
    padding: 24px 20px;
}

.intro-text {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: .93rem;
}

.field { margin-bottom: 14px; }
.field label {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 5px;
}
.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .95rem;
    outline: none;
    transition: border-color .2s;
}
.field input:focus { border-color: #2563eb; }

.btn-primary {
    width: 100%;
    padding: 11px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: background .2s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: default; }

/* Messages */
.chat-messages {
    flex: 1;
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9fafb;
}

.msg {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: .9rem;
    line-height: 1.45;
    word-break: break-word;
}

.msg-client {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-manager {
    align-self: flex-start;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.msg-system {
    align-self: center;
    background: none;
    color: #9ca3af;
    font-size: .78rem;
    padding: 2px 8px;
}

/* Input row */
.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

#msg-input {
    flex: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: .9rem;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color .2s;
}
#msg-input:focus { border-color: #2563eb; }

.btn-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.btn-send:hover { background: #1d4ed8; }
.btn-send:disabled { background: #93c5fd; cursor: default; }
