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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f1419;
    color: #e7e9ea;
    height: 100vh;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #2f3336;
}

header h1 { font-size: 1.2rem; color: #1d9bf0; }

nav a {
    color: #8899a6;
    text-decoration: none;
    margin-left: 1rem;
    font-size: 0.9rem;
}
nav a:hover { color: #e7e9ea; }

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 85%;
    line-height: 1.5;
    white-space: pre-wrap;
}

.message.user {
    background: #1d9bf0;
    margin-left: auto;
    color: white;
}

.message.assistant {
    background: #1e2732;
}

.message .sql-toggle {
    font-size: 0.75rem;
    color: #1d9bf0;
    cursor: pointer;
    margin-top: 0.5rem;
}
.message .sql-toggle:hover { text-decoration: underline; }

.message .sql-block {
    font-family: monospace;
    font-size: 0.8rem;
    background: #0d1117;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.25rem;
    overflow-x: auto;
    color: #8899a6;
}

.message.loading {
    color: #8899a6;
    font-style: italic;
}

#chat-form {
    display: flex;
    padding: 1rem;
    border-top: 1px solid #2f3336;
    gap: 0.5rem;
}

#question {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #2f3336;
    border-radius: 8px;
    background: #1e2732;
    color: #e7e9ea;
    font-size: 1rem;
}
#question:focus { outline: none; border-color: #1d9bf0; }

#chat-form button {
    padding: 0.75rem 1.5rem;
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}
#chat-form button:hover { background: #1a8cd8; }
#chat-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-container { padding: 1rem; }
.upload-container h2 { margin-bottom: 1rem; }

#upload-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#file-input {
    flex: 1;
    padding: 0.5rem;
    background: #1e2732;
    color: #e7e9ea;
    border: 1px solid #2f3336;
    border-radius: 8px;
}

#upload-form button {
    padding: 0.5rem 1.5rem;
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#upload-status {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}
.status-ok { background: #0d3320; color: #4ade80; }
.status-error { background: #3b1014; color: #f87171; }
.status-info { background: #1e2732; color: #8899a6; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}
th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #2f3336;
}
th { color: #8899a6; font-size: 0.85rem; }
