@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap');

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

:root {
  --bg: #0f1117;
  --surface: #181a23;
  --surface-2: #1f2230;
  --border: #2a2d3a;
  --text: #e4e4e9;
  --text-dim: #8b8d9a;
  --accent: #7c6aef;
  --accent-glow: rgba(124, 106, 239, 0.15);
  --green: #34d399;
  --amber: #fbbf24;
  --rose: #f472b6;
  --radius: 10px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; }

header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo span { color: var(--accent); }

.sync-status {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--surface);
}

.sync-status.saving { color: var(--amber); }
.sync-status.saved { color: var(--green); }
.sync-status.error { color: #ef4444; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
}

.tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s;
}

.tab.active { background: var(--accent); color: #fff; }

main { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }
.panel { display: none; }
.panel.active { display: block; }

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.date-nav button {
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

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

.date-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  min-width: 220px;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.date-display input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.add-form input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-form input:focus { border-color: var(--accent); }
.add-form input::placeholder { color: var(--text-dim); }

.btn {
  padding: 12px 22px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  transition: filter 0.15s;
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.12); }

.btn-outline {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-outline:hover { border-color: var(--accent); background: var(--accent-glow); }
.btn-danger { border-color: #ef4444; color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.1); border-color: #ef4444; }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.suggestion-chip {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-glow);
}

.activity-list { display: flex; flex-direction: column; gap: 8px; }

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.activity-item:hover { border-color: var(--accent); }

.activity-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.activity-time { color: var(--text-dim); font-size: 13px; }

.delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; }

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.chart-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }

.bar-label {
  width: 120px;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 28px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.bar-count {
  width: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
}

.heatmap-grid { display: flex; flex-wrap: wrap; gap: 3px; }

.heatmap-cell {
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--surface-2);
  position: relative;
  cursor: default;
}

.heatmap-cell[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-dim);
}

.heatmap-legend .swatch { width: 14px; height: 14px; border-radius: 3px; }

.weekday-chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; justify-content: center; }

.weekday-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 60px;
  height: 100%;
  justify-content: flex-end;
}

.weekday-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height 0.4s ease;
  min-height: 2px;
}

.weekday-label { font-size: 12px; color: var(--text-dim); }
.weekday-count { font-size: 12px; font-weight: 600; }

.daily-count-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
}

.range-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
  width: fit-content;
}

.range-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s;
}

.range-btn.active { background: var(--accent); color: #fff; }

.history-month { margin-bottom: 28px; }

.month-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-day {
  padding: 14px 18px;
  border-left: 3px solid var(--border);
  margin-bottom: 6px;
  margin-left: 8px;
  transition: border-color 0.2s;
}

.history-day:hover { border-color: var(--accent); }
.history-date { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.history-activities { display: flex; flex-wrap: wrap; gap: 6px; }

.history-chip {
  padding: 4px 12px;
  background: var(--surface-2);
  border-radius: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.manage-section { margin-bottom: 32px; }

.manage-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.manage-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.manage-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 600px) {
  header { padding: 16px; }
  main { padding: 20px 14px; }
  .date-display { font-size: 16px; min-width: 0; }
  .add-form { flex-direction: column; }
  .bar-label { width: 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
