:root {
  --bg-primary: #06060b;
  --bg-secondary: #0d0d16;
  --bg-card: #12121f;
  --bg-card-hover: #18182b;
  --bg-input: #0f0f1a;
  --border: #1e1e35;
  --border-light: #2a2a45;

  --accent: #00d4ff;
  --accent-dim: rgba(0, 212, 255, 0.1);
  --accent-mid: rgba(0, 212, 255, 0.25);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.15);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --pink: #ec4899;
  --pink-dim: rgba(236, 72, 153, 0.15);

  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;

  --sidebar-width: 240px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  z-index: 100;
}

#sidebar.collapsed {
  transform: translateX(-100%);
  min-width: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--accent);
  font-size: 20px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-links {
  list-style: none;
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.sidebar-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

/* Main content */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#topbar {
  display: flex;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  gap: 16px;
}

#sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: none;
}

#page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.card-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Grid layouts */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

/* Section */
.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: #00bde6;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-card);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid transparent;
}

.btn-danger:hover {
  border-color: var(--red);
}

/* Tags / Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-pink { background: var(--pink-dim); color: var(--pink); }

/* Form elements */
input, textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition);
  width: 100%;
}

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

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row > * {
  flex: 1;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

tr:hover td {
  background: var(--bg-card-hover);
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-fill.accent { background: var(--accent); }
.progress-fill.green { background: var(--green); }
.progress-fill.purple { background: var(--purple); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }
.progress-fill.pink { background: var(--pink); }

/* Stat items */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

#modal-body {
  padding: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: 16px;
}

/* Kanban Board */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 400px;
}

.kanban-column {
  min-width: 280px;
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kanban-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}

.kanban-cards {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: all var(--transition);
}

.kanban-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-header {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cal-day {
  min-height: 90px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.cal-day:hover {
  border-color: var(--accent);
}

.cal-day.other-month {
  opacity: 0.3;
}

.cal-day.today {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cal-event {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--accent-dim);
  color: var(--accent);
}

/* Habit grid */
.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.habit-row:last-child { border-bottom: none; }

.habit-name {
  min-width: 150px;
  font-size: 13px;
  font-weight: 500;
}

.habit-days {
  display: flex;
  gap: 4px;
  flex: 1;
}

.habit-day {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.habit-day:hover {
  border-color: var(--accent);
}

.habit-day.completed {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

.habit-streak {
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
  min-width: 50px;
  text-align: right;
}

/* Brain / Notes */
.note-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.note-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.note-category-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.note-category-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.note-category-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.note-category-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Journal entry */
.journal-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.journal-entry:hover {
  border-color: var(--border-light);
}

.journal-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.journal-entry-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.journal-entry-mood {
  font-size: 18px;
}

.journal-entry-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.journal-entry-preview {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Nutrition */
.macro-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  position: relative;
}

.meal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.meal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.meal-name {
  font-size: 14px;
  font-weight: 600;
}

.meal-cals {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.meal-item:last-child {
  border-bottom: none;
}

/* Glow effect for accent elements */
.glow {
  box-shadow: 0 0 20px var(--accent-dim);
}

/* Drag drop zone visual */
.kanban-cards.drag-over {
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}

/* Responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-toggle { display: block; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .kanban { flex-direction: column; }
  .kanban-column { min-width: auto; }
  #page-content { padding: 16px; }
}

@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
}
