/* Orbit -- design tokens */
:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1e1e24;
  --border: #2a2a32;
  --accent: #7c6af7;
  --accent-dim: rgba(124, 106, 247, 0.15);
  --text: #e8e8f0;
  --text-2: #888898;
  --text-3: #555560;
  --danger: #e05c5c;
  --success: #4caf7d;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 150ms ease;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
p, li { line-height: 1.55; }
small { font-size: 0.78rem; color: var(--text-2); }

/* ── Layout ──────────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 80px;
}

/* ── Header ──────────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar .wordmark {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.top-bar .wordmark span {
  color: var(--accent);
}

/* ── Offline badge ───────────────────────────────────────── */
#offline-badge {
  display: none;
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 20px;
  z-index: 100;
}
body.offline #offline-badge { display: block; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

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

/* ── Person list ─────────────────────────────────────────── */
.people-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
}

.person-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.person-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.person-meta { flex: 1; min-width: 0; }
.person-name { font-weight: 600; font-size: 0.95rem; }
.person-sub { font-size: 0.78rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.person-arrow { color: var(--text-3); font-size: 1.1rem; }

/* ── Profile view ────────────────────────────────────────── */
.profile-header {
  padding: 24px 20px 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  border: 2px solid var(--border);
  overflow: hidden;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info { flex: 1; }
.profile-name { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-blurb { color: var(--text-2); font-size: 0.85rem; margin-top: 4px; line-height: 1.5; }
.profile-met { font-size: 0.75rem; color: var(--text-3); margin-top: 6px; }

/* ── Sections ────────────────────────────────────────────── */
.section {
  padding: 0 20px;
  margin-bottom: 20px;
}

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

/* ── Detail chips ────────────────────────────────────────── */
.detail-group { margin-bottom: 12px; }
.detail-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 6px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.82rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip.likes { border-color: rgba(76, 175, 125, 0.3); background: rgba(76, 175, 125, 0.08); }
.chip.dislikes { border-color: rgba(224, 92, 92, 0.3); background: rgba(224, 92, 92, 0.08); }
.chip.important { border-color: rgba(124, 106, 247, 0.4); background: var(--accent-dim); }

.chip-remove {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.chip-remove:hover { color: var(--danger); }

/* ── Log ─────────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 8px; }

.log-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.log-date { font-size: 0.72rem; color: var(--text-3); font-family: var(--font-mono); margin-bottom: 4px; }
.log-content { font-size: 0.88rem; line-height: 1.55; }

/* ── Reminders ───────────────────────────────────────────── */
.reminder-list { display: flex; flex-direction: column; gap: 8px; }

.reminder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.reminder-date { font-size: 0.72rem; font-family: var(--font-mono); color: var(--accent); flex-shrink: 0; }
.reminder-label { flex: 1; font-size: 0.88rem; }
.reminder-person { font-size: 0.72rem; color: var(--text-3); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), background var(--transition);
  font-family: var(--font-body);
}

.btn:active { opacity: 0.8; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(224,92,92,0.3); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; display: flex; align-items: center; }

/* ── FAB (floating action button) ───────────────────────── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 106, 247, 0.4);
  z-index: 20;
  transition: transform var(--transition), box-shadow var(--transition);
}
.fab:active { transform: scale(0.94); }

/* ── Modal / Sheet ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

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

.modal-sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  padding: 20px;
  max-height: 85dvh;
  overflow-y: auto;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

/* ── Form fields ─────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.78rem; color: var(--text-2); margin-bottom: 5px; }

input[type=text],
input[type=date],
input[type=url],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

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

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

/* ── Empty states ────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
  padding: 24px 0;
}

/* ── Back nav ────────────────────────────────────────────── */
.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

/* ── Reminders badge on home ─────────────────────────────── */
.reminders-banner {
  margin: 12px 20px 0;
  background: var(--accent-dim);
  border: 1px solid rgba(124,106,247,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
}

.reminders-banner .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 2px; }
.reminders-banner .count { font-size: 0.88rem; }

/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.hidden { display: none !important; }