/* =====================
   LAYOUT
   ===================== */
.page {
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: 80px;
  padding-left: var(--page-px);
  padding-right: var(--page-px);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.container--wide {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* =====================
   NAVBAR
   ===================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}

.navbar__logo {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  flex-shrink: 0;
}

.navbar__logo span { color: var(--text); }

.navbar__links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.navbar__link { color: #aaaaaa !important;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.navbar__link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.navbar__link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.navbar__link .icon {
  font-size: 1rem;
  line-height: 1;
}

.navbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  object-fit: cover;
  transition: border-color var(--t-fast);
}

.navbar__avatar:hover { border-color: var(--accent); }

/* Mobile nav bottom */
.nav-bottom {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-top: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}

.nav-bottom__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--t-fast);
}

.nav-bottom__item .icon { font-size: 1.3rem; }

.nav-bottom__item.active { color: var(--accent); }

@media (max-width: 600px) {
  .navbar__links { display: none; }
  .nav-bottom { display: flex; }
  .page { padding-bottom: 80px; }
}

/* =====================
   BUTTONS
   ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:active { transform: scale(0.96); }

.btn--primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-2);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface);
  transform: scale(1.02);
}

.btn--danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: transparent;
}

.btn--danger:hover {
  background: var(--danger);
  color: #fff;
  transform: scale(1.02);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.btn--full { width: 100%; }

.btn--loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn--loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* =====================
   INPUTS
   ===================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  width: 100%;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.input::placeholder { color: var(--text-dim); }

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

.textarea {
  resize: vertical;
  min-height: 80px;
}

/* =====================
   CARDS
   ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t-fast);
}

.card:hover { border-color: var(--border-2); }

/* =====================
   POST CARD
   ===================== */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--t-fast);
}

.post-card:hover { border-color: var(--border-2); }

.post-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  object-fit: cover;
  flex-shrink: 0;
}

.avatar--sm {
  width: 32px;
  height: 32px;
}

.avatar--lg {
  width: 72px;
  height: 72px;
  border-width: 2px;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-sans);
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  font-size: 0.8rem;
}

.post-card__author {
  flex: 1;
  min-width: 0;
}

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

.post-card__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.post-card__content {
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-card__image {
  width: 100%;
  border-radius: var(--radius-sm);
  max-height: 400px;
  object-fit: cover;
  margin-bottom: 12px;
  background: var(--surface-2);
}

.post-card__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: color var(--t-fast), background var(--t-fast);
  cursor: pointer;
  background: none;
  border: none;
}

.action-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

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

/* =====================
   COMPOSE (criar post)
   ===================== */
.compose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.compose__row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.compose__textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.55;
  resize: none;
  min-height: 52px;
  max-height: 200px;
}

.compose__textarea::placeholder { color: var(--text-dim); }
.compose__textarea:focus { outline: none; }

.compose__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.compose__tools {
  display: flex;
  gap: 4px;
}

.compose__tool {
  padding: 7px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
  font-size: 1.1rem;
  cursor: pointer;
  border: none;
  background: none;
}

.compose__tool:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* =====================
   FEED
   ===================== */
.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =====================
   PROFILE
   ===================== */
.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 20px;
}

.profile-header__top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

.profile-header__info h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-header__info .username {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-header__info .bio {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.profile-header__stats {
  display: flex;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat { text-align: center; }

.stat__val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  display: block;
}

.stat__lbl {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* =====================
   GROUPS
   ===================== */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.group-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.group-card__icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.group-card__name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.group-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.group-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group-card__members {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* =====================
   CHAT
   ===================== */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-raised);
}

.chat-sidebar__header {
  padding: 16px;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-raised);
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--border);
}

.conversation-item:hover { background: var(--surface); }
.conversation-item.active { background: var(--accent-dim); }

.conversation-item__info { flex: 1; min-width: 0; }

.conversation-item__name {
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item__preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-window {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-window__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-raised);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 75%;
}

.message--sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message__bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
}

.message--received .message__bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
}

.message--sent .message__bubble {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  border-radius: var(--radius) 4px var(--radius) var(--radius);
}

.message__time {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  align-self: flex-end;
  flex-shrink: 0;
}

.chat-input-bar {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-raised);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
  min-height: 42px;
  transition: border-color var(--t-fast);
}

.chat-input:focus {
  border-color: var(--accent);
  outline: none;
}

.chat-input::placeholder { color: var(--text-dim); }

.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
}

@media (max-width: 640px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-sidebar.open { display: block; }
}

/* =====================
   MODAL
   ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--t-fast);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  margin-bottom: 16px;
}

.modal__title {
  font-weight: 800;
  font-size: 1.05rem;
}

.modal__close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  border: none;
  background: none;
}

.modal__close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal__body { padding: 0 20px 20px; }

/* =====================
   AUTH (login/cadastro)
   ===================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0,191,191,0.08) 0%, transparent 70%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
}

.auth-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.auth-logo span { color: var(--text); }

.auth-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-family: var(--font-mono);
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.auth-toggle a:hover { text-decoration: underline; }

.auth-error {
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--danger);
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible { display: block; }

/* =====================
   EMPTY STATE
   ===================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state__icon { font-size: 3rem; margin-bottom: 12px; }

.empty-state__title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-2);
}

.empty-state__desc { font-size: 0.85rem; margin-bottom: 20px; }

/* =====================
   SKELETON LOADER
   ===================== */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* =====================
   TOAST
   ===================== */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 10px 20px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text);
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease, fadeOut 0.3s ease 2.5s forwards;
  white-space: nowrap;
  pointer-events: auto;
}

.toast--success { border-color: var(--accent); color: var(--accent); }
.toast--error   { border-color: var(--danger); color: var(--danger); }

/* =====================
   DIVIDER
   ===================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* =====================
   BADGE
   ===================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge--accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}

/* =====================
   UTILITIES
   ===================== */
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-mono   { font-family: var(--font-mono); }
.text-sm     { font-size: 0.82rem; }
.text-xs     { font-size: 0.72rem; }
.fw-bold     { font-weight: 700; }
.fw-black    { font-weight: 800; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-12       { margin-top: 12px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =====================
   SETTINGS DROPDOWN
   ===================== */
.settings-menu {
  position: relative;
}

.settings-trigger {
  font-size: 1.1rem;
  padding: 7px 10px !important;
  border-radius: var(--radius-sm);
  color: var(--text-muted) !important;
  background: none !important;
  border: 1px solid transparent !important;
  transition: all var(--t-fast);
}

.settings-trigger:hover {
  color: var(--text) !important;
  background: rgba(255,255,255,0.05) !important;
  border-color: var(--border-2) !important;
}

.settings-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow);
  z-index: 300;
  overflow: hidden;
  animation: slideDown 0.15s ease;
}

.settings-dropdown.open { display: block; }

.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  text-align: left;
}

.settings-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.settings-item--danger { color: var(--danger) !important; }
.settings-item--danger:hover { background: var(--danger-dim) !important; }

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* =====================
   AVATAR UPLOAD
   ===================== */
.avatar-upload-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-upload-wrap--editable {
  cursor: pointer;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.avatar-upload-wrap--editable:hover .avatar-overlay { opacity: 1; }

/* =====================
   AMIGOS
   ===================== */
.search-bar {
  margin-bottom: 24px;
}

.search-bar .input {
  font-size: 0.9rem;
  padding: 12px 16px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.friend-request-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color var(--t-fast);
}

.friend-request-card:hover { border-color: var(--border-2); }

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.friend-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.friend-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.friend-card__name {
  font-weight: 700;
  font-size: 0.88rem;
  margin-top: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.friend-card__username {
  margin-top: 2px;
}

#search-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 24px;
}

/* =====================
   CHAT REDESIGN MOBILE
   ===================== */
.chat-page {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  overflow: hidden;
}

.chat-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-raised);
}

.chat-list-header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-raised);
}

#conversations-list {
  overflow-y: auto;
  flex: 1;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--border);
}

.conv-item:hover { background: var(--surface); }
.conv-item.active { background: var(--accent-dim); }

.conv-item__info { flex: 1; min-width: 0; }

.conv-item__name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-item__name--unread { font-weight: 800; }

.unread-dot {
  background: var(--accent);
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 100px;
  font-family: var(--font-mono);
}

.conv-item__preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__time {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.chat-window-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-window__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-raised);
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}

.chat-back-btn { display: none; }

/* Mobile: um painel de cada vez */
@media (max-width: 640px) {
  .chat-page { grid-template-columns: 1fr; position: relative; }

  .chat-list-panel {
    position: absolute;
    inset: 0;
    z-index: 1;
    transition: transform 0.25s ease;
  }

  .chat-list-panel.chat-panel--hidden {
    transform: translateX(-100%);
  }

  .chat-window-panel {
    position: absolute;
    inset: 0;
    z-index: 2;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  .chat-window-panel.chat-panel--visible {
    transform: translateX(0);
  }

  .chat-back-btn { display: flex !important; }
}

/* =====================
   LIKES — feedback visual
   ===================== */
.action-btn .like-count,
.action-btn .comment-count {
  font-size: 0.78rem;
}

.action-btn[data-action="like"].liked {
  color: #ff6b9d;
}

.action-btn[data-action="like"].liked .icon {
  color: #ff6b9d;
}

/* =====================
   NAVBAR LINK CONTRAST FIX
   ===================== */
.navbar__link {
  color: #b0b0b0 !important;
}
.navbar__link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.07) !important;
}
.navbar__link.active {
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

/* =====================
   MOBILE SETTINGS SHEET
   ===================== */
.mobile-settings-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--surface);
  border-top: 1px solid var(--border-2);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.mobile-settings-sheet.open {
  transform: translateY(0);
}

.mobile-settings-overlay {
  display: none;           /* sempre oculto por padrão */
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 499;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;    /* nunca bloqueia cliques quando fechado */
}

.mobile-settings-overlay.open {
  display: block;          /* só aparece quando aberto */
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .mobile-settings-sheet { display: block; }
  /* overlay NÃO fica visível por padrão — só via .open */
}

.mobile-settings-content {
  padding: 12px 24px 24px;
}

.mobile-settings-handle {
  width: 40px;
  height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.mobile-settings-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.mobile-settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: color var(--t-fast);
}

.mobile-settings-item:hover { color: var(--text); }
.mobile-settings-item--danger { color: var(--danger) !important; }

.mobile-settings-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.mobile-settings-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Garantir que o nav-bottom bottom config apareça */
@media (max-width: 640px) {
  .nav-bottom {
    grid-template-columns: repeat(6, 1fr);
    display: grid;
  }
  .nav-bottom__item { padding: 8px 4px; }
}

/* =====================
   CHAT — MÍDIA E AUDIO
   ===================== */

/* Botão de anexo */
.chat-attach-menu { position: relative; flex-shrink: 0; }

.chat-attach-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.chat-attach-btn:hover { color: var(--accent); border-color: var(--accent); }

.chat-attach-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 140px;
  animation: slideUp 0.15s ease;
  z-index: 50;
}

.attach-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast);
}
.attach-option:hover { background: var(--surface-2); }

/* Botão de áudio */
.chat-audio-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.chat-audio-btn:hover { color: var(--accent); border-color: var(--accent); }
.chat-audio-btn.recording {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 0.8s infinite;
}

/* Indicador de gravação */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--danger-dim);
  border-top: 1px solid var(--danger);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--danger);
}

.rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 0.8s infinite;
  flex-shrink: 0;
}

/* Preview de mídia no chat */
.chat-media-preview {
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-media-preview img {
  max-height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.chat-media-preview button {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  width: 26px; height: 26px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Mensagem — áudio */
.msg-audio {
  width: 100%;
  max-width: 260px;
  height: 36px;
  border-radius: 20px;
  outline: none;
}

/* Mensagem — imagem */
.msg-image {
  max-width: 240px;
  max-height: 300px;
  border-radius: var(--radius);
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Meta da mensagem (hora + reply) */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.msg-reply-btn {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast);
}

.message:hover .msg-reply-btn { opacity: 1; }
.msg-reply-btn:hover { color: var(--accent); }

/* Quote de resposta dentro da bubble */
.msg-reply-quote {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--accent);
  padding: 4px 8px;
  border-left: 2px solid var(--accent);
  background: rgba(0,191,191,0.07);
  border-radius: 0 4px 4px 0;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Banner de resposta acima do input */
.reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--accent-dim);
  border-top: 1px solid var(--accent-glow);
  gap: 10px;
  flex-shrink: 0;
}

.reply-banner__content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.reply-banner__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
}

.reply-banner__text {
  font-size: 0.8rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-banner__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--t-fast);
}
.reply-banner__close:hover { color: var(--text); }

/* msg-text */
.msg-text { display: block; word-break: break-word; }

/* ========================
   PERFIL — ESTILO INSTAGRAM
   ======================== */
.ig-profile {
  padding: 20px 16px 0;
}

.ig-profile__top {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}

/* Avatar grande com overlay de edição */
.ig-profile__avatar-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: default;
}
.ig-profile__avatar-wrap--edit { cursor: pointer; }

.ig-profile__avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-2);
  display: block;
}
div.ig-profile__avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  border: 2px solid var(--accent-dim);
}

.ig-profile__avatar-overlay {
  position: absolute;
  bottom: 0; right: 0;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  border: 2px solid var(--bg);
  pointer-events: none;
}

/* Menu de opções avatar */
.ig-avatar-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 130px;
  z-index: 30;
  animation: slideUp 0.15s ease;
}

.ig-avatar-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--t-fast);
  color: var(--text-2);
}
.ig-avatar-opt:hover { background: var(--surface-2); }

/* Stats */
.ig-profile__stats {
  display: flex;
  gap: 0;
  flex: 1;
  justify-content: space-around;
}

.ig-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

.ig-stat__val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.ig-stat__lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: lowercase;
}

/* Info textual */
.ig-profile__info {
  margin-bottom: 14px;
  line-height: 1.5;
}

.ig-profile__name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.ig-profile__bio {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ig-profile__link {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  display: block;
  margin-top: 2px;
}
.ig-profile__link:hover { text-decoration: underline; }

.ig-profile__extra {
  margin-top: 4px;
}

/* Botões de ação do perfil */
.ig-profile__actions {
  display: flex;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.btn-profile-action {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  font-family: var(--font-sans);
  text-align: center;
}

.btn-profile-primary {
  background: var(--accent);
  color: #000;
}
.btn-profile-primary:hover { filter: brightness(1.1); }

.btn-profile-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-profile-secondary:hover { background: var(--surface-2); }

/* Edit profile photo row */
.edit-profile-photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.edit-profile-photo-row .avatar--lg { flex-shrink: 0; }

/* ========================
   CHAT INPUT — ESTILO IMG 4
   ======================== */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color var(--t-fast);
  padding: 0;
}
.chat-icon-btn:hover { color: var(--accent); }

.chat-input-field {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  padding: 8px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  max-height: 120px;
  transition: border-color var(--t-fast);
  outline: none;
}
.chat-input-field::placeholder { color: var(--text-dim); }
.chat-input-field:focus { border-color: var(--accent-dim); }

.chat-right-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.chat-send-btn:hover { filter: brightness(1.1); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========================
   REPLY — ESTILO IMAGEM 5
   ======================== */
/* Banner acima do input */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.reply-bar__inner {
  flex: 1;
  min-width: 0;
}

.reply-bar__name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  display: block;
  margin-bottom: 2px;
}

.reply-bar__text {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.reply-bar__close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  flex-shrink: 0;
}

/* Bloco de quote dentro da mensagem — estilo imagem 5 */
.msg-quoted {
  margin-bottom: 6px;
  padding: 0 0 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.msg-quoted__sender {
  display: block;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 4px;
}

.msg-quoted__bubble {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: var(--text-2);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer da mensagem (hora + reply btn) */
.msg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.msg-reply-btn {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast);
}
.message:hover .msg-reply-btn { opacity: 1; }
.msg-reply-btn:hover { color: var(--accent); }

/* Outros estilos de msg */
.msg-text { display: block; word-break: break-word; }
.msg-audio { width: 100%; max-width: 240px; height: 36px; border-radius: 20px; outline: none; }
.msg-image { max-width: 220px; max-height: 280px; border-radius: var(--radius); object-fit: cover; display: block; cursor: pointer; }

/* Recording */
.recording-indicator {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  background: var(--danger-dim);
  border-top: 1px solid var(--danger);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--danger);
  flex-shrink: 0;
}
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
  animation: pulse 0.8s infinite;
  flex-shrink: 0;
}

/* Chat media preview */
.chat-media-preview {
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.chat-media-preview img { max-height: 80px; border-radius: var(--radius-sm); object-fit: cover; }
.chat-media-preview button {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; color: var(--text-muted); font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
