* { 
  box-sizing: border-box; 
  margin: 4px;
}
:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #60a5fa;
  --primary-2: #3b82f6;
  --accent: #34d399;
  --warning: #ef4444;
  --busy: #f59e0b;
  --study: #a78bfa;
  --completed: #10b981;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(180deg, #0b1022, #0f172a);
  color: var(--text);
}
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(17,24,39,0.8); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand { font-weight: 700; letter-spacing: 0.3px; }
.tabs { display: flex; gap: 8px; }
.tab-button {
  background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.tab-button.active { background: var(--primary-2); border-color: var(--primary-2); }
.tab-views { padding: 20px; max-width: 1200px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.seven { grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 16px; }
.row { display: flex; }
.row.gap { gap: 8px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { align-items: center; }
.stack { display: grid; gap: 8px; }
.stack.small { gap: 4px; }
.muted { color: var(--muted); }
.primary, .secondary, .warning, button, .tiny {
  border-radius: 8px; border: 1px solid transparent; color: var(--text);
  background: rgba(255,255,255,0.06); padding: 8px 12px; cursor: pointer;
}
.primary { background: var(--primary-2); }
.secondary { background: rgba(96,165,250,0.2); border-color: rgba(96,165,250,0.3); }
.warning { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); }
.tiny { padding: 4px 8px; font-size: 12px; }
input, select, textarea {
  background: #0b1020; color: var(--text); border: 1px solid rgba(255,255,255,0.12);
  padding: 10px 12px; border-radius: 8px; outline: none;
}
.progress { width: 100%; height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.3s ease; }
.list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.goal-item { padding: 8px; border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; }
.goal-item.completed { opacity: 0.8; border-color: rgba(16,185,129,0.45); background: rgba(16,185,129,0.08); }
.goal-item.completed .goal-title { text-decoration: line-through; color: #a7f3d0; }
.legend { display: flex; gap: 12px; margin-bottom: 8px; color: var(--muted); }
.legend-item { display: flex; gap: 6px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.busy { background: var(--busy); }
.dot.study { background: var(--study); }
.dot.completed { background: var(--completed); }

/* Week grid (hourly, gCal-like) */
#week-grid {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 8px;
  /* Single scroll container */
  max-height: 70vh;
  overflow-y: auto;
}
.day-col { display: grid; grid-template-rows: auto 1fr; gap: 6px; }
.day-head { text-align: center; font-weight: 600; color: var(--muted); }
.time-col { display: grid; grid-template-rows: auto 1fr; gap: 6px; }
.time-head { text-align: center; color: transparent; }
.time-body { position: relative; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); overflow: visible; }
.hour-label { position: absolute; left: 4px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.hour-line { position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,0.08); }
.day-body-hourly { position: relative; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); overflow: visible; }
.day-body-hourly::-webkit-scrollbar { display: none; }
.time-body::-webkit-scrollbar { display: none; }
.day-body-hourly { scrollbar-width: none; }
.time-body { scrollbar-width: none; }
.time-inner, .day-inner { position: relative; height: calc(24 * 48px); }
.slot { position: absolute; left: 2px; right: 2px; border-radius: 6px; font-size: 12px; padding: 4px; border: 1px solid rgba(255,255,255,0.12); color: var(--text); display:flex; align-items:flex-start; justify-content:flex-start; }
.slot.busy { background: rgba(245, 158, 11, 0.25); color: #fbbf24; border-color: rgba(245, 158, 11, 0.45); }
.slot.study { background: rgba(167, 139, 250, 0.28); color: #ede9fe; border-color: rgba(167, 139, 250, 0.5); cursor: pointer; }
.slot.completed { background: rgba(16, 185, 129, 0.28); color: #d1fae5; border-color: rgba(16, 185, 129, 0.55); }
.slot:hover.slot.study { outline: 2px solid rgba(255,255,255,0.2); }

/* Feed */
.feed { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; }
.post-item { border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 12px; background: rgba(255,255,255,0.03); }
.post-head { display:flex; justify-content: space-between; margin-bottom: 6px; }
.post-item .content { margin: 6px 0 8px; }
.post-item .actions { display: flex; gap: 8px; }
.comments { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.comments li { color: var(--muted); font-size: 14px; }
.comment-form input { flex: 1; }

.app-footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.06); color: var(--muted); }

/* Windows badges */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(96,165,250,0.18);
  border: 1px solid rgba(96,165,250,0.35);
  color: var(--text);
  padding: 4px 8px; border-radius: 999px; font-size: 12px;
}
.badge-x {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  padding: 0 2px; font-size: 14px; line-height: 1; border-radius: 4px;
}
.badge-x:hover { color: #fff; background: rgba(255,255,255,0.12); }
.badge-muted { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: var(--muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: grid; place-items: center; z-index: 1000;
}
.modal {
  width: min(720px, 92vw); background: var(--card); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* User tab pill with avatar */
.tab-button.user-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 6px 10px;
}
.tab-button.user-tab.active {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}
.tab-button.user-tab::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-block;
  background-size: cover;
  background-position: center;
  background-color: #334155; /* fallback */
  border: 1px solid rgba(255,255,255,0.25);
  /* Placeholder avatar (SVG) */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><defs/><circle cx="32" cy="32" r="32" fill="%235865F2"/><circle cx="32" cy="26" r="12" fill="%23ffffff" opacity="0.9"/><path d="M16 54c4-10 14-14 16-14s12 4 16 14" fill="%23ffffff" opacity="0.9"/></svg>');
}
