@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f6fc;
  --bg-shell: #e9edf9;
  --bg-card: #ffffff;
  --bg-card-hover: #eef0fa;
  --border: #e1e5f4;
  --text: #0f172a;
  --text-dim: #64748b;
  --accent: #0066ff;
  --accent-dim: #0066ff1a;
  --accent-ink: #0f172a;
  --teal: #8a2be2;
  --teal-dim: #8a2be21a;
  --orange: #ff8a00;
  --orange-dim: #ff8a001a;
  --pink: #ff2d6f;
  --pink-dim: #ff2d6f1a;
  --green: #16a34a;
  --green-dim: #16a34a1a;
  --red: #dc2626;
  --red-dim: #dc26261a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 8px 20px -6px rgba(15, 23, 42, .12), 0 2px 6px -2px rgba(15, 23, 42, .06);
  --shadow-lg: 0 16px 36px -12px rgba(15, 23, 42, .18);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1221;
    --bg-shell: #080c17;
    --bg-card: #1a2438;
    --bg-card-hover: #212d47;
    --border: #2d3a56;
    --text: #eef1fa;
    --text-dim: #94a3b8;
    --accent: #3b82f6;
    --accent-dim: #3b82f626;
    --accent-ink: #eef1fa;
    --teal: #a78bfa;
    --teal-dim: #a78bfa26;
    --orange: #ffa733;
    --orange-dim: #ffa73326;
    --pink: #ff6b9d;
    --pink-dim: #ff6b9d26;
    --green: #4ade80;
    --green-dim: #4ade8026;
    --red: #f87171;
    --red-dim: #f8717126;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 36px -12px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-shell);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Sora', 'Inter', sans-serif; letter-spacing: -.01em; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.mg-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.mg-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.mg-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 20px;
  padding: 6px 10px 26px;
  color: var(--accent-ink);
}
.mg-sidebar .brand img { border-radius: 8px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.mg-sidebar .brand .dot { color: var(--accent); }

.mg-sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.mg-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  position: relative;
  transition: background .15s, color .15s;
}
.mg-sidebar nav a .ic { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.mg-sidebar nav a:hover { background: var(--bg-card-hover); color: var(--text); text-decoration: none; }
.mg-sidebar nav a.ativo { background: var(--accent-dim); color: var(--accent-ink); }
.mg-sidebar nav a.ativo::before {
  content: '';
  position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--pink));
}

.mg-main { flex: 1; min-width: 0; background: var(--bg); }

.topo-pagina {
  padding: 20px 36px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.topo-pagina h1 { font-size: 20px; margin: 0; }
.topo-pagina .subtitulo { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }

.container { max-width: 1440px; width: 100%; margin: 0 auto; padding: 28px 40px 64px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
a.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  text-decoration: none;
}

.mg-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}
.mg-rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 92px; }
.mg-rail .card { margin-bottom: 0; }
.mg-rail h3 { font-size: 14.5px; margin: 0 0 12px; }
@media (max-width: 980px) {
  .mg-content-grid { grid-template-columns: 1fr; }
  .mg-rail { position: static; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 4px; }
.stat .valor { font-size: 23px; font-weight: 800; color: var(--accent-ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 9px 17px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: filter .15s, transform .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; transform: translateY(-1px); }
.btn.secundario { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.secundario:hover { background: var(--bg-card-hover); }
.btn.teal { background: var(--teal); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--teal) 55%, transparent); }
.btn.perigo { background: var(--red); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--red) 55%, transparent); }
.btn.pequeno { padding: 5px 11px; font-size: 12.5px; }
.btn-curtir { background: transparent; border: 1px solid var(--border); color: var(--text-dim); box-shadow: none; }
.btn-curtir.curtido { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-ink); }

.comentarios-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.comentario-item { display: flex; gap: 8px; font-size: 13.5px; }
.comentario-item .bolha { background: var(--bg); border-radius: 10px; padding: 6px 12px; flex: 1; }
.comentario-form { display: flex; gap: 8px; margin-top: 10px; }
.comentario-form input { flex: 1; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.escola, .badge.match { background: var(--teal-dim); color: var(--teal); }
.badge.bairro { background: var(--green-dim); color: var(--green); }
.badge.memoria { background: var(--orange-dim); color: var(--orange); }
.badge.empresa, .badge.lugar { background: var(--pink-dim); color: var(--pink); }
.badge.interesse { background: var(--accent-dim); color: var(--accent); }

.erro { background: var(--red-dim); color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.sucesso { background: var(--green-dim); color: var(--green); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }

.match-destaque {
  background: linear-gradient(135deg, var(--accent-dim), var(--teal-dim) 55%, var(--pink-dim));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}
.match-destaque .numero { font-size: 34px; font-weight: 800; color: var(--accent-ink); font-family: 'Sora', sans-serif; }

.busca-hero { padding: 24px 26px; }
.busca-form { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 5px 6px 5px 18px; }
.busca-form .ic { font-size: 18px; color: var(--text-dim); flex-shrink: 0; }
.busca-form input[type=text] { border: none; background: transparent; padding: 11px 6px; font-size: 15.5px; width: 100%; }
.busca-form input[type=text]:focus { outline: none; }
.busca-form .btn { flex-shrink: 0; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.chip-row .label { font-size: 12.5px; color: var(--text-dim); }
.chip { display: inline-flex; padding: 6px 14px; border-radius: 999px; background: var(--bg-card-hover); color: var(--text); font-size: 13px; font-weight: 600; border: 1px solid var(--border); transition: background .15s, color .15s; }
.chip:hover { background: var(--accent-dim); color: var(--accent-ink); text-decoration: none; }

.busca-abas { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.busca-abas button { background: transparent; border: none; padding: 9px 16px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--text-dim); cursor: pointer; font-family: inherit; }
.busca-abas button:hover { background: var(--bg-card-hover); }
.busca-abas button.ativo { background: var(--accent-dim); color: var(--accent-ink); }

.grid-pessoas { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.pessoa-mini { text-align: center; padding: 16px 8px; border-radius: 12px; text-decoration: none; color: inherit; transition: background .15s; }
.pessoa-mini:hover { background: var(--bg-card-hover); text-decoration: none; }
.pessoa-mini img, .pessoa-mini .fallback { width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 9px; object-fit: cover; }
.pessoa-mini .fallback { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-dim); font-size: 20px; }
.pessoa-mini .nome { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pessoa-mini .local { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.grid-comunidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.comunidade-mini { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; background: var(--bg-card); box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s; }
.comunidade-mini:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.comunidade-mini .capa { height: 80px; background-size: cover; background-position: center; background-color: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; }
.comunidade-mini .capa span { font-size: 26px; font-weight: 800; color: var(--text-dim); }
.comunidade-mini .corpo { padding: 12px 14px 14px; }
.comunidade-mini .nome { font-weight: 700; font-size: 14px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comunidade-mini .desc { font-size: 12px; color: var(--text-dim); margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.perfil-capa { padding: 0 0 18px; overflow: hidden; }
.perfil-banner { height: 108px; background: linear-gradient(120deg, var(--accent) 0%, var(--teal) 55%, var(--pink) 100%); margin: -20px -20px 0; }
.perfil-header { display: flex; gap: 18px; align-items: flex-end; padding: 0 22px; margin-top: -40px; }
.perfil-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg-card); box-shadow: var(--shadow-md); flex-shrink: 0; }
.perfil-avatar-fallback { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; color: var(--text-dim); }
.perfil-header h2 { font-family: 'Sora', sans-serif; }
.perfil-header > div:nth-child(2) { padding-bottom: 6px; }
.perfil-header .acoes { padding-bottom: 6px; }
.perfil-stats { display: flex; gap: 22px; padding: 16px 22px 0; margin-top: 14px; border-top: 1px solid var(--border); }
.perfil-stat { color: var(--text); font-size: 13px; }
.perfil-stat:hover { text-decoration: none; color: var(--accent-ink); }
.perfil-stat strong { font-family: 'Sora', sans-serif; font-size: 15px; margin-right: 4px; }

.notif-wrap { position: relative; flex-shrink: 0; }
.notif-sino {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.notif-sino:hover { background: var(--accent-dim); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 800;
  min-width: 17px; height: 17px; padding: 0 3px;
  border-radius: 999px; border: 2px solid var(--bg-card);
  display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
  display: none;
  position: absolute; right: 0; top: 50px;
  width: 340px; max-height: 440px; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
}
.notif-dropdown.aberto { display: block; }
.notif-dropdown-head { padding: 13px 16px; font-weight: 700; font-size: 14px; font-family: 'Sora', sans-serif; border-bottom: 1px solid var(--border); }
.notif-item { display: flex; gap: 10px; padding: 11px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-item:hover { background: var(--bg-card-hover); text-decoration: none; }
.notif-item.nao-lida { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-item img, .notif-item .fallback { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.notif-item .fallback { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-dim); }
.notif-item .hora { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.notif-vazio { padding: 26px 16px; text-align: center; color: var(--text-dim); font-size: 13px; }
.notif-ver-todas { display: block; text-align: center; padding: 11px; font-size: 13px; font-weight: 700; border-top: 1px solid var(--border); }

.memorias-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.memoria-card { border-radius: 16px; overflow: hidden; background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s; display: flex; flex-direction: column; }
.memoria-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.memoria-card .capa { display: block; height: 180px; background-size: cover; background-position: center; background-color: var(--bg-card-hover); }
.memoria-card .capa.sem-foto { background-image: linear-gradient(135deg, var(--accent), var(--teal) 55%, var(--pink)); display: flex; align-items: center; justify-content: center; }
.memoria-card .capa.sem-foto span { font-size: 64px; font-family: Georgia, serif; color: rgba(255,255,255,.5); line-height: 1; }
.memoria-card .corpo { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.memoria-card .autor-linha { display: flex; align-items: center; gap: 8px; }
.memoria-card .autor-linha img, .memoria-card .autor-linha .fallback { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.memoria-card .autor-linha .fallback { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: var(--text-dim); }
.memoria-card .autor-linha .nome-data { font-size: 12px; line-height: 1.3; min-width: 0; }
.memoria-card .autor-linha .nome { font-weight: 700; color: var(--text); }
.memoria-card .autor-linha .data { color: var(--text-dim); }
.memoria-card .titulo { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15px; margin: 0; }
.memoria-card .trecho { font-size: 13px; color: var(--text-dim); margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memoria-card .rodape { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }

.conquistas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.conquista-item { text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--bg-card-hover); }
.conquista-item .icone { font-size: 24px; margin-bottom: 4px; }
.conquista-item .nome { font-size: 10.5px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.enquete { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.enquete-opcao { margin: 0; }
.enquete-btn {
  position: relative; width: 100%; text-align: left;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; overflow: hidden; font: inherit;
  display: flex; justify-content: space-between; align-items: center;
  transition: border-color .15s;
}
.enquete-barra { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-dim); z-index: 0; transition: width .3s; }
.enquete-label, .enquete-pct { position: relative; z-index: 1; font-size: 13.5px; }
.enquete-label { font-weight: 600; }
.enquete-pct { color: var(--text-dim); font-weight: 700; }
.enquete-opcao.votada .enquete-btn { border-color: var(--accent); }
.enquete-total { font-size: 12px; color: var(--text-dim); text-align: right; }

.conversa-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; text-decoration: none; color: inherit; }
.conversa-item:hover { background: var(--bg-card-hover); text-decoration: none; }
.conversa-item.ativa { background: var(--accent-dim); }
.conversa-item img, .conversa-item .fallback { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.conversa-item .fallback { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-dim); }

.msg-bolha { max-width: 72%; padding: 9px 13px; border-radius: 14px; background: var(--bg-card-hover); font-size: 13.5px; align-self: flex-start; }
.msg-bolha.minha { background: var(--accent); color: #fff; align-self: flex-end; }
.msg-hora { font-size: 10.5px; opacity: .65; margin-top: 3px; text-align: right; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 36px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-box h1 { text-align: center; margin-bottom: 4px; color: var(--accent-ink); font-family: 'Sora', sans-serif; }
.login-box .subtitulo { text-align: center; margin-bottom: 24px; color: var(--text-dim); font-size: 14px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 6px; }
