* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

.hidden {
    display: none !important;
}

#error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

#chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 16px;
    position: relative;
    line-height: 1.4;
}

.message.incoming {
    align-self: flex-start;
    background: #f0f2f5;
    border-bottom-left-radius: 4px;
}

.message.outgoing {
    align-self: flex-end;
    background: #e3f2fd;
    border-bottom-right-radius: 4px;
}

.message.internal {
    align-self: center;
    background: #fff8e1;
    border: 1px solid #ffcc80;
    width: 90%;
    max-width: 90%;
}

.message-header {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.message-author {
    font-weight: 600;
    color: #222;
}

.message-time {
    white-space: nowrap;
}

.message-body img {
    max-width: 100%;
    border-radius: 8px;
}

.attachments {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: #1565c0;
}

.internal-label {
    font-size: 11px;
    color: #e65100;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 6px;
}

#composer {
    border-top: 1px solid #e0e0e0;
    padding: 12px 16px;
    background: #fafafa;
}

#drop-zone {
    border: 2px dashed transparent;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

#drop-zone.drag-over {
    border-color: #2196f3;
    background: #e3f2fd;
}

#message-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

#message-input:focus {
    outline: none;
    border-color: #2196f3;
}

.composer-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.btn-primary,
.btn-secondary,
.btn-attach {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary {
    background: #2196f3;
    color: #fff;
    margin-left: auto;
}

.btn-primary:hover {
    background: #1976d2;
}

.btn-secondary {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-attach {
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
}

#attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
}

.preview-item button {
    background: none;
    border: none;
    cursor: pointer;
    color: #c62828;
    font-weight: bold;
}
