:root {
  --bg: #0d0f12;
  --surface: #161a20;
  --surface-2: #1d222a;
  --border: #262c36;
  --text: #e6e8eb;
  --muted: #8a94a3;
  --accent: #6ea8fe;
  --pos: #4ade80;
  --neg: #f87171;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(13,15,18,0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ea8fe, #c084fc);
  box-shadow: 0 0 12px rgba(110,168,254,0.6);
}
.back {
  color: var(--muted);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.h1 { font-size: 20px; margin: 0 0 10px; font-weight: 700; }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.error {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
}

/* Add form */
.add-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.add-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.add-form input:focus {
  outline: none;
  border-color: var(--accent);
}
button {
  background: var(--accent);
  color: #0a0d12;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
button:hover { filter: brightness(1.08); }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }
button.ghost.danger:hover { color: var(--danger); border-color: var(--danger); }

/* Account list */
.account-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.account-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  color: var(--text);
}
.account-main:hover { text-decoration: none; }
.account-meta .username { font-weight: 600; font-size: 15px; }
.account-meta .sub { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 8px; }
.row-actions form { display: inline; }

.syncing {
  color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* Avatars */
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.avatar.lg { width: 96px; height: 96px; }
.avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
}
.avatar.placeholder.sm { width: 44px; height: 44px; font-size: 14px; }

/* Profile head */
.profile-head {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 4px 0;
}
.profile-meta { flex: 1; }
.counts {
  display: flex;
  gap: 22px;
  margin: 10px 0 6px;
}
.counts div { display: flex; flex-direction: column; }
.counts strong { font-size: 18px; }
.counts span { font-size: 12px; color: var(--muted); }

/* Two-column grid */
.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .grid-two { grid-template-columns: 1fr; }
}

/* People grid */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}
.people-grid.full { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 11px;
  text-align: center;
  word-break: break-all;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.12s;
}
.person:hover { background: var(--surface-2); text-decoration: none; }
.person img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}
.person span { color: var(--muted); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.day {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 18px;
}
.day-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding-top: 4px;
  border-right: 1px solid var(--border);
  padding-right: 14px;
}
.day-body { display: flex; flex-direction: column; gap: 14px; }
.diff-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.diff-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.diff-head .dir { font-weight: 600; color: var(--text); }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.pill.pos { background: rgba(74,222,128,0.15); color: var(--pos); }
.pill.neg { background: rgba(248,113,113,0.15); color: var(--neg); }

.diff-row { display: flex; gap: 12px; margin-top: 6px; }
.diff-tag {
  flex: 0 0 64px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  height: fit-content;
}
.diff-tag.pos { background: rgba(74,222,128,0.15); color: var(--pos); }
.diff-tag.neg { background: rgba(248,113,113,0.15); color: var(--neg); }
.diff-row .people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.diff-row .person { padding: 4px; }
.diff-row .person img, .diff-row .person .avatar { width: 40px; height: 40px; }

@media (max-width: 700px) {
  .day { grid-template-columns: 1fr; }
  .day-label { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 6px; }
}

/* Header right-side: user chip, settings, logout */
.top-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.user-chip .email { opacity: 0.85; }
.user-chip .ig-handle { color: var(--pos); font-weight: 600; }
.user-chip .warn { color: var(--neg); font-weight: 600; }
.user-chip .nav-link { color: var(--muted); }
.user-chip .nav-link:hover { color: var(--text); }
.inline-form { display: inline; }

button.xs { padding: 5px 9px; font-size: 11px; }

/* Auth + settings forms */
.auth-card {
  max-width: 400px;
  margin: 60px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 28px 22px;
}
.auth-card .h1 { margin-bottom: 18px; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.stack-form label { display: flex; flex-direction: column; gap: 5px; }
.stack-form label > span { font-size: 12px; color: var(--muted); }
.stack-form input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.stack-form input:focus { outline: none; border-color: var(--accent); }
.stack-form button { margin-top: 4px; padding: 12px; }

.small { font-size: 12px; }

.error-banner, .success-banner {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.error-banner   { background: rgba(248,113,113,0.12); color: var(--neg); border: 1px solid rgba(248,113,113,0.35); }
.success-banner { background: rgba(74,222,128,0.10); color: var(--pos); border: 1px solid rgba(74,222,128,0.30); }

.status-row {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 4px 0 16px;
  font-size: 13px;
}
.status-row.good { background: rgba(74,222,128,0.10); color: var(--pos); border: 1px solid rgba(74,222,128,0.25); }
.status-row.bad  { background: rgba(248,113,113,0.10); color: var(--neg); border: 1px solid rgba(248,113,113,0.25); }
