* {
  box-sizing: border-box;
}

:root {
  --surface: #ffffff;
  --surface-2: #f6f4fb;
  --ink: #14101f;
  --muted: #6b7280;
  --faint: #9a94a8;
  --line: #eae5f5;
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-soft: #f1ebfe;
  --accent-contrast: #ffffff;
  --sponsor: #0d9488;
  --sponsor-soft: #e6f6f4;
  --rose: #e11d48;
  --bubble-other-bg: #f3f2f8;
  --bubble-other-text: #2b2438;
  --shadow-color: rgba(30, 20, 60, 0.22);
  --page-bg: radial-gradient(circle at 15% 0%, #efe9ff 0%, transparent 55%),
    radial-gradient(circle at 100% 20%, #e3f3ff 0%, transparent 50%),
    linear-gradient(170deg, #faf9fd 0%, #f3f2fa 55%, #eef0fb 100%);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #1b1725;
    --surface-2: #241f31;
    --ink: #f2effa;
    --muted: #aba5bc;
    --faint: #756e8a;
    --line: #322c42;
    --accent: #9061f9;
    --accent-2: #7c3aed;
    --accent-soft: rgba(144, 97, 249, 0.18);
    --accent-contrast: #ffffff;
    --sponsor: #2dd4bf;
    --sponsor-soft: rgba(45, 212, 191, 0.16);
    --bubble-other-bg: #2a2436;
    --bubble-other-text: #e9e5f4;
    --shadow-color: rgba(0, 0, 0, 0.45);
    --page-bg: radial-gradient(circle at 15% 0%, #241d3a 0%, transparent 55%),
      radial-gradient(circle at 100% 20%, #1c2436 0%, transparent 50%),
      linear-gradient(170deg, #100d18 0%, #14111e 55%, #100d18 100%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --surface: #1b1725;
  --surface-2: #241f31;
  --ink: #f2effa;
  --muted: #aba5bc;
  --faint: #756e8a;
  --line: #322c42;
  --accent: #9061f9;
  --accent-2: #7c3aed;
  --accent-soft: rgba(144, 97, 249, 0.18);
  --accent-contrast: #ffffff;
  --sponsor: #2dd4bf;
  --sponsor-soft: rgba(45, 212, 191, 0.16);
  --bubble-other-bg: #2a2436;
  --bubble-other-text: #e9e5f4;
  --shadow-color: rgba(0, 0, 0, 0.45);
  --page-bg: radial-gradient(circle at 15% 0%, #241d3a 0%, transparent 55%),
    radial-gradient(circle at 100% 20%, #1c2436 0%, transparent 50%),
    linear-gradient(170deg, #100d18 0%, #14111e 55%, #100d18 100%);
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease;
}

.hidden {
  display: none !important;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* Overlay untuk login */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 16, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}

.overlay-box {
  background: var(--surface);
  padding: 40px 34px 34px;
  border-radius: var(--radius-lg);
  text-align: center;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 30px 60px -15px var(--shadow-color);
  border: 1px solid var(--line);
}

.overlay-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
}

.overlay-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.overlay-box h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.overlay-tagline {
  margin: 0 0 24px;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.overlay-box input {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 12px;
  transition: border-color 0.15s, background 0.15s;
}

.overlay-box input::placeholder {
  color: var(--faint);
}

.overlay-box input:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

.overlay-box button {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  box-shadow: 0 10px 20px -8px rgba(124, 58, 237, 0.55);
}

.overlay-box button:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.overlay-box button:active {
  transform: translateY(0) scale(0.98);
}

.google-btn {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1.5px solid var(--line) !important;
  box-shadow: 0 1px 2px rgba(20, 16, 31, 0.05) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-btn:hover {
  background: var(--surface-2) !important;
  transform: none;
}

.google-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.overlay-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overlay-divider::before,
.overlay-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.overlay-note {
  margin: 16px 0 0;
  font-size: 0.76rem;
  color: var(--faint);
  line-height: 1.5;
}

/* App shell */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 920px;
  height: min(100vh - 40px, 880px);
  height: min(100dvh - 40px, 880px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px -20px var(--shadow-color);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  flex: none;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-family: "SFMono-Regular", "Menlo", monospace;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex: none;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: block;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

.user-badge {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

@media (min-width: 560px) {
  .user-badge {
    display: flex;
  }
}

.online-wrap {
  position: relative;
}

.online-info {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.online-info:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.online-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 170px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 32px -10px var(--shadow-color);
  border: 1px solid var(--line);
  padding: 10px 0;
  z-index: 5;
}

.online-panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  padding: 4px 16px 8px;
}

.online-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.online-panel li {
  padding: 7px 16px;
  font-size: 0.86rem;
  color: var(--ink);
}

.online-panel li:hover {
  background: var(--surface-2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Body layout: side-nav + content */
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.side-nav {
  flex: none;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.tab-btn,
.logout-btn {
  width: 100%;
  padding: 10px 4px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tab-icon {
  width: 21px;
  height: 21px;
}

.tab-btn:hover,
.logout-btn:hover {
  color: var(--accent-2);
  background: var(--accent-soft);
}

.tab-btn.active {
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.logout-btn {
  margin-top: auto;
  color: var(--rose);
}

.logout-btn:hover {
  background: rgba(225, 29, 72, 0.1);
  color: var(--rose);
}

.tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
}

.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tab-panel.active {
  display: flex;
}

.empty-state {
  margin: 30px auto;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
  max-width: 260px;
  line-height: 1.5;
}

/* Feed: post form */
.post-form {
  flex: none;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-form textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  resize: none;
  transition: border-color 0.15s, background 0.15s;
}

.post-form textarea::placeholder {
  color: var(--faint);
}

.post-form textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

.post-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-image-name {
  flex: 1;
  font-size: 0.76rem;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-submit-btn {
  margin-left: auto;
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 8px 18px -8px rgba(124, 58, 237, 0.55);
}

.post-submit-btn:hover {
  transform: translateY(-1px);
}

.post-submit-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.google-btn:disabled,
#guest-signin-btn:disabled,
.logout-btn:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* Panel terkunci (guest coba akses fitur yang butuh Google login) */
.locked-panel {
  flex: none;
  margin: 18px 24px;
  padding: 22px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.locked-panel svg {
  width: 26px;
  height: 26px;
  color: var(--faint);
}

.locked-panel p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.5;
}

.locked-signin-btn {
  margin-top: 4px;
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.12s;
}

.locked-signin-btn:hover {
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  background: var(--ink);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 16px 32px -10px var(--shadow-color);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(90vw, 380px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--rose);
  color: #ffffff;
}

/* Feed: post list */
.feed-list {
  list-style: none;
  margin: 0;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-2);
  flex: 1;
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(20, 16, 31, 0.04);
  animation: post-in 0.25s ease;
}

@keyframes post-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card.sponsored {
  border: 1.5px solid var(--sponsor);
  background: linear-gradient(180deg, var(--sponsor-soft), var(--surface) 40%);
}

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.post-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.post-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.post-author-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sponsor-badge {
  background: var(--sponsor);
  color: #ffffff;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex: none;
}

.post-time {
  font-size: 0.72rem;
  color: var(--faint);
  flex: none;
}

.post-text {
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
  margin-bottom: 10px;
}

.post-image {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.sponsor-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sponsor);
  text-decoration: none;
}

.sponsor-link:hover {
  text-decoration: underline;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.post-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.12s;
}

.post-action-btn:hover {
  color: var(--accent-2);
}

.post-action-btn.liked {
  color: var(--rose);
}

.like-icon {
  font-size: 1rem;
}

.view-count {
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--faint);
  font-weight: 600;
}

.comment-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.comment-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.comment-list li {
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.45;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 8px;
}

.comment-form {
  display: flex;
  gap: 8px;
}

.comment-form input {
  flex: 1;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  transition: border-color 0.15s, background 0.15s;
}

.comment-form input:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

.comment-form button {
  border: none;
  background: var(--accent-2);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* Dashboard */
.dashboard-summary {
  display: flex;
  gap: 12px;
  padding: 20px 24px 6px;
  flex: none;
}

.stat-card {
  flex: 1;
  background: linear-gradient(160deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-heading {
  margin: 22px 24px 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.my-posts-list {
  list-style: none;
  margin: 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.my-post-row {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.my-post-text {
  font-size: 0.85rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-post-stats {
  font-size: 0.76rem;
  color: var(--faint);
  font-weight: 600;
  flex: none;
}

.admin-panel {
  margin: 26px 24px 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* Tab "Aplikasi" -- install PWA / add to home screen */
.app-install-card {
  max-width: 420px;
  margin: 40px auto;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.app-install-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px -10px var(--shadow-color);
  margin-bottom: 10px;
}

.app-install-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.app-install-desc {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.app-install-btn {
  padding: 11px 28px;
  font-size: 0.88rem;
}

.app-install-state {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--sponsor-soft);
  color: var(--sponsor);
  font-size: 0.83rem;
  font-weight: 700;
}

.app-install-state svg {
  width: 17px;
  height: 17px;
}

.app-install-instructions {
  margin-top: 6px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

.app-install-instructions p {
  margin: 0 0 6px;
}

.app-install-instructions-label {
  font-weight: 700;
  color: var(--ink);
}

.app-install-instructions ol {
  margin: 0;
  padding-left: 18px;
}

.sponsor-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.sponsor-form input,
.sponsor-form textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  resize: none;
  transition: border-color 0.15s, background 0.15s;
}

.sponsor-form input:focus,
.sponsor-form textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

/* Chat */
.messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--surface-2);
}

.msg {
  max-width: 75%;
  padding: 10px 15px;
  border-radius: 17px;
  background: var(--bubble-other-bg);
  word-wrap: break-word;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg.own {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  align-self: flex-end;
  border-bottom-left-radius: 17px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 18px -6px rgba(124, 58, 237, 0.45);
}

.msg .meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 3px;
}

.msg .name {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--accent-2);
}

.msg.own .name {
  color: rgba(255, 255, 255, 0.85);
}

.msg .time {
  font-size: 0.7rem;
  color: var(--faint);
}

.msg.own .time {
  color: rgba(255, 255, 255, 0.65);
}

.msg-delete-btn {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.msg-delete-btn:hover {
  background: var(--rose);
  color: #ffffff;
}

.msg.own .msg-delete-btn {
  color: rgba(255, 255, 255, 0.65);
}

.msg .text {
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--bubble-other-text);
}

.msg.own .text {
  color: #ffffff;
}

.msg.sticker {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.msg.sticker.own {
  background: transparent;
  box-shadow: none;
}

.sticker-emoji {
  font-size: 3.2rem;
  line-height: 1;
}

.msg.sticker .name,
.msg.sticker.own .name {
  color: var(--accent-2);
}

.msg.sticker .time,
.msg.sticker.own .time {
  color: var(--faint);
}

.msg.image {
  padding: 5px;
  background: var(--surface-2);
}

.msg.image.own {
  background: var(--accent-soft);
}

.msg-image {
  display: block;
  max-width: 240px;
  max-height: 280px;
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.msg-image:hover {
  opacity: 0.92;
}

.message-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex: none;
}

.icon-btn {
  flex: none;
  height: 42px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: var(--accent);
}

.icon-btn:active {
  transform: scale(0.97);
}

.round-icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
}

.round-icon-btn svg {
  width: 18px;
  height: 18px;
}

.round-icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: var(--accent);
}

.round-icon-btn:active {
  transform: scale(0.95);
}

.sticker-wrap {
  position: relative;
  flex: none;
}

.sticker-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 244px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 32px -10px var(--shadow-color);
  padding: 10px;
  z-index: 5;
}

.sticker-item {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.sticker-item:hover {
  background: var(--surface-2);
}

.message-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s;
}

.message-form input::placeholder {
  color: var(--faint);
}

.message-form input:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

.send-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 8px 18px -8px rgba(124, 58, 237, 0.55);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.send-btn:hover {
  transform: translateY(-1px);
}

.send-btn:active {
  transform: translateY(0) scale(0.94);
}

/* Scrollbar tipis biar nyatu sama desain */
.messages::-webkit-scrollbar,
.feed-list::-webkit-scrollbar,
.tab-panel::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb,
.feed-list::-webkit-scrollbar-thumb,
.tab-panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

/* ---------- Moderation (ban) ---------- */
.overlay-box select {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 12px;
  transition: border-color 0.15s, background 0.15s;
}

.overlay-box select:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
}

.kick-modal-actions {
  display: flex;
  gap: 10px;
}

.kick-modal-actions button {
  flex: 1;
}

.modal-cancel-btn {
  background: var(--surface-2) !important;
  color: var(--ink) !important;
  border: 1.5px solid var(--line) !important;
  box-shadow: none !important;
}

.kick-modal-actions .post-submit-btn {
  background: linear-gradient(135deg, var(--rose), #be123c) !important;
  box-shadow: 0 10px 20px -8px rgba(225, 29, 72, 0.5) !important;
}

.ban-banner {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(225, 29, 72, 0.12);
  border-bottom: 1px solid var(--rose);
  color: var(--rose);
  font-size: 0.82rem;
  font-weight: 600;
}

.ban-banner button {
  flex: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rose);
  background: transparent;
  color: var(--rose);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ban-banner button:hover {
  background: var(--rose);
  color: #ffffff;
}

/* Form kirim (chat/post/komentar) di-disable beneran (bukan cuma buram)
   pas lagi di-kick -- lihat updateBanUi() di main.js. Style ini cuma buat
   ngasih tau visual, enforcement sesungguhnya tetap di firestore.rules. */
.message-form input:disabled,
.message-form button:disabled,
.post-form textarea:disabled,
.post-form button:disabled,
.comment-form input:disabled,
.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Room chat ---------- */
.room-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}

.room-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.room-chips::-webkit-scrollbar {
  display: none;
}

.room-chip {
  flex: none;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.room-chip:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.room-chip.active {
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.room-header-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-header-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.room-header-actions .icon-btn {
  height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
}

/* Kotak putih tetap (bukan ngikut var(--surface)) -- QR butuh kontras
   hitam-di-atas-putih biar gampang di-scan kamera walau lagi dark theme. */
.qr-box {
  width: 200px;
  height: 200px;
  margin: 4px auto 16px;
  padding: 14px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  body {
    padding: 0;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    max-width: none;
  }

  .app-header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .app-header h1 {
    font-size: 1.05rem;
  }

  .app-body {
    flex-direction: column;
  }

  .tab-content {
    order: 1;
  }

  .side-nav {
    order: 2;
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--line);
  }

  .tab-btn,
  .logout-btn {
    flex: 1;
    padding: 8px 2px;
  }

  .logout-btn {
    margin-top: 0;
  }

  .post-form,
  .dashboard-summary,
  .dashboard-heading,
  .my-posts-list,
  .admin-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .app-install-card {
    margin: 24px 16px;
  }

  .feed-list {
    padding: 14px 16px;
  }

  .messages {
    padding: 16px;
  }

  .room-bar,
  .room-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .message-form {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .msg {
    max-width: 86%;
  }

  .post-image {
    max-height: 280px;
  }

  .dashboard-summary {
    flex-wrap: wrap;
  }

  .stat-card {
    min-width: 30%;
  }
}
