/* Theme system */
:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-hover: #1a1a1a;
  --border: #262626;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --sidebar-w: 240px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-card: #f9fafb;
  --bg-hover: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  transition: background 0.2s, color 0.2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  color: var(--text);
}
.sidebar-logo span { color: var(--accent); }
.sidebar nav { flex: 1; padding: 8px; }
.sidebar nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--bg-hover);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--accent);
  color: white;
}

.compose-btn {
  display: block;
  margin: 16px 8px 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.compose-btn:hover { background: var(--accent-hover); color: white; }

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
}
.topbar h1 { font-size: 16px; font-weight: 600; }
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  color: var(--text-muted);
  text-align: center;
}
.empty-state h2 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.empty-state p { font-size: 14px; }

/* Octavia Chat */
.chat-container { display: flex; flex-direction: column; height: 100%; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; }
.chat-message {
  max-width: 600px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.chat-message.user {
  background: var(--accent);
  color: white;
  margin-left: auto;
}
.chat-message.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}
.chat-input-bar input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.chat-input-bar input:focus { border-color: var(--accent); }
.chat-input-bar button {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.chat-input-bar button:hover { background: var(--accent-hover); }

/* Email list */
.email-list { list-style: none; }
.email-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.email-item:hover { background: var(--bg-hover); }
.email-from { font-weight: 500; width: 200px; font-size: 14px; }
.email-subject { flex: 1; font-size: 14px; }
.email-date { color: var(--text-muted); font-size: 13px; }

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
}
.login-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}
.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }

/* Calendar placeholder */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.calendar-cell {
  background: var(--bg-card);
  padding: 8px;
  min-height: 80px;
  font-size: 13px;
}
.calendar-cell.header {
  min-height: auto;
  padding: 8px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  border: none;
  background: none;
  border-radius: 6px;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle-icon { font-size: 16px; }

@media (max-width: 768px) {
  .sidebar { display: none; }
}
