* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #323130;
    background: #faf9f8;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Заголовок */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #217346;
    color: #fff;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Настройки */
.settings-panel {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #edebe9;
}

.settings-panel.hidden {
    display: none;
}

.settings-panel h2 {
    font-size: 15px;
    margin-bottom: 12px;
}

.settings-panel label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 4px;
    color: #605e5c;
}

.settings-panel input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c8c6c4;
    border-radius: 4px;
    font-size: 13px;
}

.settings-panel input:focus {
    outline: none;
    border-color: #217346;
}

.settings-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* Кнопки */
.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary {
    background: #217346;
    color: #fff;
    flex: 1;
}

.btn-primary:hover {
    background: #1a5c38;
}

.btn-primary:disabled {
    background: #a0a0a0;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f3f2f1;
    color: #323130;
    border: 1px solid #c8c6c4;
}

.btn-secondary:hover {
    background: #edebe9;
}

.status {
    margin-top: 10px;
    font-size: 12px;
    min-height: 16px;
}

.status.ok { color: #107c10; }
.status.err { color: #d13438; }

/* Чат */
.chat-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg.user {
    align-self: flex-end;
    background: #217346;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg.assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #edebe9;
    border-bottom-left-radius: 4px;
}

.msg.tool {
    align-self: flex-start;
    background: #f3f2f1;
    color: #605e5c;
    font-size: 11px;
    font-family: "Consolas", monospace;
    border-radius: 6px;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #edebe9;
    background: #fff;
}

.chat-input textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #c8c6c4;
    border-radius: 4px;
    font-size: 13px;
    resize: none;
    font-family: inherit;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #217346;
}

.chat-input .btn {
    flex: 0 0 auto;
    align-self: stretch;
}
