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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #252525;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #4a9eff;
  --accent-dim: #2a5a9f;
  --success: #4caf50;
  --warning: #ff9800;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* Header */
.header {
  padding: 1rem;
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.5rem;
}

.header nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--surface-2);
}

.nav-btn.active {
  background: var(--accent-dim);
  color: var(--text);
  border-color: var(--accent);
}

/* Views */
.view {
  display: none;
  flex: 1;
  overflow: hidden;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* Chat View */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 85%;
  padding: 1rem;
  border-radius: 12px;
  line-height: 1.5;
}

.message.user {
  background: var(--accent-dim);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  background: var(--surface);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message p {
  margin-bottom: 0.5rem;
}

.message p:last-child {
  margin-bottom: 0;
}

.input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--surface-2);
  background: var(--surface);
}

.voice-btn {
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-btn:hover {
  background: var(--accent-dim);
}

.voice-btn.recording {
  background: #c62828;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#user-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  resize: none;
  font-family: inherit;
}

#user-input:focus {
  outline: none;
  border-color: var(--accent);
}

.send-btn {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 0 1.5rem;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.send-btn:hover {
  background: var(--accent-dim);
}

/* Dashboard View */
#dashboard-view {
  padding: 1rem;
  overflow-y: auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
}

.card h3 {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-wrapper {
  height: 250px;
  max-height: 250px;
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.chart-wrapper canvas {
  max-height: 100% !important;
}

.stat {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.stat span {
  color: var(--text);
  font-weight: 600;
}

.phase-badge {
  display: inline-block;
  background: var(--success);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Quick Log View */
#log-view {
  padding: 1rem;
  overflow-y: auto;
}

.quick-log {
  max-width: 500px;
  margin: 0 auto;
}

.quick-log h2 {
  margin-bottom: 1.5rem;
}

.log-form {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
}

.log-form h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--surface-2);
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-row input,
.form-row select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.submit-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 1rem;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
}

.submit-btn:hover {
  background: var(--accent-dim);
}

/* Mobile */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
