* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #1a1a2e; color: #e0e0e0; }

/* Navbar */
.navbar { display: flex; align-items: center; padding: 0.75rem 1.5rem; background: #16213e; border-bottom: 1px solid #333; }
.brand { font-weight: bold; font-size: 1.2rem; color: #4a90d9; text-decoration: none; margin-right: 1rem; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.credits { color: #4caf50; font-weight: 600; }
.user-name { color: #aaa; }
.project-title { color: #aaa; font-size: 0.9rem; }

/* Status indicator */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot.connected { background: #4caf50; }
.status-dot.disconnected { background: #f44336; }

/* Buttons */
.btn { padding: 0.5rem 1rem; background: #4a90d9; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }
.btn:hover { background: #357abd; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid #4a90d9; color: #4a90d9; }
.btn-outline:hover { background: #4a90d9; color: white; }
.btn-danger { background: #d94a4a; }
.btn-danger:hover { background: #bd3535; }
.btn-google { padding: 0.75rem 2rem; font-size: 1rem; background: #4285f4; }
.btn-google:hover { background: #357ae8; }

/* Layout */
.container { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-container { text-align: center; }
.login-container h1 { font-size: 3rem; color: #4a90d9; margin-bottom: 0.5rem; }
.subtitle { color: #888; margin-bottom: 2rem; }
.error-message { color: #f44336; margin-bottom: 1rem; }

/* Projects grid */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.project-card { background: #16213e; border: 1px solid #333; border-radius: 8px; padding: 1.5rem; cursor: pointer; transition: border-color 0.2s; }
.project-card:hover { border-color: #4a90d9; }
.project-card h3 { margin-bottom: 0.5rem; }
.project-date { color: #888; font-size: 0.85rem; margin-bottom: 0.75rem; }
.empty-state { color: #888; padding: 2rem; text-align: center; }

/* Modal */
.modal { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 100; }
.modal-content { background: #16213e; padding: 2rem; border-radius: 8px; min-width: 300px; }
.modal-content h2 { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.input { width: 100%; padding: 0.5rem; background: #1a1a2e; border: 1px solid #333; border-radius: 4px; color: white; font-size: 1rem; }

/* Credit packages */
.credit-packages { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.credit-package { padding: 1rem; background: #1a1a2e; border: 1px solid #333; border-radius: 4px; cursor: pointer; text-align: center; }
.credit-package:hover { border-color: #4a90d9; }

/* Workspace layout */
.workspace { display: grid; grid-template-columns: 220px 1fr; height: calc(100vh - 50px); }
.sidebar { background: #0f3460; border-right: 1px solid #333; overflow-y: auto; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border-bottom: 1px solid #333; }
.sidebar-header h3 { font-size: 0.9rem; }
.file-tree { padding: 0.5rem; }
.file-item { padding: 0.3rem 0.5rem; font-size: 0.85rem; cursor: pointer; border-radius: 3px; font-family: monospace; word-break: break-all; }
.file-item:hover { background: rgba(74, 144, 217, 0.2); }
.file-item.selected { background: rgba(74, 144, 217, 0.3); }

/* Main area */
.main-area { display: grid; grid-template-columns: 1fr 1fr; }
.chat-panel { display: flex; flex-direction: column; border-right: 1px solid #333; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.chat-welcome { color: #888; text-align: center; padding: 2rem; }
.chat-message { margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 6px; max-width: 90%; white-space: pre-wrap; word-wrap: break-word; }
.chat-message.user { background: #0f3460; margin-left: auto; }
.chat-message.assistant { background: #16213e; }
.chat-message.system { background: transparent; color: #888; font-size: 0.85rem; font-style: italic; }
.chat-message.status-message { background: transparent; color: #4a90d9; font-size: 0.85rem; }

.chat-input-area { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid #333; }
.chat-input-area textarea { flex: 1; background: #1a1a2e; border: 1px solid #333; border-radius: 4px; color: white; padding: 0.5rem; resize: none; font-family: inherit; }

/* Preview panel */
.preview-panel { display: flex; flex-direction: column; }
.preview-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border-bottom: 1px solid #333; }
.preview-header h3 { font-size: 0.9rem; }
.preview-iframe { flex: 1; border: none; background: white; }
