:root {
  color-scheme: light;
  --blue: #1877F2;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #050505;
  --muted: #65676b;
  --border: #e4e6eb;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: transform 0.2s ease;
}
.ptr-spinner.material-symbols-outlined {
  font-size: 22px;
  color: var(--muted);
  transition: transform 0.15s ease, color 0.15s ease;
}
.ptr-indicator.ptr-ready .ptr-spinner {
  color: var(--blue);
  transform: rotate(180deg);
}
.ptr-indicator.ptr-loading .ptr-spinner {
  color: var(--blue);
  animation: ptrSpin 0.7s linear infinite;
}
@keyframes ptrSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  display: inline-block;
  color: inherit;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.mini { font-size: 16px; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color-scheme: light;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body.dashboard-active,
body.dashboard-active .app {
  background: var(--card);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 64px;
  overflow-x: hidden;
  position: relative;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  color: var(--text);
  flex-shrink: 0;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.square svg { width: 24px; height: 24px; }
.icon-btn.square .material-symbols-outlined {
  border: 1.6px solid currentColor;
  border-radius: 7px;
  padding: 1px;
  box-sizing: content-box;
  font-size: 20px;
}
.icon-btn.badge::after {
  content: attr(data-count);
  position: absolute;
  top: -2px;
  right: -2px;
  background: #e41e3f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: 8px;
  max-height: 80px;
  overflow: hidden;
  transition: max-height 0.28s ease, padding-top 0.28s ease, padding-bottom 0.28s ease, opacity 0.2s ease;
}
.topbar.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}
.logo {
  color: var(--blue);
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
  flex: 1;
}
.topbar-icon { width: 28px; height: 28px; object-fit: contain; }
.topbar-icon.messenger-icon { width: 32px; height: 32px; }
.topbar-actions {
  display: flex;
  gap: 6px;
}

/* Sub nav */
.subnav {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 52px;
  z-index: 9;
  transition: top 0.28s ease;
}
body.dashboard-active .subnav { top: 0; }
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab svg { width: 24px; height: 24px; }
.reels-icon { width: 24px; height: 24px; object-fit: contain; }
.reels-svg { width: 24px; height: 24px; color: inherit; }
.nav-icon { width: 25px; height: 25px; object-fit: contain; filter: grayscale(1) brightness(0.35); transition: filter 0.15s ease; }
.tab.active .nav-icon,
.bnav-item.active .nav-icon {
  filter: invert(29%) sepia(94%) saturate(3013%) hue-rotate(202deg) brightness(97%) contrast(101%);
}
.notif-icon.material-symbols-outlined { font-size: 27px; }
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.6px solid currentColor;
  border-radius: 7px;
  padding: 2px;
}
.icon-box .material-symbols-outlined { font-size: 18px; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab.badge-dot { position: relative; }
.tab.badge-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 30%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e41e3f;
  border: 1.5px solid var(--card);
}
.tab-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.feed { padding: 8px 0; }

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes slideOutLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}
@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}
.feed, .dashboard {
  position: relative;
  background: inherit;
}
.slide-in-right { animation: slideInRight 0.28s ease-out; }
.slide-in-left { animation: slideInLeft 0.28s ease-out; }
.slide-out-left {
  animation: slideOutLeft 0.28s ease-out;
  position: absolute;
  top: 0; left: 0; right: 0;
}
.slide-out-right {
  animation: slideOutRight 0.28s ease-out;
  position: absolute;
  top: 0; left: 0; right: 0;
}

/* Composer */
.composer {
  background: var(--card);
  margin-bottom: 8px;
  padding: 10px 12px;
}
.composer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.composer-row input {
  flex: 1;
  border: none;
  background: var(--bg);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--muted);
}
.composer-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.composer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.icon-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-circle svg { width: 14px; height: 14px; }
.icon-circle .material-symbols-outlined { color: #fff; }
.icon-circle.blue { background: var(--blue); }
.icon-circle.purple { background: #833ab4; }
.icon-circle.green { background: #45bd62; }

/* Stories */
.stories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: var(--card);
  padding: 10px 12px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }
.story {
  position: relative;
  flex: 0 0 100px;
  height: 195px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}
.story img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story p {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.story .ring {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--blue);
}
.create-stack {
  flex: 0 0 108px;
  height: 195px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.create-mini {
  flex: 1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
}
.create-mini .material-symbols-outlined { font-size: 26px; }
.create-mini p { margin: 0; font-size: 12.5px; font-weight: 700; text-align: center; }
.create-mini-story {
  background: linear-gradient(135deg, #4f7bf0, #2f56c9);
}
.create-mini-reel {
  background: linear-gradient(135deg, #e0703f, #c0392b);
}

/* Reels row */
.reels-row {
  background: var(--card);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.reels-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 8px;
}
.reels-header a {
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.reels-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.reels-scroll::-webkit-scrollbar { display: none; }
.reel-card {
  flex: 0 0 110px;
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
.reel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.reel-avatar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
}
.reel-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Post */
.post {
  background: var(--card);
  margin-bottom: 8px;
  padding-bottom: 4px;
}
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.page-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.post-meta { flex: 1; min-width: 0; }
.page-name {
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.verified.material-symbols-outlined { font-size: 16px; color: var(--blue); flex-shrink: 0; }
.post-time {
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.globe.material-symbols-outlined { font-size: 13px; color: var(--muted); }
.close-btn {
  color: var(--muted);
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn .material-symbols-outlined { font-size: 20px; }
.post-text {
  padding: 0 12px 10px;
  font-size: 15px;
  line-height: 1.4;
}
.more-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}
.translate-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.translate-icon.material-symbols-outlined { font-size: 15px; }
.post-media {
  width: 100%;
}
.post-media img {
  width: 100%;
  display: block;
}

/* Bottom nav */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 6px 0;
  z-index: 10;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  position: relative;
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-item .reels-icon { width: 22px; height: 22px; }
.bnav-item .reels-svg { width: 22px; height: 22px; }
.bnav-item .nav-icon { width: 23px; height: 23px; }
.bnav-item .notif-icon.material-symbols-outlined { font-size: 23px; }
.bnav-item .icon-box .material-symbols-outlined { font-size: 16px; }
.bnav-item.active { color: var(--blue); }
.bnav-item .tab-avatar { width: 22px; height: 22px; }
.bnav-item.badge[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -2px;
  right: 22%;
  background: #e41e3f;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
}

/* Professional Dashboard */
.dashboard { padding: 8px 0 16px; background: var(--card); min-height: 100%; }
.dash-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 8px;
}
.dash-header h2 { font-size: 22px; font-weight: 800; margin: 0; flex: 1; }
.dash-back.material-symbols-outlined { font-size: 24px; }
.dash-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.dash-pills {
  display: flex;
  gap: 8px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.dash-pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.pill.active { background: #d8e6fd; color: var(--blue); }

.dash-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.dash-profile-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.dash-profile img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.dash-avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 16px;
  color: #45bd62;
  background: var(--card);
  border-radius: 50%;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.dash-profile-name {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.chevron.material-symbols-outlined { font-size: 20px; color: var(--muted); }
.dash-profile-sub {
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.dash-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}
.banner-icon.material-symbols-outlined { font-size: 26px; flex-shrink: 0; }
.banner-icon.blue-icon { color: var(--blue); }
.banner-icon.purple-icon { color: #833ab4; }

.dash-section-header { padding: 16px 16px 4px; }
.dash-section-header h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.dash-tabs {
  display: flex;
  gap: 18px;
  padding: 8px 16px 12px;
  font-size: 14px;
  color: var(--muted);
}
.dtab.active { color: var(--blue); font-weight: 700; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 16px 8px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat-label { color: var(--muted); font-size: 13.5px; }
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 21px;
  font-weight: 700;
  margin-top: 4px;
}
.stat-up { color: #22b04c; font-size: 13.5px; font-weight: 700; }
.stat-flat { color: var(--muted); font-size: 13.5px; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.dash-label { padding: 0 16px 8px; color: var(--muted); font-size: 14px; }
.content-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 0 16px 16px;
}
.content-card {
  width: 150px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.content-thumb-wrap { position: relative; }
.content-thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.content-video-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 18px;
  color: #fff;
  background: rgba(0,0,0,0.45);
  border-radius: 4px;
  padding: 2px;
}
.content-link {
  padding: 8px 8px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.content-time {
  padding: 0 8px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.content-time .material-symbols-outlined { font-size: 13px; }

.content-stats-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat-card-row .stat-value { font-size: 18px; margin-top: 3px; }

