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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #131318;
  color: #d4d4d8;
  min-height: 100vh;
  padding: 1rem 0.8rem;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 800px; margin: 0 auto; }

h1 {
  text-align: center; font-size: 1.2rem; font-weight: 300;
  margin-bottom: 0.6rem; color: #e8e8f0;
  letter-spacing: 0.12em; text-transform: uppercase;
}

.loading { text-align: center; color: #5a5a6c; padding: 2rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: #e0825c; color: #fff;
  text-decoration: none; border-radius: 8px;
  font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; font-size: 0.85rem;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.72rem; }
.btn-ghost { background: transparent; border: 1px solid #2a2a35; color: #6b6b80; }
.btn-ghost:hover { background: #1c1c25; border-color: #4a4a58; }
.btn-google {
  background: #fff; color: #1f1f1f;
  border: 1px solid #e0e0e0; font-weight: 500;
}
.btn-google:hover { background: #f5f5f5; opacity: 1; }
.btn-google svg { width: 18px; height: 18px; }
.btn-icon {
  background: transparent; border: 1px solid #2a2a35;
  color: #b8b8cc; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; padding: 0;
}
.btn-icon:hover { background: #1c1c25; border-color: #4a4a58; color: #e8e8f0; }
.btn-icon svg { width: 16px; height: 16px; }

/* ---------- Sign-in ---------- */

.auth-prompt { text-align: center; padding: 4rem 1rem; }
.auth-prompt p { margin-bottom: 1.2rem; color: #6b6b80; }
.auth-prompt h2 { font-weight: 400; font-size: 1rem; margin-bottom: 1.5rem; color: #e8e8f0; letter-spacing: 0.08em; }

/* ---------- Top bar ---------- */

.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; gap: 0.5rem;
}
.top-bar .left { flex-shrink: 0; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.top-bar .center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.top-bar .actions { display: flex; gap: 0.4rem; flex-shrink: 0; align-items: center; }
.sync-status { font-size: 0.7rem; color: #5a5a6c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-version {
  font-size: 0.6rem; color: #4a4a58; font-family: 'JetBrains Mono', monospace;
  margin-left: 0.4rem; letter-spacing: 0.02em;
}
.avatar { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.avatar.avatar-lg { width: 40px; height: 40px; }
.avatar-fallback {
  background: #2a2a35; color: #b8b8cc;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.7rem; letter-spacing: 0.02em;
}
.avatar-fallback.avatar-lg { font-size: 1rem; }

/* On phones, hide the user name — avatar is enough. */
@media (max-width: 480px) {
  .top-bar .sync-status { display: none; }
}

/* ---------- Activity-type filter (multiselect) ---------- */

.activity-filter { display: flex; align-items: center; gap: 0.4rem; font-size: 0.68rem; color: #5a5a6c; }
.activity-filter span { white-space: nowrap; }
@media (max-width: 480px) {
  .activity-filter span { display: none; }
}
.multiselect { position: relative; display: inline-block; }
.multiselect-toggle {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.7rem; background: #1c1c25; border: 1px solid #2a2a35;
  border-radius: 6px; color: #b8b8cc; font-size: 0.72rem; font-family: inherit;
  cursor: pointer; min-width: 110px; transition: border-color 0.15s;
}
.multiselect-toggle:hover { border-color: #4a4a58; }
.multiselect-toggle .arrow { color: #5a5a6c; margin-left: auto; font-size: 0.6rem; }
.multiselect-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  background: #18181f; border: 1px solid #2a2a35; border-radius: 8px;
  padding: 0.3rem 0; z-index: 50; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.multiselect-dropdown.open { display: block; }
.multiselect-option {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.7rem; font-size: 0.72rem; color: #6b6b80;
  cursor: pointer; transition: background 0.1s;
}
.multiselect-option:hover { background: #2a2a35; }
.multiselect-option input { accent-color: #e0825c; cursor: pointer; }
.multiselect-option.checked { color: #d4d4d8; }

/* ---------- Block grid ---------- */

.block-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.block-grid > .block-full { grid-column: 1 / -1; }

@media (min-width: 720px) {
  body { padding: 1.2rem 1rem; }
  .block-grid { grid-template-columns: 1fr 1fr; gap: 1.2rem; }
}

.block { min-width: 0; }

/* ---------- Section headers (block titles) ---------- */

.recent-activities h3, .stats h3, .goal-panel h3, .graph-block h3 {
  font-size: 0.7rem; color: #6b6b80; margin-bottom: 0.5rem;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---------- Goal block ---------- */

.goal-panel {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1.2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.goal-panel h3 { margin-bottom: 0.8rem; }
.goal-panel h3.editable { cursor: pointer; }
.goal-panel h3.editable:hover { color: #8888a0; }
/* Replaces the h3 while editing — same type treatment as the section
   headers above, so the swap doesn't shift the layout. */
.goal-label-input {
  width: 130px; background: transparent; border: none; border-bottom: 1px solid #e0825c;
  color: #6b6b80; font-size: 0.7rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.06em; text-align: center; outline: none; padding: 0;
  font-family: inherit; margin-bottom: 0.8rem;
}
.goal-ring-wrap { position: relative; width: 160px; height: 160px; }
.goal-ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.goal-ring-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.goal-ring-text .goal-current { font-size: 1.6rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: #e0825c; line-height: 1; }
.goal-ring-text .goal-separator { font-size: 1.6rem; font-weight: 300; color: #4a4a58; }
.goal-ring-text .goal-remaining { font-size: 1.6rem; font-weight: 400; font-family: 'JetBrains Mono', monospace; color: #5a5a6c; line-height: 1; }
.goal-remaining.editable { cursor: pointer; }
.goal-remaining.editable:hover { color: #6b6b80; }
.goal-input {
  width: 55px; background: transparent; border: none; border-bottom: 2px solid #e0825c;
  color: #5a5a6c; font-size: 1.6rem; font-weight: 400; text-align: center;
  outline: none; font-family: 'JetBrains Mono', monospace;
}

/* ---------- Stats block ---------- */

.stats {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1.2rem;
}
.stat-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid #252530; }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 0.72rem; color: #6b6b80; font-weight: 500; letter-spacing: 0.01em; }
.stat-value { font-size: 0.82rem; font-weight: 600; text-align: right; }
.stat-value .primary { color: #e8e8f0; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.stat-value .secondary { color: #8888a0; font-size: 0.65rem; font-weight: 400; margin-left: 0.3rem; }
.stat-projected { color: #6b6b80; font-size: 0.6rem; font-weight: 400; margin-left: 0.2rem; font-style: italic; }
.stat-divider { height: 1px; background: #2a2a35; margin: 0.6rem 0 0.2rem; }
.stat-value .highlight { color: #e0825c; }
.streak-row .stat-value .primary { font-size: 1.3rem; color: #e0825c; }

/* ---------- Calendar block ---------- */

.calendar {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1rem;
}
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.cal-nav button {
  background: none; border: none; color: #6b6b80;
  cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.5rem;
  transition: color 0.15s;
}
.cal-nav button:hover { color: #e8e8f0; }
.cal-nav .month-label { font-size: 0.8rem; font-weight: 500; color: #b8b8cc; letter-spacing: 0.02em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-header { font-size: 0.55rem; text-align: center; color: #5a5a6c; padding: 0.2rem 0; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.cal-day {
  aspect-ratio: 1 / 0.85;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.65rem; position: relative;
  background: #18181f; transition: background 0.15s;
}
.cal-day.empty { background: transparent; }
.cal-day.today { outline: 1.5px solid #e0825c; outline-offset: -1px; }
.cal-day .day-num { color: #4a4a58; font-size: 0.45rem; font-weight: 500; position: absolute; top: 2px; left: 4px; }
.cal-day .day-miles { font-size: 0.8rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: #e8e8f0; line-height: 1; }
.cal-day.has-activity { border-left: 3px solid #e0825c; }
.cal-day.has-activity .day-num { color: #5a5a6c; }
.cal-day.type-walk { border-left-color: #e0825c; background: rgba(224,130,92,0.08); }
.cal-day.type-hike { border-left-color: #4ade80; background: rgba(74,222,128,0.08); }
.cal-day.type-run  { border-left-color: #60a5fa; background: rgba(96,165,250,0.08); }
.cal-day.type-multi { border-left-color: #c084fc; background: rgba(192,132,252,0.08); }
.cal-day.type-strength { border-left-color: #a78bfa; background: rgba(167,139,250,0.10); }
.cal-day .day-icons {
  position: absolute; left: 0; right: 0; bottom: 2px;
  text-align: center; font-size: 0.85rem; line-height: 1;
  opacity: 0.9; letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 2px;
}
.cal-day .day-miles { margin-bottom: 0.85rem; } /* leave room for icons strip */
.cal-day.intensity-high .day-miles { color: #fff; }
.cal-day.intensity-med .day-miles { color: #d4d4d8; }
.cal-day.intensity-low .day-miles { color: #8888a0; }

/* ---------- Recent activities block ---------- */

.recent-activities {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 0.9rem 1rem;
  scrollbar-width: thin; scrollbar-color: #2a2a35 transparent;
}
.recent-activities .ra-count {
  color: #5a5a6c; font-size: 0.6rem; font-weight: 400;
  margin-left: 0.4rem; letter-spacing: 0.04em;
}
.recent-activities .ra-see-more {
  display: block; text-align: center; padding: 0.55rem 0 0.2rem;
  color: #8888a0; font-size: 0.7rem; text-decoration: none;
  border-top: 1px solid #252530; margin-top: 0.4rem;
}
.recent-activities .ra-see-more:hover { color: #e0825c; }
.recent-activities::-webkit-scrollbar { width: 4px; }
.recent-activities::-webkit-scrollbar-track { background: transparent; }
.recent-activities::-webkit-scrollbar-thumb { background: #2a2a35; border-radius: 2px; }
.recent-activities::-webkit-scrollbar-thumb:hover { background: #4a4a58; }
.recent-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid #252530; font-size: 0.72rem; gap: 0.5rem;
}
.recent-item:last-child { border-bottom: none; }
.recent-item .ri-left { color: #8888a0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .ri-emoji { margin-right: 0.3rem; }
.recent-item .ri-name { color: #b8b8cc; text-decoration: none; }
.recent-item .ri-name:hover { text-decoration: underline; }
.recent-item .ri-date { color: #5a5a6c; font-size: 0.62rem; margin-left: 0.4rem; }
.recent-item .ri-miles { color: #e0825c; font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; text-decoration: none; flex-shrink: 0; }
.recent-item .ri-miles:hover { text-decoration: underline; }

/* ---------- Graph block ---------- */

.graph-block {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1rem;
}
.graph-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem; gap: 0.6rem; flex-wrap: wrap;
}
.graph-controls { display: flex; gap: 0.3rem; }
.graph-controls button {
  background: transparent; border: 1px solid #2a2a35; color: #6b6b80;
  padding: 0.25rem 0.55rem; border-radius: 6px; font-size: 0.65rem;
  font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.graph-controls button:hover { color: #b8b8cc; border-color: #4a4a58; }
.graph-controls button.active { color: #e0825c; border-color: #e0825c; }
.graph-svg-wrap { position: relative; }
.graph-svg { width: 100%; height: auto; display: block; }
.graph-tooltip {
  position: absolute; pointer-events: none;
  background: #18181f; border: 1px solid #2a2a35; border-radius: 6px;
  padding: 0.45rem 0.6rem; font-size: 0.7rem; color: #d4d4d8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  white-space: nowrap; z-index: 5;
}
.graph-tooltip .gt-date { color: #b8b8cc; font-size: 0.65rem; margin-bottom: 0.25rem; font-weight: 500; }
.graph-tooltip .gt-row { display: flex; align-items: center; gap: 0.4rem; line-height: 1.45; color: #8888a0; }
.graph-tooltip .gt-row strong { color: #e8e8f0; font-family: 'JetBrains Mono', monospace; font-weight: 600; margin-left: 0.15rem; }
.graph-tooltip .gt-sw { display: inline-block; width: 10px; height: 2px; }
.graph-tooltip .gt-sw.dashed { border-top: 2px dashed currentColor; height: 0; background: transparent !important; }
.graph-tooltip .gt-sw.dotted { border-top: 2px dotted currentColor; height: 0; background: transparent !important; }
.graph-tooltip .gt-sub { color: #5a5a6c; font-size: 0.6rem; margin-left: 0.2rem; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; padding: 0.6rem 0;
}
.setting-label { color: #d4d4d8; font-size: 0.78rem; }
.setting-hint  { color: #6b6b80; font-size: 0.66rem; margin-top: 0.15rem; }
.graph-legend {
  display: flex; gap: 1rem; font-size: 0.65rem; color: #6b6b80;
  margin-top: 0.4rem; flex-wrap: wrap;
}
.graph-legend .swatch { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 0.4rem; }
.graph-legend .swatch.dashed { border-top: 2px dashed currentColor; height: 0; }
.graph-legend .swatch.dotted { border-top: 2px dotted currentColor; height: 0; }
.graph-empty { color: #5a5a6c; font-size: 0.75rem; text-align: center; padding: 2rem; }

/* ---------- Settings overlay ---------- */

.overlay-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 100; display: none;
}
.overlay-backdrop.open { display: block; }
.overlay-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 100%; max-width: 420px;
  background: #131318; border-left: 1px solid #2a2a35;
  z-index: 101; padding: 1.5rem 1.2rem; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.2s ease-out;
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}
.overlay-panel.open { transform: translateX(0); }
.overlay-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.overlay-header h2 {
  font-size: 0.85rem; font-weight: 500; color: #e8e8f0;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.overlay-section { margin-bottom: 1.8rem; }
.overlay-section h3 {
  font-size: 0.65rem; color: #6b6b80; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.7rem;
}
.overlay-profile { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.8rem; }
.overlay-profile .avatar { width: 40px; height: 40px; }
.overlay-profile .name { font-size: 0.85rem; color: #e8e8f0; }
.overlay-profile .email { font-size: 0.7rem; color: #6b6b80; }

.connect-card {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1rem; text-align: center;
}
.connect-card p { color: #6b6b80; font-size: 0.75rem; margin-bottom: 0.8rem; }

.token-card {
  background: #1c1c25; border: 1px solid #2a2a35; border-radius: 10px;
  padding: 1rem;
}
.token-card h4 { font-size: 0.75rem; color: #e8e8f0; font-weight: 500; margin-bottom: 0.6rem; letter-spacing: 0.04em; }
.token-card .row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.token-card .row label { font-size: 0.65rem; color: #6b6b80; min-width: 50px; text-transform: uppercase; letter-spacing: 0.05em; }
.token-card code {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
  background: #131318; border: 1px solid #2a2a35; border-radius: 6px;
  padding: 0.4rem 0.6rem; color: #d4d4d8; overflow-x: auto; white-space: nowrap;
}
.token-card .hint { font-size: 0.65rem; color: #6b6b80; margin-top: 0.6rem; line-height: 1.4; }
.token-card .warn { color: #e0825c; }
.token-card .actions {
  display: flex; gap: 0.4rem; margin-top: 0.8rem; flex-wrap: wrap;
}

.danger { color: #d96868 !important; border-color: #5a2424 !important; }
.danger:hover { background: rgba(217,104,104,0.08) !important; }
