/* Circle — vanilla CSS, mobile-first.
   Aksen merah koral ala Path, latar terang, font sistem. */

:root {
  --coral: #E0393E;
  --coral-dark: #B92B30;
  --coral-soft: #FDECEC;
  --ink: #22222A;
  --muted: #8A8A94;
  --line: #ECECF0;
  --bg: #FAF7F5;
  --card: #FFFFFF;
  --green: #1F9D55;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.muted { color: var(--muted); font-size: 13px; }
.danger { color: var(--coral); }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.3px; }
.brand:hover { text-decoration: none; }
.brand-dot { color: var(--coral); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-icon { font-size: 18px; }
.topbar-icon:hover { text-decoration: none; }
.topbar-admin { font-size: 13px; font-weight: 600; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 999px; }
.topbar-admin:hover { text-decoration: none; }

/* Konten */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 12px 96px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(20, 20, 40, 0.05);
}
h1 { font-size: 22px; margin: 4px 0 12px; letter-spacing: -0.3px; }
h2 { font-size: 18px; margin: 18px 0 10px; }
h3 { font-size: 16px; margin: 0 0 10px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: #E6F7ED; color: #146C39; border: 1px solid #BDE8CC; }
.flash-err { background: var(--coral-soft); color: var(--coral-dark); border: 1px solid #F6C6C6; }

/* Form */
label { display: block; font-size: 13px; font-weight: 600; color: #55555F; margin: 10px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"],
input[type="file"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D9D9E0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--coral); outline-offset: 0; border-color: var(--coral); }
textarea { resize: vertical; min-height: 64px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 120px; }
.form-row .btn { flex: 0 0 auto; }
.form-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Tombol */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid #D9D9E0;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.btn:hover { text-decoration: none; background: #F4F4F6; }
.btn-primary { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-dark); }
.btn-danger { background: var(--coral-soft); border-color: #F0B9B9; color: var(--coral-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-link { background: none; border: none; padding: 2px 4px; font-size: 14px; cursor: pointer; color: var(--muted); }
.inline-form { display: inline; }

/* Avatar */
.avatar-img { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; }
.avatar-initial {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--coral); color: #fff; font-weight: 700;
  vertical-align: middle; flex: 0 0 auto;
}

/* Composer */
.composer-types { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.composer-type-btn {
  border: 1px solid var(--line); background: #F7F7F9; border-radius: 999px;
  padding: 7px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.composer-type-btn.active { background: var(--coral); border-color: var(--coral); color: #fff; }
.composer-panel { margin-bottom: 6px; }
.composer-panel input, .composer-panel textarea { margin-bottom: 8px; }

/* Kartu momen */
.moment-card { padding: 14px 14px 10px; }
.moment-head { display: flex; align-items: center; gap: 10px; }
.moment-head-text { flex: 1; min-width: 0; }
.moment-author { font-weight: 700; color: var(--ink); display: block; }
.moment-meta { font-size: 12px; color: var(--muted); display: block; }
.moment-type { font-size: 12px; background: #F4F4F6; border-radius: 999px; padding: 4px 8px; white-space: nowrap; }
.moment-body { margin-top: 10px; }
.moment-text { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }
.moment-photo { border-radius: 12px; width: 100%; display: block; margin: 4px 0 8px; }
.moment-location, .moment-music, .moment-sleep { margin: 4px 0 8px; font-size: 14px; }
.moment-views { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.moment-owner-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Reaksi */
.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.reaction-form { display: inline; }
.reaction-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 10px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.reaction-btn.active { background: var(--coral-soft); border-color: var(--coral); }
.reaction-count { font-size: 12px; color: var(--muted); }

/* Komentar */
.comments { margin-top: 10px; }
.comment { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.comment-body { flex: 1; min-width: 0; }
.comment-body p { margin: 2px 0 0; word-break: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; }

/* Daftar teman / user */
.user-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.user-row:first-of-type { border-top: none; }
.user-info { flex: 1; min-width: 0; }
.user-info .name { font-weight: 700; color: var(--ink); display: block; }
.user-info .sub { font-size: 13px; color: var(--muted); display: block; word-break: break-word; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.friend-counter { font-size: 20px; font-weight: 800; }
.friend-counter span { color: var(--coral); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab:hover { text-decoration: none; }
.status-pill { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #EEF2FF; color: #3B4CC0; }
.status-pill.friend { background: #E6F7ED; color: #146C39; }
.status-pill.blocked { background: var(--coral-soft); color: var(--coral-dark); }

/* Profil */
.profile-head { text-align: center; }
.profile-head .avatar-img, .profile-head .avatar-initial { margin-bottom: 8px; }
.profile-name { font-size: 20px; font-weight: 800; margin: 0; }
.profile-stats { display: flex; justify-content: center; gap: 24px; margin: 12px 0; }
.profile-stats b { display: block; font-size: 18px; }
.profile-stats span { font-size: 12px; color: var(--muted); }

/* Chat */
.chat-row { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink); }
.chat-row:first-of-type { border-top: none; }
.chat-row:hover { text-decoration: none; }
.chat-row .chat-info { flex: 1; min-width: 0; }
.chat-row .chat-title { font-weight: 700; display: block; }
.chat-row .chat-last { font-size: 13px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .chat-time { font-size: 12px; color: var(--muted); }
.unread-pill { background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 7px; }
.messages { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.message { max-width: 78%; padding: 9px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.message .msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.message .msg-text { word-break: break-word; }
.message.mine { align-self: flex-end; background: var(--coral); color: #fff; border-color: var(--coral); }
.message.mine .msg-meta { color: rgba(255, 255, 255, 0.8); }
.message.deleted { font-style: italic; color: var(--muted); background: #F4F4F6; }
.message-form { display: flex; gap: 8px; position: sticky; bottom: 76px; background: var(--bg); padding: 8px 0; }
.message-form input { flex: 1; }

/* Notifikasi */
.notif-row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); }
.notif-row:first-of-type { border-top: none; }
.notif-row.unread { background: var(--coral-soft); margin: 0 -14px; padding: 10px 14px; border-radius: 10px; }
.notif-row .notif-text { flex: 1; min-width: 0; }
.notif-row .notif-time { font-size: 12px; color: var(--muted); display: block; }

/* Admin */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-box b { display: block; font-size: 24px; color: var(--coral); }
.stat-box span { font-size: 12px; color: var(--muted); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* Paginasi */
.pagination { display: flex; justify-content: space-between; gap: 10px; margin: 16px 0; }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.invite-box { background: var(--coral-soft); border: 1px solid #F6C6C6; }

/* Bottom nav ala HP */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: 11px; padding: 2px 8px; position: relative; }
.nav-item:hover { text-decoration: none; }
.nav-item.active { color: var(--coral); font-weight: 700; }
.nav-icon { font-size: 20px; line-height: 1.2; position: relative; }
.nav-label { margin-top: 1px; }
.badge {
  position: absolute; top: -4px; right: -10px;
  background: var(--coral); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; min-width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Halaman auth */
.auth-card { margin-top: 24px; }
.auth-logo { text-align: center; font-size: 34px; font-weight: 800; margin: 24px 0 4px; }
.auth-logo span { color: var(--coral); }
.auth-tagline { text-align: center; color: var(--muted); margin: 0 0 8px; }

@media (min-width: 640px) {
  .container { padding-left: 16px; padding-right: 16px; }
}

/* Banner install / update PWA — melayang di atas bottom nav */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 6px 24px rgba(20, 20, 40, 0.14);
  padding: 10px 12px;
}
.pwa-banner[hidden] { display: none; }
.pwa-banner-icon { border-radius: 12px; flex-shrink: 0; }
.pwa-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.pwa-banner-text strong { font-size: 14px; }
.pwa-banner-text span { color: var(--muted); }
