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

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

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

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #1a1a2e;
    color: #fff;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: #444;
}

.status.ready {
    background: #2d6a4f;
}

.status.warning {
    background: #b08600;
}

.status.error {
    background: #9d0208;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: #1a1a2e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message.thinking {
    opacity: 0.6;
    font-style: italic;
}

.sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8rem;
    color: #666;
}

.source-tag {
    display: inline-block;
    background: #eef;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 4px 2px 0;
    font-size: 0.75rem;
}

.chat-form {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.chat-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}

.chat-form input:focus {
    border-color: #1a1a2e;
}

.chat-form button {
    padding: 10px 20px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-form button:hover {
    background: #16213e;
}

.chat-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Nav */
nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: #aaa;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 6px;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* Documents page */
.documents-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area.dragover {
    border-color: #1a1a2e;
    background: #eef;
}

.upload-text p {
    margin: 4px 0;
    color: #666;
    font-size: 0.9rem;
}

.upload-hint {
    font-size: 0.8rem !important;
    color: #999 !important;
}

.upload-btn {
    display: inline-block;
    margin: 8px 0;
    padding: 8px 20px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.upload-btn:hover {
    background: #16213e;
}

.upload-status {
    margin-bottom: 16px;
}

.upload-msg {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 4px;
    background: #f0f0f0;
    color: #333;
}

.upload-msg.success {
    background: #d4edda;
    color: #155724;
}

.upload-msg.error {
    background: #f8d7da;
    color: #721c24;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.doc-table th,
.doc-table td {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.9rem;
}

.doc-table th {
    background: #f8f8f8;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.doc-table tr:not(:last-child) td {
    border-bottom: 1px solid #f0f0f0;
}

.doc-table td:last-child {
    text-align: right;
}

.delete-btn {
    padding: 4px 12px;
    background: none;
    color: #d00;
    border: 1px solid #d00;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.delete-btn:hover {
    background: #d00;
    color: #fff;
}

.delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.no-docs {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 0.95rem;
}
